[vmkit-commits] [vmkit] r62161 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaUpcalls.cpp Jnjvm.cpp JnjvmModule.cpp JnjvmModule.h

Nicolas Geoffray nicolas.geoffray at lip6.fr
Tue Jan 13 01:59:20 PST 2009


Author: geoffray
Date: Tue Jan 13 03:59:14 2009
New Revision: 62161

URL: http://llvm.org/viewvc/llvm-project?rev=62161&view=rev
Log:
Remove hackish code for getCallerClass, and set the methods which
call getCallerClass noinline.


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

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp Tue Jan 13 03:59:14 2009
@@ -294,11 +294,7 @@
   BEGIN_NATIVE_EXCEPTION(0)
   JavaThread* th = JavaThread::get();
   Jnjvm* vm = th->getJVM();
-  // Temporary hack because we know llvm inlines a call in the call stack
-  // to this function. And this function is called only in places that
-  // we know.
-  index = vm->bootstrapLoader->nativeHandle ? index - 2 : index - 1;
-  UserClass* cl = th->getCallingClassLevel(index);
+  UserClass* cl = th->getCallingClassLevel(index - 1);
   if (cl) res = cl->getClassDelegatee(vm);
   END_NATIVE_EXCEPTION
 

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Tue Jan 13 03:59:14 2009
@@ -1206,6 +1206,24 @@
   } catch(std::string str) {
     fprintf(stderr, "Error : %s\n", str.c_str());
   }
+  
+#define SET_INLINE(NAME) { \
+  const UTF8* name = vm->asciizToUTF8(NAME); \
+  Class* cl = (Class*)vm->bootstrapLoader->lookupClass(name); \
+  if (cl) vm->bootstrapLoader->getModule()->setNoInline(cl); }
+
+  SET_INLINE("java/util/concurrent/atomic/AtomicReferenceFieldUpdater")
+  SET_INLINE("java/util/concurrent/atomic/AtomicReferenceFieldUpdater"
+             "$AtomicReferenceFieldUpdaterImpl")
+  SET_INLINE("java/util/concurrent/atomic/AtomicIntegerFieldUpdater")
+  SET_INLINE("java/util/concurrent/atomic/AtomicIntegerFieldUpdater"
+             "$AtomicIntegerFieldUpdaterImpl")
+  SET_INLINE("java/util/concurrent/atomic/AtomicLongFieldUpdater")
+  SET_INLINE("java/util/concurrent/atomic/AtomicLongFieldUpdater"
+             "$CASUpdater")
+  SET_INLINE("java/util/concurrent/atomic/AtomicLongFieldUpdater"
+             "$LockedUpdater")
+#undef SET_INLINE
 
   vm->threadSystem.nonDaemonLock.lock();
   --(vm->threadSystem.nonDaemonThreads);

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp Tue Jan 13 03:59:14 2009
@@ -2419,3 +2419,23 @@
 
   ReturnInst::Create(currentBlock);
 }
+
+void JnjvmModule::setNoInline(Class* cl) {
+  for (uint32 i = 0; i < cl->nbVirtualMethods; ++i) {
+    JavaMethod& meth = cl->virtualMethods[i];
+    if (!isAbstract(meth.access)) {
+      LLVMMethodInfo* LMI = getMethodInfo(&meth);
+      Function* func = LMI->getMethod();
+      func->addFnAttr(Attribute::NoInline);
+    }
+  }
+  
+  for (uint32 i = 0; i < cl->nbStaticMethods; ++i) {
+    JavaMethod& meth = cl->staticMethods[i];
+    if (!isAbstract(meth.access)) {
+      LLVMMethodInfo* LMI = getMethodInfo(&meth);
+      Function* func = LMI->getMethod();
+      func->addFnAttr(Attribute::NoInline);
+    }
+  }
+}

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h Tue Jan 13 03:59:14 2009
@@ -434,6 +434,8 @@
   bool isCompiling(const CommonClass* cl) const;
   
   void CreateStaticInitializer();
+  
+  static void setNoInline(Class* cl);
 
 private:
   static llvm::Module* initialModule;





More information about the vmkit-commits mailing list