[vmkit-commits] [vmkit] r85566 - /vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Thu Oct 29 18:55:51 PDT 2009


Author: geoffray
Date: Thu Oct 29 20:55:50 2009
New Revision: 85566

URL: http://llvm.org/viewvc/llvm-project?rev=85566&view=rev
Log:
Put synchronization code before entering and after leaving native code.


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

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp Thu Oct 29 20:55:50 2009
@@ -291,6 +291,10 @@
   // Allocate oldCurrentLocalIndexNumber pointer
   Value* oldCLIN = new AllocaInst(PointerType::getUnqual(Type::getInt32Ty(getGlobalContext())), "",
                                   currentBlock);
+  
+  // Synchronize before saying we're entering native
+  if (isSynchro(compilingMethod->access))
+    beginSynchronize();
 
   Value* test = CallInst::Create(module->setjmpLLVM, newJB, "",
                                  currentBlock);
@@ -306,8 +310,6 @@
   }
 
   currentBlock = executeBlock;
-  if (isSynchro(compilingMethod->access))
-    beginSynchronize();
   
   
   uint32 nargs = func->arg_size() + 1 + (stat ? 1 : 0); 
@@ -471,13 +473,15 @@
 
 
   currentBlock = endBlock; 
-  if (isSynchro(compilingMethod->access))
-    endSynchronize();
  
   Value* Args2[2] = { oldCLIN, oldJB };
 
   CallInst::Create(module->EndJNIFunction, Args2, Args2 + 2, "", currentBlock);
   
+  // Synchronize after leaving native.
+  if (isSynchro(compilingMethod->access))
+    endSynchronize();
+  
   if (returnType != Type::getVoidTy(getGlobalContext()))
     ReturnInst::Create(*llvmContext, endNode, currentBlock);
   else
@@ -581,7 +585,6 @@
   BranchInst::Create(OK, currentBlock);
   
   currentBlock = FatLockBB;
-
   // Either it's a fat lock or there is contention.
   CallInst::Create(module->AquireObjectFunction, obj, "", currentBlock);
   BranchInst::Create(OK, currentBlock);





More information about the vmkit-commits mailing list