diff options
author | buzbee <buzbee@google.com> | 2011-01-19 15:31:15 -0800 |
---|---|---|
committer | buzbee <buzbee@google.com> | 2011-01-19 16:39:41 -0800 |
commit | 18fba346582c08d81aa96d9508c0e935bad5f36f (patch) | |
tree | f69072fa267c06e5a3036c76fc37ba1df9c88f67 /vm/mterp/out/InterpAsm-armv5te.S | |
parent | 9238eb89ea5f0564047a2a2f040a2229d42f6f63 (diff) | |
download | android_dalvik-18fba346582c08d81aa96d9508c0e935bad5f36f.tar.gz android_dalvik-18fba346582c08d81aa96d9508c0e935bad5f36f.tar.bz2 android_dalvik-18fba346582c08d81aa96d9508c0e935bad5f36f.zip |
Support traceview-style profiling in all builds
This change builds on an earlier bccheng change that allowed JIT'd code
to avoid reverting to the debug portable interpeter when doing traceview-style
method profiling. That CL introduced a new traceview build (libdvm_traceview)
because the performance delta was too great to enable the capability for
all builds.
In this CL, we remove the libdvm_traceview build and provide full-speed
method tracing in all builds. This is done by introducing "_PROF"
versions of invoke and return templates used by the JIT. Normally, these
templates are not used, and performace in unaffected. However, when method
profiling is enabled, all existing translation are purged and new translations
are created using the _PROF templates. These templates introduce a
smallish performance penalty above and beyond the actual tracing cost, but
again are only used when tracing has been enabled.
Strictly speaking, there is a slight burden that is placed on invokes and
returns in the non-tracing case - on the order of an additional 3 or 4
cycles per invoke/return. Those operations are already heavyweight enough
that I was unable to measure the added cost in benchmarks.
Change-Id: Ic09baf4249f1e716e136a65458f4e06cea35fc18
Diffstat (limited to 'vm/mterp/out/InterpAsm-armv5te.S')
-rw-r--r-- | vm/mterp/out/InterpAsm-armv5te.S | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/vm/mterp/out/InterpAsm-armv5te.S b/vm/mterp/out/InterpAsm-armv5te.S index ce1f7f070..5fef4bd1f 100644 --- a/vm/mterp/out/InterpAsm-armv5te.S +++ b/vm/mterp/out/InterpAsm-armv5te.S @@ -14103,11 +14103,7 @@ common_periodicChecks: * source-level single-stepping requires Dalvik singlestepping. * GC may require a one-shot action and then full-speed resumption. */ -#if defined(WITH_INLINE_PROFILING) ands r1, #(kSubModeDebuggerActive | kSubModeEmulatorTrace | kSubModeInstCounting) -#else - ands r1, #(kSubModeDebuggerActive | kSubModeEmulatorTrace | kSubModeInstCounting | kSubModeMethodTrace) -#endif bxeq lr @ nothing to do, return @ debugger/profiler enabled, bail out; glue->entryPoint was set above @@ -14237,10 +14233,12 @@ common_invokeMethodNoRange: ldr r9, [rGLUE, #offGlue_interpStackEnd] @ r9<- interpStackEnd sub r3, r10, r3, lsl #2 @ r3<- bottom (newsave - outsSize) cmp r3, r9 @ bottom < interpStackEnd? + ldr lr, [rGLUE, #offGlue_pInterpBreak] ldr r3, [r0, #offMethod_accessFlags] @ r3<- methodToCall->accessFlags blo .LstackOverflow @ yes, this frame will overflow stack @ set up newSaveArea + ldr lr, [lr] @ lr<- active submodes #ifdef EASY_GDB SAVEAREA_FROM_FP(ip, rFP) @ ip<- stack save area str ip, [r10, #offStackSaveArea_prevSave] @@ -14251,13 +14249,14 @@ common_invokeMethodNoRange: mov r9, #0 str r9, [r10, #offStackSaveArea_returnAddr] #endif -#if defined(WITH_INLINE_PROFILING) + ands lr, #kSubModeMethodTrace @ method tracing? + beq 1f @ skip if not stmfd sp!, {r0-r3} @ preserve r0-r3 mov r1, r6 @ r0=methodToCall, r1=rGlue bl dvmFastMethodTraceEnter ldmfd sp!, {r0-r3} @ restore r0-r3 -#endif +1: str r0, [r10, #offStackSaveArea_method] tst r3, #ACC_NATIVE bne .LinvokeNative @@ -14307,9 +14306,11 @@ common_invokeMethodNoRange: @ Prep for the native call @ r0=methodToCall, r1=newFp, r10=newSaveArea ldr r3, [rGLUE, #offGlue_self] @ r3<- glue->self + ldr lr, [rGLUE, #offGlue_pInterpBreak] ldr r9, [r3, #offThread_jniLocal_topCookie] @ r9<- thread->localRef->... str r1, [r3, #offThread_curFrame] @ self->curFrame = newFp str r9, [r10, #offStackSaveArea_localRefCookie] @newFp->localRefCookie=top + ldr lr, [lr] @ lr<- active submodes mov r9, r3 @ r9<- glue->self (preserve) mov r2, r0 @ r2<- methodToCall @@ -14327,20 +14328,24 @@ dalvik_mterp: .Lskip: #endif -#if defined(WITH_INLINE_PROFILING) + ands lr, #kSubModeMethodTrace @ method tracing? + beq 110f @ hop if not @ r2=JNIMethod, r6=rGLUE stmfd sp!, {r2,r6} -#endif mov lr, pc @ set return addr ldr pc, [r2, #offMethod_nativeFunc] @ pc<- methodToCall->nativeFunc -#if defined(WITH_INLINE_PROFILING) @ r0=JNIMethod, r1=rGLUE ldmfd sp!, {r0-r1} bl dvmFastNativeMethodTraceExit -#endif - + @ r2=JNIMethod, r6=rGLUE + stmfd sp!, {r2,r6} + b 220f +110: + mov lr, pc @ set return addr + ldr pc, [r2, #offMethod_nativeFunc] @ pc<- methodToCall->nativeFunc +220: #if defined(WITH_JIT) ldr r3, [rGLUE, #offGlue_ppJitProfTable] @ Refresh Jit's on/off status #endif @@ -14413,19 +14418,22 @@ common_returnFromMethod: mov r9, #0 bl common_periodicChecks -#if defined(WITH_INLINE_PROFILING) + ldr lr, [rGLUE, #offGlue_pInterpBreak] + SAVEAREA_FROM_FP(r0, rFP) + ldr lr, [lr] @ lr<- active submodes + ldr r9, [r0, #offStackSaveArea_savedPc] @ r9 = saveArea->savedPc + ands lr, #kSubModeMethodTrace @ method tracing? + beq 333f stmfd sp!, {r0-r3} @ preserve r0-r3 mov r0, r6 @ r0=rGlue bl dvmFastJavaMethodTraceExit ldmfd sp!, {r0-r3} @ restore r0-r3 -#endif - SAVEAREA_FROM_FP(r0, rFP) @ r0<- saveArea (old) +333: ldr rFP, [r0, #offStackSaveArea_prevFrame] @ fp = saveArea->prevFrame - ldr r9, [r0, #offStackSaveArea_savedPc] @ r9 = saveArea->savedPc + ldr r3, [rGLUE, #offGlue_self] @ r3<- glue->self ldr r2, [rFP, #(offStackSaveArea_method - sizeofStackSaveArea)] @ r2<- method we're returning to - ldr r3, [rGLUE, #offGlue_self] @ r3<- glue->self cmp r2, #0 @ is this a break frame? #if defined(WORKAROUND_CORTEX_A9_745320) /* Don't use conditional loads if the HW defect exists */ |