[vmkit-commits] [vmkit] r55470 - in /vmkit/branches/isolate/lib/JnJVM: Isolate/IsolateCommonClass.h LLVMRuntime/runtime-default.ll LLVMRuntime/runtime-isolate.ll VMCore/JavaCache.h VMCore/JavaConstantPool.h VMCore/JavaJIT.cpp VMCore/JavaJITOpcodes.cpp VMCore/JavaMetaJIT.cpp VMCore/JavaRuntimeJIT.cpp VMCore/JavaUpcalls.h VMCore/Jni.cpp VMCore/JnjvmClassLoader.cpp VMCore/JnjvmModule.cpp VMCore/JnjvmModule.h VMCore/JnjvmModuleProvider.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Thu Aug 28 06:29:58 PDT 2008


Author: geoffray
Date: Thu Aug 28 08:29:55 2008
New Revision: 55470

URL: http://llvm.org/viewvc/llvm-project?rev=55470&view=rev
Log:
Make things compile on a multi environment.


Modified:
    vmkit/branches/isolate/lib/JnJVM/Isolate/IsolateCommonClass.h
    vmkit/branches/isolate/lib/JnJVM/LLVMRuntime/runtime-default.ll
    vmkit/branches/isolate/lib/JnJVM/LLVMRuntime/runtime-isolate.ll
    vmkit/branches/isolate/lib/JnJVM/VMCore/JavaCache.h
    vmkit/branches/isolate/lib/JnJVM/VMCore/JavaConstantPool.h
    vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp
    vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJITOpcodes.cpp
    vmkit/branches/isolate/lib/JnJVM/VMCore/JavaMetaJIT.cpp
    vmkit/branches/isolate/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
    vmkit/branches/isolate/lib/JnJVM/VMCore/JavaUpcalls.h
    vmkit/branches/isolate/lib/JnJVM/VMCore/Jni.cpp
    vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
    vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.cpp
    vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.h
    vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp

Modified: vmkit/branches/isolate/lib/JnJVM/Isolate/IsolateCommonClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/Isolate/IsolateCommonClass.h?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/Isolate/IsolateCommonClass.h (original)
+++ vmkit/branches/isolate/lib/JnJVM/Isolate/IsolateCommonClass.h Thu Aug 28 08:29:55 2008
@@ -28,6 +28,7 @@
 class JnjvmClassLoader;
 class UserClass;
 class UserClassArray;
+class UserConstantPool;
 class UTF8;
 
 class UserCommonClass : public mvm::Object {
@@ -92,6 +93,10 @@
   ///
   JavaField* constructField(const UTF8* name, const UTF8* type,
                             uint32 access);
+
+  UserConstantPool* getCtpCache();
+
+  UserClass* lookupClassFromMethod(JavaMethod* meth);
 };
 
 class UserClass : public UserCommonClass {
@@ -109,7 +114,7 @@
   UserClass* getOuterClass();
   void resolveInnerOuterClasses();
   JavaObject* getStaticInstance();
-  JavaConstantPool* getConstantPool();
+  UserConstantPool* getConstantPool();
 
   void setStaticSize(uint64 size);
   void setStaticVT(VirtualTable* VT);
@@ -140,6 +145,35 @@
 };
 
 class UserConstantPool {
+public:
+  
+  /// ctpRes - Objects resolved dynamically, e.g. UTF8s, classes, methods,
+  /// fields, strings.
+  ///
+  void**  ctpRes; 
+  
+  /// 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, UserCommonClass*& 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, UserCommonClass*& cl, const UTF8*& utf8,
+                    Typedef*& sign);
+
+  /// UTF8At - Get the UTF8 referenced from this string entry.
+  ///
+  const UTF8* UTF8AtForString(uint32 entry);
+
+  /// loadClass - Loads the class and returns it. This is called just in time, 
+  /// ie when the class will be used and not yet resolved.
+  ///
+  UserCommonClass* loadClass(uint32 index);
 };
 
 } // end namespace jnjvm

Modified: vmkit/branches/isolate/lib/JnJVM/LLVMRuntime/runtime-default.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/LLVMRuntime/runtime-default.ll?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/LLVMRuntime/runtime-default.ll (original)
+++ vmkit/branches/isolate/lib/JnJVM/LLVMRuntime/runtime-default.ll Thu Aug 28 08:29:55 2008
@@ -37,7 +37,6 @@
 ;;; to lookup in the constant pool.
 %Enveloppe = type { %CacheNode*, i8*, i8*, i32 }
 
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;; Constant calls for Jnjvm runtime internal objects field accesses ;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Modified: vmkit/branches/isolate/lib/JnJVM/LLVMRuntime/runtime-isolate.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/LLVMRuntime/runtime-isolate.ll?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/LLVMRuntime/runtime-isolate.ll (original)
+++ vmkit/branches/isolate/lib/JnJVM/LLVMRuntime/runtime-isolate.ll Thu Aug 28 08:29:55 2008
@@ -2,9 +2,28 @@
 ;;;;;;;;;;;;;;;;;;;;;;;; Isolate specific methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+%Jnjvm = type {%VT, %JavaClass*, [9 x %JavaClass*]}
 
-;;; getStaticInstance - Get the static instance of a class.
-declare %JavaObject* @getStaticInstance(%JavaClass*, i8*) readnone 
 
-;;; runtimeUTF8ToStr - Convert the UTF8 in a string.
-declare i8* @stringLookup(%JavaClass*, i32)
+;;; enveloppeLookup - Find the enveloppe for the current user class.
+declare i8* @enveloppeLookup(%JavaClass*, i32, ...)
+
+;;; stringLookup - Find the isolate-specific string at the given offset in the
+;;; constant pool.
+declare i8* @stringLookup(%JavaClass*, i32, ...)
+
+;;; getCtpCacheNode - Get the constant pool cache of a cache node. This is a
+;;; constant call because the cache node never changes.
+declare i8** @getCtpCacheNode(%CacheNode*) readnone
+
+;;; getCtpCacheNode - Get the constant pool cache of a cache node. This is a
+;;; constant call because the cache node never changes.
+declare i8** @getCtpClass(%JavaClass*) readnone
+
+;;; getJnjvmExceptionClass - Get the exception user class for the given
+;;; isolate.
+declare %JavaClass* @getJnjvmExceptionClass(%Jnjvm*) readnone
+
+;;; getJnjvmArrayClass - Get the array user class of the index, for the given
+;;; isolate.
+declare %JavaClass* @getJnjvmArrayClass(%Jnjvm*, i32) readnone

Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaCache.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaCache.h?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaCache.h (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaCache.h Thu Aug 28 08:29:55 2008
@@ -32,6 +32,8 @@
 namespace jnjvm {
 
 class Enveloppe;
+class UserClass;
+class UserConstantPool;
 
 /// CacheNode - A {class, method pointer} pair.
 class CacheNode {

Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaConstantPool.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaConstantPool.h?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaConstantPool.h (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaConstantPool.h Thu Aug 28 08:29:55 2008
@@ -143,6 +143,12 @@
   /// UTF8At - Get the UTF8 at the given entry.
   ///
   const UTF8* UTF8At(uint32 entry);
+  
+  /// UTF8At - Get the UTF8 referenced from this string entry.
+  ///
+  const UTF8* UTF8AtForString(uint32 entry) {
+    return UTF8At(ctpDef[entry]);
+  }
 
   /// FloatAt - Get the float at the given entry.
   ///

Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp Thu Aug 28 08:29:55 2008
@@ -831,7 +831,6 @@
   std::vector<Exception*> exceptions;  
   unsigned sync = isSynchro(compilingMethod->access) ? 1 : 0;
   nbe += sync;
-  JavaConstantPool* ctpInfo = compilingClass->ctpInfo;
   if (nbe) {
     supplLocal = new AllocaInst(JnjvmModule::JavaObjectType, "exceptionVar",
                                 currentBlock);
@@ -902,7 +901,7 @@
       JavaObject* exc = 0;
       UserClass* cl = 0; 
       try {
-        cl = (UserClass*)(ctpInfo->loadClass(ex->catche));
+        cl = (UserClass*)(compilingClass->ctpInfo->loadClass(ex->catche));
       } catch(...) {
         compilingClass->release();
         exc = JavaThread::getJavaException();
@@ -1013,8 +1012,9 @@
 #ifdef MULTIPLE_VM
     // We're dealing with exceptions, don't catch the exception if the class can
     // not be found.
-    if (catche) cl = getResolvedClass(cur->catche, false, false);
-    else cl = getJnjvmExceptionClass();
+    if (cur->catche) cl = getResolvedClass(cur->catche, false, false);
+    else cl = CallInst::Create(JnjvmModule::GetJnjvmExceptionClassFunction,
+                               isolateLocal, "", currentBlock);
 #else
     assert(cur->catchClass);
     LLVMClassInfo* LCI = (LLVMClassInfo*)module->getClassInfo(cur->catchClass);
@@ -1083,7 +1083,7 @@
     // Lookup the constant pool cache
     Value* val = getConstantPoolAt(index, JnjvmModule::StringLookupFunction,
                                    JnjvmModule::JavaObjectType, 0, true);
-    push(node, AssessorDesc::dRef);  
+    push(val, AssessorDesc::dRef);  
 #else
     const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[index]);
     JavaString* str = JavaThread::get()->isolate->UTF8ToStr(utf8);
@@ -1111,8 +1111,8 @@
       push(LCI->getDelegatee(this), AssessorDesc::dRef);
     } else {
       Value* val = getResolvedClass(index, false);
-      Value* res = CallInst::Create(JnjvmModule::GetClassDelegateeFunction, val, "",
-                                    currentBlock);
+      Value* res = CallInst::Create(JnjvmModule::GetClassDelegateeFunction,
+                                    val, "", currentBlock);
       push(res, AssessorDesc::dRef);
     }
   } else {
@@ -1468,7 +1468,7 @@
     uint32 clIndex = ctpInfo->getClassIndexFromMethod(index);
     Value* cl = getResolvedClass(clIndex, false);
 
-    Value* newCtpCache = CallInst::Create(JnjvmModule::GetCtpCacheFunction, cl,
+    Value* newCtpCache = CallInst::Create(JnjvmModule::GetCtpClassFunction, cl,
                                         "", currentBlock);
     args.push_back(newCtpCache);
 #endif
@@ -1524,7 +1524,7 @@
     uint32 clIndex = ctpInfo->getClassIndexFromMethod(index);
     Value* cl = getResolvedClass(clIndex, true);
 
-    Value* newCtpCache = CallInst::Create(JnjvmModule::GetCtpCacheFunction, cl,
+    Value* newCtpCache = CallInst::Create(JnjvmModule::GetCtpClassFunction, cl,
                                         "", currentBlock);
     args.push_back(newCtpCache);
 #endif
@@ -1557,7 +1557,7 @@
 #ifdef MULTIPLE_VM
   Value* CTP = ctpCache;
   Value* Cl = new LoadInst(ctpCache, "", currentBlock);
-  Cl = new BitCastInst(v, JnjvmModule::JavaClassType, "", currentBlock);
+  Cl = new BitCastInst(Cl, JnjvmModule::JavaClassType, "", currentBlock);
 #else
   JavaConstantPool* ctp = compilingClass->ctpInfo;
   LLVMConstantPoolInfo* LCPI = module->getConstantPoolInfo(ctp);
@@ -1605,9 +1605,7 @@
   Value* arg1 = GetElementPtrInst::Create(CTP, indexes.begin(),
                                           indexes.end(), 
                                           "", currentBlock);
-  // We set as volatile because "readnone" calls may alter
-  // the constant pool cache.
-  arg1 = new LoadInst(arg1, "", true, currentBlock);
+  arg1 = new LoadInst(arg1, "", false, currentBlock);
   Value* test = new ICmpInst(ICmpInst::ICMP_EQ, arg1, mvm::jit::constantPtrNull,
                              "", currentBlock);
  
@@ -1679,10 +1677,10 @@
     VT = CallInst::Create(JnjvmModule::GetVTFromClassFunction, Cl, "",
                           currentBlock);
   } else {
-#ifndef MULTIPLE_VM
     LLVMClassInfo* LCI = (LLVMClassInfo*)module->getClassInfo(cl);
     Size = LCI->getVirtualSize(this);
     VT = LCI->getVirtualTable(this);
+#ifndef MULTIPLE_VM
     Cl = LCI->getVar(this);
     if (!cl->isReady()) {
       Cl = invoke(JnjvmModule::InitialisationCheckFunction, Cl, "", currentBlock);
@@ -1691,9 +1689,6 @@
     }
 #else
     Cl = getResolvedClass(index, true);
-    Size = LCI->getVirtualSize(this);
-    VT = LCI->getVirtualTable(this);
-    Cl = invoke(JnjvmModule::InitialisationCheckFunction, Cl, "", currentBlock);
     CallInst::Create(JnjvmModule::ForceInitialisationCheckFunction, Cl, "",
                      currentBlock);
 #endif
@@ -1999,8 +1994,9 @@
                               uint64_t (enveloppe)),
                               JnjvmModule::EnveloppeType);
 #else
-  llvmEnv = getConstantPoolAt(index, JnjvmModule::EnveloppeLookupFunction,
-                              JnjvmModule::EnveloppeType, 0, false);
+  Value* llvmEnv = getConstantPoolAt(index,
+                                     JnjvmModule::EnveloppeLookupFunction,
+                                     JnjvmModule::EnveloppeType, 0, false);
 #endif
 
   std::vector<Value*> args1;

Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJITOpcodes.cpp?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJITOpcodes.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJITOpcodes.cpp Thu Aug 28 08:29:55 2008
@@ -1820,7 +1820,9 @@
       case NEWARRAY :
       case ANEWARRAY : {
         
+#ifndef MULTIPLE_VM
         UserClassArray* dcl = 0;
+#endif
         ConstantInt* sizeElement = 0;
         GlobalVariable* TheVT = 0;
         Value* valCl = 0;
@@ -1831,7 +1833,11 @@
 #ifndef MULTIPLE_VM
           dcl = ass->getArrayClass();
 #else
-          valCl = getJnjvmArrayCacheAt(ass->numId);
+          std::vector<Value*> args;
+          args.push_back(isolateLocal);
+          args.push_back(ConstantInt::get(Type::Int32Ty, ass->numId));
+          valCl = CallInst::Create(JnjvmModule::GetJnjvmArrayClassFunction,
+                                   args.begin(), args.end(), "", currentBlock);
 #endif
 
           TheVT = JnjvmModule::JavaObjectVirtualTableGV;

Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaMetaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaMetaJIT.cpp?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaMetaJIT.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaMetaJIT.cpp Thu Aug 28 08:29:55 2008
@@ -107,7 +107,7 @@
 \
 TYPE JavaMethod::invoke##TYPE_NAME##SpecialAP(Jnjvm* vm, UserClass* cl, JavaObject* obj, va_list ap) {\
   if (!cl->isReady()) { \
-    cl->classLoader->loadName(cl->name, true, true); \
+    cl->classLoader->loadName(cl->getName(), true, true); \
     cl->initialiseClass(vm); \
   } \
   \

Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Thu Aug 28 08:29:55 2008
@@ -32,7 +32,7 @@
 
 extern "C" void* jnjvmVirtualLookup(CacheNode* cache, JavaObject *obj) {
   Enveloppe* enveloppe = cache->enveloppe;
-  JavaConstantPool* ctpInfo = enveloppe->ctpInfo;
+  UserConstantPool* ctpInfo = enveloppe->ctpInfo;
   UserCommonClass* ocl = obj->classOf;
   UserCommonClass* cl = 0;
   const UTF8* utf8 = 0;
@@ -85,7 +85,7 @@
 }
 
 extern "C" void* virtualFieldLookup(UserClass* caller, uint32 index) {
-  JavaConstantPool* ctpInfo = caller->getConstantPool();
+  UserConstantPool* ctpInfo = caller->getConstantPool();
   if (ctpInfo->ctpRes[index]) {
     return ctpInfo->ctpRes[index];
   }
@@ -105,7 +105,7 @@
 }
 
 extern "C" void* staticFieldLookup(UserClass* caller, uint32 index) {
-  JavaConstantPool* ctpInfo = caller->getConstantPool();
+  UserConstantPool* ctpInfo = caller->getConstantPool();
   
   if (ctpInfo->ctpRes[index]) {
     return ctpInfo->ctpRes[index];
@@ -130,12 +130,19 @@
 
 #ifdef MULTIPLE_VM
 extern "C" void* stringLookup(UserClass* cl, uint32 index) {
-  JavaConstantPool* ctpInfo = cl->getConstantPool();
-  const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[index]);
+  UserConstantPool* ctpInfo = cl->getConstantPool();
+  const UTF8* utf8 = ctpInfo->UTF8AtForString(index);
   JavaString* str = JavaThread::get()->isolate->UTF8ToStr(utf8);
   ctpInfo->ctpRes[index] = str;
   return (void*)str;
 }
+
+extern "C" void* enveloppeLookup(UserClass* cl, uint32 index) {
+  UserConstantPool* ctpInfo = cl->getConstantPool();
+  Enveloppe* enveloppe = new Enveloppe(ctpInfo, index);
+  ctpInfo->ctpRes[index] = enveloppe;
+  return (void*)enveloppe;
+}
 #endif
 
 #ifndef WITHOUT_VTABLE
@@ -153,8 +160,8 @@
     JavaObject* obj = va_arg(ap, JavaObject*);
     va_end(ap);
     assert(obj->classOf->isReady() && "Class not ready in a virtual lookup.");
-    // Arg, it should have been an invoke interface.... Perform the lookup
-    // on the object class and do not update offset.
+    // Arg, the bytecode is buggy! Perform the lookup on the object class
+    // and do not update offset.
     dmeth = obj->classOf->lookupMethod(utf8, sign->keyName, false, true);
   } else {
     caller->getConstantPool()->ctpRes[index] = (void*)dmeth->offset;
@@ -167,8 +174,12 @@
 #endif
 
 extern "C" void* classLookup(UserClass* caller, uint32 index) { 
-  JavaConstantPool* ctpInfo = caller->getConstantPool();
+  UserConstantPool* ctpInfo = caller->getConstantPool();
   UserClass* cl = (UserClass*)ctpInfo->loadClass(index);
+  // We can not initialize here, because bytecodes such as CHECKCAST
+  // or classes used in catch clauses do not trigger class initialization.
+  // This is really sad, because we need to insert class initialization checks
+  // in the LLVM code.
   return (void*)cl;
 }
 

Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaUpcalls.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaUpcalls.h?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaUpcalls.h (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaUpcalls.h Thu Aug 28 08:29:55 2008
@@ -54,7 +54,7 @@
 
 class Classpath {
 public: 
-  ISOLATE_STATIC Class*      newClassLoader;
+  ISOLATE_STATIC UserClass*  newClassLoader;
   ISOLATE_STATIC JavaMethod* getSystemClassLoader;
   ISOLATE_STATIC JavaMethod* setContextClassLoader;
   ISOLATE_STATIC UserClass* newString;
@@ -132,7 +132,7 @@
   ISOLATE_STATIC JavaField* rootGroup;
   ISOLATE_STATIC JavaField* vmThread;
   ISOLATE_STATIC JavaMethod* uncaughtException;
-  ISOLATE_STATIC Class*      inheritableThreadLocal;
+  ISOLATE_STATIC UserClass*  inheritableThreadLocal;
   
 
   ISOLATE_STATIC UserClass* InvocationTargetException;

Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/Jni.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/Jni.cpp?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/Jni.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/Jni.cpp Thu Aug 28 08:29:55 2008
@@ -1176,7 +1176,7 @@
   Jnjvm* vm = JavaThread::get()->isolate;
   UserClass* cl = 0;
 #ifdef MULTIPLE_VM
-  cl = NativeUtil::resolvedImplClass(clazz, true);
+  cl = (UserClass*)NativeUtil::resolvedImplClass(clazz, true);
 #else
   cl = meth->classDef;
 #endif
@@ -1357,7 +1357,7 @@
   Jnjvm* vm = JavaThread::get()->isolate;
   UserClass* cl = 0;
 #ifdef MULTIPLE_VM
-  cl = NativeUtil::resolvedImplClass(clazz, true);
+  cl = (UserClass*)NativeUtil::resolvedImplClass(clazz, true);
 #else
   cl = meth->classDef;
 #endif
@@ -1377,7 +1377,7 @@
   Jnjvm* vm = JavaThread::get()->isolate;
   UserClass* cl = 0;
 #ifdef MULTIPLE_VM
-  cl = NativeUtil::resolvedImplClass(clazz, true);
+  cl = (UserClass*)NativeUtil::resolvedImplClass(clazz, true);
 #else
   cl = meth->classDef;
 #endif

Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmClassLoader.cpp?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmClassLoader.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmClassLoader.cpp Thu Aug 28 08:29:55 2008
@@ -136,7 +136,7 @@
     Classpath* upcalls = bootstrapLoader->upcalls;
     UserClass* forCtp = 0;
 #ifdef MULTIPLE_VM
-    forCtp = javaLoader->classOf->lookupClassInMethod(upcalls->loadInClassLoader);
+    forCtp = javaLoader->classOf->lookupClassFromMethod(upcalls->loadInClassLoader);
 #else
     forCtp = upcalls->loadInClassLoader->classDef;
 #endif

Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.cpp?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.cpp Thu Aug 28 08:29:55 2008
@@ -46,6 +46,11 @@
 const llvm::Type* JnjvmModule::CacheNodeType = 0;
 const llvm::Type* JnjvmModule::EnveloppeType = 0;
 
+#ifdef MULTIPLE_VM
+const llvm::Type* JnjvmModule::JnjvmType = 0;
+const llvm::Type* JnjvmModule::UserClassType = 0;
+#endif
+
 llvm::Constant*       JnjvmModule::JavaObjectNullConstant;
 llvm::Constant*       JnjvmModule::UTF8NullConstant;
 llvm::Constant*       JnjvmModule::JavaClassNullConstant;
@@ -107,7 +112,11 @@
 
 #ifdef MULTIPLE_VM
 llvm::Function* JnjvmModule::StringLookupFunction = 0;
-llvm::Function* JnjvmModule::GetStaticInstanceFunction = 0;
+llvm::Function* JnjvmModule::GetCtpCacheNodeFunction = 0;
+llvm::Function* JnjvmModule::GetCtpClassFunction = 0;
+llvm::Function* JnjvmModule::EnveloppeLookupFunction = 0;
+llvm::Function* JnjvmModule::GetJnjvmExceptionClassFunction = 0;
+llvm::Function* JnjvmModule::GetJnjvmArrayClassFunction = 0;
 #endif
 llvm::Function* JnjvmModule::GetClassDelegateeFunction = 0;
 llvm::Function* JnjvmModule::ArrayLengthFunction = 0;
@@ -913,6 +922,11 @@
   jnjvm::llvm_runtime::makeLLVMModuleContents(module);
   
   VTType = module->getTypeByName("VT");
+
+#ifdef MULTIPLE_VM
+  UserClassType = module->getTypeByName("UserClass");
+  JnjvmType = module->getTypeByName("Jnjvm");
+#endif
   
   JavaObjectType = 
     PointerType::getUnqual(module->getTypeByName("JavaObject"));
@@ -1008,8 +1022,13 @@
   
 
 #ifdef MULTIPLE_VM
-  GetStaticInstanceFunction = module->getFunction("getStaticInstance");
   StringLookupFunction = module->getFunction("stringLookup");
+  EnveloppeLookupFunction = module->getFunction("enveloppeLookup");
+  GetCtpCacheNodeFunction = module->getFunction("getCtpCacheNode");
+  GetCtpClassFunction = module->getFunction("getCtpClass");
+  GetJnjvmExceptionClassFunction = 
+    module->getFunction("getJnjvmExceptionClass");
+  GetJnjvmArrayClassFunction = module->getFunction("getJnjvmArrayClass");
 #endif
   
 #ifdef SERVICE_VM

Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.h?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.h (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModule.h Thu Aug 28 08:29:55 2008
@@ -304,6 +304,11 @@
   static const llvm::Type* JavaCacheType;
   static const llvm::Type* EnveloppeType;
   static const llvm::Type* CacheNodeType;
+
+#ifdef MULTIPLE_VM
+  static const llvm::Type* JnjvmType;
+  static const llvm::Type* UserClassType;
+#endif
   
 #ifdef WITH_TRACER
   static llvm::Function* MarkAndTraceFunction;
@@ -345,7 +350,11 @@
 
 #ifdef MULTIPLE_VM
   static llvm::Function* StringLookupFunction;
-  static llvm::Function* GetStaticInstanceFunction;
+  static llvm::Function* GetCtpCacheNodeFunction;
+  static llvm::Function* GetCtpClassFunction;
+  static llvm::Function* EnveloppeLookupFunction;
+  static llvm::Function* GetJnjvmExceptionClassFunction;
+  static llvm::Function* GetJnjvmArrayClassFunction;
 #endif
 
   static llvm::Function* GetClassDelegateeFunction;

Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp?rev=55470&r1=55469&r2=55470&view=diff

==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp Thu Aug 28 08:29:55 2008
@@ -37,10 +37,15 @@
 
   ctpInfo->resolveMethod(index, cl, utf8, sign);
   JavaMethod* meth = cl->lookupMethod(utf8, sign->keyName, isStatic, true);
-  
+
+#ifndef MULTIPLE_VM
+  // A multi environment would have already initialized the class. Besides,
+  // a callback does not involve UserClass, therefore we wouldn't know
+  // which class to initialize.
   if (!isVirtual(meth->access))
     cl->initialiseClass(JavaThread::get()->isolate);
-  
+#endif
+
   meth->compiledPtr();
   
   LLVMMethodInfo* LMI = ((JnjvmModule*)TheModule)->getMethodInfo(meth);
@@ -204,9 +209,9 @@
 static void AddStandardCompilePasses(FunctionPassManager *PM) {
     llvm::MutexGuard locked(mvm::jit::executionEngine->lock);
   // LLVM does not allow calling functions from other modules in verifier
-  //PM->add(llvm::createVerifierPass());                  // Verify that input is correct
+  //PM->add(llvm::createVerifierPass());        // Verify that input is correct
   
-  addPass(PM, llvm::createCFGSimplificationPass());    // Clean up disgusting code
+  addPass(PM, llvm::createCFGSimplificationPass()); // Clean up disgusting code
   addPass(PM, llvm::createPromoteMemoryToRegisterPass());// Kill useless allocas
   
   addPass(PM, createInstructionCombiningPass()); // Cleanup for scalarrepl.
@@ -229,8 +234,9 @@
   addPass(PM, createGVNPass());                  // Remove redundancies
   addPass(PM, createSCCPPass());                 // Constant prop with SCCP
   addPass(PM, createCFGSimplificationPass());    // Merge & remove BBs
-  
-  addPass(PM, mvm::createEscapeAnalysisPass(JnjvmModule::JavaObjectAllocateFunction));
+ 
+  Function* func = JnjvmModule::JavaObjectAllocateFunction;
+  addPass(PM, mvm::createEscapeAnalysisPass(func));
   addPass(PM, mvm::createLowerConstantCallsPass());
   
   // Run instcombine after redundancy elimination to exploit opportunities





More information about the vmkit-commits mailing list