Home | History | Annotate | Download | only in x86_64
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 /*
     17  * Interpreter entry point.
     18  */
     19 
     20     .text
     21     .global SYMBOL(ExecuteMterpImpl)
     22     FUNCTION_TYPE(ExecuteMterpImpl)
     23 
     24 /*
     25  * On entry:
     26  *  0  Thread* self
     27  *  1  code_item
     28  *  2  ShadowFrame
     29  *  3  JValue* result_register
     30  *
     31  */
     32 
     33 SYMBOL(ExecuteMterpImpl):
     34     .cfi_startproc
     35     .cfi_def_cfa rsp, 8
     36 
     37     /* Spill callee save regs */
     38     PUSH %rbx
     39     PUSH %rbp
     40     PUSH %r12
     41     PUSH %r13
     42     PUSH %r14
     43     PUSH %r15
     44 
     45     /* Allocate frame */
     46     subq    $$FRAME_SIZE, %rsp
     47     .cfi_adjust_cfa_offset FRAME_SIZE
     48 
     49     /* Remember the return register */
     50     movq    IN_ARG3, SHADOWFRAME_RESULT_REGISTER_OFFSET(IN_ARG2)
     51 
     52     /* Remember the code_item */
     53     movq    IN_ARG1, SHADOWFRAME_CODE_ITEM_OFFSET(IN_ARG2)
     54 
     55     /* set up "named" registers */
     56     movl    SHADOWFRAME_NUMBER_OF_VREGS_OFFSET(IN_ARG2), %eax
     57     leaq    SHADOWFRAME_VREGS_OFFSET(IN_ARG2), rFP
     58     leaq    (rFP, %rax, 4), rREFS
     59     movl    SHADOWFRAME_DEX_PC_OFFSET(IN_ARG2), %eax
     60     leaq    CODEITEM_INSNS_OFFSET(IN_ARG1), rPC
     61     leaq    (rPC, %rax, 2), rPC
     62     EXPORT_PC
     63 
     64     /* Starting ibase */
     65     movq    IN_ARG0, rSELF
     66     REFRESH_IBASE
     67 
     68     /* Set up for backwards branches & osr profiling */
     69     movq    OFF_FP_METHOD(rFP), OUT_ARG0
     70     leaq    OFF_FP_SHADOWFRAME(rFP), OUT_ARG1
     71     call    SYMBOL(MterpSetUpHotnessCountdown)
     72     movswl  %ax, rPROFILE
     73 
     74     /* start executing the instruction at rPC */
     75     FETCH_INST
     76     GOTO_NEXT
     77     /* NOTE: no fallthrough */
     78