summaryrefslogtreecommitdiffstats
path: root/vm/Globals.h
diff options
context:
space:
mode:
authorbuzbee <buzbee@google.com>2011-03-02 15:43:48 -0800
committerbuzbee <buzbee@google.com>2011-03-23 10:41:35 -0700
commit9a3147c7412f4794434b4c2604aa2ba784867774 (patch)
tree857eef2fd64a81a708d7c3b650b06b20794238e1 /vm/Globals.h
parentc28b465ea4d8d58d1bf3451b3f580a4197e52d9d (diff)
downloadandroid_dalvik-9a3147c7412f4794434b4c2604aa2ba784867774.tar.gz
android_dalvik-9a3147c7412f4794434b4c2604aa2ba784867774.tar.bz2
android_dalvik-9a3147c7412f4794434b4c2604aa2ba784867774.zip
Interpreter restructuring
This is a restructuring of the Dalvik ARM and x86 interpreters: o Combine the old portstd and portdbg interpreters into a single portable interpreter. o Add debug/profiling support to the fast (mterp) interpreters. o Delete old mechansim of switching between interpreters. Now, once you choose an interpreter at startup, you stick with it. o Allow JIT to co-exist with profiling & debugging (necessary for first-class support of debugging with the JIT active). o Adds single-step capability to the fast assembly interpreters without slowing them down (and, in fact, measurably improves their performance). o Remove old "polling for safe point" mechanism. Breakouts now achieved via modifying base of interpreter handler table. o Simplify interpeter control mechanism. o Allow thread-granularity control for profiling & debugging The primary motivation behind this change was to improve the responsiveness of debugging and profiling and to make it easier to add new debugging and profiling capabilities in the future. Instead of always bailing out to the slow debug portable interpreter, we can now stay in the fast interpreter. A nice side effect of the change is that the fast interpreters got a healthy speed boost because we were able to replace the polling safepoint check that involved a dozen or so instructions with a single table-base reload. When combined with the two earlier CLs related to this restructuring, we show a 5.6% performance improvement using libdvm_interp.so on the Checkers benchmark relative to Honeycomb. Change-Id: I8d37e866b3618def4e582fc73f1cf69ffe428f3c
Diffstat (limited to 'vm/Globals.h')
-rw-r--r--vm/Globals.h51
1 files changed, 16 insertions, 35 deletions
diff --git a/vm/Globals.h b/vm/Globals.h
index 502926d9a..7ea4e8aca 100644
--- a/vm/Globals.h
+++ b/vm/Globals.h
@@ -51,33 +51,6 @@ typedef struct AssertionControl {
} AssertionControl;
/*
- * Execution mode, e.g. interpreter vs. JIT.
- */
-typedef enum ExecutionMode {
- kExecutionModeUnknown = 0,
- kExecutionModeInterpPortable,
- kExecutionModeInterpFast,
-#if defined(WITH_JIT)
- kExecutionModeJit,
-#endif
-} ExecutionMode;
-
-/*
- * Execution sub modes, e.g. debugging, profiling, etc.
- * Treated as bit flags for fast access. These values are used directly
- * by assembly code in the mterp interpeter and may also be used by
- * code generated by the JIT. Take care when changing.
- */
-typedef enum ExecutionSubModes {
- kSubModeNormal = 0x00,
- kSubModeMethodTrace = 0x01,
- kSubModeEmulatorTrace = 0x02,
- kSubModeInstCounting = 0x04,
- kSubModeDebuggerActive = 0x08,
- kSubModeSuspendRequest = 0x10, /* Set if any suspend request active */
-} ExecutionSubModes;
-
-/*
* Register map generation mode. Only applicable when generateRegisterMaps
* is enabled. (The "disabled" state is not folded into this because
* there are callers like dexopt that want to enable/disable without
@@ -452,9 +425,9 @@ struct DvmGlobals {
pthread_mutex_t _threadSuspendLock;
/*
- * Guards Thread->suspendCount for all threads, and provides the lock
- * for the condition variable that all suspended threads sleep on
- * (threadSuspendCountCond).
+ * Guards Thread->interpBreak.ctl.suspendCount for all threads, and
+ * provides the lock for the condition variable that all suspended threads
+ * sleep on (threadSuspendCountCond).
*
* This has to be separate from threadListLock because of the way
* threads put themselves to sleep.
@@ -610,8 +583,13 @@ struct DvmGlobals {
/*
* JDWP debugger support.
+ *
+ * Note: Each thread will normally determine whether the debugger is active
+ * for it by referring to its subMode flags. "debuggerActive" here should be
+ * seen as "debugger is making requests of 1 or more threads".
*/
bool debuggerConnected; /* debugger or DDMS is connected */
+ bool debuggerActive; /* debugger is making requests */
JdwpState* jdwpState;
/*
@@ -652,12 +630,15 @@ struct DvmGlobals {
int allocRecordCount; /* #of valid entries */
/*
- * When normal control flow needs to be interrupted because
- * of an attached debugger, profiler, thread stop request, etc.,
- * a bit is set here. We collapse all stop reasons into
- * a single location for performance reasons.
+ * When a profiler is enabled, this is incremented. Distinct profilers
+ * include "dmtrace" method tracing, emulator method tracing, and
+ * possibly instruction counting.
+ *
+ * The purpose of this is to have a single value that shows whether any
+ * profiling is going on. Individual thread will normally check their
+ * thread-private subMode flags to take any profiling action.
*/
- volatile int interpBreak;
+ volatile int activeProfilers;
/*
* State for method-trace profiling.