[llvm-commits] [vmkit] r51242 - in /vmkit/trunk/lib/JnJVM: Classpath/ClasspathConstructor.cpp Classpath/ClasspathMethod.cpp Classpath/ClasspathVMClass.cpp Classpath/ClasspathVMField.cpp Classpath/ClasspathVMStackWalker.cpp Classpath/ClasspathVMThread.cpp Classpath/ClasspathVMThrowable.cpp VMCore/JavaClass.h VMCore/JavaIsolate.cpp VMCore/JavaMetaJIT.cpp VMCore/JavaObject.h VMCore/Jni.cpp VMCore/Jnjvm.cpp VMCore/NativeUtil.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Mon May 19 03:03:04 PDT 2008
Author: geoffray
Date: Mon May 19 05:03:04 2008
New Revision: 51242
URL: http://llvm.org/viewvc/llvm-project?rev=51242&view=rev
Log:
Make Java field accesses direct. Callers are in charge of initializing or
resolving the classes.
Modified:
vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp
vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h
vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp
vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp?rev=51242&r1=51241&r2=51242&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathConstructor.cpp Mon May 19 05:03:04 2008
@@ -33,7 +33,7 @@
JNIEnv *env,
#endif
jobject cons) {
- JavaMethod* meth = (JavaMethod*)((*Classpath::constructorSlot)((JavaObject*)cons).IntVal.getZExtValue());
+ JavaMethod* meth = (JavaMethod*)(Classpath::constructorSlot->getVirtualInt32Field((JavaObject*)cons));
JavaObject* loader = meth->classDef->classLoader;
return (jobject)(NativeUtil::getParameterTypes(loader, meth));
}
@@ -43,7 +43,7 @@
JNIEnv *env,
#endif
jobject cons) {
- JavaMethod* meth = (JavaMethod*)((*Classpath::constructorSlot)((JavaObject*)cons).IntVal.getZExtValue());
+ JavaMethod* meth = (JavaMethod*)(Classpath::constructorSlot->getVirtualInt32Field((JavaObject*)cons));
return meth->access;
}
@@ -105,7 +105,7 @@
#endif
jobject cons) {
verifyNull(cons);
- JavaMethod* meth = (JavaMethod*)(*Classpath::constructorSlot)((JavaObject*)cons).IntVal.getZExtValue();
+ JavaMethod* meth = (JavaMethod*)Classpath::constructorSlot->getVirtualInt32Field((JavaObject*)cons);
return (jobjectArray)NativeUtil::getExceptionTypes(meth);
}
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp?rev=51242&r1=51241&r2=51242&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathMethod.cpp Mon May 19 05:03:04 2008
@@ -32,7 +32,7 @@
JNIEnv *env,
#endif
jobject Meth) {
- JavaMethod* meth = (JavaMethod*)((*Classpath::methodSlot)((JavaObject*)Meth).IntVal.getZExtValue());
+ JavaMethod* meth = (JavaMethod*)Classpath::methodSlot->getVirtualInt32Field((JavaObject*)Meth);
return meth->access;
}
@@ -41,7 +41,7 @@
JNIEnv *env,
#endif
jobject Meth) {
- JavaMethod* meth = (JavaMethod*)((*Classpath::methodSlot)((JavaObject*)Meth).IntVal.getZExtValue());
+ JavaMethod* meth = (JavaMethod*)Classpath::methodSlot->getVirtualInt32Field((JavaObject*)Meth);
JavaObject* loader = meth->classDef->classLoader;
return (jclass)NativeUtil::getClassType(loader, meth->signature->ret);
}
@@ -53,7 +53,7 @@
#endif
jobject Meth) {
- JavaMethod* meth = (JavaMethod*)((*Classpath::methodSlot)((JavaObject*)Meth).IntVal.getZExtValue());
+ JavaMethod* meth = (JavaMethod*)Classpath::methodSlot->getVirtualInt32Field((JavaObject*)Meth);
JavaObject* loader = meth->classDef->classLoader;
return (jobject)(NativeUtil::getParameterTypes(loader, meth));
}
@@ -131,42 +131,42 @@
uint32 val = 0;
RUN_METH(Int);
res = (*Classpath::boolClass)(vm);
- (*Classpath::boolValue)(res, val);
+ Classpath::boolValue->setVirtualInt8Field(res, val);
} else if (retType == AssessorDesc::dByte) {
uint32 val = 0;
RUN_METH(Int);
res = (*Classpath::byteClass)(vm);
- (*Classpath::byteValue)(res, val);
+ Classpath::byteValue->setVirtualInt8Field(res, val);
} else if (retType == AssessorDesc::dChar) {
uint32 val = 0;
RUN_METH(Int);
res = (*Classpath::charClass)(vm);
- (*Classpath::charValue)(res, val);
+ Classpath::charValue->setVirtualInt16Field(res, val);
} else if (retType == AssessorDesc::dShort) {
uint32 val = 0;
RUN_METH(Int);
res = (*Classpath::shortClass)(vm);
- (*Classpath::shortValue)(res, val);
+ Classpath::shortValue->setVirtualInt16Field(res, val);
} else if (retType == AssessorDesc::dInt) {
uint32 val = 0;
RUN_METH(Int);
res = (*Classpath::intClass)(vm);
- (*Classpath::intValue)(res, val);
+ Classpath::intValue->setVirtualInt32Field(res, val);
} else if (retType == AssessorDesc::dLong) {
sint64 val = 0;
RUN_METH(Long);
res = (*Classpath::longClass)(vm);
- (*Classpath::longValue)(res, val);
+ Classpath::longValue->setVirtualLongField(res, val);
} else if (retType == AssessorDesc::dFloat) {
float val = 0;
RUN_METH(Float);
res = (*Classpath::floatClass)(vm);
- (*Classpath::floatValue)(res, val);
+ Classpath::floatValue->setVirtualFloatField(res, val);
} else if (retType == AssessorDesc::dDouble) {
double val = 0;
RUN_METH(Double);
res = (*Classpath::doubleClass)(vm);
- (*Classpath::doubleValue)(res, val);
+ Classpath::doubleValue->setVirtualDoubleField(res, val);
} else if (retType == AssessorDesc::dTab || retType == AssessorDesc::dRef) {
JavaObject* val = 0;
RUN_METH(JavaObject);
@@ -188,7 +188,7 @@
#endif
jobject _meth) {
verifyNull(_meth);
- JavaMethod* meth = (JavaMethod*)(*Classpath::methodSlot)((JavaObject*)_meth).IntVal.getZExtValue();
+ JavaMethod* meth = (JavaMethod*)Classpath::methodSlot->getVirtualInt32Field((JavaObject*)_meth);
return (jobjectArray)NativeUtil::getExceptionTypes(meth);
}
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp?rev=51242&r1=51241&r2=51242&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMClass.cpp Mon May 19 05:03:04 2008
@@ -38,7 +38,7 @@
jobject klass) {
CommonClass* cl =
- (CommonClass*)(((*Classpath::vmdataClass)((JavaObject*)klass)).PointerVal);
+ (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)klass);
return cl->isArray;
@@ -174,7 +174,7 @@
jobject Cl) {
Jnjvm* vm = JavaThread::get()->isolate;
CommonClass* cl =
- (CommonClass*)((*Classpath::vmdataClass)((JavaObject*)Cl).PointerVal);
+ (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl);
AssessorDesc* ass = AssessorDesc::bogusClassToPrimitive(cl);
const UTF8* res = 0;
@@ -194,7 +194,7 @@
#endif
jclass Cl) {
CommonClass* cl =
- (CommonClass*)((*Classpath::vmdataClass)((JavaObject*)Cl).PointerVal);
+ (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl);
AssessorDesc* ass = AssessorDesc::bogusClassToPrimitive(cl);
if (ass == 0) return false;
@@ -219,7 +219,7 @@
#endif
jclass Cl) {
CommonClass* cl =
- (CommonClass*)((*Classpath::vmdataClass)((JavaObject*)Cl).PointerVal);
+ (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl);
if (cl->isArray) {
CommonClass* bc = ((ClassArray*)cl)->baseClass();
@@ -236,7 +236,7 @@
#endif
jclass Cl) {
CommonClass* cl =
- (CommonClass*)((*Classpath::vmdataClass)((JavaObject*)Cl).PointerVal);
+ (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl);
return (jobject)cl->classLoader;
}
@@ -247,9 +247,9 @@
#endif
jclass Cl1, jclass Cl2) {
CommonClass* cl1 =
- (CommonClass*)((*Classpath::vmdataClass)((JavaObject*)Cl1).PointerVal);
+ (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl1);
CommonClass* cl2 =
- (CommonClass*)((*Classpath::vmdataClass)((JavaObject*)Cl2).PointerVal);
+ (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl2);
AssessorDesc* ass = AssessorDesc::bogusClassToPrimitive(cl1);
if (ass) {
@@ -268,7 +268,7 @@
#endif
jclass Cl) {
CommonClass* cl =
- (CommonClass*)((*Classpath::vmdataClass)((JavaObject*)Cl).PointerVal);
+ (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl);
if (isInterface(cl->access))
return 0;
else {
@@ -285,7 +285,7 @@
#endif
jclass Cl, jobject obj) {
CommonClass* cl =
- (CommonClass*)((*Classpath::vmdataClass)((JavaObject*)Cl).PointerVal);
+ (CommonClass*)Classpath::vmdataClass->getVirtualObjectField((JavaObject*)Cl);
return ((JavaObject*)obj)->instanceOf(cl);
}
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp?rev=51242&r1=51241&r2=51242&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMField.cpp Mon May 19 05:03:04 2008
@@ -24,7 +24,7 @@
JNIEnv *env,
#endif
jobject obj) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)obj).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)obj);
return field->access;
}
@@ -33,7 +33,7 @@
JNIEnv *env,
#endif
jobject obj) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)obj).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)obj);
JavaObject* loader = field->classDef->classLoader;
CommonClass* cl = field->signature->assocClass(loader);
return (jclass)cl->getClassDelegatee();
@@ -44,12 +44,17 @@
JNIEnv *env,
#endif
jobject Field, jobject obj) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
if (ass != AssessorDesc::dInt && ass != AssessorDesc::dChar && ass != AssessorDesc::dByte && ass != AssessorDesc::dShort)
JavaThread::get()->isolate->illegalArgumentException("");
- return (sint32)(*field)((JavaObject*)obj).IntVal.getZExtValue();
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
+ return isStatic(field->access) ?
+ (sint32)field->getStaticInt32Field() :
+ (sint32)field->getVirtualInt32Field((JavaObject*)obj);
}
JNIEXPORT jlong JNICALL Java_java_lang_reflect_Field_getLong(
@@ -57,13 +62,18 @@
JNIEnv *env,
#endif
jobject Field, jobject obj) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
if (ass != AssessorDesc::dInt && ass != AssessorDesc::dChar && ass != AssessorDesc::dByte && ass != AssessorDesc::dShort &&
ass != AssessorDesc::dLong)
JavaThread::get()->isolate->illegalArgumentException("");
- return (sint64)(*field)((JavaObject*)obj).IntVal.getZExtValue();
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
+ return isStatic(field->access) ?
+ (sint64)field->getStaticLongField() :
+ (sint64)field->getVirtualLongField((JavaObject*)obj);
}
JNIEXPORT jboolean JNICALL Java_java_lang_reflect_Field_getBoolean(
@@ -71,11 +81,18 @@
JNIEnv *env,
#endif
jobject Field, jobject obj) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
+
if (ass != AssessorDesc::dBool)
JavaThread::get()->isolate->illegalArgumentException("");
- return (uint8)(*field)((JavaObject*)obj).IntVal.getZExtValue();
+
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
+ return isStatic(field->access) ?
+ (uint8)field->getStaticInt8Field() :
+ (uint8)field->getVirtualInt8Field((JavaObject*)obj);
}
JNIEXPORT jfloat JNICALL Java_java_lang_reflect_Field_getFloat(
@@ -83,14 +100,36 @@
JNIEnv *env,
#endif
jobject Field, jobject obj) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
- if (ass == AssessorDesc::dByte || ass == AssessorDesc::dInt || ass == AssessorDesc::dShort || ass == AssessorDesc::dLong) {
- return (jfloat)(*field)((JavaObject*)obj).IntVal.getSExtValue();
+
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
+ if (ass == AssessorDesc::dByte) {
+ return isStatic(field->access) ?
+ (jfloat)field->getStaticInt8Field() :
+ (jfloat)field->getVirtualInt8Field((JavaObject*)obj);
+ } else if (ass == AssessorDesc::dInt) {
+ return isStatic(field->access) ?
+ (jfloat)field->getStaticInt32Field() :
+ (jfloat)field->getVirtualInt32Field((JavaObject*)obj);
+ } else if (ass == AssessorDesc::dShort) {
+ return isStatic(field->access) ?
+ (jfloat)field->getStaticInt16Field() :
+ (jfloat)field->getVirtualInt16Field((JavaObject*)obj);
+ } else if (ass == AssessorDesc::dLong) {
+ return isStatic(field->access) ?
+ (jfloat)field->getStaticLongField() :
+ (jfloat)field->getVirtualLongField((JavaObject*)obj);
} else if (ass == AssessorDesc::dChar) {
- return (jfloat)(*field)((JavaObject*)obj).IntVal.getZExtValue();
+ return isStatic(field->access) ?
+ (jfloat)(uint32)field->getStaticInt16Field() :
+ (jfloat)(uint32)field->getVirtualInt16Field((JavaObject*)obj);
} else if (ass == AssessorDesc::dFloat) {
- return (jfloat)(*field)((JavaObject*)obj).FloatVal;
+ return isStatic(field->access) ?
+ (jfloat)field->getStaticFloatField() :
+ (jfloat)field->getVirtualFloatField((JavaObject*)obj);
}
JavaThread::get()->isolate->illegalArgumentException("");
return 0.0;
@@ -101,11 +140,17 @@
JNIEnv *env,
#endif
jobject Field, jobject obj) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
if (ass != AssessorDesc::dByte)
JavaThread::get()->isolate->illegalArgumentException("");
- return (sint8)(*field)((JavaObject*)obj).IntVal.getSExtValue();
+
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
+ return isStatic(field->access) ?
+ (sint8)field->getStaticInt8Field() :
+ (sint8)field->getVirtualInt8Field((JavaObject*)obj);
}
JNIEXPORT jchar JNICALL Java_java_lang_reflect_Field_getChar(
@@ -113,11 +158,18 @@
JNIEnv *env,
#endif
jobject Field, jobject obj) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
+
if (ass != AssessorDesc::dChar)
JavaThread::get()->isolate->illegalArgumentException("");
- return (uint16)(*field)((JavaObject*)obj).IntVal.getZExtValue();
+
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
+ return isStatic(field->access) ?
+ (uint16)field->getStaticInt16Field() :
+ (uint16)field->getVirtualInt16Field((JavaObject*)obj);
}
JNIEXPORT jshort JNICALL Java_java_lang_reflect_Field_getShort(
@@ -125,11 +177,18 @@
JNIEnv *env,
#endif
jobject Field, jobject obj) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
+
if (ass != AssessorDesc::dShort && ass != AssessorDesc::dByte)
JavaThread::get()->isolate->illegalArgumentException("");
- return (sint16)(*field)((JavaObject*)obj).IntVal.getSExtValue();
+
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
+ return isStatic(field->access) ?
+ (sint16)field->getStaticInt16Field() :
+ (sint16)field->getVirtualInt16Field((JavaObject*)obj);
}
JNIEXPORT jdouble JNICALL Java_java_lang_reflect_Field_getDouble(
@@ -137,16 +196,40 @@
JNIEnv *env,
#endif
jobject Field, jobject obj) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
- if (ass == AssessorDesc::dByte || ass == AssessorDesc::dInt || ass == AssessorDesc::dShort || ass == AssessorDesc::dLong) {
- return (jdouble)(*field)((JavaObject*)obj).IntVal.getSExtValue();
+
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
+ if (ass == AssessorDesc::dByte) {
+ return isStatic(field->access) ?
+ (jdouble)(sint64)field->getStaticInt8Field() :
+ (jdouble)(sint64)field->getVirtualInt8Field((JavaObject*)obj);
+ } else if (ass == AssessorDesc::dInt) {
+ return isStatic(field->access) ?
+ (jdouble)(sint64)field->getStaticInt32Field() :
+ (jdouble)(sint64)field->getVirtualInt32Field((JavaObject*)obj);
+ } else if (ass == AssessorDesc::dShort) {
+ return isStatic(field->access) ?
+ (jdouble)(sint64)field->getStaticInt16Field() :
+ (jdouble)(sint64)field->getVirtualInt16Field((JavaObject*)obj);
+ } else if (ass == AssessorDesc::dLong) {
+ return isStatic(field->access) ?
+ (jdouble)(sint64)field->getStaticLongField() :
+ (jdouble)(sint64)field->getVirtualLongField((JavaObject*)obj);
} else if (ass == AssessorDesc::dChar) {
- return (jdouble)(*field)((JavaObject*)obj).IntVal.getZExtValue();
+ return isStatic(field->access) ?
+ (jdouble)(uint64)field->getStaticInt16Field() :
+ (jdouble)(uint64)field->getVirtualInt16Field((JavaObject*)obj);
} else if (ass == AssessorDesc::dFloat) {
- return (jdouble)(*field)((JavaObject*)obj).FloatVal;
+ return isStatic(field->access) ?
+ (jdouble)field->getStaticFloatField() :
+ (jdouble)field->getVirtualFloatField((JavaObject*)obj);
} else if (ass == AssessorDesc::dDouble) {
- return (jdouble)(*field)((JavaObject*)obj).DoubleVal;
+ return isStatic(field->access) ?
+ (jdouble)field->getStaticDoubleField() :
+ (jdouble)field->getVirtualDoubleField((JavaObject*)obj);
}
JavaThread::get()->isolate->illegalArgumentException("");
return 0.0;
@@ -157,40 +240,68 @@
JNIEnv *env,
#endif
jobject Field, jobject _obj) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
Typedef* type = field->signature;
const AssessorDesc* ass = type->funcs;
JavaObject* obj = (JavaObject*)_obj;
- llvm::GenericValue gv = (*field)(obj);
Jnjvm* vm = JavaThread::get()->isolate;
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
JavaObject* res = 0;
if (ass == AssessorDesc::dBool) {
+ uint8 val = (isStatic(field->access) ?
+ field->getStaticInt8Field() :
+ field->getVirtualInt8Field(obj));
res = (*Classpath::boolClass)(vm);
- (*Classpath::boolValue)(res, (uint32)gv.IntVal.getBoolValue());
+ Classpath::boolValue->setVirtualInt8Field(res, val);
} else if (ass == AssessorDesc::dByte) {
+ sint8 val = (isStatic(field->access) ?
+ field->getStaticInt8Field() :
+ field->getVirtualInt8Field(obj));
res = (*Classpath::byteClass)(vm);
- (*Classpath::byteValue)(res, (uint32)gv.IntVal.getSExtValue());
+ Classpath::byteValue->setVirtualInt8Field(res, val);
} else if (ass == AssessorDesc::dChar) {
+ uint16 val = (isStatic(field->access) ?
+ field->getStaticInt16Field() :
+ field->getVirtualInt16Field(obj));
res = (*Classpath::charClass)(vm);
- (*Classpath::charValue)(res, (uint32)gv.IntVal.getZExtValue());
+ Classpath::charValue->setVirtualInt16Field(res, val);
} else if (ass == AssessorDesc::dShort) {
+ sint16 val = (isStatic(field->access) ?
+ field->getStaticInt16Field() :
+ field->getVirtualInt16Field(obj));
res = (*Classpath::shortClass)(vm);
- (*Classpath::shortValue)(res, (uint32)gv.IntVal.getSExtValue());
+ Classpath::shortValue->setVirtualInt16Field(res, val);
} else if (ass == AssessorDesc::dInt) {
+ sint32 val = (isStatic(field->access) ?
+ field->getStaticInt32Field() :
+ field->getVirtualInt32Field(obj));
res = (*Classpath::intClass)(vm);
- (*Classpath::intValue)(res, (uint32)gv.IntVal.getSExtValue());
+ Classpath::intValue->setVirtualInt32Field(res, val);
} else if (ass == AssessorDesc::dLong) {
+ sint64 val = (isStatic(field->access) ?
+ field->getStaticLongField() :
+ field->getVirtualLongField(obj));
res = (*Classpath::longClass)(vm);
- (*Classpath::longValue)(res, (sint64)gv.IntVal.getSExtValue());
+ Classpath::longValue->setVirtualLongField(res, val);
} else if (ass == AssessorDesc::dFloat) {
+ float val = (isStatic(field->access) ?
+ field->getStaticFloatField() :
+ field->getVirtualFloatField(obj));
res = (*Classpath::floatClass)(vm);
- (*Classpath::floatValue)(res, gv.FloatVal);
+ Classpath::floatValue->setVirtualFloatField(res, val);
} else if (ass == AssessorDesc::dDouble) {
+ double val = (isStatic(field->access) ?
+ field->getStaticDoubleField() :
+ field->getVirtualDoubleField(obj));
res = (*Classpath::doubleClass)(vm);
- (*Classpath::doubleValue)(res, gv.DoubleVal);
+ Classpath::doubleValue->setVirtualDoubleField(res, val);
} else if (ass == AssessorDesc::dTab || ass == AssessorDesc::dRef) {
- res = (JavaObject*)gv.PointerVal;
+ res = (isStatic(field->access) ?
+ field->getStaticObjectField() :
+ field->getVirtualObjectField(obj));
} else {
JavaThread::get()->isolate->unknownError("should not be here");
}
@@ -202,31 +313,52 @@
JNIEnv *env,
#endif
jobject Field, jobject obj, jobject val) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
void** buf = (void**)alloca(sizeof(uint64));
void* _buf = (void*)buf;
NativeUtil::decapsulePrimitive(JavaThread::get()->isolate, buf, (JavaObject*)val, field->signature);
const AssessorDesc* ass = field->signature->funcs;
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
if (ass == AssessorDesc::dBool) {
- (*field)((JavaObject*)obj, ((uint32*)_buf)[0]);
+ isStatic(field->access) ?
+ field->setStaticInt8Field(((uint8*)_buf)[0]) :
+ field->setVirtualInt8Field((JavaObject*)obj, ((uint8*)_buf)[0]);
} else if (ass == AssessorDesc::dByte) {
- (*field)((JavaObject*)obj, ((uint32*)_buf)[0]);
+ isStatic(field->access) ?
+ field->setStaticInt8Field(((sint8*)_buf)[0]) :
+ field->setVirtualInt8Field((JavaObject*)obj, ((sint8*)_buf)[0]);
} else if (ass == AssessorDesc::dChar) {
- (*field)((JavaObject*)obj, ((uint32*)_buf)[0]);
+ isStatic(field->access) ?
+ field->setStaticInt16Field(((uint16*)_buf)[0]) :
+ field->setVirtualInt16Field((JavaObject*)obj, ((uint16*)_buf)[0]);
} else if (ass == AssessorDesc::dShort) {
- (*field)((JavaObject*)obj, ((uint32*)_buf)[0]);
+ isStatic(field->access) ?
+ field->setStaticInt16Field(((sint16*)_buf)[0]) :
+ field->setVirtualInt16Field((JavaObject*)obj, ((sint16*)_buf)[0]);
} else if (ass == AssessorDesc::dInt) {
- (*field)((JavaObject*)obj, ((uint32*)_buf)[0]);
+ isStatic(field->access) ?
+ field->setStaticInt32Field(((sint32*)_buf)[0]) :
+ field->setVirtualInt32Field((JavaObject*)obj, ((sint32*)_buf)[0]);
} else if (ass == AssessorDesc::dLong) {
- (*field)((JavaObject*)obj, ((sint64*)_buf)[0]);
+ isStatic(field->access) ?
+ field->setStaticLongField(((sint64*)_buf)[0]) :
+ field->setVirtualLongField((JavaObject*)obj, ((sint64*)_buf)[0]);
} else if (ass == AssessorDesc::dFloat) {
- (*field)((JavaObject*)obj, ((float*)_buf)[0]);
+ isStatic(field->access) ?
+ field->setStaticFloatField(((float*)_buf)[0]) :
+ field->setVirtualFloatField((JavaObject*)obj, ((float*)_buf)[0]);
} else if (ass == AssessorDesc::dDouble) {
- (*field)((JavaObject*)obj, ((double*)_buf)[0]);
+ isStatic(field->access) ?
+ field->setStaticDoubleField(((double*)_buf)[0]) :
+ field->setVirtualDoubleField((JavaObject*)obj, ((double*)_buf)[0]);
} else if (ass == AssessorDesc::dTab || ass == AssessorDesc::dRef) {
- (*field)((JavaObject*)obj, ((JavaObject**)_buf)[0]);
+ isStatic(field->access) ?
+ field->setStaticObjectField(((JavaObject**)_buf)[0]) :
+ field->setVirtualObjectField((JavaObject*)obj, ((JavaObject**)_buf)[0]);
} else {
JavaThread::get()->isolate->unknownError("should not be here");
}
@@ -237,28 +369,56 @@
JNIEnv *env,
#endif
jobject Field, jobject obj, jboolean val) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
+
if (ass != AssessorDesc::dBool)
JavaThread::get()->isolate->illegalArgumentException("");
- (*field)((JavaObject*)obj, (uint32)val);
+
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
+ isStatic(field->access) ?
+ field->setStaticInt8Field((uint8)val) :
+ field->setVirtualInt8Field((JavaObject*)obj, (uint8)val);
}
JNIEXPORT void JNICALL Java_java_lang_reflect_Field_setByte(
#ifdef NATIVE_JNI
JNIEnv *env,
#endif
-jobject Field, jobject obj, jbyte val) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+jobject Field, jobject _obj, jbyte val) {
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
- if (ass == AssessorDesc::dByte || ass == AssessorDesc::dShort || ass == AssessorDesc::dInt) {
- (*field)((JavaObject*)obj, (uint32)val);
+ JavaObject* obj = (JavaObject*)_obj;
+
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
+ if (ass == AssessorDesc::dByte) {
+ isStatic(field->access) ?
+ field->setStaticInt8Field((sint8)val) :
+ field->setVirtualInt8Field((JavaObject*)obj, (sint8)val);
+ } else if (ass == AssessorDesc::dShort) {
+ isStatic(field->access) ?
+ field->setStaticInt16Field((sint16)val) :
+ field->setVirtualInt16Field((JavaObject*)obj, (sint16)val);
+ } else if (ass == AssessorDesc::dInt) {
+ isStatic(field->access) ?
+ field->setStaticInt32Field((sint32)val) :
+ field->setVirtualInt32Field((JavaObject*)obj, (sint32)val);
} else if (ass == AssessorDesc::dLong) {
- (*field)((JavaObject*)obj, (sint64)val);
+ isStatic(field->access) ?
+ field->setStaticLongField((sint64)val) :
+ field->setVirtualLongField((JavaObject*)obj, (sint64)val);
} else if (ass == AssessorDesc::dFloat) {
- (*field)((JavaObject*)obj, (float)val);
+ isStatic(field->access) ?
+ field->setStaticFloatField((float)val) :
+ field->setVirtualFloatField((JavaObject*)obj, (float)val);
} else if (ass == AssessorDesc::dDouble) {
- (*field)((JavaObject*)obj, (double)val);
+ isStatic(field->access) ?
+ field->setStaticDoubleField((double)val) :
+ field->setVirtualDoubleField((JavaObject*)obj, (double)val);
} else {
JavaThread::get()->isolate->illegalArgumentException("");
}
@@ -269,16 +429,32 @@
JNIEnv *env,
#endif
jobject Field, jobject obj, jchar val) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
- if (ass == AssessorDesc::dChar || ass == AssessorDesc::dInt) {
- (*field)((JavaObject*)obj, (uint32)val);
+
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
+ if (ass == AssessorDesc::dChar) {
+ isStatic(field->access) ?
+ field->setStaticInt16Field((double)val) :
+ field->setVirtualDoubleField((JavaObject*)obj, (uint16)val);
+ } else if (ass == AssessorDesc::dInt) {
+ isStatic(field->access) ?
+ field->setStaticInt32Field((uint32)val) :
+ field->setVirtualInt32Field((JavaObject*)obj, (uint32)val);
} else if (ass == AssessorDesc::dLong) {
- (*field)((JavaObject*)obj, (sint64)val);
+ isStatic(field->access) ?
+ field->setStaticLongField((uint64)val) :
+ field->setVirtualLongField((JavaObject*)obj, (uint64)val);
} else if (ass == AssessorDesc::dFloat) {
- (*field)((JavaObject*)obj, (float)val);
+ isStatic(field->access) ?
+ field->setStaticFloatField((float)(uint32)val) :
+ field->setVirtualFloatField((JavaObject*)obj, (float)(uint32)val);
} else if (ass == AssessorDesc::dDouble) {
- (*field)((JavaObject*)obj, (double)val);
+ isStatic(field->access) ?
+ field->setStaticDoubleField((double)(uint64)val) :
+ field->setVirtualDoubleField((JavaObject*)obj, (double)(uint64)val);
} else {
JavaThread::get()->isolate->illegalArgumentException("");
}
@@ -289,16 +465,32 @@
JNIEnv *env,
#endif
jobject Field, jobject obj, jshort val) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
- if (ass == AssessorDesc::dShort || ass == AssessorDesc::dInt) {
- (*field)((JavaObject*)obj, (uint32)val);
+
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
+ if (ass == AssessorDesc::dShort) {
+ isStatic(field->access) ?
+ field->setStaticInt16Field((sint16)val) :
+ field->setVirtualInt16Field((JavaObject*)obj, (sint16)val);
+ } else if (ass == AssessorDesc::dInt) {
+ isStatic(field->access) ?
+ field->setStaticInt32Field((sint32)val) :
+ field->setVirtualInt32Field((JavaObject*)obj, (sint32)val);
} else if (ass == AssessorDesc::dLong) {
- (*field)((JavaObject*)obj, (sint64)val);
+ isStatic(field->access) ?
+ field->setStaticLongField((sint64)val) :
+ field->setVirtualLongField((JavaObject*)obj, (sint64)val);
} else if (ass == AssessorDesc::dFloat) {
- (*field)((JavaObject*)obj, (float)val);
+ isStatic(field->access) ?
+ field->setStaticFloatField((float)val) :
+ field->setVirtualFloatField((JavaObject*)obj, (float)val);
} else if (ass == AssessorDesc::dDouble) {
- (*field)((JavaObject*)obj, (double)val);
+ isStatic(field->access) ?
+ field->setStaticDoubleField((double)val) :
+ field->setVirtualDoubleField((JavaObject*)obj, (double)val);
} else {
JavaThread::get()->isolate->illegalArgumentException("");
}
@@ -309,16 +501,28 @@
JNIEnv *env,
#endif
jobject Field, jobject obj, jint val) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
+
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
if (ass == AssessorDesc::dInt) {
- (*field)((JavaObject*)obj, (uint32)val);
+ isStatic(field->access) ?
+ field->setStaticInt32Field((sint32)val) :
+ field->setVirtualInt32Field((JavaObject*)obj, (sint32)val);
} else if (ass == AssessorDesc::dLong) {
- (*field)((JavaObject*)obj, (sint64)val);
+ isStatic(field->access) ?
+ field->setStaticLongField((sint64)val) :
+ field->setVirtualLongField((JavaObject*)obj, (sint64)val);
} else if (ass == AssessorDesc::dFloat) {
- (*field)((JavaObject*)obj, (float)val);
+ isStatic(field->access) ?
+ field->setStaticFloatField((float)val) :
+ field->setVirtualFloatField((JavaObject*)obj, (float)val);
} else if (ass == AssessorDesc::dDouble) {
- (*field)((JavaObject*)obj, (double)val);
+ isStatic(field->access) ?
+ field->setStaticDoubleField((double)val) :
+ field->setVirtualDoubleField((JavaObject*)obj, (double)val);
} else {
JavaThread::get()->isolate->illegalArgumentException("");
}
@@ -329,14 +533,24 @@
JNIEnv *env,
#endif
jobject Field, jobject obj, jlong val) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
+
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
if (ass == AssessorDesc::dLong) {
- (*field)((JavaObject*)obj, (sint64)val);
+ isStatic(field->access) ?
+ field->setStaticLongField((sint64)val) :
+ field->setVirtualLongField((JavaObject*)obj, (sint64)val);
} else if (ass == AssessorDesc::dFloat) {
- (*field)((JavaObject*)obj, (float)val);
+ isStatic(field->access) ?
+ field->setStaticFloatField((float)val) :
+ field->setVirtualFloatField((JavaObject*)obj, (float)val);
} else if (ass == AssessorDesc::dDouble) {
- (*field)((JavaObject*)obj, (double)val);
+ isStatic(field->access) ?
+ field->setStaticDoubleField((double)val) :
+ field->setVirtualDoubleField((JavaObject*)obj, (double)val);
} else {
JavaThread::get()->isolate->illegalArgumentException("");
}
@@ -347,12 +561,20 @@
JNIEnv *env,
#endif
jobject Field, jobject obj, jfloat val) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
+
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
if (ass == AssessorDesc::dFloat) {
- (*field)((JavaObject*)obj, (float)val);
+ isStatic(field->access) ?
+ field->setStaticFloatField((float)val) :
+ field->setVirtualFloatField((JavaObject*)obj, (float)val);
} else if (ass == AssessorDesc::dDouble) {
- (*field)((JavaObject*)obj, (double)val);
+ isStatic(field->access) ?
+ field->setStaticDoubleField((double)val) :
+ field->setVirtualDoubleField((JavaObject*)obj, (double)val);
} else {
JavaThread::get()->isolate->illegalArgumentException("");
}
@@ -363,10 +585,16 @@
JNIEnv *env,
#endif
jobject Field, jobject obj, jdouble val) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
const AssessorDesc* ass = field->signature->funcs;
+
+ if (isStatic(field->access))
+ JavaThread::get()->isolate->initialiseClass(field->classDef);
+
if (ass == AssessorDesc::dDouble) {
- (*field)((JavaObject*)obj, (double)val);
+ isStatic(field->access) ?
+ field->setStaticDoubleField((double)val) :
+ field->setVirtualDoubleField((JavaObject*)obj, (double)val);
} else {
JavaThread::get()->isolate->illegalArgumentException("");
}
@@ -378,7 +606,7 @@
#endif
JavaObject* Unsafe,
JavaObject* Field) {
- JavaField* field = (JavaField*)((*Classpath::fieldSlot)((JavaObject*)Field).IntVal.getZExtValue());
+ JavaField* field = (JavaField*)Classpath::fieldSlot->getVirtualInt32Field((JavaObject*)Field);
return (jlong)field->ptrOffset;
}
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp?rev=51242&r1=51241&r2=51242&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMStackWalker.cpp Mon May 19 05:03:04 2008
@@ -72,7 +72,7 @@
#endif
jclass _Cl) {
JavaObject* Cl = (JavaObject*)_Cl;
- CommonClass* cl = (CommonClass*)((*Cl)(Classpath::vmdataClass).PointerVal);
+ CommonClass* cl = (CommonClass*)Classpath::vmdataClass->getVirtualObjectField(Cl);
return (jobject)cl->classLoader;
}
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp?rev=51242&r1=51241&r2=51242&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThread.cpp Mon May 19 05:03:04 2008
@@ -60,10 +60,10 @@
Collector::inject_my_thread(&argc);
#endif
CommonClass* vmthClass = vmThread->classOf;
- JavaObject* thread = (JavaObject*)((*ClasspathThread::assocThread)(vmThread).PointerVal);
+ JavaObject* thread = ClasspathThread::assocThread->getVirtualObjectField(vmThread);
JavaIsolate* isolate = (JavaIsolate*)(intern->isolate);
ThreadSystem* ts = isolate->threadSystem;
- bool isDaemon = (*ClasspathThread::daemon)(thread).IntVal.getBoolValue();
+ bool isDaemon = ClasspathThread::daemon->getVirtualInt8Field(thread);
if (!isDaemon) {
ts->nonDaemonLock->lock();
@@ -109,13 +109,13 @@
#endif
jobject _vmThread, sint64 stackSize) {
JavaObject* vmThread = (JavaObject*)_vmThread;
- JavaObject* javaThread = (JavaObject*)(*ClasspathThread::assocThread)(vmThread).PointerVal;
+ JavaObject* javaThread = ClasspathThread::assocThread->getVirtualObjectField(vmThread);
assert(javaThread);
Jnjvm* vm = JavaThread::get()->isolate;
JavaThread* th = vm_new(vm, JavaThread)();
th->initialise(javaThread, vm);
- (*ClasspathThread::vmdata)(vmThread, (JavaObject*)th);
+ ClasspathThread::vmdata->setVirtualObjectField(vmThread, (JavaObject*)th);
int tid = 0;
arg_thread_t* arg = (arg_thread_t*)malloc(sizeof(arg_thread_t));
arg->intern = th;
@@ -134,9 +134,10 @@
jobject _vmthread) {
JavaObject* vmthread = (JavaObject*)_vmthread;
- while ((*ClasspathThread::vmdata)(vmthread).PointerVal == 0) mvm::Thread::yield();
+ while (ClasspathThread::vmdata->getVirtualObjectField(vmthread) == 0)
+ mvm::Thread::yield();
- JavaThread* th = (JavaThread*)(*ClasspathThread::vmdata)(vmthread).PointerVal;
+ JavaThread* th = (JavaThread*)ClasspathThread::vmdata->getVirtualObjectField(vmthread);
th->lock->lock();
th->interruptFlag = 1;
@@ -167,7 +168,7 @@
#endif
jobject _vmthread) {
JavaObject* vmthread = (JavaObject*)_vmthread;
- JavaThread* th = (JavaThread*)(*ClasspathThread::vmdata)(vmthread).PointerVal;
+ JavaThread* th = (JavaThread*)ClasspathThread::vmdata->getVirtualObjectField(vmthread);
return (jboolean)th->interruptFlag;
}
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp?rev=51242&r1=51241&r2=51242&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp Mon May 19 05:03:04 2008
@@ -9,8 +9,6 @@
#include <string.h>
-#include "llvm/Type.h"
-
#include "types.h"
#include "JavaAccess.h"
@@ -99,7 +97,7 @@
JNIEnv *env,
#endif
jobject vmthrow, jobject throwable) {
- int** stack = (int**)(ArrayUInt32*)(*Classpath::vmDataVMThrowable)((JavaObject*)vmthrow).PointerVal;
+ int** stack = (int**)Classpath::vmDataVMThrowable->getVirtualObjectField((JavaObject*)vmthrow);
CommonClass* cl = ((JavaObject*)throwable)->classOf;
uint32 first = 0;
sint32 i = 0;
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h?rev=51242&r1=51241&r2=51242&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h Mon May 19 05:03:04 2008
@@ -14,8 +14,6 @@
#include "types.h"
-#include "llvm/ExecutionEngine/GenericValue.h"
-
#include "mvm/Method.h"
#include "mvm/Object.h"
#include "mvm/PrintBuffer.h"
@@ -126,8 +124,8 @@
/// for a given class.
mvm::Lock* lockVar;
- /// condVar - Used to wake threads waiting on the load/resolve/initialize process
- /// of this class, done by another thread.
+ /// condVar - Used to wake threads waiting on the load/resolve/initialize
+ /// process of this class, done by another thread.
mvm::Cond* condVar;
/// classLoader - The Java class loader that loaded the class.
@@ -378,17 +376,37 @@
virtual void print(mvm::PrintBuffer *buf) const;
virtual void TRACER;
- llvm::GenericValue operator()(JavaObject* obj = 0);
- void operator()(JavaObject* obj, float val);
- void operator()(JavaObject* obj, double val);
- void operator()(JavaObject* obj, uint32 val);
- void operator()(JavaObject* obj, sint64 val);
- void operator()(JavaObject* obj, JavaObject* val);
- void operator()(float val);
- void operator()(double val);
- void operator()(uint32 val);
- void operator()(sint64 val);
-
+ void setStaticFloatField(float val);
+ void setStaticDoubleField(double val);
+ void setStaticInt8Field(uint8 val);
+ void setStaticInt16Field(uint16 val);
+ void setStaticInt32Field(uint32 val);
+ void setStaticLongField(sint64 val);
+ void setStaticObjectField(JavaObject* val);
+
+ float getStaticFloatField();
+ double getStaticDoubleField();
+ uint8 getStaticInt8Field();
+ uint16 getStaticInt16Field();
+ uint32 getStaticInt32Field();
+ sint64 getStaticLongField();
+ JavaObject* getStaticObjectField();
+
+ void setVirtualFloatField(JavaObject* obj, float val);
+ void setVirtualDoubleField(JavaObject* obj, double val);
+ void setVirtualInt8Field(JavaObject* obj, uint8 val);
+ void setVirtualInt16Field(JavaObject* obj, uint16 val);
+ void setVirtualInt32Field(JavaObject* obj, uint32 val);
+ void setVirtualLongField(JavaObject* obj, sint64 val);
+ void setVirtualObjectField(JavaObject* obj, JavaObject* val);
+
+ float getVirtualFloatField(JavaObject* obj);
+ double getVirtualDoubleField(JavaObject* obj);
+ uint8 getVirtualInt8Field(JavaObject* obj);
+ uint16 getVirtualInt16Field(JavaObject* obj);
+ uint32 getVirtualInt32Field(JavaObject* obj);
+ sint64 getVirtualLongField(JavaObject* obj);
+ JavaObject* getVirtualObjectField(JavaObject* obj);
};
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp?rev=51242&r1=51241&r2=51242&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp Mon May 19 05:03:04 2008
@@ -350,7 +350,7 @@
JavaThread::clearException();
JavaObject* obj = JavaThread::currentThread();
JavaObject* group =
- (JavaObject*)((*obj)(ClasspathThread::group)).PointerVal;
+ ClasspathThread::group->getVirtualObjectField(obj);
try{
ClasspathThread::uncaughtException->invokeIntSpecial(this, group, obj,
exc);
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp?rev=51242&r1=51241&r2=51242&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp Mon May 19 05:03:04 2008
@@ -59,143 +59,53 @@
return doNew(vm);
}
-void JavaField::operator()(JavaObject* obj, float val) {
- if (!classDef->isReady())
- classDef->isolate->loadName(classDef->name, classDef->classLoader, true, true, true);
-
- bool stat = isStatic(access);
- if (stat) obj = classDef->staticInstance();
- void* ptr = (void*)((uint64)obj + ptrOffset);
-
- if (signature->funcs->llvmType == Type::FloatTy) {
- ((float*)ptr)[0] = val;
- } else {
- JavaThread::get()->isolate->illegalArgumentException("wrong type in field assignment");
- }
-}
-
-void JavaField::operator()(JavaObject* obj, double val) {
- if (!classDef->isReady())
- classDef->isolate->loadName(classDef->name, classDef->classLoader, true, true, true);
-
- bool stat = isStatic(access);
- if (stat) obj = classDef->staticInstance();
- void* ptr = (void*)((uint64)obj + ptrOffset);
-
- if (signature->funcs->llvmType == Type::DoubleTy) {
- ((double*)ptr)[0] = val;
- } else {
- JavaThread::get()->isolate->illegalArgumentException("wrong type in field assignment");
- }
-}
-
-void JavaField::operator()(JavaObject* obj, sint64 val) {
- if (!classDef->isReady())
- classDef->isolate->loadName(classDef->name, classDef->classLoader, true, true, true);
-
- bool stat = isStatic(access);
- if (stat) obj = classDef->staticInstance();
- void* ptr = (void*)((uint64)obj + ptrOffset);
-
- if (signature->funcs == AssessorDesc::dLong) {
- ((uint64*)ptr)[0] = val;
- } else {
- JavaThread::get()->isolate->illegalArgumentException("wrong type in field assignment");
- }
+#define GETVIRTUALFIELD(TYPE, TYPE_NAME) \
+TYPE JavaField::getVirtual##TYPE_NAME##Field(JavaObject* obj) { \
+ if (!classDef->isReady()) \
+ classDef->isolate->loadName(classDef->name, classDef->classLoader, true, true, true); \
+ void* ptr = (void*)((uint64)obj + ptrOffset); \
+ return ((TYPE*)ptr)[0]; \
}
-void JavaField::operator()(JavaObject* obj, uint32 val) {
- if (!classDef->isReady())
- classDef->isolate->loadName(classDef->name, classDef->classLoader, true, true, true);
-
- bool stat = isStatic(access);
- if (stat) obj = classDef->staticInstance();
- void* ptr = (void*)((uint64)obj + ptrOffset);
-
- if (signature->funcs == AssessorDesc::dInt) {
- ((sint32*)ptr)[0] = (sint32)val;
- } else if (signature->funcs == AssessorDesc::dShort) {
- ((sint16*)ptr)[0] = (sint16)val;
- } else if (signature->funcs == AssessorDesc::dByte) {
- ((sint8*)ptr)[0] = (sint8)val;
- } else if (signature->funcs == AssessorDesc::dBool) {
- ((uint8*)ptr)[0] = (uint8)val;
- } else if (signature->funcs == AssessorDesc::dChar) {
- ((uint16*)ptr)[0] = (uint16)val;
- } else {
- JavaThread::get()->isolate->illegalArgumentException("wrong type in field assignment");
- }
+#define GETSTATICFIELD(TYPE, TYPE_NAME) \
+TYPE JavaField::getStatic##TYPE_NAME##Field() { \
+ if (!classDef->isReady()) \
+ classDef->isolate->loadName(classDef->name, classDef->classLoader, true, true, true); \
+ JavaObject* obj = classDef->staticInstance(); \
+ void* ptr = (void*)((uint64)obj + ptrOffset); \
+ return ((TYPE*)ptr)[0]; \
}
-void JavaField::operator()(JavaObject* obj, JavaObject* val) {
- if (!classDef->isReady())
- classDef->isolate->loadName(classDef->name, classDef->classLoader, true, true, true);
-
- bool stat = isStatic(access);
- if (stat) obj = classDef->staticInstance();
- void* ptr = (void*)((uint64)obj + ptrOffset);
-
- if (signature->funcs == AssessorDesc::dRef ||
- signature->funcs == AssessorDesc::dTab) {
- ((JavaObject**)ptr)[0] = val;
- } else {
- JavaThread::get()->isolate->illegalArgumentException("wrong type in field assignment");
- }
+#define SETVIRTUALFIELD(TYPE, TYPE_NAME) \
+void JavaField::setVirtual##TYPE_NAME##Field(JavaObject* obj, TYPE val) { \
+ if (!classDef->isReady()) \
+ classDef->isolate->loadName(classDef->name, classDef->classLoader, true, true, true); \
+ void* ptr = (void*)((uint64)obj + ptrOffset); \
+ ((TYPE*)ptr)[0] = val; \
}
-GenericValue JavaField::operator()(JavaObject* obj) {
- if (!classDef->isReady())
- classDef->isolate->loadName(classDef->name, classDef->classLoader, true, true, true);
-
- bool stat = isStatic(access);
- if (stat) {
- if (obj != 0) {
- // Assignment to a static var
- void* ptr = (void*)((uint64)(classDef->staticInstance()) + ptrOffset);
- ((JavaObject**)ptr)[0] = obj;
- return GenericValue(0);
- } else {
- // Get a static var
- obj = classDef->staticInstance();
- }
- }
-
- assert(obj && "getting a field from a null value");
-
- void* ptr = (void*)((uint64)obj + ptrOffset);
- const Type* type = signature->funcs->llvmType;
- if (type == Type::Int8Ty) {
- GenericValue gv;
- gv.IntVal = APInt(8, ((uint8*)ptr)[0]);
- return gv;
- } else if (type == Type::Int16Ty) {
- GenericValue gv;
- gv.IntVal = APInt(16, ((uint16*)ptr)[0]);
- return gv;
- } else if (type == Type::Int32Ty) {
- GenericValue gv;
- gv.IntVal = APInt(32, ((uint32*)ptr)[0]);
- return gv;
- } else if (type == Type::Int64Ty) {
- GenericValue gv;
- gv.IntVal = APInt(64, ((uint64*)ptr)[0]);
- return gv;
- } else if (type == Type::DoubleTy) {
- GenericValue gv;
- gv.DoubleVal = ((double*)ptr)[0];
- return gv;
- } else if (type == Type::FloatTy) {
- GenericValue gv;
- gv.FloatVal = ((float*)ptr)[0];
- return gv;
- } else if (type == JnjvmModule::JavaObjectType) {
- GenericValue gv(((JavaObject**)ptr)[0]);
- return gv;
- } else {
- assert(0 && "Unknown type!");
- return GenericValue(0);
- }
-}
+#define SETSTATICFIELD(TYPE, TYPE_NAME) \
+void JavaField::setStatic##TYPE_NAME##Field(TYPE val) { \
+ if (!classDef->isReady()) \
+ classDef->isolate->loadName(classDef->name, classDef->classLoader, true, true, true); \
+ JavaObject* obj = classDef->staticInstance(); \
+ void* ptr = (void*)((uint64)obj + ptrOffset); \
+ ((TYPE*)ptr)[0] = val; \
+}
+
+#define MK_ASSESSORS(TYPE, TYPE_NAME) \
+ GETVIRTUALFIELD(TYPE, TYPE_NAME) \
+ SETVIRTUALFIELD(TYPE, TYPE_NAME) \
+ GETSTATICFIELD(TYPE, TYPE_NAME) \
+ SETSTATICFIELD(TYPE, TYPE_NAME) \
+
+MK_ASSESSORS(float, Float);
+MK_ASSESSORS(double, Double);
+MK_ASSESSORS(JavaObject*, Object);
+MK_ASSESSORS(uint8, Int8);
+MK_ASSESSORS(uint16, Int16);
+MK_ASSESSORS(uint32, Int32);
+MK_ASSESSORS(sint64, Long);
#define readArgs(buf, signature, ap) \
for (std::vector<Typedef*>::iterator i = signature->args.begin(), \
@@ -443,47 +353,3 @@
INVOKE(JavaObject*, JavaObject, object_virtual_ap, object_static_ap, object_virtual_buf, object_static_buf)
#undef INVOKE
-
-GenericValue JavaObject::operator()(JavaField* field) {
- return (*field)(this);
-}
-
-void JavaObject::operator()(JavaField* field, float val) {
- return (*field)(this, val);
-}
-
-void JavaObject::operator()(JavaField* field, double val) {
- return (*field)(this, val);
-}
-
-void JavaObject::operator()(JavaField* field, uint32 val) {
- return (*field)(this, val);
-}
-
-void JavaObject::operator()(JavaField* field, sint64 val) {
- return (*field)(this, val);
-}
-
-void JavaObject::operator()(JavaField* field, JavaObject* val) {
- return (*field)(this, val);
-}
-
-void JavaField::operator()(float val) {
- JavaField * field = this;
- return (*field)(0, val);
-}
-
-void JavaField::operator()(double val) {
- JavaField * field = this;
- return (*field)(0, val);
-}
-
-void JavaField::operator()(sint64 val) {
- JavaField * field = this;
- return (*field)(0, val);
-}
-
-void JavaField::operator()(uint32 val) {
- JavaField * field = this;
- return (*field)(0, val);
-}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h?rev=51242&r1=51241&r2=51242&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaObject.h Mon May 19 05:03:04 2008
@@ -12,8 +12,6 @@
#include <vector>
-#include "llvm/ExecutionEngine/GenericValue.h"
-
#include "mvm/Object.h"
#include "mvm/Threads/Locks.h"
@@ -99,13 +97,6 @@
if (obj == 0) JavaThread::get()->isolate->nullPointerException("");
#endif
- llvm::GenericValue operator()(JavaField* field);
- void operator()(JavaField* field, float val);
- void operator()(JavaField* field, double val);
- void operator()(JavaField* field, sint64 val);
- void operator()(JavaField* field, uint32 val);
- void operator()(JavaField* field, JavaObject* val);
-
};
Modified: vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp?rev=51242&r1=51241&r2=51242&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jni.cpp Mon May 19 05:03:04 2008
@@ -88,9 +88,9 @@
JavaObject* meth = (JavaObject*)method;
CommonClass* cl = meth->classOf;
if (cl == Classpath::newConstructor) {
- return (jmethodID)(*Classpath::constructorSlot)(meth).IntVal.getZExtValue();
+ return (jmethodID)Classpath::constructorSlot->getVirtualInt32Field(meth);
} else if (cl == Classpath::newMethod) {
- return (jmethodID)(*Classpath::methodSlot)(meth).IntVal.getZExtValue();
+ return (jmethodID)Classpath::methodSlot->getVirtualInt32Field(meth);
} else {
JavaThread::get()->isolate->unknownError(
"%s is not a constructor or a method",
@@ -852,7 +852,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- return (jobject)((*field)(o).PointerVal);
+ return (jobject)field->getVirtualObjectField(o);
END_EXCEPTION
return 0;
@@ -865,7 +865,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- return (uint8)((*field)(o).IntVal.getZExtValue());
+ return (uint8)field->getVirtualInt8Field(o);
END_EXCEPTION
return 0;
@@ -878,7 +878,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- return (sint8)((*field)(o).IntVal.getSExtValue());
+ return (sint8)field->getVirtualInt8Field(o);
END_EXCEPTION
return 0;
@@ -891,7 +891,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- return (uint16)((*field)(o).IntVal.getZExtValue());
+ return (uint16)field->getVirtualInt16Field(o);
END_EXCEPTION
return 0;
@@ -904,7 +904,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- return (sint16)((*field)(o).IntVal.getSExtValue());
+ return (sint16)field->getVirtualInt16Field(o);
END_EXCEPTION
return 0;
@@ -917,7 +917,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- return (sint32)((*field)(o).IntVal.getSExtValue());
+ return (sint32)field->getVirtualInt32Field(o);
END_EXCEPTION
return 0;
@@ -930,7 +930,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- return (sint64)((*field)(o).IntVal.getSExtValue());
+ return (sint64)field->getVirtualLongField(o);
END_EXCEPTION
return 0;
@@ -943,7 +943,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- return (*field)(o).FloatVal;
+ return field->getVirtualFloatField(o);
END_EXCEPTION
return 0;
@@ -956,7 +956,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- return (*field)(o).DoubleVal;
+ return (jdouble)field->getVirtualDoubleField(o);
END_EXCEPTION
return 0;
@@ -969,7 +969,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- (*field)(o, (JavaObject*)value);
+ field->setVirtualObjectField(o, (JavaObject*)value);
END_EXCEPTION
}
@@ -982,7 +982,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- (*field)(o, (uint32)value);
+ field->setVirtualInt8Field(o, (uint8)value);
END_EXCEPTION
}
@@ -994,7 +994,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- (*field)(o, (uint32)value);
+ field->setVirtualInt8Field(o, (uint8)value);
END_EXCEPTION
}
@@ -1006,7 +1006,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- (*field)(o, (uint32)value);
+ field->setVirtualInt16Field(o, (uint16)value);
END_EXCEPTION
}
@@ -1018,7 +1018,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- (*field)(o, (uint32)value);
+ field->setVirtualInt16Field(o, (sint16)value);
END_EXCEPTION
}
@@ -1030,7 +1030,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- (*field)(o, (uint32)value);
+ field->setVirtualInt32Field(o, (sint32)value);
END_EXCEPTION
}
@@ -1042,7 +1042,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- (*field)(o, (sint64)value);
+ field->setVirtualLongField(o, (sint64)value);
END_EXCEPTION
}
@@ -1054,7 +1054,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- (*field)(o, (float)value);
+ field->setVirtualFloatField(o, (float)value);
END_EXCEPTION
}
@@ -1066,7 +1066,7 @@
JavaField* field = (JavaField*)fieldID;
JavaObject* o = (JavaObject*)obj;
- (*field)(o, (double)value);
+ field->setVirtualDoubleField(o, (float)value);
END_EXCEPTION
}
@@ -1343,8 +1343,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- llvm::GenericValue res = (*field)();
- return (jobject)res.PointerVal;
+ return (jobject)field->getStaticObjectField();
END_EXCEPTION
return 0;
@@ -1356,8 +1355,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- llvm::GenericValue res = (*field)();
- return (jboolean)res.IntVal.getZExtValue();
+ return (jboolean)field->getStaticInt8Field();
END_EXCEPTION
return 0;
@@ -1369,8 +1367,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- llvm::GenericValue res = (*field)();
- return (jbyte)res.IntVal.getSExtValue();
+ return (jbyte)field->getStaticInt8Field();
END_EXCEPTION
return 0;
@@ -1382,8 +1379,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- llvm::GenericValue res = (*field)();
- return (jchar)res.IntVal.getZExtValue();
+ return (jchar)field->getStaticInt16Field();
END_EXCEPTION
return 0;
@@ -1395,8 +1391,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- llvm::GenericValue res = (*field)();
- return (jshort)res.IntVal.getSExtValue();
+ return (jshort)field->getStaticInt16Field();
END_EXCEPTION
return 0;
@@ -1408,8 +1403,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- llvm::GenericValue res = (*field)();
- return (jint)res.IntVal.getSExtValue();
+ return (jint)field->getStaticInt32Field();
END_EXCEPTION
return 0;
@@ -1421,8 +1415,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- llvm::GenericValue res = (*field)();
- return (jlong)res.IntVal.getZExtValue();
+ return (jlong)field->getStaticLongField();
END_EXCEPTION
return 0;
@@ -1434,8 +1427,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- llvm::GenericValue res = (*field)();
- return (jfloat)res.FloatVal;
+ return (jfloat)field->getStaticFloatField();
END_EXCEPTION
return 0;
@@ -1447,8 +1439,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- llvm::GenericValue res = (*field)();
- return (jdouble)res.DoubleVal;
+ return (jdouble)field->getStaticDoubleField();
END_EXCEPTION
return 0;
@@ -1461,7 +1452,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- (*field)((JavaObject*)value);
+ field->setStaticObjectField((JavaObject*)value);
END_EXCEPTION
}
@@ -1473,7 +1464,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- (*field)((uint32)value);
+ field->setStaticInt8Field((uint8)value);
END_EXCEPTION
}
@@ -1485,7 +1476,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- (*field)((uint32)value);
+ field->setStaticInt8Field((sint8)value);
END_EXCEPTION
}
@@ -1497,7 +1488,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- (*field)((uint32)value);
+ field->setStaticInt16Field((uint16)value);
END_EXCEPTION
}
@@ -1509,7 +1500,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- (*field)((uint32)value);
+ field->setStaticInt16Field((sint16)value);
END_EXCEPTION
}
@@ -1521,7 +1512,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- (*field)((uint32)value);
+ field->setStaticInt32Field((sint32)value);
END_EXCEPTION
}
@@ -1533,7 +1524,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- (*field)((sint64)value);
+ field->setStaticLongField((sint64)value);
END_EXCEPTION
}
@@ -1545,7 +1536,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- (*field)((float)value);
+ field->setStaticFloatField((float)value);
END_EXCEPTION
}
@@ -1557,7 +1548,7 @@
BEGIN_EXCEPTION
JavaField* field = (JavaField*)fieldID;
- (*field)((double)value);
+ field->setStaticDoubleField((double)value);
END_EXCEPTION
}
@@ -2152,9 +2143,9 @@
BEGIN_EXCEPTION
JavaObject* buf = (JavaObject*)_buf;
- JavaObject* address = (JavaObject*)((*Classpath::bufferAddress)(buf).PointerVal);
+ JavaObject* address = Classpath::bufferAddress->getVirtualObjectField(buf);
if (address != 0) {
- int res = (*Classpath::dataPointer32)(address).IntVal.getZExtValue();
+ int res = Classpath::dataPointer32->getVirtualInt32Field(address);
return (void*)res;
} else {
return 0;
Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=51242&r1=51241&r2=51242&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Mon May 19 05:03:04 2008
@@ -641,18 +641,18 @@
if (loader) {
#ifndef SERVICE_VM
ClassMap* map =
- (ClassMap*)(*Classpath::vmdataClassLoader)(loader).PointerVal;
+ (ClassMap*)(Classpath::vmdataClassLoader->getVirtualObjectField(loader));
if (!map) {
map = vm_new(this, ClassMap)();
- (*Classpath::vmdataClassLoader)(loader, (JavaObject*)map);
+ Classpath::vmdataClassLoader->setVirtualObjectField(loader, (JavaObject*)map);
}
#else
ClassMap* map = 0;
ServiceDomain* vm =
- (ServiceDomain*)(*Classpath::vmdataClassLoader)(loader).PointerVal;
+ (ServiceDomain*)(Classpath::vmdataClassLoader->getVirtualObjectField(loader));
if (!vm) {
vm = ServiceDomain::allocateService((JavaIsolate*)Jnjvm::bootstrapVM);
- (*Classpath::vmdataClassLoader)(loader, (JavaObject*)vm);
+ Classpath::vmdataClassLoader->setVirtualObjectField(loader, (JavaObject*)vm);
}
map = vm->classes;
#endif
@@ -690,19 +690,19 @@
if (loader) {
#ifndef SERVICE_VM
ClassMap* map =
- (ClassMap*)(*Classpath::vmdataClassLoader)(loader).PointerVal;
+ (ClassMap*)(Classpath::vmdataClassLoader->getVirtualObjectField(loader));
if (!map) {
map = vm_new(this, ClassMap)();
- (*Classpath::vmdataClassLoader)(loader, (JavaObject*)map);
+ Classpath::vmdataClassLoader->setVirtualObjectField(loader, (JavaObject*)map);
}
ClassArray* res = (ClassArray*)map->lookupOrCreate(name, this, arrayDup);
#else
ClassMap* map = 0;
ServiceDomain* vm =
- (ServiceDomain*)(*Classpath::vmdataClassLoader)(loader).PointerVal;
+ (ServiceDomain*)(Classpath::vmdataClassLoader->getVirtualObjectField(loader));
if (!vm) {
vm = ServiceDomain::allocateService((JavaIsolate*)Jnjvm::bootstrapVM);
- (*Classpath::vmdataClassLoader)(loader, (JavaObject*)vm);
+ Classpath::vmdataClassLoader->getVirtualObjectField(loader, (JavaObject*)vm);
}
map = vm->classes;
ClassArray* res = (ClassArray*)map->lookupOrCreate(name, vm, arrayDup);
@@ -733,19 +733,19 @@
if (loader) {
#ifndef SERVICE_VM
ClassMap* map =
- (ClassMap*)(*Classpath::vmdataClassLoader)(loader).PointerVal;
+ (ClassMap*)(Classpath::vmdataClassLoader->getVirtualObjectField(loader));
if (!map) {
map = vm_new(this, ClassMap)();
- (*Classpath::vmdataClassLoader)(loader, (JavaObject*)map);
+ (Classpath::vmdataClassLoader->setVirtualObjectField(loader, (JavaObject*)map));
}
Class* res = (Class*)map->lookupOrCreate(name, this, classDup);
#else
ClassMap* map = 0;
ServiceDomain* vm =
- (ServiceDomain*)(*Classpath::vmdataClassLoader)(loader).PointerVal;
+ (ServiceDomain*)(Classpath::vmdataClassLoader->getVirtualObjectField(loader));
if (!vm) {
vm = ServiceDomain::allocateService((JavaIsolate*)Jnjvm::bootstrapVM);
- (*Classpath::vmdataClassLoader)(loader, (JavaObject*)vm);
+ Classpath::vmdataClassLoader->setVirtualObjectField(loader, (JavaObject*)vm);
}
map = vm->classes;
Class* res = (Class*)map->lookupOrCreate(name, vm, classDup);
@@ -825,7 +825,7 @@
JavaString* str = this->UTF8ToStr(name);
JavaObject* obj = (JavaObject*)
Classpath::loadInClassLoader->invokeJavaObjectVirtual(this, loader, str);
- return (CommonClass*)((*Classpath::vmdataClass)(obj).PointerVal);
+ return (CommonClass*)(Classpath::vmdataClass->getVirtualObjectField(obj));
}
JavaString* Jnjvm::UTF8ToStr(const UTF8* utf8) {
Modified: vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp?rev=51242&r1=51241&r2=51242&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp Mon May 19 05:03:04 2008
@@ -229,7 +229,7 @@
CommonClass* NativeUtil::resolvedImplClass(jclass clazz, bool doClinit) {
JavaObject *Cl = (JavaObject*)clazz;
- CommonClass* cl = (CommonClass*)((*Cl)(Classpath::vmdataClass).PointerVal);
+ CommonClass* cl = (CommonClass*)Classpath::vmdataClass->getVirtualObjectField(Cl);
cl->resolveClass(doClinit);
return cl;
}
@@ -258,13 +258,12 @@
if (funcs == AssessorDesc::dShort) {
if (value == AssessorDesc::dShort) {
- llvm::GenericValue val = (*Classpath::shortValue)(obj);
- ((uint32*)buf)[0] = (uint32)val.IntVal.getSExtValue();
+ ((uint16*)buf)[0] = Classpath::shortValue->getVirtualInt16Field(obj);
buf++;
return;
} else if (value == AssessorDesc::dByte) {
- llvm::GenericValue val = (*Classpath::shortValue)(obj);
- ((uint32*)buf)[0] = (uint32)val.IntVal.getSExtValue();
+ ((sint16*)buf)[0] =
+ (sint16)Classpath::byteValue->getVirtualInt8Field(obj);
buf++;
return;
} else {
@@ -272,8 +271,7 @@
}
} else if (funcs == AssessorDesc::dByte) {
if (value == AssessorDesc::dByte) {
- llvm::GenericValue val = (*Classpath::byteValue)(obj);
- ((uint32*)buf)[0] = (uint32)val.IntVal.getSExtValue();
+ ((uint8*)buf)[0] = Classpath::byteValue->getVirtualInt8Field(obj);
buf++;
return;
} else {
@@ -281,170 +279,98 @@
}
} else if (funcs == AssessorDesc::dBool) {
if (value == AssessorDesc::dBool) {
- llvm::GenericValue val = (*Classpath::boolValue)(obj);
- ((uint32*)buf)[0] = (uint32)val.IntVal.getZExtValue();
+ ((uint8*)buf)[0] = Classpath::boolValue->getVirtualInt8Field(obj);
buf++;
return;
} else {
vm->illegalArgumentException("");
}
} else if (funcs == AssessorDesc::dInt) {
+ sint32 val = 0;
if (value == AssessorDesc::dInt) {
- llvm::GenericValue val = (*Classpath::intValue)(obj);
- ((uint32*)buf)[0] = (uint32)val.IntVal.getSExtValue();
- buf++;
+ val = Classpath::intValue->getVirtualInt32Field(obj);
} else if (value == AssessorDesc::dByte) {
- llvm::GenericValue val = (*Classpath::byteValue)(obj);
- ((uint32*)buf)[0] = (uint32)val.IntVal.getSExtValue();
- buf++;
- return;
+ val = (sint32)Classpath::byteValue->getVirtualInt8Field(obj);
} else if (value == AssessorDesc::dChar) {
- llvm::GenericValue val = (*Classpath::charValue)(obj);
- ((uint32*)buf)[0] = (uint32)val.IntVal.getZExtValue();
- buf++;
- return;
+ val = (uint32)Classpath::charValue->getVirtualInt16Field(obj);
} else if (value == AssessorDesc::dShort) {
- llvm::GenericValue val = (*Classpath::shortValue)(obj);
- ((uint32*)buf)[0] = val.IntVal.getSExtValue();
- buf++;
- return;
+ val = (sint32)Classpath::shortValue->getVirtualInt16Field(obj);
} else {
vm->illegalArgumentException("");
}
+ ((sint32*)buf)[0] = val;
+ buf++;
+ return;
} else if (funcs == AssessorDesc::dChar) {
+ uint16 val = 0;
if (value == AssessorDesc::dChar) {
- llvm::GenericValue val = (*Classpath::charValue)(obj);
- ((uint32*)buf)[0] = (uint32)val.IntVal.getZExtValue();
- buf++;
- return;
+ val = (uint16)Classpath::charValue->getVirtualInt16Field(obj);
} else {
vm->illegalArgumentException("");
}
+ ((uint16*)buf)[0] = val;
+ buf++;
+ return;
} else if (funcs == AssessorDesc::dFloat) {
+ float val = 0;
if (value == AssessorDesc::dFloat) {
- llvm::GenericValue val = (*Classpath::floatValue)(obj);
- ((float*)buf)[0] = val.FloatVal;
- buf++;
- return;
+ val = (float)Classpath::floatValue->getVirtualFloatField(obj);
} else if (value == AssessorDesc::dByte) {
- llvm::GenericValue val = (*Classpath::byteValue)(obj);
- float res = (float)(val.IntVal.getSExtValue());
- ((float*)buf)[0] = res;
- buf++;
- return;
+ val = (float)(sint32)Classpath::byteValue->getVirtualInt8Field(obj);
} else if (value == AssessorDesc::dChar) {
- llvm::GenericValue val = (*Classpath::charValue)(obj);
- float res = (float)(val.IntVal.getZExtValue());
- ((float*)buf)[0] = res;
- buf++;
- return;
+ val = (float)(uint32)Classpath::charValue->getVirtualInt16Field(obj);
} else if (value == AssessorDesc::dShort) {
- llvm::GenericValue val = (*Classpath::shortValue)(obj);
- float res = (float)(val.IntVal.getSExtValue());
- ((float*)buf)[0] = res;
- buf++;
- return;
+ val = (float)(sint32)Classpath::shortValue->getVirtualInt16Field(obj);
} else if (value == AssessorDesc::dInt) {
- llvm::GenericValue val = (*Classpath::intValue)(obj);
- float res = (float)(val.IntVal.getSExtValue());
- ((float*)buf)[0] = res;
- buf++;
- return;
+ val = (float)(sint32)Classpath::intValue->getVirtualInt32Field(obj);
} else if (value == AssessorDesc::dLong) {
- llvm::GenericValue val = (*Classpath::longValue)(obj);
- float res = (float)(val.IntVal.getSExtValue());
- ((float*)buf)[0] = res;
- buf++;
- return;
+ val = (float)Classpath::longValue->getVirtualLongField(obj);
} else {
vm->illegalArgumentException("");
}
+ ((float*)buf)[0] = val;
+ buf++;
+ return;
} else if (funcs == AssessorDesc::dDouble) {
+ double val = 0;
if (value == AssessorDesc::dDouble) {
- llvm::GenericValue gv = (*Classpath::doubleValue)(obj);
- ((double*)buf)[0] = gv.DoubleVal;
- buf++;
- buf++;
- return;
+ val = (double)Classpath::doubleValue->getVirtualDoubleField(obj);
} else if (value == AssessorDesc::dFloat) {
- llvm::GenericValue val = (*Classpath::floatValue)(obj);
- double res = (double)(val.FloatVal);
- ((double*)buf)[0] = res;
- buf++;
- buf++;
- return;
+ val = (double)Classpath::floatValue->getVirtualFloatField(obj);
} else if (value == AssessorDesc::dByte) {
- llvm::GenericValue val = (*Classpath::byteValue)(obj);
- double res = (double)(val.IntVal.getSExtValue());
- ((double*)buf)[0] = res;
- buf++;
- buf++;
- return;
+ val = (double)(sint64)Classpath::byteValue->getVirtualInt8Field(obj);
} else if (value == AssessorDesc::dChar) {
- llvm::GenericValue val = (*Classpath::charValue)(obj);
- double res = (double)(val.IntVal.getZExtValue());
- ((double*)buf)[0] = res;
- buf++;
- buf++;
- return;
+ val = (double)(uint64)Classpath::charValue->getVirtualInt16Field(obj);
} else if (value == AssessorDesc::dShort) {
- llvm::GenericValue val = (*Classpath::shortValue)(obj);
- double res = (double)(val.IntVal.getSExtValue());
- ((double*)buf)[0] = res;
- buf++;
- buf++;
- return;
+ val = (double)(sint16)Classpath::shortValue->getVirtualInt16Field(obj);
} else if (value == AssessorDesc::dInt) {
- llvm::GenericValue val = (*Classpath::intValue)(obj);
- double res = (double)(val.IntVal.getSExtValue());
- ((double*)buf)[0] = res;
- buf++;
- buf++;
- return;
+ val = (double)(sint32)Classpath::intValue->getVirtualInt32Field(obj);
} else if (value == AssessorDesc::dLong) {
- llvm::GenericValue val = (*Classpath::longValue)(obj);
- double res = (double)(val.IntVal.getSExtValue());
- ((double*)buf)[0] = res;
- buf++;
- buf++;
- return;
+ val = (double)(sint64)Classpath::longValue->getVirtualLongField(obj);
} else {
vm->illegalArgumentException("");
}
+ ((double*)buf)[0] = val;
+ buf += 2;
+ return;
} else if (funcs == AssessorDesc::dLong) {
+ sint64 val = 0;
if (value == AssessorDesc::dByte) {
- llvm::GenericValue val = (*Classpath::byteValue)(obj);
- ((uint64*)buf)[0] = val.IntVal.getSExtValue();
- buf++;
- buf++;
- return;
+ val = (sint64)Classpath::byteValue->getVirtualInt8Field(obj);
} else if (value == AssessorDesc::dChar) {
- llvm::GenericValue val = (*Classpath::charValue)(obj);
- ((uint64*)buf)[0] = val.IntVal.getZExtValue();
- buf++;
- buf++;
- return;
+ val = (sint64)(uint64)Classpath::charValue->getVirtualInt16Field(obj);
} else if (value == AssessorDesc::dShort) {
- llvm::GenericValue val = (*Classpath::shortValue)(obj);
- ((uint64*)buf)[0] = val.IntVal.getSExtValue();
- buf++;
- buf++;
- return;
+ val = (sint64)Classpath::shortValue->getVirtualInt16Field(obj);
} else if (value == AssessorDesc::dInt) {
- llvm::GenericValue val = (*Classpath::intValue)(obj);
- ((uint64*)buf)[0] = val.IntVal.getSExtValue();
- buf++;
- buf++;
- return;
+ val = (sint64)Classpath::intValue->getVirtualInt32Field(obj);
} else if (value == AssessorDesc::dLong) {
- llvm::GenericValue val = (*Classpath::longValue)(obj);
- ((uint64*)buf)[0] = val.IntVal.getSExtValue();
- buf++;
- buf++;
- return;
+ val = (sint64)Classpath::intValue->getVirtualLongField(obj);
} else {
vm->illegalArgumentException("");
}
+ ((sint64*)buf)[0] = val;
+ buf += 2;
+ return;
}
}
// can not be here
More information about the llvm-commits
mailing list