implement JNIEnv::GetSuperclass; use vm::run in JNIEnv::GetObjectClass

This commit is contained in:
Joel Dice 2011-03-02 08:29:44 -07:00
parent 16b936a600
commit fc45cf767b

View File

@ -430,12 +430,40 @@ GetDirectBufferCapacity(Thread*, jobject)
return -1; return -1;
} }
uint64_t
getObjectClass(Thread* t, uintptr_t* arguments)
{
jobject o = reinterpret_cast<jclass>(arguments[0]);
return reinterpret_cast<uint64_t>
(makeLocalReference(t, getJClass(t, objectClass(t, *o))));
}
jclass JNICALL jclass JNICALL
GetObjectClass(Thread* t, jobject o) GetObjectClass(Thread* t, jobject o)
{ {
ENTER(t, Thread::ActiveState); uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(o) };
return makeLocalReference(t, getJClass(t, objectClass(t, *o))); return reinterpret_cast<jobject>(run(t, getObjectClass, arguments));
}
uint64_t
getSuperclass(Thread* t, uintptr_t* arguments)
{
jclass c = reinterpret_cast<jclass>(arguments[0]);
object super = classSuper(t, jclassVmClass(t, *c));
return super ? reinterpret_cast<uint64_t>
(makeLocalReference(t, getJClass(t, super))) : 0;
}
jclass JNICALL
GetSuperclass(Thread* t, jclass c)
{
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(c) };
return reinterpret_cast<jclass>(run(t, getSuperclass, arguments));
} }
jboolean JNICALL jboolean JNICALL
@ -2358,6 +2386,7 @@ populateJNITables(JavaVMVTable* vmTable, JNIEnvVTable* envTable)
envTable->GetDirectBufferCapacity = local::GetDirectBufferCapacity; envTable->GetDirectBufferCapacity = local::GetDirectBufferCapacity;
envTable->DeleteLocalRef = local::DeleteLocalRef; envTable->DeleteLocalRef = local::DeleteLocalRef;
envTable->GetObjectClass = local::GetObjectClass; envTable->GetObjectClass = local::GetObjectClass;
envTable->GetSuperclass = local::GetSuperclass;
envTable->IsInstanceOf = local::IsInstanceOf; envTable->IsInstanceOf = local::IsInstanceOf;
envTable->IsAssignableFrom = local::IsAssignableFrom; envTable->IsAssignableFrom = local::IsAssignableFrom;
envTable->GetFieldID = local::GetFieldID; envTable->GetFieldID = local::GetFieldID;