* Runtime::CreateCalleeSaveMethod(kSaveAll)
*/
.macro SETUP_SAVE_ALL_CALLEE_SAVE_FRAME
- adrp x9, :got:_ZN3art7Runtime9instance_E
- ldr x9, [x9, #:got_lo12:_ZN3art7Runtime9instance_E]
+ adrp xIP0, :got:_ZN3art7Runtime9instance_E
+ ldr xIP0, [xIP0, #:got_lo12:_ZN3art7Runtime9instance_E]
// Our registers aren't intermixed - just spill in order.
- ldr x9,[x9] // x9 = & (art::Runtime * art::Runtime.instance_) .
+ ldr xIP0, [xIP0] // xIP0 = & (art::Runtime * art::Runtime.instance_) .
- // x9 = (ArtMethod*) Runtime.instance_.callee_save_methods[kRefAndArgs] .
+ // xIP0 = (ArtMethod*) Runtime.instance_.callee_save_methods[kRefAndArgs] .
THIS_LOAD_REQUIRES_READ_BARRIER
- ldr x9, [x9, RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET ]
+ ldr xIP0, [xIP0, RUNTIME_SAVE_ALL_CALLEE_SAVE_FRAME_OFFSET ]
- sub sp, sp, #368
- .cfi_adjust_cfa_offset 368
+ sub sp, sp, #176
+ .cfi_adjust_cfa_offset 176
// Ugly compile-time check, but we only have the preprocessor.
-#if (FRAME_SIZE_SAVE_ALL_CALLEE_SAVE != 368)
+#if (FRAME_SIZE_SAVE_ALL_CALLEE_SAVE != 176)
#error "SAVE_ALL_CALLEE_SAVE_FRAME(ARM64) size not as expected."
#endif
- // FP args
- stp d0, d1, [sp, #8]
- stp d2, d3, [sp, #24]
- stp d4, d5, [sp, #40]
- stp d6, d7, [sp, #56]
-
// FP callee-saves
- stp d8, d9, [sp, #72]
- stp d10, d11, [sp, #88]
- stp d12, d13, [sp, #104]
- stp d14, d15, [sp, #120]
-
- stp d16, d17, [sp, #136]
- stp d18, d19, [sp, #152]
- stp d20, d21, [sp, #168]
- stp d22, d23, [sp, #184]
- stp d24, d25, [sp, #200]
- stp d26, d27, [sp, #216]
- stp d28, d29, [sp, #232]
- stp d30, d31, [sp, #248]
-
+ stp d8, d9, [sp, #8]
+ stp d10, d11, [sp, #24]
+ stp d12, d13, [sp, #40]
+ stp d14, d15, [sp, #56]
- // Callee saved.
- stp xSELF, x19, [sp, #264]
- .cfi_rel_offset x18, 264
- .cfi_rel_offset x19, 272
+ // Reserved registers
+ stp xSELF, xSUSPEND, [sp, #72]
+ .cfi_rel_offset x18, 72
+ .cfi_rel_offset x19, 80
- stp x20, x21, [sp, #280]
- .cfi_rel_offset x20, 280
- .cfi_rel_offset x21, 288
+ // callee-saves
+ stp x20, x21, [sp, #88]
+ .cfi_rel_offset x20, 88
+ .cfi_rel_offset x21, 96
- stp x22, x23, [sp, #296]
- .cfi_rel_offset x22, 296
- .cfi_rel_offset x23, 304
+ stp x22, x23, [sp, #104]
+ .cfi_rel_offset x22, 104
+ .cfi_rel_offset x23, 112
- stp x24, x25, [sp, #312]
- .cfi_rel_offset x24, 312
- .cfi_rel_offset x25, 320
+ stp x24, x25, [sp, #120]
+ .cfi_rel_offset x24, 120
+ .cfi_rel_offset x25, 128
- stp x26, x27, [sp, #328]
- .cfi_rel_offset x26, 328
- .cfi_rel_offset x27, 336
+ stp x26, x27, [sp, #136]
+ .cfi_rel_offset x26, 136
+ .cfi_rel_offset x27, 144
- stp x28, xFP, [sp, #344] // Save FP.
- .cfi_rel_offset x28, 344
- .cfi_rel_offset x29, 352
+ stp x28, x29, [sp, #152]
+ .cfi_rel_offset x28, 152
+ .cfi_rel_offset x29, 160
- str xLR, [sp, #360]
- .cfi_rel_offset x30, 360
+ str xLR, [sp, #168]
+ .cfi_rel_offset x30, 168
// Loads appropriate callee-save-method
- str x9, [sp] // Store ArtMethod* Runtime::callee_save_methods_[kRefsAndArgs]
-
+ str xIP0, [sp] // Store ArtMethod* Runtime::callee_save_methods_[kRefsAndArgs]
.endm
/*
* Macro that sets up the callee save frame to conform with
* Runtime::CreateCalleeSaveMethod(kRefsOnly).
*/
-// WIP.
.macro SETUP_REF_ONLY_CALLEE_SAVE_FRAME
- adrp x9, :got:_ZN3art7Runtime9instance_E
- ldr x9, [x9, #:got_lo12:_ZN3art7Runtime9instance_E]
+ adrp xIP0, :got:_ZN3art7Runtime9instance_E
+ ldr xIP0, [xIP0, #:got_lo12:_ZN3art7Runtime9instance_E]
// Our registers aren't intermixed - just spill in order.
- ldr x9,[x9] // x9 = & (art::Runtime * art::Runtime.instance_) .
+ ldr xIP0, [xIP0] // xIP0 = & (art::Runtime * art::Runtime.instance_) .
- // x9 = (ArtMethod*) Runtime.instance_.callee_save_methods[kRefAndArgs] .
+ // xIP0 = (ArtMethod*) Runtime.instance_.callee_save_methods[kRefAndArgs] .
THIS_LOAD_REQUIRES_READ_BARRIER
- ldr x9, [x9, RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET ]
+ ldr xIP0, [xIP0, RUNTIME_REFS_ONLY_CALLEE_SAVE_FRAME_OFFSET ]
- sub sp, sp, #176
- .cfi_adjust_cfa_offset 176
+ sub sp, sp, #96
+ .cfi_adjust_cfa_offset 96
// Ugly compile-time check, but we only have the preprocessor.
-#if (FRAME_SIZE_REFS_ONLY_CALLEE_SAVE != 176)
+#if (FRAME_SIZE_REFS_ONLY_CALLEE_SAVE != 96)
#error "REFS_ONLY_CALLEE_SAVE_FRAME(ARM64) size not as expected."
#endif
- // FP callee-saves
- stp d8, d9, [sp, #8]
- stp d10, d11, [sp, #24]
- stp d12, d13, [sp, #40]
- stp d14, d15, [sp, #56]
+ // Callee-saves
+ stp x20, x21, [sp, #8]
+ .cfi_rel_offset x20, 8
+ .cfi_rel_offset x21, 16
- // Callee saved.
- stp xSELF, x19, [sp, #72]
- .cfi_rel_offset x18, 72
- .cfi_rel_offset x19, 80
+ stp x22, x23, [sp, #24]
+ .cfi_rel_offset x22, 24
+ .cfi_rel_offset x23, 32
- stp x20, x21, [sp, #88]
- .cfi_rel_offset x20, 88
- .cfi_rel_offset x21, 96
+ stp x24, x25, [sp, #40]
+ .cfi_rel_offset x24, 40
+ .cfi_rel_offset x25, 48
- stp x22, x23, [sp, #104]
- .cfi_rel_offset x22, 104
- .cfi_rel_offset x23, 112
+ stp x26, x27, [sp, #56]
+ .cfi_rel_offset x26, 56
+ .cfi_rel_offset x27, 64
- stp x24, x25, [sp, #120]
- .cfi_rel_offset x24, 120
- .cfi_rel_offset x25, 128
-
- stp x26, x27, [sp, #136]
- .cfi_rel_offset x26, 136
- .cfi_rel_offset x27, 144
+ stp x28, x29, [sp, #72]
+ .cfi_rel_offset x28, 72
+ .cfi_rel_offset x29, 80
- stp x28, xFP, [sp, #152] // Save FP.
- .cfi_rel_offset x28, 152
- .cfi_rel_offset x29, 160
+ // LR
+ str xLR, [sp, #88]
+ .cfi_rel_offset x30, 88
- str xLR, [sp, #168]
- .cfi_rel_offset x30, 168
+ // Save xSELF to xETR.
+ mov xETR, xSELF
// Loads appropriate callee-save-method
- str x9, [sp] // Store ArtMethod* Runtime::callee_save_methods_[kRefsAndArgs]
+ str xIP0, [sp] // Store ArtMethod* Runtime::callee_save_methods_[kRefsAndArgs]
.endm
+// TODO: Probably no need to restore registers preserved by aapcs64.
.macro RESTORE_REF_ONLY_CALLEE_SAVE_FRAME
- // FP callee saves
- ldp d8, d9, [sp, #8]
- ldp d10, d11, [sp, #24]
- ldp d12, d13, [sp, #40]
- ldp d14, d15, [sp, #56]
-
- // Callee saved.
- ldp xSELF, x19, [sp, #72]
- .cfi_restore x18
- .cfi_restore x19
+ // Restore xSELF.
+ mov xSELF, xETR
- ldp x20, x21, [sp, #88]
+ // Callee-saves
+ ldp x20, x21, [sp, #8]
.cfi_restore x20
.cfi_restore x21
- ldp x22, x23, [sp, #104]
+ ldp x22, x23, [sp, #24]
.cfi_restore x22
.cfi_restore x23
- ldp x24, x25, [sp, #120]
+ ldp x24, x25, [sp, #40]
.cfi_restore x24
.cfi_restore x25
- ldp x26, x27, [sp, #136]
+ ldp x26, x27, [sp, #56]
.cfi_restore x26
.cfi_restore x27
- ldp x28, xFP, [sp, #152] // Save FP.
+ ldp x28, x29, [sp, #72]
.cfi_restore x28
.cfi_restore x29
- ldr xLR, [sp, #168]
+ // LR
+ ldr xLR, [sp, #88]
.cfi_restore x30
- add sp, sp, #176
- .cfi_adjust_cfa_offset -176
+ add sp, sp, #96
+ .cfi_adjust_cfa_offset -96
.endm
.macro POP_REF_ONLY_CALLEE_SAVE_FRAME
- add sp, sp, #176
- .cfi_adjust_cfa_offset -176
+ // Restore xSELF as it might be scratched.
+ mov xSELF, xETR
+ // ETR
+ ldr xETR, [sp, #16]
+ .cfi_restore x21
+
+ add sp, sp, #96
+ .cfi_adjust_cfa_offset -96
.endm
.macro RESTORE_REF_ONLY_CALLEE_SAVE_FRAME_AND_RETURN
.macro SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME_INTERNAL
- sub sp, sp, #304
- .cfi_adjust_cfa_offset 304
+ sub sp, sp, #224
+ .cfi_adjust_cfa_offset 224
// Ugly compile-time check, but we only have the preprocessor.
-#if (FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE != 304)
+#if (FRAME_SIZE_REFS_AND_ARGS_CALLEE_SAVE != 224)
#error "REFS_AND_ARGS_CALLEE_SAVE_FRAME(ARM64) size not as expected."
#endif
- stp d0, d1, [sp, #16]
- stp d2, d3, [sp, #32]
- stp d4, d5, [sp, #48]
- stp d6, d7, [sp, #64]
- stp d8, d9, [sp, #80]
- stp d10, d11, [sp, #96]
- stp d12, d13, [sp, #112]
- stp d14, d15, [sp, #128]
-
- stp x1, x2, [sp, #144]
- .cfi_rel_offset x1, 144
- .cfi_rel_offset x2, 152
-
- stp x3, x4, [sp, #160]
- .cfi_rel_offset x3, 160
- .cfi_rel_offset x4, 168
-
- stp x5, x6, [sp, #176]
- .cfi_rel_offset x5, 176
- .cfi_rel_offset x6, 184
-
- stp x7, xSELF, [sp, #192]
- .cfi_rel_offset x7, 192
- .cfi_rel_offset x18, 200
-
- stp x19, x20, [sp, #208]
- .cfi_rel_offset x19, 208
- .cfi_rel_offset x20, 216
-
- stp x21, x22, [sp, #224]
- .cfi_rel_offset x21, 224
- .cfi_rel_offset x22, 232
-
- stp x23, x24, [sp, #240]
- .cfi_rel_offset x23, 240
- .cfi_rel_offset x24, 248
-
- stp x25, x26, [sp, #256]
- .cfi_rel_offset x25, 256
- .cfi_rel_offset x26, 264
-
- stp x27, x28, [sp, #272]
- .cfi_rel_offset x27, 272
- .cfi_rel_offset x28, 280
-
- stp xFP, xLR, [sp, #288]
- .cfi_rel_offset x29, 288
- .cfi_rel_offset x30, 296
+ // FP args
+ stp d0, d1, [sp, #16]
+ stp d2, d3, [sp, #32]
+ stp d4, d5, [sp, #48]
+ stp d6, d7, [sp, #64]
+
+ // args and x20(callee-save)
+ stp x1, x2, [sp, #80]
+ .cfi_rel_offset x1, 80
+ .cfi_rel_offset x2, 88
+
+ stp x3, x4, [sp, #96]
+ .cfi_rel_offset x3, 96
+ .cfi_rel_offset x4, 104
+
+ stp x5, x6, [sp, #112]
+ .cfi_rel_offset x5, 112
+ .cfi_rel_offset x6, 120
+
+ stp x7, x20, [sp, #128]
+ .cfi_rel_offset x7, 128
+ .cfi_rel_offset x20, 136
+
+ // Callee-saves.
+ stp x21, x22, [sp, #144]
+ .cfi_rel_offset x21, 144
+ .cfi_rel_offset x22, 152
+
+ stp x23, x24, [sp, #160]
+ .cfi_rel_offset x23, 160
+ .cfi_rel_offset x24, 168
+
+ stp x25, x26, [sp, #176]
+ .cfi_rel_offset x25, 176
+ .cfi_rel_offset x26, 184
+
+ stp x27, x28, [sp, #192]
+ .cfi_rel_offset x27, 192
+ .cfi_rel_offset x28, 200
+
+ // x29(callee-save) and LR
+ stp x29, xLR, [sp, #208]
+ .cfi_rel_offset x29, 208
+ .cfi_rel_offset x30, 216
+
+ // Save xSELF to xETR.
+ mov xETR, xSELF
.endm
/*
* TODO This is probably too conservative - saving FP & LR.
*/
.macro SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME
- adrp x9, :got:_ZN3art7Runtime9instance_E
- ldr x9, [x9, #:got_lo12:_ZN3art7Runtime9instance_E]
+ adrp xIP0, :got:_ZN3art7Runtime9instance_E
+ ldr xIP0, [xIP0, #:got_lo12:_ZN3art7Runtime9instance_E]
// Our registers aren't intermixed - just spill in order.
- ldr x9,[x9] // x9 = & (art::Runtime * art::Runtime.instance_) .
+ ldr xIP0, [xIP0] // xIP0 = & (art::Runtime * art::Runtime.instance_) .
- // x9 = (ArtMethod*) Runtime.instance_.callee_save_methods[kRefAndArgs] .
+ // xIP0 = (ArtMethod*) Runtime.instance_.callee_save_methods[kRefAndArgs] .
THIS_LOAD_REQUIRES_READ_BARRIER
- ldr x9, [x9, RUNTIME_REF_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET ]
+ ldr xIP0, [xIP0, RUNTIME_REF_AND_ARGS_CALLEE_SAVE_FRAME_OFFSET ]
SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME_INTERNAL
- str x9, [sp] // Store ArtMethod* Runtime::callee_save_methods_[kRefsAndArgs]
+ str xIP0, [sp] // Store ArtMethod* Runtime::callee_save_methods_[kRefsAndArgs]
.endm
+// TODO: Probably no need to restore registers preserved by aapcs64.
.macro RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME
+ // Restore xSELF.
+ mov xSELF, xETR
- ldp d0, d1, [sp, #16]
- ldp d2, d3, [sp, #32]
- ldp d4, d5, [sp, #48]
- ldp d6, d7, [sp, #64]
- ldp d8, d9, [sp, #80]
- ldp d10, d11, [sp, #96]
- ldp d12, d13, [sp, #112]
- ldp d14, d15, [sp, #128]
-
- // args.
- ldp x1, x2, [sp, #144]
+ // FP args
+ ldp d0, d1, [sp, #16]
+ ldp d2, d3, [sp, #32]
+ ldp d4, d5, [sp, #48]
+ ldp d6, d7, [sp, #64]
+
+ // args and x20(callee-save)
+ ldp x1, x2, [sp, #80]
.cfi_restore x1
.cfi_restore x2
- ldp x3, x4, [sp, #160]
+ ldp x3, x4, [sp, #96]
.cfi_restore x3
.cfi_restore x4
- ldp x5, x6, [sp, #176]
+ ldp x5, x6, [sp, #112]
.cfi_restore x5
.cfi_restore x6
- ldp x7, xSELF, [sp, #192]
+ ldp x7, x20, [sp, #128]
.cfi_restore x7
- .cfi_restore x18
-
- ldp x19, x20, [sp, #208]
- .cfi_restore x19
.cfi_restore x20
- ldp x21, x22, [sp, #224]
+ // Callee-saves.
+ ldp x21, x22, [sp, #144]
.cfi_restore x21
.cfi_restore x22
- ldp x23, x24, [sp, #240]
+ ldp x23, x24, [sp, #160]
.cfi_restore x23
.cfi_restore x24
- ldp x25, x26, [sp, #256]
+ ldp x25, x26, [sp, #176]
.cfi_restore x25
.cfi_restore x26
- ldp x27, x28, [sp, #272]
+ ldp x27, x28, [sp, #192]
.cfi_restore x27
.cfi_restore x28
- ldp xFP, xLR, [sp, #288]
+ // x29(callee-save) and LR
+ ldp x29, xLR, [sp, #208]
.cfi_restore x29
.cfi_restore x30
- add sp, sp, #304
- .cfi_adjust_cfa_offset -304
+ add sp, sp, #224
+ .cfi_adjust_cfa_offset -224
.endm
.macro RETURN_IF_RESULT_IS_ZERO
.endm
.macro RETURN_OR_DELIVER_PENDING_EXCEPTION
- RETURN_OR_DELIVER_PENDING_EXCEPTION_REG x9
+ RETURN_OR_DELIVER_PENDING_EXCEPTION_REG xIP0
.endm
// Same as above with x1. This is helpful in stubs that want to avoid clobbering another register.
.extern \cxx_name
ENTRY \c_name
SETUP_SAVE_ALL_CALLEE_SAVE_FRAME // save all registers as basis for long jump context
- mov x0, xSELF // pass Thread::Current
+ mov x0, xSELF // pass Thread::Current
mov x1, sp // pass SP
b \cxx_name // \cxx_name(Thread*, SP)
END \c_name
.extern \cxx_name
ENTRY \c_name
SETUP_SAVE_ALL_CALLEE_SAVE_FRAME // save all registers as basis for long jump context.
- mov x1, xSELF // pass Thread::Current.
+ mov x1, xSELF // pass Thread::Current.
mov x2, sp // pass SP.
b \cxx_name // \cxx_name(arg, Thread*, SP).
brk 0
.extern \cxx_name
ENTRY \c_name
SETUP_SAVE_ALL_CALLEE_SAVE_FRAME // save all registers as basis for long jump context
- mov x2, xSELF // pass Thread::Current
+ mov x2, xSELF // pass Thread::Current
mov x3, sp // pass SP
b \cxx_name // \cxx_name(arg1, arg2, Thread*, SP)
brk 0
*
* Adapted from ARM32 code.
*
- * Clobbers x12.
+ * Clobbers xIP0.
*/
.macro INVOKE_TRAMPOLINE c_name, cxx_name
.extern \cxx_name
mov x3, xSELF // pass Thread::Current
mov x4, sp
bl \cxx_name // (method_idx, this, caller, Thread*, SP)
- mov x12, x1 // save Method*->code_
+ mov xIP0, x1 // save Method*->code_
RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME
cbz x0, 1f // did we find the target? if not go to exception delivery
- br x12 // tail call to target
+ br xIP0 // tail call to target
1:
DELIVER_PENDING_EXCEPTION
END \c_name
.macro INVOKE_STUB_CREATE_FRAME
-SAVE_SIZE=6*8 // x4, x5, x19(wSUSPEND), SP, LR & FP saved.
+SAVE_SIZE=6*8 // x4, x5, xSUSPEND, SP, LR & FP saved.
SAVE_SIZE_AND_METHOD=SAVE_SIZE+STACK_REFERENCE_SIZE
.cfi_def_cfa_register x10 // before this.
.cfi_adjust_cfa_offset SAVE_SIZE
- stp x9, x19, [x10, #32] // Save old stack pointer and x19(wSUSPEND)
+ stp x9, xSUSPEND, [x10, #32] // Save old stack pointer and xSUSPEND
.cfi_rel_offset sp, 32
.cfi_rel_offset x19, 40
str x0, [x4]
.Lexit_art_quick_invoke_stub\@:
- ldp x2, x19, [xFP, #32] // Restore stack pointer and x19.
+ ldp x2, xSUSPEND, [xFP, #32] // Restore stack pointer and xSUSPEND.
.cfi_restore x19
mov sp, x2
.cfi_restore sp
* | FP'' | <- SP'
* +----------------------+
* +----------------------+
+ * | x19 | <- Used as wSUSPEND, won't be restored by managed code.
* | SP' |
* | X5 |
* | X4 | Saved registers
.endm
// Macros taking opportunity of code similarities for downcalls with referrer.
-
-// TODO: xSELF -> x19. Temporarily rely on xSELF being saved in REF_ONLY
.macro ONE_ARG_REF_DOWNCALL name, entrypoint, return
.extern \entrypoint
ENTRY \name
END \name
.endm
-// TODO: xSELF -> x19. Temporarily rely on xSELF being saved in REF_ONLY
.macro TWO_ARG_REF_DOWNCALL name, entrypoint, return
.extern \entrypoint
ENTRY \name
END \name
.endm
-// TODO: xSELF -> x19. Temporarily rely on xSELF being saved in REF_ONLY
.macro THREE_ARG_REF_DOWNCALL name, entrypoint, return
.extern \entrypoint
ENTRY \name
mov x2, xSELF // pass Thread::Current
mov x3, sp // pass SP
bl artQuickProxyInvokeHandler // (Method* proxy method, receiver, Thread*, SP)
- ldr xSELF, [sp, #200] // Restore self pointer.
- ldr x2, [xSELF, THREAD_EXCEPTION_OFFSET]
+ // Use xETR as xSELF might be scratched by native function above.
+ ldr x2, [xETR, THREAD_EXCEPTION_OFFSET]
cbnz x2, .Lexception_in_proxy // success if no exception is pending
RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME // Restore frame
fmov d0, x0 // Store result in d0 in case it was float or double
END art_quick_proxy_invoke_handler
/*
- * Called to resolve an imt conflict. x12 is a hidden argument that holds the target method's
+ * Called to resolve an imt conflict. xIP1 is a hidden argument that holds the target method's
* dex method index.
*/
ENTRY art_quick_imt_conflict_trampoline
ldr w0, [sp, #0] // load caller Method*
ldr w0, [x0, #METHOD_DEX_CACHE_METHODS_OFFSET] // load dex_cache_resolved_methods
add x0, x0, #OBJECT_ARRAY_DATA_OFFSET // get starting address of data
- ldr w0, [x0, x12, lsl 2] // load the target method
+ ldr w0, [x0, xIP1, lsl 2] // load the target method
b art_quick_invoke_interface_trampoline
END art_quick_imt_conflict_trampoline
mov x3, sp
bl artQuickResolutionTrampoline // (called, receiver, Thread*, SP)
cbz x0, 1f
- mov x9, x0 // Remember returned code pointer in x9.
+ mov xIP0, x0 // Remember returned code pointer in xIP0.
ldr w0, [sp, #0] // artQuickResolutionTrampoline puts called method in *SP.
RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME
- br x9
+ br xIP0
1:
RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME
DELIVER_PENDING_EXCEPTION
* | X22 | callee save
* | X21 | callee save
* | X20 | callee save
- * | X19 | callee save
* | X7 | arg7
* | X6 | arg6
* | X5 | arg5
* | X3 | arg3
* | X2 | arg2
* | X1 | arg1
- * | D15 | float arg 8
- * | D14 | float arg 8
- * | D13 | float arg 8
- * | D12 | callee save
- * | D11 | callee save
- * | D10 | callee save
- * | D9 | callee save
- * | D8 | callee save
* | D7 | float arg 8
* | D6 | float arg 7
* | D5 | float arg 6
// of the frame when the handle scope is inserted.
mov xFP, sp
- mov x8, #5120
- sub sp, sp, x8
+ mov xIP0, #5120
+ sub sp, sp, xIP0
// prepare for artQuickGenericJniTrampoline call
// (Thread*, SP)
add sp, sp, #128
- blr xIP0 // native call.
-
- // Restore self pointer.
- ldr xSELF, [x28, #200]
+ blr xIP0 // native call.
// result sign extension is handled in C code
// prepare for artQuickGenericJniEndTrampoline call
// (Thread*, result, result_f)
// x0 x1 x2 <= C calling convention
mov x1, x0 // Result (from saved)
- mov x0, xSELF // Thread register
+ mov x0, xETR // Thread register, original xSELF might be scratched by native code.
fmov x2, d0 // d0 will contain floating point result, but needs to go into x2
bl artQuickGenericJniEndTrampoline
mov sp, x28
.cfi_def_cfa_register sp
- // Restore self pointer.
- ldr xSELF, [x28, #200]
-
// Pending exceptions possible.
- ldr x1, [xSELF, THREAD_EXCEPTION_OFFSET]
+ // Use xETR as xSELF might be scratched by native code
+ ldr x1, [xETR, THREAD_EXCEPTION_OFFSET]
cbnz x1, .Lexception_in_native
// Tear down the callee-save frame.
.Lentry_error:
mov sp, x28
.cfi_def_cfa_register sp
- ldr xSELF, [x28, #200]
.Lexception_in_native:
RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME
DELIVER_PENDING_EXCEPTION
ENTRY art_quick_instrumentation_entry
SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME
- mov x19, x0 // Preserve method reference in a callee-save.
+ mov x20, x0 // Preserve method reference in a callee-save.
mov x2, xSELF
mov x3, sp
mov x4, xLR
bl artInstrumentationMethodEntryFromCode // (Method*, Object*, Thread*, SP, LR)
- mov x9, x0 // x0 = result of call.
- mov x0, x19 // Reload method reference.
+ mov xIP0, x0 // x0 = result of call.
+ mov x0, x20 // Reload method reference.
RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME // Note: will restore xSELF
adr xLR, art_quick_instrumentation_exit
- br x9 // Tail-call method with lr set to art_quick_instrumentation_exit.
+ br xIP0 // Tail-call method with lr set to art_quick_instrumentation_exit.
END art_quick_instrumentation_entry
.extern artInstrumentationMethodExitFromCode
mov x0, xSELF // Pass Thread.
bl artInstrumentationMethodExitFromCode // (Thread*, SP, gpr_res, fpr_res)
- mov x9, x0 // Return address from instrumentation call.
+ mov xIP0, x0 // Return address from instrumentation call.
mov xLR, x1 // r1 is holding link register if we're to bounce to deoptimize
ldr d0, [sp, #8] // Restore floating-point result.
ldr x0, [sp], 16 // Restore integer result, and drop stack area.
.cfi_adjust_cfa_offset 16
- // Need to restore x18.
- ldr xSELF, [sp, #72]
POP_REF_ONLY_CALLEE_SAVE_FRAME
- br x9 // Tail-call out.
+ br xIP0 // Tail-call out.
END art_quick_instrumentation_exit
/*
.Lindexof_loop4:
ldrh w6, [x0, #2]!
ldrh w7, [x0, #2]!
- ldrh w8, [x0, #2]!
- ldrh w9, [x0, #2]!
+ ldrh wIP0, [x0, #2]!
+ ldrh wIP1, [x0, #2]!
cmp w6, w1
b.eq .Lmatch_0
cmp w7, w1
b.eq .Lmatch_1
- cmp w8, w1
+ cmp wIP0, w1
b.eq .Lmatch_2
- cmp w9, w1
+ cmp wIP1, w1
b.eq .Lmatch_3
subs w2, w2, #4
b.ge .Lindexof_loop4
ret
.Ldo_memcmp16:
- mov x14, x0 // Save x0 and LR. __memcmp16 does not use these temps.
- mov x15, xLR // TODO: Codify and check that?
+ mov xIP0, x0 // Save x0 and LR. __memcmp16 does not use these temps.
+ mov xIP1, xLR // TODO: Codify and check that?
mov x0, x2
uxtw x2, w3
bl __memcmp16
- mov xLR, x15 // Restore LR.
+ mov xLR, xIP1 // Restore LR.
cmp x0, #0 // Check the memcmp difference.
- csel x0, x0, x14, ne // x0 := x0 != 0 ? x14(prev x0=length diff) : x1.
+ csel x0, x0, xIP0, ne // x0 := x0 != 0 ? xIP0(prev x0=length diff) : x1.
ret
END art_quick_string_compareto