summaryrefslogtreecommitdiffstats
path: root/runtime/interpreter/interpreter_switch_impl.cc
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2013-09-17 14:10:13 +0200
committerSebastien Hertz <shertz@google.com>2013-09-17 15:28:37 +0200
commit947ff080753c786a74f1cd7aeb09f717bb7074bd (patch)
treeae8d4ceb42602b19b62b61205a5bcb70e6ef6ab3 /runtime/interpreter/interpreter_switch_impl.cc
parentad5f8731448f03c59d5fc8d9b5b25ee91d351ba9 (diff)
downloadart-947ff080753c786a74f1cd7aeb09f717bb7074bd.zip
art-947ff080753c786a74f1cd7aeb09f717bb7074bd.tar.gz
art-947ff080753c786a74f1cd7aeb09f717bb7074bd.tar.bz2
Load shadow frame's this object only upon instrumentation.
We used to load the shadow frame's this object when entering the interpreter and push it into thread's SIRT to make it visible to garbage collector. But it is only used by instrumentation listeners. We now move this load at each place an instrumentation listener is called. This avoids loading it when instrumentation is disabled. This also allows to remove the SIRT reference and the push/pop management it implies when entering/exiting the interpreter. The performance improvement is 6% in average on our benchmarks suite. This CL also makes method Instrumentation::ExceptionCaughtEvent const so we can use a "const instrumentation::Instrumentation*" object in interpreter. Change-Id: I2caccba9a906f244c8057b24031250f9824cc711
Diffstat (limited to 'runtime/interpreter/interpreter_switch_impl.cc')
-rw-r--r--runtime/interpreter/interpreter_switch_impl.cc24
1 files changed, 10 insertions, 14 deletions
diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc
index 5253e9d..01a0e4b 100644
--- a/runtime/interpreter/interpreter_switch_impl.cc
+++ b/runtime/interpreter/interpreter_switch_impl.cc
@@ -25,9 +25,10 @@ namespace interpreter {
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, \
inst->GetDexPc(insns), \
- this_object_ref, \
+ this_object, \
instrumentation); \
if (found_dex_pc == DexFile::kDexNoIndex) { \
return JValue(); /* Handled in caller. */ \
@@ -57,17 +58,12 @@ static JValue ExecuteSwitchImpl(Thread* self, MethodHelper& mh, const DexFile::C
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);
}
}
@@ -77,7 +73,7 @@ static JValue ExecuteSwitchImpl(Thread* self, MethodHelper& mh, const DexFile::C
dex_pc = inst->GetDexPc(insns);
shadow_frame.SetDexPC(dex_pc);
if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- instrumentation->DexPcMovedEvent(self, this_object_ref.get(),
+ instrumentation->DexPcMovedEvent(self, shadow_frame.GetThisObject(code_item->ins_size_),
shadow_frame.GetMethod(), dex_pc);
}
TraceExecution(shadow_frame, inst, dex_pc, mh);
@@ -176,7 +172,7 @@ static JValue ExecuteSwitchImpl(Thread* self, MethodHelper& mh, const DexFile::C
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(), inst->GetDexPc(insns),
result);
}
@@ -190,7 +186,7 @@ static JValue ExecuteSwitchImpl(Thread* self, MethodHelper& mh, const DexFile::C
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(), inst->GetDexPc(insns),
result);
}
@@ -205,7 +201,7 @@ static JValue ExecuteSwitchImpl(Thread* self, MethodHelper& mh, const DexFile::C
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(), inst->GetDexPc(insns),
result);
}
@@ -219,7 +215,7 @@ static JValue ExecuteSwitchImpl(Thread* self, MethodHelper& mh, const DexFile::C
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(), inst->GetDexPc(insns),
result);
}
@@ -234,7 +230,7 @@ static JValue ExecuteSwitchImpl(Thread* self, MethodHelper& mh, const DexFile::C
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(), inst->GetDexPc(insns),
result);
}