[vmkit-commits] [vmkit] r83536 - in /vmkit/trunk: include/jnjvm/JnjvmModule.h lib/JnJVM/Compiler/JavaAOTCompiler.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Thu Oct 8 01:58:48 PDT 2009


Author: geoffray
Date: Thu Oct  8 03:58:47 2009
New Revision: 83536

URL: http://llvm.org/viewvc/llvm-project?rev=83536&view=rev
Log:
The AOT compiler should also define loadMethod, so that it thinks that a method
loaded by a .bc file is defined in the VM.


Modified:
    vmkit/trunk/include/jnjvm/JnjvmModule.h
    vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp

Modified: vmkit/trunk/include/jnjvm/JnjvmModule.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/jnjvm/JnjvmModule.h?rev=83536&r1=83535&r2=83536&view=diff

==============================================================================
--- vmkit/trunk/include/jnjvm/JnjvmModule.h (original)
+++ vmkit/trunk/include/jnjvm/JnjvmModule.h Thu Oct  8 03:58:47 2009
@@ -621,6 +621,8 @@
 #endif
   
   virtual ~JavaAOTCompiler() {}
+  
+  virtual void* loadMethod(void* handle, const char* symbol);
 
 private:
 

Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp?rev=83536&r1=83535&r2=83536&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp Thu Oct  8 03:58:47 2009
@@ -1998,3 +1998,18 @@
   ReturnInst::Create(getGlobalContext(), res, currentBlock);
 
 }
+
+
+// Use a FakeFunction to return from loadMethod, so that the compiler thinks
+// the method is defined by J3.
+extern "C" void __JavaAOTFakeFunction__() {}
+
+void* JavaAOTCompiler::loadMethod(void* handle, const char* symbol) {
+  Function* F = mvm::MvmModule::globalModule->getFunction(symbol);
+  if (F) {
+    return (void*)(uintptr_t)__JavaAOTFakeFunction__;
+  }
+
+  return JavaCompiler::loadMethod(handle, symbol);
+}
+





More information about the vmkit-commits mailing list