TEMPLATE_RETURN.S revision 72e93344b4d1ffc71e9c832ec23de0657e5b04a5
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    ldr     r9,  [r0, #offStackSaveArea_returnAddr] @ r9<- chaining cell ret
13    ldr     r2, [r10, #(offStackSaveArea_method - sizeofStackSaveArea)]
14                                        @ r2<- method we're returning to
15    ldr     r3, [rGLUE, #offGlue_self]  @ r3<- glue->self
16    cmp     r2, #0                      @ break frame?
17    beq     1f                          @ bail to interpreter
18    ldr     r0, .LdvmJitToInterpNoChain @ defined in footer.S
19    mov     rFP, r10                    @ publish new FP
20    ldrne   r10, [r2, #offMethod_clazz] @ r10<- method->clazz
21    ldr     r8, [r8]                    @ r8<- suspendCount
22
23    str     r2, [rGLUE, #offGlue_method]@ glue->method = newSave->method
24    ldr     r1, [r10, #offClassObject_pDvmDex] @ r1<- method->clazz->pDvmDex
25    str     rFP, [r3, #offThread_curFrame] @ self->curFrame = fp
26    add     rPC, rPC, #6                @ publish new rPC (advance 6 bytes)
27    str     r1, [rGLUE, #offGlue_methodClassDex]
28    cmp     r8, #0                      @ check the suspendCount
29    movne   r9, #0                      @ clear the chaining cell address
30    cmp     r9, #0                      @ chaining cell exists?
31    blxne   r9                          @ jump to the chaining cell
32    mov     pc, r0                      @ callsite is interpreted
331:
34    stmia   rGLUE, {rPC, rFP}           @ SAVE_PC_FP_TO_GLUE()
35    ldr     r2, .LdvmMterpStdBail       @ defined in footer.S
36    mov     r1, #0                      @ changeInterp = false
37    mov     r0, rGLUE                   @ Expecting rGLUE in r0
38    blx     r2                          @ exit the interpreter
39