summaryrefslogtreecommitdiffstats
path: root/runtime/interpreter/interpreter_goto_table_impl.cc
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2013-09-18 07:10:55 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-18 07:10:55 +0000
commit3523909c99a27729d9a0d6fe3624f09dfadf351c (patch)
tree610a5acc4d2e78d43a551380527304270d841f73 /runtime/interpreter/interpreter_goto_table_impl.cc
parent8c7ec8cd8e39809ed31cb62bc3b068430042bd76 (diff)
parent947ff080753c786a74f1cd7aeb09f717bb7074bd (diff)
downloadart-3523909c99a27729d9a0d6fe3624f09dfadf351c.zip
art-3523909c99a27729d9a0d6fe3624f09dfadf351c.tar.gz
art-3523909c99a27729d9a0d6fe3624f09dfadf351c.tar.bz2
Merge "Load shadow frame's this object only upon instrumentation." into dalvik-dev
Diffstat (limited to 'runtime/interpreter/interpreter_goto_table_impl.cc')
-rw-r--r--runtime/interpreter/interpreter_goto_table_impl.cc36
1 files changed, 15 insertions, 21 deletions
diff --git a/runtime/interpreter/interpreter_goto_table_impl.cc b/runtime/interpreter/interpreter_goto_table_impl.cc
index 7f4c7c8..4bef770 100644
--- a/runtime/interpreter/interpreter_goto_table_impl.cc
+++ b/runtime/interpreter/interpreter_goto_table_impl.cc
@@ -24,7 +24,6 @@ namespace interpreter {
// - "inst" : the current Instruction*.
// - "dex_pc": the current pc.
// - "shadow_frame": the current shadow frame.
-// - "insns": the start of current method's code item.
// - "mh": the current MethodHelper.
// - "currentHandlersTable": the current table of pointer to each instruction handler.
@@ -78,22 +77,16 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
return JValue();
}
self->VerifyStack();
- instrumentation::Instrumentation* const instrumentation = Runtime::Current()->GetInstrumentation();
-
- // As the 'this' object won't change during the execution of current code, we
- // want to cache it in local variables. Nevertheless, in order to let the
- // garbage collector access it, we store it into sirt references.
- SirtRef<Object> this_object_ref(self, shadow_frame.GetThisObject(code_item->ins_size_));
uint32_t dex_pc = shadow_frame.GetDexPC();
+ const instrumentation::Instrumentation* const instrumentation = Runtime::Current()->GetInstrumentation();
if (LIKELY(dex_pc == 0)) { // We are entering the method as opposed to deoptimizing..
if (UNLIKELY(instrumentation->HasMethodEntryListeners())) {
- instrumentation->MethodEnterEvent(self, this_object_ref.get(),
+ instrumentation->MethodEnterEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
shadow_frame.GetMethod(), 0);
}
}
- const uint16_t* const insns = code_item->insns_;
- const Instruction* inst = Instruction::At(insns + dex_pc);
+ const Instruction* inst = Instruction::At(code_item->insns_ + dex_pc);
// Define handlers table.
static const void* handlersTable[kNumPackedOpcodes] = {
@@ -212,7 +205,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
CheckSuspend(self);
}
if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
- instrumentation->MethodExitEvent(self, this_object_ref.get(),
+ instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
shadow_frame.GetMethod(), dex_pc,
result);
}
@@ -227,7 +220,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
CheckSuspend(self);
}
if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
- instrumentation->MethodExitEvent(self, this_object_ref.get(),
+ instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
shadow_frame.GetMethod(), dex_pc,
result);
}
@@ -243,7 +236,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
CheckSuspend(self);
}
if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
- instrumentation->MethodExitEvent(self, this_object_ref.get(),
+ instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
shadow_frame.GetMethod(), dex_pc,
result);
}
@@ -258,7 +251,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
CheckSuspend(self);
}
if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
- instrumentation->MethodExitEvent(self, this_object_ref.get(),
+ instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
shadow_frame.GetMethod(), dex_pc,
result);
}
@@ -274,7 +267,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
CheckSuspend(self);
}
if (UNLIKELY(instrumentation->HasMethodExitListeners())) {
- instrumentation->MethodExitEvent(self, this_object_ref.get(),
+ instrumentation->MethodExitEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
shadow_frame.GetMethod(), dex_pc,
result);
}
@@ -2324,8 +2317,9 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
+ Object* this_object = shadow_frame.GetThisObject(code_item->ins_size_);
uint32_t found_dex_pc = FindNextInstructionFollowingException(self, shadow_frame, dex_pc,
- this_object_ref,
+ this_object,
instrumentation);
if (found_dex_pc == DexFile::kDexNoIndex) {
return JValue(); /* Handled in caller. */
@@ -2336,11 +2330,11 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
}
// Create alternative instruction handlers dedicated to instrumentation.
-#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
- instrumentation_op_##code: { \
- instrumentation->DexPcMovedEvent(self, this_object_ref.get(), \
- shadow_frame.GetMethod(), dex_pc); \
- goto *handlersTable[Instruction::code]; \
+#define INSTRUMENTATION_INSTRUCTION_HANDLER(o, code, n, f, r, i, a, v) \
+ instrumentation_op_##code: { \
+ instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_), \
+ shadow_frame.GetMethod(), dex_pc); \
+ goto *handlersTable[Instruction::code]; \
}
#include "dex_instruction_list.h"
DEX_INSTRUCTION_LIST(INSTRUMENTATION_INSTRUCTION_HANDLER)