diff options
author | buzbee <buzbee@google.com> | 2010-12-15 16:32:35 -0800 |
---|---|---|
committer | buzbee <buzbee@google.com> | 2010-12-17 12:13:59 -0800 |
commit | 2e152baec01433de9c63633ebc6f4adf1cea3a87 (patch) | |
tree | ab5329129870bdd66296d776374d9e4bed05e8e6 /vm/compiler/Compiler.h | |
parent | 08c2f9fc9cd7c1cb36c31d6f15b4d13a7cc15432 (diff) | |
download | android_dalvik-2e152baec01433de9c63633ebc6f4adf1cea3a87.tar.gz android_dalvik-2e152baec01433de9c63633ebc6f4adf1cea3a87.tar.bz2 android_dalvik-2e152baec01433de9c63633ebc6f4adf1cea3a87.zip |
[JIT] Trace profiling support
In preparation for method compilation, this CL causes all traces to
include two entry points: profiling and non-profiling. For now, the
profiling entry will only be used if dalvik is run with -Xjitprofile,
and largely works like it did before. The difference is that profiling
support no longer requires the "assert" build - it's always there now.
This will enable us to do a form of sampling profiling of
traces in order to identify hot methods or hot trace groups,
while keeping the overhead low by only switching profiling on periodically.
To turn the periodic profiling on and off, we simply unchain all existing
translations and set the appropriate global profile state. The underlying
translation lookup and chaining utilties will examine the profile state to
determine which entry point to use (i.e. - profiling or non-profiling) while
the traces naturally rechain during further execution.
Change-Id: I9ee33e69e33869b9fab3a57e88f9bc524175172b
Diffstat (limited to 'vm/compiler/Compiler.h')
-rw-r--r-- | vm/compiler/Compiler.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/vm/compiler/Compiler.h b/vm/compiler/Compiler.h index 0a43df3c9..cd9d21bb3 100644 --- a/vm/compiler/Compiler.h +++ b/vm/compiler/Compiler.h @@ -45,15 +45,8 @@ #define COMPILER_TRACE_CHAINING(X) /* Macro to change the permissions applied to a chunk of the code cache */ -#if !defined(WITH_JIT_TUNING) #define PROTECT_CODE_CACHE_ATTRS (PROT_READ | PROT_EXEC) #define UNPROTECT_CODE_CACHE_ATTRS (PROT_READ | PROT_EXEC | PROT_WRITE) -#else -/* When doing JIT profiling always grant the write permission */ -#define PROTECT_CODE_CACHE_ATTRS (PROT_READ | PROT_EXEC | \ - (gDvmJit.profile ? PROT_WRITE : 0)) -#define UNPROTECT_CODE_CACHE_ATTRS (PROT_READ | PROT_EXEC | PROT_WRITE) -#endif /* Acquire the lock before removing PROT_WRITE from the specified mem region */ #define UNPROTECT_CODE_CACHE(addr, size) \ @@ -90,6 +83,7 @@ typedef enum JitInstructionSetType { typedef struct JitTranslationInfo { void *codeAddress; JitInstructionSetType instructionSet; + int profileCodeSize; bool discardResult; // Used for debugging divergence and IC patching bool methodCompilationAborted; // Cannot compile the whole method Thread *requestingThread; // For debugging purpose @@ -100,6 +94,7 @@ typedef enum WorkOrderKind { kWorkOrderMethod = 1, // Work is to compile a whole method kWorkOrderTrace = 2, // Work is to compile code fragment(s) kWorkOrderTraceDebug = 3, // Work is to compile/debug code fragment(s) + kWorkOrderProfileMode = 4, // Change profiling mode } WorkOrderKind; typedef struct CompilerWorkOrder { |