quick_entrypoints_arm64.S revision 908eb22e49edc9fe070afe5ab44a5d07299dc976
1/* 2 * Copyright (C) 2014 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#include "asm_support_arm64.S" 18 19#include "arch/quick_alloc_entrypoints.S" 20 21 22.macro INCREASE_FRAME frame_adjustment 23 sub sp, sp, #(\frame_adjustment) 24 .cfi_adjust_cfa_offset (\frame_adjustment) 25.endm 26 27.macro DECREASE_FRAME frame_adjustment 28 add sp, sp, #(\frame_adjustment) 29 .cfi_adjust_cfa_offset -(\frame_adjustment) 30.endm 31 32.macro SAVE_REG reg, offset 33 str \reg, [sp, #(\offset)] 34 .cfi_rel_offset \reg, (\offset) 35.endm 36 37.macro RESTORE_REG reg, offset 38 ldr \reg, [sp, #(\offset)] 39 .cfi_restore \reg 40.endm 41 42.macro SAVE_TWO_REGS reg1, reg2, offset 43 stp \reg1, \reg2, [sp, #(\offset)] 44 .cfi_rel_offset \reg1, (\offset) 45 .cfi_rel_offset \reg2, (\offset) + 8 46.endm 47 48.macro RESTORE_TWO_REGS reg1, reg2, offset 49 ldp \reg1, \reg2, [sp, #(\offset)] 50 .cfi_restore \reg1 51 .cfi_restore \reg2 52.endm 53 54.macro SAVE_TWO_REGS_INCREASE_FRAME reg1, reg2, frame_adjustment 55 stp \reg1, \reg2, [sp, #-(\frame_adjustment)]! 56 .cfi_adjust_cfa_offset (\frame_adjustment) 57 .cfi_rel_offset \reg1, 0 58 .cfi_rel_offset \reg2, 8 59.endm 60 61.macro RESTORE_TWO_REGS_DECREASE_FRAME reg1, reg2, frame_adjustment 62 ldp \reg1, \reg2, [sp], #(\frame_adjustment) 63 .cfi_restore \reg1 64 .cfi_restore \reg2 65 .cfi_adjust_cfa_offset -(\frame_adjustment) 66.endm 67 68 /* 69 * Macro that sets up the callee save frame to conform with 70 * Runtime::CreateCalleeSaveMethod(kSaveAllCalleeSaves) 71 */ 72.macro SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 73 // art::Runtime** xIP0 = &art::Runtime::instance_ 74 adrp xIP0, :got:_ZN3art7Runtime9instance_E 75 ldr xIP0, [xIP0, #:got_lo12:_ZN3art7Runtime9instance_E] 76 77 // Our registers aren't intermixed - just spill in order. 78 ldr xIP0, [xIP0] // art::Runtime* xIP0 = art::Runtime::instance_; 79 80 // ArtMethod* xIP0 = Runtime::instance_->callee_save_methods_[kSaveAllCalleeSaves]; 81 ldr xIP0, [xIP0, RUNTIME_SAVE_ALL_CALLEE_SAVES_METHOD_OFFSET] 82 83 INCREASE_FRAME 176 84 85 // Ugly compile-time check, but we only have the preprocessor. 86#if (FRAME_SIZE_SAVE_ALL_CALLEE_SAVES != 176) 87#error "FRAME_SIZE_SAVE_ALL_CALLEE_SAVES(ARM64) size not as expected." 88#endif 89 90 // Stack alignment filler [sp, #8]. 91 // FP callee-saves. 92 stp d8, d9, [sp, #16] 93 stp d10, d11, [sp, #32] 94 stp d12, d13, [sp, #48] 95 stp d14, d15, [sp, #64] 96 97 // GP callee-saves 98 SAVE_TWO_REGS x19, x20, 80 99 SAVE_TWO_REGS x21, x22, 96 100 SAVE_TWO_REGS x23, x24, 112 101 SAVE_TWO_REGS x25, x26, 128 102 SAVE_TWO_REGS x27, x28, 144 103 SAVE_TWO_REGS x29, xLR, 160 104 105 // Store ArtMethod* Runtime::callee_save_methods_[kSaveAllCalleeSaves]. 106 str xIP0, [sp] 107 // Place sp in Thread::Current()->top_quick_frame. 108 mov xIP0, sp 109 str xIP0, [xSELF, # THREAD_TOP_QUICK_FRAME_OFFSET] 110.endm 111 112 /* 113 * Macro that sets up the callee save frame to conform with 114 * Runtime::CreateCalleeSaveMethod(kSaveRefsOnly). 115 */ 116.macro SETUP_SAVE_REFS_ONLY_FRAME 117 // art::Runtime** xIP0 = &art::Runtime::instance_ 118 adrp xIP0, :got:_ZN3art7Runtime9instance_E 119 ldr xIP0, [xIP0, #:got_lo12:_ZN3art7Runtime9instance_E] 120 121 // Our registers aren't intermixed - just spill in order. 122 ldr xIP0, [xIP0] // art::Runtime* xIP0 = art::Runtime::instance_; 123 124 // ArtMethod* xIP0 = Runtime::instance_->callee_save_methods_[kSaveRefOnly]; 125 ldr xIP0, [xIP0, RUNTIME_SAVE_REFS_ONLY_METHOD_OFFSET] 126 127 INCREASE_FRAME 96 128 129 // Ugly compile-time check, but we only have the preprocessor. 130#if (FRAME_SIZE_SAVE_REFS_ONLY != 96) 131#error "FRAME_SIZE_SAVE_REFS_ONLY(ARM64) size not as expected." 132#endif 133 134 // GP callee-saves. 135 // x20 paired with ArtMethod* - see below. 136 SAVE_TWO_REGS x21, x22, 16 137 SAVE_TWO_REGS x23, x24, 32 138 SAVE_TWO_REGS x25, x26, 48 139 SAVE_TWO_REGS x27, x28, 64 140 SAVE_TWO_REGS x29, xLR, 80 141 142 // Store ArtMethod* Runtime::callee_save_methods_[kSaveRefsOnly]. 143 stp xIP0, x20, [sp] 144 .cfi_rel_offset x20, 8 145 146 // Place sp in Thread::Current()->top_quick_frame. 147 mov xIP0, sp 148 str xIP0, [xSELF, # THREAD_TOP_QUICK_FRAME_OFFSET] 149.endm 150 151// TODO: Probably no need to restore registers preserved by aapcs64. 152.macro RESTORE_SAVE_REFS_ONLY_FRAME 153 // Callee-saves. 154 RESTORE_REG x20, 8 155 RESTORE_TWO_REGS x21, x22, 16 156 RESTORE_TWO_REGS x23, x24, 32 157 RESTORE_TWO_REGS x25, x26, 48 158 RESTORE_TWO_REGS x27, x28, 64 159 RESTORE_TWO_REGS x29, xLR, 80 160 161 DECREASE_FRAME 96 162.endm 163 164.macro POP_SAVE_REFS_ONLY_FRAME 165 DECREASE_FRAME 96 166.endm 167 168.macro RESTORE_SAVE_REFS_ONLY_FRAME_AND_RETURN 169 RESTORE_SAVE_REFS_ONLY_FRAME 170 ret 171.endm 172 173 174.macro SETUP_SAVE_REFS_AND_ARGS_FRAME_INTERNAL 175 INCREASE_FRAME 224 176 177 // Ugly compile-time check, but we only have the preprocessor. 178#if (FRAME_SIZE_SAVE_REFS_AND_ARGS != 224) 179#error "FRAME_SIZE_SAVE_REFS_AND_ARGS(ARM64) size not as expected." 180#endif 181 182 // Stack alignment filler [sp, #8]. 183 // FP args. 184 stp d0, d1, [sp, #16] 185 stp d2, d3, [sp, #32] 186 stp d4, d5, [sp, #48] 187 stp d6, d7, [sp, #64] 188 189 // Core args. 190 SAVE_TWO_REGS x1, x2, 80 191 SAVE_TWO_REGS x3, x4, 96 192 SAVE_TWO_REGS x5, x6, 112 193 194 // x7, Callee-saves. 195 SAVE_TWO_REGS x7, x20, 128 196 SAVE_TWO_REGS x21, x22, 144 197 SAVE_TWO_REGS x23, x24, 160 198 SAVE_TWO_REGS x25, x26, 176 199 SAVE_TWO_REGS x27, x28, 192 200 201 // x29(callee-save) and LR. 202 SAVE_TWO_REGS x29, xLR, 208 203 204.endm 205 206 /* 207 * Macro that sets up the callee save frame to conform with 208 * Runtime::CreateCalleeSaveMethod(kSaveRefsAndArgs). 209 * 210 * TODO This is probably too conservative - saving FP & LR. 211 */ 212.macro SETUP_SAVE_REFS_AND_ARGS_FRAME 213 // art::Runtime** xIP0 = &art::Runtime::instance_ 214 adrp xIP0, :got:_ZN3art7Runtime9instance_E 215 ldr xIP0, [xIP0, #:got_lo12:_ZN3art7Runtime9instance_E] 216 217 // Our registers aren't intermixed - just spill in order. 218 ldr xIP0, [xIP0] // art::Runtime* xIP0 = art::Runtime::instance_; 219 220 // ArtMethod* xIP0 = Runtime::instance_->callee_save_methods_[kSaveRefAndArgs]; 221 ldr xIP0, [xIP0, RUNTIME_SAVE_REFS_AND_ARGS_METHOD_OFFSET] 222 223 SETUP_SAVE_REFS_AND_ARGS_FRAME_INTERNAL 224 225 str xIP0, [sp] // Store ArtMethod* Runtime::callee_save_methods_[kSaveRefsAndArgs]. 226 // Place sp in Thread::Current()->top_quick_frame. 227 mov xIP0, sp 228 str xIP0, [xSELF, # THREAD_TOP_QUICK_FRAME_OFFSET] 229.endm 230 231.macro SETUP_SAVE_REFS_AND_ARGS_FRAME_WITH_METHOD_IN_X0 232 SETUP_SAVE_REFS_AND_ARGS_FRAME_INTERNAL 233 str x0, [sp, #0] // Store ArtMethod* to bottom of stack. 234 // Place sp in Thread::Current()->top_quick_frame. 235 mov xIP0, sp 236 str xIP0, [xSELF, # THREAD_TOP_QUICK_FRAME_OFFSET] 237.endm 238 239// TODO: Probably no need to restore registers preserved by aapcs64. 240.macro RESTORE_SAVE_REFS_AND_ARGS_FRAME 241 // FP args. 242 ldp d0, d1, [sp, #16] 243 ldp d2, d3, [sp, #32] 244 ldp d4, d5, [sp, #48] 245 ldp d6, d7, [sp, #64] 246 247 // Core args. 248 RESTORE_TWO_REGS x1, x2, 80 249 RESTORE_TWO_REGS x3, x4, 96 250 RESTORE_TWO_REGS x5, x6, 112 251 252 // x7, Callee-saves. 253 RESTORE_TWO_REGS x7, x20, 128 254 RESTORE_TWO_REGS x21, x22, 144 255 RESTORE_TWO_REGS x23, x24, 160 256 RESTORE_TWO_REGS x25, x26, 176 257 RESTORE_TWO_REGS x27, x28, 192 258 259 // x29(callee-save) and LR. 260 RESTORE_TWO_REGS x29, xLR, 208 261 262 DECREASE_FRAME 224 263.endm 264 265 /* 266 * Macro that sets up the callee save frame to conform with 267 * Runtime::CreateCalleeSaveMethod(kSaveEverything) 268 * when the SP has already been decremented by FRAME_SIZE_SAVE_EVERYTHING 269 * and saving registers x29 and LR is handled elsewhere. 270 */ 271.macro SETUP_SAVE_EVERYTHING_FRAME_DECREMENTED_SP_SKIP_X29_LR 272 // Ugly compile-time check, but we only have the preprocessor. 273#if (FRAME_SIZE_SAVE_EVERYTHING != 512) 274#error "FRAME_SIZE_SAVE_EVERYTHING(ARM64) size not as expected." 275#endif 276 277 // Save FP registers. 278 // For better performance, store d0 and d31 separately, so that all STPs are 16-byte aligned. 279 str d0, [sp, #8] 280 stp d1, d2, [sp, #16] 281 stp d3, d4, [sp, #32] 282 stp d5, d6, [sp, #48] 283 stp d7, d8, [sp, #64] 284 stp d9, d10, [sp, #80] 285 stp d11, d12, [sp, #96] 286 stp d13, d14, [sp, #112] 287 stp d15, d16, [sp, #128] 288 stp d17, d18, [sp, #144] 289 stp d19, d20, [sp, #160] 290 stp d21, d22, [sp, #176] 291 stp d23, d24, [sp, #192] 292 stp d25, d26, [sp, #208] 293 stp d27, d28, [sp, #224] 294 stp d29, d30, [sp, #240] 295 str d31, [sp, #256] 296 297 // Save core registers. 298 SAVE_REG x0, 264 299 SAVE_TWO_REGS x1, x2, 272 300 SAVE_TWO_REGS x3, x4, 288 301 SAVE_TWO_REGS x5, x6, 304 302 SAVE_TWO_REGS x7, x8, 320 303 SAVE_TWO_REGS x9, x10, 336 304 SAVE_TWO_REGS x11, x12, 352 305 SAVE_TWO_REGS x13, x14, 368 306 SAVE_TWO_REGS x15, x16, 384 307 SAVE_TWO_REGS x17, x18, 400 308 SAVE_TWO_REGS x19, x20, 416 309 SAVE_TWO_REGS x21, x22, 432 310 SAVE_TWO_REGS x23, x24, 448 311 SAVE_TWO_REGS x25, x26, 464 312 SAVE_TWO_REGS x27, x28, 480 313 314 // art::Runtime** xIP0 = &art::Runtime::instance_ 315 adrp xIP0, :got:_ZN3art7Runtime9instance_E 316 ldr xIP0, [xIP0, #:got_lo12:_ZN3art7Runtime9instance_E] 317 318 ldr xIP0, [xIP0] // art::Runtime* xIP0 = art::Runtime::instance_; 319 320 // ArtMethod* xIP0 = Runtime::instance_->callee_save_methods_[kSaveEverything]; 321 ldr xIP0, [xIP0, RUNTIME_SAVE_EVERYTHING_METHOD_OFFSET] 322 323 // Store ArtMethod* Runtime::callee_save_methods_[kSaveEverything]. 324 str xIP0, [sp] 325 // Place sp in Thread::Current()->top_quick_frame. 326 mov xIP0, sp 327 str xIP0, [xSELF, # THREAD_TOP_QUICK_FRAME_OFFSET] 328.endm 329 330 /* 331 * Macro that sets up the callee save frame to conform with 332 * Runtime::CreateCalleeSaveMethod(kSaveEverything) 333 */ 334.macro SETUP_SAVE_EVERYTHING_FRAME 335 INCREASE_FRAME 512 336 SAVE_TWO_REGS x29, xLR, 496 337 SETUP_SAVE_EVERYTHING_FRAME_DECREMENTED_SP_SKIP_X29_LR 338.endm 339 340.macro RESTORE_SAVE_EVERYTHING_FRAME 341 // Restore FP registers. 342 // For better performance, load d0 and d31 separately, so that all LDPs are 16-byte aligned. 343 ldr d0, [sp, #8] 344 ldp d1, d2, [sp, #16] 345 ldp d3, d4, [sp, #32] 346 ldp d5, d6, [sp, #48] 347 ldp d7, d8, [sp, #64] 348 ldp d9, d10, [sp, #80] 349 ldp d11, d12, [sp, #96] 350 ldp d13, d14, [sp, #112] 351 ldp d15, d16, [sp, #128] 352 ldp d17, d18, [sp, #144] 353 ldp d19, d20, [sp, #160] 354 ldp d21, d22, [sp, #176] 355 ldp d23, d24, [sp, #192] 356 ldp d25, d26, [sp, #208] 357 ldp d27, d28, [sp, #224] 358 ldp d29, d30, [sp, #240] 359 ldr d31, [sp, #256] 360 361 // Restore core registers. 362 RESTORE_REG x0, 264 363 RESTORE_TWO_REGS x1, x2, 272 364 RESTORE_TWO_REGS x3, x4, 288 365 RESTORE_TWO_REGS x5, x6, 304 366 RESTORE_TWO_REGS x7, x8, 320 367 RESTORE_TWO_REGS x9, x10, 336 368 RESTORE_TWO_REGS x11, x12, 352 369 RESTORE_TWO_REGS x13, x14, 368 370 RESTORE_TWO_REGS x15, x16, 384 371 RESTORE_TWO_REGS x17, x18, 400 372 RESTORE_TWO_REGS x19, x20, 416 373 RESTORE_TWO_REGS x21, x22, 432 374 RESTORE_TWO_REGS x23, x24, 448 375 RESTORE_TWO_REGS x25, x26, 464 376 RESTORE_TWO_REGS x27, x28, 480 377 RESTORE_TWO_REGS x29, xLR, 496 378 379 DECREASE_FRAME 512 380.endm 381 382.macro RETURN_IF_RESULT_IS_ZERO 383 cbnz x0, 1f // result non-zero branch over 384 ret // return 3851: 386.endm 387 388.macro RETURN_IF_RESULT_IS_NON_ZERO 389 cbz x0, 1f // result zero branch over 390 ret // return 3911: 392.endm 393 394 /* 395 * Macro that set calls through to artDeliverPendingExceptionFromCode, where the pending 396 * exception is Thread::Current()->exception_ 397 */ 398.macro DELIVER_PENDING_EXCEPTION 399 SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 400 mov x0, xSELF 401 402 // Point of no return. 403 bl artDeliverPendingExceptionFromCode // artDeliverPendingExceptionFromCode(Thread*) 404 brk 0 // Unreached 405.endm 406 407.macro RETURN_OR_DELIVER_PENDING_EXCEPTION_REG reg 408 ldr \reg, [xSELF, # THREAD_EXCEPTION_OFFSET] // Get exception field. 409 cbnz \reg, 1f 410 ret 4111: 412 DELIVER_PENDING_EXCEPTION 413.endm 414 415.macro RETURN_OR_DELIVER_PENDING_EXCEPTION 416 RETURN_OR_DELIVER_PENDING_EXCEPTION_REG xIP0 417.endm 418 419// Same as above with x1. This is helpful in stubs that want to avoid clobbering another register. 420.macro RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 421 RETURN_OR_DELIVER_PENDING_EXCEPTION_REG x1 422.endm 423 424.macro RETURN_IF_W0_IS_ZERO_OR_DELIVER 425 cbnz w0, 1f // result non-zero branch over 426 ret // return 4271: 428 DELIVER_PENDING_EXCEPTION 429.endm 430 431.macro NO_ARG_RUNTIME_EXCEPTION c_name, cxx_name 432 .extern \cxx_name 433ENTRY \c_name 434 SETUP_SAVE_ALL_CALLEE_SAVES_FRAME // save all registers as basis for long jump context 435 mov x0, xSELF // pass Thread::Current 436 bl \cxx_name // \cxx_name(Thread*) 437END \c_name 438.endm 439 440.macro ONE_ARG_RUNTIME_EXCEPTION c_name, cxx_name 441 .extern \cxx_name 442ENTRY \c_name 443 SETUP_SAVE_ALL_CALLEE_SAVES_FRAME // save all registers as basis for long jump context. 444 mov x1, xSELF // pass Thread::Current. 445 bl \cxx_name // \cxx_name(arg, Thread*). 446 brk 0 447END \c_name 448.endm 449 450.macro TWO_ARG_RUNTIME_EXCEPTION c_name, cxx_name 451 .extern \cxx_name 452ENTRY \c_name 453 SETUP_SAVE_ALL_CALLEE_SAVES_FRAME // save all registers as basis for long jump context 454 mov x2, xSELF // pass Thread::Current 455 bl \cxx_name // \cxx_name(arg1, arg2, Thread*) 456 brk 0 457END \c_name 458.endm 459 460 /* 461 * Called by managed code, saves callee saves and then calls artThrowException 462 * that will place a mock Method* at the bottom of the stack. Arg1 holds the exception. 463 */ 464ONE_ARG_RUNTIME_EXCEPTION art_quick_deliver_exception, artDeliverExceptionFromCode 465 466 /* 467 * Called by managed code to create and deliver a NullPointerException. 468 */ 469NO_ARG_RUNTIME_EXCEPTION art_quick_throw_null_pointer_exception, artThrowNullPointerExceptionFromCode 470 471 /* 472 * Call installed by a signal handler to create and deliver a NullPointerException. 473 */ 474 .extern art_quick_throw_null_pointer_exception_from_signal 475ENTRY art_quick_throw_null_pointer_exception_from_signal 476 // The fault handler pushes the gc map address, i.e. "return address", to stack 477 // and passes the fault address in LR. So we need to set up the CFI info accordingly. 478 .cfi_def_cfa_offset __SIZEOF_POINTER__ 479 .cfi_rel_offset lr, 0 480 // Save all registers as basis for long jump context. 481 INCREASE_FRAME (FRAME_SIZE_SAVE_EVERYTHING - __SIZEOF_POINTER__) 482 SAVE_REG x29, (FRAME_SIZE_SAVE_EVERYTHING - 2 * __SIZEOF_POINTER__) // LR already saved. 483 SETUP_SAVE_EVERYTHING_FRAME_DECREMENTED_SP_SKIP_X29_LR 484 mov x0, lr // pass the fault address stored in LR by the fault handler. 485 mov x1, xSELF // pass Thread::Current. 486 bl artThrowNullPointerExceptionFromSignal // (arg, Thread*). 487 brk 0 488END art_quick_throw_null_pointer_exception_from_signal 489 490 /* 491 * Called by managed code to create and deliver an ArithmeticException. 492 */ 493NO_ARG_RUNTIME_EXCEPTION art_quick_throw_div_zero, artThrowDivZeroFromCode 494 495 /* 496 * Called by managed code to create and deliver an ArrayIndexOutOfBoundsException. Arg1 holds 497 * index, arg2 holds limit. 498 */ 499TWO_ARG_RUNTIME_EXCEPTION art_quick_throw_array_bounds, artThrowArrayBoundsFromCode 500 501 /* 502 * Called by managed code to create and deliver a StringIndexOutOfBoundsException 503 * as if thrown from a call to String.charAt(). Arg1 holds index, arg2 holds limit. 504 */ 505TWO_ARG_RUNTIME_EXCEPTION art_quick_throw_string_bounds, artThrowStringBoundsFromCode 506 507 /* 508 * Called by managed code to create and deliver a StackOverflowError. 509 */ 510NO_ARG_RUNTIME_EXCEPTION art_quick_throw_stack_overflow, artThrowStackOverflowFromCode 511 512 /* 513 * All generated callsites for interface invokes and invocation slow paths will load arguments 514 * as usual - except instead of loading arg0/x0 with the target Method*, arg0/x0 will contain 515 * the method_idx. This wrapper will save arg1-arg3, and call the appropriate C helper. 516 * NOTE: "this" is first visible argument of the target, and so can be found in arg1/x1. 517 * 518 * The helper will attempt to locate the target and return a 128-bit result in x0/x1 consisting 519 * of the target Method* in x0 and method->code_ in x1. 520 * 521 * If unsuccessful, the helper will return null/????. There will be a pending exception in the 522 * thread and we branch to another stub to deliver it. 523 * 524 * On success this wrapper will restore arguments and *jump* to the target, leaving the lr 525 * pointing back to the original caller. 526 * 527 * Adapted from ARM32 code. 528 * 529 * Clobbers xIP0. 530 */ 531.macro INVOKE_TRAMPOLINE_BODY cxx_name 532 .extern \cxx_name 533 SETUP_SAVE_REFS_AND_ARGS_FRAME // save callee saves in case allocation triggers GC 534 // Helper signature is always 535 // (method_idx, *this_object, *caller_method, *self, sp) 536 537 mov x2, xSELF // pass Thread::Current 538 mov x3, sp 539 bl \cxx_name // (method_idx, this, Thread*, SP) 540 mov xIP0, x1 // save Method*->code_ 541 RESTORE_SAVE_REFS_AND_ARGS_FRAME 542 cbz x0, 1f // did we find the target? if not go to exception delivery 543 br xIP0 // tail call to target 5441: 545 DELIVER_PENDING_EXCEPTION 546.endm 547.macro INVOKE_TRAMPOLINE c_name, cxx_name 548ENTRY \c_name 549 INVOKE_TRAMPOLINE_BODY \cxx_name 550END \c_name 551.endm 552 553INVOKE_TRAMPOLINE art_quick_invoke_interface_trampoline_with_access_check, artInvokeInterfaceTrampolineWithAccessCheck 554 555INVOKE_TRAMPOLINE art_quick_invoke_static_trampoline_with_access_check, artInvokeStaticTrampolineWithAccessCheck 556INVOKE_TRAMPOLINE art_quick_invoke_direct_trampoline_with_access_check, artInvokeDirectTrampolineWithAccessCheck 557INVOKE_TRAMPOLINE art_quick_invoke_super_trampoline_with_access_check, artInvokeSuperTrampolineWithAccessCheck 558INVOKE_TRAMPOLINE art_quick_invoke_virtual_trampoline_with_access_check, artInvokeVirtualTrampolineWithAccessCheck 559 560 561.macro INVOKE_STUB_CREATE_FRAME 562 563SAVE_SIZE=15*8 // x4, x5, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28, SP, LR, FP saved. 564SAVE_SIZE_AND_METHOD=SAVE_SIZE+8 565 566 567 mov x9, sp // Save stack pointer. 568 .cfi_register sp,x9 569 570 add x10, x2, # SAVE_SIZE_AND_METHOD // calculate size of frame. 571 sub x10, sp, x10 // Calculate SP position - saves + ArtMethod* + args 572 and x10, x10, # ~0xf // Enforce 16 byte stack alignment. 573 mov sp, x10 // Set new SP. 574 575 sub x10, x9, #SAVE_SIZE // Calculate new FP (later). Done here as we must move SP 576 .cfi_def_cfa_register x10 // before this. 577 .cfi_adjust_cfa_offset SAVE_SIZE 578 579 str x28, [x10, #112] 580 .cfi_rel_offset x28, 112 581 582 stp x26, x27, [x10, #96] 583 .cfi_rel_offset x26, 96 584 .cfi_rel_offset x27, 104 585 586 stp x24, x25, [x10, #80] 587 .cfi_rel_offset x24, 80 588 .cfi_rel_offset x25, 88 589 590 stp x22, x23, [x10, #64] 591 .cfi_rel_offset x22, 64 592 .cfi_rel_offset x23, 72 593 594 stp x20, x21, [x10, #48] 595 .cfi_rel_offset x20, 48 596 .cfi_rel_offset x21, 56 597 598 stp x9, x19, [x10, #32] // Save old stack pointer and x19. 599 .cfi_rel_offset sp, 32 600 .cfi_rel_offset x19, 40 601 602 stp x4, x5, [x10, #16] // Save result and shorty addresses. 603 .cfi_rel_offset x4, 16 604 .cfi_rel_offset x5, 24 605 606 stp xFP, xLR, [x10] // Store LR & FP. 607 .cfi_rel_offset x29, 0 608 .cfi_rel_offset x30, 8 609 610 mov xFP, x10 // Use xFP now, as it's callee-saved. 611 .cfi_def_cfa_register x29 612 mov xSELF, x3 // Move thread pointer into SELF register. 613 614 // Copy arguments into stack frame. 615 // Use simple copy routine for now. 616 // 4 bytes per slot. 617 // X1 - source address 618 // W2 - args length 619 // X9 - destination address. 620 // W10 - temporary 621 add x9, sp, #8 // Destination address is bottom of stack + null. 622 623 // Copy parameters into the stack. Use numeric label as this is a macro and Clang's assembler 624 // does not have unique-id variables. 6251: 626 cmp w2, #0 627 beq 2f 628 sub w2, w2, #4 // Need 65536 bytes of range. 629 ldr w10, [x1, x2] 630 str w10, [x9, x2] 631 632 b 1b 633 6342: 635 // Store null into ArtMethod* at bottom of frame. 636 str xzr, [sp] 637.endm 638 639.macro INVOKE_STUB_CALL_AND_RETURN 640 641 // load method-> METHOD_QUICK_CODE_OFFSET 642 ldr x9, [x0, #ART_METHOD_QUICK_CODE_OFFSET_64] 643 // Branch to method. 644 blr x9 645 646 // Restore return value address and shorty address. 647 ldp x4,x5, [xFP, #16] 648 .cfi_restore x4 649 .cfi_restore x5 650 651 ldr x28, [xFP, #112] 652 .cfi_restore x28 653 654 ldp x26, x27, [xFP, #96] 655 .cfi_restore x26 656 .cfi_restore x27 657 658 ldp x24, x25, [xFP, #80] 659 .cfi_restore x24 660 .cfi_restore x25 661 662 ldp x22, x23, [xFP, #64] 663 .cfi_restore x22 664 .cfi_restore x23 665 666 ldp x20, x21, [xFP, #48] 667 .cfi_restore x20 668 .cfi_restore x21 669 670 // Store result (w0/x0/s0/d0) appropriately, depending on resultType. 671 ldrb w10, [x5] 672 673 // Check the return type and store the correct register into the jvalue in memory. 674 // Use numeric label as this is a macro and Clang's assembler does not have unique-id variables. 675 676 // Don't set anything for a void type. 677 cmp w10, #'V' 678 beq 3f 679 680 // Is it a double? 681 cmp w10, #'D' 682 bne 1f 683 str d0, [x4] 684 b 3f 685 6861: // Is it a float? 687 cmp w10, #'F' 688 bne 2f 689 str s0, [x4] 690 b 3f 691 6922: // Just store x0. Doesn't matter if it is 64 or 32 bits. 693 str x0, [x4] 694 6953: // Finish up. 696 ldp x2, x19, [xFP, #32] // Restore stack pointer and x19. 697 .cfi_restore x19 698 mov sp, x2 699 .cfi_restore sp 700 701 ldp xFP, xLR, [xFP] // Restore old frame pointer and link register. 702 .cfi_restore x29 703 .cfi_restore x30 704 705 ret 706 707.endm 708 709 710/* 711 * extern"C" void art_quick_invoke_stub(ArtMethod *method, x0 712 * uint32_t *args, x1 713 * uint32_t argsize, w2 714 * Thread *self, x3 715 * JValue *result, x4 716 * char *shorty); x5 717 * +----------------------+ 718 * | | 719 * | C/C++ frame | 720 * | LR'' | 721 * | FP'' | <- SP' 722 * +----------------------+ 723 * +----------------------+ 724 * | x28 | <- TODO: Remove callee-saves. 725 * | : | 726 * | x19 | 727 * | SP' | 728 * | X5 | 729 * | X4 | Saved registers 730 * | LR' | 731 * | FP' | <- FP 732 * +----------------------+ 733 * | uint32_t out[n-1] | 734 * | : : | Outs 735 * | uint32_t out[0] | 736 * | ArtMethod* | <- SP value=null 737 * +----------------------+ 738 * 739 * Outgoing registers: 740 * x0 - Method* 741 * x1-x7 - integer parameters. 742 * d0-d7 - Floating point parameters. 743 * xSELF = self 744 * SP = & of ArtMethod* 745 * x1 = "this" pointer. 746 * 747 */ 748ENTRY art_quick_invoke_stub 749 // Spill registers as per AACPS64 calling convention. 750 INVOKE_STUB_CREATE_FRAME 751 752 // Fill registers x/w1 to x/w7 and s/d0 to s/d7 with parameters. 753 // Parse the passed shorty to determine which register to load. 754 // Load addresses for routines that load WXSD registers. 755 adr x11, .LstoreW2 756 adr x12, .LstoreX2 757 adr x13, .LstoreS0 758 adr x14, .LstoreD0 759 760 // Initialize routine offsets to 0 for integers and floats. 761 // x8 for integers, x15 for floating point. 762 mov x8, #0 763 mov x15, #0 764 765 add x10, x5, #1 // Load shorty address, plus one to skip return value. 766 ldr w1, [x9],#4 // Load "this" parameter, and increment arg pointer. 767 768 // Loop to fill registers. 769.LfillRegisters: 770 ldrb w17, [x10], #1 // Load next character in signature, and increment. 771 cbz w17, .LcallFunction // Exit at end of signature. Shorty 0 terminated. 772 773 cmp w17, #'F' // is this a float? 774 bne .LisDouble 775 776 cmp x15, # 8*12 // Skip this load if all registers full. 777 beq .Ladvance4 778 779 add x17, x13, x15 // Calculate subroutine to jump to. 780 br x17 781 782.LisDouble: 783 cmp w17, #'D' // is this a double? 784 bne .LisLong 785 786 cmp x15, # 8*12 // Skip this load if all registers full. 787 beq .Ladvance8 788 789 add x17, x14, x15 // Calculate subroutine to jump to. 790 br x17 791 792.LisLong: 793 cmp w17, #'J' // is this a long? 794 bne .LisOther 795 796 cmp x8, # 6*12 // Skip this load if all registers full. 797 beq .Ladvance8 798 799 add x17, x12, x8 // Calculate subroutine to jump to. 800 br x17 801 802.LisOther: // Everything else takes one vReg. 803 cmp x8, # 6*12 // Skip this load if all registers full. 804 beq .Ladvance4 805 806 add x17, x11, x8 // Calculate subroutine to jump to. 807 br x17 808 809.Ladvance4: 810 add x9, x9, #4 811 b .LfillRegisters 812 813.Ladvance8: 814 add x9, x9, #8 815 b .LfillRegisters 816 817// Macro for loading a parameter into a register. 818// counter - the register with offset into these tables 819// size - the size of the register - 4 or 8 bytes. 820// register - the name of the register to be loaded. 821.macro LOADREG counter size register return 822 ldr \register , [x9], #\size 823 add \counter, \counter, 12 824 b \return 825.endm 826 827// Store ints. 828.LstoreW2: 829 LOADREG x8 4 w2 .LfillRegisters 830 LOADREG x8 4 w3 .LfillRegisters 831 LOADREG x8 4 w4 .LfillRegisters 832 LOADREG x8 4 w5 .LfillRegisters 833 LOADREG x8 4 w6 .LfillRegisters 834 LOADREG x8 4 w7 .LfillRegisters 835 836// Store longs. 837.LstoreX2: 838 LOADREG x8 8 x2 .LfillRegisters 839 LOADREG x8 8 x3 .LfillRegisters 840 LOADREG x8 8 x4 .LfillRegisters 841 LOADREG x8 8 x5 .LfillRegisters 842 LOADREG x8 8 x6 .LfillRegisters 843 LOADREG x8 8 x7 .LfillRegisters 844 845// Store singles. 846.LstoreS0: 847 LOADREG x15 4 s0 .LfillRegisters 848 LOADREG x15 4 s1 .LfillRegisters 849 LOADREG x15 4 s2 .LfillRegisters 850 LOADREG x15 4 s3 .LfillRegisters 851 LOADREG x15 4 s4 .LfillRegisters 852 LOADREG x15 4 s5 .LfillRegisters 853 LOADREG x15 4 s6 .LfillRegisters 854 LOADREG x15 4 s7 .LfillRegisters 855 856// Store doubles. 857.LstoreD0: 858 LOADREG x15 8 d0 .LfillRegisters 859 LOADREG x15 8 d1 .LfillRegisters 860 LOADREG x15 8 d2 .LfillRegisters 861 LOADREG x15 8 d3 .LfillRegisters 862 LOADREG x15 8 d4 .LfillRegisters 863 LOADREG x15 8 d5 .LfillRegisters 864 LOADREG x15 8 d6 .LfillRegisters 865 LOADREG x15 8 d7 .LfillRegisters 866 867 868.LcallFunction: 869 870 INVOKE_STUB_CALL_AND_RETURN 871 872END art_quick_invoke_stub 873 874/* extern"C" 875 * void art_quick_invoke_static_stub(ArtMethod *method, x0 876 * uint32_t *args, x1 877 * uint32_t argsize, w2 878 * Thread *self, x3 879 * JValue *result, x4 880 * char *shorty); x5 881 */ 882ENTRY art_quick_invoke_static_stub 883 // Spill registers as per AACPS64 calling convention. 884 INVOKE_STUB_CREATE_FRAME 885 886 // Fill registers x/w1 to x/w7 and s/d0 to s/d7 with parameters. 887 // Parse the passed shorty to determine which register to load. 888 // Load addresses for routines that load WXSD registers. 889 adr x11, .LstoreW1_2 890 adr x12, .LstoreX1_2 891 adr x13, .LstoreS0_2 892 adr x14, .LstoreD0_2 893 894 // Initialize routine offsets to 0 for integers and floats. 895 // x8 for integers, x15 for floating point. 896 mov x8, #0 897 mov x15, #0 898 899 add x10, x5, #1 // Load shorty address, plus one to skip return value. 900 901 // Loop to fill registers. 902.LfillRegisters2: 903 ldrb w17, [x10], #1 // Load next character in signature, and increment. 904 cbz w17, .LcallFunction2 // Exit at end of signature. Shorty 0 terminated. 905 906 cmp w17, #'F' // is this a float? 907 bne .LisDouble2 908 909 cmp x15, # 8*12 // Skip this load if all registers full. 910 beq .Ladvance4_2 911 912 add x17, x13, x15 // Calculate subroutine to jump to. 913 br x17 914 915.LisDouble2: 916 cmp w17, #'D' // is this a double? 917 bne .LisLong2 918 919 cmp x15, # 8*12 // Skip this load if all registers full. 920 beq .Ladvance8_2 921 922 add x17, x14, x15 // Calculate subroutine to jump to. 923 br x17 924 925.LisLong2: 926 cmp w17, #'J' // is this a long? 927 bne .LisOther2 928 929 cmp x8, # 7*12 // Skip this load if all registers full. 930 beq .Ladvance8_2 931 932 add x17, x12, x8 // Calculate subroutine to jump to. 933 br x17 934 935.LisOther2: // Everything else takes one vReg. 936 cmp x8, # 7*12 // Skip this load if all registers full. 937 beq .Ladvance4_2 938 939 add x17, x11, x8 // Calculate subroutine to jump to. 940 br x17 941 942.Ladvance4_2: 943 add x9, x9, #4 944 b .LfillRegisters2 945 946.Ladvance8_2: 947 add x9, x9, #8 948 b .LfillRegisters2 949 950// Store ints. 951.LstoreW1_2: 952 LOADREG x8 4 w1 .LfillRegisters2 953 LOADREG x8 4 w2 .LfillRegisters2 954 LOADREG x8 4 w3 .LfillRegisters2 955 LOADREG x8 4 w4 .LfillRegisters2 956 LOADREG x8 4 w5 .LfillRegisters2 957 LOADREG x8 4 w6 .LfillRegisters2 958 LOADREG x8 4 w7 .LfillRegisters2 959 960// Store longs. 961.LstoreX1_2: 962 LOADREG x8 8 x1 .LfillRegisters2 963 LOADREG x8 8 x2 .LfillRegisters2 964 LOADREG x8 8 x3 .LfillRegisters2 965 LOADREG x8 8 x4 .LfillRegisters2 966 LOADREG x8 8 x5 .LfillRegisters2 967 LOADREG x8 8 x6 .LfillRegisters2 968 LOADREG x8 8 x7 .LfillRegisters2 969 970// Store singles. 971.LstoreS0_2: 972 LOADREG x15 4 s0 .LfillRegisters2 973 LOADREG x15 4 s1 .LfillRegisters2 974 LOADREG x15 4 s2 .LfillRegisters2 975 LOADREG x15 4 s3 .LfillRegisters2 976 LOADREG x15 4 s4 .LfillRegisters2 977 LOADREG x15 4 s5 .LfillRegisters2 978 LOADREG x15 4 s6 .LfillRegisters2 979 LOADREG x15 4 s7 .LfillRegisters2 980 981// Store doubles. 982.LstoreD0_2: 983 LOADREG x15 8 d0 .LfillRegisters2 984 LOADREG x15 8 d1 .LfillRegisters2 985 LOADREG x15 8 d2 .LfillRegisters2 986 LOADREG x15 8 d3 .LfillRegisters2 987 LOADREG x15 8 d4 .LfillRegisters2 988 LOADREG x15 8 d5 .LfillRegisters2 989 LOADREG x15 8 d6 .LfillRegisters2 990 LOADREG x15 8 d7 .LfillRegisters2 991 992 993.LcallFunction2: 994 995 INVOKE_STUB_CALL_AND_RETURN 996 997END art_quick_invoke_static_stub 998 999 1000 1001/* extern"C" void art_quick_osr_stub(void** stack, x0 1002 * size_t stack_size_in_bytes, x1 1003 * const uin8_t* native_pc, x2 1004 * JValue *result, x3 1005 * char *shorty, x4 1006 * Thread *self) x5 1007 */ 1008ENTRY art_quick_osr_stub 1009SAVE_SIZE=15*8 // x3, x4, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28, SP, LR, FP saved. 1010 mov x9, sp // Save stack pointer. 1011 .cfi_register sp,x9 1012 1013 sub x10, sp, # SAVE_SIZE 1014 and x10, x10, # ~0xf // Enforce 16 byte stack alignment. 1015 mov sp, x10 // Set new SP. 1016 1017 str x28, [sp, #112] 1018 stp x26, x27, [sp, #96] 1019 stp x24, x25, [sp, #80] 1020 stp x22, x23, [sp, #64] 1021 stp x20, x21, [sp, #48] 1022 stp x9, x19, [sp, #32] // Save old stack pointer and x19. 1023 stp x3, x4, [sp, #16] // Save result and shorty addresses. 1024 stp xFP, xLR, [sp] // Store LR & FP. 1025 mov xSELF, x5 // Move thread pointer into SELF register. 1026 1027 sub sp, sp, #16 1028 str xzr, [sp] // Store null for ArtMethod* slot 1029 // Branch to stub. 1030 bl .Losr_entry 1031 add sp, sp, #16 1032 1033 // Restore return value address and shorty address. 1034 ldp x3,x4, [sp, #16] 1035 ldr x28, [sp, #112] 1036 ldp x26, x27, [sp, #96] 1037 ldp x24, x25, [sp, #80] 1038 ldp x22, x23, [sp, #64] 1039 ldp x20, x21, [sp, #48] 1040 1041 // Store result (w0/x0/s0/d0) appropriately, depending on resultType. 1042 ldrb w10, [x4] 1043 1044 // Check the return type and store the correct register into the jvalue in memory. 1045 1046 // Don't set anything for a void type. 1047 cmp w10, #'V' 1048 beq .Losr_exit 1049 1050 // Is it a double? 1051 cmp w10, #'D' 1052 bne .Lno_double 1053 str d0, [x3] 1054 b .Losr_exit 1055 1056.Lno_double: // Is it a float? 1057 cmp w10, #'F' 1058 bne .Lno_float 1059 str s0, [x3] 1060 b .Losr_exit 1061 1062.Lno_float: // Just store x0. Doesn't matter if it is 64 or 32 bits. 1063 str x0, [x3] 1064 1065.Losr_exit: // Finish up. 1066 ldp x2, x19, [sp, #32] // Restore stack pointer and x19. 1067 ldp xFP, xLR, [sp] // Restore old frame pointer and link register. 1068 mov sp, x2 1069 ret 1070 1071.Losr_entry: 1072 // Update stack pointer for the callee 1073 sub sp, sp, x1 1074 1075 // Update link register slot expected by the callee. 1076 sub w1, w1, #8 1077 str lr, [sp, x1] 1078 1079 // Copy arguments into stack frame. 1080 // Use simple copy routine for now. 1081 // 4 bytes per slot. 1082 // X0 - source address 1083 // W1 - args length 1084 // SP - destination address. 1085 // W10 - temporary 1086.Losr_loop_entry: 1087 cmp w1, #0 1088 beq .Losr_loop_exit 1089 sub w1, w1, #4 1090 ldr w10, [x0, x1] 1091 str w10, [sp, x1] 1092 b .Losr_loop_entry 1093 1094.Losr_loop_exit: 1095 // Branch to the OSR entry point. 1096 br x2 1097 1098END art_quick_osr_stub 1099 1100 /* 1101 * On entry x0 is uintptr_t* gprs_ and x1 is uint64_t* fprs_ 1102 */ 1103 1104ENTRY art_quick_do_long_jump 1105 // Load FPRs 1106 ldp d0, d1, [x1], #16 1107 ldp d2, d3, [x1], #16 1108 ldp d4, d5, [x1], #16 1109 ldp d6, d7, [x1], #16 1110 ldp d8, d9, [x1], #16 1111 ldp d10, d11, [x1], #16 1112 ldp d12, d13, [x1], #16 1113 ldp d14, d15, [x1], #16 1114 ldp d16, d17, [x1], #16 1115 ldp d18, d19, [x1], #16 1116 ldp d20, d21, [x1], #16 1117 ldp d22, d23, [x1], #16 1118 ldp d24, d25, [x1], #16 1119 ldp d26, d27, [x1], #16 1120 ldp d28, d29, [x1], #16 1121 ldp d30, d31, [x1] 1122 1123 // Load GPRs 1124 // TODO: lots of those are smashed, could optimize. 1125 add x0, x0, #30*8 1126 ldp x30, x1, [x0], #-16 // LR & SP 1127 ldp x28, x29, [x0], #-16 1128 ldp x26, x27, [x0], #-16 1129 ldp x24, x25, [x0], #-16 1130 ldp x22, x23, [x0], #-16 1131 ldp x20, x21, [x0], #-16 1132 ldp x18, x19, [x0], #-16 1133 ldp x16, x17, [x0], #-16 1134 ldp x14, x15, [x0], #-16 1135 ldp x12, x13, [x0], #-16 1136 ldp x10, x11, [x0], #-16 1137 ldp x8, x9, [x0], #-16 1138 ldp x6, x7, [x0], #-16 1139 ldp x4, x5, [x0], #-16 1140 ldp x2, x3, [x0], #-16 1141 mov sp, x1 1142 1143 // Need to load PC, it's at the end (after the space for the unused XZR). Use x1. 1144 ldr x1, [x0, #33*8] 1145 // And the value of x0. 1146 ldr x0, [x0] 1147 1148 br x1 1149END art_quick_do_long_jump 1150 1151 /* 1152 * Entry from managed code that calls artLockObjectFromCode, may block for GC. x0 holds the 1153 * possibly null object to lock. 1154 * 1155 * Derived from arm32 code. 1156 */ 1157 .extern artLockObjectFromCode 1158ENTRY art_quick_lock_object 1159 cbz w0, .Lslow_lock 1160 add x4, x0, #MIRROR_OBJECT_LOCK_WORD_OFFSET // exclusive load/store has no immediate anymore 1161.Lretry_lock: 1162 ldr w2, [xSELF, #THREAD_ID_OFFSET] // TODO: Can the thread ID really change during the loop? 1163 ldxr w1, [x4] 1164 mov x3, x1 1165 and w3, w3, #LOCK_WORD_GC_STATE_MASK_SHIFTED_TOGGLED // zero the gc bits 1166 cbnz w3, .Lnot_unlocked // already thin locked 1167 // unlocked case - x1: original lock word that's zero except for the read barrier bits. 1168 orr x2, x1, x2 // x2 holds thread id with count of 0 with preserved read barrier bits 1169 stxr w3, w2, [x4] 1170 cbnz w3, .Llock_stxr_fail // store failed, retry 1171 dmb ishld // full (LoadLoad|LoadStore) memory barrier 1172 ret 1173.Lnot_unlocked: // x1: original lock word 1174 lsr w3, w1, LOCK_WORD_STATE_SHIFT 1175 cbnz w3, .Lslow_lock // if either of the top two bits are set, go slow path 1176 eor w2, w1, w2 // lock_word.ThreadId() ^ self->ThreadId() 1177 uxth w2, w2 // zero top 16 bits 1178 cbnz w2, .Lslow_lock // lock word and self thread id's match -> recursive lock 1179 // else contention, go to slow path 1180 mov x3, x1 // copy the lock word to check count overflow. 1181 and w3, w3, #LOCK_WORD_GC_STATE_MASK_SHIFTED_TOGGLED // zero the gc bits. 1182 add w2, w3, #LOCK_WORD_THIN_LOCK_COUNT_ONE // increment count in lock word placing in w2 to check overflow 1183 lsr w3, w2, #LOCK_WORD_GC_STATE_SHIFT // if the first gc state bit is set, we overflowed. 1184 cbnz w3, .Lslow_lock // if we overflow the count go slow path 1185 add w2, w1, #LOCK_WORD_THIN_LOCK_COUNT_ONE // increment count for real 1186 stxr w3, w2, [x4] 1187 cbnz w3, .Llock_stxr_fail // store failed, retry 1188 ret 1189.Llock_stxr_fail: 1190 b .Lretry_lock // retry 1191.Lslow_lock: 1192 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case we block 1193 mov x1, xSELF // pass Thread::Current 1194 bl artLockObjectFromCode // (Object* obj, Thread*) 1195 RESTORE_SAVE_REFS_ONLY_FRAME 1196 RETURN_IF_W0_IS_ZERO_OR_DELIVER 1197END art_quick_lock_object 1198 1199ENTRY art_quick_lock_object_no_inline 1200 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case we block 1201 mov x1, xSELF // pass Thread::Current 1202 bl artLockObjectFromCode // (Object* obj, Thread*) 1203 RESTORE_SAVE_REFS_ONLY_FRAME 1204 RETURN_IF_W0_IS_ZERO_OR_DELIVER 1205END art_quick_lock_object_no_inline 1206 1207 /* 1208 * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure. 1209 * x0 holds the possibly null object to lock. 1210 * 1211 * Derived from arm32 code. 1212 */ 1213 .extern artUnlockObjectFromCode 1214ENTRY art_quick_unlock_object 1215 cbz x0, .Lslow_unlock 1216 add x4, x0, #MIRROR_OBJECT_LOCK_WORD_OFFSET // exclusive load/store has no immediate anymore 1217.Lretry_unlock: 1218#ifndef USE_READ_BARRIER 1219 ldr w1, [x4] 1220#else 1221 ldxr w1, [x4] // Need to use atomic instructions for read barrier 1222#endif 1223 lsr w2, w1, LOCK_WORD_STATE_SHIFT 1224 cbnz w2, .Lslow_unlock // if either of the top two bits are set, go slow path 1225 ldr w2, [xSELF, #THREAD_ID_OFFSET] 1226 mov x3, x1 // copy lock word to check thread id equality 1227 and w3, w3, #LOCK_WORD_GC_STATE_MASK_SHIFTED_TOGGLED // zero the gc bits 1228 eor w3, w3, w2 // lock_word.ThreadId() ^ self->ThreadId() 1229 uxth w3, w3 // zero top 16 bits 1230 cbnz w3, .Lslow_unlock // do lock word and self thread id's match? 1231 mov x3, x1 // copy lock word to detect transition to unlocked 1232 and w3, w3, #LOCK_WORD_GC_STATE_MASK_SHIFTED_TOGGLED // zero the gc bits 1233 cmp w3, #LOCK_WORD_THIN_LOCK_COUNT_ONE 1234 bpl .Lrecursive_thin_unlock 1235 // transition to unlocked 1236 mov x3, x1 1237 and w3, w3, #LOCK_WORD_GC_STATE_MASK_SHIFTED // w3: zero except for the preserved read barrier bits 1238 dmb ish // full (LoadStore|StoreStore) memory barrier 1239#ifndef USE_READ_BARRIER 1240 str w3, [x4] 1241#else 1242 stxr w2, w3, [x4] // Need to use atomic instructions for read barrier 1243 cbnz w2, .Lunlock_stxr_fail // store failed, retry 1244#endif 1245 ret 1246.Lrecursive_thin_unlock: // w1: original lock word 1247 sub w1, w1, #LOCK_WORD_THIN_LOCK_COUNT_ONE // decrement count 1248#ifndef USE_READ_BARRIER 1249 str w1, [x4] 1250#else 1251 stxr w2, w1, [x4] // Need to use atomic instructions for read barrier 1252 cbnz w2, .Lunlock_stxr_fail // store failed, retry 1253#endif 1254 ret 1255.Lunlock_stxr_fail: 1256 b .Lretry_unlock // retry 1257.Lslow_unlock: 1258 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case exception allocation triggers GC 1259 mov x1, xSELF // pass Thread::Current 1260 bl artUnlockObjectFromCode // (Object* obj, Thread*) 1261 RESTORE_SAVE_REFS_ONLY_FRAME 1262 RETURN_IF_W0_IS_ZERO_OR_DELIVER 1263END art_quick_unlock_object 1264 1265ENTRY art_quick_unlock_object_no_inline 1266 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case exception allocation triggers GC 1267 mov x1, xSELF // pass Thread::Current 1268 bl artUnlockObjectFromCode // (Object* obj, Thread*) 1269 RESTORE_SAVE_REFS_ONLY_FRAME 1270 RETURN_IF_W0_IS_ZERO_OR_DELIVER 1271END art_quick_unlock_object_no_inline 1272 1273 /* 1274 * Entry from managed code that calls artIsAssignableFromCode and on failure calls 1275 * artThrowClassCastException. 1276 */ 1277 .extern artThrowClassCastException 1278ENTRY art_quick_check_cast 1279 // Store arguments and link register 1280 // Stack needs to be 16B aligned on calls. 1281 SAVE_TWO_REGS_INCREASE_FRAME x0, x1, 32 1282 SAVE_REG xLR, 24 1283 1284 // Call runtime code 1285 bl artIsAssignableFromCode 1286 1287 // Check for exception 1288 cbz x0, .Lthrow_class_cast_exception 1289 1290 // Restore and return 1291 .cfi_remember_state 1292 RESTORE_REG xLR, 24 1293 RESTORE_TWO_REGS_DECREASE_FRAME x0, x1, 32 1294 ret 1295 .cfi_restore_state // Reset unwind info so following code unwinds. 1296 1297.Lthrow_class_cast_exception: 1298 // Restore 1299 RESTORE_REG xLR, 24 1300 RESTORE_TWO_REGS_DECREASE_FRAME x0, x1, 32 1301 1302 SETUP_SAVE_ALL_CALLEE_SAVES_FRAME // save all registers as basis for long jump context 1303 mov x2, xSELF // pass Thread::Current 1304 bl artThrowClassCastException // (Class*, Class*, Thread*) 1305 brk 0 // We should not return here... 1306END art_quick_check_cast 1307 1308// Restore xReg's value from [sp, #offset] if xReg is not the same as xExclude. 1309.macro POP_REG_NE xReg, offset, xExclude 1310 .ifnc \xReg, \xExclude 1311 ldr \xReg, [sp, #\offset] // restore xReg 1312 .cfi_restore \xReg 1313 .endif 1314.endm 1315 1316// Restore xReg1's value from [sp, #offset] if xReg1 is not the same as xExclude. 1317// Restore xReg2's value from [sp, #(offset + 8)] if xReg2 is not the same as xExclude. 1318.macro POP_REGS_NE xReg1, xReg2, offset, xExclude 1319 .ifc \xReg1, \xExclude 1320 ldr \xReg2, [sp, #(\offset + 8)] // restore xReg2 1321 .else 1322 .ifc \xReg2, \xExclude 1323 ldr \xReg1, [sp, #\offset] // restore xReg1 1324 .else 1325 ldp \xReg1, \xReg2, [sp, #\offset] // restore xReg1 and xReg2 1326 .endif 1327 .endif 1328 .cfi_restore \xReg1 1329 .cfi_restore \xReg2 1330.endm 1331 1332 /* 1333 * Macro to insert read barrier, only used in art_quick_aput_obj. 1334 * xDest, wDest and xObj are registers, offset is a defined literal such as 1335 * MIRROR_OBJECT_CLASS_OFFSET. Dest needs both x and w versions of the same register to handle 1336 * name mismatch between instructions. This macro uses the lower 32b of register when possible. 1337 * TODO: When read barrier has a fast path, add heap unpoisoning support for the fast path. 1338 */ 1339.macro READ_BARRIER xDest, wDest, xObj, xTemp, wTemp, offset, number 1340#ifdef USE_READ_BARRIER 1341#ifdef USE_BAKER_READ_BARRIER 1342 ldr \wTemp, [\xObj, #MIRROR_OBJECT_LOCK_WORD_OFFSET] 1343 tbnz \wTemp, #LOCK_WORD_READ_BARRIER_STATE_SHIFT, .Lrb_slowpath\number 1344 // False dependency to avoid needing load/load fence. 1345 add \xObj, \xObj, \xTemp, lsr #32 1346 ldr \wDest, [\xObj, #\offset] // Heap reference = 32b. This also zero-extends to \xDest. 1347 UNPOISON_HEAP_REF \wDest 1348 b .Lrb_exit\number 1349#endif 1350.Lrb_slowpath\number: 1351 // Store registers used in art_quick_aput_obj (x0-x4, LR), stack is 16B aligned. 1352 SAVE_TWO_REGS_INCREASE_FRAME x0, x1, 48 1353 SAVE_TWO_REGS x2, x3, 16 1354 SAVE_TWO_REGS x4, xLR, 32 1355 1356 // mov x0, \xRef // pass ref in x0 (no-op for now since parameter ref is unused) 1357 .ifnc \xObj, x1 1358 mov x1, \xObj // pass xObj 1359 .endif 1360 mov w2, #\offset // pass offset 1361 bl artReadBarrierSlow // artReadBarrierSlow(ref, xObj, offset) 1362 // No need to unpoison return value in w0, artReadBarrierSlow() would do the unpoisoning. 1363 .ifnc \wDest, w0 1364 mov \wDest, w0 // save return value in wDest 1365 .endif 1366 1367 // Conditionally restore saved registers 1368 POP_REG_NE x0, 0, \xDest 1369 POP_REG_NE x1, 8, \xDest 1370 POP_REG_NE x2, 16, \xDest 1371 POP_REG_NE x3, 24, \xDest 1372 POP_REG_NE x4, 32, \xDest 1373 RESTORE_REG xLR, 40 1374 DECREASE_FRAME 48 1375.Lrb_exit\number: 1376#else 1377 ldr \wDest, [\xObj, #\offset] // Heap reference = 32b. This also zero-extends to \xDest. 1378 UNPOISON_HEAP_REF \wDest 1379#endif // USE_READ_BARRIER 1380.endm 1381 1382 /* 1383 * Entry from managed code for array put operations of objects where the value being stored 1384 * needs to be checked for compatibility. 1385 * x0 = array, x1 = index, x2 = value 1386 * 1387 * Currently all values should fit into w0/w1/w2, and w1 always will as indices are 32b. We 1388 * assume, though, that the upper 32b are zeroed out. At least for x1/w1 we can do better by 1389 * using index-zero-extension in load/stores. 1390 * 1391 * Temporaries: x3, x4 1392 * TODO: x4 OK? ip seems wrong here. 1393 */ 1394ENTRY art_quick_aput_obj_with_null_and_bound_check 1395 tst x0, x0 1396 bne art_quick_aput_obj_with_bound_check 1397 b art_quick_throw_null_pointer_exception 1398END art_quick_aput_obj_with_null_and_bound_check 1399 1400ENTRY art_quick_aput_obj_with_bound_check 1401 ldr w3, [x0, #MIRROR_ARRAY_LENGTH_OFFSET] 1402 cmp w3, w1 1403 bhi art_quick_aput_obj 1404 mov x0, x1 1405 mov x1, x3 1406 b art_quick_throw_array_bounds 1407END art_quick_aput_obj_with_bound_check 1408 1409#ifdef USE_READ_BARRIER 1410 .extern artReadBarrierSlow 1411#endif 1412ENTRY art_quick_aput_obj 1413 cbz x2, .Ldo_aput_null 1414 READ_BARRIER x3, w3, x0, x3, w3, MIRROR_OBJECT_CLASS_OFFSET, 0 // Heap reference = 32b 1415 // This also zero-extends to x3 1416 READ_BARRIER x3, w3, x3, x4, w4, MIRROR_CLASS_COMPONENT_TYPE_OFFSET, 1 // Heap reference = 32b 1417 // This also zero-extends to x3 1418 READ_BARRIER x4, w4, x2, x4, w4, MIRROR_OBJECT_CLASS_OFFSET, 2 // Heap reference = 32b 1419 // This also zero-extends to x4 1420 cmp w3, w4 // value's type == array's component type - trivial assignability 1421 bne .Lcheck_assignability 1422.Ldo_aput: 1423 add x3, x0, #MIRROR_OBJECT_ARRAY_DATA_OFFSET 1424 // "Compress" = do nothing 1425 POISON_HEAP_REF w2 1426 str w2, [x3, x1, lsl #2] // Heap reference = 32b 1427 ldr x3, [xSELF, #THREAD_CARD_TABLE_OFFSET] 1428 lsr x0, x0, #7 1429 strb w3, [x3, x0] 1430 ret 1431.Ldo_aput_null: 1432 add x3, x0, #MIRROR_OBJECT_ARRAY_DATA_OFFSET 1433 // "Compress" = do nothing 1434 str w2, [x3, x1, lsl #2] // Heap reference = 32b 1435 ret 1436.Lcheck_assignability: 1437 // Store arguments and link register 1438 SAVE_TWO_REGS_INCREASE_FRAME x0, x1, 32 1439 SAVE_TWO_REGS x2, xLR, 16 1440 1441 // Call runtime code 1442 mov x0, x3 // Heap reference, 32b, "uncompress" = do nothing, already zero-extended 1443 mov x1, x4 // Heap reference, 32b, "uncompress" = do nothing, already zero-extended 1444 bl artIsAssignableFromCode 1445 1446 // Check for exception 1447 cbz x0, .Lthrow_array_store_exception 1448 1449 // Restore 1450 .cfi_remember_state 1451 RESTORE_TWO_REGS x2, xLR, 16 1452 RESTORE_TWO_REGS_DECREASE_FRAME x0, x1, 32 1453 1454 add x3, x0, #MIRROR_OBJECT_ARRAY_DATA_OFFSET 1455 // "Compress" = do nothing 1456 POISON_HEAP_REF w2 1457 str w2, [x3, x1, lsl #2] // Heap reference = 32b 1458 ldr x3, [xSELF, #THREAD_CARD_TABLE_OFFSET] 1459 lsr x0, x0, #7 1460 strb w3, [x3, x0] 1461 ret 1462 .cfi_restore_state // Reset unwind info so following code unwinds. 1463.Lthrow_array_store_exception: 1464 RESTORE_TWO_REGS x2, xLR, 16 1465 RESTORE_TWO_REGS_DECREASE_FRAME x0, x1, 32 1466 1467 SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 1468 mov x1, x2 // Pass value. 1469 mov x2, xSELF // Pass Thread::Current. 1470 bl artThrowArrayStoreException // (Object*, Object*, Thread*). 1471 brk 0 // Unreached. 1472END art_quick_aput_obj 1473 1474// Macro to facilitate adding new allocation entrypoints. 1475.macro ONE_ARG_DOWNCALL name, entrypoint, return 1476 .extern \entrypoint 1477ENTRY \name 1478 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case of GC 1479 mov x1, xSELF // pass Thread::Current 1480 bl \entrypoint // (uint32_t type_idx, Method* method, Thread*) 1481 RESTORE_SAVE_REFS_ONLY_FRAME 1482 \return 1483END \name 1484.endm 1485 1486// Macro to facilitate adding new allocation entrypoints. 1487.macro TWO_ARG_DOWNCALL name, entrypoint, return 1488 .extern \entrypoint 1489ENTRY \name 1490 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case of GC 1491 mov x2, xSELF // pass Thread::Current 1492 bl \entrypoint // (uint32_t type_idx, Method* method, Thread*) 1493 RESTORE_SAVE_REFS_ONLY_FRAME 1494 \return 1495END \name 1496.endm 1497 1498// Macro to facilitate adding new allocation entrypoints. 1499.macro THREE_ARG_DOWNCALL name, entrypoint, return 1500 .extern \entrypoint 1501ENTRY \name 1502 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case of GC 1503 mov x3, xSELF // pass Thread::Current 1504 bl \entrypoint 1505 RESTORE_SAVE_REFS_ONLY_FRAME 1506 \return 1507END \name 1508.endm 1509 1510// Macro to facilitate adding new allocation entrypoints. 1511.macro FOUR_ARG_DOWNCALL name, entrypoint, return 1512 .extern \entrypoint 1513ENTRY \name 1514 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case of GC 1515 mov x4, xSELF // pass Thread::Current 1516 bl \entrypoint // 1517 RESTORE_SAVE_REFS_ONLY_FRAME 1518 \return 1519 DELIVER_PENDING_EXCEPTION 1520END \name 1521.endm 1522 1523// Macros taking opportunity of code similarities for downcalls with referrer. 1524.macro ONE_ARG_REF_DOWNCALL name, entrypoint, return 1525 .extern \entrypoint 1526ENTRY \name 1527 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case of GC 1528 ldr x1, [sp, #FRAME_SIZE_SAVE_REFS_ONLY] // Load referrer 1529 mov x2, xSELF // pass Thread::Current 1530 bl \entrypoint // (uint32_t type_idx, Method* method, Thread*, SP) 1531 RESTORE_SAVE_REFS_ONLY_FRAME 1532 \return 1533END \name 1534.endm 1535 1536.macro TWO_ARG_REF_DOWNCALL name, entrypoint, return 1537 .extern \entrypoint 1538ENTRY \name 1539 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case of GC 1540 ldr x2, [sp, #FRAME_SIZE_SAVE_REFS_ONLY] // Load referrer 1541 mov x3, xSELF // pass Thread::Current 1542 bl \entrypoint 1543 RESTORE_SAVE_REFS_ONLY_FRAME 1544 \return 1545END \name 1546.endm 1547 1548.macro THREE_ARG_REF_DOWNCALL name, entrypoint, return 1549 .extern \entrypoint 1550ENTRY \name 1551 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case of GC 1552 ldr x3, [sp, #FRAME_SIZE_SAVE_REFS_ONLY] // Load referrer 1553 mov x4, xSELF // pass Thread::Current 1554 bl \entrypoint 1555 RESTORE_SAVE_REFS_ONLY_FRAME 1556 \return 1557END \name 1558.endm 1559 1560.macro RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 1561 cbz w0, 1f // result zero branch over 1562 ret // return 15631: 1564 DELIVER_PENDING_EXCEPTION 1565.endm 1566 1567 /* 1568 * Entry from managed code that calls artHandleFillArrayDataFromCode and delivers exception on 1569 * failure. 1570 */ 1571TWO_ARG_REF_DOWNCALL art_quick_handle_fill_data, artHandleFillArrayDataFromCode, RETURN_IF_W0_IS_ZERO_OR_DELIVER 1572 1573 /* 1574 * Entry from managed code when uninitialized static storage, this stub will run the class 1575 * initializer and deliver the exception on error. On success the static storage base is 1576 * returned. 1577 */ 1578ONE_ARG_DOWNCALL art_quick_initialize_static_storage, artInitializeStaticStorageFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 1579 1580ONE_ARG_DOWNCALL art_quick_initialize_type, artInitializeTypeFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 1581ONE_ARG_DOWNCALL art_quick_initialize_type_and_verify_access, artInitializeTypeAndVerifyAccessFromCode, RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 1582 1583ONE_ARG_REF_DOWNCALL art_quick_get_boolean_static, artGetBooleanStaticFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 1584ONE_ARG_REF_DOWNCALL art_quick_get_byte_static, artGetByteStaticFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 1585ONE_ARG_REF_DOWNCALL art_quick_get_char_static, artGetCharStaticFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 1586ONE_ARG_REF_DOWNCALL art_quick_get_short_static, artGetShortStaticFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 1587ONE_ARG_REF_DOWNCALL art_quick_get32_static, artGet32StaticFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 1588ONE_ARG_REF_DOWNCALL art_quick_get64_static, artGet64StaticFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 1589ONE_ARG_REF_DOWNCALL art_quick_get_obj_static, artGetObjStaticFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 1590 1591TWO_ARG_REF_DOWNCALL art_quick_get_boolean_instance, artGetBooleanInstanceFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 1592TWO_ARG_REF_DOWNCALL art_quick_get_byte_instance, artGetByteInstanceFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 1593TWO_ARG_REF_DOWNCALL art_quick_get_char_instance, artGetCharInstanceFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 1594TWO_ARG_REF_DOWNCALL art_quick_get_short_instance, artGetShortInstanceFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 1595TWO_ARG_REF_DOWNCALL art_quick_get32_instance, artGet32InstanceFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 1596TWO_ARG_REF_DOWNCALL art_quick_get64_instance, artGet64InstanceFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 1597TWO_ARG_REF_DOWNCALL art_quick_get_obj_instance, artGetObjInstanceFromCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1 1598 1599TWO_ARG_REF_DOWNCALL art_quick_set8_static, artSet8StaticFromCode, RETURN_IF_W0_IS_ZERO_OR_DELIVER 1600TWO_ARG_REF_DOWNCALL art_quick_set16_static, artSet16StaticFromCode, RETURN_IF_W0_IS_ZERO_OR_DELIVER 1601TWO_ARG_REF_DOWNCALL art_quick_set32_static, artSet32StaticFromCode, RETURN_IF_W0_IS_ZERO_OR_DELIVER 1602TWO_ARG_REF_DOWNCALL art_quick_set_obj_static, artSetObjStaticFromCode, RETURN_IF_W0_IS_ZERO_OR_DELIVER 1603 1604THREE_ARG_REF_DOWNCALL art_quick_set8_instance, artSet8InstanceFromCode, RETURN_IF_W0_IS_ZERO_OR_DELIVER 1605THREE_ARG_REF_DOWNCALL art_quick_set16_instance, artSet16InstanceFromCode, RETURN_IF_W0_IS_ZERO_OR_DELIVER 1606THREE_ARG_REF_DOWNCALL art_quick_set32_instance, artSet32InstanceFromCode, RETURN_IF_W0_IS_ZERO_OR_DELIVER 1607THREE_ARG_REF_DOWNCALL art_quick_set64_instance, artSet64InstanceFromCode, RETURN_IF_W0_IS_ZERO_OR_DELIVER 1608THREE_ARG_REF_DOWNCALL art_quick_set_obj_instance, artSetObjInstanceFromCode, RETURN_IF_W0_IS_ZERO_OR_DELIVER 1609 1610// This is separated out as the argument order is different. 1611 .extern artSet64StaticFromCode 1612ENTRY art_quick_set64_static 1613 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case of GC 1614 ldr x1, [sp, #FRAME_SIZE_SAVE_REFS_ONLY] // Load referrer 1615 // x2 contains the parameter 1616 mov x3, xSELF // pass Thread::Current 1617 bl artSet64StaticFromCode 1618 RESTORE_SAVE_REFS_ONLY_FRAME 1619 RETURN_IF_W0_IS_ZERO_OR_DELIVER 1620END art_quick_set64_static 1621 1622 /* 1623 * Entry from managed code to resolve a string, this stub will 1624 * check the dex cache for a matching string (the fast path), and if not found, 1625 * it will allocate a String and deliver an exception on error. 1626 * On success the String is returned. R0 holds the string index. 1627 */ 1628 1629ENTRY art_quick_resolve_string 1630 ldr x1, [sp] // load referrer 1631 ldr w2, [x1, #ART_METHOD_DECLARING_CLASS_OFFSET] // load declaring class 1632 ldr x1, [x2, #DECLARING_CLASS_DEX_CACHE_STRINGS_OFFSET] // load string dex cache 1633 ubfx x2, x0, #0, #STRING_DEX_CACHE_HASH_BITS // get masked string index into x2 1634 ldr x2, [x1, x2, lsl #STRING_DEX_CACHE_ELEMENT_SIZE_SHIFT] // load dex cache pair into x2 1635 cmp x0, x2, lsr #32 // compare against upper 32 bits 1636 bne .Lart_quick_resolve_string_slow_path 1637 ubfx x0, x2, #0, #32 // extract lower 32 bits into x0 1638#ifdef USE_READ_BARRIER 1639 // Most common case: GC is not marking. 1640 ldr w3, [xSELF, #THREAD_IS_GC_MARKING_OFFSET] 1641 cbnz x3, .Lart_quick_resolve_string_marking 1642#endif 1643 ret 1644 1645// Slow path case, the index did not match. 1646.Lart_quick_resolve_string_slow_path: 1647 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case of GC 1648 mov x1, xSELF // pass Thread::Current 1649 bl artResolveStringFromCode // (int32_t string_idx, Thread* self) 1650 RESTORE_SAVE_REFS_ONLY_FRAME 1651 RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 1652 1653// GC is marking case, need to check the mark bit. 1654.Lart_quick_resolve_string_marking: 1655 ldr x3, [x0, #MIRROR_OBJECT_LOCK_WORD_OFFSET] 1656 tbnz x3, #LOCK_WORD_MARK_BIT_SHIFT, .Lart_quick_resolve_string_no_rb 1657 // Save LR so that we can return, also x1 for alignment purposes. 1658 SAVE_TWO_REGS_INCREASE_FRAME x1, xLR, 16 // Save x1, LR. 1659 bl artReadBarrierMark // Get the marked string back. 1660 RESTORE_TWO_REGS_DECREASE_FRAME x1, xLR, 16 // Restore registers. 1661.Lart_quick_resolve_string_no_rb: 1662 ret 1663 1664END art_quick_resolve_string 1665 1666// Generate the allocation entrypoints for each allocator. 1667GENERATE_ALLOC_ENTRYPOINTS_FOR_NON_REGION_TLAB_ALLOCATORS 1668// Comment out allocators that have arm64 specific asm. 1669// GENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT(_region_tlab, RegionTLAB) implemented in asm 1670// GENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT_RESOLVED(_region_tlab, RegionTLAB) 1671// GENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT_INITIALIZED(_region_tlab, RegionTLAB) 1672GENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT_WITH_ACCESS_CHECK(_region_tlab, RegionTLAB) 1673// GENERATE_ALLOC_ENTRYPOINTS_ALLOC_ARRAY(_region_tlab, RegionTLAB) implemented in asm 1674// GENERATE_ALLOC_ENTRYPOINTS_ALLOC_ARRAY_RESOLVED(_region_tlab, RegionTLAB) 1675GENERATE_ALLOC_ENTRYPOINTS_ALLOC_ARRAY_WITH_ACCESS_CHECK(_region_tlab, RegionTLAB) 1676GENERATE_ALLOC_ENTRYPOINTS_CHECK_AND_ALLOC_ARRAY(_region_tlab, RegionTLAB) 1677GENERATE_ALLOC_ENTRYPOINTS_CHECK_AND_ALLOC_ARRAY_WITH_ACCESS_CHECK(_region_tlab, RegionTLAB) 1678GENERATE_ALLOC_ENTRYPOINTS_ALLOC_STRING_FROM_BYTES(_region_tlab, RegionTLAB) 1679GENERATE_ALLOC_ENTRYPOINTS_ALLOC_STRING_FROM_CHARS(_region_tlab, RegionTLAB) 1680GENERATE_ALLOC_ENTRYPOINTS_ALLOC_STRING_FROM_STRING(_region_tlab, RegionTLAB) 1681 1682// A hand-written override for GENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT(_rosalloc, RosAlloc). 1683ENTRY art_quick_alloc_object_rosalloc 1684 // Fast path rosalloc allocation. 1685 // x0: type_idx/return value, x1: ArtMethod*, xSELF(x19): Thread::Current 1686 // x2-x7: free. 1687 ldr x2, [x1, #ART_METHOD_DEX_CACHE_TYPES_OFFSET_64] // Load dex cache resolved types array 1688 // Load the class (x2) 1689 ldr w2, [x2, x0, lsl #COMPRESSED_REFERENCE_SIZE_SHIFT] 1690 cbz x2, .Lart_quick_alloc_object_rosalloc_slow_path // Check null class 1691 ldr x3, [xSELF, #THREAD_LOCAL_ALLOC_STACK_TOP_OFFSET] // Check if the thread local 1692 // allocation stack has room. 1693 // ldp won't work due to large offset. 1694 ldr x4, [xSELF, #THREAD_LOCAL_ALLOC_STACK_END_OFFSET] 1695 cmp x3, x4 1696 bhs .Lart_quick_alloc_object_rosalloc_slow_path 1697 ldr w3, [x2, #MIRROR_CLASS_OBJECT_SIZE_ALLOC_FAST_PATH_OFFSET] // Load the object size (x3) 1698 cmp x3, #ROSALLOC_MAX_THREAD_LOCAL_BRACKET_SIZE // Check if the size is for a thread 1699 // local allocation. Also does the 1700 // finalizable and initialization 1701 // checks. 1702 bhs .Lart_quick_alloc_object_rosalloc_slow_path 1703 // Compute the rosalloc bracket index 1704 // from the size. Since the size is 1705 // already aligned we can combine the 1706 // two shifts together. 1707 add x4, xSELF, x3, lsr #(ROSALLOC_BRACKET_QUANTUM_SIZE_SHIFT - POINTER_SIZE_SHIFT) 1708 // Subtract pointer size since ther 1709 // are no runs for 0 byte allocations 1710 // and the size is already aligned. 1711 ldr x4, [x4, #(THREAD_ROSALLOC_RUNS_OFFSET - __SIZEOF_POINTER__)] 1712 // Load the free list head (x3). This 1713 // will be the return val. 1714 ldr x3, [x4, #(ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_HEAD_OFFSET)] 1715 cbz x3, .Lart_quick_alloc_object_rosalloc_slow_path 1716 // "Point of no slow path". Won't go to the slow path from here on. OK to clobber x0 and x1. 1717 ldr x1, [x3, #ROSALLOC_SLOT_NEXT_OFFSET] // Load the next pointer of the head 1718 // and update the list head with the 1719 // next pointer. 1720 str x1, [x4, #(ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_HEAD_OFFSET)] 1721 // Store the class pointer in the 1722 // header. This also overwrites the 1723 // next pointer. The offsets are 1724 // asserted to match. 1725#if ROSALLOC_SLOT_NEXT_OFFSET != MIRROR_OBJECT_CLASS_OFFSET 1726#error "Class pointer needs to overwrite next pointer." 1727#endif 1728 POISON_HEAP_REF w2 1729 str w2, [x3, #MIRROR_OBJECT_CLASS_OFFSET] 1730 // Fence. This is "ish" not "ishst" so 1731 // that it also ensures ordering of 1732 // the object size load with respect 1733 // to later accesses to the class 1734 // object. Alternatively we could use 1735 // "ishst" if we use load-acquire for 1736 // the class status load. 1737 // Needs to be done before pushing on 1738 // allocation since Heap::VisitObjects 1739 // relies on seeing the class pointer. 1740 // b/28790624 1741 dmb ish 1742 // Push the new object onto the thread 1743 // local allocation stack and 1744 // increment the thread local 1745 // allocation stack top. 1746 ldr x1, [xSELF, #THREAD_LOCAL_ALLOC_STACK_TOP_OFFSET] 1747 str w3, [x1], #COMPRESSED_REFERENCE_SIZE // (Increment x1 as a side effect.) 1748 str x1, [xSELF, #THREAD_LOCAL_ALLOC_STACK_TOP_OFFSET] 1749 // Decrement the size of the free list 1750 ldr w1, [x4, #(ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_SIZE_OFFSET)] 1751 sub x1, x1, #1 1752 // TODO: consider combining this store 1753 // and the list head store above using 1754 // strd. 1755 str w1, [x4, #(ROSALLOC_RUN_FREE_LIST_OFFSET + ROSALLOC_RUN_FREE_LIST_SIZE_OFFSET)] 1756 1757 mov x0, x3 // Set the return value and return. 1758 ret 1759.Lart_quick_alloc_object_rosalloc_slow_path: 1760 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case of GC 1761 mov x2, xSELF // pass Thread::Current 1762 bl artAllocObjectFromCodeRosAlloc // (uint32_t type_idx, Method* method, Thread*) 1763 RESTORE_SAVE_REFS_ONLY_FRAME 1764 RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 1765END art_quick_alloc_object_rosalloc 1766 1767 1768// The common fast path code for art_quick_alloc_array_region_tlab. 1769.macro ALLOC_ARRAY_TLAB_FAST_PATH slowPathLabel, xClass, wClass, xCount, wCount, xTemp0, wTemp0, xTemp1, wTemp1, xTemp2, wTemp2 1770 // Check null class 1771 cbz \wClass, \slowPathLabel 1772 ALLOC_ARRAY_TLAB_FAST_PATH_RESOLVED \slowPathLabel, \xClass, \wClass, \xCount, \wCount, \xTemp0, \wTemp0, \xTemp1, \wTemp1, \xTemp2, \wTemp2 1773.endm 1774 1775// The common fast path code for art_quick_alloc_array_region_tlab. 1776.macro ALLOC_ARRAY_TLAB_FAST_PATH_RESOLVED slowPathLabel, xClass, wClass, xCount, wCount, xTemp0, wTemp0, xTemp1, wTemp1, xTemp2, wTemp2 1777 // Array classes are never finalizable or uninitialized, no need to check. 1778 ldr \wTemp0, [\xClass, #MIRROR_CLASS_COMPONENT_TYPE_OFFSET] // Load component type 1779 UNPOISON_HEAP_REF \wTemp0 1780 ldr \wTemp0, [\xTemp0, #MIRROR_CLASS_OBJECT_PRIMITIVE_TYPE_OFFSET] 1781 lsr \xTemp0, \xTemp0, #PRIMITIVE_TYPE_SIZE_SHIFT_SHIFT // Component size shift is in high 16 1782 // bits. 1783 // xCount is holding a 32 bit value, 1784 // it can not overflow. 1785 lsl \xTemp1, \xCount, \xTemp0 // Calculate data size 1786 // Add array data offset and alignment. 1787 add \xTemp1, \xTemp1, #(MIRROR_INT_ARRAY_DATA_OFFSET + OBJECT_ALIGNMENT_MASK) 1788#if MIRROR_LONG_ARRAY_DATA_OFFSET != MIRROR_INT_ARRAY_DATA_OFFSET + 4 1789#error Long array data offset must be 4 greater than int array data offset. 1790#endif 1791 1792 add \xTemp0, \xTemp0, #1 // Add 4 to the length only if the 1793 // component size shift is 3 1794 // (for 64 bit alignment). 1795 and \xTemp0, \xTemp0, #4 1796 add \xTemp1, \xTemp1, \xTemp0 1797 and \xTemp1, \xTemp1, #OBJECT_ALIGNMENT_MASK_TOGGLED64 // Apply alignemnt mask 1798 // (addr + 7) & ~7. The mask must 1799 // be 64 bits to keep high bits in 1800 // case of overflow. 1801 // Negative sized arrays are handled here since xCount holds a zero extended 32 bit value. 1802 // Negative ints become large 64 bit unsigned ints which will always be larger than max signed 1803 // 32 bit int. Since the max shift for arrays is 3, it can not become a negative 64 bit int. 1804 cmp \xTemp1, #MIN_LARGE_OBJECT_THRESHOLD // Possibly a large object, go slow 1805 bhs \slowPathLabel // path. 1806 1807 ldr \xTemp0, [xSELF, #THREAD_LOCAL_POS_OFFSET] // Check tlab for space, note that 1808 // we use (end - begin) to handle 1809 // negative size arrays. It is 1810 // assumed that a negative size will 1811 // always be greater unsigned than 1812 // region size. 1813 ldr \xTemp2, [xSELF, #THREAD_LOCAL_END_OFFSET] 1814 sub \xTemp2, \xTemp2, \xTemp0 1815 cmp \xTemp1, \xTemp2 1816 bhi \slowPathLabel 1817 // "Point of no slow path". Won't go to the slow path from here on. OK to clobber x0 and x1. 1818 // Move old thread_local_pos to x0 1819 // for the return value. 1820 mov x0, \xTemp0 1821 add \xTemp0, \xTemp0, \xTemp1 1822 str \xTemp0, [xSELF, #THREAD_LOCAL_POS_OFFSET] // Store new thread_local_pos. 1823 ldr \xTemp0, [xSELF, #THREAD_LOCAL_OBJECTS_OFFSET] // Increment thread_local_objects. 1824 add \xTemp0, \xTemp0, #1 1825 str \xTemp0, [xSELF, #THREAD_LOCAL_OBJECTS_OFFSET] 1826 POISON_HEAP_REF \wClass 1827 str \wClass, [x0, #MIRROR_OBJECT_CLASS_OFFSET] // Store the class pointer. 1828 str \wCount, [x0, #MIRROR_ARRAY_LENGTH_OFFSET] // Store the array length. 1829 // Fence. 1830 dmb ishst 1831 ret 1832.endm 1833 1834// The common fast path code for art_quick_alloc_object_tlab and art_quick_alloc_object_region_tlab. 1835// 1836// x0: type_idx/return value, x1: ArtMethod*, x2: Class*, xSELF(x19): Thread::Current 1837// x3-x7: free. 1838// Need to preserve x0 and x1 to the slow path. 1839.macro ALLOC_OBJECT_TLAB_FAST_PATH slowPathLabel 1840 cbz x2, \slowPathLabel // Check null class 1841 ALLOC_OBJECT_TLAB_FAST_PATH_RESOLVED \slowPathLabel 1842.endm 1843 1844// TODO: delete ALLOC_OBJECT_TLAB_FAST_PATH_RESOLVED since it is the same as 1845// ALLOC_OBJECT_TLAB_FAST_PATH_INITIALIZED. 1846.macro ALLOC_OBJECT_TLAB_FAST_PATH_RESOLVED slowPathLabel 1847 ALLOC_OBJECT_TLAB_FAST_PATH_INITIALIZED \slowPathLabel 1848.endm 1849 1850.macro ALLOC_OBJECT_TLAB_FAST_PATH_INITIALIZED slowPathLabel 1851 ldr x4, [xSELF, #THREAD_LOCAL_POS_OFFSET] 1852 ldr x5, [xSELF, #THREAD_LOCAL_END_OFFSET] 1853 ldr w7, [x2, #MIRROR_CLASS_OBJECT_SIZE_ALLOC_FAST_PATH_OFFSET] // Load the object size (x7). 1854 add x6, x4, x7 // Add object size to tlab pos. 1855 cmp x6, x5 // Check if it fits, overflow works 1856 // since the tlab pos and end are 32 1857 // bit values. 1858 bhi \slowPathLabel 1859 // "Point of no slow path". Won't go to the slow path from here on. OK to clobber x0 and x1. 1860 mov x0, x4 1861 str x6, [xSELF, #THREAD_LOCAL_POS_OFFSET] // Store new thread_local_pos. 1862 ldr x5, [xSELF, #THREAD_LOCAL_OBJECTS_OFFSET] // Increment thread_local_objects. 1863 add x5, x5, #1 1864 str x5, [xSELF, #THREAD_LOCAL_OBJECTS_OFFSET] 1865 POISON_HEAP_REF w2 1866 str w2, [x0, #MIRROR_OBJECT_CLASS_OFFSET] // Store the class pointer. 1867 // Fence. This is "ish" not "ishst" so 1868 // that the code after this allocation 1869 // site will see the right values in 1870 // the fields of the class. 1871 // Alternatively we could use "ishst" 1872 // if we use load-acquire for the 1873 // object size load.) 1874 dmb ish 1875 ret 1876.endm 1877 1878// A hand-written override for GENERATE_ALLOC_ENTRYPOINTS_ALLOC_OBJECT(_tlab, TLAB). 1879ENTRY art_quick_alloc_object_tlab 1880 // Fast path tlab allocation. 1881 // x0: type_idx/return value, x1: ArtMethod*, xSELF(x19): Thread::Current 1882 // x2-x7: free. 1883#if defined(USE_READ_BARRIER) 1884 mvn x0, xzr // Read barrier not supported here. 1885 ret // Return -1. 1886#endif 1887 ldr x2, [x1, #ART_METHOD_DEX_CACHE_TYPES_OFFSET_64] // Load dex cache resolved types array 1888 // Load the class (x2) 1889 ldr w2, [x2, x0, lsl #COMPRESSED_REFERENCE_SIZE_SHIFT] 1890 ALLOC_OBJECT_TLAB_FAST_PATH .Lart_quick_alloc_object_tlab_slow_path 1891.Lart_quick_alloc_object_tlab_slow_path: 1892 SETUP_SAVE_REFS_ONLY_FRAME // Save callee saves in case of GC. 1893 mov x2, xSELF // Pass Thread::Current. 1894 bl artAllocObjectFromCodeTLAB // (uint32_t type_idx, Method* method, Thread*) 1895 RESTORE_SAVE_REFS_ONLY_FRAME 1896 RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 1897END art_quick_alloc_object_tlab 1898 1899// The common code for art_quick_alloc_object_*region_tlab 1900.macro GENERATE_ALLOC_OBJECT_REGION_TLAB name, entrypoint, fast_path, is_resolved, read_barrier 1901ENTRY \name 1902 // Fast path region tlab allocation. 1903 // x0: type_idx/resolved class/return value, x1: ArtMethod*, xSELF(x19): Thread::Current 1904 // If is_resolved is 1 then x0 is the resolved type, otherwise it is the index. 1905 // x2-x7: free. 1906#if !defined(USE_READ_BARRIER) 1907 mvn x0, xzr // Read barrier must be enabled here. 1908 ret // Return -1. 1909#endif 1910.if \is_resolved 1911 mov x2, x0 // class is actually stored in x0 already 1912.else 1913 ldr x2, [x1, #ART_METHOD_DEX_CACHE_TYPES_OFFSET_64] // Load dex cache resolved types array 1914 // Load the class (x2) 1915 ldr w2, [x2, x0, lsl #COMPRESSED_REFERENCE_SIZE_SHIFT] 1916 // If the class is null, go slow path. The check is required to read the lock word. 1917 cbz w2, .Lslow_path\name 1918.endif 1919.if \read_barrier 1920 // Most common case: GC is not marking. 1921 ldr w3, [xSELF, #THREAD_IS_GC_MARKING_OFFSET] 1922 cbnz x3, .Lmarking\name 1923.endif 1924.Ldo_allocation\name: 1925 \fast_path .Lslow_path\name 1926.Lmarking\name: 1927.if \read_barrier 1928 // GC is marking, check the lock word of the class for the mark bit. 1929 // Class is not null, check mark bit in lock word. 1930 ldr w3, [x2, #MIRROR_OBJECT_LOCK_WORD_OFFSET] 1931 // If the bit is not zero, do the allocation. 1932 tbnz w3, #LOCK_WORD_MARK_BIT_SHIFT, .Ldo_allocation\name 1933 // The read barrier slow path. Mark 1934 // the class. 1935 SAVE_TWO_REGS_INCREASE_FRAME x0, x1, 32 // Save registers (x0, x1, lr). 1936 SAVE_REG xLR, 24 // Align sp by 16 bytes. 1937 mov x0, x2 // Pass the class as the first param. 1938 bl artReadBarrierMark 1939 mov x2, x0 // Get the (marked) class back. 1940 RESTORE_REG xLR, 24 1941 RESTORE_TWO_REGS_DECREASE_FRAME x0, x1, 32 // Restore registers. 1942 b .Ldo_allocation\name 1943.endif 1944.Lslow_path\name: 1945 SETUP_SAVE_REFS_ONLY_FRAME // Save callee saves in case of GC. 1946 mov x2, xSELF // Pass Thread::Current. 1947 bl \entrypoint // (uint32_t type_idx, Method* method, Thread*) 1948 RESTORE_SAVE_REFS_ONLY_FRAME 1949 RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 1950END \name 1951.endm 1952 1953// Use ALLOC_OBJECT_TLAB_FAST_PATH_RESOLVED since the null check is already done in GENERATE_ALLOC_OBJECT_TLAB. 1954GENERATE_ALLOC_OBJECT_REGION_TLAB art_quick_alloc_object_region_tlab, artAllocObjectFromCodeRegionTLAB, ALLOC_OBJECT_TLAB_FAST_PATH_RESOLVED, 0, 1 1955// No read barrier for the resolved or initialized cases since the caller is responsible for the 1956// read barrier due to the to-space invariant. 1957GENERATE_ALLOC_OBJECT_REGION_TLAB art_quick_alloc_object_resolved_region_tlab, artAllocObjectFromCodeResolvedRegionTLAB, ALLOC_OBJECT_TLAB_FAST_PATH_RESOLVED, 1, 0 1958GENERATE_ALLOC_OBJECT_REGION_TLAB art_quick_alloc_object_initialized_region_tlab, artAllocObjectFromCodeInitializedRegionTLAB, ALLOC_OBJECT_TLAB_FAST_PATH_INITIALIZED, 1, 0 1959 1960// TODO: We could use this macro for the normal tlab allocator too. 1961 1962// The common code for art_quick_alloc_array_*region_tlab 1963.macro GENERATE_ALLOC_ARRAY_REGION_TLAB name, entrypoint, fast_path, is_resolved 1964ENTRY \name 1965 // Fast path array allocation for region tlab allocation. 1966 // x0: uint32_t type_idx 1967 // x1: int32_t component_count 1968 // x2: ArtMethod* method 1969 // x3-x7: free. 1970#if !defined(USE_READ_BARRIER) 1971 mvn x0, xzr // Read barrier must be enabled here. 1972 ret // Return -1. 1973#endif 1974.if \is_resolved 1975 mov x3, x0 1976 // If already resolved, class is stored in x0 1977.else 1978 ldr x3, [x2, #ART_METHOD_DEX_CACHE_TYPES_OFFSET_64] // Load dex cache resolved types array 1979 // Load the class (x2) 1980 ldr w3, [x3, x0, lsl #COMPRESSED_REFERENCE_SIZE_SHIFT] 1981.endif 1982 // Most common case: GC is not marking. 1983 ldr w4, [xSELF, #THREAD_IS_GC_MARKING_OFFSET] 1984 cbnz x4, .Lmarking\name 1985.Ldo_allocation\name: 1986 \fast_path .Lslow_path\name, x3, w3, x1, w1, x4, w4, x5, w5, x6, w6 1987.Lmarking\name: 1988 // GC is marking, check the lock word of the class for the mark bit. 1989 // If the class is null, go slow path. The check is required to read the lock word. 1990 cbz w3, .Lslow_path\name 1991 // Class is not null, check mark bit in lock word. 1992 ldr w4, [x3, #MIRROR_OBJECT_LOCK_WORD_OFFSET] 1993 // If the bit is not zero, do the allocation. 1994 tbnz w4, #LOCK_WORD_MARK_BIT_SHIFT, .Ldo_allocation\name 1995 // The read barrier slow path. Mark 1996 // the class. 1997 stp x0, x1, [sp, #-32]! // Save registers (x0, x1, x2, lr). 1998 stp x2, xLR, [sp, #16] 1999 mov x0, x3 // Pass the class as the first param. 2000 bl artReadBarrierMark 2001 mov x3, x0 // Get the (marked) class back. 2002 ldp x2, xLR, [sp, #16] 2003 ldp x0, x1, [sp], #32 // Restore registers. 2004 b .Ldo_allocation\name 2005.Lslow_path\name: 2006 // x0: uint32_t type_idx / mirror::Class* klass (if resolved) 2007 // x1: int32_t component_count 2008 // x2: ArtMethod* method 2009 // x3: Thread* self 2010 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves in case of GC 2011 mov x3, xSELF // pass Thread::Current 2012 bl \entrypoint 2013 RESTORE_SAVE_REFS_ONLY_FRAME 2014 RETURN_IF_RESULT_IS_NON_ZERO_OR_DELIVER 2015END \name 2016.endm 2017 2018GENERATE_ALLOC_ARRAY_REGION_TLAB art_quick_alloc_array_region_tlab, artAllocArrayFromCodeRegionTLAB, ALLOC_ARRAY_TLAB_FAST_PATH, 0 2019// TODO: art_quick_alloc_array_resolved_region_tlab seems to not get called. Investigate compiler. 2020GENERATE_ALLOC_ARRAY_REGION_TLAB art_quick_alloc_array_resolved_region_tlab, artAllocArrayFromCodeResolvedRegionTLAB, ALLOC_ARRAY_TLAB_FAST_PATH_RESOLVED, 1 2021 2022 /* 2023 * Called by managed code when the thread has been asked to suspend. 2024 */ 2025 .extern artTestSuspendFromCode 2026ENTRY art_quick_test_suspend 2027 SETUP_SAVE_EVERYTHING_FRAME // save callee saves for stack crawl 2028 mov x0, xSELF 2029 bl artTestSuspendFromCode // (Thread*) 2030 RESTORE_SAVE_EVERYTHING_FRAME 2031 ret 2032END art_quick_test_suspend 2033 2034ENTRY art_quick_implicit_suspend 2035 mov x0, xSELF 2036 SETUP_SAVE_REFS_ONLY_FRAME // save callee saves for stack crawl 2037 bl artTestSuspendFromCode // (Thread*) 2038 RESTORE_SAVE_REFS_ONLY_FRAME_AND_RETURN 2039END art_quick_implicit_suspend 2040 2041 /* 2042 * Called by managed code that is attempting to call a method on a proxy class. On entry 2043 * x0 holds the proxy method and x1 holds the receiver; The frame size of the invoked proxy 2044 * method agrees with a ref and args callee save frame. 2045 */ 2046 .extern artQuickProxyInvokeHandler 2047ENTRY art_quick_proxy_invoke_handler 2048 SETUP_SAVE_REFS_AND_ARGS_FRAME_WITH_METHOD_IN_X0 2049 mov x2, xSELF // pass Thread::Current 2050 mov x3, sp // pass SP 2051 bl artQuickProxyInvokeHandler // (Method* proxy method, receiver, Thread*, SP) 2052 ldr x2, [xSELF, THREAD_EXCEPTION_OFFSET] 2053 cbnz x2, .Lexception_in_proxy // success if no exception is pending 2054 RESTORE_SAVE_REFS_AND_ARGS_FRAME // Restore frame 2055 fmov d0, x0 // Store result in d0 in case it was float or double 2056 ret // return on success 2057.Lexception_in_proxy: 2058 RESTORE_SAVE_REFS_AND_ARGS_FRAME 2059 DELIVER_PENDING_EXCEPTION 2060END art_quick_proxy_invoke_handler 2061 2062 /* 2063 * Called to resolve an imt conflict. 2064 * x0 is the conflict ArtMethod. 2065 * xIP1 is a hidden argument that holds the target interface method's dex method index. 2066 * 2067 * Note that this stub writes to xIP0, xIP1, and x0. 2068 */ 2069 .extern artInvokeInterfaceTrampoline 2070ENTRY art_quick_imt_conflict_trampoline 2071 ldr xIP0, [sp, #0] // Load referrer 2072 ldr xIP0, [xIP0, #ART_METHOD_DEX_CACHE_METHODS_OFFSET_64] // Load dex cache methods array 2073 ldr xIP0, [xIP0, xIP1, lsl #POINTER_SIZE_SHIFT] // Load interface method 2074 ldr xIP1, [x0, #ART_METHOD_JNI_OFFSET_64] // Load ImtConflictTable 2075 ldr x0, [xIP1] // Load first entry in ImtConflictTable. 2076.Limt_table_iterate: 2077 cmp x0, xIP0 2078 // Branch if found. Benchmarks have shown doing a branch here is better. 2079 beq .Limt_table_found 2080 // If the entry is null, the interface method is not in the ImtConflictTable. 2081 cbz x0, .Lconflict_trampoline 2082 // Iterate over the entries of the ImtConflictTable. 2083 ldr x0, [xIP1, #(2 * __SIZEOF_POINTER__)]! 2084 b .Limt_table_iterate 2085.Limt_table_found: 2086 // We successfully hit an entry in the table. Load the target method 2087 // and jump to it. 2088 ldr x0, [xIP1, #__SIZEOF_POINTER__] 2089 ldr xIP0, [x0, #ART_METHOD_QUICK_CODE_OFFSET_64] 2090 br xIP0 2091.Lconflict_trampoline: 2092 // Call the runtime stub to populate the ImtConflictTable and jump to the 2093 // resolved method. 2094 INVOKE_TRAMPOLINE_BODY artInvokeInterfaceTrampoline 2095END art_quick_imt_conflict_trampoline 2096 2097ENTRY art_quick_resolution_trampoline 2098 SETUP_SAVE_REFS_AND_ARGS_FRAME 2099 mov x2, xSELF 2100 mov x3, sp 2101 bl artQuickResolutionTrampoline // (called, receiver, Thread*, SP) 2102 cbz x0, 1f 2103 mov xIP0, x0 // Remember returned code pointer in xIP0. 2104 ldr x0, [sp, #0] // artQuickResolutionTrampoline puts called method in *SP. 2105 RESTORE_SAVE_REFS_AND_ARGS_FRAME 2106 br xIP0 21071: 2108 RESTORE_SAVE_REFS_AND_ARGS_FRAME 2109 DELIVER_PENDING_EXCEPTION 2110END art_quick_resolution_trampoline 2111 2112/* 2113 * Generic JNI frame layout: 2114 * 2115 * #-------------------# 2116 * | | 2117 * | caller method... | 2118 * #-------------------# <--- SP on entry 2119 * | Return X30/LR | 2120 * | X29/FP | callee save 2121 * | X28 | callee save 2122 * | X27 | callee save 2123 * | X26 | callee save 2124 * | X25 | callee save 2125 * | X24 | callee save 2126 * | X23 | callee save 2127 * | X22 | callee save 2128 * | X21 | callee save 2129 * | X20 | callee save 2130 * | X19 | callee save 2131 * | X7 | arg7 2132 * | X6 | arg6 2133 * | X5 | arg5 2134 * | X4 | arg4 2135 * | X3 | arg3 2136 * | X2 | arg2 2137 * | X1 | arg1 2138 * | D7 | float arg 8 2139 * | D6 | float arg 7 2140 * | D5 | float arg 6 2141 * | D4 | float arg 5 2142 * | D3 | float arg 4 2143 * | D2 | float arg 3 2144 * | D1 | float arg 2 2145 * | D0 | float arg 1 2146 * | Method* | <- X0 2147 * #-------------------# 2148 * | local ref cookie | // 4B 2149 * | handle scope size | // 4B 2150 * #-------------------# 2151 * | JNI Call Stack | 2152 * #-------------------# <--- SP on native call 2153 * | | 2154 * | Stack for Regs | The trampoline assembly will pop these values 2155 * | | into registers for native call 2156 * #-------------------# 2157 * | Native code ptr | 2158 * #-------------------# 2159 * | Free scratch | 2160 * #-------------------# 2161 * | Ptr to (1) | <--- SP 2162 * #-------------------# 2163 */ 2164 /* 2165 * Called to do a generic JNI down-call 2166 */ 2167ENTRY art_quick_generic_jni_trampoline 2168 SETUP_SAVE_REFS_AND_ARGS_FRAME_WITH_METHOD_IN_X0 2169 2170 // Save SP , so we can have static CFI info. 2171 mov x28, sp 2172 .cfi_def_cfa_register x28 2173 2174 // This looks the same, but is different: this will be updated to point to the bottom 2175 // of the frame when the handle scope is inserted. 2176 mov xFP, sp 2177 2178 mov xIP0, #5120 2179 sub sp, sp, xIP0 2180 2181 // prepare for artQuickGenericJniTrampoline call 2182 // (Thread*, SP) 2183 // x0 x1 <= C calling convention 2184 // xSELF xFP <= where they are 2185 2186 mov x0, xSELF // Thread* 2187 mov x1, xFP 2188 bl artQuickGenericJniTrampoline // (Thread*, sp) 2189 2190 // The C call will have registered the complete save-frame on success. 2191 // The result of the call is: 2192 // x0: pointer to native code, 0 on error. 2193 // x1: pointer to the bottom of the used area of the alloca, can restore stack till there. 2194 2195 // Check for error = 0. 2196 cbz x0, .Lexception_in_native 2197 2198 // Release part of the alloca. 2199 mov sp, x1 2200 2201 // Save the code pointer 2202 mov xIP0, x0 2203 2204 // Load parameters from frame into registers. 2205 // TODO Check with artQuickGenericJniTrampoline. 2206 // Also, check again APPCS64 - the stack arguments are interleaved. 2207 ldp x0, x1, [sp] 2208 ldp x2, x3, [sp, #16] 2209 ldp x4, x5, [sp, #32] 2210 ldp x6, x7, [sp, #48] 2211 2212 ldp d0, d1, [sp, #64] 2213 ldp d2, d3, [sp, #80] 2214 ldp d4, d5, [sp, #96] 2215 ldp d6, d7, [sp, #112] 2216 2217 add sp, sp, #128 2218 2219 blr xIP0 // native call. 2220 2221 // result sign extension is handled in C code 2222 // prepare for artQuickGenericJniEndTrampoline call 2223 // (Thread*, result, result_f) 2224 // x0 x1 x2 <= C calling convention 2225 mov x1, x0 // Result (from saved). 2226 mov x0, xSELF // Thread register. 2227 fmov x2, d0 // d0 will contain floating point result, but needs to go into x2 2228 2229 bl artQuickGenericJniEndTrampoline 2230 2231 // Pending exceptions possible. 2232 ldr x2, [xSELF, THREAD_EXCEPTION_OFFSET] 2233 cbnz x2, .Lexception_in_native 2234 2235 // Tear down the alloca. 2236 mov sp, x28 2237 .cfi_def_cfa_register sp 2238 2239 // Tear down the callee-save frame. 2240 RESTORE_SAVE_REFS_AND_ARGS_FRAME 2241 2242 // store into fpr, for when it's a fpr return... 2243 fmov d0, x0 2244 ret 2245 2246.Lexception_in_native: 2247 // Move to x1 then sp to please assembler. 2248 ldr x1, [xSELF, # THREAD_TOP_QUICK_FRAME_OFFSET] 2249 mov sp, x1 2250 .cfi_def_cfa_register sp 2251 # This will create a new save-all frame, required by the runtime. 2252 DELIVER_PENDING_EXCEPTION 2253END art_quick_generic_jni_trampoline 2254 2255/* 2256 * Called to bridge from the quick to interpreter ABI. On entry the arguments match those 2257 * of a quick call: 2258 * x0 = method being called/to bridge to. 2259 * x1..x7, d0..d7 = arguments to that method. 2260 */ 2261ENTRY art_quick_to_interpreter_bridge 2262 SETUP_SAVE_REFS_AND_ARGS_FRAME // Set up frame and save arguments. 2263 2264 // x0 will contain mirror::ArtMethod* method. 2265 mov x1, xSELF // How to get Thread::Current() ??? 2266 mov x2, sp 2267 2268 // uint64_t artQuickToInterpreterBridge(mirror::ArtMethod* method, Thread* self, 2269 // mirror::ArtMethod** sp) 2270 bl artQuickToInterpreterBridge 2271 2272 RESTORE_SAVE_REFS_AND_ARGS_FRAME // TODO: no need to restore arguments in this case. 2273 2274 fmov d0, x0 2275 2276 RETURN_OR_DELIVER_PENDING_EXCEPTION 2277END art_quick_to_interpreter_bridge 2278 2279 2280// 2281// Instrumentation-related stubs 2282// 2283 .extern artInstrumentationMethodEntryFromCode 2284ENTRY art_quick_instrumentation_entry 2285 SETUP_SAVE_REFS_AND_ARGS_FRAME 2286 2287 mov x20, x0 // Preserve method reference in a callee-save. 2288 2289 mov x2, xSELF 2290 mov x3, xLR 2291 bl artInstrumentationMethodEntryFromCode // (Method*, Object*, Thread*, LR) 2292 2293 mov xIP0, x0 // x0 = result of call. 2294 mov x0, x20 // Reload method reference. 2295 2296 RESTORE_SAVE_REFS_AND_ARGS_FRAME // Note: will restore xSELF 2297 adr xLR, art_quick_instrumentation_exit 2298 br xIP0 // Tail-call method with lr set to art_quick_instrumentation_exit. 2299END art_quick_instrumentation_entry 2300 2301 .extern artInstrumentationMethodExitFromCode 2302ENTRY art_quick_instrumentation_exit 2303 mov xLR, #0 // Clobber LR for later checks. 2304 2305 SETUP_SAVE_REFS_ONLY_FRAME 2306 2307 // We need to save x0 and d0. We could use a callee-save from SETUP_REF_ONLY, but then 2308 // we would need to fully restore it. As there are a lot of callee-save registers, it seems 2309 // easier to have an extra small stack area. 2310 2311 str x0, [sp, #-16]! // Save integer result. 2312 .cfi_adjust_cfa_offset 16 2313 str d0, [sp, #8] // Save floating-point result. 2314 2315 add x1, sp, #16 // Pass SP. 2316 mov x2, x0 // Pass integer result. 2317 fmov x3, d0 // Pass floating-point result. 2318 mov x0, xSELF // Pass Thread. 2319 bl artInstrumentationMethodExitFromCode // (Thread*, SP, gpr_res, fpr_res) 2320 2321 mov xIP0, x0 // Return address from instrumentation call. 2322 mov xLR, x1 // r1 is holding link register if we're to bounce to deoptimize 2323 2324 ldr d0, [sp, #8] // Restore floating-point result. 2325 ldr x0, [sp], #16 // Restore integer result, and drop stack area. 2326 .cfi_adjust_cfa_offset 16 2327 2328 POP_SAVE_REFS_ONLY_FRAME 2329 2330 br xIP0 // Tail-call out. 2331END art_quick_instrumentation_exit 2332 2333 /* 2334 * Instrumentation has requested that we deoptimize into the interpreter. The deoptimization 2335 * will long jump to the upcall with a special exception of -1. 2336 */ 2337 .extern artDeoptimize 2338ENTRY art_quick_deoptimize 2339 SETUP_SAVE_ALL_CALLEE_SAVES_FRAME 2340 mov x0, xSELF // Pass thread. 2341 bl artDeoptimize // artDeoptimize(Thread*) 2342 brk 0 2343END art_quick_deoptimize 2344 2345 /* 2346 * Compiled code has requested that we deoptimize into the interpreter. The deoptimization 2347 * will long jump to the upcall with a special exception of -1. 2348 */ 2349 .extern artDeoptimizeFromCompiledCode 2350ENTRY art_quick_deoptimize_from_compiled_code 2351 SETUP_SAVE_EVERYTHING_FRAME 2352 mov x0, xSELF // Pass thread. 2353 bl artDeoptimizeFromCompiledCode // artDeoptimizeFromCompiledCode(Thread*) 2354 brk 0 2355END art_quick_deoptimize_from_compiled_code 2356 2357 2358 /* 2359 * String's indexOf. 2360 * 2361 * TODO: Not very optimized. 2362 * On entry: 2363 * x0: string object (known non-null) 2364 * w1: char to match (known <= 0xFFFF) 2365 * w2: Starting offset in string data 2366 */ 2367ENTRY art_quick_indexof 2368 ldr w3, [x0, #MIRROR_STRING_COUNT_OFFSET] 2369 add x0, x0, #MIRROR_STRING_VALUE_OFFSET 2370 2371 /* Clamp start to [0..count] */ 2372 cmp w2, #0 2373 csel w2, wzr, w2, lt 2374 cmp w2, w3 2375 csel w2, w3, w2, gt 2376 2377 /* Save a copy to compute result */ 2378 mov x5, x0 2379 2380 /* Build pointer to start of data to compare and pre-bias */ 2381 add x0, x0, x2, lsl #1 2382 sub x0, x0, #2 2383 2384 /* Compute iteration count */ 2385 sub w2, w3, w2 2386 2387 /* 2388 * At this point we have: 2389 * x0: start of the data to test 2390 * w1: char to compare 2391 * w2: iteration count 2392 * x5: original start of string data 2393 */ 2394 2395 subs w2, w2, #4 2396 b.lt .Lindexof_remainder 2397 2398.Lindexof_loop4: 2399 ldrh w6, [x0, #2]! 2400 ldrh w7, [x0, #2]! 2401 ldrh wIP0, [x0, #2]! 2402 ldrh wIP1, [x0, #2]! 2403 cmp w6, w1 2404 b.eq .Lmatch_0 2405 cmp w7, w1 2406 b.eq .Lmatch_1 2407 cmp wIP0, w1 2408 b.eq .Lmatch_2 2409 cmp wIP1, w1 2410 b.eq .Lmatch_3 2411 subs w2, w2, #4 2412 b.ge .Lindexof_loop4 2413 2414.Lindexof_remainder: 2415 adds w2, w2, #4 2416 b.eq .Lindexof_nomatch 2417 2418.Lindexof_loop1: 2419 ldrh w6, [x0, #2]! 2420 cmp w6, w1 2421 b.eq .Lmatch_3 2422 subs w2, w2, #1 2423 b.ne .Lindexof_loop1 2424 2425.Lindexof_nomatch: 2426 mov x0, #-1 2427 ret 2428 2429.Lmatch_0: 2430 sub x0, x0, #6 2431 sub x0, x0, x5 2432 asr x0, x0, #1 2433 ret 2434.Lmatch_1: 2435 sub x0, x0, #4 2436 sub x0, x0, x5 2437 asr x0, x0, #1 2438 ret 2439.Lmatch_2: 2440 sub x0, x0, #2 2441 sub x0, x0, x5 2442 asr x0, x0, #1 2443 ret 2444.Lmatch_3: 2445 sub x0, x0, x5 2446 asr x0, x0, #1 2447 ret 2448END art_quick_indexof 2449 2450 /* 2451 * Create a function `name` calling the ReadBarrier::Mark routine, 2452 * getting its argument and returning its result through W register 2453 * `wreg` (corresponding to X register `xreg`), saving and restoring 2454 * all caller-save registers. 2455 * 2456 * If `wreg` is different from `w0`, the generated function follows a 2457 * non-standard runtime calling convention: 2458 * - register `wreg` is used to pass the (sole) argument of this 2459 * function (instead of W0); 2460 * - register `wreg` is used to return the result of this function 2461 * (instead of W0); 2462 * - W0 is treated like a normal (non-argument) caller-save register; 2463 * - everything else is the same as in the standard runtime calling 2464 * convention (e.g. standard callee-save registers are preserved). 2465 */ 2466.macro READ_BARRIER_MARK_REG name, wreg, xreg 2467ENTRY \name 2468 // Reference is null, no work to do at all. 2469 cbz \wreg, .Lret_rb_\name 2470 /* 2471 * Allocate 46 stack slots * 8 = 368 bytes: 2472 * - 20 slots for core registers X0-X19 2473 * - 24 slots for floating-point registers D0-D7 and D16-D31 2474 * - 1 slot for return address register XLR 2475 * - 1 padding slot for 16-byte stack alignment 2476 */ 2477 // Use wIP0 as temp and check the mark bit of the reference. wIP0 is not used by the compiler. 2478 ldr wIP0, [\xreg, #MIRROR_OBJECT_LOCK_WORD_OFFSET] 2479 tbz wIP0, #LOCK_WORD_MARK_BIT_SHIFT, .Lslow_path_rb_\name 2480 ret 2481.Lslow_path_rb_\name: 2482 // Save all potentially live caller-save core registers. 2483 SAVE_TWO_REGS_INCREASE_FRAME x0, x1, 368 2484 SAVE_TWO_REGS x2, x3, 16 2485 SAVE_TWO_REGS x4, x5, 32 2486 SAVE_TWO_REGS x6, x7, 48 2487 SAVE_TWO_REGS x8, x9, 64 2488 SAVE_TWO_REGS x10, x11, 80 2489 SAVE_TWO_REGS x12, x13, 96 2490 SAVE_TWO_REGS x14, x15, 112 2491 SAVE_TWO_REGS x16, x17, 128 2492 SAVE_TWO_REGS x18, x19, 144 2493 // Save all potentially live caller-save floating-point registers. 2494 stp d0, d1, [sp, #160] 2495 stp d2, d3, [sp, #176] 2496 stp d4, d5, [sp, #192] 2497 stp d6, d7, [sp, #208] 2498 stp d16, d17, [sp, #224] 2499 stp d18, d19, [sp, #240] 2500 stp d20, d21, [sp, #256] 2501 stp d22, d23, [sp, #272] 2502 stp d24, d25, [sp, #288] 2503 stp d26, d27, [sp, #304] 2504 stp d28, d29, [sp, #320] 2505 stp d30, d31, [sp, #336] 2506 // Save return address. 2507 // (sp + #352 is a padding slot) 2508 SAVE_REG xLR, 360 2509 2510 .ifnc \wreg, w0 2511 mov w0, \wreg // Pass arg1 - obj from `wreg` 2512 .endif 2513 bl artReadBarrierMark // artReadBarrierMark(obj) 2514 .ifnc \wreg, w0 2515 mov \wreg, w0 // Return result into `wreg` 2516 .endif 2517 2518 // Restore core regs, except `xreg`, as `wreg` is used to return the 2519 // result of this function (simply remove it from the stack instead). 2520 POP_REGS_NE x0, x1, 0, \xreg 2521 POP_REGS_NE x2, x3, 16, \xreg 2522 POP_REGS_NE x4, x5, 32, \xreg 2523 POP_REGS_NE x6, x7, 48, \xreg 2524 POP_REGS_NE x8, x9, 64, \xreg 2525 POP_REGS_NE x10, x11, 80, \xreg 2526 POP_REGS_NE x12, x13, 96, \xreg 2527 POP_REGS_NE x14, x15, 112, \xreg 2528 POP_REGS_NE x16, x17, 128, \xreg 2529 POP_REGS_NE x18, x19, 144, \xreg 2530 // Restore floating-point registers. 2531 ldp d0, d1, [sp, #160] 2532 ldp d2, d3, [sp, #176] 2533 ldp d4, d5, [sp, #192] 2534 ldp d6, d7, [sp, #208] 2535 ldp d16, d17, [sp, #224] 2536 ldp d18, d19, [sp, #240] 2537 ldp d20, d21, [sp, #256] 2538 ldp d22, d23, [sp, #272] 2539 ldp d24, d25, [sp, #288] 2540 ldp d26, d27, [sp, #304] 2541 ldp d28, d29, [sp, #320] 2542 ldp d30, d31, [sp, #336] 2543 // Restore return address and remove padding. 2544 RESTORE_REG xLR, 360 2545 DECREASE_FRAME 368 2546.Lret_rb_\name: 2547 ret 2548END \name 2549.endm 2550 2551READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg00, w0, x0 2552READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg01, w1, x1 2553READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg02, w2, x2 2554READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg03, w3, x3 2555READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg04, w4, x4 2556READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg05, w5, x5 2557READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg06, w6, x6 2558READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg07, w7, x7 2559READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg08, w8, x8 2560READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg09, w9, x9 2561READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg10, w10, x10 2562READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg11, w11, x11 2563READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg12, w12, x12 2564READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg13, w13, x13 2565READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg14, w14, x14 2566READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg15, w15, x15 2567// READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg16, w16, x16 ip0 is blocked 2568READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg17, w17, x17 2569READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg18, w18, x18 2570READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg19, w19, x19 2571READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg20, w20, x20 2572READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg21, w21, x21 2573READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg22, w22, x22 2574READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg23, w23, x23 2575READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg24, w24, x24 2576READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg25, w25, x25 2577READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg26, w26, x26 2578READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg27, w27, x27 2579READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg28, w28, x28 2580READ_BARRIER_MARK_REG art_quick_read_barrier_mark_reg29, w29, x29 2581