1   /* Copyright (C) 2010 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_RANGE.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: AA, {vCCCC..v(CCCC+AA-1)}, 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    movl        %eax, -8(%esp)          # push parameter glue->retval
36    lea         -24(%esp), %esp
37    jmp         .L${opcode}_continue
38%break
39
40   /*
41    * Extract args, call function.
42    *  rINST = #of args (0-4)
43    *  %ecx = call index
44    */
45
46.L${opcode}_continue:
47    FETCH       2, %edx                 # %edx<- FEDC
48    cmp         $$1, rINST              # determine number of arguments
49    jl          0f                      # handle zero args
50    je          1f                      # handle one arg
51    cmp         $$3, rINST
52    jl          2f                      # handle two args
53    je          3f                      # handle three args
544:
55    movl        12(rFP, %edx, 4), rINST     # rINST<- vF
56    movl        rINST, 12(%esp)         # push parameter vF
573:
58    movl        8(rFP, %edx, 4), rINST     # rINST<- vE
59    movl        rINST, 8(%esp)          # push parameter E
602:
61    movl        4(rFP, %edx, 4), rINST     # rINST<- vD
62    movl        rINST, 4(%esp)          # push parameter D
631:
64    movl        (rFP, %edx, 4), %edx    # rINST<- vC
65    movl        %edx, (%esp)            # push parameter C
660:
67    shl         $$4, %ecx
68    movl        $$gDvmInlineOpsTable, %eax # %eax<- address for table of inline operations
69    call        *(%eax, %ecx)           # call function
70
71    cmp         $$0, %eax               # check boolean result of inline
72    FFETCH_ADV  3, %eax                 # %eax<- next instruction hi; fetch, advance
73    lea         24(%esp), %esp          # update stack pointer
74    je          common_exceptionThrown  # handle exception
75    FGETOP_JMP  3, %eax                 # jump to next instruction; getop, jmp
76