mirror of
https://github.com/corda/corda.git
synced 2025-02-01 08:48:09 +00:00
apply jnienv + java-common changes
This commit is contained in:
parent
9c93c5989c
commit
1da8170c66
@ -33,21 +33,34 @@ typedef jint jsize;
|
|||||||
|
|
||||||
typedef object* jobject;
|
typedef object* jobject;
|
||||||
|
|
||||||
typedef jobject jclass;
|
class GcString;
|
||||||
typedef jobject jthrowable;
|
class GcJclass;
|
||||||
typedef jobject jstring;
|
class GcThrowable;
|
||||||
|
class GcBooleanArray;
|
||||||
|
class GcByteArray;
|
||||||
|
class GcCharArray;
|
||||||
|
class GcShortArray;
|
||||||
|
class GcIntArray;
|
||||||
|
class GcLongArray;
|
||||||
|
class GcFloatArray;
|
||||||
|
class GcDoubleArray;
|
||||||
|
class GcObjectArray;
|
||||||
|
|
||||||
|
typedef GcJclass** jclass;
|
||||||
|
typedef GcThrowable** jthrowable;
|
||||||
|
typedef GcString** jstring;
|
||||||
typedef jobject jweak;
|
typedef jobject jweak;
|
||||||
|
|
||||||
typedef jobject jarray;
|
typedef jobject jarray;
|
||||||
typedef jarray jbooleanArray;
|
typedef GcBooleanArray** jbooleanArray;
|
||||||
typedef jarray jbyteArray;
|
typedef GcByteArray** jbyteArray;
|
||||||
typedef jarray jcharArray;
|
typedef GcCharArray** jcharArray;
|
||||||
typedef jarray jshortArray;
|
typedef GcShortArray** jshortArray;
|
||||||
typedef jarray jintArray;
|
typedef GcIntArray** jintArray;
|
||||||
typedef jarray jlongArray;
|
typedef GcLongArray** jlongArray;
|
||||||
typedef jarray jfloatArray;
|
typedef GcFloatArray** jfloatArray;
|
||||||
typedef jarray jdoubleArray;
|
typedef GcDoubleArray** jdoubleArray;
|
||||||
typedef jarray jobjectArray;
|
typedef GcObjectArray** jobjectArray;
|
||||||
|
|
||||||
typedef uintptr_t jfieldID;
|
typedef uintptr_t jfieldID;
|
||||||
typedef uintptr_t jmethodID;
|
typedef uintptr_t jmethodID;
|
||||||
|
@ -711,7 +711,7 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
|
|||||||
Avian_sun_misc_Unsafe_arrayIndexScale
|
Avian_sun_misc_Unsafe_arrayIndexScale
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
GcClass* c = cast<GcClass>(t, jclassVmClass(t, reinterpret_cast<object>(arguments[1])));
|
GcClass* c = cast<GcJclass>(t, reinterpret_cast<object>(arguments[1]))->vmClass();
|
||||||
|
|
||||||
if (c == type(t, GcBooleanArray::Type)
|
if (c == type(t, GcBooleanArray::Type)
|
||||||
|| c == type(t, GcByteArray::Type))
|
|| c == type(t, GcByteArray::Type))
|
||||||
|
@ -112,7 +112,7 @@ makeMethodOrConstructor(Thread* t, GcJclass* c, unsigned index)
|
|||||||
PROTECT(t, c);
|
PROTECT(t, c);
|
||||||
|
|
||||||
GcMethod* method = cast<GcMethod>(t, arrayBody
|
GcMethod* method = cast<GcMethod>(t, arrayBody
|
||||||
(t, classMethodTable(t, c->vmClass()), index));
|
(t, c->vmClass()->methodTable(), index));
|
||||||
PROTECT(t, method);
|
PROTECT(t, method);
|
||||||
|
|
||||||
unsigned parameterCount;
|
unsigned parameterCount;
|
||||||
@ -153,7 +153,7 @@ makeField(Thread* t, GcJclass* c, unsigned index)
|
|||||||
PROTECT(t, c);
|
PROTECT(t, c);
|
||||||
|
|
||||||
GcField* field = cast<GcField>(t, arrayBody
|
GcField* field = cast<GcField>(t, arrayBody
|
||||||
(t, classFieldTable(t, c->vmClass()), index));
|
(t, c->vmClass()->fieldTable(), index));
|
||||||
|
|
||||||
PROTECT(t, field);
|
PROTECT(t, field);
|
||||||
|
|
||||||
@ -327,12 +327,10 @@ class MyClasspath : public Classpath {
|
|||||||
{
|
{
|
||||||
return cast<GcMethod>(t, objectClass(t, jmethod) == type(t, GcJmethod::Type)
|
return cast<GcMethod>(t, objectClass(t, jmethod) == type(t, GcJmethod::Type)
|
||||||
? arrayBody
|
? arrayBody
|
||||||
(t, classMethodTable
|
(t, jclassVmClass(t, jmethodDeclaringClass(t, jmethod))->methodTable(),
|
||||||
(t, jclassVmClass(t, jmethodDeclaringClass(t, jmethod))),
|
|
||||||
jmethodSlot(t, jmethod))
|
jmethodSlot(t, jmethod))
|
||||||
: arrayBody
|
: arrayBody
|
||||||
(t, classMethodTable
|
(t,jclassVmClass(t, jconstructorDeclaringClass(t, jmethod))->methodTable(),
|
||||||
(t, jclassVmClass(t, jconstructorDeclaringClass(t, jmethod))),
|
|
||||||
jconstructorSlot(t, jmethod)));
|
jconstructorSlot(t, jmethod)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,8 +350,7 @@ class MyClasspath : public Classpath {
|
|||||||
getVMField(Thread* t, object jfield)
|
getVMField(Thread* t, object jfield)
|
||||||
{
|
{
|
||||||
return cast<GcField>(t, arrayBody
|
return cast<GcField>(t, arrayBody
|
||||||
(t, classFieldTable
|
(t, jclassVmClass(t, jfieldDeclaringClass(t, jfield))->fieldTable(),
|
||||||
(t, jclassVmClass(t, jfieldDeclaringClass(t, jfield))),
|
|
||||||
jfieldSlot(t, jfield)));
|
jfieldSlot(t, jfield)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1088,9 +1085,9 @@ Avian_java_lang_Class_getInterfaces
|
|||||||
{
|
{
|
||||||
GcJclass* c = cast<GcJclass>(t, reinterpret_cast<object>(arguments[0]));
|
GcJclass* c = cast<GcJclass>(t, reinterpret_cast<object>(arguments[0]));
|
||||||
|
|
||||||
object addendum = classAddendum(t, c->vmClass());
|
GcClassAddendum* addendum = c->vmClass()->addendum();
|
||||||
if (addendum) {
|
if (addendum) {
|
||||||
object table = classAddendumInterfaceTable(t, addendum);
|
object table = addendum->interfaceTable();
|
||||||
if (table) {
|
if (table) {
|
||||||
PROTECT(t, table);
|
PROTECT(t, table);
|
||||||
|
|
||||||
@ -1116,7 +1113,7 @@ Avian_java_lang_Class_getDeclaredClasses
|
|||||||
{
|
{
|
||||||
return reinterpret_cast<intptr_t>
|
return reinterpret_cast<intptr_t>
|
||||||
(getDeclaredClasses
|
(getDeclaredClasses
|
||||||
(t, cast<GcClass>(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))),
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0])),
|
||||||
arguments[1]));
|
arguments[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1126,26 +1123,26 @@ Avian_java_lang_Class_getDeclaringClass
|
|||||||
{
|
{
|
||||||
return reinterpret_cast<intptr_t>
|
return reinterpret_cast<intptr_t>
|
||||||
(getDeclaringClass
|
(getDeclaringClass
|
||||||
(t, cast<GcClass>(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0])))));
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||||
Avian_java_lang_Class_getEnclosingMethod
|
Avian_java_lang_Class_getEnclosingMethod
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
object c = jclassVmClass(t, reinterpret_cast<object>(arguments[0]));
|
GcClass* c = jclassVmClass(t, reinterpret_cast<object>(arguments[0]));
|
||||||
PROTECT(t, c);
|
PROTECT(t, c);
|
||||||
|
|
||||||
object addendum = classAddendum(t, c);
|
GcClassAddendum* addendum = c->addendum();
|
||||||
if (addendum) {
|
if (addendum) {
|
||||||
object enclosingClass = classAddendumEnclosingClass(t, addendum);
|
object enclosingClass = addendum->enclosingClass();
|
||||||
if (enclosingClass) {
|
if (enclosingClass) {
|
||||||
PROTECT(t, enclosingClass);
|
PROTECT(t, enclosingClass);
|
||||||
|
|
||||||
// enclosingClass = getJClass
|
// enclosingClass = getJClass
|
||||||
// (t, resolveClass(t, classLoader(t, c), enclosingClass));
|
// (t, resolveClass(t, classLoader(t, c), enclosingClass));
|
||||||
|
|
||||||
object enclosingMethod = classAddendumEnclosingMethod(t, addendum);
|
object enclosingMethod = addendum->enclosingMethod();
|
||||||
if (enclosingMethod) {
|
if (enclosingMethod) {
|
||||||
PROTECT(t, enclosingMethod);
|
PROTECT(t, enclosingMethod);
|
||||||
|
|
||||||
@ -1177,7 +1174,7 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
|
|||||||
Avian_java_lang_Class_newInstanceImpl
|
Avian_java_lang_Class_newInstanceImpl
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
GcClass* c = cast<GcClass>(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0])));
|
GcClass* c = jclassVmClass(t, reinterpret_cast<object>(arguments[0]));
|
||||||
|
|
||||||
GcMethod* method = resolveMethod(t, c, "<init>", "()V");
|
GcMethod* method = resolveMethod(t, c, "<init>", "()V");
|
||||||
PROTECT(t, method);
|
PROTECT(t, method);
|
||||||
@ -1196,15 +1193,15 @@ Avian_java_lang_Class_getComponentType
|
|||||||
{
|
{
|
||||||
GcJclass* c = cast<GcJclass>(t, reinterpret_cast<object>(arguments[0]));
|
GcJclass* c = cast<GcJclass>(t, reinterpret_cast<object>(arguments[0]));
|
||||||
|
|
||||||
if (classArrayDimensions(t, c->vmClass())) {
|
if (c->vmClass()->arrayDimensions()) {
|
||||||
uint8_t n = byteArrayBody(t, className(t, c->vmClass()), 1);
|
uint8_t n = c->vmClass()->name()->body()[1];
|
||||||
if (n != 'L' and n != '[') {
|
if (n != 'L' and n != '[') {
|
||||||
return reinterpret_cast<uintptr_t>
|
return reinterpret_cast<uintptr_t>
|
||||||
(getJClass(t, primitiveClass(t, n)));
|
(getJClass(t, primitiveClass(t, n)));
|
||||||
} else {
|
} else {
|
||||||
return reinterpret_cast<uintptr_t>
|
return reinterpret_cast<uintptr_t>
|
||||||
(getJClass(t, cast<GcClass>(t, classArrayElementClass(t, c->vmClass()))));
|
(getJClass(t, c->vmClass()->arrayElementClass()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1405,8 +1402,7 @@ Avian_sun_misc_Unsafe_objectFieldOffset
|
|||||||
object jfield = reinterpret_cast<object>(arguments[1]);
|
object jfield = reinterpret_cast<object>(arguments[1]);
|
||||||
return fieldOffset
|
return fieldOffset
|
||||||
(t, arrayBody
|
(t, arrayBody
|
||||||
(t, classFieldTable
|
(t, jclassVmClass(t, jfieldDeclaringClass(t, jfield))->fieldTable(),
|
||||||
(t, jclassVmClass(t, jfieldDeclaringClass(t, jfield))),
|
|
||||||
jfieldSlot(t, jfield)));
|
jfieldSlot(t, jfield)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1711,18 +1707,18 @@ Avian_java_lang_Class_getModifiers
|
|||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
return classModifiers
|
return classModifiers
|
||||||
(t, cast<GcClass>(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))));
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||||
Avian_java_lang_Class_getSuperclass
|
Avian_java_lang_Class_getSuperclass
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
object c = jclassVmClass(t, reinterpret_cast<object>(arguments[0]));
|
GcClass* c = jclassVmClass(t, reinterpret_cast<object>(arguments[0]));
|
||||||
if (classFlags(t, c) & ACC_INTERFACE) {
|
if (c->flags() & ACC_INTERFACE) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
GcClass* s = cast<GcClass>(t, classSuper(t, c));
|
GcClass* s = c->super();
|
||||||
return s ? reinterpret_cast<uintptr_t>(getJClass(t, s)) : 0;
|
return s ? reinterpret_cast<uintptr_t>(getJClass(t, s)) : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1738,12 +1734,11 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
|
|||||||
Avian_java_lang_Class_getNameNative
|
Avian_java_lang_Class_getNameNative
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
object name = className
|
GcByteArray* name = jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->name();
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0])));
|
|
||||||
|
|
||||||
THREAD_RUNTIME_ARRAY(t, char, s, byteArrayLength(t, name));
|
THREAD_RUNTIME_ARRAY(t, char, s, name->length());
|
||||||
replace('/', '.', RUNTIME_ARRAY_BODY(s),
|
replace('/', '.', RUNTIME_ARRAY_BODY(s),
|
||||||
reinterpret_cast<char*>(&byteArrayBody(t, name, 0)));
|
reinterpret_cast<char*>(name->body().begin()));
|
||||||
|
|
||||||
return reinterpret_cast<uintptr_t>
|
return reinterpret_cast<uintptr_t>
|
||||||
(makeString(t, "%s", RUNTIME_ARRAY_BODY(s)));
|
(makeString(t, "%s", RUNTIME_ARRAY_BODY(s)));
|
||||||
@ -1753,8 +1748,7 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
|
|||||||
Avian_java_lang_Class_isInterface
|
Avian_java_lang_Class_isInterface
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
return (classFlags
|
return (jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->flags()
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0])))
|
|
||||||
& ACC_INTERFACE) != 0;
|
& ACC_INTERFACE) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1762,8 +1756,7 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
|
|||||||
Avian_java_lang_Class_isPrimitive
|
Avian_java_lang_Class_isPrimitive
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
return (classVmFlags
|
return (jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->vmFlags()
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0])))
|
|
||||||
& PrimitiveFlag) != 0;
|
& PrimitiveFlag) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1771,11 +1764,10 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
|
|||||||
Avian_java_lang_Class_isAnonymousClass
|
Avian_java_lang_Class_isAnonymousClass
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
object name = className
|
GcByteArray* name = jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->name();
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0])));
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < byteArrayLength(t, name) - 1; ++i) {
|
for (unsigned i = 0; i < name->length() - 1; ++i) {
|
||||||
int c = byteArrayBody(t, name, i);
|
int c = name->body()[i];
|
||||||
if (c != '$' and (c < '0' or c > '9')) {
|
if (c != '$' and (c < '0' or c > '9')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1789,8 +1781,7 @@ Avian_java_lang_Class_getClassLoader
|
|||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<uintptr_t>
|
return reinterpret_cast<uintptr_t>
|
||||||
(classLoader
|
(jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->loader());
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||||
@ -1802,7 +1793,7 @@ Avian_java_lang_Class_isAssignableFrom
|
|||||||
|
|
||||||
if (LIKELY(that)) {
|
if (LIKELY(that)) {
|
||||||
return isAssignableFrom
|
return isAssignableFrom
|
||||||
(t, cast<GcClass>(t, jclassVmClass(t, this_)), cast<GcClass>(t, jclassVmClass(t, that)));
|
(t, jclassVmClass(t, this_), jclassVmClass(t, that));
|
||||||
} else {
|
} else {
|
||||||
throwNew(t, GcNullPointerException::Type);
|
throwNew(t, GcNullPointerException::Type);
|
||||||
}
|
}
|
||||||
@ -1816,7 +1807,7 @@ Avian_java_lang_Class_isInstance
|
|||||||
object o = reinterpret_cast<object>(arguments[1]);
|
object o = reinterpret_cast<object>(arguments[1]);
|
||||||
|
|
||||||
if (o) {
|
if (o) {
|
||||||
return instanceOf(t, cast<GcClass>(t, jclassVmClass(t, this_)), o);
|
return instanceOf(t, jclassVmClass(t, this_), o);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1863,8 +1854,7 @@ Avian_java_lang_reflect_Method_invokeNative
|
|||||||
object instance = reinterpret_cast<object>(arguments[1]);
|
object instance = reinterpret_cast<object>(arguments[1]);
|
||||||
object args = reinterpret_cast<object>(arguments[2]);
|
object args = reinterpret_cast<object>(arguments[2]);
|
||||||
GcMethod* method = cast<GcMethod>(t, arrayBody
|
GcMethod* method = cast<GcMethod>(t, arrayBody
|
||||||
(t, classMethodTable
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[3]))->methodTable(),
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[3]))),
|
|
||||||
arguments[6]));
|
arguments[6]));
|
||||||
|
|
||||||
return reinterpret_cast<uintptr_t>(invoke(t, method, instance, args));
|
return reinterpret_cast<uintptr_t>(invoke(t, method, instance, args));
|
||||||
@ -1876,8 +1866,7 @@ Avian_java_lang_reflect_Method_getMethodModifiers
|
|||||||
{
|
{
|
||||||
return methodFlags
|
return methodFlags
|
||||||
(t, arrayBody
|
(t, arrayBody
|
||||||
(t, classMethodTable
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->methodTable(),
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))),
|
|
||||||
arguments[1]));
|
arguments[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1886,8 +1875,7 @@ Avian_java_lang_reflect_Method_isAnnotationPresent
|
|||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
object method = arrayBody
|
object method = arrayBody
|
||||||
(t, classMethodTable
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->methodTable(),
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))),
|
|
||||||
arguments[1]);
|
arguments[1]);
|
||||||
|
|
||||||
object addendum = methodAddendum(t, method);
|
object addendum = methodAddendum(t, method);
|
||||||
@ -1912,8 +1900,7 @@ Avian_java_lang_reflect_Method_getAnnotation
|
|||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
object method = arrayBody
|
object method = arrayBody
|
||||||
(t, classMethodTable
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->methodTable(),
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))),
|
|
||||||
arguments[1]);
|
arguments[1]);
|
||||||
|
|
||||||
object addendum = methodAddendum(t, method);
|
object addendum = methodAddendum(t, method);
|
||||||
@ -1949,8 +1936,7 @@ Avian_java_lang_reflect_Method_getDeclaredAnnotations
|
|||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
object method = arrayBody
|
object method = arrayBody
|
||||||
(t, classMethodTable
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->methodTable(),
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))),
|
|
||||||
arguments[1]);
|
arguments[1]);
|
||||||
|
|
||||||
object addendum = methodAddendum(t, method);
|
object addendum = methodAddendum(t, method);
|
||||||
@ -1998,8 +1984,7 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
|
|||||||
{
|
{
|
||||||
GcField* field = cast<GcField>(t, arrayBody(
|
GcField* field = cast<GcField>(t, arrayBody(
|
||||||
t,
|
t,
|
||||||
classFieldTable(
|
jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->fieldTable(),
|
||||||
t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))),
|
|
||||||
arguments[1]));
|
arguments[1]));
|
||||||
|
|
||||||
object addendum = reinterpret_cast<object>(field->addendum());
|
object addendum = reinterpret_cast<object>(field->addendum());
|
||||||
@ -2052,8 +2037,7 @@ Avian_java_lang_reflect_Method_getDefaultValue
|
|||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
object method = arrayBody
|
object method = arrayBody
|
||||||
(t, classMethodTable
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[1]))->methodTable(),
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[1]))),
|
|
||||||
arguments[2]);
|
arguments[2]);
|
||||||
|
|
||||||
object addendum = methodAddendum(t, method);
|
object addendum = methodAddendum(t, method);
|
||||||
@ -2079,7 +2063,7 @@ Avian_java_lang_reflect_Constructor_constructNative
|
|||||||
object args = reinterpret_cast<object>(arguments[1]);
|
object args = reinterpret_cast<object>(arguments[1]);
|
||||||
PROTECT(t, args);
|
PROTECT(t, args);
|
||||||
|
|
||||||
GcClass* c = cast<GcClass>(t, jclassVmClass(t, reinterpret_cast<object>(arguments[2])));
|
GcClass* c = jclassVmClass(t, reinterpret_cast<object>(arguments[2]));
|
||||||
PROTECT(t, c);
|
PROTECT(t, c);
|
||||||
|
|
||||||
initClass(t, c);
|
initClass(t, c);
|
||||||
@ -2100,8 +2084,7 @@ Avian_java_lang_reflect_Field_getField
|
|||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
GcField* field = cast<GcField>(t, arrayBody
|
GcField* field = cast<GcField>(t, arrayBody
|
||||||
(t, classFieldTable
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[2]))->fieldTable(),
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[2]))),
|
|
||||||
arguments[4]));
|
arguments[4]));
|
||||||
|
|
||||||
PROTECT(t, field);
|
PROTECT(t, field);
|
||||||
@ -2117,8 +2100,7 @@ Avian_java_lang_reflect_Field_getIField
|
|||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
GcField* field = cast<GcField>(t, arrayBody
|
GcField* field = cast<GcField>(t, arrayBody
|
||||||
(t, classFieldTable
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[2]))->fieldTable(),
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[2]))),
|
|
||||||
arguments[4]));
|
arguments[4]));
|
||||||
|
|
||||||
PROTECT(t, field);
|
PROTECT(t, field);
|
||||||
@ -2134,8 +2116,7 @@ Avian_java_lang_reflect_Field_getJField
|
|||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
GcField* field = cast<GcField>(t, arrayBody
|
GcField* field = cast<GcField>(t, arrayBody
|
||||||
(t, classFieldTable
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[2]))->fieldTable(),
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[2]))),
|
|
||||||
arguments[4]));
|
arguments[4]));
|
||||||
|
|
||||||
PROTECT(t, field);
|
PROTECT(t, field);
|
||||||
@ -2151,8 +2132,7 @@ Avian_java_lang_reflect_Field_setField
|
|||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
GcField* field = cast<GcField>(t, arrayBody
|
GcField* field = cast<GcField>(t, arrayBody
|
||||||
(t, classFieldTable
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[2]))->fieldTable(),
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[2]))),
|
|
||||||
arguments[4]));
|
arguments[4]));
|
||||||
|
|
||||||
PROTECT(t, field);
|
PROTECT(t, field);
|
||||||
@ -2171,8 +2151,7 @@ Avian_java_lang_reflect_Field_setIField
|
|||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
GcField* field = cast<GcField>(t, arrayBody
|
GcField* field = cast<GcField>(t, arrayBody
|
||||||
(t, classFieldTable
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[2]))->fieldTable(),
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[2]))),
|
|
||||||
arguments[4]));
|
arguments[4]));
|
||||||
|
|
||||||
object instance = reinterpret_cast<object>(arguments[1]);
|
object instance = reinterpret_cast<object>(arguments[1]);
|
||||||
@ -2189,8 +2168,7 @@ Avian_java_lang_reflect_Field_getFieldModifiers
|
|||||||
{
|
{
|
||||||
return fieldFlags
|
return fieldFlags
|
||||||
(t, arrayBody
|
(t, arrayBody
|
||||||
(t, classFieldTable
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[1]))->fieldTable(),
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[1]))),
|
|
||||||
arguments[2]));
|
arguments[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2199,8 +2177,7 @@ Avian_java_lang_reflect_Field_getAnnotation
|
|||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
GcField* field = cast<GcField>(t, arrayBody
|
GcField* field = cast<GcField>(t, arrayBody
|
||||||
(t, classFieldTable
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))->fieldTable(),
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))),
|
|
||||||
arguments[1]));
|
arguments[1]));
|
||||||
|
|
||||||
object addendum = reinterpret_cast<object>(field->addendum());
|
object addendum = reinterpret_cast<object>(field->addendum());
|
||||||
@ -2236,8 +2213,7 @@ Avian_java_lang_reflect_Field_getSignatureAnnotation
|
|||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
GcField* field = cast<GcField>(t, arrayBody
|
GcField* field = cast<GcField>(t, arrayBody
|
||||||
(t, classFieldTable
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[1]))->fieldTable(),
|
||||||
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[1]))),
|
|
||||||
arguments[2]));
|
arguments[2]));
|
||||||
|
|
||||||
object addendum = reinterpret_cast<object>(field->addendum());
|
object addendum = reinterpret_cast<object>(field->addendum());
|
||||||
@ -2298,7 +2274,7 @@ Avian_java_lang_reflect_Array_createObjectArray
|
|||||||
{
|
{
|
||||||
return reinterpret_cast<uintptr_t>
|
return reinterpret_cast<uintptr_t>
|
||||||
(makeObjectArray
|
(makeObjectArray
|
||||||
(t, cast<GcClass>(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0]))),
|
(t, jclassVmClass(t, reinterpret_cast<object>(arguments[0])),
|
||||||
arguments[1]));
|
arguments[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2313,7 +2289,7 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
|
|||||||
Avian_dalvik_system_VMRuntime_newNonMovableArray
|
Avian_dalvik_system_VMRuntime_newNonMovableArray
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
if (cast<GcClass>(t, jclassVmClass(t, reinterpret_cast<object>(arguments[1])))
|
if (jclassVmClass(t, reinterpret_cast<object>(arguments[1]))
|
||||||
== type(t, GcJbyte::Type))
|
== type(t, GcJbyte::Type))
|
||||||
{
|
{
|
||||||
object array = allocate3
|
object array = allocate3
|
||||||
|
@ -593,12 +593,10 @@ class MyClasspath : public Classpath {
|
|||||||
{
|
{
|
||||||
return cast<GcMethod>(t, objectClass(t, jmethod) == type(t, GcJmethod::Type)
|
return cast<GcMethod>(t, objectClass(t, jmethod) == type(t, GcJmethod::Type)
|
||||||
? arrayBody
|
? arrayBody
|
||||||
(t, classMethodTable
|
(t, jclassVmClass(t, jmethodClazz(t, jmethod))->methodTable(),
|
||||||
(t, jclassVmClass(t, jmethodClazz(t, jmethod))),
|
|
||||||
jmethodSlot(t, jmethod))
|
jmethodSlot(t, jmethod))
|
||||||
: arrayBody
|
: arrayBody
|
||||||
(t, classMethodTable
|
(t, jclassVmClass(t, jconstructorClazz(t, jmethod))->methodTable(),
|
||||||
(t, jclassVmClass(t, jconstructorClazz(t, jmethod))),
|
|
||||||
jconstructorSlot(t, jmethod)));
|
jconstructorSlot(t, jmethod)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -612,8 +610,7 @@ class MyClasspath : public Classpath {
|
|||||||
getVMField(Thread* t, object jfield)
|
getVMField(Thread* t, object jfield)
|
||||||
{
|
{
|
||||||
return cast<GcField>(t, arrayBody
|
return cast<GcField>(t, arrayBody
|
||||||
(t, classFieldTable
|
(t, jclassVmClass(t, jfieldClazz(t, jfield))->fieldTable(), jfieldSlot(t, jfield)));
|
||||||
(t, jclassVmClass(t, jfieldClazz(t, jfield))), jfieldSlot(t, jfield)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
@ -2103,23 +2100,23 @@ interceptFileOperations(Thread* t, bool updateRuntimeData)
|
|||||||
#endif // AVIAN_OPENJDK_SRC
|
#endif // AVIAN_OPENJDK_SRC
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
classDeclaredMethodCount(Thread* t, object c)
|
classDeclaredMethodCount(Thread* t, GcClass* c)
|
||||||
{
|
{
|
||||||
object addendum = classAddendum(t, c);
|
GcClassAddendum* addendum = c->addendum();
|
||||||
if (addendum) {
|
if (addendum) {
|
||||||
int count = classAddendumDeclaredMethodCount(t, addendum);
|
int count = addendum->declaredMethodCount();
|
||||||
if (count >= 0) {
|
if (count >= 0) {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
object table = classMethodTable(t, c);
|
object table = c->methodTable();
|
||||||
return table == 0 ? 0 : arrayLength(t, table);
|
return table == 0 ? 0 : arrayLength(t, table);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
countMethods(Thread* t, object c, bool publicOnly)
|
countMethods(Thread* t, GcClass* c, bool publicOnly)
|
||||||
{
|
{
|
||||||
object table = classMethodTable(t, c);
|
object table = c->methodTable();
|
||||||
unsigned count = 0;
|
unsigned count = 0;
|
||||||
for (unsigned i = 0, j = classDeclaredMethodCount(t, c); i < j; ++i) {
|
for (unsigned i = 0, j = classDeclaredMethodCount(t, c); i < j; ++i) {
|
||||||
GcMethod* vmMethod = cast<GcMethod>(t, arrayBody(t, table, i));
|
GcMethod* vmMethod = cast<GcMethod>(t, arrayBody(t, table, i));
|
||||||
@ -2133,9 +2130,9 @@ countMethods(Thread* t, object c, bool publicOnly)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
countFields(Thread* t, object c, bool publicOnly)
|
countFields(Thread* t, GcClass* c, bool publicOnly)
|
||||||
{
|
{
|
||||||
object table = classFieldTable(t, c);
|
object table = c->fieldTable();
|
||||||
if (publicOnly) {
|
if (publicOnly) {
|
||||||
unsigned count = 0;
|
unsigned count = 0;
|
||||||
for (unsigned i = 0; i < arrayLength(t, table); ++i) {
|
for (unsigned i = 0; i < arrayLength(t, table); ++i) {
|
||||||
@ -2151,9 +2148,9 @@ countFields(Thread* t, object c, bool publicOnly)
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
countConstructors(Thread* t, object c, bool publicOnly)
|
countConstructors(Thread* t, GcClass* c, bool publicOnly)
|
||||||
{
|
{
|
||||||
object table = classMethodTable(t, c);
|
object table = c->methodTable();
|
||||||
unsigned count = 0;
|
unsigned count = 0;
|
||||||
for (unsigned i = 0, j = classDeclaredMethodCount(t, c); i < j; ++i) {
|
for (unsigned i = 0, j = classDeclaredMethodCount(t, c); i < j; ++i) {
|
||||||
GcMethod* vmMethod = cast<GcMethod>(t, arrayBody(t, table, i));
|
GcMethod* vmMethod = cast<GcMethod>(t, arrayBody(t, table, i));
|
||||||
@ -2516,12 +2513,12 @@ extern "C" AVIAN_EXPORT int64_t JNICALL
|
|||||||
Avian_java_lang_Class_getSuperclass
|
Avian_java_lang_Class_getSuperclass
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
object class_ = jclassVmClass(t, reinterpret_cast<object>(arguments[0]));
|
GcClass* class_ = jclassVmClass(t, reinterpret_cast<object>(arguments[0]));
|
||||||
if (classFlags(t, class_) & ACC_INTERFACE) {
|
if (class_->flags() & ACC_INTERFACE) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
object super = classSuper(t, class_);
|
GcClass* super = class_->super();
|
||||||
return super ? reinterpret_cast<int64_t>(getJClass(t, cast<GcClass>(t, super))) : 0;
|
return super ? reinterpret_cast<int64_t>(getJClass(t, super)) : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2583,7 +2580,7 @@ extern "C" AVIAN_EXPORT int64_t
|
|||||||
Avian_sun_misc_Unsafe_allocateInstance
|
Avian_sun_misc_Unsafe_allocateInstance
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
GcClass* c = cast<GcClass>(t, jclassVmClass(t, reinterpret_cast<object>(arguments[1])));
|
GcClass* c = jclassVmClass(t, reinterpret_cast<object>(arguments[1]));
|
||||||
PROTECT(t, c);
|
PROTECT(t, c);
|
||||||
|
|
||||||
initClass(t, c);
|
initClass(t, c);
|
||||||
@ -2598,8 +2595,7 @@ Avian_sun_misc_Unsafe_staticFieldOffset
|
|||||||
object jfield = reinterpret_cast<object>(arguments[1]);
|
object jfield = reinterpret_cast<object>(arguments[1]);
|
||||||
return fieldOffset
|
return fieldOffset
|
||||||
(t, arrayBody
|
(t, arrayBody
|
||||||
(t, classFieldTable
|
(t, jclassVmClass(t, jfieldClazz(t, jfield))->fieldTable(), jfieldSlot(t, jfield)));
|
||||||
(t, jclassVmClass(t, jfieldClazz(t, jfield))), jfieldSlot(t, jfield)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||||
@ -2607,9 +2603,8 @@ Avian_sun_misc_Unsafe_staticFieldBase
|
|||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<int64_t>
|
return reinterpret_cast<int64_t>
|
||||||
(classStaticTable
|
(jclassVmClass
|
||||||
(t, jclassVmClass
|
(t, jfieldClazz(t, reinterpret_cast<object>(arguments[1])))->staticTable());
|
||||||
(t, jfieldClazz(t, reinterpret_cast<object>(arguments[1])))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||||
@ -2619,8 +2614,7 @@ Avian_sun_misc_Unsafe_objectFieldOffset
|
|||||||
object jfield = reinterpret_cast<object>(arguments[1]);
|
object jfield = reinterpret_cast<object>(arguments[1]);
|
||||||
return fieldOffset
|
return fieldOffset
|
||||||
(t, arrayBody
|
(t, arrayBody
|
||||||
(t, classFieldTable
|
(t, jclassVmClass(t, jfieldClazz(t, jfield))->fieldTable(), jfieldSlot(t, jfield)));
|
||||||
(t, jclassVmClass(t, jfieldClazz(t, jfield))), jfieldSlot(t, jfield)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT int64_t JNICALL
|
extern "C" AVIAN_EXPORT int64_t JNICALL
|
||||||
@ -2787,7 +2781,7 @@ extern "C" AVIAN_EXPORT void JNICALL
|
|||||||
Avian_sun_misc_Unsafe_ensureClassInitialized
|
Avian_sun_misc_Unsafe_ensureClassInitialized
|
||||||
(Thread* t, object, uintptr_t* arguments)
|
(Thread* t, object, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
initClass(t, cast<GcClass>(t, jclassVmClass(t, reinterpret_cast<object>(arguments[1]))));
|
initClass(t, jclassVmClass(t, reinterpret_cast<object>(arguments[1])));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT void JNICALL
|
extern "C" AVIAN_EXPORT void JNICALL
|
||||||
@ -2908,7 +2902,7 @@ EXPORT(JVM_InternString)(Thread* t, jstring s)
|
|||||||
{
|
{
|
||||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(s) };
|
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(s) };
|
||||||
|
|
||||||
return reinterpret_cast<jobject>(run(t, jvmInternString, arguments));
|
return reinterpret_cast<jstring>(run(t, jvmInternString, arguments));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT jlong JNICALL
|
extern "C" AVIAN_EXPORT jlong JNICALL
|
||||||
@ -3425,7 +3419,7 @@ jvmDumpThreads(Thread* t, uintptr_t* arguments)
|
|||||||
{
|
{
|
||||||
jobjectArray threads = reinterpret_cast<jobjectArray>(arguments[0]);
|
jobjectArray threads = reinterpret_cast<jobjectArray>(arguments[0]);
|
||||||
|
|
||||||
unsigned threadsLength = objectArrayLength(t, *threads);
|
unsigned threadsLength = objectArrayLength(t, reinterpret_cast<object>(*threads));
|
||||||
GcClass* arrayClass = resolveObjectArrayClass
|
GcClass* arrayClass = resolveObjectArrayClass
|
||||||
(t, type(t, GcStackTraceElement::Type)->loader(),
|
(t, type(t, GcStackTraceElement::Type)->loader(),
|
||||||
type(t, GcStackTraceElement::Type));
|
type(t, GcStackTraceElement::Type));
|
||||||
@ -3436,7 +3430,7 @@ jvmDumpThreads(Thread* t, uintptr_t* arguments)
|
|||||||
++ threadsIndex)
|
++ threadsIndex)
|
||||||
{
|
{
|
||||||
Thread* peer = reinterpret_cast<Thread*>
|
Thread* peer = reinterpret_cast<Thread*>
|
||||||
(threadPeer(t, objectArrayBody(t, *threads, threadsIndex)));
|
(cast<GcThread>(t, objectArrayBody(t, reinterpret_cast<object>(*threads), threadsIndex))->peer());
|
||||||
|
|
||||||
if (peer) {
|
if (peer) {
|
||||||
object trace = t->m->processor->getStackTrace(t, peer);
|
object trace = t->m->processor->getStackTrace(t, peer);
|
||||||
@ -3523,8 +3517,8 @@ jvmGetSystemPackage(Thread* t, uintptr_t* arguments)
|
|||||||
|
|
||||||
ACQUIRE(t, t->m->classLock);
|
ACQUIRE(t, t->m->classLock);
|
||||||
|
|
||||||
THREAD_RUNTIME_ARRAY(t, char, chars, cast<GcString>(t, *s)->length(t) + 1);
|
THREAD_RUNTIME_ARRAY(t, char, chars, (*s)->length(t) + 1);
|
||||||
stringChars(t, cast<GcString>(t, *s), RUNTIME_ARRAY_BODY(chars));
|
stringChars(t, *s, RUNTIME_ARRAY_BODY(chars));
|
||||||
|
|
||||||
object key = reinterpret_cast<object>(makeByteArray(t, RUNTIME_ARRAY_BODY(chars)));
|
object key = reinterpret_cast<object>(makeByteArray(t, RUNTIME_ARRAY_BODY(chars)));
|
||||||
|
|
||||||
@ -3763,7 +3757,7 @@ jvmNewArray(Thread* t, uintptr_t* arguments)
|
|||||||
|
|
||||||
return reinterpret_cast<uint64_t>
|
return reinterpret_cast<uint64_t>
|
||||||
(makeLocalReference
|
(makeLocalReference
|
||||||
(t, makeNewArray(t, jclassVmClass(t, *elementClass), length)));
|
(t, makeNewArray(t, reinterpret_cast<object>((*elementClass)->vmClass()), length)));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT jobject JNICALL
|
extern "C" AVIAN_EXPORT jobject JNICALL
|
||||||
@ -3781,9 +3775,9 @@ jvmNewMultiArray(Thread* t, uintptr_t* arguments)
|
|||||||
jclass elementClass = reinterpret_cast<jclass>(arguments[0]);
|
jclass elementClass = reinterpret_cast<jclass>(arguments[0]);
|
||||||
jintArray dimensions = reinterpret_cast<jintArray>(arguments[1]);
|
jintArray dimensions = reinterpret_cast<jintArray>(arguments[1]);
|
||||||
|
|
||||||
THREAD_RUNTIME_ARRAY(t, int32_t, counts, intArrayLength(t, *dimensions));
|
THREAD_RUNTIME_ARRAY(t, int32_t, counts, (*dimensions)->length());
|
||||||
for (int i = intArrayLength(t, *dimensions) - 1; i >= 0; --i) {
|
for (int i = (*dimensions)->length() - 1; i >= 0; --i) {
|
||||||
RUNTIME_ARRAY_BODY(counts)[i] = intArrayBody(t, *dimensions, i);
|
RUNTIME_ARRAY_BODY(counts)[i] = (*dimensions)->body()[i];
|
||||||
if (UNLIKELY(RUNTIME_ARRAY_BODY(counts)[i] < 0)) {
|
if (UNLIKELY(RUNTIME_ARRAY_BODY(counts)[i] < 0)) {
|
||||||
throwNew(t, GcNegativeArraySizeException::Type, "%d",
|
throwNew(t, GcNegativeArraySizeException::Type, "%d",
|
||||||
RUNTIME_ARRAY_BODY(counts)[i]);
|
RUNTIME_ARRAY_BODY(counts)[i]);
|
||||||
@ -3792,11 +3786,11 @@ jvmNewMultiArray(Thread* t, uintptr_t* arguments)
|
|||||||
}
|
}
|
||||||
|
|
||||||
object array = makeNewArray
|
object array = makeNewArray
|
||||||
(t, jclassVmClass(t, *elementClass), RUNTIME_ARRAY_BODY(counts)[0]);
|
(t, reinterpret_cast<object>((*elementClass)->vmClass()), RUNTIME_ARRAY_BODY(counts)[0]);
|
||||||
PROTECT(t, array);
|
PROTECT(t, array);
|
||||||
|
|
||||||
populateMultiArray(t, array, RUNTIME_ARRAY_BODY(counts), 0,
|
populateMultiArray(t, array, RUNTIME_ARRAY_BODY(counts), 0,
|
||||||
intArrayLength(t, *dimensions));
|
(*dimensions)->length());
|
||||||
|
|
||||||
return reinterpret_cast<uint64_t>(makeLocalReference(t, array));
|
return reinterpret_cast<uint64_t>(makeLocalReference(t, array));
|
||||||
}
|
}
|
||||||
@ -3818,8 +3812,8 @@ EXPORT(JVM_GetCallerClass)(Thread* t, int target)
|
|||||||
|
|
||||||
GcMethod* method = getCaller(t, target, true);
|
GcMethod* method = getCaller(t, target, true);
|
||||||
|
|
||||||
return method ? makeLocalReference
|
return method ? reinterpret_cast<jclass>(makeLocalReference
|
||||||
(t, reinterpret_cast<object>(getJClass(t, method->class_()))) : 0;
|
(t, reinterpret_cast<object>(getJClass(t, method->class_())))) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT jclass JNICALL
|
extern "C" AVIAN_EXPORT jclass JNICALL
|
||||||
@ -3830,33 +3824,33 @@ EXPORT(JVM_FindPrimitiveClass)(Thread* t, const char* name)
|
|||||||
switch (*name) {
|
switch (*name) {
|
||||||
case 'b':
|
case 'b':
|
||||||
if (name[1] == 'o') {
|
if (name[1] == 'o') {
|
||||||
return makeLocalReference
|
return reinterpret_cast<jclass>(makeLocalReference
|
||||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJboolean::Type))));
|
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJboolean::Type)))));
|
||||||
} else {
|
} else {
|
||||||
return makeLocalReference
|
return reinterpret_cast<jclass>(makeLocalReference
|
||||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJbyte::Type))));
|
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJbyte::Type)))));
|
||||||
}
|
}
|
||||||
case 'c':
|
case 'c':
|
||||||
return makeLocalReference
|
return reinterpret_cast<jclass>(makeLocalReference
|
||||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJchar::Type))));
|
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJchar::Type)))));
|
||||||
case 'd':
|
case 'd':
|
||||||
return makeLocalReference
|
return reinterpret_cast<jclass>(makeLocalReference
|
||||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJdouble::Type))));
|
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJdouble::Type)))));
|
||||||
case 'f':
|
case 'f':
|
||||||
return makeLocalReference
|
return reinterpret_cast<jclass>(makeLocalReference
|
||||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJfloat::Type))));
|
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJfloat::Type)))));
|
||||||
case 'i':
|
case 'i':
|
||||||
return makeLocalReference
|
return reinterpret_cast<jclass>(makeLocalReference
|
||||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJint::Type))));
|
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJint::Type)))));
|
||||||
case 'l':
|
case 'l':
|
||||||
return makeLocalReference
|
return reinterpret_cast<jclass>(makeLocalReference
|
||||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJlong::Type))));
|
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJlong::Type)))));
|
||||||
case 's':
|
case 's':
|
||||||
return makeLocalReference
|
return reinterpret_cast<jclass>(makeLocalReference
|
||||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJshort::Type))));
|
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJshort::Type)))));
|
||||||
case 'v':
|
case 'v':
|
||||||
return makeLocalReference
|
return reinterpret_cast<jclass>(makeLocalReference
|
||||||
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJvoid::Type))));
|
(t, reinterpret_cast<object>(getJClass(t, type(t, GcJvoid::Type)))));
|
||||||
default:
|
default:
|
||||||
throwNew(t, GcIllegalArgumentException::Type);
|
throwNew(t, GcIllegalArgumentException::Type);
|
||||||
}
|
}
|
||||||
@ -3871,7 +3865,7 @@ jvmResolveClass(Thread* t, uintptr_t* arguments)
|
|||||||
(t, cast<GcClassLoader>(t, root(t, Machine::BootLoader)), "avian/Classes", "link",
|
(t, cast<GcClassLoader>(t, root(t, Machine::BootLoader)), "avian/Classes", "link",
|
||||||
"(Lavian/VMClass;)V");
|
"(Lavian/VMClass;)V");
|
||||||
|
|
||||||
t->m->processor->invoke(t, method, 0, jclassVmClass(t, *c));
|
t->m->processor->invoke(t, method, 0, (*c)->vmClass());
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -3936,10 +3930,10 @@ jvmFindLoadedClass(Thread* t, uintptr_t* arguments)
|
|||||||
jobject loader = reinterpret_cast<jobject>(arguments[0]);
|
jobject loader = reinterpret_cast<jobject>(arguments[0]);
|
||||||
jstring name = reinterpret_cast<jstring>(arguments[1]);
|
jstring name = reinterpret_cast<jstring>(arguments[1]);
|
||||||
|
|
||||||
GcByteArray* spec = makeByteArray(t, cast<GcString>(t, *name)->length(t) + 1);
|
GcByteArray* spec = makeByteArray(t, (*name)->length(t) + 1);
|
||||||
|
|
||||||
{ char* s = reinterpret_cast<char*>(spec->body().begin());
|
{ char* s = reinterpret_cast<char*>(spec->body().begin());
|
||||||
stringChars(t, cast<GcString>(t, *name), s);
|
stringChars(t, (*name), s);
|
||||||
replace('.', '/', s);
|
replace('.', '/', s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4002,7 +3996,7 @@ EXPORT(JVM_GetClassName)(Thread* t, jclass c)
|
|||||||
{
|
{
|
||||||
ENTER(t, Thread::ActiveState);
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
return makeLocalReference(t, jclassName(t, *c));
|
return reinterpret_cast<jstring>(makeLocalReference(t, reinterpret_cast<object>((*c)->name())));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
@ -4010,9 +4004,9 @@ jvmGetClassInterfaces(Thread* t, uintptr_t* arguments)
|
|||||||
{
|
{
|
||||||
jclass c = reinterpret_cast<jclass>(arguments[0]);
|
jclass c = reinterpret_cast<jclass>(arguments[0]);
|
||||||
|
|
||||||
object addendum = classAddendum(t, jclassVmClass(t, *c));
|
GcClassAddendum* addendum = (*c)->vmClass()->addendum();
|
||||||
if (addendum) {
|
if (addendum) {
|
||||||
object table = classAddendumInterfaceTable(t, addendum);
|
object table = addendum->interfaceTable();
|
||||||
if (table) {
|
if (table) {
|
||||||
PROTECT(t, table);
|
PROTECT(t, table);
|
||||||
|
|
||||||
@ -4039,7 +4033,7 @@ EXPORT(JVM_GetClassInterfaces)(Thread* t, jclass c)
|
|||||||
{
|
{
|
||||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(c) };
|
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(c) };
|
||||||
|
|
||||||
return reinterpret_cast<jclass>(run(t, jvmGetClassInterfaces, arguments));
|
return reinterpret_cast<jobjectArray>(run(t, jvmGetClassInterfaces, arguments));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT jobject JNICALL
|
extern "C" AVIAN_EXPORT jobject JNICALL
|
||||||
@ -4047,7 +4041,7 @@ EXPORT(JVM_GetClassLoader)(Thread* t, jclass c)
|
|||||||
{
|
{
|
||||||
ENTER(t, Thread::ActiveState);
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
GcClassLoader* loader = cast<GcClassLoader>(t, classLoader(t, jclassVmClass(t, *c)));
|
GcClassLoader* loader = (*c)->vmClass()->loader();
|
||||||
|
|
||||||
if (loader == cast<GcClassLoader>(t, root(t, Machine::BootLoader))) {
|
if (loader == cast<GcClassLoader>(t, root(t, Machine::BootLoader))) {
|
||||||
// sun.misc.Unsafe.getUnsafe expects a null result if the class
|
// sun.misc.Unsafe.getUnsafe expects a null result if the class
|
||||||
@ -4073,7 +4067,7 @@ EXPORT(JVM_IsInterface)(Thread* t, jclass c)
|
|||||||
{
|
{
|
||||||
ENTER(t, Thread::ActiveState);
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
return (classFlags(t, jclassVmClass(t, *c)) & ACC_INTERFACE) != 0;
|
return ((*c)->vmClass()->flags() & ACC_INTERFACE) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT jobjectArray JNICALL
|
extern "C" AVIAN_EXPORT jobjectArray JNICALL
|
||||||
@ -4081,10 +4075,10 @@ EXPORT(JVM_GetClassSigners)(Thread* t, jclass c)
|
|||||||
{
|
{
|
||||||
ENTER(t, Thread::ActiveState);
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
object runtimeData = getClassRuntimeDataIfExists(t, cast<GcClass>(t, jclassVmClass(t, *c)));
|
object runtimeData = getClassRuntimeDataIfExists(t, (*c)->vmClass());
|
||||||
|
|
||||||
return runtimeData ? makeLocalReference
|
return runtimeData ? reinterpret_cast<jobjectArray>(makeLocalReference
|
||||||
(t, classRuntimeDataSigners(t, runtimeData)) : 0;
|
(t, classRuntimeDataSigners(t, runtimeData))) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT jbyteArray JNICALL
|
extern "C" AVIAN_EXPORT jbyteArray JNICALL
|
||||||
@ -4110,9 +4104,9 @@ EXPORT(JVM_SetClassSigners)(Thread* t, jclass c, jobjectArray signers)
|
|||||||
{
|
{
|
||||||
ENTER(t, Thread::ActiveState);
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
GcClassRuntimeData* runtimeData = getClassRuntimeData(t, cast<GcClass>(t, jclassVmClass(t, *c)));
|
GcClassRuntimeData* runtimeData = getClassRuntimeData(t, (*c)->vmClass());
|
||||||
|
|
||||||
set(t, reinterpret_cast<object>(runtimeData), ClassRuntimeDataSigners, *signers);
|
set(t, reinterpret_cast<object>(runtimeData), ClassRuntimeDataSigners, reinterpret_cast<object>(*signers));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
@ -4126,7 +4120,7 @@ jvmGetProtectionDomain(Thread* t, uintptr_t* arguments)
|
|||||||
|
|
||||||
return reinterpret_cast<uint64_t>
|
return reinterpret_cast<uint64_t>
|
||||||
(makeLocalReference
|
(makeLocalReference
|
||||||
(t, t->m->processor->invoke(t, method, 0, jclassVmClass(t, *c))));
|
(t, t->m->processor->invoke(t, method, 0, (*c)->vmClass())));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT jobject JNICALL
|
extern "C" AVIAN_EXPORT jobject JNICALL
|
||||||
@ -4145,7 +4139,7 @@ EXPORT(JVM_IsArrayClass)(Thread* t, jclass c)
|
|||||||
{
|
{
|
||||||
ENTER(t, Thread::ActiveState);
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
return classArrayDimensions(t, jclassVmClass(t, *c)) != 0;
|
return (*c)->vmClass()->arrayDimensions() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT jboolean JNICALL
|
extern "C" AVIAN_EXPORT jboolean JNICALL
|
||||||
@ -4153,23 +4147,23 @@ EXPORT(JVM_IsPrimitiveClass)(Thread* t, jclass c)
|
|||||||
{
|
{
|
||||||
ENTER(t, Thread::ActiveState);
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
return (classVmFlags(t, jclassVmClass(t, *c)) & PrimitiveFlag) != 0;
|
return ((*c)->vmClass()->vmFlags() & PrimitiveFlag) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
jvmGetComponentType(Thread* t, uintptr_t* arguments)
|
jvmGetComponentType(Thread* t, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
jclass c = reinterpret_cast<jobject>(arguments[0]);
|
jclass c = reinterpret_cast<jclass>(arguments[0]);
|
||||||
|
|
||||||
if (classArrayDimensions(t, jclassVmClass(t, *c))) {
|
if ((*c)->vmClass()->arrayDimensions()) {
|
||||||
uint8_t n = byteArrayBody(t, className(t, jclassVmClass(t, *c)), 1);
|
uint8_t n = (*c)->vmClass()->name()->body()[1];
|
||||||
if (n != 'L' and n != '[') {
|
if (n != 'L' and n != '[') {
|
||||||
return reinterpret_cast<uintptr_t>
|
return reinterpret_cast<uintptr_t>
|
||||||
(makeLocalReference(t, reinterpret_cast<object>(getJClass(t, primitiveClass(t, n)))));
|
(makeLocalReference(t, reinterpret_cast<object>(getJClass(t, primitiveClass(t, n)))));
|
||||||
} else {
|
} else {
|
||||||
return reinterpret_cast<uintptr_t>
|
return reinterpret_cast<uintptr_t>
|
||||||
(makeLocalReference
|
(makeLocalReference
|
||||||
(t, reinterpret_cast<object>(getJClass(t, cast<GcClass>(t, classArrayElementClass(t, jclassVmClass(t, *c)))))));
|
(t, reinterpret_cast<object>(getJClass(t, (*c)->vmClass()->arrayElementClass()))));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
@ -4188,7 +4182,7 @@ uint64_t
|
|||||||
jvmGetClassModifiers(Thread* t, uintptr_t* arguments)
|
jvmGetClassModifiers(Thread* t, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
return classModifiers
|
return classModifiers
|
||||||
(t, cast<GcClass>(t, jclassVmClass(t, *reinterpret_cast<jobject>(arguments[0]))));
|
(t, jclassVmClass(t, *reinterpret_cast<jobject>(arguments[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT jint JNICALL
|
extern "C" AVIAN_EXPORT jint JNICALL
|
||||||
@ -4205,7 +4199,7 @@ jvmGetDeclaredClasses(Thread* t, uintptr_t* arguments)
|
|||||||
return reinterpret_cast<uintptr_t>
|
return reinterpret_cast<uintptr_t>
|
||||||
(makeLocalReference
|
(makeLocalReference
|
||||||
(t, getDeclaredClasses
|
(t, getDeclaredClasses
|
||||||
(t, cast<GcClass>(t, jclassVmClass(t, *reinterpret_cast<jobject>(arguments[0]))), false)));
|
(t, jclassVmClass(t, *reinterpret_cast<jobject>(arguments[0])), false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT jobjectArray JNICALL
|
extern "C" AVIAN_EXPORT jobjectArray JNICALL
|
||||||
@ -4213,7 +4207,7 @@ EXPORT(JVM_GetDeclaredClasses)(Thread* t, jclass c)
|
|||||||
{
|
{
|
||||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(c) };
|
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(c) };
|
||||||
|
|
||||||
return reinterpret_cast<jclass>(run(t, jvmGetDeclaredClasses, arguments));
|
return reinterpret_cast<jobjectArray>(run(t, jvmGetDeclaredClasses, arguments));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
@ -4222,7 +4216,7 @@ jvmGetDeclaringClass(Thread* t, uintptr_t* arguments)
|
|||||||
return reinterpret_cast<uintptr_t>
|
return reinterpret_cast<uintptr_t>
|
||||||
(makeLocalReference
|
(makeLocalReference
|
||||||
(t, reinterpret_cast<object>(getDeclaringClass
|
(t, reinterpret_cast<object>(getDeclaringClass
|
||||||
(t, cast<GcClass>(t, jclassVmClass(t, *reinterpret_cast<jobject>(arguments[0])))))));
|
(t, jclassVmClass(t, *reinterpret_cast<jobject>(arguments[0]))))));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT jclass JNICALL
|
extern "C" AVIAN_EXPORT jclass JNICALL
|
||||||
@ -4236,11 +4230,11 @@ EXPORT(JVM_GetDeclaringClass)(Thread* t, jclass c)
|
|||||||
uint64_t
|
uint64_t
|
||||||
jvmGetClassSignature(Thread* t, uintptr_t* arguments)
|
jvmGetClassSignature(Thread* t, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
jclass c = reinterpret_cast<jobject>(arguments[0]);
|
jclass c = reinterpret_cast<jclass>(arguments[0]);
|
||||||
|
|
||||||
object addendum = classAddendum(t, jclassVmClass(t, *c));
|
GcClassAddendum* addendum = (*c)->vmClass()->addendum();
|
||||||
if (addendum) {
|
if (addendum) {
|
||||||
object signature = addendumSignature(t, addendum);
|
object signature = addendum->signature();
|
||||||
if (signature) {
|
if (signature) {
|
||||||
return reinterpret_cast<uintptr_t>
|
return reinterpret_cast<uintptr_t>
|
||||||
(makeLocalReference
|
(makeLocalReference
|
||||||
@ -4256,7 +4250,7 @@ EXPORT(JVM_GetClassSignature)(Thread* t, jclass c)
|
|||||||
{
|
{
|
||||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(c) };
|
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(c) };
|
||||||
|
|
||||||
return reinterpret_cast<jclass>(run(t, jvmGetClassSignature, arguments));
|
return reinterpret_cast<jstring>(run(t, jvmGetClassSignature, arguments));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT jbyteArray JNICALL
|
extern "C" AVIAN_EXPORT jbyteArray JNICALL
|
||||||
@ -4264,9 +4258,9 @@ EXPORT(JVM_GetClassAnnotations)(Thread* t, jclass c)
|
|||||||
{
|
{
|
||||||
ENTER(t, Thread::ActiveState);
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
object addendum = classAddendum(t, jclassVmClass(t, *c));
|
GcClassAddendum* addendum = (*c)->vmClass()->addendum();
|
||||||
return addendum
|
return addendum
|
||||||
? makeLocalReference(t, addendumAnnotationTable(t, addendum)) : 0;
|
? reinterpret_cast<jbyteArray>(makeLocalReference(t, addendum->annotationTable())) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
@ -4275,17 +4269,17 @@ jvmGetClassDeclaredMethods(Thread* t, uintptr_t* arguments)
|
|||||||
jclass c = reinterpret_cast<jclass>(arguments[0]);
|
jclass c = reinterpret_cast<jclass>(arguments[0]);
|
||||||
jboolean publicOnly = arguments[1];
|
jboolean publicOnly = arguments[1];
|
||||||
|
|
||||||
object table = classMethodTable(t, jclassVmClass(t, *c));
|
object table = (*c)->vmClass()->methodTable();
|
||||||
if (table) {
|
if (table) {
|
||||||
PROTECT(t, table);
|
PROTECT(t, table);
|
||||||
|
|
||||||
object array = makeObjectArray
|
object array = makeObjectArray
|
||||||
(t, type(t, GcJmethod::Type),
|
(t, type(t, GcJmethod::Type),
|
||||||
local::countMethods(t, jclassVmClass(t, *c), publicOnly));
|
local::countMethods(t, (*c)->vmClass(), publicOnly));
|
||||||
PROTECT(t, array);
|
PROTECT(t, array);
|
||||||
|
|
||||||
unsigned ai = 0;
|
unsigned ai = 0;
|
||||||
for (unsigned i = 0, j = classDeclaredMethodCount(t, jclassVmClass(t, *c));
|
for (unsigned i = 0, j = classDeclaredMethodCount(t, (*c)->vmClass());
|
||||||
i < j; ++i)
|
i < j; ++i)
|
||||||
{
|
{
|
||||||
GcMethod* vmMethod = cast<GcMethod>(t, arrayBody(t, table, i));
|
GcMethod* vmMethod = cast<GcMethod>(t, arrayBody(t, table, i));
|
||||||
@ -4324,13 +4318,13 @@ jvmGetClassDeclaredFields(Thread* t, uintptr_t* arguments)
|
|||||||
{
|
{
|
||||||
jclass c = reinterpret_cast<jclass>(arguments[0]);
|
jclass c = reinterpret_cast<jclass>(arguments[0]);
|
||||||
jboolean publicOnly = arguments[1];
|
jboolean publicOnly = arguments[1];
|
||||||
object table = classFieldTable(t, jclassVmClass(t, *c));
|
object table = (*c)->vmClass()->fieldTable();
|
||||||
if (table) {
|
if (table) {
|
||||||
PROTECT(t, table);
|
PROTECT(t, table);
|
||||||
|
|
||||||
object array = makeObjectArray
|
object array = makeObjectArray
|
||||||
(t, type(t, GcJfield::Type),
|
(t, type(t, GcJfield::Type),
|
||||||
local::countFields(t, jclassVmClass(t, *c), publicOnly));
|
local::countFields(t, (*c)->vmClass(), publicOnly));
|
||||||
PROTECT(t, array);
|
PROTECT(t, array);
|
||||||
|
|
||||||
unsigned ai = 0;
|
unsigned ai = 0;
|
||||||
@ -4371,17 +4365,17 @@ jvmGetClassDeclaredConstructors(Thread* t, uintptr_t* arguments)
|
|||||||
jclass c = reinterpret_cast<jclass>(arguments[0]);
|
jclass c = reinterpret_cast<jclass>(arguments[0]);
|
||||||
jboolean publicOnly = arguments[1];
|
jboolean publicOnly = arguments[1];
|
||||||
|
|
||||||
object table = classMethodTable(t, jclassVmClass(t, *c));
|
object table = (*c)->vmClass()->methodTable();
|
||||||
if (table) {
|
if (table) {
|
||||||
PROTECT(t, table);
|
PROTECT(t, table);
|
||||||
|
|
||||||
object array = makeObjectArray
|
object array = makeObjectArray
|
||||||
(t, type(t, GcJconstructor::Type),
|
(t, type(t, GcJconstructor::Type),
|
||||||
local::countConstructors(t, jclassVmClass(t, *c), publicOnly));
|
local::countConstructors(t, (*c)->vmClass(), publicOnly));
|
||||||
PROTECT(t, array);
|
PROTECT(t, array);
|
||||||
|
|
||||||
unsigned ai = 0;
|
unsigned ai = 0;
|
||||||
for (unsigned i = 0, j = classDeclaredMethodCount(t, jclassVmClass(t, *c));
|
for (unsigned i = 0, j = classDeclaredMethodCount(t, (*c)->vmClass());
|
||||||
i < j; ++i)
|
i < j; ++i)
|
||||||
{
|
{
|
||||||
GcMethod* vmMethod = cast<GcMethod>(t, arrayBody(t, table, i));
|
GcMethod* vmMethod = cast<GcMethod>(t, arrayBody(t, table, i));
|
||||||
@ -4423,7 +4417,7 @@ EXPORT(JVM_GetClassAccessFlags)(Thread* t, jclass c)
|
|||||||
{
|
{
|
||||||
ENTER(t, Thread::ActiveState);
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
return classFlags(t, jclassVmClass(t, *c));
|
return (*c)->vmClass()->flags();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
@ -4434,8 +4428,7 @@ jvmInvokeMethod(Thread* t, uintptr_t* arguments)
|
|||||||
jobjectArray args = reinterpret_cast<jobjectArray>(arguments[2]);
|
jobjectArray args = reinterpret_cast<jobjectArray>(arguments[2]);
|
||||||
|
|
||||||
GcMethod* vmMethod = cast<GcMethod>(t, arrayBody
|
GcMethod* vmMethod = cast<GcMethod>(t, arrayBody
|
||||||
(t, classMethodTable
|
(t, jclassVmClass(t, jmethodClazz(t, *method))->methodTable(),
|
||||||
(t, jclassVmClass(t, jmethodClazz(t, *method))),
|
|
||||||
jmethodSlot(t, *method)));
|
jmethodSlot(t, *method)));
|
||||||
|
|
||||||
if (vmMethod->flags() & ACC_STATIC) {
|
if (vmMethod->flags() & ACC_STATIC) {
|
||||||
@ -4449,7 +4442,7 @@ jvmInvokeMethod(Thread* t, uintptr_t* arguments)
|
|||||||
return reinterpret_cast<uint64_t>
|
return reinterpret_cast<uint64_t>
|
||||||
(makeLocalReference
|
(makeLocalReference
|
||||||
(t, invoke
|
(t, invoke
|
||||||
(t, vmMethod, instance ? *instance : 0, args ? *args : 0)));
|
(t, vmMethod, instance ? reinterpret_cast<object>(*instance) : 0, args ? reinterpret_cast<object>(*args) : 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" AVIAN_EXPORT jobject JNICALL
|
extern "C" AVIAN_EXPORT jobject JNICALL
|
||||||
@ -4470,15 +4463,14 @@ jvmNewInstanceFromConstructor(Thread* t, uintptr_t* arguments)
|
|||||||
jobjectArray args = reinterpret_cast<jobjectArray>(arguments[1]);
|
jobjectArray args = reinterpret_cast<jobjectArray>(arguments[1]);
|
||||||
|
|
||||||
object instance = make
|
object instance = make
|
||||||
(t, cast<GcClass>(t, jclassVmClass(t, jconstructorClazz(t, *constructor))));
|
(t, jclassVmClass(t, jconstructorClazz(t, *constructor)));
|
||||||
PROTECT(t, instance);
|
PROTECT(t, instance);
|
||||||
|
|
||||||
GcMethod* method = cast<GcMethod>(t, arrayBody
|
GcMethod* method = cast<GcMethod>(t, arrayBody
|
||||||
(t, classMethodTable
|
(t, jclassVmClass(t, jconstructorClazz(t, *constructor))->methodTable(),
|
||||||
(t, jclassVmClass(t, jconstructorClazz(t, *constructor))),
|
|
||||||
jconstructorSlot(t, *constructor)));
|
jconstructorSlot(t, *constructor)));
|
||||||
|
|
||||||
invoke(t, method, instance, args ? *args : 0);
|
invoke(t, method, reinterpret_cast<object>(instance), args ? reinterpret_cast<object>(*args) : 0);
|
||||||
|
|
||||||
return reinterpret_cast<uint64_t>(makeLocalReference(t, instance));
|
return reinterpret_cast<uint64_t>(makeLocalReference(t, instance));
|
||||||
}
|
}
|
||||||
@ -4499,17 +4491,17 @@ EXPORT(JVM_GetClassConstantPool)(Thread* t, jclass c)
|
|||||||
{
|
{
|
||||||
ENTER(t, Thread::ActiveState);
|
ENTER(t, Thread::ActiveState);
|
||||||
|
|
||||||
object vmClass = jclassVmClass(t, *c);
|
GcClass* vmClass = (*c)->vmClass();
|
||||||
object addendum = classAddendum(t, vmClass);
|
GcClassAddendum* addendum = vmClass->addendum();
|
||||||
object pool;
|
object pool;
|
||||||
if (addendum) {
|
if (addendum) {
|
||||||
pool = addendumPool(t, addendum);
|
pool = reinterpret_cast<object>(addendum->pool());
|
||||||
} else {
|
} else {
|
||||||
pool = 0;
|
pool = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pool == 0) {
|
if (pool == 0) {
|
||||||
pool = getClassRuntimeData(t, cast<GcClass>(t, vmClass))->pool();
|
pool = getClassRuntimeData(t, vmClass)->pool();
|
||||||
}
|
}
|
||||||
|
|
||||||
return makeLocalReference(t, reinterpret_cast<object>(makeConstantPool(t, pool)));
|
return makeLocalReference(t, reinterpret_cast<object>(makeConstantPool(t, pool)));
|
||||||
@ -5261,12 +5253,12 @@ uint64_t
|
|||||||
getEnclosingMethodInfo(Thread* t, uintptr_t* arguments)
|
getEnclosingMethodInfo(Thread* t, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
jclass c = reinterpret_cast<jclass>(arguments[0]);
|
jclass c = reinterpret_cast<jclass>(arguments[0]);
|
||||||
object class_ = jclassVmClass(t, *c);
|
GcClass* class_ = (*c)->vmClass();
|
||||||
PROTECT(t, class_);
|
PROTECT(t, class_);
|
||||||
|
|
||||||
object addendum = classAddendum(t, class_);
|
GcClassAddendum* addendum = class_->addendum();
|
||||||
if (addendum) {
|
if (addendum) {
|
||||||
object enclosingClass = classAddendumEnclosingClass(t, addendum);
|
object enclosingClass = addendum->enclosingClass();
|
||||||
if (enclosingClass) {
|
if (enclosingClass) {
|
||||||
PROTECT(t, enclosingClass);
|
PROTECT(t, enclosingClass);
|
||||||
|
|
||||||
@ -5274,11 +5266,11 @@ getEnclosingMethodInfo(Thread* t, uintptr_t* arguments)
|
|||||||
PROTECT(t, array);
|
PROTECT(t, array);
|
||||||
|
|
||||||
enclosingClass = reinterpret_cast<object>(getJClass
|
enclosingClass = reinterpret_cast<object>(getJClass
|
||||||
(t, resolveClass(t, cast<GcClassLoader>(t, classLoader(t, class_)), cast<GcByteArray>(t, enclosingClass))));
|
(t, resolveClass(t, class_->loader(), cast<GcByteArray>(t, enclosingClass))));
|
||||||
|
|
||||||
set(t, array, ArrayBody, enclosingClass);
|
set(t, array, ArrayBody, enclosingClass);
|
||||||
|
|
||||||
object enclosingMethod = classAddendumEnclosingMethod(t, addendum);
|
object enclosingMethod = addendum->enclosingMethod();
|
||||||
|
|
||||||
if (enclosingMethod) {
|
if (enclosingMethod) {
|
||||||
PROTECT(t, enclosingMethod);
|
PROTECT(t, enclosingMethod);
|
||||||
|
603
src/jnienv.cpp
603
src/jnienv.cpp
File diff suppressed because it is too large
Load Diff
@ -4555,7 +4555,7 @@ resolveClass(Thread* t, GcClassLoader* loader, GcByteArray* spec, bool throw_,
|
|||||||
(runRaw(t, invokeLoadClass, arguments));
|
(runRaw(t, invokeLoadClass, arguments));
|
||||||
|
|
||||||
if (LIKELY(jc)) {
|
if (LIKELY(jc)) {
|
||||||
c = cast<GcClass>(t, jclassVmClass(t, jc));
|
c = reinterpret_cast<GcClass*>(jclassVmClass(t, jc));
|
||||||
} else if (t->exception) {
|
} else if (t->exception) {
|
||||||
if (throw_) {
|
if (throw_) {
|
||||||
GcThrowable* e = type(t, throwType) == objectClass(t, t->exception)
|
GcThrowable* e = type(t, throwType) == objectClass(t, t->exception)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
(array void* vtable))
|
(array void* vtable))
|
||||||
|
|
||||||
(type jclass java/lang/Class
|
(type jclass java/lang/Class
|
||||||
(require object vmClass))
|
(require class vmClass))
|
||||||
|
|
||||||
(type jaccessibleObject java/lang/reflect/AccessibleObject)
|
(type jaccessibleObject java/lang/reflect/AccessibleObject)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user