summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/interpreter/interpreter_common.h8
-rw-r--r--runtime/interpreter/mterp/mterp.cc5
2 files changed, 10 insertions, 3 deletions
diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h
index 949112de5c..19d971ead8 100644
--- a/runtime/interpreter/interpreter_common.h
+++ b/runtime/interpreter/interpreter_common.h
@@ -948,11 +948,15 @@ NO_RETURN void UnexpectedOpcode(const Instruction* inst, const ShadowFrame& shad
__attribute__((cold))
SHARED_REQUIRES(Locks::mutator_lock_);
+static inline bool TraceExecutionEnabled() {
+ // Return true if you want TraceExecution invocation before each bytecode execution.
+ return false;
+}
+
static inline void TraceExecution(const ShadowFrame& shadow_frame, const Instruction* inst,
const uint32_t dex_pc)
SHARED_REQUIRES(Locks::mutator_lock_) {
- constexpr bool kTracing = false;
- if (kTracing) {
+ if (TraceExecutionEnabled()) {
#define TRACE_LOG std::cerr
std::ostringstream oss;
oss << PrettyMethod(shadow_frame.GetMethod())
diff --git a/runtime/interpreter/mterp/mterp.cc b/runtime/interpreter/mterp/mterp.cc
index 15745d2731..1a90acd799 100644
--- a/runtime/interpreter/mterp/mterp.cc
+++ b/runtime/interpreter/mterp/mterp.cc
@@ -47,7 +47,9 @@ void CheckMterpAsmConstants() {
void InitMterpTls(Thread* self) {
self->SetMterpDefaultIBase(artMterpAsmInstructionStart);
self->SetMterpAltIBase(artMterpAsmAltInstructionStart);
- self->SetMterpCurrentIBase(artMterpAsmInstructionStart);
+ self->SetMterpCurrentIBase(TraceExecutionEnabled() ?
+ artMterpAsmAltInstructionStart :
+ artMterpAsmInstructionStart);
}
/*
@@ -445,6 +447,7 @@ extern "C" void MterpCheckBefore(Thread* self, ShadowFrame* shadow_frame)
} else {
self->AssertNoPendingException();
}
+ TraceExecution(*shadow_frame, inst, shadow_frame->GetDexPC());
}
extern "C" void MterpLogDivideByZeroException(Thread* self, ShadowFrame* shadow_frame)