diff options
author | Ben Cheng <bccheng@android.com> | 2010-01-26 16:46:15 -0800 |
---|---|---|
committer | Ben Cheng <bccheng@android.com> | 2010-02-03 17:46:39 -0800 |
commit | c3b92b26df6416d3179e865adccb283ee4170ab1 (patch) | |
tree | c958be4e631bc827b378a5e10954adfea0b230e0 /vm/compiler/Compiler.h | |
parent | c9e63cbc096ec112aa97fa078c6e38c05f64c703 (diff) | |
download | android_dalvik-c3b92b26df6416d3179e865adccb283ee4170ab1.tar.gz android_dalvik-c3b92b26df6416d3179e865adccb283ee4170ab1.tar.bz2 android_dalvik-c3b92b26df6416d3179e865adccb283ee4170ab1.zip |
Fix performance issues related to chaining and unchaining.
1) Patching requests for predicted chaining cells (used by virtual/interface
methods) are now batched in a queue and processed when the VM is paused for GC.
2) When the code cache is full the reset operation is also conducted at the
end of GC pauses so this totally eliminates the need for the compiler thread
to issue suspend-all requests. This is a very rare event and when happening it
takes less than 5ms to finish.
3) Change the initial value of the branch in a predicted chaining cell from 0
(ie lsl r0, r0, #0) to 0xe7fe (ie branch to self) so that initializing a
predicted chaining cell doesn't need to suspend all threads. Together with 1)
seeing 20% speedup on some benchmarks.
4) Add TestCompability.c where defining "TEST_VM_IN_ECLAIR := true" in
buildspec.mk will activate dummy symbols needed to run libdvm.so in older
releases.
Bug: 2397689
Bug: 2396513
Bug: 2331313
Diffstat (limited to 'vm/compiler/Compiler.h')
-rw-r--r-- | vm/compiler/Compiler.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/vm/compiler/Compiler.h b/vm/compiler/Compiler.h index 6b4d41424..153e84568 100644 --- a/vm/compiler/Compiler.h +++ b/vm/compiler/Compiler.h @@ -22,6 +22,7 @@ #define CODE_CACHE_SIZE 1024*1024 #define MAX_JIT_RUN_LEN 64 #define COMPILER_WORK_QUEUE_SIZE 100 +#define COMPILER_IC_PATCH_QUEUE_SIZE 64 #define COMPILER_TRACED(X) #define COMPILER_TRACEE(X) @@ -49,7 +50,6 @@ 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) - kWorkOrderICPatch = 4, // Work is to patch a polymorphic callsite } WorkOrderKind; typedef struct CompilerWorkOrder { @@ -59,6 +59,20 @@ typedef struct CompilerWorkOrder { JitTranslationInfo result; } CompilerWorkOrder; +/* Chain cell for predicted method invocation */ +typedef struct PredictedChainingCell { + u4 branch; /* Branch to chained destination */ + const ClassObject *clazz; /* key #1 for prediction */ + const Method *method; /* key #2 to lookup native PC from dalvik PC */ + u4 counter; /* counter to patch the chaining cell */ +} PredictedChainingCell; + +/* Work order for inline cache patching */ +typedef struct ICPatchWorkOrder { + PredictedChainingCell *cellAddr; /* Address to be patched */ + PredictedChainingCell cellContent; /* content of the new cell */ +} ICPatchWorkOrder; + typedef enum JitState { kJitOff = 0, kJitNormal = 1, // Profiling in mterp or running native |