summaryrefslogtreecommitdiff
path: root/src/compiler_llvm/jni_compiler.cc
diff options
context:
space:
mode:
author TDYa127 <tdy@google.com> 2012-06-05 23:51:19 -0700
committer Shih-wei Liao <sliao@google.com> 2012-06-06 21:52:21 -0700
commitb08ed1255fc34b9f34bcea66cd5e0a292af3d698 (patch)
treeecc865c3f942fe0949ef3d9b0bb3aa585f6e2d61 /src/compiler_llvm/jni_compiler.cc
parent7a2a23a44d27f769718e28327af671f4e486c49a (diff)
Implement thin-lock fast path for compiler-llvm.
Change-Id: I09d6a0dba4df7cbeb0c0e3f432ab3b09fce0846d
Diffstat (limited to 'src/compiler_llvm/jni_compiler.cc')
-rw-r--r--src/compiler_llvm/jni_compiler.cc15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/compiler_llvm/jni_compiler.cc b/src/compiler_llvm/jni_compiler.cc
index 838c89da81..bb45facba6 100644
--- a/src/compiler_llvm/jni_compiler.cc
+++ b/src/compiler_llvm/jni_compiler.cc
@@ -108,9 +108,6 @@ CompiledMethod* JniCompiler::Compile() {
}
}
- // Get thread object
- llvm::Value* thread_object_addr = irb_.Runtime().EmitGetCurrentThread();
-
// Shadow stack
llvm::StructType* shadow_frame_type = irb_.getShadowFrameTy(sirt_size);
llvm::AllocaInst* shadow_frame_ = irb_.CreateAlloca(shadow_frame_type);
@@ -187,10 +184,7 @@ CompiledMethod* JniCompiler::Compile() {
// Acquire lock for synchronized methods.
if (is_synchronized) {
- // Acquire lock
- irb_.CreateCall2(irb_.GetRuntime(LockObject),
- this_object_or_class_object,
- thread_object_addr);
+ irb_.Runtime().EmitLockObject(this_object_or_class_object);
}
// saved_local_ref_cookie = env->local_ref_cookie
@@ -218,9 +212,7 @@ CompiledMethod* JniCompiler::Compile() {
// Release lock for synchronized methods.
if (is_synchronized) {
- irb_.CreateCall2(irb_.GetRuntime(UnlockObject),
- this_object_or_class_object,
- thread_object_addr);
+ irb_.Runtime().EmitUnlockObject(this_object_or_class_object);
}
// Set thread state to kRunnable
@@ -232,6 +224,9 @@ CompiledMethod* JniCompiler::Compile() {
irb_.Runtime().EmitTestSuspend();
if (return_shorty == 'L') {
+ // Get thread object
+ llvm::Value* thread_object_addr = irb_.Runtime().EmitGetCurrentThread();
+
// If the return value is reference, it may point to SIRT, we should decode it.
retval = irb_.CreateCall2(irb_.GetRuntime(DecodeJObjectInThread),
thread_object_addr,