TEMPLATE_RETURN.S revision 7a2697d327936e20ef5484f7819e2e4bf91c891f
1    /*
2     * Unwind a frame from the Dalvik stack for compiled OP_RETURN_XXX.
3     * If the stored value in returnAddr
4     * is non-zero, the caller is compiled by the JIT thus return to the
5     * address in the code cache following the invoke instruction. Otherwise
6     * return to the special dvmJitToInterpNoChain entry point.
7     */
8    SAVEAREA_FROM_FP(r0, rFP)           @ r0<- saveArea (old)
9    ldr     r10, [r0, #offStackSaveArea_prevFrame] @ r10<- saveArea->prevFrame
10    ldr     r8, [rGLUE, #offGlue_pSelfSuspendCount] @ r8<- &suspendCount
11    ldr     rPC, [r0, #offStackSaveArea_savedPc] @ rPC<- saveArea->savedPc
12#if !defined(WITH_SELF_VERIFICATION)
13    ldr     r9,  [r0, #offStackSaveArea_returnAddr] @ r9<- chaining cell ret
14#else
15    mov     r9, #0                      @ disable chaining
16#endif
17    ldr     r2, [r10, #(offStackSaveArea_method - sizeofStackSaveArea)]
18                                        @ r2<- method we're returning to
19    ldr     r3, [rGLUE, #offGlue_self]  @ r3<- glue->self
20    cmp     r2, #0                      @ break frame?
21#if !defined(WITH_SELF_VERIFICATION)
22    beq     1f                          @ bail to interpreter
23#else
24    blxeq   lr                          @ punt to interpreter and compare state
25#endif
26    ldr     r1, .LdvmJitToInterpNoChainNoProfile @ defined in footer.S
27    mov     rFP, r10                    @ publish new FP
28    ldrne   r10, [r2, #offMethod_clazz] @ r10<- method->clazz
29    ldr     r8, [r8]                    @ r8<- suspendCount
30
31    str     r2, [rGLUE, #offGlue_method]@ glue->method = newSave->method
32    ldr     r0, [r10, #offClassObject_pDvmDex] @ r0<- method->clazz->pDvmDex
33    str     rFP, [r3, #offThread_curFrame] @ self->curFrame = fp
34    add     rPC, rPC, #6                @ publish new rPC (advance 6 bytes)
35    str     r0, [rGLUE, #offGlue_methodClassDex]
36    cmp     r8, #0                      @ check the suspendCount
37    movne   r9, #0                      @ clear the chaining cell address
38    str     r9, [r3, #offThread_inJitCodeCache] @ in code cache or not
39    cmp     r9, #0                      @ chaining cell exists?
40    blxne   r9                          @ jump to the chaining cell
41#if defined(WITH_JIT_TUNING)
42    mov     r0, #kCallsiteInterpreted
43#endif
44    mov     pc, r1                      @ callsite is interpreted
451:
46    stmia   rGLUE, {rPC, rFP}           @ SAVE_PC_FP_TO_GLUE()
47    ldr     r2, .LdvmMterpStdBail       @ defined in footer.S
48    mov     r1, #0                      @ changeInterp = false
49    mov     r0, rGLUE                   @ Expecting rGLUE in r0
50    blx     r2                          @ exit the interpreter
51