[llvm-commits] [vmkit] r51543 - in /vmkit/trunk/lib/JnJVM: Classpath/ClasspathVMClass.cpp Classpath/ClasspathVMSystem.cpp VMCore/JavaClass.cpp VMCore/JavaTypes.cpp VMCore/JavaTypes.h VMCore/Jni.cpp VMCore/Jnjvm.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sat May 24 05:26:48 PDT 2008
Author: geoffray
Date: Sat May 24 07:26:33 2008
New Revision: 51543
URL: http://llvm.org/viewvc/llvm-project?rev=51543&view=rev
Log:
Use the isPrimitive flag of a CommonClass instead of bogusClassToPrimitive.
Removed bogusClassToPrimitive.
Modified:
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h
vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp
vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp?rev=51543&r1=51542&r2=51543&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp Sat May 24 07:26:33 2008
@@ -177,14 +177,9 @@
CommonClass* cl =
(CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl);
- AssessorDesc* ass = AssessorDesc::bogusClassToPrimitive(cl);
- const UTF8* res = 0;
- if (ass) {
- res = ass->UTF8Name;
- } else {
- const UTF8* iname = cl->name;
- res = iname->internalToJava(vm, 0, iname->size);
- }
+ const UTF8* iname = cl->name;
+ const UTF8* res = iname->internalToJava(vm, 0, iname->size);
+
return (jobject)(vm->UTF8ToStr(res));
}
@@ -197,9 +192,7 @@
CommonClass* cl =
(CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl);
- AssessorDesc* ass = AssessorDesc::bogusClassToPrimitive(cl);
- if (ass == 0) return false;
- else return true;
+ return cl->isPrimitive;
}
JNIEXPORT jboolean JNICALL Java_java_lang_VMClass_isInterface(
@@ -252,13 +245,8 @@
CommonClass* cl2 =
(CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl2);
- AssessorDesc* ass = AssessorDesc::bogusClassToPrimitive(cl1);
- if (ass) {
- return ass == AssessorDesc::bogusClassToPrimitive(cl2);
- } else {
- cl2->resolveClass(false);
- return cl2->isAssignableFrom(cl1);
- }
+ cl2->resolveClass(false);
+ return cl2->isAssignableFrom(cl1);
}
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp?rev=51543&r1=51542&r2=51543&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMSystem.cpp Sat May 24 07:26:33 2008
@@ -47,10 +47,10 @@
ClassArray* ts = (ClassArray*)src->classOf;
ClassArray* td = (ClassArray*)dst->classOf;
CommonClass* dstType = td->baseClass();
- CommonClass* srcType = ts->baseClass();
- AssessorDesc* srcPrim = AssessorDesc::bogusClassToPrimitive(srcType);
- AssessorDesc* dstPrim = AssessorDesc::bogusClassToPrimitive(dstType);
+ AssessorDesc* dstFuncs = td->funcs();
AssessorDesc* srcFuncs = ts->funcs();
+ CommonClass* srcPrim = srcFuncs->classType;
+ CommonClass* dstPrim = dstFuncs->classType;
if (len > src->size) {
vm->indexOutOfBounds(src, len);
@@ -72,9 +72,9 @@
jint i = sstart;
bool doThrow = false;
- if (srcFuncs == AssessorDesc::dTab || srcFuncs == AssessorDesc::dRef) {
+ if (srcFuncs->doTrace) {
while (i < sstart + len && !doThrow) {
- JavaObject* cur = ((ArrayObject*)src)->at(i);
+ JavaObject* cur = ((ArrayObject*)src)->elements[i];
if (cur) {
if (!(cur->classOf->isAssignableFrom(dstType))) {
doThrow = true;
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp?rev=51543&r1=51542&r2=51543&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Sat May 24 07:26:33 2008
@@ -388,8 +388,8 @@
bool CommonClass::inheritName(const UTF8* Tname) {
if (name->equals(Tname)) {
return true;
- } else if (AssessorDesc::bogusClassToPrimitive(this)) {
- return true;
+ } else if (isPrimitive) {
+ return false;
} else if (super) {
if (super->inheritName(Tname)) return true;
}
@@ -551,7 +551,7 @@
JavaState* CommonClass::getStatus() {
if (!this->isArray &&
- !AssessorDesc::bogusClassToPrimitive(this)) {
+ !this->isPrimitive) {
Class* cl = (Class*)this;
Jnjvm* vm = JavaThread::get()->isolate;
std::pair<JavaState, JavaObject*>* val = vm->statics->lookup(cl);
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp?rev=51543&r1=51542&r2=51543&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp Sat May 24 07:26:33 2008
@@ -401,30 +401,6 @@
}
}
-AssessorDesc* AssessorDesc::bogusClassToPrimitive(CommonClass* cl) {
- if (cl == dFloat->classType) {
- return dFloat;
- } else if (cl == dInt->classType) {
- return dInt;
- } else if (cl == dShort->classType) {
- return dShort;
- } else if (cl == dChar->classType) {
- return dChar;
- } else if (cl == dDouble->classType) {
- return dDouble;
- } else if (cl == dByte->classType) {
- return dByte;
- } else if (cl == dBool->classType) {
- return dBool;
- } else if (cl == dLong->classType) {
- return dLong;
- } else if (cl == dVoid->classType) {
- return dVoid;
- } else {
- return 0;
- }
-}
-
void Typedef::print(mvm::PrintBuffer* buf) const {
buf->write("Type<");
tPrintBuf(buf);
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h?rev=51543&r1=51542&r2=51543&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.h Sat May 24 07:26:33 2008
@@ -118,7 +118,6 @@
static AssessorDesc* byteIdToPrimitive(const char id);
static AssessorDesc* classToPrimitive(CommonClass* cl);
- static AssessorDesc* bogusClassToPrimitive(CommonClass* cl);
};
Modified: vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp?rev=51543&r1=51542&r2=51543&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp Sat May 24 07:26:33 2008
@@ -114,11 +114,7 @@
CommonClass* cl2 = NativeUtil::resolvedImplClass(sup, false);
CommonClass* cl1 = NativeUtil::resolvedImplClass(sub, false);
- AssessorDesc* prim = AssessorDesc::bogusClassToPrimitive(cl2);
- if (prim)
- return prim == AssessorDesc::bogusClassToPrimitive(cl1);
- else
- return cl1->isAssignableFrom(cl2);
+ return cl1->isAssignableFrom(cl2);
END_EXCEPTION
Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=51543&r1=51542&r2=51543&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Sat May 24 07:26:33 2008
@@ -304,7 +304,7 @@
void Jnjvm::initialiseClass(CommonClass* cl) {
JavaState* status = cl->getStatus();
- if (cl->isArray || AssessorDesc::bogusClassToPrimitive(cl)) {
+ if (cl->isArray || cl->isPrimitive) {
*status = ready;
} else if (!(*status == ready)) {
cl->aquire();
More information about the llvm-commits
mailing list