• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1    /*
2     * For monomorphic callsite, setup the Dalvik frame and return to the
3     * Thumb code through the link register to transfer control to the callee
4     * method through a dedicated chaining cell.
5     */
6    @ r0 = methodToCall, r1 = returnCell, rPC = dalvikCallsite
7    @ methodToCall is guaranteed to be non-native
8.LinvokeChain:
9    ldrh    r7, [r0, #offMethod_registersSize]  @ r7<- methodToCall->regsSize
10    ldrh    r2, [r0, #offMethod_outsSize]  @ r2<- methodToCall->outsSize
11    ldr     r9, [rGLUE, #offGlue_interpStackEnd]    @ r9<- interpStackEnd
12    ldr     r8, [rGLUE, #offGlue_pSelfSuspendCount] @ r8<- &suspendCount
13    add     r3, r1, #1  @ Thumb addr is odd
14    SAVEAREA_FROM_FP(r1, rFP)           @ r1<- stack save area
15    sub     r1, r1, r7, lsl #2          @ r1<- newFp (old savearea - regsSize)
16    SAVEAREA_FROM_FP(r10, r1)           @ r10<- stack save area
17    add     r12, lr, #2                 @ setup the punt-to-interp address
18    sub     r10, r10, r2, lsl #2        @ r10<- bottom (newsave - outsSize)
19    ldr     r8, [r8]                    @ r3<- suspendCount (int)
20    cmp     r10, r9                     @ bottom < interpStackEnd?
21    bxlt    r12                         @ return to raise stack overflow excep.
22    @ r1 = newFP, r0 = methodToCall, r3 = returnCell, rPC = dalvikCallsite
23    ldr     r9, [r0, #offMethod_clazz]      @ r9<- method->clazz
24    str     rPC, [rFP, #(offStackSaveArea_currentPc - sizeofStackSaveArea)]
25    str     rPC, [r1, #(offStackSaveArea_savedPc - sizeofStackSaveArea)]
26    ldr     rPC, [r0, #offMethod_insns]     @ rPC<- methodToCall->insns
27
28
29    @ set up newSaveArea
30    str     rFP, [r1, #(offStackSaveArea_prevFrame - sizeofStackSaveArea)]
31    str     r3, [r1, #(offStackSaveArea_returnAddr - sizeofStackSaveArea)]
32    str     r0, [r1, #(offStackSaveArea_method - sizeofStackSaveArea)]
33    cmp     r8, #0                      @ suspendCount != 0
34    bxne    r12                         @ bail to the interpreter
35
36    ldr     r3, [r9, #offClassObject_pDvmDex] @ r3<- method->clazz->pDvmDex
37    ldr     r2, [rGLUE, #offGlue_self]      @ r2<- glue->self
38
39    @ Update "glue" values for the new method
40    str     r0, [rGLUE, #offGlue_method]    @ glue->method = methodToCall
41    str     r3, [rGLUE, #offGlue_methodClassDex] @ glue->methodClassDex = ...
42    mov     rFP, r1                         @ fp = newFp
43    str     rFP, [r2, #offThread_curFrame]  @ self->curFrame = newFp
44
45    bx      lr                              @ return to the callee-chaining cell
46
47
48