[vmkit-commits] [vmkit] r58910 - in /vmkit/trunk: include/mvm/JIT.h lib/JnJVM/LLVMRuntime/runtime-default.ll lib/JnJVM/VMCore/JavaJIT.cpp lib/JnJVM/VMCore/JnjvmModule.cpp lib/JnJVM/VMCore/JnjvmModule.h lib/Mvm/Runtime/JIT.cpp lib/Mvm/Runtime/LLVMRuntime.ll

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sat Nov 8 08:17:05 PST 2008


Author: geoffray
Date: Sat Nov  8 10:16:57 2008
New Revision: 58910

URL: http://llvm.org/viewvc/llvm-project?rev=58910&view=rev
Log:
GetThreadID is now inlined with frameaddress.


Modified:
    vmkit/trunk/include/mvm/JIT.h
    vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-default.ll
    vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h
    vmkit/trunk/lib/Mvm/Runtime/JIT.cpp
    vmkit/trunk/lib/Mvm/Runtime/LLVMRuntime.ll

Modified: vmkit/trunk/include/mvm/JIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/JIT.h?rev=58910&r1=58909&r2=58910&view=diff

==============================================================================
--- vmkit/trunk/include/mvm/JIT.h (original)
+++ vmkit/trunk/include/mvm/JIT.h Sat Nov  8 10:16:57 2008
@@ -106,6 +106,7 @@
 
   llvm::Function* llvm_memcpy_i32;
   llvm::Function* llvm_memset_i32;
+  llvm::Function* llvm_frameaddress;
   llvm::Function* llvm_atomic_lcs_i8;
   llvm::Function* llvm_atomic_lcs_i16;
   llvm::Function* llvm_atomic_lcs_i32;
@@ -158,6 +159,7 @@
   static llvm::ConstantFP*  constantDoubleMinusZero;
   static llvm::Constant*    constantPtrNull;
   static llvm::ConstantInt* constantPtrSize;
+  static llvm::ConstantInt* constantThreadIDMask;
   static const llvm::PointerType* ptrType;
   static const llvm::PointerType* ptr32Type;
   static const llvm::PointerType* ptrPtrType;

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=58910&r1=58909&r2=58910&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-default.ll (original)
+++ vmkit/trunk/lib/JnJVM/LLVMRuntime/runtime-default.ll Sat Nov  8 10:16:57 2008
@@ -155,10 +155,6 @@
 ;;; class.
 declare %JavaObject* @getClassDelegatee(%JavaClass*) readnone 
 
-;;; getThreadID - Returns the thread ID of the current thread. Used for thin
-;;; locks.
-declare i32 @getThreadID() readnone
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Exception methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -169,14 +165,14 @@
 declare void @negativeArraySizeException(i32)
 declare void @outOfMemoryError(i32)
 
-declare void @JavaThreadThrowException(%JavaObject*)
-declare void @JavaThreadClearException()
-declare i8* @JavaThreadGetException()
+declare void         @JavaThreadThrowException(%JavaObject*)
+declare void         @JavaThreadClearException()
+declare i8*          @JavaThreadGetException()
 declare %JavaObject* @JavaThreadGetJavaException()
-declare i1 @JavaThreadCompareException(%JavaClass*)
+declare i1           @JavaThreadCompareException(%JavaClass*)
 
 declare void @jniProceedPendingException()
-declare i8* @getSJLJBuffer()
+declare i8*  @getSJLJBuffer()
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Debugging methods ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Sat Nov  8 10:16:57 2008
@@ -326,8 +326,11 @@
   gep.push_back(module->JavaObjectLockOffsetConstant);
   Value* lockPtr = GetElementPtrInst::Create(obj, gep.begin(), gep.end(), "",
                                              currentBlock);
-  Value* threadId = CallInst::Create(module->GetThreadIDFunction, "",
-                                     currentBlock);
+  Value* threadId = CallInst::Create(module->llvm_frameaddress,
+                                     module->constantZero, "", currentBlock);
+  threadId = new PtrToIntInst(threadId, Type::Int32Ty, "", currentBlock);
+  threadId = BinaryOperator::CreateAnd(threadId, module->constantThreadIDMask,
+                                       "", currentBlock);
   std::vector<Value*> atomicArgs;
   atomicArgs.push_back(lockPtr);
   atomicArgs.push_back(module->constantZero);
@@ -411,8 +414,11 @@
   Value* lockPtr = GetElementPtrInst::Create(obj, gep.begin(), gep.end(), "",
                                              currentBlock);
   Value* lock = new LoadInst(lockPtr, "", currentBlock);
-  Value* threadId = CallInst::Create(module->GetThreadIDFunction, "",
-                                     currentBlock);
+  Value* threadId = CallInst::Create(module->llvm_frameaddress,
+                                     module->constantZero, "", currentBlock);
+  threadId = new PtrToIntInst(threadId, Type::Int32Ty, "", currentBlock);
+  threadId = BinaryOperator::CreateAnd(threadId, module->constantThreadIDMask,
+                                       "", currentBlock);
   
   Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, lock, threadId, "",
                             currentBlock);

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp Sat Nov  8 10:16:57 2008
@@ -1109,7 +1109,6 @@
   GetCollectorFunction = module->getFunction("getCollector");
 #endif
   
-  GetThreadIDFunction = module->getFunction("getThreadID");
   GetLockFunction = module->getFunction("getLock");
 }
 

Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h?rev=58910&r1=58909&r2=58910&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h Sat Nov  8 10:16:57 2008
@@ -321,7 +321,6 @@
   llvm::Function* GetObjectSizeFromClassFunction;
 
   llvm::Function* GetLockFunction;
-  llvm::Function* GetThreadIDFunction;
   llvm::Function* OverflowThinLockFunction;
 
   static llvm::ConstantInt* OffsetObjectSizeInClassConstant;

Modified: vmkit/trunk/lib/Mvm/Runtime/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/JIT.cpp?rev=58910&r1=58909&r2=58910&view=diff

==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/JIT.cpp (original)
+++ vmkit/trunk/lib/Mvm/Runtime/JIT.cpp Sat Nov  8 10:16:57 2008
@@ -122,6 +122,7 @@
   constantDoubleMinusInfinity = ConstantFP::get(Type::DoubleTy, MinDouble);
   constantDoubleMinusZero = ConstantFP::get(Type::DoubleTy, -0.0);
   constantFloatMinusZero = ConstantFP::get(Type::FloatTy, -0.0f);
+  constantThreadIDMask = ConstantInt::get(Type::Int32Ty, mvm::Thread::IDMask);
 
   constantPtrNull = Constant::getNullValue(ptrType); 
   constantPtrSize = ConstantInt::get(Type::Int32Ty, sizeof(void*));
@@ -185,7 +186,8 @@
   
   llvm_memcpy_i32 = module->getFunction("llvm.memcpy.i32");
   llvm_memset_i32 = module->getFunction("llvm.memset.i32");
-    
+  llvm_frameaddress = module->getFunction("llvm.frameaddress");
+
   llvm_atomic_lcs_i8 = module->getFunction("llvm.atomic.cmp.swap.i8.p0i8");
   llvm_atomic_lcs_i16 = module->getFunction("llvm.atomic.cmp.swap.i16.p0i16");
   llvm_atomic_lcs_i32 = module->getFunction("llvm.atomic.cmp.swap.i32.p0i32");
@@ -234,6 +236,7 @@
 llvm::ConstantFP*  MvmModule::constantDoubleMinusZero;
 llvm::Constant*    MvmModule::constantPtrNull;
 llvm::ConstantInt* MvmModule::constantPtrSize;
+llvm::ConstantInt* MvmModule::constantThreadIDMask;
 const llvm::PointerType* MvmModule::ptrType;
 const llvm::PointerType* MvmModule::ptr32Type;
 const llvm::PointerType* MvmModule::ptrPtrType;

Modified: vmkit/trunk/lib/Mvm/Runtime/LLVMRuntime.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/LLVMRuntime.ll?rev=58910&r1=58909&r2=58910&view=diff

==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/LLVMRuntime.ll (original)
+++ vmkit/trunk/lib/Mvm/Runtime/LLVMRuntime.ll Sat Nov  8 10:16:57 2008
@@ -20,13 +20,13 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 declare void @_Unwind_Resume_or_Rethrow(i8*)
-declare i8* @llvm.eh.exception() nounwind
-declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind
-declare i64 @llvm.eh.selector.i64(i8*, i8*, ...) nounwind
+declare i8*  @llvm.eh.exception() nounwind
+declare i32  @llvm.eh.selector.i32(i8*, i8*, ...) nounwind
+declare i64  @llvm.eh.selector.i64(i8*, i8*, ...) nounwind
 declare void @__gxx_personality_v0()
-declare i8* @__cxa_begin_catch(i8*)
+declare i8*  @__cxa_begin_catch(i8*)
 declare void @__cxa_end_catch()
-declare i32 @setjmp(i8*)
+declare i32  @setjmp(i8*)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Math ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -55,7 +55,7 @@
 declare double @hypot(double, double)
 declare double @pow(double, double)
 declare double @atan2(double, double)
-declare float @fabsf(float)
+declare float  @fabsf(float)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Memory ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -63,12 +63,13 @@
 
 declare void @llvm.memcpy.i32(i8 *, i8 *, i32, i32) nounwind
 declare void @llvm.memset.i32(i8 *, i8, i32, i32) nounwind
+declare i8*  @llvm.frameaddress(i32) nounwind readnone
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Atomic ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-declare i8 @llvm.atomic.cmp.swap.i8.p0i8(i8*, i8, i8) nounwind
+declare i8  @llvm.atomic.cmp.swap.i8.p0i8(i8*, i8, i8) nounwind
 declare i16 @llvm.atomic.cmp.swap.i16.p0i16(i16*, i16, i16) nounwind
 declare i32 @llvm.atomic.cmp.swap.i32.p0i32(i32*, i32, i32) nounwind
 declare i64 @llvm.atomic.cmp.swap.i64.p0i64(i64*, i64, i64) nounwind





More information about the vmkit-commits mailing list