[vmkit-commits] [vmkit] r56347 - in /vmkit/branches/isolate/lib/JnJVM: Classpath/ VMCore/
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Fri Sep 19 07:50:41 PDT 2008
Author: geoffray
Date: Fri Sep 19 09:50:39 2008
New Revision: 56347
URL: http://llvm.org/viewvc/llvm-project?rev=56347&view=rev
Log:
Get rid of AssessorDescs, and only base the type information on
primitive classes.
Modified:
vmkit/branches/isolate/lib/JnJVM/Classpath/Classpath.cpp
vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathMethod.cpp.inc
vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc
vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathVMField.cpp.inc
vmkit/branches/isolate/lib/JnJVM/VMCore/JavaClass.cpp
vmkit/branches/isolate/lib/JnJVM/VMCore/JavaClass.h
vmkit/branches/isolate/lib/JnJVM/VMCore/JavaInitialise.cpp
vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp
vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.h
vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJITOpcodes.cpp
vmkit/branches/isolate/lib/JnJVM/VMCore/JavaMetaJIT.cpp
vmkit/branches/isolate/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
vmkit/branches/isolate/lib/JnJVM/VMCore/JavaTypes.cpp
vmkit/branches/isolate/lib/JnJVM/VMCore/JavaTypes.h
vmkit/branches/isolate/lib/JnJVM/VMCore/JavaUpcalls.h
vmkit/branches/isolate/lib/JnJVM/VMCore/Jni.cpp
vmkit/branches/isolate/lib/JnJVM/VMCore/Jnjvm.cpp
vmkit/branches/isolate/lib/JnJVM/VMCore/Jnjvm.h
vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.cpp
vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.h
vmkit/branches/isolate/lib/JnJVM/VMCore/NativeUtil.cpp
Modified: vmkit/branches/isolate/lib/JnJVM/Classpath/Classpath.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/Classpath/Classpath.cpp?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/Classpath/Classpath.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/Classpath/Classpath.cpp Fri Sep 19 09:50:39 2008
@@ -179,7 +179,7 @@
UserCommonClass* base = NativeUtil::resolvedImplClass(arrayType, true);
JnjvmClassLoader* loader = base->classLoader;
const UTF8* name = base->getName();
- const UTF8* arrayName = AssessorDesc::constructArrayName(loader, 0, 1, name);
+ const UTF8* arrayName = AssessorDesc::constructArrayName(loader, 1, name);
UserClassArray* array = loader->constructArray(arrayName);
ArrayObject* res = ArrayObject::acons(arrayLength, array, &(vm->allocator));
Modified: vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathMethod.cpp.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathMethod.cpp.inc?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathMethod.cpp.inc (original)
+++ vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathMethod.cpp.inc Fri Sep 19 09:50:39 2008
@@ -144,58 +144,59 @@
} \
JavaObject* res = 0;
- const AssessorDesc* retType = meth->getSignature()->ret->funcs;
- if (retType == AssessorDesc::dVoid) {
- res = 0;
- uint32 val = 0;
- RUN_METH(Int);
- } else if (retType == AssessorDesc::dBool) {
- uint32 val = 0;
- RUN_METH(Int);
- res = vm->upcalls->boolClass->doNew(vm);
- vm->upcalls->boolValue->setInt8Field(res, val);
- } else if (retType == AssessorDesc::dByte) {
- uint32 val = 0;
- RUN_METH(Int);
- res = vm->upcalls->byteClass->doNew(vm);
- vm->upcalls->byteValue->setInt8Field(res, val);
- } else if (retType == AssessorDesc::dChar) {
- uint32 val = 0;
- RUN_METH(Int);
- res = vm->upcalls->charClass->doNew(vm);
- vm->upcalls->charValue->setInt16Field(res, val);
- } else if (retType == AssessorDesc::dShort) {
- uint32 val = 0;
- RUN_METH(Int);
- res = vm->upcalls->shortClass->doNew(vm);
- vm->upcalls->shortValue->setInt16Field(res, val);
- } else if (retType == AssessorDesc::dInt) {
- uint32 val = 0;
- RUN_METH(Int);
- res = vm->upcalls->intClass->doNew(vm);
- vm->upcalls->intValue->setInt32Field(res, val);
- } else if (retType == AssessorDesc::dLong) {
- sint64 val = 0;
- RUN_METH(Long);
- res = vm->upcalls->longClass->doNew(vm);
- vm->upcalls->longValue->setLongField(res, val);
- } else if (retType == AssessorDesc::dFloat) {
- float val = 0;
- RUN_METH(Float);
- res = vm->upcalls->floatClass->doNew(vm);
- vm->upcalls->floatValue->setFloatField(res, val);
- } else if (retType == AssessorDesc::dDouble) {
- double val = 0;
- RUN_METH(Double);
- res = vm->upcalls->doubleClass->doNew(vm);
- vm->upcalls->doubleValue->setDoubleField(res, val);
- } else if (retType == AssessorDesc::dTab || retType == AssessorDesc::dRef) {
+ Typedef* retType = meth->getSignature()->ret;
+ if (retType->isPrimitive()) {
+ PrimitiveTypedef* prim = (PrimitiveTypedef*)retType;
+ if (prim->isVoid()) {
+ res = 0;
+ uint32 val = 0;
+ RUN_METH(Int);
+ } else if (prim->isBool()) {
+ uint32 val = 0;
+ RUN_METH(Int);
+ res = vm->upcalls->boolClass->doNew(vm);
+ vm->upcalls->boolValue->setInt8Field(res, val);
+ } else if (prim->isByte()) {
+ uint32 val = 0;
+ RUN_METH(Int);
+ res = vm->upcalls->byteClass->doNew(vm);
+ vm->upcalls->byteValue->setInt8Field(res, val);
+ } else if (prim->isChar()) {
+ uint32 val = 0;
+ RUN_METH(Int);
+ res = vm->upcalls->charClass->doNew(vm);
+ vm->upcalls->charValue->setInt16Field(res, val);
+ } else if (prim->isShort()) {
+ uint32 val = 0;
+ RUN_METH(Int);
+ res = vm->upcalls->shortClass->doNew(vm);
+ vm->upcalls->shortValue->setInt16Field(res, val);
+ } else if (prim->isInt()) {
+ uint32 val = 0;
+ RUN_METH(Int);
+ res = vm->upcalls->intClass->doNew(vm);
+ vm->upcalls->intValue->setInt32Field(res, val);
+ } else if (prim->isLong()) {
+ sint64 val = 0;
+ RUN_METH(Long);
+ res = vm->upcalls->longClass->doNew(vm);
+ vm->upcalls->longValue->setLongField(res, val);
+ } else if (prim->isFloat()) {
+ float val = 0;
+ RUN_METH(Float);
+ res = vm->upcalls->floatClass->doNew(vm);
+ vm->upcalls->floatValue->setFloatField(res, val);
+ } else if (prim->isDouble()) {
+ double val = 0;
+ RUN_METH(Double);
+ res = vm->upcalls->doubleClass->doNew(vm);
+ vm->upcalls->doubleValue->setDoubleField(res, val);
+ }
+ } else {
JavaObject* val = 0;
RUN_METH(JavaObject);
res = val;
- } else {
- vm->unknownError("should not be here");
- }
+ }
return (jobject)res;
}
vm->illegalArgumentExceptionForMethod(meth, 0, 0);
Modified: vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc (original)
+++ vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathVMClassLoader.cpp.inc Fri Sep 19 09:50:39 2008
@@ -32,12 +32,12 @@
#endif
jchar byteId) {
- AssessorDesc* ass = AssessorDesc::byteIdToPrimitive(byteId);
Jnjvm* vm = JavaThread::get()->isolate;
- if (!ass)
+ UserClassPrimitive* prim = AssessorDesc::byteIdToPrimitive(byteId, vm->upcalls);
+ if (!prim)
vm->unknownError("unknown byte primitive %c", byteId);
- return (jobject)ass->getPrimitiveClass()->getClassDelegatee(vm);
+ return (jobject)prim->getClassDelegatee(vm);
}
Modified: vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathVMField.cpp.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathVMField.cpp.inc?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathVMField.cpp.inc (original)
+++ vmkit/branches/isolate/lib/JnJVM/Classpath/ClasspathVMField.cpp.inc Fri Sep 19 09:50:39 2008
@@ -65,7 +65,7 @@
jobject Field, jobject obj) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
+ const Typedef* type = field->getSignature();
JavaObject* Obj = (JavaObject*)obj;
@@ -75,18 +75,20 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case INT_ID :
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+
+ if (prim->isInt())
return (sint32)field->getInt32Field(Obj);
- case CHAR_ID :
+ if (prim->isChar())
return (uint32)field->getInt16Field(Obj);
- case BYTE_ID :
+ if (prim->isByte())
return (sint32)field->getInt8Field(Obj);
- case SHORT_ID :
+ if (prim->isShort())
return (sint32)field->getInt16Field(Obj);
- default :
- JavaThread::get()->isolate->illegalArgumentException("");
}
+
+ JavaThread::get()->isolate->illegalArgumentException("");
return 0;
}
@@ -98,7 +100,6 @@
jobject Field, jobject obj) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
@@ -108,20 +109,23 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case INT_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+
+ if (prim->isInt())
return (sint64)field->getInt32Field(Obj);
- case CHAR_ID :
+ if (prim->isChar())
return (uint64)field->getInt16Field(Obj);
- case BYTE_ID :
+ if (prim->isByte())
return (sint64)field->getInt8Field(Obj);
- case SHORT_ID :
+ if (prim->isShort())
return (sint64)field->getInt16Field(Obj);
- case LONG_ID :
+ if (prim->isLong())
return (sint64)field->getLongField(Obj);
- default:
- JavaThread::get()->isolate->illegalArgumentException("");
}
+
+ JavaThread::get()->isolate->illegalArgumentException("");
return 0;
}
@@ -132,7 +136,6 @@
jobject Field, jobject obj) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
@@ -142,12 +145,14 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case BOOL_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isBool())
return (uint8)field->getInt8Field(Obj);
- default:
- JavaThread::get()->isolate->illegalArgumentException("");
}
+
+ JavaThread::get()->isolate->illegalArgumentException("");
return 0;
@@ -160,7 +165,6 @@
jobject Field, jobject obj) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
@@ -170,22 +174,23 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case BYTE_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isByte())
return (jfloat)field->getInt8Field(Obj);
- case INT_ID :
+ if (prim->isInt())
return (jfloat)field->getInt32Field((JavaObject*)obj);
- case SHORT_ID :
+ if (prim->isShort())
return (jfloat)field->getInt16Field((JavaObject*)obj);
- case LONG_ID :
+ if (prim->isLong())
return (jfloat)field->getLongField((JavaObject*)obj);
- case CHAR_ID :
+ if (prim->isChar())
return (jfloat)(uint32)field->getInt16Field((JavaObject*)obj);
- case FLOAT_ID :
+ if (prim->isFloat())
return (jfloat)field->getFloatField((JavaObject*)obj);
- default:
- JavaThread::get()->isolate->illegalArgumentException("");
}
+ JavaThread::get()->isolate->illegalArgumentException("");
return 0.0;
}
@@ -196,7 +201,6 @@
jobject Field, jobject obj) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
@@ -206,12 +210,13 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case BYTE_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isByte())
return (sint8)field->getInt8Field(Obj);
- default :
- JavaThread::get()->isolate->illegalArgumentException("");
}
+ JavaThread::get()->isolate->illegalArgumentException("");
return 0;
}
@@ -223,7 +228,6 @@
jobject Field, jobject obj) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
@@ -233,12 +237,13 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case CHAR_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isChar())
return (uint16)field->getInt16Field((JavaObject*)obj);
- default :
- JavaThread::get()->isolate->illegalArgumentException("");
}
+ JavaThread::get()->isolate->illegalArgumentException("");
return 0;
@@ -251,7 +256,6 @@
jobject Field, jobject obj) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
@@ -261,14 +265,15 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case SHORT_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isShort())
return (sint16)field->getInt16Field(Obj);
- case BYTE_ID :
+ if (prim->isByte())
return (sint16)field->getInt8Field(Obj);
- default :
- JavaThread::get()->isolate->illegalArgumentException("");
}
+ JavaThread::get()->isolate->illegalArgumentException("");
return 0;
}
@@ -280,7 +285,6 @@
jobject Field, jobject obj) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
@@ -290,24 +294,25 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case BYTE_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isByte())
return (jdouble)(sint64)field->getInt8Field(Obj);
- case INT_ID :
+ if (prim->isInt())
return (jdouble)(sint64)field->getInt32Field(Obj);
- case SHORT_ID :
+ if (prim->isShort())
return (jdouble)(sint64)field->getInt16Field(Obj);
- case LONG_ID :
+ if (prim->isLong())
return (jdouble)(sint64)field->getLongField(Obj);
- case CHAR_ID :
+ if (prim->isChar())
return (jdouble)(uint64)field->getInt16Field(Obj);
- case FLOAT_ID :
+ if (prim->isFloat())
return (jdouble)field->getFloatField(Obj);
- case DOUBLE_ID :
+ if (prim->isDouble())
return (jdouble)field->getDoubleField(Obj);
- default :
- JavaThread::get()->isolate->illegalArgumentException("");
}
+ JavaThread::get()->isolate->illegalArgumentException("");
return 0.0;
}
@@ -318,8 +323,6 @@
jobject Field, jobject _obj) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- Typedef* type = field->getSignature();
- const AssessorDesc* ass = type->funcs;
JavaObject* Obj = (JavaObject*)_obj;
@@ -330,61 +333,51 @@
}
JavaObject* res = 0;
- switch (ass->numId) {
- case BOOL_ID : {
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isBool()) {
uint8 val = field->getInt8Field(Obj);
res = vm->upcalls->boolClass->doNew(vm);
vm->upcalls->boolValue->setInt8Field(res, val);
- break;
}
- case BYTE_ID : {
+ else if (prim->isByte()) {
sint8 val = field->getInt8Field(Obj);
res = vm->upcalls->byteClass->doNew(vm);
vm->upcalls->byteValue->setInt8Field(res, val);
- break;
}
- case CHAR_ID : {
+ else if (prim->isChar()) {
uint16 val = field->getInt16Field(Obj);
res = vm->upcalls->charClass->doNew(vm);
vm->upcalls->charValue->setInt16Field(res, val);
- break;
}
- case SHORT_ID : {
+ else if (prim->isShort()) {
sint16 val = field->getInt16Field(Obj);
res = vm->upcalls->shortClass->doNew(vm);
vm->upcalls->shortValue->setInt16Field(res, val);
- break;
}
- case INT_ID : {
+ else if (prim->isInt()) {
sint32 val = field->getInt32Field(Obj);
res = vm->upcalls->intClass->doNew(vm);
vm->upcalls->intValue->setInt32Field(res, val);
- break;
}
- case LONG_ID : {
+ else if (prim->isLong()) {
sint64 val = field->getLongField(Obj);
res = vm->upcalls->longClass->doNew(vm);
vm->upcalls->longValue->setLongField(res, val);
- break;
}
- case FLOAT_ID : {
+ else if (prim->isFloat()) {
float val = field->getFloatField(Obj);
res = vm->upcalls->floatClass->doNew(vm);
vm->upcalls->floatValue->setFloatField(res, val);
- break;
}
- case DOUBLE_ID : {
+ else if (prim->isDouble()) {
double val = field->getDoubleField(Obj);
res = vm->upcalls->doubleClass->doNew(vm);
vm->upcalls->doubleValue->setDoubleField(res, val);
- break;
}
- case OBJECT_ID :
- case ARRAY_ID :
- res = field->getObjectField(Obj);
- break;
- default:
- JavaThread::get()->isolate->unknownError("should not be here");
+ } else {
+ res = field->getObjectField(Obj);
}
return (jobject)res;
}
@@ -400,7 +393,6 @@
void* _buf = (void*)buf;
NativeUtil::decapsulePrimitive(JavaThread::get()->isolate, buf, (JavaObject*)val, field->getSignature());
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
@@ -410,28 +402,27 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case BOOL_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isBool())
return field->setInt8Field(Obj, ((uint8*)_buf)[0]);
- case BYTE_ID :
+ if (prim->isByte())
return field->setInt8Field(Obj, ((sint8*)_buf)[0]);
- case CHAR_ID :
+ if (prim->isChar())
return field->setInt16Field(Obj, ((uint16*)_buf)[0]);
- case SHORT_ID :
+ if (prim->isShort())
return field->setInt16Field(Obj, ((sint16*)_buf)[0]);
- case INT_ID :
+ if (prim->isInt())
return field->setInt32Field(Obj, ((sint32*)_buf)[0]);
- case LONG_ID :
+ if (prim->isLong())
return field->setLongField(Obj, ((sint64*)_buf)[0]);
- case FLOAT_ID :
+ if (prim->isFloat())
return field->setFloatField(Obj, ((float*)_buf)[0]);
- case DOUBLE_ID :
+ if (prim->isDouble())
return field->setDoubleField(Obj, ((double*)_buf)[0]);
- case ARRAY_ID :
- case OBJECT_ID :
- return field->setObjectField(Obj, ((JavaObject**)_buf)[0]);
- default :
- JavaThread::get()->isolate->unknownError("should not be here");
+ } else {
+ return field->setObjectField(Obj, ((JavaObject**)_buf)[0]);
}
}
@@ -442,7 +433,6 @@
jobject Field, jobject obj, jboolean val) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
if (isStatic(field->access)) {
@@ -451,12 +441,13 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case BOOL_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isBool())
return field->setInt8Field(Obj, (uint8)val);
- default :
- JavaThread::get()->isolate->illegalArgumentException("");
}
+ JavaThread::get()->isolate->illegalArgumentException("");
}
@@ -467,7 +458,6 @@
jobject Field, jobject obj, jbyte val) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
if (isStatic(field->access)) {
@@ -476,22 +466,23 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case BYTE_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isByte())
return field->setInt8Field(Obj, (sint8)val);
- case SHORT_ID :
+ if (prim->isShort())
return field->setInt16Field(Obj, (sint16)val);
- case INT_ID :
+ if (prim->isInt())
return field->setInt32Field(Obj, (sint32)val);
- case LONG_ID :
+ if (prim->isLong())
return field->setLongField(Obj, (sint64)val);
- case FLOAT_ID :
+ if (prim->isFloat())
return field->setFloatField(Obj, (float)val);
- case DOUBLE_ID :
+ if (prim->isDouble())
return field->setDoubleField(Obj, (double)val);
- default :
- JavaThread::get()->isolate->illegalArgumentException("");
}
+ JavaThread::get()->isolate->illegalArgumentException("");
}
JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setChar(
@@ -501,7 +492,6 @@
jobject Field, jobject obj, jchar val) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
@@ -511,20 +501,21 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case CHAR_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isChar())
return field->setInt16Field(Obj, (uint16)val);
- case INT_ID :
+ if (prim->isInt())
return field->setInt32Field(Obj, (uint32)val);
- case LONG_ID :
+ if (prim->isLong())
return field->setLongField(Obj, (uint64)val);
- case FLOAT_ID :
+ if (prim->isFloat())
return field->setFloatField(Obj, (float)(uint32)val);
- case DOUBLE_ID :
+ if (prim->isDouble())
return field->setDoubleField(Obj, (double)(uint64)val);
- default :
- JavaThread::get()->isolate->illegalArgumentException("");
}
+ JavaThread::get()->isolate->illegalArgumentException("");
}
JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setShort(
@@ -534,7 +525,6 @@
jobject Field, jobject obj, jshort val) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
@@ -544,20 +534,21 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case SHORT_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isShort())
return field->setInt16Field(Obj, (sint16)val);
- case INT_ID :
+ if (prim->isInt())
return field->setInt32Field(Obj, (sint32)val);
- case LONG_ID :
+ if (prim->isLong())
return field->setLongField(Obj, (sint64)val);
- case FLOAT_ID :
+ if (prim->isFloat())
return field->setFloatField(Obj, (float)val);
- case DOUBLE_ID :
+ if (prim->isDouble())
return field->setDoubleField(Obj, (double)val);
- default :
- JavaThread::get()->isolate->illegalArgumentException("");
}
+ JavaThread::get()->isolate->illegalArgumentException("");
}
JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setInt(
@@ -567,7 +558,6 @@
jobject Field, jobject obj, jint val) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
if (isStatic(field->access)) {
@@ -576,18 +566,19 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case INT_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isInt())
return field->setInt32Field(Obj, (sint32)val);
- case LONG_ID :
+ if (prim->isLong())
return field->setLongField(Obj, (sint64)val);
- case FLOAT_ID :
+ if (prim->isFloat())
return field->setFloatField(Obj, (float)val);
- case DOUBLE_ID :
+ if (prim->isDouble())
return field->setDoubleField(Obj, (double)val);
- default :
- JavaThread::get()->isolate->illegalArgumentException("");
}
+ JavaThread::get()->isolate->illegalArgumentException("");
}
JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setLong(
@@ -597,7 +588,6 @@
jobject Field, jobject obj, jlong val) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
if (isStatic(field->access)) {
@@ -606,16 +596,17 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case LONG_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isLong())
return field->setLongField(Obj, (sint64)val);
- case FLOAT_ID :
+ if (prim->isFloat())
return field->setFloatField(Obj, (float)val);
- case DOUBLE_ID :
+ if (prim->isDouble())
return field->setDoubleField(Obj, (double)val);
- default :
- JavaThread::get()->isolate->illegalArgumentException("");
}
+ JavaThread::get()->isolate->illegalArgumentException("");
}
JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setFloat(
@@ -625,7 +616,6 @@
jobject Field, jobject obj, jfloat val) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
if (isStatic(field->access)) {
@@ -634,14 +624,15 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case FLOAT_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isFloat())
return field->setFloatField(Obj, (float)val);
- case DOUBLE_ID :
+ if (prim->isDouble())
return field->setDoubleField(Obj, (double)val);
- default :
- JavaThread::get()->isolate->illegalArgumentException("");
}
+ JavaThread::get()->isolate->illegalArgumentException("");
}
JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setDouble(
@@ -651,7 +642,6 @@
jobject Field, jobject obj, jdouble val) {
Jnjvm* vm = JavaThread::get()->isolate;
JavaField* field = (JavaField*)vm->upcalls->fieldSlot->getInt32Field((JavaObject*)Field);
- const AssessorDesc* ass = field->getSignature()->funcs;
JavaObject* Obj = (JavaObject*)obj;
if (isStatic(field->access)) {
@@ -660,12 +650,13 @@
Obj = cl->getStaticInstance();
}
- switch (ass->numId) {
- case DOUBLE_ID :
+ const Typedef* type = field->getSignature();
+ if (type->isPrimitive()) {
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isDouble())
return field->setDoubleField(Obj, (double)val);
- default :
- JavaThread::get()->isolate->illegalArgumentException("");
}
+ JavaThread::get()->isolate->illegalArgumentException("");
}
JNIEXPORT jlong JNICALL Java_sun_misc_Unsafe_objectFieldOffset(
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaClass.cpp?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaClass.cpp Fri Sep 19 09:50:39 2008
@@ -25,6 +25,7 @@
#include "JavaObject.h"
#include "JavaThread.h"
#include "JavaTypes.h"
+#include "JavaUpcalls.h"
#include "Jnjvm.h"
#include "JnjvmModuleProvider.h"
#include "LockedMap.h"
@@ -176,10 +177,7 @@
if (name->elements[stepsEnd] == AssessorDesc::I_REF) {
printClassNameIntern(name, (stepsEnd + 1),(end - 1), buf);
} else {
- AssessorDesc * funcs = 0;
- uint32 next = 0;
- AssessorDesc::analyseIntern(name, stepsEnd, 0, funcs, next);
- buf->write(funcs->asciizName);
+ name->print(buf);
}
buf->write(" ");
for (uint32 i = start; i < stepsEnd; i++)
@@ -205,6 +203,30 @@
buf->write(">");
}
+UserClassPrimitive* CommonClass::toPrimitive(Jnjvm* vm) const {
+ if (this == vm->upcalls->voidClass) {
+ return vm->upcalls->OfVoid;
+ } else if (this == vm->upcalls->intClass) {
+ return vm->upcalls->OfInt;
+ } else if (this == vm->upcalls->shortClass) {
+ return vm->upcalls->OfShort;
+ } else if (this == vm->upcalls->charClass) {
+ return vm->upcalls->OfChar;
+ } else if (this == vm->upcalls->doubleClass) {
+ return vm->upcalls->OfDouble;
+ } else if (this == vm->upcalls->byteClass) {
+ return vm->upcalls->OfByte;
+ } else if (this == vm->upcalls->boolClass) {
+ return vm->upcalls->OfBool;
+ } else if (this == vm->upcalls->longClass) {
+ return vm->upcalls->OfLong;
+ } else if (this == vm->upcalls->floatClass) {
+ return vm->upcalls->OfFloat;
+ } else {
+ return 0;
+ }
+}
+
CommonClass::CommonClass(JnjvmClassLoader* loader, const UTF8* n,
bool isArray) {
name = n;
@@ -521,8 +543,8 @@
}
}
-void JavaField::initField(JavaObject* obj) {
- const AssessorDesc* funcs = getSignature()->funcs;
+void JavaField::initField(JavaObject* obj, Jnjvm* vm) {
+ const Typedef* type = getSignature();
Attribut* attribut = lookupAttribut(Attribut::constantAttribut);
if (!attribut) {
@@ -531,26 +553,26 @@
Reader reader(attribut, classDef->bytes);
JavaConstantPool * ctpInfo = classDef->ctpInfo;
uint16 idx = reader.readU2();
- if (funcs == AssessorDesc::dLong) {
- JnjvmModule::InitField(this, obj, (uint64)ctpInfo->LongAt(idx));
- } else if (funcs == AssessorDesc::dDouble) {
- JnjvmModule::InitField(this, obj, ctpInfo->DoubleAt(idx));
- } else if (funcs == AssessorDesc::dFloat) {
- JnjvmModule::InitField(this, obj, ctpInfo->FloatAt(idx));
- } else if (funcs == AssessorDesc::dRef) {
+ if (type->isPrimitive()) {
+ UserCommonClass* cl = type->assocClass(vm->bootstrapLoader);
+ if (cl == vm->upcalls->OfLong) {
+ JnjvmModule::InitField(this, obj, (uint64)ctpInfo->LongAt(idx));
+ } else if (cl == vm->upcalls->OfDouble) {
+ JnjvmModule::InitField(this, obj, ctpInfo->DoubleAt(idx));
+ } else if (cl == vm->upcalls->OfFloat) {
+ JnjvmModule::InitField(this, obj, ctpInfo->FloatAt(idx));
+ } else {
+ JnjvmModule::InitField(this, obj, (uint64)ctpInfo->IntegerAt(idx));
+ }
+ } else if (type->isReference()){
const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[idx]);
JnjvmModule::InitField(this, obj,
(JavaObject*)ctpInfo->resolveString(utf8, idx));
- } else if (funcs == AssessorDesc::dInt || funcs == AssessorDesc::dChar ||
- funcs == AssessorDesc::dShort || funcs == AssessorDesc::dByte ||
- funcs == AssessorDesc::dBool) {
- JnjvmModule::InitField(this, obj, (uint64)ctpInfo->IntegerAt(idx));
} else {
JavaThread::get()->isolate->
- unknownError("unknown constant %c", funcs->byteId);
+ unknownError("unknown constant %s\n", type->printString());
}
- }
-
+ }
}
JavaMethod* CommonClass::constructMethod(const UTF8* name,
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaClass.h?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaClass.h (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaClass.h Fri Sep 19 09:50:39 2008
@@ -495,6 +495,9 @@
void setSuper(CommonClass* S) {
super = S;
}
+
+ UserClassPrimitive* toPrimitive(Jnjvm* vm) const;
+
};
/// ClassPrimitive - This class represents internal classes for primitive
@@ -936,7 +939,7 @@
/// initField - Init the value of the field in the given object. This is
/// used for static fields which have a default value.
///
- void initField(JavaObject* obj);
+ void initField(JavaObject* obj, Jnjvm* vm);
/// lookupAttribut - Look up the attribut in the field's list of attributs.
///
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaInitialise.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaInitialise.cpp?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaInitialise.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaInitialise.cpp Fri Sep 19 09:50:39 2008
@@ -175,8 +175,6 @@
JCL->constructArray(JCL->asciizConstructUTF8("[Ljava/lang/Object;"));
- AssessorDesc::initialise(JCL);
-
Attribut::codeAttribut = JCL->asciizConstructUTF8("Code");
Attribut::exceptionsAttribut = JCL->asciizConstructUTF8("Exceptions");
Attribut::constantAttribut = JCL->asciizConstructUTF8("ConstantValue");
@@ -228,9 +226,6 @@
DEF_UTF8(finalize);
#undef DEF_UTF8
-
- JCL->upcalls->initialiseClasspath(JCL);
-
}
void mvm::VirtualMachine::initialiseJVM() {
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp Fri Sep 19 09:50:39 2008
@@ -64,6 +64,7 @@
#if !defined(WITHOUT_VTABLE)
Signdef* signature = ctpInfo->infoOfInterfaceOrVirtualMethod(index);
+ Typedef* retTypedef = signature->ret;
std::vector<Value*> args; // size = [signature->nbIn + 3];
LLVMSignatureInfo* LSI = module->getSignatureInfo(signature);
const llvm::FunctionType* virtualType = LSI->getVirtualType();
@@ -118,9 +119,9 @@
const llvm::Type* retType = virtualType->getReturnType();
if (retType != Type::VoidTy) {
- push(val, signature->ret->funcs);
+ push(val, retTypedef->isUnsigned());
if (retType == Type::DoubleTy || retType == Type::Int64Ty) {
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(mvm::jit::constantZero, false);
}
}
@@ -154,6 +155,7 @@
currentBlock = createBasicBlock("start");
BasicBlock* executeBlock = createBasicBlock("execute");
endBlock = createBasicBlock("end block");
+ returnType = funcType->getReturnType();
#if defined(MULTIPLE_VM)
Value* lastArg = 0;
@@ -192,8 +194,6 @@
#endif
#endif
- if (funcType->getReturnType() != Type::VoidTy)
- endNode = llvm::PHINode::Create(funcType->getReturnType(), "", endBlock);
Value* buf = llvm::CallInst::Create(JnjvmModule::GetSJLJBufferFunction,
"", currentBlock);
@@ -202,14 +202,13 @@
test = new ICmpInst(ICmpInst::ICMP_EQ, test, mvm::jit::constantZero, "",
currentBlock);
llvm::BranchInst::Create(executeBlock, endBlock, test, currentBlock);
-
- if (compilingMethod->getSignature()->ret->funcs != AssessorDesc::dVoid) {
- uint8 id = compilingMethod->getSignature()->ret->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
- Constant* C = LAI.llvmNullConstant;
- endNode->addIncoming(C, currentBlock);
- }
+ if (returnType != Type::VoidTy) {
+ endNode = llvm::PHINode::Create(returnType, "", endBlock);
+ endNode->addIncoming(Constant::getNullValue(returnType),
+ currentBlock);
+ }
+
currentBlock = executeBlock;
if (isSynchro(compilingMethod->access))
beginSynchronize();
@@ -256,7 +255,7 @@
Value* result = llvm::CallInst::Create(valPtr, nativeArgs.begin(),
nativeArgs.end(), "", currentBlock);
- if (funcType->getReturnType() != Type::VoidTy)
+ if (returnType != Type::VoidTy)
endNode->addIncoming(result, currentBlock);
llvm::BranchInst::Create(endBlock, currentBlock);
@@ -267,7 +266,7 @@
llvm::CallInst::Create(JnjvmModule::JniProceedPendingExceptionFunction, "",
currentBlock);
- if (funcType->getReturnType() != Type::VoidTy)
+ if (returnType != Type::VoidTy)
llvm::ReturnInst::Create(result, currentBlock);
else
llvm::ReturnInst::Create(currentBlock);
@@ -556,37 +555,39 @@
#endif
std::vector<Typedef*>::iterator type =
compilingMethod->getSignature()->args.begin();
- std::vector<Value*>::iterator i = args.begin();
+ Function::arg_iterator i = func->arg_begin();
if (isVirtual(compilingMethod->access)) {
- new StoreInst(*i, objectLocals[0], false, currentBlock);
+ new StoreInst(i, objectLocals[0], false, currentBlock);
++i;
++index;
++count;
}
+
for (;count < max; ++i, ++index, ++count, ++type) {
- const AssessorDesc* cur = (*type)->funcs;
+ const Typedef* cur = *type;
+ const Type* curType = i->getType();
- if (cur == AssessorDesc::dLong){
- new StoreInst(*i, longLocals[index], false, currentBlock);
+ if (curType == Type::Int64Ty){
+ new StoreInst(i, longLocals[index], false, currentBlock);
++index;
- } else if (cur == AssessorDesc::dBool || cur == AssessorDesc::dChar) {
- new StoreInst(new ZExtInst(*i, Type::Int32Ty, "", currentBlock),
+ } else if (cur->isUnsigned()) {
+ new StoreInst(new ZExtInst(i, Type::Int32Ty, "", currentBlock),
intLocals[index], false, currentBlock);
- } else if (cur == AssessorDesc::dByte || cur == AssessorDesc::dShort) {
- new StoreInst(new SExtInst(*i, Type::Int32Ty, "", currentBlock),
+ } else if (curType == Type::Int8Ty || curType == Type::Int16Ty) {
+ new StoreInst(new SExtInst(i, Type::Int32Ty, "", currentBlock),
intLocals[index], false, currentBlock);
- } else if (cur == AssessorDesc::dInt) {
- new StoreInst(*i, intLocals[index], false, currentBlock);
- } else if (cur == AssessorDesc::dDouble) {
- new StoreInst(*i, doubleLocals[index], false, currentBlock);
+ } else if (curType == Type::Int32Ty) {
+ new StoreInst(i, intLocals[index], false, currentBlock);
+ } else if (curType == Type::DoubleTy) {
+ new StoreInst(i, doubleLocals[index], false, currentBlock);
++index;
- } else if (cur == AssessorDesc::dFloat) {
- new StoreInst(*i, floatLocals[index], false, currentBlock);
+ } else if (curType == Type::FloatTy) {
+ new StoreInst(i, floatLocals[index], false, currentBlock);
} else {
- new StoreInst(*i, objectLocals[index], false, currentBlock);
+ new StoreInst(i, objectLocals[index], false, currentBlock);
}
}
@@ -733,22 +734,24 @@
for (;count < max; ++i, ++index, ++count, ++type) {
- const AssessorDesc* cur = (*type)->funcs;
- if (cur == AssessorDesc::dLong){
+ const Typedef* cur = *type;
+ const llvm::Type* curType = i->getType();
+
+ if (curType == Type::Int64Ty){
new StoreInst(i, longLocals[index], false, currentBlock);
++index;
- } else if (cur == AssessorDesc::dBool || cur == AssessorDesc::dChar) {
+ } else if (cur->isUnsigned()) {
new StoreInst(new ZExtInst(i, Type::Int32Ty, "", currentBlock),
intLocals[index], false, currentBlock);
- } else if (cur == AssessorDesc::dByte || cur == AssessorDesc::dShort) {
+ } else if (curType == Type::Int8Ty || curType == Type::Int16Ty) {
new StoreInst(new SExtInst(i, Type::Int32Ty, "", currentBlock),
intLocals[index], false, currentBlock);
- } else if (cur == AssessorDesc::dInt) {
+ } else if (curType == Type::Int32Ty) {
new StoreInst(i, intLocals[index], false, currentBlock);
- } else if (cur == AssessorDesc::dDouble) {
+ } else if (curType == Type::DoubleTy) {
new StoreInst(i, doubleLocals[index], false, currentBlock);
++index;
- } else if (cur == AssessorDesc::dFloat) {
+ } else if (curType == Type::FloatTy) {
new StoreInst(i, floatLocals[index], false, currentBlock);
} else {
new StoreInst(i, objectLocals[index], false, currentBlock);
@@ -1139,7 +1142,7 @@
c = new FCmpInst(FCmpInst::FCMP_UNO, val1, val2, "", currentBlock);
r = llvm::SelectInst::Create(c, l ? one : minus, r, "", currentBlock);
- push(r, AssessorDesc::dInt);
+ push(r, false);
}
@@ -1152,39 +1155,39 @@
// Lookup the constant pool cache
Value* val = getConstantPoolAt(index, JnjvmModule::StringLookupFunction,
JnjvmModule::JavaObjectType, 0, false);
- push(val, AssessorDesc::dRef);
+ push(val, false);
#else
const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[index]);
JavaString* str = JavaThread::get()->isolate->UTF8ToStr(utf8);
LLVMStringInfo* LSI = module->getStringInfo(str);
Value* val = LSI->getDelegatee(this);
- push(val, AssessorDesc::dRef);
+ push(val, false);
#endif
} else if (type == JavaConstantPool::ConstantLong) {
push(ConstantInt::get(Type::Int64Ty, ctpInfo->LongAt(index)),
- AssessorDesc::dLong);
+ false);
} else if (type == JavaConstantPool::ConstantDouble) {
push(ConstantFP::get(Type::DoubleTy, ctpInfo->DoubleAt(index)),
- AssessorDesc::dDouble);
+ false);
} else if (type == JavaConstantPool::ConstantInteger) {
push(ConstantInt::get(Type::Int32Ty, ctpInfo->IntegerAt(index)),
- AssessorDesc::dInt);
+ false);
} else if (type == JavaConstantPool::ConstantFloat) {
push(ConstantFP::get(Type::FloatTy, ctpInfo->FloatAt(index)),
- AssessorDesc::dFloat);
+ false);
} else if (type == JavaConstantPool::ConstantClass) {
#ifndef MULTIPLE_VM
if (ctpInfo->ctpRes[index]) {
CommonClass* cl = (CommonClass*)(ctpInfo->ctpRes[index]);
LLVMCommonClassInfo* LCI = module->getClassInfo(cl);
- push(LCI->getDelegatee(this), AssessorDesc::dRef);
+ push(LCI->getDelegatee(this), false);
} else {
#endif
Value* val = getResolvedClass(index, false);
Value* res = CallInst::Create(JnjvmModule::GetClassDelegateeFunction,
val, "", currentBlock);
- push(res, AssessorDesc::dRef);
+ push(res, false);
#ifndef MULTIPLE_VM
}
#endif
@@ -1274,7 +1277,7 @@
void JavaJIT::setCurrentBlock(BasicBlock* newBlock) {
- std::vector< std::pair<Value*, const AssessorDesc*> > newStack;
+ std::vector< std::pair<Value*, bool> > newStack;
uint32 index = 0;
for (BasicBlock::iterator i = newBlock->begin(), e = newBlock->end(); i != e;
++i, ++index) {
@@ -1285,7 +1288,7 @@
const llvm::Type* type = i->getType();
if (type == Type::Int32Ty || type == Type::Int16Ty ||
type == Type::Int8Ty) {
- newStack.push_back(std::make_pair(i, AssessorDesc::dInt));
+ newStack.push_back(std::make_pair(i, false));
} else {
newStack.push_back(std::make_pair(i, stack[index].second));
}
@@ -1298,16 +1301,17 @@
static void testPHINodes(BasicBlock* dest, BasicBlock* insert, JavaJIT* jit) {
if(dest->empty()) {
- for (std::vector< std::pair<Value*, const AssessorDesc*> >::iterator i =
+ for (std::vector< std::pair<Value*, bool> >::iterator i =
jit->stack.begin(),
e = jit->stack.end(); i!= e; ++i) {
Value* cur = i->first;
- const AssessorDesc* func = i->second;
+ bool unsign = i->second;
PHINode* node = 0;
- if (func == AssessorDesc::dChar || func == AssessorDesc::dBool) {
+ const Type* type = cur->getType();
+ if (unsign) {
node = llvm::PHINode::Create(Type::Int32Ty, "", dest);
cur = new ZExtInst(cur, Type::Int32Ty, "", jit->currentBlock);
- } else if (func == AssessorDesc::dByte || func == AssessorDesc::dShort) {
+ } else if (type == Type::Int8Ty || type == Type::Int16Ty) {
node = llvm::PHINode::Create(Type::Int32Ty, "", dest);
cur = new SExtInst(cur, Type::Int32Ty, "", jit->currentBlock);
} else {
@@ -1316,7 +1320,7 @@
node->addIncoming(cur, insert);
}
} else {
- std::vector< std::pair<Value*, const AssessorDesc*> >::iterator stackit =
+ std::vector< std::pair<Value*, bool> >::iterator stackit =
jit->stack.begin();
for (BasicBlock::iterator i = dest->begin(), e = dest->end(); i != e;
++i) {
@@ -1325,11 +1329,12 @@
} else {
Instruction* ins = i;
Value* cur = stackit->first;
- const AssessorDesc* func = stackit->second;
+ const Type* type = cur->getType();
+ bool unsign = stackit->second;
- if (func == AssessorDesc::dChar || func == AssessorDesc::dBool) {
+ if (unsign) {
cur = new ZExtInst(cur, Type::Int32Ty, "", jit->currentBlock);
- } else if (func == AssessorDesc::dByte || func == AssessorDesc::dShort) {
+ } else if (type == Type::Int8Ty || type == Type::Int16Ty) {
cur = new SExtInst(cur, Type::Int32Ty, "", jit->currentBlock);
}
@@ -1372,13 +1377,12 @@
if (it->get() == Type::Int64Ty || it->get() == Type::DoubleTy) {
pop();
}
- const AssessorDesc* func = topFunc();
+ bool unsign = topFunc();
Value* tmp = pop();
const Type* type = it->get();
if (tmp->getType() != type) { // int8 or int16
- convertValue(tmp, type, currentBlock,
- func == AssessorDesc::dChar || func == AssessorDesc::dBool);
+ convertValue(tmp, type, currentBlock, unsign);
}
args[i] = tmp;
@@ -1577,9 +1581,9 @@
const llvm::Type* retType = virtualType->getReturnType();
if (retType != Type::VoidTy) {
- push(val, signature->ret->funcs);
+ push(val, signature->ret->isUnsigned());
if (retType == Type::DoubleTy || retType == Type::Int64Ty) {
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(mvm::jit::constantZero, false);
}
}
@@ -1629,9 +1633,9 @@
const llvm::Type* retType = staticType->getReturnType();
if (retType != Type::VoidTy) {
- push(val, signature->ret->funcs);
+ push(val, signature->ret->isUnsigned());
if (retType == Type::DoubleTy || retType == Type::Int64Ty) {
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(mvm::jit::constantZero, false);
}
}
}
@@ -1818,7 +1822,7 @@
new StoreInst(Cl, GEP, currentBlock);
- push(val, AssessorDesc::dRef);
+ push(val, false);
}
Value* JavaJIT::arraySize(Value* val) {
@@ -1922,20 +1926,21 @@
void JavaJIT::setStaticField(uint16 index) {
- const AssessorDesc* ass = topFunc();
+ bool unsign = topFunc();
Value* val = pop();
+
Typedef* sign = compilingClass->ctpInfo->infoOfField(index);
- uint8 id = sign->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
+ LLVMAssessorInfo& LAI = module->getTypedefInfo(sign);
const Type* type = LAI.llvmType;
+
if (type == Type::Int64Ty || type == Type::DoubleTy) {
val = pop();
}
+
Value* ptr = ldResolved(index, true, 0, type, LAI.llvmTypePtr);
if (type != val->getType()) { // int1, int8, int16
- convertValue(val, type, currentBlock,
- ass == AssessorDesc::dChar || ass == AssessorDesc::dBool);
+ convertValue(val, type, currentBlock, unsign);
}
new StoreInst(val, ptr, false, currentBlock);
@@ -1943,23 +1948,22 @@
void JavaJIT::getStaticField(uint16 index) {
Typedef* sign = compilingClass->ctpInfo->infoOfField(index);
- uint8 id = sign->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
- Value* ptr = ldResolved(index, true, 0, LAI.llvmType,
- LAI.llvmTypePtr);
- push(new LoadInst(ptr, "", currentBlock), sign->funcs);
+ LLVMAssessorInfo& LAI = module->getTypedefInfo(sign);
const Type* type = LAI.llvmType;
+
+ Value* ptr = ldResolved(index, true, 0, type, LAI.llvmTypePtr);
+
+ push(new LoadInst(ptr, "", currentBlock), sign->isUnsigned());
if (type == Type::Int64Ty || type == Type::DoubleTy) {
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(mvm::jit::constantZero, false);
}
}
void JavaJIT::setVirtualField(uint16 index) {
- const AssessorDesc* ass = topFunc();
+ bool unsign = topFunc();
Value* val = pop();
Typedef* sign = compilingClass->ctpInfo->infoOfField(index);
- uint8 id = sign->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
+ LLVMAssessorInfo& LAI = module->getTypedefInfo(sign);
const Type* type = LAI.llvmType;
if (type == Type::Int64Ty || type == Type::DoubleTy) {
@@ -1968,12 +1972,10 @@
Value* object = pop();
JITVerifyNull(object);
- Value* ptr = ldResolved(index, false, object, type,
- LAI.llvmTypePtr);
+ Value* ptr = ldResolved(index, false, object, type, LAI.llvmTypePtr);
if (type != val->getType()) { // int1, int8, int16
- convertValue(val, type, currentBlock,
- ass == AssessorDesc::dChar || ass == AssessorDesc::dBool);
+ convertValue(val, type, currentBlock, unsign);
}
new StoreInst(val, ptr, false, currentBlock);
@@ -1981,16 +1983,16 @@
void JavaJIT::getVirtualField(uint16 index) {
Typedef* sign = compilingClass->ctpInfo->infoOfField(index);
+ LLVMAssessorInfo& LAI = module->getTypedefInfo(sign);
+ const Type* type = LAI.llvmType;
Value* obj = pop();
JITVerifyNull(obj);
- uint8 id = sign->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
- Value* ptr = ldResolved(index, false, obj, LAI.llvmType,
- LAI.llvmTypePtr);
- push(new LoadInst(ptr, "", currentBlock), sign->funcs);
- const Type* type = LAI.llvmType;
+
+ Value* ptr = ldResolved(index, false, obj, type, LAI.llvmTypePtr);
+
+ push(new LoadInst(ptr, "", currentBlock), sign->isUnsigned());
if (type == Type::Int64Ty || type == Type::DoubleTy) {
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(mvm::jit::constantZero, false);
}
}
@@ -2168,9 +2170,9 @@
currentBlock = endBlock;
if (node) {
- push(node, signature->ret->funcs);
+ push(node, signature->ret->isUnsigned());
if (retType == Type::DoubleTy || retType == Type::Int64Ty) {
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(mvm::jit::constantZero, false);
}
}
}
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.h?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.h (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.h Fri Sep 19 09:50:39 2008
@@ -24,7 +24,6 @@
#include "mvm/Object.h"
#include "mvm/PrintBuffer.h"
-#include "JavaTypes.h"
#include "JnjvmModule.h"
namespace jnjvm {
@@ -102,16 +101,12 @@
// stack manipulation
- std::vector< std::pair<llvm::Value*, const AssessorDesc*> > stack;
- void push(llvm::Value* val, const AssessorDesc* ass) {
- assert(LLVMAssessorInfo::AssessorInfo[ass->numId].llvmType ==
- val->getType());
- stack.push_back(std::make_pair(val, ass));
+ std::vector< std::pair<llvm::Value*, bool> > stack;
+ void push(llvm::Value* val, bool unsign) {
+ stack.push_back(std::make_pair(val, unsign));
}
- void push(std::pair<llvm::Value*, const AssessorDesc*> pair) {
- assert(LLVMAssessorInfo::AssessorInfo[pair.second->numId].llvmType ==
- pair.first->getType());
+ void push(std::pair<llvm::Value*, bool> pair) {
stack.push_back(pair);
}
@@ -125,7 +120,7 @@
return stack.back().first;
}
- const AssessorDesc* topFunc() {
+ bool topFunc() {
return stack.back().second;
}
@@ -135,11 +130,11 @@
llvm::Value* popAsInt() {
llvm::Value * ret = top();
- const AssessorDesc* ass = topFunc();
+ bool unsign = topFunc();
stack.pop_back();
if (ret->getType() != llvm::Type::Int32Ty) {
- if (ass == AssessorDesc::dChar || ass == AssessorDesc::dBool) {
+ if (unsign) {
ret = new llvm::ZExtInst(ret, llvm::Type::Int32Ty, "", currentBlock);
} else {
ret = new llvm::SExtInst(ret, llvm::Type::Int32Ty, "", currentBlock);
@@ -150,8 +145,8 @@
}
- std::pair<llvm::Value*, const AssessorDesc*> popPair() {
- std::pair<llvm::Value*, const AssessorDesc*> ret = stack.back();
+ std::pair<llvm::Value*, bool> popPair() {
+ std::pair<llvm::Value*, bool> ret = stack.back();
stack.pop_back();
return ret;
}
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJITOpcodes.cpp?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJITOpcodes.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJITOpcodes.cpp Fri Sep 19 09:50:39 2008
@@ -136,85 +136,85 @@
#endif
if (opinfo->reqSuppl) {
- push(new LoadInst(supplLocal, "", currentBlock), AssessorDesc::dRef);
+ push(new LoadInst(supplLocal, "", currentBlock), false);
}
switch (bytecodes[i]) {
case ACONST_NULL :
- push(JnjvmModule::JavaObjectNullConstant, AssessorDesc::dRef);
+ push(JnjvmModule::JavaObjectNullConstant, false);
break;
case ICONST_M1 :
- push(mvm::jit::constantMinusOne, AssessorDesc::dInt);
+ push(mvm::jit::constantMinusOne, false);
break;
case ICONST_0 :
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(mvm::jit::constantZero, false);
break;
case ICONST_1 :
- push(mvm::jit::constantOne, AssessorDesc::dInt);
+ push(mvm::jit::constantOne, false);
break;
case ICONST_2 :
- push(mvm::jit::constantTwo, AssessorDesc::dInt);
+ push(mvm::jit::constantTwo, false);
break;
case ICONST_3 :
- push(mvm::jit::constantThree, AssessorDesc::dInt);
+ push(mvm::jit::constantThree, false);
break;
case ICONST_4 :
- push(mvm::jit::constantFour, AssessorDesc::dInt);
+ push(mvm::jit::constantFour, false);
break;
case ICONST_5 :
- push(mvm::jit::constantFive, AssessorDesc::dInt);
+ push(mvm::jit::constantFive, false);
break;
case LCONST_0 :
- push(mvm::jit::constantLongZero, AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(mvm::jit::constantLongZero, false);
+ push(mvm::jit::constantZero, false);
break;
case LCONST_1 :
- push(mvm::jit::constantLongOne, AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(mvm::jit::constantLongOne, false);
+ push(mvm::jit::constantZero, false);
break;
case FCONST_0 :
- push(mvm::jit::constantFloatZero, AssessorDesc::dFloat);
+ push(mvm::jit::constantFloatZero, false);
break;
case FCONST_1 :
- push(mvm::jit::constantFloatOne, AssessorDesc::dFloat);
+ push(mvm::jit::constantFloatOne, false);
break;
case FCONST_2 :
- push(mvm::jit::constantFloatTwo, AssessorDesc::dFloat);
+ push(mvm::jit::constantFloatTwo, false);
break;
case DCONST_0 :
- push(mvm::jit::constantDoubleZero, AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(mvm::jit::constantDoubleZero, false);
+ push(mvm::jit::constantZero, false);
break;
case DCONST_1 :
- push(mvm::jit::constantDoubleOne, AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(mvm::jit::constantDoubleOne, false);
+ push(mvm::jit::constantZero, false);
break;
case BIPUSH :
push(ConstantExpr::getSExt(ConstantInt::get(Type::Int8Ty,
bytecodes[++i]),
- Type::Int32Ty), AssessorDesc::dInt);
+ Type::Int32Ty), false);
break;
case SIPUSH :
push(ConstantExpr::getSExt(ConstantInt::get(Type::Int16Ty,
readS2(bytecodes, i)),
- Type::Int32Ty), AssessorDesc::dInt);
+ Type::Int32Ty), false);
break;
case LDC :
@@ -227,138 +227,138 @@
case LDC2_W :
_ldc(readS2(bytecodes, i));
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(mvm::jit::constantZero, false);
break;
case ILOAD :
push(new LoadInst(intLocals[WREAD_U1(bytecodes, false, i)], "",
- currentBlock), AssessorDesc::dInt);
+ currentBlock), false);
break;
case LLOAD :
push(new LoadInst(longLocals[WREAD_U1(bytecodes, false, i)], "",
- currentBlock), AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ currentBlock), false);
+ push(mvm::jit::constantZero, false);
break;
case FLOAD :
push(new LoadInst(floatLocals[WREAD_U1(bytecodes, false, i)], "",
- currentBlock), AssessorDesc::dFloat);
+ currentBlock), false);
break;
case DLOAD :
push(new LoadInst(doubleLocals[WREAD_U1(bytecodes, false, i)], "",
- currentBlock), AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ currentBlock), false);
+ push(mvm::jit::constantZero, false);
break;
case ALOAD :
push(new LoadInst(objectLocals[WREAD_U1(bytecodes, false, i)], "",
- currentBlock), AssessorDesc::dRef);
+ currentBlock), false);
break;
case ILOAD_0 :
- push(new LoadInst(intLocals[0], "", currentBlock), AssessorDesc::dInt);
+ push(new LoadInst(intLocals[0], "", currentBlock), false);
break;
case ILOAD_1 :
- push(new LoadInst(intLocals[1], "", currentBlock), AssessorDesc::dInt);
+ push(new LoadInst(intLocals[1], "", currentBlock), false);
break;
case ILOAD_2 :
- push(new LoadInst(intLocals[2], "", currentBlock), AssessorDesc::dInt);
+ push(new LoadInst(intLocals[2], "", currentBlock), false);
break;
case ILOAD_3 :
- push(new LoadInst(intLocals[3], "", currentBlock), AssessorDesc::dInt);
+ push(new LoadInst(intLocals[3], "", currentBlock), false);
break;
case LLOAD_0 :
push(new LoadInst(longLocals[0], "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
case LLOAD_1 :
push(new LoadInst(longLocals[1], "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
case LLOAD_2 :
push(new LoadInst(longLocals[2], "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
case LLOAD_3 :
push(new LoadInst(longLocals[3], "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
case FLOAD_0 :
push(new LoadInst(floatLocals[0], "", currentBlock),
- AssessorDesc::dFloat);
+ false);
break;
case FLOAD_1 :
push(new LoadInst(floatLocals[1], "", currentBlock),
- AssessorDesc::dFloat);
+ false);
break;
case FLOAD_2 :
push(new LoadInst(floatLocals[2], "", currentBlock),
- AssessorDesc::dFloat);
+ false);
break;
case FLOAD_3 :
push(new LoadInst(floatLocals[3], "", currentBlock),
- AssessorDesc::dFloat);
+ false);
break;
case DLOAD_0 :
push(new LoadInst(doubleLocals[0], "", currentBlock),
- AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
case DLOAD_1 :
push(new LoadInst(doubleLocals[1], "", currentBlock),
- AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
case DLOAD_2 :
push(new LoadInst(doubleLocals[2], "", currentBlock),
- AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
case DLOAD_3 :
push(new LoadInst(doubleLocals[3], "", currentBlock),
- AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
case ALOAD_0 :
push(new LoadInst(objectLocals[0], "", currentBlock),
- AssessorDesc::dRef);
+ false);
break;
case ALOAD_1 :
push(new LoadInst(objectLocals[1], "", currentBlock),
- AssessorDesc::dRef);
+ false);
break;
case ALOAD_2 :
push(new LoadInst(objectLocals[2], "", currentBlock),
- AssessorDesc::dRef);
+ false);
break;
case ALOAD_3 :
push(new LoadInst(objectLocals[3], "", currentBlock),
- AssessorDesc::dRef);
+ false);
break;
case IALOAD : {
@@ -366,7 +366,7 @@
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
JnjvmModule::JavaArraySInt32Type);
- push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dInt);
+ push(new LoadInst(ptr, "", currentBlock), false);
break;
}
@@ -375,8 +375,8 @@
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
JnjvmModule::JavaArrayLongType);
- push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(new LoadInst(ptr, "", currentBlock), false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -385,7 +385,7 @@
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
JnjvmModule::JavaArrayFloatType);
- push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dFloat);
+ push(new LoadInst(ptr, "", currentBlock), false);
break;
}
@@ -394,8 +394,8 @@
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
JnjvmModule::JavaArrayDoubleType);
- push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(new LoadInst(ptr, "", currentBlock), false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -404,7 +404,7 @@
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
JnjvmModule::JavaArrayObjectType);
- push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dRef);
+ push(new LoadInst(ptr, "", currentBlock), false);
break;
}
@@ -415,7 +415,7 @@
JnjvmModule::JavaArraySInt8Type);
Value* val = new LoadInst(ptr, "", currentBlock);
push(new SExtInst(val, Type::Int32Ty, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -426,7 +426,7 @@
JnjvmModule::JavaArrayUInt16Type);
Value* val = new LoadInst(ptr, "", currentBlock);
push(new ZExtInst(val, Type::Int32Ty, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -437,7 +437,7 @@
JnjvmModule::JavaArraySInt16Type);
Value* val = new LoadInst(ptr, "", currentBlock);
push(new SExtInst(val, Type::Int32Ty, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -640,11 +640,11 @@
}
case CASTORE : {
- const AssessorDesc* ass = topFunc();
Value* val = pop();
- if (ass == AssessorDesc::dInt) {
+ const Type* type = val->getType();
+ if (type == Type::Int32Ty) {
val = new TruncInst(val, Type::Int16Ty, "", currentBlock);
- } else if (ass == AssessorDesc::dByte || ass == AssessorDesc::dBool) {
+ } else if (type == Type::Int8Ty) {
val = new ZExtInst(val, Type::Int16Ty, "", currentBlock);
}
Value* index = pop();
@@ -656,11 +656,11 @@
}
case SASTORE : {
- const AssessorDesc* ass = topFunc();
Value* val = pop();
- if (ass == AssessorDesc::dInt) {
+ const Type* type = val->getType();
+ if (type == Type::Int32Ty) {
val = new TruncInst(val, Type::Int16Ty, "", currentBlock);
- } else if (ass == AssessorDesc::dByte || ass == AssessorDesc::dBool) {
+ } else if (type == Type::Int8Ty) {
val = new SExtInst(val, Type::Int16Ty, "", currentBlock);
}
Value* index = pop();
@@ -684,8 +684,8 @@
break;
case DUP_X1 : {
- std::pair<Value*, const AssessorDesc*> one = popPair();
- std::pair<Value*, const AssessorDesc*> two = popPair();
+ std::pair<Value*, bool> one = popPair();
+ std::pair<Value*, bool> two = popPair();
push(one);
push(two);
push(one);
@@ -693,9 +693,9 @@
}
case DUP_X2 : {
- std::pair<Value*, const AssessorDesc*> one = popPair();
- std::pair<Value*, const AssessorDesc*> two = popPair();
- std::pair<Value*, const AssessorDesc*> three = popPair();
+ std::pair<Value*, bool> one = popPair();
+ std::pair<Value*, bool> two = popPair();
+ std::pair<Value*, bool> three = popPair();
push(one);
push(three);
push(two);
@@ -709,9 +709,9 @@
break;
case DUP2_X1 : {
- std::pair<Value*, const AssessorDesc*> one = popPair();
- std::pair<Value*, const AssessorDesc*> two = popPair();
- std::pair<Value*, const AssessorDesc*> three = popPair();
+ std::pair<Value*, bool> one = popPair();
+ std::pair<Value*, bool> two = popPair();
+ std::pair<Value*, bool> three = popPair();
push(two);
push(one);
@@ -724,10 +724,10 @@
}
case DUP2_X2 : {
- std::pair<Value*, const AssessorDesc*> one = popPair();
- std::pair<Value*, const AssessorDesc*> two = popPair();
- std::pair<Value*, const AssessorDesc*> three = popPair();
- std::pair<Value*, const AssessorDesc*> four = popPair();
+ std::pair<Value*, bool> one = popPair();
+ std::pair<Value*, bool> two = popPair();
+ std::pair<Value*, bool> three = popPair();
+ std::pair<Value*, bool> four = popPair();
push(two);
push(one);
@@ -741,8 +741,8 @@
}
case SWAP : {
- std::pair<Value*, const AssessorDesc*> one = popPair();
- std::pair<Value*, const AssessorDesc*> two = popPair();
+ std::pair<Value*, bool> one = popPair();
+ std::pair<Value*, bool> two = popPair();
push(one);
push(two);
break;
@@ -752,7 +752,7 @@
Value* val2 = popAsInt();
Value* val1 = popAsInt();
push(BinaryOperator::createAdd(val1, val2, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -762,8 +762,8 @@
pop();
llvm::Value* val1 = pop();
push(BinaryOperator::createAdd(val1, val2, "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -771,7 +771,7 @@
Value* val2 = pop();
Value* val1 = pop();
push(BinaryOperator::createAdd(val1, val2, "", currentBlock),
- AssessorDesc::dFloat);
+ false);
break;
}
@@ -781,8 +781,8 @@
pop();
llvm::Value* val1 = pop();
push(BinaryOperator::createAdd(val1, val2, "", currentBlock),
- AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -790,7 +790,7 @@
Value* val2 = popAsInt();
Value* val1 = popAsInt();
push(BinaryOperator::createSub(val1, val2, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
case LSUB : {
@@ -799,8 +799,8 @@
pop();
llvm::Value* val1 = pop();
push(BinaryOperator::createSub(val1, val2, "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -808,7 +808,7 @@
Value* val2 = pop();
Value* val1 = pop();
push(BinaryOperator::createSub(val1, val2, "", currentBlock),
- AssessorDesc::dFloat);
+ false);
break;
}
@@ -818,8 +818,8 @@
pop();
llvm::Value* val1 = pop();
push(BinaryOperator::createSub(val1, val2, "", currentBlock),
- AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -827,7 +827,7 @@
Value* val2 = popAsInt();
Value* val1 = popAsInt();
push(BinaryOperator::createMul(val1, val2, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -837,8 +837,8 @@
pop();
llvm::Value* val1 = pop();
push(BinaryOperator::createMul(val1, val2, "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -846,7 +846,7 @@
Value* val2 = pop();
Value* val1 = pop();
push(BinaryOperator::createMul(val1, val2, "", currentBlock),
- AssessorDesc::dFloat);
+ false);
break;
}
@@ -856,8 +856,8 @@
pop();
llvm::Value* val1 = pop();
push(BinaryOperator::createMul(val1, val2, "", currentBlock),
- AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -865,7 +865,7 @@
Value* val2 = popAsInt();
Value* val1 = popAsInt();
push(BinaryOperator::createSDiv(val1, val2, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -875,8 +875,8 @@
pop();
llvm::Value* val1 = pop();
push(BinaryOperator::createSDiv(val1, val2, "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -884,7 +884,7 @@
Value* val2 = pop();
Value* val1 = pop();
push(BinaryOperator::createFDiv(val1, val2, "", currentBlock),
- AssessorDesc::dFloat);
+ false);
break;
}
@@ -894,8 +894,8 @@
pop();
llvm::Value* val1 = pop();
push(BinaryOperator::createFDiv(val1, val2, "", currentBlock),
- AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -903,7 +903,7 @@
Value* val2 = popAsInt();
Value* val1 = popAsInt();
push(BinaryOperator::createSRem(val1, val2, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -913,8 +913,8 @@
pop();
llvm::Value* val1 = pop();
push(BinaryOperator::createSRem(val1, val2, "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -922,7 +922,7 @@
Value* val2 = pop();
Value* val1 = pop();
push(BinaryOperator::createFRem(val1, val2, "", currentBlock),
- AssessorDesc::dFloat);
+ false);
break;
}
@@ -932,8 +932,8 @@
pop();
llvm::Value* val1 = pop();
push(BinaryOperator::createFRem(val1, val2, "", currentBlock),
- AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -941,30 +941,30 @@
push(BinaryOperator::createSub(
mvm::jit::constantZero,
popAsInt(), "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
case LNEG : {
pop();
push(BinaryOperator::createSub(
mvm::jit::constantLongZero,
- pop(), "", currentBlock), AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ pop(), "", currentBlock), false);
+ push(mvm::jit::constantZero, false);
break;
}
case FNEG :
push(BinaryOperator::createSub(
mvm::jit::constantFloatMinusZero,
- pop(), "", currentBlock), AssessorDesc::dFloat);
+ pop(), "", currentBlock), false);
break;
case DNEG : {
pop();
push(BinaryOperator::createSub(
mvm::jit::constantDoubleMinusZero,
- pop(), "", currentBlock), AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ pop(), "", currentBlock), false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -972,7 +972,7 @@
Value* val2 = popAsInt();
Value* val1 = popAsInt();
push(BinaryOperator::createShl(val1, val2, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -981,8 +981,8 @@
pop(); // remove the 0 on the stack
Value* val1 = pop();
push(BinaryOperator::createShl(val1, val2, "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -990,7 +990,7 @@
Value* val2 = popAsInt();
Value* val1 = popAsInt();
push(BinaryOperator::createAShr(val1, val2, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -999,8 +999,8 @@
pop(); // remove the 0 on the stack
Value* val1 = pop();
push(BinaryOperator::createAShr(val1, val2, "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -1010,7 +1010,7 @@
Value* mask = ConstantInt::get(Type::Int32Ty, 0x1F);
val2 = BinaryOperator::CreateAnd(val2, mask, "", currentBlock);
push(BinaryOperator::createLShr(val1, val2, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -1021,8 +1021,8 @@
pop(); // remove the 0 on the stack
Value* val1 = pop();
push(BinaryOperator::createLShr(val1, val2, "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -1030,7 +1030,7 @@
Value* val2 = popAsInt();
Value* val1 = popAsInt();
push(BinaryOperator::createAnd(val1, val2, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -1040,8 +1040,8 @@
pop(); // remove the 0 on the stack
Value* val1 = pop();
push(BinaryOperator::createAnd(val1, val2, "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -1049,7 +1049,7 @@
Value* val2 = popAsInt();
Value* val1 = popAsInt();
push(BinaryOperator::createOr(val1, val2, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -1059,8 +1059,8 @@
pop(); // remove the 0 on the stack
Value* val1 = pop();
push(BinaryOperator::createOr(val1, val2, "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -1068,7 +1068,7 @@
Value* val2 = popAsInt();
Value* val1 = popAsInt();
push(BinaryOperator::createXor(val1, val2, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -1078,8 +1078,8 @@
pop(); // remove the 0 on the stack
Value* val1 = pop();
push(BinaryOperator::createXor(val1, val2, "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
}
@@ -1096,38 +1096,38 @@
case I2L :
push(new SExtInst(pop(), llvm::Type::Int64Ty, "", currentBlock),
- AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
case I2F :
push(new SIToFPInst(pop(), llvm::Type::FloatTy, "", currentBlock),
- AssessorDesc::dFloat);
+ false);
break;
case I2D :
push(new SIToFPInst(pop(), llvm::Type::DoubleTy, "", currentBlock),
- AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
case L2I :
pop();
push(new TruncInst(pop(), llvm::Type::Int32Ty, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
case L2F :
pop();
push(new SIToFPInst(pop(), llvm::Type::FloatTy, "", currentBlock),
- AssessorDesc::dFloat);
+ false);
break;
case L2D :
pop();
push(new SIToFPInst(pop(), llvm::Type::DoubleTy, "", currentBlock),
- AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
case F2I : {
@@ -1174,7 +1174,7 @@
currentBlock = res;
- push(node, AssessorDesc::dInt);
+ push(node, false);
break;
}
@@ -1220,15 +1220,15 @@
currentBlock = res;
- push(node, AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(node, false);
+ push(mvm::jit::constantZero, false);
break;
}
case F2D :
push(new FPExtInst(pop(), llvm::Type::DoubleTy, "", currentBlock),
- AssessorDesc::dDouble);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ false);
+ push(mvm::jit::constantZero, false);
break;
case D2I : {
@@ -1275,7 +1275,7 @@
currentBlock = res;
- push(node, AssessorDesc::dInt);
+ push(node, false);
break;
}
@@ -1324,15 +1324,15 @@
currentBlock = res;
- push(node, AssessorDesc::dLong);
- push(mvm::jit::constantZero, AssessorDesc::dInt);
+ push(node, false);
+ push(mvm::jit::constantZero, false);
break;
}
case D2F :
pop(); // remove the 0 on the stack
push(new FPTruncInst(pop(), llvm::Type::FloatTy, "", currentBlock),
- AssessorDesc::dFloat);
+ false);
break;
case I2B : {
@@ -1341,7 +1341,7 @@
val = new TruncInst(val, llvm::Type::Int8Ty, "", currentBlock);
}
push(new SExtInst(val, llvm::Type::Int32Ty, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -1351,7 +1351,7 @@
val = new TruncInst(val, llvm::Type::Int16Ty, "", currentBlock);
}
push(new ZExtInst(val, llvm::Type::Int32Ty, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -1361,7 +1361,7 @@
val = new TruncInst(val, llvm::Type::Int16Ty, "", currentBlock);
}
push(new SExtInst(val, llvm::Type::Int32Ty, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -1392,7 +1392,7 @@
BranchInst::Create(res, currentBlock);
currentBlock = res;
- push(node, AssessorDesc::dInt);
+ push(node, false);
break;
}
@@ -1433,13 +1433,10 @@
case IFEQ : {
uint32 tmp = i;
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
- const AssessorDesc* ass = topFunc();
-
- uint8 id = ass->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
- llvm::Value* val = LAI.llvmNullConstant;
Value* op = pop();
+ const Type* type = op->getType();
+ Constant* val = Constant::getNullValue(type);
llvm::Value* test = new ICmpInst(ICmpInst::ICMP_EQ, op, val, "",
currentBlock);
BasicBlock* ifFalse = createBasicBlock("false IFEQ");
@@ -1451,13 +1448,10 @@
case IFNE : {
uint32 tmp = i;
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
- const AssessorDesc* ass = topFunc();
-
- uint8 id = ass->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
- llvm::Value* val = LAI.llvmNullConstant;
Value* op = pop();
+ const Type* type = op->getType();
+ Constant* val = Constant::getNullValue(type);
llvm::Value* test = new ICmpInst(ICmpInst::ICMP_NE, op, val, "",
currentBlock);
BasicBlock* ifFalse = createBasicBlock("false IFNE");
@@ -1469,11 +1463,9 @@
case IFLT : {
uint32 tmp = i;
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
- const AssessorDesc* ass = topFunc();
- uint8 id = ass->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
- llvm::Value* val = LAI.llvmNullConstant;
Value* op = pop();
+ const Type* type = op->getType();
+ Constant* val = Constant::getNullValue(type);
llvm::Value* test = new ICmpInst(ICmpInst::ICMP_SLT, op, val, "",
currentBlock);
BasicBlock* ifFalse = createBasicBlock("false IFLT");
@@ -1485,11 +1477,9 @@
case IFGE : {
uint32 tmp = i;
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
- const AssessorDesc* ass = topFunc();
- uint8 id = ass->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
- llvm::Value* val = LAI.llvmNullConstant;
Value* op = pop();
+ const Type* type = op->getType();
+ Constant* val = Constant::getNullValue(type);
llvm::Value* test = new ICmpInst(ICmpInst::ICMP_SGE, op, val, "",
currentBlock);
BasicBlock* ifFalse = createBasicBlock("false IFGE");
@@ -1501,11 +1491,9 @@
case IFGT : {
uint32 tmp = i;
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
- const AssessorDesc* ass = topFunc();
- uint8 id = ass->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
- llvm::Value* val = LAI.llvmNullConstant;
Value* op = pop();
+ const Type* type = op->getType();
+ Constant* val = Constant::getNullValue(type);
llvm::Value* test = new ICmpInst(ICmpInst::ICMP_SGT, op, val, "",
currentBlock);
BasicBlock* ifFalse = createBasicBlock("false IFGT");
@@ -1517,11 +1505,9 @@
case IFLE : {
uint32 tmp = i;
BasicBlock* ifTrue = opcodeInfos[tmp + readS2(bytecodes, i)].newBlock;
- const AssessorDesc* ass = topFunc();
- uint8 id = ass->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
- llvm::Value* val = LAI.llvmNullConstant;
Value* op = pop();
+ const Type* type = op->getType();
+ Constant* val = Constant::getNullValue(type);
llvm::Value* test = new ICmpInst(ICmpInst::ICMP_SLE, op, val, "",
currentBlock);
BasicBlock* ifFalse = createBasicBlock("false IFLE");
@@ -1707,12 +1693,13 @@
BasicBlock* def = opcodeInfos[tmp + readU4(bytecodes, i)].newBlock;
uint32 nbs = readU4(bytecodes, i);
- const AssessorDesc* ass = topFunc();
+ bool unsign = topFunc();
Value* key = pop();
- if (ass == AssessorDesc::dShort || ass == AssessorDesc::dByte) {
- key = new SExtInst(key, Type::Int32Ty, "", currentBlock);
- } else if (ass == AssessorDesc::dChar || ass == AssessorDesc::dBool) {
+ const Type* type = key->getType();
+ if (unsign) {
key = new ZExtInst(key, Type::Int32Ty, "", currentBlock);
+ } else if (type == Type::Int8Ty || type == Type::Int16Ty) {
+ key = new SExtInst(key, Type::Int32Ty, "", currentBlock);
}
for (uint32 cur = 0; cur < nbs; ++cur) {
Value* val = ConstantInt::get(Type::Int32Ty, readU4(bytecodes, i));
@@ -1727,11 +1714,10 @@
break;
}
case IRETURN : {
- const AssessorDesc* ass = topFunc();
+ bool unsign = topFunc();
Value* val = pop();
assert(val->getType()->isInteger());
- convertValue(val, returnType, currentBlock,
- ass == AssessorDesc::dChar || ass == AssessorDesc::dBool);
+ convertValue(val, returnType, currentBlock, unsign);
endNode->addIncoming(val, currentBlock);
BranchInst::Create(endBlock, currentBlock);
break;
@@ -1829,19 +1815,19 @@
if (bytecodes[i] == NEWARRAY) {
uint8 id = bytecodes[++i];
- AssessorDesc* ass = AssessorDesc::arrayType(id);
+ uint8 charId = AssessorDesc::arrayType(id);
#ifndef MULTIPLE_VM
- dcl = ass->getArrayClass();
+ dcl = JavaThread::get()->isolate->arrayClasses[id - 4];
#else
std::vector<Value*> args;
args.push_back(isolateLocal);
- args.push_back(ConstantInt::get(Type::Int32Ty, ass->numId));
+ args.push_back(ConstantInt::get(Type::Int32Ty, id - 4));
valCl = CallInst::Create(JnjvmModule::GetJnjvmArrayClassFunction,
args.begin(), args.end(), "", currentBlock);
#endif
TheVT = JnjvmModule::JavaObjectVirtualTableGV;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[ass->numId];
+ LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[charId];
sizeElement = LAI.sizeInBytesConstant;
} else {
uint16 index = readU2(bytecodes, i);
@@ -1851,7 +1837,7 @@
JnjvmClassLoader* JCL = compilingClass->classLoader;
const UTF8* arrayName =
- AssessorDesc::constructArrayName(JCL, 0, 1, className);
+ AssessorDesc::constructArrayName(JCL, 1, className);
dcl = JCL->constructArray(arrayName);
#else
@@ -1945,7 +1931,7 @@
currentBlock);
new StoreInst(valCl, GEP, currentBlock);
- push(res, AssessorDesc::dRef);
+ push(res, false);
break;
}
@@ -1953,7 +1939,7 @@
case ARRAYLENGTH : {
Value* val = pop();
JITVerifyNull(val);
- push(arraySize(val), AssessorDesc::dInt);
+ push(arraySize(val), false);
break;
}
@@ -2052,7 +2038,7 @@
args.begin(), args.end(), "",
currentBlock);
push(new ZExtInst(val, Type::Int32Ty, "", currentBlock),
- AssessorDesc::dInt);
+ false);
break;
}
@@ -2118,7 +2104,7 @@
Args.push_back(args[v]);
}
push(invoke(JnjvmModule::MultiCallNewFunction, Args, "", currentBlock),
- AssessorDesc::dRef);
+ false);
break;
}
@@ -2128,10 +2114,8 @@
case IFNULL : {
uint32 tmp = i;
- const AssessorDesc* ass = topFunc();
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[ass->numId];
- llvm::Value* nil = LAI.llvmNullConstant;
llvm::Value* val = pop();
+ Constant* nil = Constant::getNullValue(val->getType());
llvm::Value* test = new ICmpInst(ICmpInst::ICMP_EQ, val, nil, "",
currentBlock);
BasicBlock* ifFalse = createBasicBlock("true IFNULL");
@@ -2143,10 +2127,8 @@
case IFNONNULL : {
uint32 tmp = i;
- const AssessorDesc* ass = topFunc();
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[ass->numId];
- llvm::Value* nil = LAI.llvmNullConstant;
llvm::Value* val = pop();
+ Constant* nil = Constant::getNullValue(val->getType());
llvm::Value* test = new ICmpInst(ICmpInst::ICMP_NE, val, nil, "",
currentBlock);
BasicBlock* ifFalse = createBasicBlock("false IFNONNULL");
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaMetaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaMetaJIT.cpp?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaMetaJIT.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaMetaJIT.cpp Fri Sep 19 09:50:39 2008
@@ -55,38 +55,42 @@
#define readArgs(buf, signature, ap) \
for (std::vector<Typedef*>::iterator i = signature->args.begin(), \
e = signature->args.end(); i!= e; i++) { \
- const AssessorDesc* funcs = (*i)->funcs; \
- if (funcs == AssessorDesc::dLong) { \
- ((sint64*)buf)[0] = va_arg(ap, sint64); \
- buf += 2; \
- } else if (funcs == AssessorDesc::dInt) { \
- ((sint32*)buf)[0] = va_arg(ap, sint32); \
+ const Typedef* type = *i;\
+ if (type->isPrimitive()){\
+ const PrimitiveTypedef* prim = (PrimitiveTypedef*)type;\
+ if (prim->isLong()){\
+ ((sint64*)buf)[0] = va_arg(ap, sint64);\
+ buf += 2;\
+ } else if (prim->isInt()){ \
+ ((sint32*)buf)[0] = va_arg(ap, sint32);\
+ buf++; \
+ } else if (prim->isChar()){ \
+ ((uint32*)buf)[0] = va_arg(ap, uint32);\
+ buf++; \
+ } else if (prim->isShort()){ \
+ ((uint32*)buf)[0] = va_arg(ap, uint32);\
+ buf++; \
+ } else if (prim->isByte()){ \
+ ((uint32*)buf)[0] = va_arg(ap, uint32);\
+ buf++; \
+ } else if (prim->isBool()){ \
+ ((uint32*)buf)[0] = va_arg(ap, uint32);\
+ buf++;\
+ } else if (prim->isFloat()){\
+ ((float*)buf)[0] = (float)va_arg(ap, double);\
+ buf++;\
+ } else if (prim->isDouble()){\
+ ((double*)buf)[0] = va_arg(ap, double);\
+ buf += 2;\
+ } else{\
+ fprintf(stderr, "Can't happen");\
+ abort();\
+ }\
+ } else{\
+ ((JavaObject**)buf)[0] = va_arg(ap, JavaObject*);\
buf++; \
- } else if (funcs == AssessorDesc::dChar) { \
- ((uint32*)buf)[0] = va_arg(ap, uint32); \
- buf++; \
- } else if (funcs == AssessorDesc::dShort) { \
- ((uint32*)buf)[0] = va_arg(ap, uint32); \
- buf++; \
- } else if (funcs == AssessorDesc::dByte) { \
- ((uint32*)buf)[0] = va_arg(ap, uint32); \
- buf++; \
- } else if (funcs == AssessorDesc::dBool) { \
- ((uint32*)buf)[0] = va_arg(ap, uint32); \
- buf++; \
- } else if (funcs == AssessorDesc::dFloat) { \
- ((float*)buf)[0] = (float)va_arg(ap, double); \
- buf++; \
- } else if (funcs == AssessorDesc::dDouble) { \
- ((double*)buf)[0] = va_arg(ap, double); \
- buf += 2; \
- } else if (funcs == AssessorDesc::dRef || funcs == AssessorDesc::dTab) { \
- ((JavaObject**)buf)[0] = va_arg(ap, JavaObject*); \
- buf++; \
- } else { \
- assert(0 && "Should not be here"); \
- } \
- } \
+ }\
+ }\
#if 1//defined(__PPC__) && !defined(__MACH__)
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Fri Sep 19 09:50:39 2008
@@ -173,7 +173,7 @@
extern "C" UserClassArray* getArrayClass(UserCommonClass* cl) {
JnjvmClassLoader* JCL = cl->classLoader;
const UTF8* arrayName =
- AssessorDesc::constructArrayName(JCL, 0, 1, cl->getName());
+ AssessorDesc::constructArrayName(JCL, 1, cl->getName());
UserClassArray* dcl = JCL->constructArray(arrayName);
return dcl;
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaTypes.cpp?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaTypes.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaTypes.cpp Fri Sep 19 09:50:39 2008
@@ -39,113 +39,6 @@
const char AssessorDesc::I_BOOL = 'Z';
const char AssessorDesc::I_SEP = '/';
-AssessorDesc* AssessorDesc::dParg = 0;
-AssessorDesc* AssessorDesc::dPard = 0;
-AssessorDesc* AssessorDesc::dVoid = 0;
-AssessorDesc* AssessorDesc::dBool = 0;
-AssessorDesc* AssessorDesc::dByte = 0;
-AssessorDesc* AssessorDesc::dChar = 0;
-AssessorDesc* AssessorDesc::dShort = 0;
-AssessorDesc* AssessorDesc::dInt = 0;
-AssessorDesc* AssessorDesc::dFloat = 0;
-AssessorDesc* AssessorDesc::dLong = 0;
-AssessorDesc* AssessorDesc::dDouble = 0;
-AssessorDesc* AssessorDesc::dTab = 0;
-AssessorDesc* AssessorDesc::dRef = 0;
-
-AssessorDesc::AssessorDesc(bool dt, char bid, uint32 nb, uint32 nw,
- const char* name,
- JnjvmClassLoader* loader, uint8 nid,
- const char* assocName,
- UserClassPrimitive* prim, UserClassArray* cl) {
-
- AssessorDesc* res = this;
- res->numId = nid;
- res->doTrace = dt;
- res->byteId = bid;
- res->nbb = nb;
- res->nbw = nw;
- res->asciizName = name;
- res->UTF8Name = loader->asciizConstructUTF8(name);
-
- res->arrayClass = cl;
- if (assocName)
- res->assocClassName = loader->asciizConstructUTF8(assocName);
- else
- res->assocClassName = 0;
-
- if (bid != I_PARG && bid != I_PARD && bid != I_REF && bid != I_TAB) {
- res->primitiveClass = prim;
- if (res->arrayClass) {
- res->arrayClass->_baseClass = res->primitiveClass;
- res->arrayClass->status = ready;
- }
- } else {
- res->primitiveClass = 0;
- }
-}
-
-void AssessorDesc::initialise(JnjvmBootstrapLoader* vm) {
-
- dParg = new AssessorDesc(false, I_PARG, 0, 0, "(", vm, 0, 0, 0,
- 0);
- dPard = new AssessorDesc(false, I_PARD, 0, 0, ")", vm, 0, 0, 0,
- 0);
- dVoid = new AssessorDesc(false, I_VOID, 0, 0, "void",
- vm, VOID_ID, "java/lang/Void",
- vm->upcalls->OfVoid, 0);
- dBool = new AssessorDesc(false, I_BOOL, 1, 1, "boolean",
- vm,
- BOOL_ID, "java/lang/Boolean",
- vm->upcalls->OfBool,
- vm->upcalls->ArrayOfBool);
- dByte = new AssessorDesc(false, I_BYTE, 1, 1, "byte",
- vm, BYTE_ID, "java/lang/Byte",
- vm->upcalls->OfByte,
- vm->upcalls->ArrayOfByte);
- dChar = new AssessorDesc(false, I_CHAR, 2, 1, "char",
- vm, CHAR_ID, "java/lang/Character",
- vm->upcalls->OfChar,
- vm->upcalls->ArrayOfChar);
- dShort = new AssessorDesc(false, I_SHORT, 2, 1, "short",
- vm, SHORT_ID,
- "java/lang/Short",
- vm->upcalls->OfShort,
- vm->upcalls->ArrayOfShort);
- dInt = new AssessorDesc(false, I_INT, 4, 1, "int", vm,
- INT_ID, "java/lang/Integer",
- vm->upcalls->OfInt,
- vm->upcalls->ArrayOfInt);
- dFloat = new AssessorDesc(false, I_FLOAT, 4, 1, "float",
- vm,
- FLOAT_ID, "java/lang/Float",
- vm->upcalls->OfFloat,
- vm->upcalls->ArrayOfFloat);
- dLong = new AssessorDesc(false, I_LONG, 8, 2, "long",
- vm, LONG_ID, "java/lang/Long",
- vm->upcalls->OfLong,
- vm->upcalls->ArrayOfLong);
- dDouble = new AssessorDesc(false, I_DOUBLE, 8, 2, "double",
- vm,
- DOUBLE_ID, "java/lang/Double",
- vm->upcalls->OfDouble,
- vm->upcalls->ArrayOfDouble);
- dTab = new AssessorDesc(true, I_TAB, sizeof(void*), 1, "array",
- vm, ARRAY_ID, 0, 0, 0);
- dRef = new AssessorDesc(true, I_REF, sizeof(void*), 1, "reference",
- vm, OBJECT_ID,
- 0, 0, 0);
-
-}
-
-const char* AssessorDesc::printString() const {
- mvm::PrintBuffer *buf= mvm::PrintBuffer::alloc();
- buf->write("AssessorDescriptor<");
- buf->write(asciizName);
- buf->write(">");
- return buf->contents()->cString();
-}
-
static void typeError(const UTF8* name, short int l) {
if (l != 0) {
JavaThread::get()->isolate->
@@ -157,195 +50,152 @@
}
-void AssessorDesc::analyseIntern(const UTF8* name, uint32 pos,
- uint32 meth, AssessorDesc*& ass,
+bool AssessorDesc::analyseIntern(const UTF8* name, uint32 pos,
+ uint32 meth,
uint32& ret) {
short int cur = name->elements[pos];
switch (cur) {
- case I_PARG :
- ass = dParg;
- ret = pos + 1;
- break;
case I_PARD :
- ass = dPard;
ret = pos + 1;
- break;
+ return true;
case I_BOOL :
- ass = dBool;
ret = pos + 1;
- break;
+ return false;
case I_BYTE :
- ass = dByte;
ret = pos + 1;
- break;
+ return false;
case I_CHAR :
- ass = dChar;
ret = pos + 1;
- break;
+ return false;
case I_SHORT :
- ass = dShort;
ret = pos + 1;
- break;
+ return false;
case I_INT :
- ass = dInt;
ret = pos + 1;
- break;
+ return false;
case I_FLOAT :
- ass = dFloat;
ret = pos + 1;
- break;
+ return false;
case I_DOUBLE :
- ass = dDouble;
ret = pos + 1;
- break;
+ return false;
case I_LONG :
- ass = dLong;
ret = pos + 1;
- break;
+ return false;
case I_VOID :
- ass = dVoid;
ret = pos + 1;
- break;
+ return false;
case I_TAB :
if (meth == 1) {
pos++;
} else {
- AssessorDesc * typeIntern = dTab;
while (name->elements[++pos] == I_TAB) {}
- analyseIntern(name, pos, 1, typeIntern, pos);
+ analyseIntern(name, pos, 1, pos);
}
- ass = dTab;
ret = pos;
- break;
+ return false;
case I_REF :
if (meth != 2) {
while (name->elements[++pos] != I_END_REF) {}
}
- ass = dRef;
ret = pos + 1;
- break;
+ return false;
default :
typeError(name, cur);
}
+ return false;
}
-const UTF8* AssessorDesc::constructArrayName(JnjvmClassLoader *loader, AssessorDesc* ass,
+const UTF8* AssessorDesc::constructArrayName(JnjvmClassLoader *loader,
uint32 steps,
const UTF8* className) {
- if (ass) {
- uint16* buf = (uint16*)alloca((steps + 1) * sizeof(uint16));
- for (uint32 i = 0; i < steps; i++) {
- buf[i] = I_TAB;
- }
- buf[steps] = ass->byteId;
- return loader->readerConstructUTF8(buf, steps + 1);
- } else {
- uint32 len = className->size;
- uint32 pos = steps;
- AssessorDesc * funcs = (className->elements[0] == I_TAB ? dTab : dRef);
- uint32 n = steps + len + (funcs == dRef ? 2 : 0);
- uint16* buf = (uint16*)alloca(n * sizeof(uint16));
+ uint32 len = className->size;
+ uint32 pos = steps;
+ bool isTab = (className->elements[0] == I_TAB ? true : false);
+ uint32 n = steps + len + (isTab ? 0 : 2);
+ uint16* buf = (uint16*)alloca(n * sizeof(uint16));
- for (uint32 i = 0; i < steps; i++) {
- buf[i] = I_TAB;
- }
-
- if (funcs == dRef) {
- ++pos;
- buf[steps] = funcs->byteId;
- }
+ for (uint32 i = 0; i < steps; i++) {
+ buf[i] = I_TAB;
+ }
- for (uint32 i = 0; i < len; i++) {
- buf[pos + i] = className->elements[i];
- }
+ if (!isTab) {
+ ++pos;
+ buf[steps] = I_REF;
+ }
- if (funcs == dRef) {
- buf[n - 1] = I_END_REF;
- }
+ for (uint32 i = 0; i < len; i++) {
+ buf[pos + i] = className->elements[i];
+ }
- return loader->readerConstructUTF8(buf, n);
+ if (!isTab) {
+ buf[n - 1] = I_END_REF;
}
+
+ return loader->readerConstructUTF8(buf, n);
}
-AssessorDesc* AssessorDesc::arrayType(unsigned int t) {
+uint8 AssessorDesc::arrayType(unsigned int t) {
if (t == JavaArray::T_CHAR) {
- return AssessorDesc::dChar;
+ return I_CHAR;
} else if (t == JavaArray::T_BOOLEAN) {
- return AssessorDesc::dBool;
+ return I_BOOL;
} else if (t == JavaArray::T_INT) {
- return AssessorDesc::dInt;
+ return I_INT;
} else if (t == JavaArray::T_SHORT) {
- return AssessorDesc::dShort;
+ return I_SHORT;
} else if (t == JavaArray::T_BYTE) {
- return AssessorDesc::dByte;
+ return I_BYTE;
} else if (t == JavaArray::T_FLOAT) {
- return AssessorDesc::dFloat;
+ return I_FLOAT;
} else if (t == JavaArray::T_LONG) {
- return AssessorDesc::dLong;
+ return I_LONG;
} else if (t == JavaArray::T_DOUBLE) {
- return AssessorDesc::dDouble;
+ return I_DOUBLE;
} else {
JavaThread::get()->isolate->unknownError("unknown array type %d\n", t);
return 0;
}
}
-void Typedef::tPrintBuf(mvm::PrintBuffer* buf) const {
- if (pseudoAssocClassName == 0)
- buf->write(funcs->asciizName);
- else
- CommonClass::printClassName(pseudoAssocClassName, buf);
+void PrimitiveTypedef::tPrintBuf(mvm::PrintBuffer* buf) const {
+ prim->name->print(buf);
}
-AssessorDesc* AssessorDesc::byteIdToPrimitive(char id) {
+void ArrayTypedef::tPrintBuf(mvm::PrintBuffer* buf) const {
+ CommonClass::printClassName(keyName, buf);
+}
+
+void ObjectTypedef::tPrintBuf(mvm::PrintBuffer* buf) const {
+ CommonClass::printClassName(pseudoAssocClassName, buf);
+}
+
+UserClassPrimitive*
+AssessorDesc::byteIdToPrimitive(char id, Classpath* upcalls) {
switch (id) {
case I_FLOAT :
- return dFloat;
+ return upcalls->OfFloat;
case I_INT :
- return dInt;
+ return upcalls->OfInt;
case I_SHORT :
- return dShort;
+ return upcalls->OfShort;
case I_CHAR :
- return dChar;
+ return upcalls->OfChar;
case I_DOUBLE :
- return dDouble;
+ return upcalls->OfDouble;
case I_BYTE :
- return dByte;
+ return upcalls->OfByte;
case I_BOOL :
- return dBool;
+ return upcalls->OfBool;
case I_LONG :
- return dLong;
+ return upcalls->OfLong;
case I_VOID :
- return dVoid;
+ return upcalls->OfVoid;
default :
return 0;
}
}
-AssessorDesc* AssessorDesc::classNameToPrimitive(const UTF8* name) {
- if (name->equals(dFloat->assocClassName)) {
- return dFloat;
- } else if (name->equals(dInt->assocClassName)) {
- return dInt;
- } else if (name->equals(dShort->assocClassName)) {
- return dShort;
- } else if (name->equals(dChar->assocClassName)) {
- return dChar;
- } else if (name->equals(dDouble->assocClassName)) {
- return dDouble;
- } else if (name->equals(dByte->assocClassName)) {
- return dByte;
- } else if (name->equals(dBool->assocClassName)) {
- return dBool;
- } else if (name->equals(dLong->assocClassName)) {
- return dLong;
- } else if (name->equals(dVoid->assocClassName)) {
- return dVoid;
- } else {
- return 0;
- }
-}
-
const char* Typedef::printString() const {
mvm::PrintBuffer *buf= mvm::PrintBuffer::alloc();
buf->write("Type<");
@@ -354,14 +204,12 @@
return buf->contents()->cString();
}
-UserCommonClass* Typedef::assocClass(JnjvmClassLoader* loader) {
- if (pseudoAssocClassName == 0) {
- return funcs->getPrimitiveClass();
- } else if (funcs == AssessorDesc::dRef) {
- return loader->loadName(pseudoAssocClassName, false, true);
- } else {
- return loader->constructArray(pseudoAssocClassName);
- }
+UserCommonClass* ArrayTypedef::assocClass(JnjvmClassLoader* loader) const {
+ return loader->constructArray(keyName);
+}
+
+UserCommonClass* ObjectTypedef::assocClass(JnjvmClassLoader* loader) const {
+ return loader->loadName(pseudoAssocClassName, false, true);
}
void Typedef::humanPrintArgs(const std::vector<Typedef*>* args,
@@ -402,12 +250,11 @@
uint32 len = (uint32)name->size;
uint32 pos = 1;
uint32 pred = 0;
- AssessorDesc* funcs = 0;
while (pos < len) {
pred = pos;
- AssessorDesc::analyseIntern(name, pos, 0, funcs, pos);
- if (funcs == AssessorDesc::dPard) break;
+ bool end = AssessorDesc::analyseIntern(name, pos, 0, pos);
+ if (end) break;
else {
buf.push_back(loader->constructType(name->extract(loader->hashUTF8, pred, pos)));
}
@@ -417,7 +264,7 @@
typeError(name, 0);
}
- AssessorDesc::analyseIntern(name, pos, 0, funcs, pred);
+ AssessorDesc::analyseIntern(name, pos, 0, pred);
if (pred != len) {
typeError(name, 0);
@@ -435,38 +282,28 @@
}
-Typedef::Typedef(const UTF8* name, JnjvmClassLoader *loader) {
- Typedef* res = this;
- AssessorDesc* funcs = 0;
- uint32 next;
- AssessorDesc::analyseIntern(name, 0, 0, funcs, next);
-
- assert(funcs != AssessorDesc::dParg &&
- "Error: resolving a signature for a field");
- res->initialLoader = loader;
- res->keyName = name;
- res->funcs = funcs;
- if (isReference()) {
- res->pseudoAssocClassName = name->extract(loader->hashUTF8, 1, next - 1);
- } else if (isArray()) {
- res->pseudoAssocClassName = name;
- } else {
- res->pseudoAssocClassName = 0;
+Typedef* Typedef::constructType(const UTF8* name, UTF8Map* map, Jnjvm* vm) {
+ short int cur = name->elements[0];
+ Typedef* res = 0;
+ switch (cur) {
+ case AssessorDesc::I_TAB :
+ res = new ArrayTypedef(name);
+ break;
+ case AssessorDesc::I_REF :
+ res = new ObjectTypedef(name, map);
+ break;
+ default :
+ UserClassPrimitive* cl = vm->getPrimitiveClass((char)name->elements[0]);
+ assert(cl && "No primitive");
+ bool unsign = (cl == vm->upcalls->OfChar || cl == vm->upcalls->OfBool);
+ res = new PrimitiveTypedef(name, cl, unsign, cur);
}
-
-}
-
-bool Typedef::isArray() {
- return keyName->elements[0] == '[';
-}
-
-bool Typedef::isReference() {
- return keyName->elements[0] == 'L';
+ return res;
}
-bool Typedef::trace() {
- uint16 val = keyName->elements[0];
- return (val == '[' || val == 'L');
+ObjectTypedef::ObjectTypedef(const UTF8* name, UTF8Map* map) {
+ keyName = name;
+ pseudoAssocClassName = name->extract(map, 1, name->size - 1);
}
intptr_t Signdef::staticCallBuf() {
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaTypes.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaTypes.h?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaTypes.h (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaTypes.h Fri Sep 19 09:50:39 2008
@@ -17,6 +17,7 @@
namespace jnjvm {
+class Classpath;
class ClassArray;
class CommonClass;
class JavaArray;
@@ -29,6 +30,7 @@
class UserClassPrimitive;
class UserCommonClass;
class UTF8;
+class UTF8Map;
#define VOID_ID 0
#define BOOL_ID 1
@@ -39,12 +41,12 @@
#define FLOAT_ID 6
#define LONG_ID 7
#define DOUBLE_ID 8
-#define ARRAY_ID 9
-#define OBJECT_ID 10
+#define OBJECT_ID 9
+#define ARRAY_ID 10
#define NUM_ASSESSORS 11
-/// AssessorDesc - Description of a Java assessor: these are the letters found
-/// in Java signatures, e.g. "I" or "(".
+/// AssessorDesc - Helpful functions to analyse UTF8s and ids and get
+/// either Typedefs or Classes.
///
class AssessorDesc {
public:
@@ -65,213 +67,218 @@
static const char I_BOOL;
static const char I_SEP;
- /// doTrace - Is this assessor for garbage collected objects? True for
- /// the "L" assessor and the "[" assessor.
- ///
- bool doTrace;
+ static bool analyseIntern(const UTF8* name, uint32 pos,
+ uint32 meth,
+ uint32& ret);
- /// byteId - Letter reprensenting this assessor.
- ///
- char byteId;
+ static const UTF8* constructArrayName(JnjvmClassLoader* loader,
+ uint32 steps, const UTF8* className);
+
+ static uint8 arrayType(unsigned int t);
+
+ static UserClassPrimitive* byteIdToPrimitive(char id, Classpath* upcalls);
- /// nbb - Number of bytes of instances of this assessor (e.g. 4 for "I").
- ///
- uint32 nbb;
- /// nbw - Number of words of instances if this assessor (e.g. 2 for "D").
- ///
- uint32 nbw;
+};
- /// numId - A byte identifier from 0 to the number of assessors.
- ///
- uint8 numId;
- /// asciizName - The name of the assessor in asciiz, e.g. "void" for "V".
+/// Typedef - Each class has a Typedef representation. A Typedef is also a class
+/// which has not been loaded yet. Typedefs are hashed on the name of the class.
+/// Hashing is for memory purposes, not for comparison.
+///
+class Typedef {
+public:
+
+ /// keyName - The name of the Typedef. It is the representation of a class
+ /// in a Java signature, e.g. "Ljava/lang/Object;".
///
- const char* asciizName;
+ const UTF8* keyName;
- /// UTF8Name - The name of the assessor in UTF8, e.g. "void" for "V".
+ /// humanPrintArgs - Prints the list of typedef in a human readable form.
///
- const UTF8* UTF8Name;
+ static void humanPrintArgs(const std::vector<Typedef*>*,
+ mvm::PrintBuffer* buf);
- /// primitiveClass - The primitive Java class of this assessor. This class
- /// is internal to the JVM.
+ /// tPrintBuf - Prints the name of the class this Typedef represents.
///
- UserClassPrimitive* primitiveClass;
-
- /// assocClassName - The associated class name, e.g. "java/lang/Integer" for
- /// "I".
+ virtual void tPrintBuf(mvm::PrintBuffer* buf) const = 0;
+
+ /// printString - Print the Typedef for debugging purposes.
///
- const UTF8* assocClassName;
+ const char* printString() const;
- /// arrayClass - The primitive array class of the assessor, e.g. I[] for "I".
+ /// assocClass - Given the loaded, try to load the class represented by this
+ /// Typedef.
///
- UserClassArray* arrayClass;
+ virtual UserCommonClass* assocClass(JnjvmClassLoader* loader) const = 0;
+
+ /// Typedef - Create a new Typedef.
+ ///
+ static Typedef* constructType(const UTF8* name, UTF8Map* map, Jnjvm* vm);
+
+ virtual bool trace() const = 0;
+
+ virtual bool isPrimitive() const {
+ return false;
+ }
+
+ virtual bool isReference() const {
+ return true;
+ }
+
+ virtual bool isUnsigned() const {
+ return false;
+ }
-//===----------------------------------------------------------------------===//
-//
-// The set of assessors in Java. This set is unique and there are no other
-// assessors.
-//
-//===----------------------------------------------------------------------===//
+ virtual const UTF8* getName() const {
+ return keyName;
+ }
+ const UTF8* getKey() const {
+ return keyName;
+ }
- /// dParg - The "(" assessor.
- ///
- static AssessorDesc* dParg;
+};
- /// dPard - The ")" assessor.
+class PrimitiveTypedef : public Typedef {
+private:
+ UserClassPrimitive* prim;
+ bool unsign;
+ char charId;
+
+public:
+
+ /// tPrintBuf - Prints the name of the class this Typedef represents.
///
- static AssessorDesc* dPard;
+ virtual void tPrintBuf(mvm::PrintBuffer* buf) const;
+
- /// dVoid - The "V" assessor.
- ///
- static AssessorDesc* dVoid;
+ virtual bool trace() const {
+ return false;
+ }
+
+ virtual bool isPrimitive() const {
+ return true;
+ }
+
+ virtual bool isReference() const {
+ return false;
+ }
- /// dBool - The "Z" assessor.
- ///
- static AssessorDesc* dBool;
+ virtual bool isUnsigned() const {
+ return unsign;
+ }
- /// dByte - The "B" assessor.
- ///
- static AssessorDesc* dByte;
+ virtual UserCommonClass* assocClass(JnjvmClassLoader* loader) const {
+ return (UserCommonClass*)prim;
+ }
- /// dChar - The "C" assessor.
- ///
- static AssessorDesc* dChar;
+ PrimitiveTypedef(const UTF8* name, UserClassPrimitive* cl, bool u, char i) {
+ keyName = name;
+ prim = cl;
+ unsign = u;
+ charId = i;
+ }
+
+ bool isVoid() const {
+ return charId == AssessorDesc::I_VOID;
+ }
- /// dShort - The "S" assessor.
- ///
- static AssessorDesc* dShort;
+ bool isLong() const {
+ return charId == AssessorDesc::I_LONG;
+ }
- /// dInt - The "I" assessor.
- ///
- static AssessorDesc* dInt;
+ bool isInt() const {
+ return charId == AssessorDesc::I_INT;
+ }
- /// dFloat - The "F" assessor.
- ///
- static AssessorDesc* dFloat;
+ bool isChar() const {
+ return charId == AssessorDesc::I_CHAR;
+ }
- /// dLong - The "J" assessor.
- ///
- static AssessorDesc* dLong;
+ bool isShort() const {
+ return charId == AssessorDesc::I_SHORT;
+ }
- /// dDouble - The "D" assessor.
- ///
- static AssessorDesc* dDouble;
+ bool isByte() const {
+ return charId == AssessorDesc::I_BYTE;
+ }
- /// dTab - The "[" assessor.
- ///
- static AssessorDesc* dTab;
+ bool isBool() const {
+ return charId == AssessorDesc::I_BOOL;
+ }
- /// dRef - The "L" assessor.
- ///
- static AssessorDesc* dRef;
-
-//===----------------------------------------------------------------------===//
-//
-// End of assessors.
-//
-//===----------------------------------------------------------------------===//
+ bool isFloat() const {
+ return charId == AssessorDesc::I_FLOAT;
+ }
- /// AssessorDesc - Construct an assessor.
+ bool isDouble() const {
+ return charId == AssessorDesc::I_DOUBLE;
+ }
+
+ /// JInfo - Holds info useful for the JIT.
///
- AssessorDesc(bool dt, char bid, uint32 nb, uint32 nw,
- const char* name,
- JnjvmClassLoader* loader, uint8 nid,
- const char* assocName,
- UserClassPrimitive* prim, UserClassArray* cl);
-
+ mvm::JITInfo* JInfo;
- /// initialise - Construct all assessors.
+ /// getInfo - Get the JIT info of this signature. The info is created lazely.
///
- static void initialise(JnjvmBootstrapLoader* loader);
-
+ template<typename Ty>
+ Ty *getInfo() {
+ if (!JInfo) {
+ JInfo = new Ty(this);
+ }
- /// printString - Print the assessor for debugging purposes.
- ///
- const char* printString() const;
+ assert((void*)dynamic_cast<Ty*>(JInfo) == (void*)JInfo &&
+ "Invalid concrete type or multiple inheritence for getInfo");
+ return static_cast<Ty*>(JInfo);
+ }
+};
- static void analyseIntern(const UTF8* name, uint32 pos,
- uint32 meth, AssessorDesc*& ass,
- uint32& ret);
+class ArrayTypedef : public Typedef {
+public:
+ /// tPrintBuf - Prints the name of the class this Typedef represents.
+ ///
+ virtual void tPrintBuf(mvm::PrintBuffer* buf) const;
- static const UTF8* constructArrayName(JnjvmClassLoader* loader, AssessorDesc* ass,
- uint32 steps, const UTF8* className);
-
- static AssessorDesc* arrayType(unsigned int t);
- static AssessorDesc* byteIdToPrimitive(const char id);
- static AssessorDesc* classNameToPrimitive(const UTF8* name);
-
-#ifdef MULTIPLE_VM
- UserClassArray* getArrayClass() const;
- UserClassPrimitive* getPrimitiveClass() const;
-#else
- UserClassArray* getArrayClass() const {
- return arrayClass;
- }
- UserClassPrimitive* getPrimitiveClass() const {
- return primitiveClass;
+ virtual bool trace() const {
+ return true;
}
-#endif
-};
+ virtual UserCommonClass* assocClass(JnjvmClassLoader* loader) const;
-/// Typedef - Each class has a Typedef representation. A Typedef is also a class
-/// which has not been loaded yet. Typedefs are hashed on the name of the class.
-/// Hashing is for memory purposes, not for comparison.
-///
-class Typedef {
-public:
-
- /// keyName - The name of the Typedef. It is the representation of a class
- /// in a Java signature, e.g. "Ljava/lang/Object;".
- ///
- const UTF8* keyName;
+ ArrayTypedef(const UTF8* name) {
+ keyName = name;
+ }
+};
+class ObjectTypedef : public Typedef {
+private:
/// pseudoAssocClassName - The real name of the class this Typedef
/// represents, e.g. "java/lang/Object"
///
const UTF8* pseudoAssocClassName;
- /// funcs - The assessor for this Typedef. All Typedef must have the dRef
- /// or the dTab assessor, except the primive Typedefs.
- ///
- const AssessorDesc* funcs;
-
- /// initialLoader - The loader that first loaded this typedef.
- ///
- JnjvmClassLoader* initialLoader;
-
- /// printString - Print the Typedef for debugging purposes.
- ///
- const char* printString() const;
-
- /// assocClass - Given the loaded, try to load the class represented by this
- /// Typedef.
- ///
- UserCommonClass* assocClass(JnjvmClassLoader* loader);
-
- /// humanPrintArgs - Prints the list of typedef in a human readable form.
+public:
+ /// tPrintBuf - Prints the name of the class this Typedef represents.
///
- static void humanPrintArgs(const std::vector<Typedef*>*,
- mvm::PrintBuffer* buf);
+ virtual void tPrintBuf(mvm::PrintBuffer* buf) const;
- /// Typedef - Create a new Typedef.
- ///
- Typedef(const UTF8* name, JnjvmClassLoader* loader);
+ virtual bool trace() const {
+ return true;
+ }
- /// tPrintBuf - Prints the name of the class this Typedef represents.
- ///
- void tPrintBuf(mvm::PrintBuffer* buf) const;
+ virtual UserCommonClass* assocClass(JnjvmClassLoader* loader) const;
+
+ ObjectTypedef(const UTF8*name, UTF8Map* map);
- bool isArray();
- bool isReference();
- bool trace();
+ virtual const UTF8* getName() const {
+ return pseudoAssocClassName;
+ }
};
+
/// Signdef - This class represents a Java signature. Each Java method has a
/// Java signature. Signdefs are hashed for memory purposes, not equality
/// purposes.
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaUpcalls.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaUpcalls.h?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaUpcalls.h (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaUpcalls.h Fri Sep 19 09:50:39 2008
@@ -28,7 +28,7 @@
#define UPCALL_ARRAY_CLASS(vm, name, depth) \
vm->constructArray( \
- AssessorDesc::constructArrayName(vm, 0, depth, \
+ AssessorDesc::constructArrayName(vm, depth, \
vm->asciizConstructUTF8(name)))
#define UPCALL_CLASS_EXCEPTION(loader, name) \
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/Jni.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/Jni.cpp?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/Jni.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/Jni.cpp Fri Sep 19 09:50:39 2008
@@ -1746,7 +1746,7 @@
UserCommonClass* base = NativeUtil::resolvedImplClass(elementClass, true);
JnjvmClassLoader* loader = base->classLoader;
const UTF8* name = base->getName();
- const UTF8* arrayName = AssessorDesc::constructArrayName(loader, 0, 1, name);
+ const UTF8* arrayName = AssessorDesc::constructArrayName(loader, 1, name);
UserClassArray* array = loader->constructArray(arrayName);
ArrayObject* res = ArrayObject::acons(length, array, &(vm->allocator));
if (initialElement) {
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/Jnjvm.cpp?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/Jnjvm.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/Jnjvm.cpp Fri Sep 19 09:50:39 2008
@@ -84,6 +84,7 @@
/// If we're not in a multi-vm environment, this can be made static.
std::vector<void*> Jnjvm::nativeLibs;
JnjvmBootstrapLoader* Jnjvm::bootstrapLoader;
+std::map<const char, UserClassPrimitive*> Jnjvm::primitiveMap;
#endif
typedef void (*clinit_t)(Jnjvm* vm, UserConstantPool*);
@@ -125,7 +126,7 @@
CommonClass::field_map* map = cl->getStaticFields();
for (CommonClass::field_iterator i = map->begin(), e = map->end(); i!= e;
++i) {
- i->second->initField(val);
+ i->second->initField(val, vm);
}
cl->setStaticInstance(val);
@@ -846,15 +847,34 @@
#ifdef MULTIPLE_VM
isolate->throwable = isolate->upcalls->newThrowable;
- isolate->arrayClasses[1] = isolate->upcalls->ArrayOfBool;
- isolate->arrayClasses[2] = isolate->upcalls->ArrayOfByte;
- isolate->arrayClasses[3] = isolate->upcalls->ArrayOfChar;
- isolate->arrayClasses[4] = isolate->upcalls->ArrayOfShort;
- isolate->arrayClasses[5] = isolate->upcalls->ArrayOfInt;
- isolate->arrayClasses[6] = isolate->upcalls->ArrayOfFloat;
- isolate->arrayClasses[7] = isolate->upcalls->ArrayOfLong;
- isolate->arrayClasses[8] = isolate->upcalls->ArrayOfDouble;
#endif
-
+ isolate->arrayClasses[JavaArray::T_BOOLEAN - 4] =
+ isolate->upcalls->ArrayOfBool;
+ isolate->arrayClasses[JavaArray::T_BYTE - 4] =
+ isolate->upcalls->ArrayOfByte;
+ isolate->arrayClasses[JavaArray::T_CHAR - 4] =
+ isolate->upcalls->ArrayOfChar;
+ isolate->arrayClasses[JavaArray::T_SHORT - 4] =
+ isolate->upcalls->ArrayOfShort;
+ isolate->arrayClasses[JavaArray::T_INT - 4] =
+ isolate->upcalls->ArrayOfInt;
+ isolate->arrayClasses[JavaArray::T_FLOAT - 4] =
+ isolate->upcalls->ArrayOfFloat;
+ isolate->arrayClasses[JavaArray::T_LONG - 4] =
+ isolate->upcalls->ArrayOfLong;
+ isolate->arrayClasses[JavaArray::T_DOUBLE - 4] =
+ isolate->upcalls->ArrayOfDouble;
+
+ isolate->primitiveMap[AssessorDesc::I_VOID] = isolate->upcalls->OfVoid;
+ isolate->primitiveMap[AssessorDesc::I_BOOL] = isolate->upcalls->OfBool;
+ isolate->primitiveMap[AssessorDesc::I_BYTE] = isolate->upcalls->OfByte;
+ isolate->primitiveMap[AssessorDesc::I_CHAR] = isolate->upcalls->OfChar;
+ isolate->primitiveMap[AssessorDesc::I_SHORT] = isolate->upcalls->OfShort;
+ isolate->primitiveMap[AssessorDesc::I_INT] = isolate->upcalls->OfInt;
+ isolate->primitiveMap[AssessorDesc::I_FLOAT] = isolate->upcalls->OfFloat;
+ isolate->primitiveMap[AssessorDesc::I_LONG] = isolate->upcalls->OfLong;
+ isolate->primitiveMap[AssessorDesc::I_DOUBLE] = isolate->upcalls->OfDouble;
+
+ isolate->upcalls->initialiseClasspath(bootstrapLoader);
return isolate;
}
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/Jnjvm.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/Jnjvm.h?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/Jnjvm.h (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/Jnjvm.h Fri Sep 19 09:50:39 2008
@@ -98,10 +98,12 @@
#ifdef MULTIPLE_VM
UserClass* throwable;
- UserClassArray* arrayClasses[9];
#endif
+ std::map<const char, UserClassArray*> arrayClasses;
private:
+ ISOLATE_STATIC std::map<const char, UserClassPrimitive*> primitiveMap;
+
/// bootstrapThread - The initial thread of this JVM.
///
JavaThread* bootstrapThread;
@@ -245,10 +247,7 @@
/// nativeLibs - Native libraries (e.g. '.so') loaded by this JVM.
///
-#ifndef MULTIPLE_VM
- static
-#endif
- std::vector<void*> nativeLibs;
+ ISOLATE_STATIC std::vector<void*> nativeLibs;
/// classpath - The CLASSPATH value, or the paths given in command line.
///
@@ -331,6 +330,10 @@
/// static variables in a single environment.
///
ISOLATE_STATIC void initialiseStatics();
+
+ ISOLATE_STATIC UserClassPrimitive* getPrimitiveClass(char id) {
+ return primitiveMap[id];
+ }
/// allocateIsolate - Allocates a new JVM.
///
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmClassLoader.cpp?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmClassLoader.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmClassLoader.cpp Fri Sep 19 09:50:39 2008
@@ -267,8 +267,11 @@
UserCommonClass* cl = loadName(componentName, false, true);
return cl;
} else {
- AssessorDesc* ass = AssessorDesc::byteIdToPrimitive(name->elements[start]);
- return ass ? ass->primitiveClass : 0;
+ Classpath* upcalls = bootstrapLoader->upcalls;
+ UserClassPrimitive* prim =
+ AssessorDesc::byteIdToPrimitive(name->elements[start], upcalls);
+ assert(prim && "No primitive found");
+ return prim;
}
}
@@ -318,11 +321,14 @@
Typedef* JnjvmClassLoader::constructType(const UTF8* name) {
Typedef* res = javaTypes->lookup(name);
if (res == 0) {
- res = new Typedef(name, this);
+ res = Typedef::constructType(name, hashUTF8, isolate);
javaTypes->lock->lock();
Typedef* tmp = javaTypes->lookup(name);
if (tmp == 0) javaTypes->hash(name, res);
- else res = tmp;
+ else {
+ delete res;
+ res = tmp;
+ }
javaTypes->lock->unlock();
}
return res;
@@ -335,7 +341,10 @@
javaSignatures->lock->lock();
Signdef* tmp = javaSignatures->lookup(name);
if (tmp == 0) javaSignatures->hash(name, res);
- else res = tmp;
+ else {
+ delete res;
+ res = tmp;
+ }
javaSignatures->lock->unlock();
}
return res;
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.cpp?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.cpp Fri Sep 19 09:50:39 2008
@@ -389,8 +389,8 @@
for (uint32 index = 0; index < classDef->virtualFields.size(); ++index) {
- uint8 id = array[index]->getSignature()->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
+ Typedef* type = array[index]->getSignature();
+ LLVMAssessorInfo& LAI = JnjvmModule::getTypedefInfo(type);
fields.push_back(LAI.llvmType);
}
@@ -434,8 +434,8 @@
for (uint32 index = 0; index < classDef->staticFields.size(); ++index) {
JavaField* field = array[index];
- uint8 id = field->getSignature()->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
+ Typedef* type = field->getSignature();
+ LLVMAssessorInfo& LAI = JnjvmModule::getTypedefInfo(type);
fields.push_back(LAI.llvmType);
}
@@ -573,8 +573,8 @@
llvmArgs.push_back(JnjvmModule::JavaObjectType);
for (uint32 i = 0; i < size; ++i) {
- uint8 id = signature->args.at(i)->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
+ Typedef* type = signature->args.at(i);
+ LLVMAssessorInfo& LAI = JnjvmModule::getTypedefInfo(type);
llvmArgs.push_back(LAI.llvmType);
}
@@ -583,8 +583,7 @@
llvmArgs.push_back(JnjvmModule::ConstantPoolType); // cached constant pool
#endif
- uint8 id = signature->ret->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
+ LLVMAssessorInfo& LAI = JnjvmModule::getTypedefInfo(signature->ret);
virtualType = FunctionType::get(LAI.llvmType, llvmArgs, false);
}
return virtualType;
@@ -598,8 +597,8 @@
unsigned int size = signature->args.size();
for (uint32 i = 0; i < size; ++i) {
- uint8 id = signature->args.at(i)->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
+ Typedef* type = signature->args.at(i);
+ LLVMAssessorInfo& LAI = JnjvmModule::getTypedefInfo(type);
llvmArgs.push_back(LAI.llvmType);
}
@@ -608,8 +607,7 @@
llvmArgs.push_back(JnjvmModule::ConstantPoolType); // cached constant pool
#endif
- uint8 id = signature->ret->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
+ LLVMAssessorInfo& LAI = JnjvmModule::getTypedefInfo(signature->ret);
staticType = FunctionType::get(LAI.llvmType, llvmArgs, false);
}
return staticType;
@@ -626,8 +624,8 @@
llvmArgs.push_back(JnjvmModule::JavaObjectType); // Class
for (uint32 i = 0; i < size; ++i) {
- uint8 id = signature->args.at(i)->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
+ Typedef* type = signature->args.at(i);
+ LLVMAssessorInfo& LAI = JnjvmModule::getTypedefInfo(type);
llvmArgs.push_back(LAI.llvmType);
}
@@ -636,8 +634,7 @@
llvmArgs.push_back(JnjvmModule::ConstantPoolType); // cached constant pool
#endif
- uint8 id = signature->ret->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
+ LLVMAssessorInfo& LAI = JnjvmModule::getTypedefInfo(signature->ret);
nativeType = FunctionType::get(LAI.llvmType, llvmArgs, false);
}
return nativeType;
@@ -678,13 +675,13 @@
for (std::vector<Typedef*>::iterator i = signature->args.begin(),
e = signature->args.end(); i!= e; ++i) {
- const AssessorDesc* funcs = (*i)->funcs;
ptr = GetElementPtrInst::Create(ptr, CI, "", currentBlock);
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[funcs->numId];
+ LLVMAssessorInfo& LAI = JnjvmModule::getTypedefInfo(*i);
+ const Type* type = LAI.llvmType;
Value* val = new BitCastInst(ptr, LAI.llvmTypePtr, "", currentBlock);
Value* arg = new LoadInst(val, "", currentBlock);
Args.push_back(arg);
- if (funcs == AssessorDesc::dLong || funcs == AssessorDesc::dDouble) {
+ if (type == Type::Int64Ty || type == Type::DoubleTy) {
CI = mvm::jit::constantTwo;
} else {
CI = mvm::jit::constantOne;
@@ -697,7 +694,7 @@
#endif
Value* val = CallInst::Create(func, Args.begin(), Args.end(), "", currentBlock);
- if (signature->ret->funcs != AssessorDesc::dVoid)
+ if (res->getFunctionType()->getReturnType() != Type::VoidTy)
ReturnInst::Create(val, currentBlock);
else
ReturnInst::Create(currentBlock);
@@ -735,10 +732,9 @@
}
ap = i;
- for (std::vector<Typedef*>::iterator i = signature->args.begin(),
+ for (std::vector<Typedef*>::iterator i = signature->args.begin(),
e = signature->args.end(); i!= e; i++) {
-
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[(*i)->funcs->numId];
+ LLVMAssessorInfo& LAI = JnjvmModule::getTypedefInfo(*i);
Args.push_back(new VAArgInst(ap, LAI.llvmType, "", currentBlock));
}
@@ -748,7 +744,7 @@
#endif
Value* val = CallInst::Create(func, Args.begin(), Args.end(), "", currentBlock);
- if (signature->ret->funcs != AssessorDesc::dVoid)
+ if (res->getFunctionType()->getReturnType() != Type::VoidTy)
ReturnInst::Create(val, currentBlock);
else
ReturnInst::Create(currentBlock);
@@ -788,8 +784,7 @@
Args2.push_back(getVirtualPtrType());
Args2.push_back(JnjvmModule::JavaObjectType);
Args2.push_back(PointerType::getUnqual(Type::Int32Ty));
- uint8 id = signature->ret->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
+ LLVMAssessorInfo& LAI = JnjvmModule::getTypedefInfo(signature->ret);
virtualBufType = FunctionType::get(LAI.llvmType, Args2, false);
}
return virtualBufType;
@@ -804,8 +799,7 @@
Args.push_back(JnjvmModule::ConstantPoolType); // ctp
Args.push_back(getStaticPtrType());
Args.push_back(PointerType::getUnqual(Type::Int32Ty));
- uint8 id = signature->ret->funcs->numId;
- LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[id];
+ LLVMAssessorInfo& LAI = JnjvmModule::getTypedefInfo(signature->ret);
staticBufType = FunctionType::get(LAI.llvmType, Args, false);
}
return staticBufType;
@@ -1104,18 +1098,24 @@
void JnjvmModule::InitField(JavaField* field, JavaObject* obj, uint64 val) {
- const AssessorDesc* funcs = field->getSignature()->funcs;
- if (funcs == AssessorDesc::dLong) {
+ Typedef* type = field->getSignature();
+ if (!type->isPrimitive()) {
+ ((sint32*)((uint64)obj + field->ptrOffset))[0] = (sint32)val;
+ return;
+ }
+
+ PrimitiveTypedef* prim = (PrimitiveTypedef*)type;
+ if (prim->isLong()) {
((sint64*)((uint64)obj + field->ptrOffset))[0] = val;
- } else if (funcs == AssessorDesc::dInt) {
+ } else if (prim->isInt()) {
((sint32*)((uint64)obj + field->ptrOffset))[0] = (sint32)val;
- } else if (funcs == AssessorDesc::dChar) {
+ } else if (prim->isChar()) {
((uint16*)((uint64)obj + field->ptrOffset))[0] = (uint16)val;
- } else if (funcs == AssessorDesc::dShort) {
+ } else if (prim->isShort()) {
((sint16*)((uint64)obj + field->ptrOffset))[0] = (sint16)val;
- } else if (funcs == AssessorDesc::dByte) {
+ } else if (prim->isByte()) {
((sint8*)((uint64)obj + field->ptrOffset))[0] = (sint8)val;
- } else if (funcs == AssessorDesc::dBool) {
+ } else if (prim->isBool()) {
((uint8*)((uint64)obj + field->ptrOffset))[0] = (uint8)val;
} else {
// 0 value for everything else
@@ -1151,72 +1151,77 @@
setDataLayout(str);
}
void LLVMAssessorInfo::initialise() {
- AssessorInfo[VOID_ID].llvmType = Type::VoidTy;
- AssessorInfo[VOID_ID].llvmTypePtr = 0;
- AssessorInfo[VOID_ID].llvmNullConstant = 0;
- AssessorInfo[VOID_ID].sizeInBytesConstant = 0;
-
- AssessorInfo[BOOL_ID].llvmType = Type::Int8Ty;
- AssessorInfo[BOOL_ID].llvmTypePtr = PointerType::getUnqual(Type::Int8Ty);
- AssessorInfo[BOOL_ID].llvmNullConstant =
+ AssessorInfo[AssessorDesc::I_VOID].llvmType = Type::VoidTy;
+ AssessorInfo[AssessorDesc::I_VOID].llvmTypePtr = 0;
+ AssessorInfo[AssessorDesc::I_VOID].llvmNullConstant = 0;
+ AssessorInfo[AssessorDesc::I_VOID].sizeInBytesConstant = 0;
+
+ AssessorInfo[AssessorDesc::I_BOOL].llvmType = Type::Int8Ty;
+ AssessorInfo[AssessorDesc::I_BOOL].llvmTypePtr = PointerType::getUnqual(Type::Int8Ty);
+ AssessorInfo[AssessorDesc::I_BOOL].llvmNullConstant =
Constant::getNullValue(Type::Int8Ty);
- AssessorInfo[BOOL_ID].sizeInBytesConstant = mvm::jit::constantOne;
+ AssessorInfo[AssessorDesc::I_BOOL].sizeInBytesConstant = mvm::jit::constantOne;
- AssessorInfo[BYTE_ID].llvmType = Type::Int8Ty;
- AssessorInfo[BYTE_ID].llvmTypePtr = PointerType::getUnqual(Type::Int8Ty);
- AssessorInfo[BYTE_ID].llvmNullConstant =
+ AssessorInfo[AssessorDesc::I_BYTE].llvmType = Type::Int8Ty;
+ AssessorInfo[AssessorDesc::I_BYTE].llvmTypePtr = PointerType::getUnqual(Type::Int8Ty);
+ AssessorInfo[AssessorDesc::I_BYTE].llvmNullConstant =
Constant::getNullValue(Type::Int8Ty);
- AssessorInfo[BYTE_ID].sizeInBytesConstant = mvm::jit::constantOne;
+ AssessorInfo[AssessorDesc::I_BYTE].sizeInBytesConstant = mvm::jit::constantOne;
- AssessorInfo[SHORT_ID].llvmType = Type::Int16Ty;
- AssessorInfo[SHORT_ID].llvmTypePtr = PointerType::getUnqual(Type::Int16Ty);
- AssessorInfo[SHORT_ID].llvmNullConstant =
+ AssessorInfo[AssessorDesc::I_SHORT].llvmType = Type::Int16Ty;
+ AssessorInfo[AssessorDesc::I_SHORT].llvmTypePtr = PointerType::getUnqual(Type::Int16Ty);
+ AssessorInfo[AssessorDesc::I_SHORT].llvmNullConstant =
Constant::getNullValue(Type::Int16Ty);
- AssessorInfo[SHORT_ID].sizeInBytesConstant = mvm::jit::constantTwo;
+ AssessorInfo[AssessorDesc::I_SHORT].sizeInBytesConstant = mvm::jit::constantTwo;
- AssessorInfo[CHAR_ID].llvmType = Type::Int16Ty;
- AssessorInfo[CHAR_ID].llvmTypePtr = PointerType::getUnqual(Type::Int16Ty);
- AssessorInfo[CHAR_ID].llvmNullConstant =
+ AssessorInfo[AssessorDesc::I_CHAR].llvmType = Type::Int16Ty;
+ AssessorInfo[AssessorDesc::I_CHAR].llvmTypePtr = PointerType::getUnqual(Type::Int16Ty);
+ AssessorInfo[AssessorDesc::I_CHAR].llvmNullConstant =
Constant::getNullValue(Type::Int16Ty);
- AssessorInfo[CHAR_ID].sizeInBytesConstant = mvm::jit::constantTwo;
+ AssessorInfo[AssessorDesc::I_CHAR].sizeInBytesConstant = mvm::jit::constantTwo;
- AssessorInfo[INT_ID].llvmType = Type::Int32Ty;
- AssessorInfo[INT_ID].llvmTypePtr = PointerType::getUnqual(Type::Int32Ty);
- AssessorInfo[INT_ID].llvmNullConstant =
+ AssessorInfo[AssessorDesc::I_INT].llvmType = Type::Int32Ty;
+ AssessorInfo[AssessorDesc::I_INT].llvmTypePtr = PointerType::getUnqual(Type::Int32Ty);
+ AssessorInfo[AssessorDesc::I_INT].llvmNullConstant =
Constant::getNullValue(Type::Int32Ty);
- AssessorInfo[INT_ID].sizeInBytesConstant = mvm::jit::constantFour;
+ AssessorInfo[AssessorDesc::I_INT].sizeInBytesConstant = mvm::jit::constantFour;
- AssessorInfo[FLOAT_ID].llvmType = Type::FloatTy;
- AssessorInfo[FLOAT_ID].llvmTypePtr = PointerType::getUnqual(Type::FloatTy);
- AssessorInfo[FLOAT_ID].llvmNullConstant =
+ AssessorInfo[AssessorDesc::I_FLOAT].llvmType = Type::FloatTy;
+ AssessorInfo[AssessorDesc::I_FLOAT].llvmTypePtr = PointerType::getUnqual(Type::FloatTy);
+ AssessorInfo[AssessorDesc::I_FLOAT].llvmNullConstant =
Constant::getNullValue(Type::FloatTy);
- AssessorInfo[FLOAT_ID].sizeInBytesConstant = mvm::jit::constantFour;
+ AssessorInfo[AssessorDesc::I_FLOAT].sizeInBytesConstant = mvm::jit::constantFour;
- AssessorInfo[LONG_ID].llvmType = Type::Int64Ty;
- AssessorInfo[LONG_ID].llvmTypePtr = PointerType::getUnqual(Type::Int64Ty);
- AssessorInfo[LONG_ID].llvmNullConstant =
+ AssessorInfo[AssessorDesc::I_LONG].llvmType = Type::Int64Ty;
+ AssessorInfo[AssessorDesc::I_LONG].llvmTypePtr = PointerType::getUnqual(Type::Int64Ty);
+ AssessorInfo[AssessorDesc::I_LONG].llvmNullConstant =
Constant::getNullValue(Type::Int64Ty);
- AssessorInfo[LONG_ID].sizeInBytesConstant = mvm::jit::constantEight;
+ AssessorInfo[AssessorDesc::I_LONG].sizeInBytesConstant = mvm::jit::constantEight;
- AssessorInfo[DOUBLE_ID].llvmType = Type::DoubleTy;
- AssessorInfo[DOUBLE_ID].llvmTypePtr = PointerType::getUnqual(Type::DoubleTy);
- AssessorInfo[DOUBLE_ID].llvmNullConstant =
+ AssessorInfo[AssessorDesc::I_DOUBLE].llvmType = Type::DoubleTy;
+ AssessorInfo[AssessorDesc::I_DOUBLE].llvmTypePtr = PointerType::getUnqual(Type::DoubleTy);
+ AssessorInfo[AssessorDesc::I_DOUBLE].llvmNullConstant =
Constant::getNullValue(Type::DoubleTy);
- AssessorInfo[DOUBLE_ID].sizeInBytesConstant = mvm::jit::constantEight;
+ AssessorInfo[AssessorDesc::I_DOUBLE].sizeInBytesConstant = mvm::jit::constantEight;
- AssessorInfo[ARRAY_ID].llvmType = JnjvmModule::JavaObjectType;
- AssessorInfo[ARRAY_ID].llvmTypePtr =
+ AssessorInfo[AssessorDesc::I_TAB].llvmType = JnjvmModule::JavaObjectType;
+ AssessorInfo[AssessorDesc::I_TAB].llvmTypePtr =
PointerType::getUnqual(JnjvmModule::JavaObjectType);
- AssessorInfo[ARRAY_ID].llvmNullConstant =
+ AssessorInfo[AssessorDesc::I_TAB].llvmNullConstant =
JnjvmModule::JavaObjectNullConstant;
- AssessorInfo[ARRAY_ID].sizeInBytesConstant = mvm::jit::constantPtrSize;
+ AssessorInfo[AssessorDesc::I_TAB].sizeInBytesConstant = mvm::jit::constantPtrSize;
- AssessorInfo[OBJECT_ID].llvmType = JnjvmModule::JavaObjectType;
- AssessorInfo[OBJECT_ID].llvmTypePtr =
+ AssessorInfo[AssessorDesc::I_REF].llvmType = JnjvmModule::JavaObjectType;
+ AssessorInfo[AssessorDesc::I_REF].llvmTypePtr =
PointerType::getUnqual(JnjvmModule::JavaObjectType);
- AssessorInfo[OBJECT_ID].llvmNullConstant =
+ AssessorInfo[AssessorDesc::I_REF].llvmNullConstant =
JnjvmModule::JavaObjectNullConstant;
- AssessorInfo[OBJECT_ID].sizeInBytesConstant = mvm::jit::constantPtrSize;
+ AssessorInfo[AssessorDesc::I_REF].sizeInBytesConstant = mvm::jit::constantPtrSize;
+}
+
+std::map<const char, LLVMAssessorInfo> LLVMAssessorInfo::AssessorInfo;
+
+LLVMAssessorInfo& JnjvmModule::getTypedefInfo(Typedef* type) {
+ return LLVMAssessorInfo::AssessorInfo[type->getKey()->elements[0]];
}
-LLVMAssessorInfo LLVMAssessorInfo::AssessorInfo[NUM_ASSESSORS];
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.h?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.h (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.h Fri Sep 19 09:50:39 2008
@@ -45,7 +45,7 @@
llvm::ConstantInt* sizeInBytesConstant;
static void initialise();
- static LLVMAssessorInfo AssessorInfo[];
+ static std::map<const char, LLVMAssessorInfo> AssessorInfo;
};
@@ -436,6 +436,8 @@
return ctp->getInfo<LLVMConstantPoolInfo>();
}
+ static LLVMAssessorInfo& getTypedefInfo(Typedef* type);
+
LLVMStringInfo* getStringInfo(JavaString* str);
#ifdef SERVICE_VM
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/NativeUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/NativeUtil.cpp?rev=56347&r1=56346&r2=56347&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/NativeUtil.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/NativeUtil.cpp Fri Sep 19 09:50:39 2008
@@ -239,10 +239,9 @@
void NativeUtil::decapsulePrimitive(Jnjvm *vm, void** &buf,
JavaObject* obj,
Typedef* signature) {
- const AssessorDesc* funcs = signature->funcs;
- if (funcs == AssessorDesc::dRef || funcs == AssessorDesc::dTab) {
- if (obj && !(obj->classOf->isOfTypeName(signature->pseudoAssocClassName))) {
+ if (!signature->isPrimitive()) {
+ if (obj && !(obj->classOf->isOfTypeName(signature->getName()))) {
vm->illegalArgumentException("wrong type argument");
}
((JavaObject**)buf)[0] = obj;
@@ -252,18 +251,19 @@
vm->illegalArgumentException("");
} else {
UserCommonClass* cl = obj->classOf;
- AssessorDesc* value = AssessorDesc::classNameToPrimitive(cl->getName());
-
+ UserClassPrimitive* value = cl->toPrimitive(vm);
+ PrimitiveTypedef* prim = (PrimitiveTypedef*)signature;
+
if (value == 0) {
vm->illegalArgumentException("");
}
- if (funcs == AssessorDesc::dShort) {
- if (value == AssessorDesc::dShort) {
+ if (prim->isShort()) {
+ if (value == vm->upcalls->OfShort) {
((uint16*)buf)[0] = vm->upcalls->shortValue->getInt16Field(obj);
buf++;
return;
- } else if (value == AssessorDesc::dByte) {
+ } else if (value == vm->upcalls->OfByte) {
((sint16*)buf)[0] =
(sint16)vm->upcalls->byteValue->getInt8Field(obj);
buf++;
@@ -271,31 +271,31 @@
} else {
vm->illegalArgumentException("");
}
- } else if (funcs == AssessorDesc::dByte) {
- if (value == AssessorDesc::dByte) {
+ } else if (prim->isByte()) {
+ if (value == vm->upcalls->OfByte) {
((uint8*)buf)[0] = vm->upcalls->byteValue->getInt8Field(obj);
buf++;
return;
} else {
vm->illegalArgumentException("");
}
- } else if (funcs == AssessorDesc::dBool) {
- if (value == AssessorDesc::dBool) {
+ } else if (prim->isBool()) {
+ if (value == vm->upcalls->OfBool) {
((uint8*)buf)[0] = vm->upcalls->boolValue->getInt8Field(obj);
buf++;
return;
} else {
vm->illegalArgumentException("");
}
- } else if (funcs == AssessorDesc::dInt) {
+ } else if (prim->isInt()) {
sint32 val = 0;
- if (value == AssessorDesc::dInt) {
+ if (value == vm->upcalls->OfInt) {
val = vm->upcalls->intValue->getInt32Field(obj);
- } else if (value == AssessorDesc::dByte) {
+ } else if (value == vm->upcalls->OfByte) {
val = (sint32)vm->upcalls->byteValue->getInt8Field(obj);
- } else if (value == AssessorDesc::dChar) {
+ } else if (value == vm->upcalls->OfChar) {
val = (uint32)vm->upcalls->charValue->getInt16Field(obj);
- } else if (value == AssessorDesc::dShort) {
+ } else if (value == vm->upcalls->OfShort) {
val = (sint32)vm->upcalls->shortValue->getInt16Field(obj);
} else {
vm->illegalArgumentException("");
@@ -303,9 +303,9 @@
((sint32*)buf)[0] = val;
buf++;
return;
- } else if (funcs == AssessorDesc::dChar) {
+ } else if (prim->isChar()) {
uint16 val = 0;
- if (value == AssessorDesc::dChar) {
+ if (value == vm->upcalls->OfChar) {
val = (uint16)vm->upcalls->charValue->getInt16Field(obj);
} else {
vm->illegalArgumentException("");
@@ -313,19 +313,19 @@
((uint16*)buf)[0] = val;
buf++;
return;
- } else if (funcs == AssessorDesc::dFloat) {
+ } else if (prim->isFloat()) {
float val = 0;
- if (value == AssessorDesc::dFloat) {
+ if (value == vm->upcalls->OfFloat) {
val = (float)vm->upcalls->floatValue->getFloatField(obj);
- } else if (value == AssessorDesc::dByte) {
+ } else if (value == vm->upcalls->OfByte) {
val = (float)(sint32)vm->upcalls->byteValue->getInt8Field(obj);
- } else if (value == AssessorDesc::dChar) {
+ } else if (value == vm->upcalls->OfChar) {
val = (float)(uint32)vm->upcalls->charValue->getInt16Field(obj);
- } else if (value == AssessorDesc::dShort) {
+ } else if (value == vm->upcalls->OfShort) {
val = (float)(sint32)vm->upcalls->shortValue->getInt16Field(obj);
- } else if (value == AssessorDesc::dInt) {
+ } else if (value == vm->upcalls->OfInt) {
val = (float)(sint32)vm->upcalls->intValue->getInt32Field(obj);
- } else if (value == AssessorDesc::dLong) {
+ } else if (value == vm->upcalls->OfLong) {
val = (float)vm->upcalls->longValue->getLongField(obj);
} else {
vm->illegalArgumentException("");
@@ -333,21 +333,21 @@
((float*)buf)[0] = val;
buf++;
return;
- } else if (funcs == AssessorDesc::dDouble) {
+ } else if (prim->isDouble()) {
double val = 0;
- if (value == AssessorDesc::dDouble) {
+ if (value == vm->upcalls->OfDouble) {
val = (double)vm->upcalls->doubleValue->getDoubleField(obj);
- } else if (value == AssessorDesc::dFloat) {
+ } else if (value == vm->upcalls->OfFloat) {
val = (double)vm->upcalls->floatValue->getFloatField(obj);
- } else if (value == AssessorDesc::dByte) {
+ } else if (value == vm->upcalls->OfByte) {
val = (double)(sint64)vm->upcalls->byteValue->getInt8Field(obj);
- } else if (value == AssessorDesc::dChar) {
+ } else if (value == vm->upcalls->OfChar) {
val = (double)(uint64)vm->upcalls->charValue->getInt16Field(obj);
- } else if (value == AssessorDesc::dShort) {
+ } else if (value == vm->upcalls->OfShort) {
val = (double)(sint16)vm->upcalls->shortValue->getInt16Field(obj);
- } else if (value == AssessorDesc::dInt) {
+ } else if (value == vm->upcalls->OfInt) {
val = (double)(sint32)vm->upcalls->intValue->getInt32Field(obj);
- } else if (value == AssessorDesc::dLong) {
+ } else if (value == vm->upcalls->OfLong) {
val = (double)(sint64)vm->upcalls->longValue->getLongField(obj);
} else {
vm->illegalArgumentException("");
@@ -355,17 +355,17 @@
((double*)buf)[0] = val;
buf += 2;
return;
- } else if (funcs == AssessorDesc::dLong) {
+ } else if (prim->isLong()) {
sint64 val = 0;
- if (value == AssessorDesc::dByte) {
+ if (value == vm->upcalls->OfByte) {
val = (sint64)vm->upcalls->byteValue->getInt8Field(obj);
- } else if (value == AssessorDesc::dChar) {
+ } else if (value == vm->upcalls->OfChar) {
val = (sint64)(uint64)vm->upcalls->charValue->getInt16Field(obj);
- } else if (value == AssessorDesc::dShort) {
+ } else if (value == vm->upcalls->OfShort) {
val = (sint64)vm->upcalls->shortValue->getInt16Field(obj);
- } else if (value == AssessorDesc::dInt) {
+ } else if (value == vm->upcalls->OfInt) {
val = (sint64)vm->upcalls->intValue->getInt32Field(obj);
- } else if (value == AssessorDesc::dLong) {
+ } else if (value == vm->upcalls->OfLong) {
val = (sint64)vm->upcalls->intValue->getLongField(obj);
} else {
vm->illegalArgumentException("");
More information about the vmkit-commits
mailing list