[讨论] [Dalvik VM] JIT划分状态是根据什么而来的?&&SelfVerification在JIT中的角色是什么呢?其状态划分依据是?
pzz2011
2014-11-08
首先向R大表示感谢,同时也为我一直以来在R大提供回答后未能有进一步思考表示遗憾与抱歉(因为确实对整个代码还不熟悉,很多基础还要补充)
下面是我的问题: (DVM中)Jit划分状态是根据什么而来的?&&SelfVerification在jit中的角色是什么呢?其状态划分依据是? 在vm/interp/InterpState.h中: /* States of the interpreter when serving a JIT-related request */ 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 kJitDone = 6, // No further JIT actions for interpBreak }; #if defined(WITH_SELF_VERIFICATION) 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 }; #endif /* Number of entries in the 2nd level JIT profiler filter cache */ #define JIT_TRACE_THRESH_FILTER_SIZE 32 /* Number of low dalvik pc address bits to include in 2nd level filter key */ #define JIT_TRACE_THRESH_FILTER_PC_BITS 16 #define MAX_JIT_RUN_LEN 64 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 }; /* * Element of a Jit trace description. If the isCode bit is set, it describes * a contiguous sequence of Dalvik byte codes. */ struct JitCodeDesc { unsigned numInsts:8; // Number of Byte codes in run unsigned runEnd:1; // Run ends with last byte code JitHint hint:7; // Hint to apply to final code of run u2 startOffset; // Starting offset for trace run }; /* * A complete list of trace runs passed to the compiler looks like the * following: * frag1 * frag2 * frag3 * meta1 * : * metan * frag4 * * frags 1-4 have the "isCode" field set and describe the location/length of * real code traces, while metas 1-n are misc information. * 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 * descriptor/loader of "this" and the currently resolved method pointer are * three instances of meta information stored there. */ struct JitTraceRun { union { JitCodeDesc frag; void* meta; } info; u4 isCode:1; u4 unused:31; }; 还有关于jit chaining是什么东西呢? /* * A complete list of trace runs passed to the compiler looks like the * following: * frag1 * frag2 * frag3 * meta1 * : * metan * frag4 * * frags 1-4 have the "isCode" field set and describe the location/length of * real code traces, while metas 1-n are misc information. * 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 * descriptor/loader of "this" and the currently resolved method pointer are * three instances of meta information stored there.*/ 这段注释没看懂,不知道: * A complete list of trace runs passed to the compiler looks like the * following: * frag1 * frag2 * frag3 * meta1 * : * metan * frag4 想表达什么意思!! |