1 %verify "executed" 2 %verify "exception handled" 3 /* 4 * Execute a "native inline" instruction, using "/range" semantics. 5 * Same idea as execute-inline, but we get the args differently. 6 * 7 * We need to call an InlineOp4Func: 8 * bool (func)(u4 arg0, u4 arg1, u4 arg2, u4 arg3, JValue* pResult) 9 * 10 * The first four args are in r0-r3, pointer to return value storage 11 * is on the stack. The function's return value is a flag that tells 12 * us if an exception was thrown. 13 */ 14 /* [opt] execute-inline/range {vCCCC..v(CCCC+AA-1)}, inline@BBBB */ 15 FETCH(r10, 1) @ r10<- BBBB 16 add r1, rGLUE, #offGlue_retval @ r1<- &glue->retval 17 EXPORT_PC() @ can throw 18 sub sp, sp, #8 @ make room for arg, +64 bit align 19 mov r0, rINST, lsr #8 @ r0<- AA 20 str r1, [sp] @ push &glue->retval 21 bl .L${opcode}_continue @ make call; will return after 22 add sp, sp, #8 @ pop stack 23 cmp r0, #0 @ test boolean result of inline 24 beq common_exceptionThrown @ returned false, handle exception 25 FETCH_ADVANCE_INST(3) @ advance rPC, load rINST 26 GET_INST_OPCODE(ip) @ extract opcode from rINST 27 GOTO_OPCODE(ip) @ jump to next instruction 28 %break 29 30 /* 31 * Extract args, call function. 32 * r0 = #of args (0-4) 33 * r10 = call index 34 * lr = return addr, above [DO NOT bl out of here w/o preserving LR] 35 */ 36 .L${opcode}_continue: 37 rsb r0, r0, #4 @ r0<- 4-r0 38 FETCH(r9, 2) @ r9<- CCCC 39 add pc, pc, r0, lsl #3 @ computed goto, 2 instrs each 40 bl common_abort @ (skipped due to ARM prefetch) 41 4: add ip, r9, #3 @ base+3 42 GET_VREG(r3, ip) @ r3<- vBase[3] 43 3: add ip, r9, #2 @ base+2 44 GET_VREG(r2, ip) @ r2<- vBase[2] 45 2: add ip, r9, #1 @ base+1 46 GET_VREG(r1, ip) @ r1<- vBase[1] 47 1: add ip, r9, #0 @ (nop) 48 GET_VREG(r0, ip) @ r0<- vBase[0] 49 0: 50 ldr r9, .L${opcode}_table @ table of InlineOperation 51 LDR_PC "[r9, r10, lsl #4]" @ sizeof=16, "func" is first entry 52 @ (not reached) 53 54 .L${opcode}_table: 55 .word gDvmInlineOpsTable 56