• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1%verify "executed"
2%verify "exception handled"
3    /*
4     * Execute a "native inline" instruction.
5     *
6     * We need to call:
7     *  dvmPerformInlineOp4Std(arg0, arg1, arg2, arg3, &retval, ref)
8     *
9     * The first four args are in r0-r3, but the last two must be pushed
10     * onto the stack.
11     */
12    /* [opt] execute-inline vAA, {vC, vD, vE, vF}, inline@BBBB */
13    FETCH(r10, 1)                       @ r10<- BBBB
14    add     r1, rGLUE, #offGlue_retval  @ r1<- &glue->retval
15    EXPORT_PC()                         @ can throw
16    sub     sp, sp, #8                  @ make room for arg(s)
17    mov     r0, rINST, lsr #12          @ r0<- B
18    str     r1, [sp]                    @ push &glue->retval
19    bl      .L${opcode}_continue        @ make call; will return after
20    add     sp, sp, #8                  @ pop stack
21    cmp     r0, #0                      @ test boolean result of inline
22    beq     common_exceptionThrown      @ returned false, handle exception
23    FETCH_ADVANCE_INST(3)               @ advance rPC, load rINST
24    GET_INST_OPCODE(ip)                 @ extract opcode from rINST
25    GOTO_OPCODE(ip)                     @ jump to next instruction
26%break
27
28    /*
29     * Extract args, call function.
30     *  r0 = #of args (0-4)
31     *  r10 = call index
32     *  lr = return addr, above  [DO NOT bl out of here w/o preserving LR]
33     *
34     * Other ideas:
35     * - Use a jump table from the main piece to jump directly into the
36     *   AND/LDR pairs.  Costs a data load, saves a branch.
37     * - Have five separate pieces that do the loading, so we can work the
38     *   interleave a little better.  Increases code size.
39     */
40.L${opcode}_continue:
41    rsb     r0, r0, #4                  @ r0<- 4-r0
42    FETCH(r9, 2)                        @ r9<- FEDC
43    add     pc, pc, r0, lsl #3          @ computed goto, 2 instrs each
44    bl      common_abort                @ (skipped due to ARM prefetch)
454:  and     ip, r9, #0xf000             @ isolate F
46    ldr     r3, [rFP, ip, lsr #10]      @ r3<- vF (shift right 12, left 2)
473:  and     ip, r9, #0x0f00             @ isolate E
48    ldr     r2, [rFP, ip, lsr #6]       @ r2<- vE
492:  and     ip, r9, #0x00f0             @ isolate D
50    ldr     r1, [rFP, ip, lsr #2]       @ r1<- vD
511:  and     ip, r9, #0x000f             @ isolate C
52    ldr     r0, [rFP, ip, lsl #2]       @ r0<- vC
530:
54    ldr     r9, .L${opcode}_table       @ table of InlineOperation
55    LDR_PC  "[r9, r10, lsl #4]"         @ sizeof=16, "func" is first entry
56    @ (not reached)
57
58.L${opcode}_table:
59    .word   gDvmInlineOpsTable
60
61