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