Add -verbose:interpreter
Adds a mode to track what methods are being interpreted. Good
for debugging interpreter usage during app startup.
Bug: 130185360
Test: test-art-host
Change-Id: I8119f79e534cdad7d6a72d4f01115a288e9c8d9a
diff --git a/cmdline/cmdline_parser_test.cc b/cmdline/cmdline_parser_test.cc
index 101e5c4..052d9ec 100644
--- a/cmdline/cmdline_parser_test.cc
+++ b/cmdline/cmdline_parser_test.cc
@@ -257,7 +257,7 @@
TEST_F(CmdlineParserTest, TestLogVerbosity) {
{
const char* log_args = "-verbose:"
- "class,compiler,gc,heap,jdwp,jni,monitor,profiler,signals,simulator,startup,"
+ "class,compiler,gc,heap,interpreter,jdwp,jni,monitor,profiler,signals,simulator,startup,"
"third-party-jni,threads,verifier,verifier-debug";
LogVerbosity log_verbosity = LogVerbosity();
@@ -265,6 +265,7 @@
log_verbosity.compiler = true;
log_verbosity.gc = true;
log_verbosity.heap = true;
+ log_verbosity.interpreter = true;
log_verbosity.jdwp = true;
log_verbosity.jni = true;
log_verbosity.monitor = true;
diff --git a/cmdline/cmdline_types.h b/cmdline/cmdline_types.h
index a757c91..a83a0dc 100644
--- a/cmdline/cmdline_types.h
+++ b/cmdline/cmdline_types.h
@@ -565,6 +565,8 @@
log_verbosity.gc = true;
} else if (verbose_options[j] == "heap") {
log_verbosity.heap = true;
+ } else if (verbose_options[j] == "interpreter") {
+ log_verbosity.interpreter = true;
} else if (verbose_options[j] == "jdwp") {
log_verbosity.jdwp = true;
} else if (verbose_options[j] == "jit") {
diff --git a/libartbase/base/logging.h b/libartbase/base/logging.h
index 484db87..68ad9fc 100644
--- a/libartbase/base/logging.h
+++ b/libartbase/base/logging.h
@@ -38,6 +38,7 @@
bool deopt;
bool gc;
bool heap;
+ bool interpreter; // Enabled with "-verbose:interpreter".
bool jdwp;
bool jit;
bool jni;
diff --git a/openjdkjvmti/OpenjdkJvmTi.cc b/openjdkjvmti/OpenjdkJvmTi.cc
index ffa1bd3..e889f98 100644
--- a/openjdkjvmti/OpenjdkJvmTi.cc
+++ b/openjdkjvmti/OpenjdkJvmTi.cc
@@ -1414,6 +1414,7 @@
art::gLogVerbosity.compiler = val;
art::gLogVerbosity.deopt = val;
art::gLogVerbosity.heap = val;
+ art::gLogVerbosity.interpreter = val;
art::gLogVerbosity.jdwp = val;
art::gLogVerbosity.jit = val;
art::gLogVerbosity.monitor = val;
diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc
index db116f5..ce242a7 100644
--- a/runtime/interpreter/interpreter.cc
+++ b/runtime/interpreter/interpreter.cc
@@ -321,6 +321,7 @@
DCHECK(!method->SkipAccessChecks() || !method->MustCountLocks());
bool transaction_active = Runtime::Current()->IsActiveTransaction();
+ VLOG(interpreter) << "Interpreting " << method->PrettyMethod();
if (LIKELY(method->SkipAccessChecks())) {
// Enter the "without access check" interpreter.
if (kInterpreterImplKind == kMterpImplKind) {
diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h
index 6366035..19da77d 100644
--- a/runtime/interpreter/interpreter_common.h
+++ b/runtime/interpreter/interpreter_common.h
@@ -33,6 +33,7 @@
#include "art_method-inl.h"
#include "base/enums.h"
#include "base/locks.h"
+#include "base/logging.h"
#include "base/macros.h"
#include "class_linker-inl.h"
#include "class_root.h"
@@ -278,6 +279,8 @@
self->PushShadowFrame(new_shadow_frame);
self->EndAssertNoThreadSuspension(old_cause);
+ VLOG(interpreter) << "Interpreting " << called_method->PrettyMethod();
+
DCheckStaticState(self, called_method);
while (true) {
// Mterp does not support all instrumentation/debugging.
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index 346ae26..2f8ee02 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -481,6 +481,7 @@
// gLogVerbosity.deopt = true; // TODO: don't check this in!
// gLogVerbosity.gc = true; // TODO: don't check this in!
// gLogVerbosity.heap = true; // TODO: don't check this in!
+ // gLogVerbosity.interpreter = true; // TODO: don't check this in!
// gLogVerbosity.jdwp = true; // TODO: don't check this in!
// gLogVerbosity.jit = true; // TODO: don't check this in!
// gLogVerbosity.jni = true; // TODO: don't check this in!
diff --git a/runtime/parsed_options_test.cc b/runtime/parsed_options_test.cc
index 75952bb..dd9ca23 100644
--- a/runtime/parsed_options_test.cc
+++ b/runtime/parsed_options_test.cc
@@ -100,6 +100,7 @@
EXPECT_FALSE(VLOG_IS_ON(compiler));
EXPECT_FALSE(VLOG_IS_ON(heap));
EXPECT_TRUE(VLOG_IS_ON(gc));
+ EXPECT_FALSE(VLOG_IS_ON(interpreter));
EXPECT_FALSE(VLOG_IS_ON(jdwp));
EXPECT_TRUE(VLOG_IS_ON(jni));
EXPECT_FALSE(VLOG_IS_ON(monitor));