[vmkit-commits] [vmkit] r71945 - in /vmkit/trunk/lib/JnJVM/Compiler: JavaJIT.cpp JavaJITOpcodes.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sat May 16 06:36:20 PDT 2009


Author: geoffray
Date: Sat May 16 08:36:19 2009
New Revision: 71945

URL: http://llvm.org/viewvc/llvm-project?rev=71945&view=rev
Log:
Don't throw exceptions from the JIT.


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

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp Sat May 16 08:36:19 2009
@@ -596,9 +596,10 @@
   Attribut* codeAtt = compilingMethod->lookupAttribut(Attribut::codeAttribut);
   
   if (!codeAtt) {
-    Jnjvm* vm = JavaThread::get()->getJVM();
-    vm->unknownError("unable to find the code attribut in %s",
-                     compilingMethod->printString());
+    fprintf(stderr, "I haven't verified your class file and it's malformed:"
+                    " no code attribut found for %s!\n",
+                    compilingMethod->printString());
+    abort();
   }
 
   Reader reader(codeAtt, compilingClass->bytes);
@@ -724,9 +725,10 @@
   Attribut* codeAtt = compilingMethod->lookupAttribut(Attribut::codeAttribut);
   
   if (!codeAtt) {
-    Jnjvm* vm = JavaThread::get()->getJVM();
-    vm->unknownError("unable to find the code attribut in %s",
-                     compilingMethod->printString());
+    fprintf(stderr, "I haven't verified your class file and it's malformed:"
+                    " no code attribut found for %s!\n",
+                    compilingMethod->printString());
+    abort();
   }
 
   Reader reader(codeAtt, compilingClass->bytes);
@@ -1075,7 +1077,10 @@
                            currentBlock);
     push(res, false);
   } else {
-    JavaThread::get()->getJVM()->unknownError("unknown type %d", type);
+    fprintf(stderr, "I haven't verified your class file and it's malformed:"
+                    " unknown ldc %d in %s!\n", type,
+                    compilingClass->printString());
+    abort();
   }
 }
 

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp Sat May 16 08:36:19 2009
@@ -42,7 +42,7 @@
 using namespace jnjvm;
 using namespace llvm;
 
-uint8 arrayType(unsigned int t) {
+uint8 arrayType(JavaMethod* meth, unsigned int t) {
   if (t == JavaArray::T_CHAR) {
     return I_CHAR;
   } else if (t == JavaArray::T_BOOLEAN) {
@@ -60,8 +60,10 @@
   } else if (t == JavaArray::T_DOUBLE) {
     return I_DOUBLE;
   } else {
-    JavaThread::get()->getJVM()->unknownError("unknown array type %d\n", t);
-    return 0;
+    fprintf(stderr, "I haven't verified your class file and it's malformed:"
+                    " unknown array type %d in %s!\n", t,
+                    meth->printString());
+    abort();
   }
 }
 
@@ -1902,7 +1904,7 @@
 
         if (bytecodes[i] == NEWARRAY) {
           uint8 id = bytecodes[++i];
-          uint8 charId = arrayType(id);
+          uint8 charId = arrayType(compilingMethod, id);
 #ifndef ISOLATE_SHARING
           JnjvmBootstrapLoader* loader = 
             compilingClass->classLoader->bootstrapLoader;
@@ -2190,9 +2192,12 @@
         break;
       }
       
-      default :
-        JavaThread::get()->getJVM()->unknownError("unknown bytecode");
-
+      default : {
+        fprintf(stderr, "I haven't verified your class file and it's malformed:"
+                    " unknown bytecode %d in %s\n!", bytecodes[i],
+                    compilingClass->printString());
+        abort();
+      }
     } 
   }
 }
@@ -2536,8 +2541,12 @@
       }
 
 
-      default :
-        JavaThread::get()->getJVM()->unknownError("unknown bytecode");
+      default : {
+        fprintf(stderr, "I haven't verified your class file and it's malformed:"
+                    " unknown bytecode %d in %s!\n", bytecodes[i],
+                    compilingClass->printString());
+        abort();
+      }
     }
   }
 }





More information about the vmkit-commits mailing list