[vmkit-commits] [vmkit] r61522 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaClass.cpp JavaClass.h JavaJIT.cpp JavaUpcalls.cpp JnjvmModule.cpp JnjvmModule.h

Nicolas Geoffray nicolas.geoffray at lip6.fr
Wed Dec 31 08:08:18 PST 2008


Author: geoffray
Date: Wed Dec 31 10:08:16 2008
New Revision: 61522

URL: http://llvm.org/viewvc/llvm-project?rev=61522&view=rev
Log:
Also set the name when setting the compiled method pointer.


Modified:
    vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
    vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp?rev=61522&r1=61521&r2=61522&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Wed Dec 31 10:08:16 2008
@@ -379,13 +379,14 @@
   }
 }
 
-void JavaMethod::setCompiledPtr(void* ptr) {
+void JavaMethod::setCompiledPtr(void* ptr, const char* name) {
   classDef->acquire();
   assert(code == 0 && "Code of Java method already set!");
   code = ptr;
   Jnjvm* vm = JavaThread::get()->getJVM();
   vm->addMethodInFunctionMap(this, code);
-  classDef->classLoader->getModule()->setMethod(this, ptr);
+  classDef->classLoader->getModule()->setMethod(this, ptr, name);
+  access |= ACC_NATIVE;
   classDef->release();
 }
 

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h?rev=61522&r1=61521&r2=61522&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h Wed Dec 31 10:08:16 2008
@@ -948,7 +948,7 @@
 
   /// setCompiledPtr - Set the pointer function to the method.
   ///
-  void setCompiledPtr(void*);
+  void setCompiledPtr(void*, const char*);
   
   /// JavaMethod - Delete the method as well as the cache enveloppes and
   /// attributes of the method.

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=61522&r1=61521&r2=61522&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Wed Dec 31 10:08:16 2008
@@ -209,7 +209,7 @@
   
   Function* func = llvmFunction;
   if (jnjvm) {
-    compilingMethod->setCompiledPtr((void*)natPtr);
+    compilingMethod->setCompiledPtr((void*)natPtr, functionName);
     return llvmFunction;
   }
   

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp?rev=61522&r1=61521&r2=61522&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp Wed Dec 31 10:08:16 2008
@@ -469,11 +469,12 @@
   JavaMethod* internString =
     UPCALL_METHOD(loader, "java/lang/VMString", "intern",
                   "(Ljava/lang/String;)Ljava/lang/String;", ACC_STATIC); 
-  internString->setCompiledPtr((void*)(intptr_t)nativeInternString);
+  internString->setCompiledPtr((void*)(intptr_t)nativeInternString,
+                               "nativeInternString");
   
   JavaMethod* isArray =
     UPCALL_METHOD(loader, "java/lang/Class", "isArray", "()Z", ACC_VIRTUAL);
-  isArray->setCompiledPtr((void*)(intptr_t)nativeIsArray);
+  isArray->setCompiledPtr((void*)(intptr_t)nativeIsArray, "nativeIsArray");
 
 
   UPCALL_REFLECT_CLASS_EXCEPTION(loader, InvocationTargetException);
@@ -633,17 +634,20 @@
   JavaMethod* getCallingClass =
     UPCALL_METHOD(loader, "gnu/classpath/VMStackWalker", "getCallingClass",
                   "()Ljava/lang/Class;", ACC_STATIC);
-  getCallingClass->setCompiledPtr((void*)(intptr_t)nativeGetCallingClass);
+  getCallingClass->setCompiledPtr((void*)(intptr_t)nativeGetCallingClass,
+                                  "nativeGetCallingClass");
   
   JavaMethod* getCallingClassLoader =
     UPCALL_METHOD(loader, "gnu/classpath/VMStackWalker", "getCallingClassLoader",
                   "()Ljava/lang/ClassLoader;", ACC_STATIC);
   getCallingClassLoader->setCompiledPtr((void*)(intptr_t)
-                                        nativeGetCallingClassLoader);
+                                        nativeGetCallingClassLoader,
+                                        "nativeGetCallingClassLoader");
   
   JavaMethod* postProperties =
     UPCALL_METHOD(loader, "gnu/classpath/VMSystemProperties", "postInit",
                   "(Ljava/util/Properties;)V", ACC_STATIC);
-  postProperties->setCompiledPtr((void*)(intptr_t)nativePropertiesPostInit);
+  postProperties->setCompiledPtr((void*)(intptr_t)nativePropertiesPostInit,
+                                 "nativePropertiesPostInit");
 }
 

Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp?rev=61522&r1=61521&r2=61522&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp Wed Dec 31 10:08:16 2008
@@ -1353,17 +1353,8 @@
       char* buf = (char*)alloca(3 + JNI_NAME_PRE_LEN + 1 +
                                 ((mnlen + clen + mtlen) << 1));
       
-      if (isNative(methodDef->access)) {
-        bool jnjvm = false;
-        JCL->nativeLookup(methodDef, jnjvm, buf);
-        if (!jnjvm) {
-          methodDef->jniConsFromMethOverloaded(buf + 1);
-          memcpy(buf, "JnJVM", 5);
-        }
-      } else {
-        methodDef->jniConsFromMethOverloaded(buf + 1);
-        memcpy(buf, "JnJVM", 5);
-      }
+      methodDef->jniConsFromMethOverloaded(buf + 1);
+      memcpy(buf, "JnJVM", 5);
 
       methodFunction = Function::Create(getFunctionType(), 
                                         GlobalValue::GhostLinkage, buf, Mod);
@@ -1845,8 +1836,9 @@
   return PrimitiveArrayVT;
 }
 
-void JnjvmModule::setMethod(JavaMethod* meth, void* ptr) {
+void JnjvmModule::setMethod(JavaMethod* meth, void* ptr, const char* name) {
   Function* func = getMethodInfo(meth)->getMethod();
+  func->setName(name);
   assert(ptr && "No value given");
   executionEngine->addGlobalMapping(func, ptr);
   func->setLinkage(GlobalValue::ExternalLinkage);

Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h?rev=61522&r1=61521&r2=61522&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h Wed Dec 31 10:08:16 2008
@@ -368,7 +368,7 @@
 
   static void resolveVirtualClass(Class* cl);
   static void resolveStaticClass(Class* cl);
-  static void setMethod(JavaMethod* meth, void* ptr);
+  static void setMethod(JavaMethod* meth, void* ptr, const char* name);
   static llvm::Function* getMethod(JavaMethod* meth);
 
   static LLVMSignatureInfo* getSignatureInfo(Signdef* sign) {





More information about the vmkit-commits mailing list