summaryrefslogtreecommitdiffstats
path: root/runtime/interpreter/interpreter_goto_table_impl.cc
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2013-09-13 14:57:51 +0200
committerSebastien Hertz <shertz@google.com>2013-09-13 18:00:02 +0200
commitcdf2d4cbbb1d0cf3e9f80d3dca609a3435c74427 (patch)
tree8c528f54d745d2ba166e749f81c9d1ca78987d4b /runtime/interpreter/interpreter_goto_table_impl.cc
parent174e9192843002a98e2d2ed26031e83f944645d1 (diff)
downloadart-cdf2d4cbbb1d0cf3e9f80d3dca609a3435c74427.zip
art-cdf2d4cbbb1d0cf3e9f80d3dca609a3435c74427.tar.gz
art-cdf2d4cbbb1d0cf3e9f80d3dca609a3435c74427.tar.bz2
Update interpreter handler table after invoke.
And introduce UPDATE_HANDLER_TABLE macro to reduce copy & paste. Change-Id: I9ea7565df0db2b44581d0e6bcefb5f104e76ed01
Diffstat (limited to 'runtime/interpreter/interpreter_goto_table_impl.cc')
-rw-r--r--runtime/interpreter/interpreter_goto_table_impl.cc129
1 files changed, 39 insertions, 90 deletions
diff --git a/runtime/interpreter/interpreter_goto_table_impl.cc b/runtime/interpreter/interpreter_goto_table_impl.cc
index 10c50f3..7f4c7c8 100644
--- a/runtime/interpreter/interpreter_goto_table_impl.cc
+++ b/runtime/interpreter/interpreter_goto_table_impl.cc
@@ -51,6 +51,15 @@ namespace interpreter {
} \
} while (false)
+#define UPDATE_HANDLER_TABLE() \
+ do { \
+ if (UNLIKELY(instrumentation->HasDexPcListeners())) { \
+ currentHandlersTable = instrumentationHandlersTable; \
+ } else { \
+ currentHandlersTable = handlersTable; \
+ } \
+ } while (false);
+
#define UNREACHABLE_CODE_CHECK() \
do { \
if (kIsDebugBuild) { \
@@ -104,11 +113,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
};
const void** currentHandlersTable;
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
// Jump to first instruction.
ADVANCE(0);
@@ -524,11 +529,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
}
@@ -540,11 +541,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
}
@@ -556,11 +553,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
}
@@ -572,11 +565,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
}
@@ -588,11 +577,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
}
@@ -685,11 +670,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
} else {
@@ -705,11 +686,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
} else {
@@ -725,11 +702,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
} else {
@@ -745,11 +718,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
} else {
@@ -765,11 +734,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
} else {
@@ -785,11 +750,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
} else {
@@ -805,11 +766,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
} else {
@@ -825,11 +782,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
} else {
@@ -845,11 +798,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
} else {
@@ -865,11 +814,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
} else {
@@ -885,11 +830,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
} else {
@@ -905,11 +846,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
if (UNLIKELY(self->TestAllFlags())) {
CheckSuspend(self);
}
- if (UNLIKELY(instrumentation->HasDexPcListeners())) {
- currentHandlersTable = instrumentationHandlersTable;
- } else {
- currentHandlersTable = handlersTable;
- }
+ UPDATE_HANDLER_TABLE();
}
ADVANCE(offset);
} else {
@@ -1383,72 +1320,84 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem*
HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL) {
bool success = DoInvoke<kVirtual, false, do_access_check>(self, shadow_frame, inst, &result_register);
+ UPDATE_HANDLER_TABLE();
POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
}
HANDLE_INSTRUCTION_END();
HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE) {
bool success = DoInvoke<kVirtual, true, do_access_check>(self, shadow_frame, inst, &result_register);
+ UPDATE_HANDLER_TABLE();
POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
}
HANDLE_INSTRUCTION_END();
HANDLE_INSTRUCTION_START(INVOKE_SUPER) {
bool success = DoInvoke<kSuper, false, do_access_check>(self, shadow_frame, inst, &result_register);
+ UPDATE_HANDLER_TABLE();
POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
}
HANDLE_INSTRUCTION_END();
HANDLE_INSTRUCTION_START(INVOKE_SUPER_RANGE) {
bool success = DoInvoke<kSuper, true, do_access_check>(self, shadow_frame, inst, &result_register);
+ UPDATE_HANDLER_TABLE();
POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
}
HANDLE_INSTRUCTION_END();
HANDLE_INSTRUCTION_START(INVOKE_DIRECT) {
bool success = DoInvoke<kDirect, false, do_access_check>(self, shadow_frame, inst, &result_register);
+ UPDATE_HANDLER_TABLE();
POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
}
HANDLE_INSTRUCTION_END();
HANDLE_INSTRUCTION_START(INVOKE_DIRECT_RANGE) {
bool success = DoInvoke<kDirect, true, do_access_check>(self, shadow_frame, inst, &result_register);
+ UPDATE_HANDLER_TABLE();
POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
}
HANDLE_INSTRUCTION_END();
HANDLE_INSTRUCTION_START(INVOKE_INTERFACE) {
bool success = DoInvoke<kInterface, false, do_access_check>(self, shadow_frame, inst, &result_register);
+ UPDATE_HANDLER_TABLE();
POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
}
HANDLE_INSTRUCTION_END();
HANDLE_INSTRUCTION_START(INVOKE_INTERFACE_RANGE) {
bool success = DoInvoke<kInterface, true, do_access_check>(self, shadow_frame, inst, &result_register);
+ UPDATE_HANDLER_TABLE();
POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
}
HANDLE_INSTRUCTION_END();
HANDLE_INSTRUCTION_START(INVOKE_STATIC) {
bool success = DoInvoke<kStatic, false, do_access_check>(self, shadow_frame, inst, &result_register);
+ UPDATE_HANDLER_TABLE();
POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
}
HANDLE_INSTRUCTION_END();
HANDLE_INSTRUCTION_START(INVOKE_STATIC_RANGE) {
bool success = DoInvoke<kStatic, true, do_access_check>(self, shadow_frame, inst, &result_register);
+ UPDATE_HANDLER_TABLE();
POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
}
HANDLE_INSTRUCTION_END();
HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_QUICK) {
bool success = DoInvokeVirtualQuick<false>(self, shadow_frame, inst, &result_register);
+ UPDATE_HANDLER_TABLE();
POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
}
HANDLE_INSTRUCTION_END();
HANDLE_INSTRUCTION_START(INVOKE_VIRTUAL_RANGE_QUICK) {
bool success = DoInvokeVirtualQuick<true>(self, shadow_frame, inst, &result_register);
+ UPDATE_HANDLER_TABLE();
POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, 3);
}
HANDLE_INSTRUCTION_END();