[vmkit-commits] [vmkit] r76737 - in /vmkit/trunk: include/jnjvm/JnjvmModule.h include/mvm/Threads/Thread.h lib/JnJVM/Compiler/JavaJIT.cpp lib/JnJVM/Compiler/JnjvmModule.cpp lib/JnJVM/Compiler/LowerConstantCalls.cpp lib/JnJVM/LLVMRuntime/runtime-default.ll

Nicolas Geoffray nicolas.geoffray at lip6.fr
Wed Jul 22 06:52:31 PDT 2009


Author: geoffray
Date: Wed Jul 22 08:52:07 2009
New Revision: 76737

URL: http://llvm.org/viewvc/llvm-project?rev=76737&view=rev
Log:
Create constants for accessing thread fields instead of
using directly the offset, and add a new field doYield
to the thread.


Modified:
    vmkit/trunk/include/jnjvm/JnjvmModule.h
    vmkit/trunk/include/mvm/Threads/Thread.h
    vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp
    vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp
    vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp
    vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-default.ll

Modified: vmkit/trunk/include/jnjvm/JnjvmModule.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/jnjvm/JnjvmModule.h?rev=76737&r1=76736&r2=76737&view=diff

==============================================================================
--- vmkit/trunk/include/jnjvm/JnjvmModule.h (original)
+++ vmkit/trunk/include/jnjvm/JnjvmModule.h Wed Jul 22 08:52:07 2009
@@ -324,6 +324,9 @@
   llvm::Constant* OffsetInitializedInTaskClassMirrorConstant;
   llvm::Constant* OffsetStatusInTaskClassMirrorConstant;
   
+  llvm::Constant* OffsetDoYieldInThreadConstant;
+  llvm::Constant* OffsetIsolateInThreadConstant;
+  llvm::Constant* OffsetJNIInThreadConstant;
   llvm::Constant* OffsetJavaExceptionInThreadConstant;
   llvm::Constant* OffsetCXXExceptionInThreadConstant;
   

Modified: vmkit/trunk/include/mvm/Threads/Thread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/Thread.h?rev=76737&r1=76736&r2=76737&view=diff

==============================================================================
--- vmkit/trunk/include/mvm/Threads/Thread.h (original)
+++ vmkit/trunk/include/mvm/Threads/Thread.h Wed Jul 22 08:52:07 2009
@@ -138,7 +138,11 @@
   /// baseSP - The base stack pointer.
   ///
   void* baseSP;
-  
+ 
+  /// doYield - Flag to tell the thread to yield for GC reasons.
+  ///
+  bool doYield;
+
   /// get - Get the thread specific data of the current thread.
   ///
   static Thread* get() {

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp Wed Jul 22 08:52:07 2009
@@ -322,7 +322,7 @@
   
   Value* threadId = getCurrentThread();
 
-  Value* geps[2] = { module->constantZero, module->constantEight };
+  Value* geps[2] = { module->constantZero, module->OffsetJNIInThreadConstant };
 
   Value* jniEnv = GetElementPtrInst::Create(threadId, geps, geps + 2, "",
                                             currentBlock);

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp Wed Jul 22 08:52:07 2009
@@ -196,8 +196,11 @@
   OffsetStatusInTaskClassMirrorConstant = constantZero;
   OffsetInitializedInTaskClassMirrorConstant = constantOne;
   
-  OffsetJavaExceptionInThreadConstant = Context.getConstantInt(Type::Int32Ty, 9);
-  OffsetCXXExceptionInThreadConstant = Context.getConstantInt(Type::Int32Ty, 10);
+  OffsetIsolateInThreadConstant = Context.getConstantInt(Type::Int32Ty, 3);
+  OffsetDoYieldInThreadConstant = Context.getConstantInt(Type::Int32Ty, 6);
+  OffsetJNIInThreadConstant = Context.getConstantInt(Type::Int32Ty, 9);
+  OffsetJavaExceptionInThreadConstant = Context.getConstantInt(Type::Int32Ty, 10);
+  OffsetCXXExceptionInThreadConstant = Context.getConstantInt(Type::Int32Ty, 11);
   
   ClassReadyConstant = Context.getConstantInt(Type::Int8Ty, ready);
   

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/LowerConstantCalls.cpp Wed Jul 22 08:52:07 2009
@@ -50,8 +50,9 @@
   
   threadId = new IntToPtrInst(threadId, module->ptr32Type, "", CI);
   
-  Value* IsolateID = GetElementPtrInst::Create(threadId, module->constantThree,
-                                               "", CI);
+  Value* IsolateID = GetElementPtrInst::Create(threadId,
+      module->OffsetIsolateInThreadConstant, "", CI);
+
   IsolateID = new LoadInst(IsolateID, "", CI);
 
   Value* GEP2[2] = { module->constantZero, IsolateID };
@@ -74,8 +75,9 @@
   
   threadId = new IntToPtrInst(threadId, module->ptr32Type, "", CI);
   
-  Value* IsolateID = GetElementPtrInst::Create(threadId, module->constantThree,
-                                               "", CI);
+  Value* IsolateID = GetElementPtrInst::Create(threadId, 
+      module->OffsetIsolateInThreadConstant, "", CI);
+
   IsolateID = new LoadInst(IsolateID, "", CI);
 
   Value* GEP2[2] = { module->constantZero, IsolateID };

Modified: vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-default.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-default.ll?rev=76737&r1=76736&r2=76737&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-default.ll (original)
+++ vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-default.ll Wed Jul 22 08:52:07 2009
@@ -40,13 +40,14 @@
 ;;; Field 3: IsolateID
 ;;; Field 4: MyVM
 ;;; Field 5: baseSP
-;;; Field 6: internalThreadID
-;;; field 7: routine
-;;; field 8: jnienv
-;;; field 9: Java pendingException
-;;; field 10: CXX pendingException
-%JavaThread = type { %VT*, %JavaThread*, %JavaThread*, i8*, i8*, i8*, i8*, i8*,
-                     i8*, %JavaObject*, i8* }
+;;; Field 6: doYield
+;;; Field 7: internalThreadID
+;;; field 8: routine
+;;; field 9: jnienv
+;;; field 10: Java pendingException
+;;; field 11: CXX pendingException
+%JavaThread = type { %VT*, %JavaThread*, %JavaThread*, i8*, i8*, i8*, i1, i8*,
+                     i8*, i8*, %JavaObject*, i8* }
 
 
 %Attribut = type { %UTF8*, i32, i32 }





More information about the vmkit-commits mailing list