[vmkit-commits] [vmkit] r139146 - in /vmkit/trunk/lib/J3: Classpath/ClasspathVMClassLoader.inc Compiler/JavaJIT.cpp Compiler/JavaJIT.h Compiler/JavaJITOpcodes.cpp VMCore/JavaClass.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Tue Sep 6 10:28:39 PDT 2011


Author: geoffray
Date: Tue Sep  6 12:28:39 2011
New Revision: 139146

URL: http://llvm.org/viewvc/llvm-project?rev=139146&view=rev
Log:
Fix off by one line tester, NPEs check and guard against segfault in defineClass.


Modified:
    vmkit/trunk/lib/J3/Classpath/ClasspathVMClassLoader.inc
    vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
    vmkit/trunk/lib/J3/Compiler/JavaJIT.h
    vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
    vmkit/trunk/lib/J3/VMCore/JavaClass.cpp

Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMClassLoader.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathVMClassLoader.inc?rev=139146&r1=139145&r2=139146&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Classpath/ClasspathVMClassLoader.inc (original)
+++ vmkit/trunk/lib/J3/Classpath/ClasspathVMClassLoader.inc Tue Sep  6 12:28:39 2011
@@ -129,6 +129,9 @@
   llvm_gcroot(excp, 0);
 
   BEGIN_NATIVE_EXCEPTION(0)
+  
+  // We need a name, which is unfortunately not required by the spec.
+  verifyNull(str);
 
   Jnjvm* vm = JavaThread::get()->getJVM();
 

Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp?rev=139146&r1=139145&r2=139146&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.cpp Tue Sep  6 12:28:39 2011
@@ -1272,8 +1272,10 @@
 }
 
 Value* JavaJIT::verifyAndComputePtr(Value* obj, Value* index,
-                                    Type* arrayType, bool verif) {
-  JITVerifyNull(obj);
+                                    Type* arrayType, bool doNullCheck) {
+  if (doNullCheck) {
+    JITVerifyNull(obj);
+  }
   
   if (index->getType() != Type::getInt32Ty(*llvmContext)) {
     index = new SExtInst(index, Type::getInt32Ty(*llvmContext), "", currentBlock);
@@ -1813,6 +1815,7 @@
   if (!stat) {
     object = new LoadInst(
         object, "", TheCompiler->useCooperativeGC(), currentBlock);
+    JITVerifyNull(object);
     Value* tmp = new BitCastInst(object, Pty, "", currentBlock);
     Value* args[2] = { zero, ptr };
     ptr = GetElementPtrInst::Create(tmp, args, "", currentBlock);

Modified: vmkit/trunk/lib/J3/Compiler/JavaJIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJIT.h?rev=139146&r1=139145&r2=139146&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJIT.h (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJIT.h Tue Sep  6 12:28:39 2011
@@ -220,7 +220,7 @@
   /// throw an exception.
   llvm::Value* verifyAndComputePtr(llvm::Value* obj, llvm::Value* index,
                                    llvm::Type* arrayType,
-                                   bool verif = true);
+                                   bool doNullCheck = true);
 
   /// compareFP - Do float comparisons.
   void compareFP(llvm::Value*, llvm::Value*, llvm::Type*, bool l);

Modified: vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp?rev=139146&r1=139145&r2=139146&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITOpcodes.cpp Tue Sep  6 12:28:39 2011
@@ -686,6 +686,7 @@
           Value* obj = new LoadInst(objectStack[currentStackIndex - 3], "",
                                     TheCompiler->useCooperativeGC(),
                                     currentBlock);
+          JITVerifyNull(obj);
           Value* cmp = new ICmpInst(*currentBlock, ICmpInst::ICMP_EQ, val,
                                     intrinsics->JavaObjectNullConstant, "");
 
@@ -720,7 +721,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         intrinsics->JavaArrayObjectType);
+                                         intrinsics->JavaArrayObjectType, false);
         if (mvm::Collector::needsWriteBarrier()) {
           ptr = new BitCastInst(ptr, intrinsics->ptrPtrType, "", currentBlock);
           val = new BitCastInst(val, intrinsics->ptrType, "", currentBlock);

Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.cpp?rev=139146&r1=139145&r2=139146&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaClass.cpp Tue Sep  6 12:28:39 2011
@@ -1717,7 +1717,7 @@
       uint16_t currentLine = 0;
       for (uint16 j = 0; j < lineLength; ++j) {
         uint16 pc = reader.readU2();
-        if (pc > info->SourceIndex + 1) return currentLine;
+        if (pc > info->SourceIndex) return currentLine;
         currentLine = reader.readU2();
       }
       return currentLine;





More information about the vmkit-commits mailing list