summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2018-11-09 14:26:28 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2018-11-09 14:26:28 +0000
commit00e96d054e2b656d4d0f99fc141d1701af4dba23 (patch)
tree85cb8740401b0b61f80400e520700978a0628e80
parentf0c883ba9b90d4e808c8f3fb25f988c436cfbe55 (diff)
parent5f250014f4cc348a573798c4daa191ea1381078d (diff)
Merge "Make exception handling code in switch interpreter NO_INLINE."
-rw-r--r--runtime/interpreter/interpreter_switch_impl-inl.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/runtime/interpreter/interpreter_switch_impl-inl.h b/runtime/interpreter/interpreter_switch_impl-inl.h
index bf12a72f9a..94cb3de9f8 100644
--- a/runtime/interpreter/interpreter_switch_impl-inl.h
+++ b/runtime/interpreter/interpreter_switch_impl-inl.h
@@ -71,7 +71,7 @@ class InstructionHandler {
return true;
}
- ALWAYS_INLINE WARN_UNUSED bool HandlePendingExceptionWithInstrumentation(
+ NO_INLINE WARN_UNUSED bool HandlePendingExceptionWithInstrumentationImpl(
const instrumentation::Instrumentation* instr)
REQUIRES_SHARED(Locks::mutator_lock_) {
DCHECK(self->IsExceptionPending());
@@ -99,6 +99,25 @@ class InstructionHandler {
return false; // Stop executing this opcode and continue in the exception handler.
}
+ // Forwards the call to the NO_INLINE HandlePendingExceptionWithInstrumentationImpl.
+ ALWAYS_INLINE WARN_UNUSED bool HandlePendingExceptionWithInstrumentation(
+ const instrumentation::Instrumentation* instr)
+ REQUIRES_SHARED(Locks::mutator_lock_) {
+ // We need to help the compiler a bit to make the NO_INLINE call efficient.
+ // * All handler fields should be in registers, so we do not want to take the object
+ // address (for 'this' argument). Make a copy of the handler just for the slow path.
+ // * The modifiable fields should also be in registers, so we don't want to store their
+ // address even in the handler copy. Make a copy of them just for the call as well.
+ const Instruction* inst_copy = inst;
+ bool exit_loop_copy = exit_interpreter_loop;
+ InstructionHandler<do_access_check, transaction_active> handler_copy(
+ ctx, instrumentation, self, shadow_frame, dex_pc, inst_copy, inst_data, exit_loop_copy);
+ bool result = handler_copy.HandlePendingExceptionWithInstrumentationImpl(instr);
+ inst = inst_copy;
+ exit_interpreter_loop = exit_loop_copy;
+ return result;
+ }
+
ALWAYS_INLINE WARN_UNUSED bool HandlePendingException()
REQUIRES_SHARED(Locks::mutator_lock_) {
return HandlePendingExceptionWithInstrumentation(instrumentation);