[vmkit-commits] [vmkit] r180429 - Fixing a bug in jitter related to exception handling

Peter Senna Tschudin peter.senna at gmail.com
Thu Apr 25 10:10:33 PDT 2013


Author: peter.senna
Date: Thu Apr 25 12:08:57 2013
New Revision: 180429

URL: http://llvm.org/viewvc/llvm-project?rev=180429&view=rev
Log:
Fixing a bug in jitter related to exception handling

Note:
Let T be the set of programs runnable with the previous version and W the set of program which run now then
I can say for sure that : T is subset of W

Advanteges:
Any program which run in previous version will use the same execution path in the new version.
Some program which fail in previous version will run. Now I can run call annotation's properties.

However, my solution is not complete because:

1 - Verification errors can emerge
2 - W is a subset of U, the set of valid programs

Final solution to this is required.
(cherry picked from commit 598b55294382c89790b9393d0eb16e475c598bb5)

Modified:
    vmkit/trunk/lib/j3/Compiler/JavaJITOpcodes.cpp

Modified: vmkit/trunk/lib/j3/Compiler/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/Compiler/JavaJITOpcodes.cpp?rev=180429&r1=180428&r2=180429&view=diff
==============================================================================
--- vmkit/trunk/lib/j3/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/j3/Compiler/JavaJITOpcodes.cpp Thu Apr 25 12:08:57 2013
@@ -114,18 +114,33 @@ void JavaJIT::compileOpcodes(Reader& rea
     PRINT_DEBUG(JNJVM_COMPILE, 1, LIGHT_BLUE, "\n");
     
     Opinfo* opinfo = &(opcodeInfos[i]);
-    
     if (opinfo->newBlock) {
       if (currentBlock->getTerminator() == 0) {
         // Load the exception object if we have branched to a handler.
+    	  bool b = false;
         if (opinfo->handler) {
           Instruction* I = opinfo->newBlock->begin();
           PHINode * node = dyn_cast<PHINode>(I);
-          assert(node && "Handler marlformed");
-          Value* obj = pop();
-          node->addIncoming(obj, currentBlock);
+          if (!node) {
+        	  //llvmFunction->dump();
+        	  //Value* obj = pop();
+        	  //PHINode* node = PHINode::Create(obj->getType(), 0, "jaja", opinfo->newBlock);
+        	  //node->addIncoming(obj, currentBlock);
+        	  // if we were in a handler and now we are in a new handler we simulate a throw
+        	  llvm::Value* arg = pop();
+        	  throwException(arg);
+        	  b = true;
+        	  // Original Code
+        	  //assert(node && "Handler marlformed");
+          }
+          else {
+
+			  Value* obj = pop();
+			  node->addIncoming(obj, currentBlock);
+          }
         }
-        branch(*opinfo, currentBlock);
+        if (!b)
+        	branch(*opinfo, currentBlock);
       }
       
       currentBlock = opinfo->newBlock;





More information about the vmkit-commits mailing list