Lazy pushing shadow frame.
Function:
aget v0, v1, v2
return v0
Original:
push shadow frame;
if (null pointer) { throw; pop shadow frame; unwind; }
if (index out of bounds) { throw; pop shadow frame; unwind; }
load from array;
pop shadow frame;
return;
New:
if (null pointer) { push shadow frame; throw; pop shadow frame; unwind; }
if (index out of bounds) { push shadow frame; throw; pop shadow frame; unwind; }
load from array;
return;
Change-Id: I7fc0ff12b9a5454f8e1491b9ce1cdef3afcbed23
diff --git a/src/compiler_llvm/jni_compiler.cc b/src/compiler_llvm/jni_compiler.cc
index c76c80d..e66674c 100644
--- a/src/compiler_llvm/jni_compiler.cc
+++ b/src/compiler_llvm/jni_compiler.cc
@@ -115,29 +115,17 @@
llvm::StructType* shadow_frame_type = irb_.getShadowFrameTy(sirt_size);
llvm::AllocaInst* shadow_frame_ = irb_.CreateAlloca(shadow_frame_type);
- // Store the method pointer
- llvm::Value* method_field_addr =
- irb_.CreatePtrDisp(shadow_frame_,
- irb_.getPtrEquivInt(ShadowFrame::MethodOffset()),
- irb_.getJObjectTy()->getPointerTo());
- irb_.CreateStore(method_object_addr, method_field_addr, kTBAAShadowFrame);
-
// Store the dex pc
irb_.StoreToObjectOffset(shadow_frame_,
ShadowFrame::DexPCOffset(),
irb_.getInt32(0),
kTBAAShadowFrame);
- // Store the number of the pointer slots
- irb_.StoreToObjectOffset(shadow_frame_,
- ShadowFrame::NumberOfReferencesOffset(),
- irb_.getInt32(sirt_size),
- kTBAAShadowFrame);
-
// Push the shadow frame
llvm::Value* shadow_frame_upcast = irb_.CreateConstGEP2_32(shadow_frame_, 0, 0);
llvm::Value* old_shadow_frame =
- irb_.CreateCall(irb_.GetRuntime(PushShadowFrame), shadow_frame_upcast);
+ irb_.CreateCall3(irb_.GetRuntime(PushShadowFrame),
+ shadow_frame_upcast, method_object_addr, irb_.getInt32(sirt_size));
// Get JNIEnv
llvm::Value* jni_env_object_addr =