summaryrefslogtreecommitdiff
path: root/src/compiler_llvm/jni_compiler.cc
diff options
context:
space:
mode:
author TDYa127 <tdy@google.com> 2012-11-18 16:59:53 -0800
committer Shih-wei Liao <sliao@google.com> 2012-12-04 11:07:34 -0800
commitce4cc0d1818e872c1c7f3c3519a82259afd5c288 (patch)
tree308f2c30e5a842a5e459d96e730ca4432a020f4f /src/compiler_llvm/jni_compiler.cc
parent823b8acdf2c8274ff93b685e50a93ab9afc6af8b (diff)
Using gcmap instead of shadow frame.
Fix misuse of TBAAJRuntime & TBAARuntimeInfo. Now, the TBAAJRuntime is only for runtime support function. Update DexPC before lock object and suspend. Change-Id: I40fa37f4863fe6e127328a8413285ee3c62e8505
Diffstat (limited to 'src/compiler_llvm/jni_compiler.cc')
-rw-r--r--src/compiler_llvm/jni_compiler.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/compiler_llvm/jni_compiler.cc b/src/compiler_llvm/jni_compiler.cc
index d5a7869d00..2a173208ac 100644
--- a/src/compiler_llvm/jni_compiler.cc
+++ b/src/compiler_llvm/jni_compiler.cc
@@ -101,7 +101,7 @@ CompiledMethod* JniCompiler::Compile() {
}
// Shadow stack
- llvm::StructType* shadow_frame_type = irb_.getShadowFrameTy(sirt_size, 0);
+ llvm::StructType* shadow_frame_type = irb_.getShadowFrameTy(sirt_size);
llvm::AllocaInst* shadow_frame_ = irb_.CreateAlloca(shadow_frame_type);
// Store the dex pc
@@ -113,20 +113,20 @@ CompiledMethod* JniCompiler::Compile() {
// Push the shadow frame
llvm::Value* shadow_frame_upcast = irb_.CreateConstGEP2_32(shadow_frame_, 0, 0);
llvm::Value* old_shadow_frame =
- irb_.Runtime().EmitPushShadowFrame(shadow_frame_upcast, method_object_addr, sirt_size, 0);
+ irb_.Runtime().EmitPushShadowFrame(shadow_frame_upcast, method_object_addr, sirt_size);
// Get JNIEnv
llvm::Value* jni_env_object_addr =
irb_.Runtime().EmitLoadFromThreadOffset(Thread::JniEnvOffset().Int32Value(),
irb_.getJObjectTy(),
- kTBAAJRuntime);
+ kTBAARuntimeInfo);
// Get callee code_addr
llvm::Value* code_addr =
irb_.LoadFromObjectOffset(method_object_addr,
AbstractMethod::NativeMethodOffset().Int32Value(),
GetFunctionType(method_idx_, is_static, true)->getPointerTo(),
- kTBAAJRuntime);
+ kTBAARuntimeInfo);
// Load actual parameters
std::vector<llvm::Value*> args;
@@ -145,7 +145,8 @@ CompiledMethod* JniCompiler::Compile() {
// Store the "this object or class object" to SIRT
gep_index[2] = irb_.getInt32(sirt_member_index++);
- llvm::Value* sirt_field_addr = irb_.CreateGEP(shadow_frame_, gep_index);
+ llvm::Value* sirt_field_addr = irb_.CreateBitCast(irb_.CreateGEP(shadow_frame_, gep_index),
+ irb_.getJObjectTy()->getPointerTo());
irb_.CreateStore(this_object_or_class_object, sirt_field_addr, kTBAAShadowFrame);
// Push the "this object or class object" to out args
this_object_or_class_object = irb_.CreateBitCast(sirt_field_addr, irb_.getJObjectTy());
@@ -155,7 +156,8 @@ CompiledMethod* JniCompiler::Compile() {
if (arg_iter->getType() == irb_.getJObjectTy()) {
// Store the reference type arguments to SIRT
gep_index[2] = irb_.getInt32(sirt_member_index++);
- llvm::Value* sirt_field_addr = irb_.CreateGEP(shadow_frame_, gep_index);
+ llvm::Value* sirt_field_addr = irb_.CreateBitCast(irb_.CreateGEP(shadow_frame_, gep_index),
+ irb_.getJObjectTy()->getPointerTo());
irb_.CreateStore(arg_iter, sirt_field_addr, kTBAAShadowFrame);
// Note null is placed in the SIRT but the jobject passed to the native code must be null
// (not a pointer into the SIRT as with regular references).