Bill Buzbee | 7c58bd4 | 2016-01-20 20:46:01 +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 | * Interpreter entry point. |
| 18 | */ |
| 19 | |
| 20 | .text |
Serguei Katkov | 05dfaaa | 2016-01-28 08:21:26 +0600 | [diff] [blame] | 21 | .global SYMBOL(ExecuteMterpImpl) |
| 22 | FUNCTION_TYPE(ExecuteMterpImpl) |
Bill Buzbee | 7c58bd4 | 2016-01-20 20:46:01 +0000 | [diff] [blame] | 23 | |
| 24 | /* |
| 25 | * On entry: |
| 26 | * 0 Thread* self |
| 27 | * 1 code_item |
| 28 | * 2 ShadowFrame |
| 29 | * 3 JValue* result_register |
| 30 | * |
| 31 | */ |
| 32 | |
Serguei Katkov | 05dfaaa | 2016-01-28 08:21:26 +0600 | [diff] [blame] | 33 | SYMBOL(ExecuteMterpImpl): |
Bill Buzbee | 7c58bd4 | 2016-01-20 20:46:01 +0000 | [diff] [blame] | 34 | .cfi_startproc |
Serguei Katkov | 897338d | 2016-03-01 15:53:22 +0600 | [diff] [blame] | 35 | .cfi_def_cfa esp, 4 |
| 36 | |
| 37 | /* Spill callee save regs */ |
| 38 | PUSH %ebp |
| 39 | PUSH %edi |
| 40 | PUSH %esi |
| 41 | PUSH %ebx |
| 42 | |
Bill Buzbee | 7c58bd4 | 2016-01-20 20:46:01 +0000 | [diff] [blame] | 43 | /* Allocate frame */ |
| 44 | subl $$FRAME_SIZE, %esp |
| 45 | .cfi_adjust_cfa_offset FRAME_SIZE |
| 46 | |
Bill Buzbee | 7c58bd4 | 2016-01-20 20:46:01 +0000 | [diff] [blame] | 47 | /* Load ShadowFrame pointer */ |
| 48 | movl IN_ARG2(%esp), %edx |
| 49 | |
| 50 | /* Remember the return register */ |
| 51 | movl IN_ARG3(%esp), %eax |
| 52 | movl %eax, SHADOWFRAME_RESULT_REGISTER_OFFSET(%edx) |
| 53 | |
| 54 | /* Remember the code_item */ |
| 55 | movl IN_ARG1(%esp), %ecx |
| 56 | movl %ecx, SHADOWFRAME_CODE_ITEM_OFFSET(%edx) |
| 57 | |
| 58 | /* set up "named" registers */ |
| 59 | movl SHADOWFRAME_NUMBER_OF_VREGS_OFFSET(%edx), %eax |
| 60 | leal SHADOWFRAME_VREGS_OFFSET(%edx), rFP |
| 61 | leal (rFP, %eax, 4), rREFS |
| 62 | movl SHADOWFRAME_DEX_PC_OFFSET(%edx), %eax |
| 63 | lea CODEITEM_INSNS_OFFSET(%ecx), rPC |
| 64 | lea (rPC, %eax, 2), rPC |
| 65 | EXPORT_PC |
| 66 | |
Bill Buzbee | d634208 | 2016-04-04 16:59:10 +0000 | [diff] [blame] | 67 | /* Set up for backwards branches & osr profiling */ |
| 68 | movl OFF_FP_METHOD(rFP), %eax |
| 69 | movl %eax, OUT_ARG0(%esp) |
| 70 | leal OFF_FP_SHADOWFRAME(rFP), %ecx |
| 71 | movl %ecx, OUT_ARG1(%esp) |
| 72 | call SYMBOL(MterpSetUpHotnessCountdown) |
| 73 | |
Bill Buzbee | 7c58bd4 | 2016-01-20 20:46:01 +0000 | [diff] [blame] | 74 | /* Starting ibase */ |
| 75 | REFRESH_IBASE |
| 76 | |
| 77 | /* start executing the instruction at rPC */ |
| 78 | FETCH_INST |
| 79 | GOTO_NEXT |
| 80 | /* NOTE: no fallthrough */ |