diff options
author | buzbee <buzbee@google.com> | 2011-01-14 13:37:31 -0800 |
---|---|---|
committer | buzbee <buzbee@google.com> | 2011-01-19 10:00:50 -0800 |
commit | cb3081f675109049e63380170b60871e8275f9a8 (patch) | |
tree | 9ec66b046bb21b93ef53b4969873042ef60bf89b /vm/Profile.h | |
parent | 442d65246ad6c863e8e58a100f5238387865dbdb (diff) | |
download | android_dalvik-cb3081f675109049e63380170b60871e8275f9a8.tar.gz android_dalvik-cb3081f675109049e63380170b60871e8275f9a8.tar.bz2 android_dalvik-cb3081f675109049e63380170b60871e8275f9a8.zip |
Consolidate mterp's debug/profile/suspend control
This is a step towards full debug & profiling support in JIT'd code.
Previously, the interpreter made multiple distinct checks for pending
suspend requests, debugger and profiler checks at each safe point.
This CL moves the individual controls into a single control word,
significantly speeding up the safe-point check code path in the common
fast case.
In short, any time some VM component wants control to break at a safe
point it will set a bit in gDvm.interpBreak, which will be examined
at the safe point check in footer.S. In the old code, the safe point
check consisted of 11 instructions (including 6 loads). The new sequence
is 6 instructions (4 loads - two of which are needed and two are
speculative to fill otherwise stalling slots).
This code path is hot enough in the interpreter that we actually see
some measureable speedups in benchmarks. The old sieve benchmark
improves from 252 to 256 (~1.5%).
As part of the change, global debuggerActive and activeProfilers variables
have been eliminated as redundant. Note also that there is a subtle
change in thread suspension. Thread suspend request counts are kept on
a per-thread basis, and previously each thread would only examine its own
suspend count. With this change, a bit has been allocated in interpBreak
to signify that at least one suspend request is active across all
threads. This bit is treated as "some thread is supposed to
suspend, check to see if it's me".
Change-Id: I527dc918f58d1486ef3324136080ef541a775ba8
Diffstat (limited to 'vm/Profile.h')
-rw-r--r-- | vm/Profile.h | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/vm/Profile.h b/vm/Profile.h index dd3825202..167eafe4e 100644 --- a/vm/Profile.h +++ b/vm/Profile.h @@ -113,30 +113,24 @@ enum { */ #define TRACE_METHOD_ENTER(_self, _method) \ do { \ - if (gDvm.activeProfilers != 0) { \ - if (gDvm.methodTrace.traceEnabled) \ - dvmMethodTraceAdd(_self, _method, METHOD_TRACE_ENTER); \ - if (gDvm.emulatorTraceEnableCount != 0) \ - dvmEmitEmulatorTrace(_method, METHOD_TRACE_ENTER); \ - } \ + if (gDvm.interpBreak & kSubModeMethodTrace) \ + dvmMethodTraceAdd(_self, _method, METHOD_TRACE_ENTER); \ + if (gDvm.interpBreak & kSubModeEmulatorTrace) \ + dvmEmitEmulatorTrace(_method, METHOD_TRACE_ENTER); \ } while(0); #define TRACE_METHOD_EXIT(_self, _method) \ do { \ - if (gDvm.activeProfilers != 0) { \ - if (gDvm.methodTrace.traceEnabled) \ - dvmMethodTraceAdd(_self, _method, METHOD_TRACE_EXIT); \ - if (gDvm.emulatorTraceEnableCount != 0) \ - dvmEmitEmulatorTrace(_method, METHOD_TRACE_EXIT); \ - } \ + if (gDvm.interpBreak & kSubModeMethodTrace) \ + dvmMethodTraceAdd(_self, _method, METHOD_TRACE_EXIT); \ + if (gDvm.interpBreak & kSubModeEmulatorTrace) \ + dvmEmitEmulatorTrace(_method, METHOD_TRACE_EXIT); \ } while(0); #define TRACE_METHOD_UNROLL(_self, _method) \ do { \ - if (gDvm.activeProfilers != 0) { \ - if (gDvm.methodTrace.traceEnabled) \ - dvmMethodTraceAdd(_self, _method, METHOD_TRACE_UNROLL); \ - if (gDvm.emulatorTraceEnableCount != 0) \ - dvmEmitEmulatorTrace(_method, METHOD_TRACE_UNROLL); \ - } \ + if (gDvm.interpBreak & kSubModeMethodTrace) \ + dvmMethodTraceAdd(_self, _method, METHOD_TRACE_UNROLL); \ + if (gDvm.interpBreak & kSubModeEmulatorTrace) \ + dvmEmitEmulatorTrace(_method, METHOD_TRACE_UNROLL); \ } while(0); void dvmMethodTraceAdd(struct Thread* self, const Method* method, int action); |