summaryrefslogtreecommitdiffstats
path: root/vm/compiler/Compiler.h
diff options
context:
space:
mode:
authorbuzbee <buzbee@google.com>2011-02-11 17:48:20 -0800
committerbuzbee <buzbee@google.com>2011-02-19 13:35:30 -0800
commit9f601a917c8878204482c37aec7005054b6776fa (patch)
treef98216746f7d84c894627cb6256e5be66ca1a1f8 /vm/compiler/Compiler.h
parentf7f82d5e083f6c99d0dd6de213650751ca314cff (diff)
downloadandroid_dalvik-9f601a917c8878204482c37aec7005054b6776fa.tar.gz
android_dalvik-9f601a917c8878204482c37aec7005054b6776fa.tar.bz2
android_dalvik-9f601a917c8878204482c37aec7005054b6776fa.zip
Interpreter restructuring: eliminate InterpState
The key datastructure for the interpreter is InterpState. This change eliminates it, merging its data with the Thread structure. Here's why: In principio creavit Fadden Thread et InterpState. And it was good. Thread holds thread-private state, while InterpState captures data associated with a Dalvik interpreter activation. Because JNI calls can result in nested interpreter invocations, we can have more than one InterpState for each actual thread. InterpState was relatively small, and it all worked well. It was used enough that in the Arm version a register (rGLUE) was dedicated to it. Then, along came the JIT guys, who saw InterpState as a convenient place to dump all sorts of useful data that they wanted quick access to through that dedicated register. InterpState grew and grew. In terms of space, this wasn't a big problem - but it did mean that the initialization cost of each interpreter activation grew as well. For applications that do a lot of callbacks from native code into Dalvik, this is measurable. It's also mostly useless cost because much of the JIT-related InterpState initialization was setting up useful constants - things that don't need to be saved and restored all the time. The biggest problem, though, deals with thread control. When something interesting is happening that needs all threads to be stopped (such as GC and debugger attach), we have access to all of the Thread structures, but we don't have access to all of the InterpState structures (which may be buried/nested on the native stack). As a result, polling for thread suspension is done via a one-indirection pointer chase. InterpState itself can't hold the stop bits because we can't always find it, so instead it holds a pointer to the global or thread-specific stop control. Yuck. With this change, we eliminate InterpState and merge all needed data into Thread. Further, we replace the decidated rGLUE register with a pointer to the Thread structure (rSELF). The small subset of state data that needs to be saved and restored across nested interpreter activations is collected into a record that is saved to the interpreter frame, and restored on exit. Further, these small records are linked together to allow tracebacks to show nested activations. Old InterpState variables that simply contain useful constants are initialized once at thread creation time. This CL is large enough by itself that the new ability to streamline suspend checks is not done here - that will happen in a future CL. Here we just focus on consolidation. Change-Id: Ide6b2fb85716fea454ac113f5611263a96687356
Diffstat (limited to 'vm/compiler/Compiler.h')
-rw-r--r--vm/compiler/Compiler.h77
1 files changed, 0 insertions, 77 deletions
diff --git a/vm/compiler/Compiler.h b/vm/compiler/Compiler.h
index 7533e2630..c566aa6c4 100644
--- a/vm/compiler/Compiler.h
+++ b/vm/compiler/Compiler.h
@@ -25,7 +25,6 @@
* #define SIGNATURE_BREAKPOINT
*/
-#define MAX_JIT_RUN_LEN 64
#define COMPILER_WORK_QUEUE_SIZE 100
#define COMPILER_IC_PATCH_QUEUE_SIZE 64
@@ -119,82 +118,6 @@ typedef struct ICPatchWorkOrder {
PredictedChainingCell cellContent; /* content of the new cell */
} ICPatchWorkOrder;
-/* States of the dbg interpreter when serving a JIT-related request */
-typedef enum JitState {
- /* Entering states in the debug interpreter */
- kJitNot = 0, // Non-JIT related reasons */
- kJitTSelectRequest = 1, // Request a trace (subject to filtering)
- kJitTSelectRequestHot = 2, // Request a hot trace (bypass the filter)
- kJitSelfVerification = 3, // Self Verification Mode
-
- /* Operational states in the debug interpreter */
- kJitTSelect = 4, // Actively selecting a trace
- kJitTSelectEnd = 5, // Done with the trace - wrap it up
- kJitSingleStep = 6, // Single step interpretation
- kJitSingleStepEnd = 7, // Done with single step, ready return to mterp
- kJitDone = 8, // Ready to leave the debug interpreter
-} JitState;
-
-#if defined(WITH_SELF_VERIFICATION)
-typedef enum SelfVerificationState {
- kSVSIdle = 0, // Idle
- kSVSStart = 1, // Shadow space set up, running compiled code
- kSVSPunt = 2, // Exiting compiled code by punting
- kSVSSingleStep = 3, // Exiting compiled code by single stepping
- kSVSNoProfile = 4, // Exiting compiled code and don't collect profiles
- kSVSTraceSelect = 5, // Exiting compiled code and compile the next pc
- kSVSNormal = 6, // Exiting compiled code normally
- kSVSNoChain = 7, // Exiting compiled code by no chain
- kSVSBackwardBranch = 8, // Exiting compiled code with backward branch trace
- kSVSDebugInterp = 9, // Normal state restored, running debug interpreter
-} SelfVerificationState;
-#endif
-
-typedef enum JitHint {
- kJitHintNone = 0,
- kJitHintTaken = 1, // Last inst in run was taken branch
- kJitHintNotTaken = 2, // Last inst in run was not taken branch
- kJitHintNoBias = 3, // Last inst in run was unbiased branch
-} jitHint;
-
-/*
- * Element of a Jit trace description. If the isCode bit is set, it describes
- * a contiguous sequence of Dalvik byte codes.
- */
-typedef struct {
- unsigned isCode:1; // If set denotes code fragments
- unsigned numInsts:8; // Number of Byte codes in run
- unsigned runEnd:1; // Run ends with last byte code
- jitHint hint:6; // Hint to apply to final code of run
- u2 startOffset; // Starting offset for trace run
-} JitCodeDesc;
-
-/*
- * A complete list of trace runs passed to the compiler looks like the
- * following:
- * frag1
- * frag2
- * frag3
- * meta1
- * meta2
- * frag4
- *
- * frags 1-4 have the "isCode" field set, and metas 1-2 are plain pointers or
- * pointers to auxiliary data structures as long as the LSB is null.
- * The meaning of the meta content is loosely defined. It is usually the code
- * fragment right before the first meta field (frag3 in this case) to
- * understand and parse them. Frag4 could be a dummy one with 0 "numInsts" but
- * the "runEnd" field set.
- *
- * For example, if a trace run contains a method inlining target, the class
- * type of "this" and the currently resolved method pointer are two instances
- * of meta information stored there.
- */
-typedef union {
- JitCodeDesc frag;
- void* meta;
-} JitTraceRun;
-
/*
* Trace description as will appear in the translation cache. Note
* flexible array at end, as these will be of variable size. To