[vmkit-commits] [vmkit] r55172 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaCache.cpp JavaCache.h JavaClass.cpp JavaClass.h JavaConstantPool.cpp JavaConstantPool.h JavaJIT.cpp JavaRuntimeJIT.cpp JnjvmClassLoader.cpp JnjvmModuleProvider.cpp NativeUtil.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Fri Aug 22 01:27:02 PDT 2008
Author: geoffray
Date: Fri Aug 22 03:27:01 2008
New Revision: 55172
URL: http://llvm.org/viewvc/llvm-project?rev=55172&view=rev
Log:
Rename JavaCtpInfo to JavaConstantPool and symplify & comment
JavaConstantPool.h.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaCache.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaCache.h
vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.h
vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp
vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaCache.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaCache.cpp?rev=55172&r1=55171&r2=55172&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaCache.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaCache.cpp Fri Aug 22 03:27:01 2008
@@ -44,10 +44,9 @@
enveloppe = E;
}
- Enveloppe::Enveloppe(JavaCtpInfo* ctp, uint32 i) {
+Enveloppe::Enveloppe(JavaConstantPool* ctp, uint32 i) {
firstCache = new CacheNode(this);
cacheLock = mvm::Lock::allocNormal();
ctpInfo = ctp;
index = i;
}
-
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaCache.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaCache.h?rev=55172&r1=55171&r2=55172&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaCache.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaCache.h Fri Aug 22 03:27:01 2008
@@ -31,7 +31,7 @@
class Class;
class Enveloppe;
-class JavaCtpInfo;
+class JavaConstantPool;
/// CacheNode - A {class, method pointer} pair.
class CacheNode {
@@ -67,7 +67,7 @@
/// ctpInfo - The constant pool info that owns the invokeinterface
/// bytecode. This is used to resolve the interface call at its first
/// occurence.
- JavaCtpInfo* ctpInfo;
+ JavaConstantPool* ctpInfo;
/// cacheLock - The linked list may be modified by concurrent thread. This
/// lock ensures that the list stays consistent.
@@ -79,7 +79,7 @@
/// Enveloppe - Allocates the linked list with the given constant pool info
/// at the given index, so as the resolution process knows which interface
/// method the invokeinterface bytecode references.
- Enveloppe(JavaCtpInfo* info, uint32 index);
+ Enveloppe(JavaConstantPool* info, uint32 index);
};
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp?rev=55172&r1=55171&r2=55172&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Fri Aug 22 03:27:01 2008
@@ -500,7 +500,7 @@
JnjvmModule::InitField(this, obj);
} else {
Reader reader(attribut, classDef->bytes);
- JavaCtpInfo * ctpInfo = classDef->ctpInfo;
+ JavaConstantPool * ctpInfo = classDef->ctpInfo;
uint16 idx = reader.readU2();
if (funcs == AssessorDesc::dLong) {
JnjvmModule::InitField(this, obj, (uint64)ctpInfo->LongAt(idx));
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h?rev=55172&r1=55171&r2=55172&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h Fri Aug 22 03:27:01 2008
@@ -31,7 +31,7 @@
class AssessorDesc;
class Enveloppe;
class Class;
-class JavaCtpInfo;
+class JavaConstantPool;
class JavaField;
class JavaJIT;
class JavaMethod;
@@ -478,7 +478,7 @@
/// ctpInfo - The constant pool info of this class.
///
- JavaCtpInfo* ctpInfo;
+ JavaConstantPool* ctpInfo;
/// attributs - JVM attributes of this class.
///
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp?rev=55172&r1=55171&r2=55172&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp Fri Aug 22 03:27:01 2008
@@ -30,61 +30,56 @@
using namespace jnjvm;
-const uint32 JavaCtpInfo::ConstantUTF8 = 1;
-const uint32 JavaCtpInfo::ConstantInteger = 3;
-const uint32 JavaCtpInfo::ConstantFloat = 4;
-const uint32 JavaCtpInfo::ConstantLong = 5;
-const uint32 JavaCtpInfo::ConstantDouble = 6;
-const uint32 JavaCtpInfo::ConstantClass = 7;
-const uint32 JavaCtpInfo::ConstantString = 8;
-const uint32 JavaCtpInfo::ConstantFieldref = 9;
-const uint32 JavaCtpInfo::ConstantMethodref = 10;
-const uint32 JavaCtpInfo::ConstantInterfaceMethodref = 11;
-const uint32 JavaCtpInfo::ConstantNameAndType = 12;
+const uint32 JavaConstantPool::ConstantUTF8 = 1;
+const uint32 JavaConstantPool::ConstantInteger = 3;
+const uint32 JavaConstantPool::ConstantFloat = 4;
+const uint32 JavaConstantPool::ConstantLong = 5;
+const uint32 JavaConstantPool::ConstantDouble = 6;
+const uint32 JavaConstantPool::ConstantClass = 7;
+const uint32 JavaConstantPool::ConstantString = 8;
+const uint32 JavaConstantPool::ConstantFieldref = 9;
+const uint32 JavaConstantPool::ConstantMethodref = 10;
+const uint32 JavaConstantPool::ConstantInterfaceMethodref = 11;
+const uint32 JavaConstantPool::ConstantNameAndType = 12;
-static uint32 unimplemented(Class* cl, uint32 type, uint32 e, Reader& reader,
- sint32* ctpDef, void** ctpRes, uint8* ctpType) {
+static uint32 unimplemented(JavaConstantPool* ctp, Reader& reader, uint32 index) {
JavaThread::get()->isolate->classFormatError(
- "unknown constant pool type %d",
- type);
+ "unknown constant pool at index %d",
+ index);
return 1;
}
-uint32 JavaCtpInfo::CtpReaderClass(Class* cl, uint32 type, uint32 e,
- Reader& reader, sint32* ctpDef,
- void** ctpRes, uint8* ctpType) {
+uint32 JavaConstantPool::CtpReaderClass(JavaConstantPool* ctp, Reader& reader,
+ uint32 index) {
uint16 entry = reader.readU2();
- ctpDef[e] = entry;
+ ctp->ctpDef[index] = entry;
PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] <class>\t\tutf8 is at %d\n", e,
entry);
return 1;
}
-uint32 JavaCtpInfo::CtpReaderInteger(Class* cl, uint32 type, uint32 e,
- Reader& reader, sint32* ctpDef,
- void** ctpRes, uint8* ctpType) {
+uint32 JavaConstantPool::CtpReaderInteger(JavaConstantPool* ctp, Reader& reader,
+ uint32 index) {
uint32 val = reader.readU4();
- ctpDef[e] = val;
+ ctp->ctpDef[index] = val;
PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] <class>\tinteger: %d\n", e,
val);
return 1;
}
-uint32 JavaCtpInfo::CtpReaderFloat(Class* cl, uint32 type, uint32 e,
- Reader& reader, sint32* ctpDef,
- void** ctpRes, uint8* ctpType) {
+uint32 JavaConstantPool::CtpReaderFloat(JavaConstantPool* ctp, Reader& reader,
+ uint32 index) {
uint32 val = reader.readU4();
- ctpDef[e] = val;
+ ctp->ctpDef[index] = val;
PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] <class>\tfloat: %d\n", e,
val);
return 1;
}
-uint32 JavaCtpInfo::CtpReaderUTF8(Class* cl, uint32 type, uint32 e,
- Reader& reader, sint32* ctpDef, void** ctpRes,
- uint8* ctpType) {
+uint32 JavaConstantPool::CtpReaderUTF8(JavaConstantPool* ctp, Reader& reader,
+ uint32 index) {
uint16 len = reader.readU2();
uint16* buf = (uint16*)alloca(len * sizeof(uint16));
uint32 n = 0;
@@ -111,118 +106,105 @@
buf[n] = ((uint16)cur);
++n;
}
-
+
+ Class* cl = ctp->classDef;
const UTF8* utf8 = cl->classLoader->hashUTF8->lookupOrCreateReader(buf, n);
- ctpRes[e] = (UTF8*)utf8;
+ ctp->ctpRes[index] = (UTF8*)utf8;
- PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] <utf8>\t\t\"%s\"\n", e,
+ PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] <utf8>\t\t\"%s\"\n", index,
utf8->printString());
return 1;
}
-uint32 JavaCtpInfo::CtpReaderNameAndType(Class* cl, uint32 type,
- uint32 e, Reader& reader,
- sint32* ctpDef, void** ctpRes,
- uint8* ctpType) {
+uint32 JavaConstantPool::CtpReaderNameAndType(JavaConstantPool* ctp, Reader& reader,
+ uint32 index) {
uint32 entry = reader.readU4();
- ctpDef[e] = entry;
+ ctp->ctpDef[index] = entry;
PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL,
- "; [%5d] <name/type>\tname is at %d, type is at %d\n", e,
+ "; [%5d] <name/type>\tname is at %d, type is at %d\n", index,
(entry >> 16), (entry & 0xffff));
return 1;
}
-uint32 JavaCtpInfo::CtpReaderFieldref(Class* cl, uint32 type,
- uint32 e, Reader& reader, sint32* ctpDef,
- void** ctpRes, uint8* ctpType) {
+uint32 JavaConstantPool::CtpReaderFieldref(JavaConstantPool* ctp, Reader& reader,
+ uint32 index) {
uint32 entry = reader.readU4();
- ctpDef[e] = entry;
+ ctp->ctpDef[index] = entry;
PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL,
- "; [%5d] <fieldref>\tclass is at %d, name/type is at %d\n", e,
+ "; [%5d] <fieldref>\tclass is at %d, name/type is at %d\n", index,
(entry >> 16), (entry & 0xffff));
return 1;
}
-uint32 JavaCtpInfo::CtpReaderString(Class* cl, uint32 type, uint32 e,
- Reader& reader, sint32* ctpDef,
- void** ctpRes, uint8* ctpType) {
+uint32 JavaConstantPool::CtpReaderString(JavaConstantPool* ctp, Reader& reader,
+ uint32 index) {
uint16 entry = reader.readU2();
- ctpDef[e] = entry;
+ ctp->ctpDef[index] = entry;
PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] <string>\tutf8 is at %d\n",
- e, entry);
+ index, entry);
return 1;
}
-uint32 JavaCtpInfo::CtpReaderMethodref(Class* cl, uint32 type,
- uint32 e, Reader& reader, sint32* ctpDef,
- void** ctpRes, uint8* ctpType) {
+uint32 JavaConstantPool::CtpReaderMethodref(JavaConstantPool* ctp, Reader& reader,
+ uint32 index) {
uint32 entry = reader.readU4();
- ctpDef[e] = entry;
+ ctp->ctpDef[index] = entry;
PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL,
- "; [%5d] <methodref>\tclass is at %d, name/type is at %d\n", e,
- (entry >> 16), (entry & 0xffff));
+ "; [%5d] <methodref>\tclass is at %d, name/type is at %d\n",
+ index, (entry >> 16), (entry & 0xffff));
return 1;
}
-uint32 JavaCtpInfo::CtpReaderInterfaceMethodref(Class* cl,
- uint32 type,
- uint32 e, Reader& reader,
- sint32* ctpDef, void** ctpRes,
- uint8* ctpType) {
+uint32 JavaConstantPool::CtpReaderInterfaceMethodref(JavaConstantPool* ctp,
+ Reader& reader,
+ uint32 index) {
uint32 entry = reader.readU4();
- ctpDef[e] = entry;
+ ctp->ctpDef[index] = entry;
PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL,
"; [%5d] <Interface xmethodref>\tclass is at %d, name/type is at %d\n",
- e, (entry >> 16), (entry & 0xffff));
+ index, (entry >> 16), (entry & 0xffff));
return 1;
}
-uint32 JavaCtpInfo::CtpReaderLong(Class* cl, uint32 type, uint32 e,
- Reader& reader, sint32* ctpDef, void** ctpRes,
- uint8* ctpType) {
- ctpDef[e + 1] = reader.readU4();
- ctpDef[e] = reader.readU4();
- PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] <long>%d %d\n", e,
+uint32 JavaConstantPool::CtpReaderLong(JavaConstantPool* ctp, Reader& reader,
+ uint32 index) {
+ ctp->ctpDef[index + 1] = reader.readU4();
+ ctp->ctpDef[index] = reader.readU4();
+ PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] <long>%d %d\n", index,
ctpDef[e], ctpDef[e + 1]);
return 2;
}
-uint32 JavaCtpInfo::CtpReaderDouble(Class* cl, uint32 type, uint32 e,
- Reader& reader, sint32* ctpDef,
- void** ctpRes, uint8* ctpType) {
- ctpDef[e + 1] = reader.readU4();
- ctpDef[e] = reader.readU4();
- PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] <double>%d %d\n", e,
- ctpDef[e], ctpDef[e + 1]);
+uint32 JavaConstantPool::CtpReaderDouble(JavaConstantPool* ctp, Reader& reader,
+ uint32 index) {
+ ctp->ctpDef[index + 1] = reader.readU4();
+ ctp->ctpDef[index] = reader.readU4();
+ PRINT_DEBUG(JNJVM_LOAD, 3, COLOR_NORMAL, "; [%5d] <double>%d %d\n", index,
+ ctp->ctpDef[index], ctp->ctpDef[index + 1]);
return 2;
}
-void JavaCtpInfo::read(Class* cl, Reader& reader) {
- uint32 nbCtp = reader.readU2();
- JavaCtpInfo* res = new JavaCtpInfo();
-
- res->ctpRes = (void**)malloc(sizeof(void*)*nbCtp);
- res->ctpDef = (sint32*)malloc(sizeof(sint32)*nbCtp);
- res->ctpType = (uint8*)malloc(sizeof(uint8)*nbCtp);
- memset(res->ctpRes, 0, sizeof(void**)*nbCtp);
- memset(res->ctpDef, 0, sizeof(sint32)*nbCtp);
- memset(res->ctpType, 0, sizeof(uint8)*nbCtp);
-
- res->ctpSize = nbCtp;
- res->classDef = cl;
- cl->ctpInfo = res;
+JavaConstantPool::JavaConstantPool(Class* cl, Reader& reader) {
+ ctpSize = reader.readU2();
+ classDef = cl;
+
+ ctpRes = new void*[ctpSize];
+ ctpDef = new sint32[ctpSize];
+ ctpType = new uint8[ctpSize];
+ memset(ctpRes, 0, sizeof(void**) * ctpSize);
+ memset(ctpDef, 0, sizeof(sint32) * ctpSize);
+ memset(ctpType, 0, sizeof(uint8) * ctpSize);
uint32 cur = 1;
- while (cur < nbCtp) {
+ while (cur < ctpSize) {
uint8 curType = reader.readU1();
- res->ctpType[cur] = curType;
- cur += ((funcsReader[curType])(cl, curType, cur, reader, res->ctpDef,
- res->ctpRes, res->ctpType));
+ ctpType[cur] = curType;
+ cur += ((funcsReader[curType])(this, reader, cur));
}
}
-const UTF8* JavaCtpInfo::UTF8At(uint32 entry) {
+const UTF8* JavaConstantPool::UTF8At(uint32 entry) {
if (! ((entry > 0) && (entry < ctpSize) &&
typeAt(entry) == ConstantUTF8)) {
JavaThread::get()->isolate->classFormatError(
@@ -231,7 +213,7 @@
return (const UTF8*)ctpRes[entry];
}
-float JavaCtpInfo::FloatAt(uint32 entry) {
+float JavaConstantPool::FloatAt(uint32 entry) {
if (! ((entry > 0) && (entry < ctpSize) &&
typeAt(entry) == ConstantFloat)) {
JavaThread::get()->isolate->classFormatError(
@@ -240,7 +222,7 @@
return ((float*)ctpDef)[entry];
}
-sint32 JavaCtpInfo::IntegerAt(uint32 entry) {
+sint32 JavaConstantPool::IntegerAt(uint32 entry) {
if (! ((entry > 0) && (entry < ctpSize) &&
typeAt(entry) == ConstantInteger)) {
JavaThread::get()->isolate->classFormatError(
@@ -249,7 +231,7 @@
return ((sint32*)ctpDef)[entry];
}
-sint64 JavaCtpInfo::LongAt(uint32 entry) {
+sint64 JavaConstantPool::LongAt(uint32 entry) {
if (! ((entry > 0) && (entry < ctpSize) &&
typeAt(entry) == ConstantLong)) {
JavaThread::get()->isolate->classFormatError(
@@ -258,7 +240,7 @@
return Reader::readLong(ctpDef[entry], ctpDef[entry + 1]);
}
-double JavaCtpInfo::DoubleAt(uint32 entry) {
+double JavaConstantPool::DoubleAt(uint32 entry) {
if (! ((entry > 0) && (entry < ctpSize) &&
typeAt(entry) == ConstantDouble)) {
JavaThread::get()->isolate->classFormatError(
@@ -267,7 +249,7 @@
return Reader::readDouble(ctpDef[entry], ctpDef[entry + 1]);
}
-CommonClass* JavaCtpInfo::isLoadedClassOrClassName(uint32 entry) {
+CommonClass* JavaConstantPool::isClassLoaded(uint32 entry) {
if (! ((entry > 0) && (entry < ctpSize) &&
typeAt(entry) == ConstantClass)) {
JavaThread::get()->isolate->classFormatError(
@@ -276,14 +258,14 @@
return (CommonClass*)ctpRes[entry];
}
-const UTF8* JavaCtpInfo::resolveClassName(uint32 index) {
- CommonClass* cl = isLoadedClassOrClassName(index);
+const UTF8* JavaConstantPool::resolveClassName(uint32 index) {
+ CommonClass* cl = isClassLoaded(index);
if (cl) return cl->name;
else return UTF8At(ctpDef[index]);
}
-CommonClass* JavaCtpInfo::loadClass(uint32 index) {
- CommonClass* temp = isLoadedClassOrClassName(index);
+CommonClass* JavaConstantPool::loadClass(uint32 index) {
+ CommonClass* temp = isClassLoaded(index);
if (!temp) {
JnjvmClassLoader* loader = classDef->classLoader;
const UTF8* name = UTF8At(ctpDef[index]);
@@ -293,18 +275,13 @@
// Put into ctpRes because there is only one representation of the class
temp = loader->loadName(name, false, false, false);
}
-#ifdef MULTIPLE_VM
- if (classDef->isSharedClass() && !temp->isSharedClass()) {
- JavaThread::get()->isolate->unknownError("Class sharing violation");
- }
-#endif
ctpRes[index] = temp;
}
return temp;
}
-CommonClass* JavaCtpInfo::getMethodClassIfLoaded(uint32 index) {
- CommonClass* temp = isLoadedClassOrClassName(index);
+CommonClass* JavaConstantPool::getMethodClassIfLoaded(uint32 index) {
+ CommonClass* temp = isClassLoaded(index);
if (!temp) {
JnjvmClassLoader* loader = classDef->classLoader;
const UTF8* name = UTF8At(ctpDef[index]);
@@ -312,23 +289,10 @@
if (!temp)
temp = JnjvmClassLoader::bootstrapLoader->lookupClass(name);
}
-#ifdef MULTIPLE_VM
- if (temp && classDef->isSharedClass() && !temp->isSharedClass()) {
- JavaThread::get()->isolate->unknownError("Class sharing violation");
- }
-#endif
return temp;
}
-void JavaCtpInfo::checkInfoOfClass(uint32 index) {
- if (typeAt(index) != ConstantClass)
- JavaThread::get()->isolate->classFormatError(
- "bad constant pool number for class at entry %d", index);
- /*if (!(ctpRes[index]))
- ctpRes[index] = JavaJIT::newLookupLLVM;*/
-}
-
-Typedef* JavaCtpInfo::resolveNameAndType(uint32 index) {
+Typedef* JavaConstantPool::resolveNameAndType(uint32 index) {
void* res = ctpRes[index];
if (!res) {
if (typeAt(index) != ConstantNameAndType) {
@@ -344,7 +308,7 @@
return (Typedef*)res;
}
-Signdef* JavaCtpInfo::resolveNameAndSign(uint32 index) {
+Signdef* JavaConstantPool::resolveNameAndSign(uint32 index) {
void* res = ctpRes[index];
if (!res) {
if (typeAt(index) != ConstantNameAndType) {
@@ -360,15 +324,15 @@
return (Signdef*)res;
}
-Typedef* JavaCtpInfo::infoOfField(uint32 index) {
+Typedef* JavaConstantPool::infoOfField(uint32 index) {
if (typeAt(index) != ConstantFieldref)
JavaThread::get()->isolate->classFormatError(
"bad constant pool number for field at entry %d", index);
return resolveNameAndType(ctpDef[index] & 0xFFFF);
}
-void JavaCtpInfo::infoOfMethod(uint32 index, uint32 access,
- CommonClass*& cl, JavaMethod*& meth) {
+void JavaConstantPool::infoOfMethod(uint32 index, uint32 access,
+ CommonClass*& cl, JavaMethod*& meth) {
uint8 id = typeAt(index);
if (id != ConstantMethodref && id != ConstantInterfaceMethodref)
JavaThread::get()->isolate->classFormatError(
@@ -386,13 +350,13 @@
}
}
-uint32 JavaCtpInfo::getClassIndexFromMethod(uint32 index) {
+uint32 JavaConstantPool::getClassIndexFromMethod(uint32 index) {
sint32 entry = ctpDef[index];
return (uint32)(entry >> 16);
}
-void JavaCtpInfo::nameOfStaticOrSpecialMethod(uint32 index,
+void JavaConstantPool::nameOfStaticOrSpecialMethod(uint32 index,
const UTF8*& cl,
const UTF8*& name,
Signdef*& sign) {
@@ -408,15 +372,17 @@
cl = resolveClassName(entry >> 16);
}
-void* JavaCtpInfo::infoOfStaticOrSpecialMethod(uint32 index,
- uint32 access,
- Signdef*& sign,
- JavaMethod*& meth) {
+void* JavaConstantPool::infoOfStaticOrSpecialMethod(uint32 index,
+ uint32 access,
+ Signdef*& sign,
+ JavaMethod*& meth) {
uint8 id = typeAt(index);
if (id != ConstantMethodref && id != ConstantInterfaceMethodref)
JavaThread::get()->isolate->classFormatError(
"bad constant pool number for method at entry %d", index);
+ if (ctpRes[index]) return ctpRes[index];
+
sign = resolveNameAndSign(ctpDef[index] & 0xFFFF);
sint32 entry = ctpDef[index];
sint32 ntIndex = entry & 0xFFFF;
@@ -436,20 +402,16 @@
}
// Must be a callback
- if (ctpRes[index]) {
- return ctpRes[index];
- } else {
- void* val =
- classDef->classLoader->TheModuleProvider->addCallback(classDef, index, sign,
- isStatic(access));
+ void* val =
+ classDef->classLoader->TheModuleProvider->addCallback(classDef, index, sign,
+ isStatic(access));
- ctpRes[index] = val;
- return val;
- }
+ ctpRes[index] = val;
+ return val;
}
-Signdef* JavaCtpInfo::infoOfInterfaceOrVirtualMethod(uint32 index) {
+Signdef* JavaConstantPool::infoOfInterfaceOrVirtualMethod(uint32 index) {
uint8 id = typeAt(index);
if (id != ConstantMethodref && id != ConstantInterfaceMethodref)
@@ -461,28 +423,29 @@
return sign;
}
-void JavaCtpInfo::resolveInterfaceOrMethod(uint32 index,
- CommonClass*& cl, const UTF8*& utf8,
- Signdef*& sign) {
+void JavaConstantPool::resolveMethod(uint32 index, CommonClass*& cl,
+ const UTF8*& utf8, Signdef*& sign) {
sint32 entry = ctpDef[index];
sint32 ntIndex = entry & 0xFFFF;
sign = (Signdef*)ctpRes[ntIndex];
+ assert(sign && "No cached signature after JITting");
utf8 = UTF8At(ctpDef[ntIndex] >> 16);
cl = loadClass(entry >> 16);
cl->resolveClass(true);
}
-void JavaCtpInfo::resolveField(uint32 index, CommonClass*& cl,
- const UTF8*& utf8, Typedef*& sign) {
+void JavaConstantPool::resolveField(uint32 index, CommonClass*& cl,
+ const UTF8*& utf8, Typedef*& sign) {
sint32 entry = ctpDef[index];
sint32 ntIndex = entry & 0xFFFF;
sign = (Typedef*)ctpRes[ntIndex];
+ assert(sign && "No cached Typedef after JITting");
utf8 = UTF8At(ctpDef[ntIndex] >> 16);
cl = loadClass(entry >> 16);
cl->resolveClass(true);
}
-JavaField* JavaCtpInfo::lookupField(uint32 index, bool stat) {
+JavaField* JavaConstantPool::lookupField(uint32 index, bool stat) {
if (!(ctpRes[index])) {
sint32 entry = ctpDef[index];
sint32 ntIndex = entry & 0xFFFF;
@@ -504,12 +467,12 @@
return (JavaField*)ctpRes[index];
}
-JavaString* JavaCtpInfo::resolveString(const UTF8* utf8, uint16 index) {
+JavaString* JavaConstantPool::resolveString(const UTF8* utf8, uint16 index) {
JavaString* str = JavaThread::get()->isolate->UTF8ToStr(utf8);
return str;
}
-ctpReader JavaCtpInfo::funcsReader[16] = {
+JavaConstantPool::ctpReader JavaConstantPool::funcsReader[16] = {
unimplemented,
CtpReaderUTF8,
unimplemented,
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.h?rev=55172&r1=55171&r2=55172&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.h Fri Aug 22 03:27:01 2008
@@ -19,6 +19,7 @@
class Class;
class CommonClass;
class Jnjvm;
+class JavaConstantPool;
class JavaField;
class JavaMethod;
class JavaString;
@@ -27,16 +28,80 @@
class Typedef;
class UTF8;
-typedef uint32 (*ctpReader)(Class*, uint32, uint32, Reader&, sint32*, void**, uint8*);
-class JavaCtpInfo {
+/// JavaConstantPool - This class represents a Java constant pool, a place where
+/// a Java class makes external references such as classes and methods and
+/// stores constants such as integers or UTF8s.
+class JavaConstantPool {
public:
+
+ /// classDef - The owning class of this constant pool.
+ ///
Class* classDef;
- void** ctpRes;
- sint32* ctpDef;
- uint8* ctpType;
+
+ /// ctpSize - The number of entries in the constant pool.
+ ///
uint32 ctpSize;
+
+ /// ctpType - The types of the constant pool entries.
+ ///
+ uint8* ctpType;
+
+ /// ctpDef - The values of the constant pool entries: may be constants or
+ /// references to other entries.
+ ///
+ sint32* ctpDef;
+ /// ctpRes - Objects resolved dynamically, e.g. UTF8s, classes, methods,
+ /// fields, strings.
+ ///
+ void** ctpRes;
+
+ /// CtpReaderClass - Reads a class entry.
+ static uint32 CtpReaderClass(JavaConstantPool* ctp, Reader& reader,
+ uint32 index);
+
+ /// CtpReaderInteger - Reads an integer entry.
+ static uint32 CtpReaderInteger(JavaConstantPool* ctp, Reader& reader,
+ uint32 index);
+
+ /// CtpReaderFloat - Reads a float entry.
+ static uint32 CtpReaderFloat(JavaConstantPool* ctp, Reader& reader,
+ uint32 index);
+
+ /// CtpReaderClass - Reads an UTF8 entry.
+ static uint32 CtpReaderUTF8(JavaConstantPool* ctp, Reader& reader,
+ uint32 index);
+
+ /// CtpReaderNameAndType - Reads a name/signature entry.
+ static uint32 CtpReaderNameAndType(JavaConstantPool* ctp, Reader& reader,
+ uint32 index);
+
+ /// CtpReaderFieldref - Reads a field entry.
+ static uint32 CtpReaderFieldref(JavaConstantPool* ctp, Reader& reader,
+ uint32 index);
+
+ /// CtpReaderString - Reads a string entry.
+ static uint32 CtpReaderString(JavaConstantPool* ctp, Reader& reader,
+ uint32 index);
+
+ /// CtpReaderMethodref - Reads a method entry.
+ static uint32 CtpReaderMethodref(JavaConstantPool* ctp, Reader& reader,
+ uint32 index);
+
+ /// CtpReaderInterfaceMethodref - Reads a method of an interface entry.
+ static uint32 CtpReaderInterfaceMethodref(JavaConstantPool* ctp,
+ Reader& reader,
+ uint32 index);
+
+ /// CtpReaderLong - Reads a long entry.
+ static uint32 CtpReaderLong(JavaConstantPool* ctp, Reader& reader,
+ uint32 index);
+
+ /// CtpReaderClass - Reads a double entry.
+ static uint32 CtpReaderDouble(JavaConstantPool* ctp, Reader& reader,
+ uint32 index);
+
static const uint32 ConstantUTF8;
static const uint32 ConstantInteger;
static const uint32 ConstantFloat;
@@ -48,94 +113,158 @@
static const uint32 ConstantMethodref;
static const uint32 ConstantInterfaceMethodref;
static const uint32 ConstantNameAndType;
-
- static ctpReader funcsReader[16];
- static uint32 CtpReaderClass(Class*, uint32 type, uint32 e, Reader& reader,
- sint32* ctpDef, void** ctpRes, uint8* ctpType);
-
- static uint32 CtpReaderInteger(Class*, uint32 type, uint32 e, Reader& reader,
- sint32* ctpDef, void** ctpRes, uint8* ctpType);
-
- static uint32 CtpReaderFloat(Class*, uint32 type, uint32 e, Reader& reader,
- sint32* ctpDef, void** ctpRes, uint8* ctpType);
-
- static uint32 CtpReaderUTF8(Class*, uint32 type, uint32 e, Reader& reader,
- sint32* ctpDef, void** ctpRes, uint8* ctpType);
-
- static uint32 CtpReaderNameAndType(Class*, uint32 type, uint32 e, Reader& reader,
- sint32* ctpDef, void** ctpRes,
- uint8* ctpType);
-
- static uint32 CtpReaderFieldref(Class*, uint32 type, uint32 e, Reader& reader,
- sint32* ctpDef, void** ctpRes, uint8* ctpType);
-
- static uint32 CtpReaderString(Class*, uint32 type, uint32 e, Reader& reader,
- sint32* ctpDef, void** ctpRes, uint8* ctpType);
-
- static uint32 CtpReaderMethodref(Class*, uint32 type, uint32 e, Reader& reader,
- sint32* ctpDef, void** ctpRes, uint8* ctpType);
-
- static uint32 CtpReaderInterfaceMethodref(Class*, uint32 type, uint32 e,
- Reader& reader, sint32* ctpDef,
- void** ctpRes, uint8* ctpType);
-
- static uint32 CtpReaderLong(Class*, uint32 type, uint32 e, Reader& reader,
- sint32* ctpDef, void** ctpRes, uint8* ctpType);
-
- static uint32 CtpReaderDouble(Class*, uint32 type, uint32 e, Reader& reader,
- sint32* ctpDef, void** ctpRes, uint8* ctpType);
+ typedef uint32 (*ctpReader)(JavaConstantPool*, Reader&, uint32);
- static void read(Class* cl, Reader& reader);
+ /// funcsReader - Array of CtpReader* functions.
+ ///
+ static ctpReader funcsReader[16];
+ /// isAStaticCall - Is the name/type at the given entry a reference to a
+ /// static method?
bool isAStaticCall(uint32 index) {
return (ctpType[index] & 0x80) != 0;
}
-
+
+ /// markAsStaticCall - Set the name/type entry as a reference to a static
+ /// method.
void markAsStaticCall(uint32 index) {
ctpType[index] |= 0x80;
}
+ /// typeAt - Get the constant pool type of the given entry.
+ ///
uint8 typeAt(uint32 index) {
return ctpType[index] & 0x7F;
}
-
+
+ /// UTF8At - Get the UTF8 at the given entry.
+ ///
const UTF8* UTF8At(uint32 entry);
+
+ /// FloatAt - Get the float at the given entry.
+ ///
float FloatAt(uint32 entry);
+
+ /// IntegerAt - Get the int at the given entry.
+ ///
sint32 IntegerAt(uint32 entry);
+
+ /// LongAt - Get the long at the given entry.
+ ///
sint64 LongAt(uint32 entry);
+
+ /// DoubleAt - Get the double at the given entry.
+ ///
double DoubleAt(uint32 entry);
- CommonClass* isLoadedClassOrClassName(uint32 index);
+ /// isClassLoaded - Is the class at the given entry already loaded?
+ ///
+ CommonClass* isClassLoaded(uint32 index);
+
+ /// resolveClassName - Get the name of the class referenced and returns
+ /// it.
+ ///
const UTF8* resolveClassName(uint32 index);
- CommonClass* loadClass(uint32 index);
- void checkInfoOfClass(uint32 index);
+
+ /// resolveNameAndType - Resolve the name/type at the given index,
+ /// and returns the type.
Typedef* resolveNameAndType(uint32 index);
+
+ /// resolveNameAndSign - Resolve the name/sign at the given index,
+ /// and returns the signature.
Signdef* resolveNameAndSign(uint32 index);
- Typedef* infoOfField(uint32 index);
+
+ /// infoOfInterfaceOrVirtualMethod - Get the signature of the method
+ /// referenced at the given entry.
Signdef* infoOfInterfaceOrVirtualMethod(uint32 index);
+
+ /// infoOfStaticOrSpecialMethod - Get the JIT representation of a
+ /// non-virtual method. Also returns its signature and the Jnjvm
+ /// representation.
+ ///
void* infoOfStaticOrSpecialMethod(uint32 index,
uint32 access,
Signdef*& sign,
JavaMethod*& meth);
-
+
+ /// nameOfStaticOrSpecialMethod - Get the name and the signature
+ /// of a non-virtual method.
+ ///
void nameOfStaticOrSpecialMethod(uint32 index, const UTF8*& cl,
const UTF8*& name, Signdef*& sign);
+ /// getClassIndexFromMethod - Get the entry of the class that owns
+ /// the referenced method.
+ ///
uint32 getClassIndexFromMethod(uint32 index);
+ /// getMethodClassIfLoaded - Returns the class of the given method if
+ /// loaded, null if not.
CommonClass* getMethodClassIfLoaded(uint32 index);
- void resolveInterfaceOrMethod(uint32 index, CommonClass*& cl,
- const UTF8*& utf8, Signdef*& sign);
+
+ /// infoOfField - Get the Typedef representation of the field referenced
+ /// at the given entry. This does not involve any class loading.
+ ///
+ Typedef* infoOfField(uint32 index);
+
+ /// infoOfMethod - Get the signature of the method referenced at the given
+ /// entry and try to find the method. This does not involve any class
+ /// loading.
+ ///
void infoOfMethod(uint32 index, uint32 access, CommonClass*& cl,
JavaMethod*& meth);
- void resolveField(uint32 index, CommonClass*& cl, const UTF8*& utf8,
- Typedef*& sign);
+
+ /// lookupField - Lookup the field at the given entry.
+ ///
+ JavaField* lookupField(uint32 index, bool stat);
+ /// resolveString - Get the string referenced at the given
+ /// index from the UTF8.
JavaString* resolveString(const UTF8* utf8, uint16 index);
- JavaField* lookupField(uint32 index, bool stat);
+ /// resolveMethod - Resolve the class and the signature of the method. May
+ /// perform class loading. This function is called just in time, ie when
+ /// the method call is actually made and not yet resolved.
+ ///
+ void resolveMethod(uint32 index, CommonClass*& cl,
+ const UTF8*& utf8, Signdef*& sign);
+
+ /// resolveField - Resolve the class and signature of the field. May
+ /// perform class loading. This function is called just in time, ie when
+ /// the field is accessed and not yet resolved.
+ ///
+ void resolveField(uint32 index, CommonClass*& cl, const UTF8*& utf8,
+ Typedef*& sign);
+
+ /// loadClass - Loads the class and returns it. This is called just in time,
+ /// ie when the class will be used and not yet resolved, and also for
+ /// two special instructions when JIIting: exception comparisons, and
+ /// MULTIANEWARRAY. This function is also called by the classpath for
+ /// loading exception classes referenced by a method.
+ ///
+ CommonClass* loadClass(uint32 index);
+ /// JavaConstantPool - Default constructor.
+ ///
+ JavaConstantPool() {
+ ctpRes = 0;
+ ctpType = 0;
+ ctpDef = 0;
+ }
+
+ /// JavaConstantPool - Reads the bytecode of the class to get
+ /// the initial types and constants definitions.
+ ///
+ JavaConstantPool(Class*, Reader& reader);
+
+ /// ~JavaConstantPool - Delete the constant pool.
+ ///
+ ~JavaConstantPool() {
+ delete ctpRes;
+ delete ctpDef;
+ delete ctpType;
+ }
};
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=55172&r1=55171&r2=55172&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Fri Aug 22 03:27:01 2008
@@ -52,7 +52,7 @@
void JavaJIT::invokeVirtual(uint16 index) {
- JavaCtpInfo* ctpInfo = compilingClass->ctpInfo;
+ JavaConstantPool* ctpInfo = compilingClass->ctpInfo;
CommonClass* cl = 0;
JavaMethod* meth = 0;
ctpInfo->infoOfMethod(index, ACC_VIRTUAL, cl, meth);
@@ -849,7 +849,7 @@
std::vector<Exception*> exceptions;
unsigned sync = isSynchro(compilingMethod->access) ? 1 : 0;
nbe += sync;
- JavaCtpInfo* ctpInfo = compilingClass->ctpInfo;
+ JavaConstantPool* ctpInfo = compilingClass->ctpInfo;
if (nbe) {
supplLocal = new AllocaInst(JnjvmModule::JavaObjectType, "exceptionVar",
currentBlock);
@@ -1084,10 +1084,10 @@
}
void JavaJIT::_ldc(uint16 index) {
- JavaCtpInfo* ctpInfo = compilingClass->ctpInfo;
+ JavaConstantPool* ctpInfo = compilingClass->ctpInfo;
uint8 type = ctpInfo->typeAt(index);
- if (type == JavaCtpInfo::ConstantString) {
+ if (type == JavaConstantPool::ConstantString) {
Value* toPush = 0;
if (ctpInfo->ctpRes[index] == 0) {
compilingClass->acquire();
@@ -1136,19 +1136,19 @@
#else
push(toPush, AssessorDesc::dRef);
#endif
- } else if (type == JavaCtpInfo::ConstantLong) {
+ } else if (type == JavaConstantPool::ConstantLong) {
push(ConstantInt::get(Type::Int64Ty, ctpInfo->LongAt(index)),
AssessorDesc::dLong);
- } else if (type == JavaCtpInfo::ConstantDouble) {
+ } else if (type == JavaConstantPool::ConstantDouble) {
push(ConstantFP::get(Type::DoubleTy, ctpInfo->DoubleAt(index)),
AssessorDesc::dDouble);
- } else if (type == JavaCtpInfo::ConstantInteger) {
+ } else if (type == JavaConstantPool::ConstantInteger) {
push(ConstantInt::get(Type::Int32Ty, ctpInfo->IntegerAt(index)),
AssessorDesc::dInt);
- } else if (type == JavaCtpInfo::ConstantFloat) {
+ } else if (type == JavaConstantPool::ConstantFloat) {
push(ConstantFP::get(Type::FloatTy, ctpInfo->FloatAt(index)),
AssessorDesc::dFloat);
- } else if (type == JavaCtpInfo::ConstantClass) {
+ } else if (type == JavaConstantPool::ConstantClass) {
if (ctpInfo->ctpRes[index]) {
CommonClass* cl = (CommonClass*)(ctpInfo->ctpRes[index]);
LLVMCommonClassInfo* LCI = module->getClassInfo(cl);
@@ -1486,7 +1486,7 @@
}
void JavaJIT::invokeSpecial(uint16 index) {
- JavaCtpInfo* ctpInfo = compilingClass->ctpInfo;
+ JavaConstantPool* ctpInfo = compilingClass->ctpInfo;
JavaMethod* meth = 0;
Signdef* signature = 0;
const UTF8* name = 0;
@@ -1531,7 +1531,7 @@
}
void JavaJIT::invokeStatic(uint16 index) {
- JavaCtpInfo* ctpInfo = compilingClass->ctpInfo;
+ JavaConstantPool* ctpInfo = compilingClass->ctpInfo;
JavaMethod* meth = 0;
Signdef* signature = 0;
const UTF8* name = 0;
@@ -1641,8 +1641,7 @@
}
void JavaJIT::invokeNew(uint16 index) {
- JavaCtpInfo* ctpInfo = compilingClass->ctpInfo;
- ctpInfo->checkInfoOfClass(index);
+ JavaConstantPool* ctpInfo = compilingClass->ctpInfo;
Class* cl = (Class*)(ctpInfo->getMethodClassIfLoaded(index));
Value* Size = 0;
@@ -1710,7 +1709,7 @@
Value* JavaJIT::ldResolved(uint16 index, bool stat, Value* object,
const Type* fieldType, const Type* fieldTypePtr) {
- JavaCtpInfo* info = compilingClass->ctpInfo;
+ JavaConstantPool* info = compilingClass->ctpInfo;
JavaField* field = info->lookupField(index, stat);
if (field && field->classDef->isResolved()
@@ -1962,7 +1961,7 @@
void JavaJIT::invokeInterfaceOrVirtual(uint16 index) {
// Do the usual
- JavaCtpInfo* ctpInfo = compilingClass->ctpInfo;
+ JavaConstantPool* ctpInfo = compilingClass->ctpInfo;
Signdef* signature = ctpInfo->infoOfInterfaceOrVirtualMethod(index);
LLVMSignatureInfo* LSI = module->getSignatureInfo(signature);
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp?rev=55172&r1=55171&r2=55172&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Fri Aug 22 03:27:01 2008
@@ -37,14 +37,14 @@
extern "C" void* jnjvmVirtualLookup(CacheNode* cache, JavaObject *obj) {
Enveloppe* enveloppe = cache->enveloppe;
- JavaCtpInfo* ctpInfo = enveloppe->ctpInfo;
+ JavaConstantPool* ctpInfo = enveloppe->ctpInfo;
CommonClass* ocl = obj->classOf;
CommonClass* cl = 0;
const UTF8* utf8 = 0;
Signdef* sign = 0;
uint32 index = enveloppe->index;
- ctpInfo->resolveInterfaceOrMethod(index, cl, utf8, sign);
+ ctpInfo->resolveMethod(index, cl, utf8, sign);
enveloppe->cacheLock->lock();
CacheNode* rcache = 0;
@@ -88,7 +88,7 @@
extern "C" void* fieldLookup(JavaObject* obj, Class* caller, uint32 index,
uint32 stat, void** ifStatic, uint32* offset) {
- JavaCtpInfo* ctpInfo = caller->ctpInfo;
+ JavaConstantPool* ctpInfo = caller->ctpInfo;
if (ctpInfo->ctpRes[index]) {
JavaField* field = (JavaField*)(ctpInfo->ctpRes[index]);
field->classDef->initialiseClass();
@@ -198,7 +198,7 @@
extern "C" Class* newLookup(Class* caller, uint32 index, Class** toAlloc,
uint32 clinit) {
- JavaCtpInfo* ctpInfo = caller->ctpInfo;
+ JavaConstantPool* ctpInfo = caller->ctpInfo;
Class* cl = (Class*)ctpInfo->loadClass(index);
cl->resolveClass(clinit);
@@ -213,7 +213,7 @@
const UTF8* utf8 = 0;
Signdef* sign = 0;
- caller->ctpInfo->resolveInterfaceOrMethod(index, cl, utf8, sign);
+ caller->ctpInfo->resolveMethod(index, cl, utf8, sign);
JavaMethod* dmeth = cl->lookupMethodDontThrow(utf8, sign->keyName, false,
true);
if (!dmeth) {
Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp?rev=55172&r1=55171&r2=55172&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp Fri Aug 22 03:27:01 2008
@@ -100,7 +100,7 @@
}
void JnjvmClassLoader::readParents(Class* cl, Reader& reader) {
- JavaCtpInfo* ctpInfo = cl->ctpInfo;
+ JavaConstantPool* ctpInfo = cl->ctpInfo;
unsigned short int superEntry = reader.readU2();
const UTF8* super = superEntry ?
ctpInfo->resolveClassName(superEntry) : 0;
@@ -137,7 +137,7 @@
void JnjvmClassLoader::readAttributs(Class* cl, Reader& reader,
std::vector<Attribut*>& attr) {
- JavaCtpInfo* ctpInfo = cl->ctpInfo;
+ JavaConstantPool* ctpInfo = cl->ctpInfo;
unsigned short int nba = reader.readU2();
for (int i = 0; i < nba; i++) {
@@ -151,7 +151,7 @@
void JnjvmClassLoader::readFields(Class* cl, Reader& reader) {
uint16 nbFields = reader.readU2();
- JavaCtpInfo* ctpInfo = cl->ctpInfo;
+ JavaConstantPool* ctpInfo = cl->ctpInfo;
uint32 sindex = 0;
uint32 vindex = 0;
for (int i = 0; i < nbFields; i++) {
@@ -168,7 +168,7 @@
void JnjvmClassLoader::readMethods(Class* cl, Reader& reader) {
uint16 nbMethods = reader.readU2();
- JavaCtpInfo* ctpInfo = cl->ctpInfo;
+ JavaConstantPool* ctpInfo = cl->ctpInfo;
for (int i = 0; i < nbMethods; i++) {
uint16 access = reader.readU2();
const UTF8* name = ctpInfo->UTF8At(reader.readU2());
@@ -192,12 +192,11 @@
}
cl->minor = reader.readU2();
cl->major = reader.readU2();
- JavaCtpInfo::read(cl, reader);
- JavaCtpInfo* ctpInfo = cl->ctpInfo;
+ cl->ctpInfo = new JavaConstantPool(cl, reader);
cl->access = reader.readU2();
const UTF8* thisClassName =
- ctpInfo->resolveClassName(reader.readU2());
+ cl->ctpInfo->resolveClassName(reader.readU2());
if (!(thisClassName->equals(cl->name))) {
JavaThread::get()->isolate->classFormatError("try to load %s and found class named %s",
Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp?rev=55172&r1=55171&r2=55172&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp Fri Aug 22 03:27:01 2008
@@ -26,7 +26,7 @@
using namespace jnjvm;
JavaMethod* JnjvmModuleProvider::staticLookup(Class* caller, uint32 index) {
- JavaCtpInfo* ctpInfo = caller->ctpInfo;
+ JavaConstantPool* ctpInfo = caller->ctpInfo;
bool isStatic = ctpInfo->isAStaticCall(index);
@@ -35,7 +35,7 @@
const UTF8* utf8 = 0;
Signdef* sign = 0;
- ctpInfo->resolveInterfaceOrMethod(index, cl, utf8, sign);
+ ctpInfo->resolveMethod(index, cl, utf8, sign);
JavaMethod* meth = cl->lookupMethod(utf8, sign->keyName, isStatic, true);
Modified: vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp?rev=55172&r1=55171&r2=55172&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/NativeUtil.cpp Fri Aug 22 03:27:01 2008
@@ -403,7 +403,7 @@
&(JavaThread::get()->isolate->allocator));
} else {
Class* cl = meth->classDef;
- JavaCtpInfo* ctp = cl->ctpInfo;
+ JavaConstantPool* ctp = cl->ctpInfo;
Reader reader(exceptionAtt, cl->bytes);
uint16 nbe = reader.readU2();
ArrayObject* res = ArrayObject::acons(nbe, Classpath::classArrayClass,
More information about the vmkit-commits
mailing list