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

Nicolas Geoffray nicolas.geoffray at lip6.fr
Thu Apr 23 14:24:03 PDT 2009


Author: geoffray
Date: Thu Apr 23 16:24:03 2009
New Revision: 69920

URL: http://llvm.org/viewvc/llvm-project?rev=69920&view=rev
Log:
Enable stack overflow check only of exceptions are enabled.


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=69920&r1=69919&r2=69920&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp Thu Apr 23 16:24:03 2009
@@ -883,26 +883,29 @@
   
   if (isSynchro(compilingMethod->access))
     beginSynchronize();
-  
-  // Variables have been allocated and the lock has been taken. Do the stack
-  // check now: if there is an exception, we will go to the lock release code.
-  currentExceptionBlock = opcodeInfos[0].exceptionBlock;
-  Value* FrameAddr = CallInst::Create(module->llvm_frameaddress,
-                                     	module->constantZero, "", currentBlock);
-  FrameAddr = new PtrToIntInst(FrameAddr, module->pointerSizeType, "",
-                               currentBlock);
-  Value* stackCheck = 
-    BinaryOperator::CreateAnd(FrameAddr, module->constantStackOverflowMask, "",
-                              currentBlock);
-
-  stackCheck = new ICmpInst(ICmpInst::ICMP_EQ, stackCheck,
-                            module->constantPtrZero, "", currentBlock);
-  BasicBlock* stackOverflow = createBasicBlock("stack overflow");
-  BasicBlock* noStackOverflow = createBasicBlock("no stack overflow");
-  BranchInst::Create(stackOverflow, noStackOverflow, stackCheck, currentBlock);
-  currentBlock = stackOverflow;
-  throwException(module->StackOverflowErrorFunction, 0, 0);
-  currentBlock = noStackOverflow;
+ 
+  if (TheCompiler->hasExceptionsEnabled()) {
+    // Variables have been allocated and the lock has been taken. Do the stack
+    // check now: if there is an exception, we will go to the lock release code.
+    currentExceptionBlock = opcodeInfos[0].exceptionBlock;
+    Value* FrameAddr = CallInst::Create(module->llvm_frameaddress,
+                                       	module->constantZero, "", currentBlock);
+    FrameAddr = new PtrToIntInst(FrameAddr, module->pointerSizeType, "",
+                                 currentBlock);
+    Value* stackCheck = 
+      BinaryOperator::CreateAnd(FrameAddr, module->constantStackOverflowMask,
+                                "", currentBlock);
+
+    stackCheck = new ICmpInst(ICmpInst::ICMP_EQ, stackCheck,
+                              module->constantPtrZero, "", currentBlock);
+    BasicBlock* stackOverflow = createBasicBlock("stack overflow");
+    BasicBlock* noStackOverflow = createBasicBlock("no stack overflow");
+    BranchInst::Create(stackOverflow, noStackOverflow, stackCheck,
+                       currentBlock);
+    currentBlock = stackOverflow;
+    throwException(module->StackOverflowErrorFunction, 0, 0);
+    currentBlock = noStackOverflow;
+  }
 
   compileOpcodes(&compilingClass->bytes->elements[start], codeLen); 
   





More information about the vmkit-commits mailing list