• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * ===========================================================================
3 *  Common subroutines and data
4 * ===========================================================================
5 */
6
7    .text
8    .align  2
9.LinvokeNative:
10    @ Prep for the native call
11    @ r1 = newFP, r0 = methodToCall
12    ldr     r3, [rGLUE, #offGlue_self]      @ r3<- glue->self
13    ldr     r9, [r3, #offThread_jniLocal_topCookie] @ r9<- thread->localRef->...
14    str     r1, [r3, #offThread_curFrame]   @ self->curFrame = newFp
15    str     r9, [r1, #(offStackSaveArea_localRefCookie - sizeofStackSaveArea)]
16                                        @ newFp->localRefCookie=top
17    mov     r9, r3                      @ r9<- glue->self (preserve)
18    SAVEAREA_FROM_FP(r10, r1)           @ r10<- new stack save area
19
20    mov     r2, r0                      @ r2<- methodToCall
21    mov     r0, r1                      @ r0<- newFP
22    add     r1, rGLUE, #offGlue_retval  @ r1<- &retval
23
24    LDR_PC_LR "[r2, #offMethod_nativeFunc]"
25
26    @ native return; r9=self, r10=newSaveArea
27    @ equivalent to dvmPopJniLocals
28    ldr     r2, [r10, #offStackSaveArea_returnAddr] @ r2 = chaining cell ret
29    ldr     r0, [r10, #offStackSaveArea_localRefCookie] @ r0<- saved->top
30    ldr     r1, [r9, #offThread_exception] @ check for exception
31    str     rFP, [r9, #offThread_curFrame]  @ self->curFrame = fp
32    cmp     r1, #0                      @ null?
33    str     r0, [r9, #offThread_jniLocal_topCookie] @ new top <- old top
34    bne     .LhandleException             @ no, handle exception
35    bx      r2
36
37/* NOTE - this path can be exercised if the JIT threshold is set to 5 */
38.LhandleException:
39    ldr     r0, .LdvmMterpCommonExceptionThrown @ PIC way of getting &func
40    ldr     rIBASE, .LdvmAsmInstructionStart    @ same as above
41    ldr     rPC, [r10, #offStackSaveArea_savedPc] @ reload rPC
42    mov     pc, r0                  @ branch to dvmMterpCommonExceptionThrown
43
44    .align  2
45.LdvmAsmInstructionStart:
46    .word   dvmAsmInstructionStart
47.LdvmJitToInterpNoChain:
48    .word   dvmJitToInterpNoChain
49.LdvmMterpStdBail:
50    .word   dvmMterpStdBail
51.LdvmMterpCommonExceptionThrown:
52    .word   dvmMterpCommonExceptionThrown
53.L__aeabi_cdcmple:
54    .word   __aeabi_cdcmple
55.L__aeabi_cfcmple:
56    .word   __aeabi_cfcmple
57
58    .global dmvCompilerTemplateEnd
59dmvCompilerTemplateEnd:
60
61#endif /* WITH_JIT */
62