Bill Buzbee | 3b0b4b9 | 2016-02-02 13:45:36 +0000 | [diff] [blame] | 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 | .text |
| 18 | |
| 19 | /* |
| 20 | * Interpreter entry point. |
| 21 | * On entry: |
| 22 | * x0 Thread* self/ |
| 23 | * x1 code_item |
| 24 | * x2 ShadowFrame |
| 25 | * x3 JValue* result_register |
| 26 | * |
| 27 | */ |
| 28 | .global ExecuteMterpImpl |
| 29 | .type ExecuteMterpImpl, %function |
| 30 | .balign 16 |
| 31 | |
| 32 | ExecuteMterpImpl: |
| 33 | .cfi_startproc |
Vladimir Marko | 112aa10 | 2016-12-01 11:53:54 +0000 | [diff] [blame] | 34 | SAVE_TWO_REGS_INCREASE_FRAME xPROFILE, x27, 80 |
| 35 | SAVE_TWO_REGS xIBASE, xREFS, 16 |
| 36 | SAVE_TWO_REGS xSELF, xINST, 32 |
| 37 | SAVE_TWO_REGS xPC, xFP, 48 |
| 38 | SAVE_TWO_REGS fp, lr, 64 |
Bill Buzbee | 1d011d9 | 2016-04-04 16:59:29 +0000 | [diff] [blame] | 39 | add fp, sp, #64 |
Bill Buzbee | 3b0b4b9 | 2016-02-02 13:45:36 +0000 | [diff] [blame] | 40 | |
| 41 | /* Remember the return register */ |
| 42 | str x3, [x2, #SHADOWFRAME_RESULT_REGISTER_OFFSET] |
| 43 | |
| 44 | /* Remember the code_item */ |
| 45 | str x1, [x2, #SHADOWFRAME_CODE_ITEM_OFFSET] |
| 46 | |
| 47 | /* set up "named" registers */ |
| 48 | mov xSELF, x0 |
| 49 | ldr w0, [x2, #SHADOWFRAME_NUMBER_OF_VREGS_OFFSET] |
buzbee | ace690f | 2016-03-11 09:51:11 -0800 | [diff] [blame] | 50 | add xFP, x2, #SHADOWFRAME_VREGS_OFFSET // point to vregs. |
Bill Buzbee | 3b0b4b9 | 2016-02-02 13:45:36 +0000 | [diff] [blame] | 51 | add xREFS, xFP, w0, lsl #2 // point to reference array in shadow frame |
| 52 | ldr w0, [x2, #SHADOWFRAME_DEX_PC_OFFSET] // Get starting dex_pc. |
| 53 | add xPC, x1, #CODEITEM_INSNS_OFFSET // Point to base of insns[] |
| 54 | add xPC, xPC, w0, lsl #1 // Create direct pointer to 1st dex opcode |
| 55 | EXPORT_PC |
| 56 | |
| 57 | /* Starting ibase */ |
| 58 | ldr xIBASE, [xSELF, #THREAD_CURRENT_IBASE_OFFSET] |
| 59 | |
Bill Buzbee | 1d011d9 | 2016-04-04 16:59:29 +0000 | [diff] [blame] | 60 | /* Set up for backwards branches & osr profiling */ |
| 61 | ldr x0, [xFP, #OFF_FP_METHOD] |
| 62 | add x1, xFP, #OFF_FP_SHADOWFRAME |
| 63 | bl MterpSetUpHotnessCountdown |
| 64 | mov wPROFILE, w0 // Starting hotness countdown to xPROFILE |
| 65 | |
Bill Buzbee | 3b0b4b9 | 2016-02-02 13:45:36 +0000 | [diff] [blame] | 66 | /* start executing the instruction at rPC */ |
| 67 | FETCH_INST // load wINST from rPC |
| 68 | GET_INST_OPCODE ip // extract opcode from wINST |
| 69 | GOTO_OPCODE ip // jump to next instruction |
| 70 | /* NOTE: no fallthrough */ |