1 /* Copyright (C) 2008 The Android Open Source Project 2 * 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /* 17 * File: OP_EXECUTE_INLINE.S 18 * 19 * Code: Executes a "native inline" instruction. Uses no substitutions. 20 * 21 * For: execute-inline 22 * 23 * Description: Executes a "native inline" instruction. This instruction 24 * is generated by the optimizer. 25 * 26 * Format: 27 * 28 * Syntax: vAA, {vC, vD, vE, vF}, inline@BBBB 29 */ 30 31 FETCH 1, %ecx # %ecx<- BBBB 32 movl rGLUE, %eax # %eax<- MterpGlue pointer 33 addl $$offGlue_retval, %eax # %eax<- &glue->retval 34 EXPORT_PC 35 shr $$4, rINST # rINST<- B 36 movl %eax, -8(%esp) # push parameter glue->retval 37 lea -24(%esp), %esp 38 jmp .L${opcode}_continue 39 %break 40 41 /* 42 * Extract args, call function. 43 * rINST = #of args (0-4) 44 * %ecx = call index 45 */ 46 47 .L${opcode}_continue: 48 FETCH 2, %edx # %edx<- FEDC 49 cmp $$1, rINST # determine number of arguments 50 jl 0f # handle zero args 51 je 1f # handle one arg 52 cmp $$3, rINST 53 jl 2f # handle two args 54 je 3f # handle three args 55 4: 56 movl %edx, rINST # rINST<- FEDC 57 and $$0xf000, rINST # isolate F 58 shr $$10, rINST 59 movl (rFP, rINST), rINST # rINST<- vF 60 movl rINST, 12(%esp) # push parameter vF 61 3: 62 movl %edx, rINST # rINST<- FEDC 63 and $$0x0f00, rINST # isolate E 64 shr $$6, rINST 65 movl (rFP, rINST), rINST # rINST<- vE 66 movl rINST, 8(%esp) # push parameter E 67 2: 68 movl %edx, rINST # rINST<- FEDC 69 and $$0x00f0, rINST # isolate D 70 shr $$2, rINST 71 movl (rFP, rINST), rINST # rINST<- vD 72 movl rINST, 4(%esp) # push parameter D 73 1: 74 and $$0x000f, %edx # isolate C 75 movl (rFP, %edx, 4), %edx # rINST<- vC 76 movl %edx, (%esp) # push parameter C 77 0: 78 shl $$4, %ecx 79 movl $$gDvmInlineOpsTable, %eax # %eax<- address for table of inline operations 80 call *(%eax, %ecx) # call function 81 82 cmp $$0, %eax # check boolean result of inline 83 FFETCH_ADV 3, %eax # %eax<- next instruction hi; fetch, advance 84 lea 24(%esp), %esp # update stack pointer 85 je common_exceptionThrown # handle exception 86 FGETOP_JMP 3, %eax # jump to next instruction; getop, jmp