1    @ r0 = methodToCall, r1 = returnCell, rPC = dalvikCallsite
2    @ r7 = methodToCall->registersSize
3    ldr     r9, [rSELF, #offThread_interpStackEnd]    @ r9<- interpStackEnd
4    ldrb    r8, [rSELF, #offThread_breakFlags]        @ r8<- breakFlags
5    add     r3, r1, #1  @ Thumb addr is odd
6    SAVEAREA_FROM_FP(r1, rFP)           @ r1<- stack save area
7    sub     r1, r1, r7, lsl #2          @ r1<- newFp (old savearea - regsSize)
8    SAVEAREA_FROM_FP(r10, r1)           @ r10<- stack save area
9    cmp     r10, r9                     @ bottom < interpStackEnd?
10    bxlo    lr                          @ return to raise stack overflow excep.
11    @ r1 = newFP, r0 = methodToCall, r3 = returnCell, rPC = dalvikCallsite
12    str     rPC, [rFP, #(offStackSaveArea_currentPc - sizeofStackSaveArea)]
13    str     rPC, [r1, #(offStackSaveArea_savedPc - sizeofStackSaveArea)]
14
15    @ set up newSaveArea
16    str     rFP, [r1, #(offStackSaveArea_prevFrame - sizeofStackSaveArea)]
17    str     r3, [r1, #(offStackSaveArea_returnAddr - sizeofStackSaveArea)]
18    str     r0, [r1, #(offStackSaveArea_method - sizeofStackSaveArea)]
19    cmp     r8, #0                      @ breakFlags != 0
20    ldr     r8, [r0, #offMethod_nativeFunc] @ r8<- method->nativeFunc
21#if !defined(WITH_SELF_VERIFICATION)
22    bxne    lr                          @ bail to the interpreter
23#else
24    bx      lr                          @ bail to interpreter unconditionally
25#endif
26
27    @ go ahead and transfer control to the native code
28    ldr     r9, [rSELF, #offThread_jniLocal_topCookie]@r9<-thread->localRef->...
29    mov     r2, #0
30    str     r1, [rSELF, #offThread_curFrame]   @ curFrame = newFp
31    str     r2, [rSELF, #offThread_inJitCodeCache] @ not in the jit code cache
32    str     r9, [r1, #(offStackSaveArea_localRefCookie - sizeofStackSaveArea)]
33                                        @ newFp->localRefCookie=top
34    SAVEAREA_FROM_FP(r10, r1)           @ r10<- new stack save area
35
36    mov     r2, r0                        @ arg2<- methodToCall
37    mov     r0, r1                        @ arg0<- newFP
38    add     r1, rSELF, #offThread_retval  @ arg1<- &retval
39    mov     r3, rSELF                     @ arg3<- self
40#if defined(TEMPLATE_INLINE_PROFILING)
41    @ r2=methodToCall, r6=rSELF
42    stmfd   sp!, {r2,r6}                @ to be consumed after JNI return
43    stmfd   sp!, {r0-r3}                @ preserve r0-r3
44    mov     r0, r2
45    mov     r1, r6
46    @ r0=JNIMethod, r1=rSELF
47    ldr     ip, .LdvmFastMethodTraceEnter
48    blx     ip
49    ldmfd   sp!, {r0-r3}                @ restore r0-r3
50#endif
51
52    blx     r8                          @ off to the native code
53
54#if defined(TEMPLATE_INLINE_PROFILING)
55    ldmfd   sp!, {r0-r1}                @ restore r2 and r6
56    @ r0=JNIMethod, r1=rSELF
57    ldr     ip, .LdvmFastNativeMethodTraceExit
58    blx     ip
59#endif
60    @ native return; r10=newSaveArea
61    @ equivalent to dvmPopJniLocals
62    ldr     r2, [r10, #offStackSaveArea_returnAddr] @ r2 = chaining cell ret
63    ldr     r0, [r10, #offStackSaveArea_localRefCookie] @ r0<- saved->top
64    ldr     r1, [rSELF, #offThread_exception] @ check for exception
65    str     rFP, [rSELF, #offThread_curFrame]  @ curFrame = fp
66    cmp     r1, #0                      @ null?
67    str     r0, [rSELF, #offThread_jniLocal_topCookie] @ new top <- old top
68    ldr     r0, [rFP, #(offStackSaveArea_currentPc - sizeofStackSaveArea)]
69
70    @ r0 = dalvikCallsitePC
71    bne     .LhandleException           @ no, handle exception
72
73    str     r2, [rSELF, #offThread_inJitCodeCache] @ set the mode properly
74    cmp     r2, #0                      @ return chaining cell still exists?
75    bxne    r2                          @ yes - go ahead
76
77    @ continue executing the next instruction through the interpreter
78    ldr     r1, .LdvmJitToInterpTraceSelectNoChain @ defined in footer.S
79    add     rPC, r0, #6                 @ reconstruct new rPC (advance 6 bytes)
80#if defined(WITH_JIT_TUNING)
81    mov     r0, #kCallsiteInterpreted
82#endif
83    mov     pc, r1
84