[vmkit-commits] [vmkit] r109417 - /vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Mon Jul 26 11:25:18 PDT 2010


Author: geoffray
Date: Mon Jul 26 13:25:17 2010
New Revision: 109417

URL: http://llvm.org/viewvc/llvm-project?rev=109417&view=rev
Log:
Minor bugfixes in the compiler for the GC.


Modified:
    vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp

Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=109417&r1=109416&r2=109417&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Mon Jul 26 13:25:17 2010
@@ -1063,16 +1063,7 @@
     longStack.push_back(new AllocaInst(Type::getInt64Ty(*llvmContext), "", currentBlock));
     floatStack.push_back(new AllocaInst(Type::getFloatTy(*llvmContext), "", currentBlock));
   }
-
-#if JNJVM_EXECUTE > 0
-    {
-    Value* arg = TheCompiler->getMethodInClass(compilingMethod);
-
-    llvm::CallInst::Create(intrinsics->PrintMethodStartFunction, arg, "",
-                           currentBlock);
-    }
-#endif
-  
+ 
   uint32 index = 0;
   uint32 count = 0;
 #if defined(ISOLATE_SHARING)
@@ -1121,6 +1112,16 @@
     }
   }
 
+  // Now that arguments have been setup, we can proceed with runtime calls.
+#if JNJVM_EXECUTE > 0
+    {
+    Value* arg = TheCompiler->getMethodInClass(compilingMethod);
+
+    llvm::CallInst::Create(intrinsics->PrintMethodStartFunction, arg, "",
+                           currentBlock);
+    }
+#endif
+
 #if defined(ISOLATE_SHARING)
   ctpCache = i;
   Value* addrCtpCache = new AllocaInst(intrinsics->ConstantPoolType, "",
@@ -1284,15 +1285,16 @@
   if (returnType == intrinsics->JavaObjectType &&
       TheCompiler->useCooperativeGC()) {
     returnValue = new AllocaInst(intrinsics->JavaObjectType, "",
-                                 func->begin()->getTerminator());
-    Value* GCArgs[2] = { 
-        new BitCastInst(returnValue, intrinsics->ptrPtrType, "",
-                        func->begin()->getTerminator()),
-        intrinsics->constantPtrNull
-    };
+                                 func->begin()->begin());
+    Instruction* cast = 
+        new BitCastInst(returnValue, intrinsics->ptrPtrType, "");
+    cast->insertAfter(returnValue);
+    Value* GCArgs[2] = { cast, intrinsics->constantPtrNull };
         
-    CallInst::Create(intrinsics->llvm_gc_gcroot, GCArgs, GCArgs + 2, "",
-                     func->begin()->getTerminator());
+    Instruction* call =
+      CallInst::Create(intrinsics->llvm_gc_gcroot, GCArgs, GCArgs + 2, "");
+    call->insertAfter(cast);
+
     new StoreInst(endNode, returnValue, currentBlock);
   }
 





More information about the vmkit-commits mailing list