1 /* 2 * Copyright (c) 2018, Red Hat, Inc. and/or its affiliates. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. 7 * 8 * This code is distributed in the hope that it will be useful, but WITHOUT 9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 * version 2 for more details (a copy is included in the LICENSE file that 12 * accompanied this code). 13 * 14 * You should have received a copy of the GNU General Public License version 15 * 2 along with this work; if not, write to the Free Software Foundation, 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 * 18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 * or visit www.oracle.com if you need additional information or have any 20 * questions. 21 * 22 */ 23 24 #include "precompiled.hpp" 25 #include "gc/shenandoah/brooksPointer.hpp" 26 #include "gc/shenandoah/shenandoahBarrierSetAssembler.hpp" 27 #include "gc/shenandoah/shenandoahBarrierSet.hpp" 28 #include "gc/shenandoah/shenandoahConnectionMatrix.hpp" 29 #include "gc/shenandoah/shenandoahHeapRegion.hpp" 30 #include "gc/shenandoah/shenandoahThreadLocalData.hpp" 31 #include "interpreter/interpreter.hpp" 32 #include "interpreter/interp_masm.hpp" 33 #include "runtime/sharedRuntime.hpp" 34 #include "runtime/thread.hpp" 35 36 #define __ masm-> 37 38 void ShenandoahBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, BasicType type, 39 Register src, Register dst, Register count) { 40 41 bool checkcast = (decorators & ARRAYCOPY_CHECKCAST) != 0; 42 bool disjoint = (decorators & ARRAYCOPY_DISJOINT) != 0; 43 bool obj_int = type == T_OBJECT LP64_ONLY(&& UseCompressedOops); 44 bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0; 45 46 if (type == T_OBJECT || type == T_ARRAY) { 47 #ifdef _LP64 48 if (!checkcast && !obj_int) { 49 // Save count for barrier 50 __ movptr(r11, count); 51 } else if (disjoint && obj_int) { 52 // Save dst in r11 in the disjoint case 53 __ movq(r11, dst); 54 } 55 #else 56 if (disjoint) { 57 __ mov(rdx, dst); // save 'to' 58 } 59 #endif 60 61 if (!dest_uninitialized) { 62 Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread); 63 #ifndef _LP64 64 __ push(thread); 65 __ get_thread(thread); 66 #endif 67 68 Label filtered; 69 Address in_progress(thread, in_bytes(ShenandoahThreadLocalData::satb_mark_queue_active_offset())); 70 // Is marking active? 71 if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) { 72 __ cmpl(in_progress, 0); 73 } else { 74 assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption"); 75 __ cmpb(in_progress, 0); 76 } 77 78 NOT_LP64(__ pop(thread);) 79 80 __ jcc(Assembler::equal, filtered); 81 82 __ pusha(); // push registers 83 #ifdef _LP64 84 if (count == c_rarg0) { 85 if (dst == c_rarg1) { 86 // exactly backwards!! 87 __ xchgptr(c_rarg1, c_rarg0); 88 } else { 89 __ movptr(c_rarg1, count); 90 __ movptr(c_rarg0, dst); 91 } 92 } else { 93 __ movptr(c_rarg0, dst); 94 __ movptr(c_rarg1, count); 95 } 96 if (UseCompressedOops) { 97 __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahBarrierSet::write_ref_array_pre_narrow_oop_entry), 2); 98 } else { 99 __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahBarrierSet::write_ref_array_pre_oop_entry), 2); 100 } 101 #else 102 __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahBarrierSet::write_ref_array_pre_oop_entry), 103 dst, count); 104 #endif 105 __ popa(); 106 __ bind(filtered); 107 } 108 } 109 110 } 111 112 void ShenandoahBarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, BasicType type, 113 Register src, Register dst, Register count) { 114 bool checkcast = (decorators & ARRAYCOPY_CHECKCAST) != 0; 115 bool disjoint = (decorators & ARRAYCOPY_DISJOINT) != 0; 116 bool obj_int = type == T_OBJECT LP64_ONLY(&& UseCompressedOops); 117 Register tmp = rax; 118 119 if (type == T_OBJECT || type == T_ARRAY) { 120 #ifdef _LP64 121 if (!checkcast && !obj_int) { 122 // Save count for barrier 123 count = r11; 124 } else if (disjoint && obj_int) { 125 // Use the saved dst in the disjoint case 126 dst = r11; 127 } else if (checkcast) { 128 tmp = rscratch1; 129 } 130 #else 131 if (disjoint) { 132 __ mov(dst, rdx); // restore 'to' 133 } 134 #endif 135 136 __ pusha(); // push registers (overkill) 137 #ifdef _LP64 138 if (c_rarg0 == count) { // On win64 c_rarg0 == rcx 139 assert_different_registers(c_rarg1, dst); 140 __ mov(c_rarg1, count); 141 __ mov(c_rarg0, dst); 142 } else { 143 assert_different_registers(c_rarg0, count); 144 __ mov(c_rarg0, dst); 145 __ mov(c_rarg1, count); 146 } 147 __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahBarrierSet::write_ref_array_post_entry), 2); 148 #else 149 __ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahBarrierSet::write_ref_array_post_entry), 150 dst, count); 151 #endif 152 __ popa(); 153 } 154 } 155 156 void ShenandoahBarrierSetAssembler::shenandoah_write_barrier_pre(MacroAssembler* masm, 157 Register obj, 158 Register pre_val, 159 Register thread, 160 Register tmp, 161 bool tosca_live, 162 bool expand_call) { 163 164 if (ShenandoahConditionalSATBBarrier) { 165 Label done; 166 Address gc_state(thread, in_bytes(ShenandoahThreadLocalData::gc_state_offset())); 167 __ testb(gc_state, ShenandoahHeap::MARKING); 168 __ jcc(Assembler::zero, done); // Skip SATB barrier when conc-mark is not active 169 satb_write_barrier_pre(masm, obj, pre_val, thread, tmp, tosca_live, expand_call); 170 __ bind(done); 171 } 172 if (ShenandoahSATBBarrier) { 173 satb_write_barrier_pre(masm, obj, pre_val, thread, tmp, tosca_live, expand_call); 174 } 175 } 176 177 void ShenandoahBarrierSetAssembler::satb_write_barrier_pre(MacroAssembler* masm, 178 Register obj, 179 Register pre_val, 180 Register thread, 181 Register tmp, 182 bool tosca_live, 183 bool expand_call) { 184 // If expand_call is true then we expand the call_VM_leaf macro 185 // directly to skip generating the check by 186 // InterpreterMacroAssembler::call_VM_leaf_base that checks _last_sp. 187 188 #ifdef _LP64 189 assert(thread == r15_thread, "must be"); 190 #endif // _LP64 191 192 Label done; 193 Label runtime; 194 195 assert(pre_val != noreg, "check this code"); 196 197 if (obj != noreg) { 198 assert_different_registers(obj, pre_val, tmp); 199 assert(pre_val != rax, "check this code"); 200 } 201 202 Address in_progress(thread, in_bytes(ShenandoahThreadLocalData::satb_mark_queue_active_offset())); 203 Address index(thread, in_bytes(ShenandoahThreadLocalData::satb_mark_queue_index_offset())); 204 Address buffer(thread, in_bytes(ShenandoahThreadLocalData::satb_mark_queue_buffer_offset())); 205 206 Address gc_state(thread, in_bytes(ShenandoahThreadLocalData::gc_state_offset())); 207 __ testb(gc_state, ShenandoahHeap::MARKING | ShenandoahHeap::TRAVERSAL); 208 __ jcc(Assembler::zero, done); 209 210 // Do we need to load the previous value? 211 if (obj != noreg) { 212 __ load_heap_oop(pre_val, Address(obj, 0), noreg, noreg, AS_RAW); 213 } 214 215 // Is the previous value null? 216 __ cmpptr(pre_val, (int32_t) NULL_WORD); 217 __ jcc(Assembler::equal, done); 218 219 // Can we store original value in the thread's buffer? 220 // Is index == 0? 221 // (The index field is typed as size_t.) 222 223 __ movptr(tmp, index); // tmp := *index_adr 224 __ cmpptr(tmp, 0); // tmp == 0? 225 __ jcc(Assembler::equal, runtime); // If yes, goto runtime 226 227 __ subptr(tmp, wordSize); // tmp := tmp - wordSize 228 __ movptr(index, tmp); // *index_adr := tmp 229 __ addptr(tmp, buffer); // tmp := tmp + *buffer_adr 230 231 // Record the previous value 232 __ movptr(Address(tmp, 0), pre_val); 233 __ jmp(done); 234 235 __ bind(runtime); 236 // save the live input values 237 if(tosca_live) __ push(rax); 238 239 if (obj != noreg && obj != rax) 240 __ push(obj); 241 242 if (pre_val != rax) 243 __ push(pre_val); 244 245 // Calling the runtime using the regular call_VM_leaf mechanism generates 246 // code (generated by InterpreterMacroAssember::call_VM_leaf_base) 247 // that checks that the *(ebp+frame::interpreter_frame_last_sp) == NULL. 248 // 249 // If we care generating the pre-barrier without a frame (e.g. in the 250 // intrinsified Reference.get() routine) then ebp might be pointing to 251 // the caller frame and so this check will most likely fail at runtime. 252 // 253 // Expanding the call directly bypasses the generation of the check. 254 // So when we do not have have a full interpreter frame on the stack 255 // expand_call should be passed true. 256 257 NOT_LP64( __ push(thread); ) 258 259 if (expand_call) { 260 LP64_ONLY( assert(pre_val != c_rarg1, "smashed arg"); ) 261 #ifdef _LP64 262 if (c_rarg1 != thread) { 263 __ mov(c_rarg1, thread); 264 } 265 if (c_rarg0 != pre_val) { 266 __ mov(c_rarg0, pre_val); 267 } 268 #else 269 __ push(thread); 270 __ push(pre_val); 271 #endif 272 __ MacroAssembler::call_VM_leaf_base(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), 2); 273 } else { 274 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), pre_val, thread); 275 } 276 277 NOT_LP64( __ pop(thread); ) 278 279 // save the live input values 280 if (pre_val != rax) 281 __ pop(pre_val); 282 283 if (obj != noreg && obj != rax) 284 __ pop(obj); 285 286 if(tosca_live) __ pop(rax); 287 288 __ bind(done); 289 } 290 291 void ShenandoahBarrierSetAssembler::shenandoah_write_barrier_post(MacroAssembler* masm, 292 Register store_addr, 293 Register new_val, 294 Register thread, 295 Register tmp, 296 Register tmp2) { 297 assert(UseShenandoahGC, "why else should we be here?"); 298 299 if (! UseShenandoahMatrix) { 300 // No need for that barrier if not using matrix. 301 return; 302 } 303 304 Label done; 305 __ testptr(new_val, new_val); 306 __ jcc(Assembler::zero, done); 307 ShenandoahConnectionMatrix* matrix = ShenandoahHeap::heap()->connection_matrix(); 308 address matrix_addr = matrix->matrix_addr(); 309 __ movptr(rscratch1, (intptr_t) ShenandoahHeap::heap()->base()); 310 // Compute to-region index 311 __ movptr(tmp, new_val); 312 __ subptr(tmp, rscratch1); 313 __ shrptr(tmp, ShenandoahHeapRegion::region_size_bytes_shift_jint()); 314 // Compute from-region index 315 __ movptr(tmp2, store_addr); 316 __ subptr(tmp2, rscratch1); 317 __ shrptr(tmp2, ShenandoahHeapRegion::region_size_bytes_shift_jint()); 318 // Compute matrix index 319 __ imulptr(tmp, tmp, matrix->stride_jint()); 320 __ addptr(tmp, tmp2); 321 // Address is _matrix[to * stride + from] 322 __ movptr(rscratch1, (intptr_t) matrix_addr); 323 // Test if the element is already set. 324 __ cmpb(Address(rscratch1, tmp, Address::times_1), 0); 325 __ jcc(Assembler::notEqual, done); 326 // Store true, if not yet set. 327 __ movb(Address(rscratch1, tmp, Address::times_1), 1); 328 __ bind(done); 329 } 330 331 void ShenandoahBarrierSetAssembler::read_barrier(MacroAssembler* masm, Register dst) { 332 if (ShenandoahReadBarrier) { 333 read_barrier_impl(masm, dst); 334 } 335 } 336 337 void ShenandoahBarrierSetAssembler::read_barrier_impl(MacroAssembler* masm, Register dst) { 338 assert(UseShenandoahGC && (ShenandoahReadBarrier || ShenandoahStoreValReadBarrier), "should be enabled"); 339 Label is_null; 340 __ testptr(dst, dst); 341 __ jcc(Assembler::zero, is_null); 342 read_barrier_not_null_impl(masm, dst); 343 __ bind(is_null); 344 } 345 346 void ShenandoahBarrierSetAssembler::read_barrier_not_null(MacroAssembler* masm, Register dst) { 347 if (ShenandoahReadBarrier) { 348 read_barrier_not_null_impl(masm, dst); 349 } 350 } 351 352 void ShenandoahBarrierSetAssembler::read_barrier_not_null_impl(MacroAssembler* masm, Register dst) { 353 assert(UseShenandoahGC && (ShenandoahReadBarrier || ShenandoahStoreValReadBarrier), "should be enabled"); 354 __ movptr(dst, Address(dst, BrooksPointer::byte_offset())); 355 } 356 357 358 void ShenandoahBarrierSetAssembler::write_barrier(MacroAssembler* masm, Register dst) { 359 if (ShenandoahWriteBarrier) { 360 write_barrier_impl(masm, dst); 361 } 362 } 363 364 void ShenandoahBarrierSetAssembler::write_barrier_impl(MacroAssembler* masm, Register dst) { 365 assert(UseShenandoahGC && (ShenandoahWriteBarrier || ShenandoahStoreValWriteBarrier || ShenandoahStoreValEnqueueBarrier), "should be enabled"); 366 #ifdef _LP64 367 assert(dst != rscratch1, "different regs"); 368 369 Label done; 370 371 Address gc_state(r15_thread, in_bytes(ShenandoahThreadLocalData::gc_state_offset())); 372 __ testb(gc_state, ShenandoahHeap::EVACUATION | ShenandoahHeap::PARTIAL | ShenandoahHeap::TRAVERSAL); 373 374 // Now check if evacuation is in progress. 375 read_barrier_not_null(masm, dst); 376 377 __ jcc(Assembler::zero, done); 378 __ push(rscratch1); 379 __ push(rscratch2); 380 381 __ movptr(rscratch1, dst); 382 __ shrptr(rscratch1, ShenandoahHeapRegion::region_size_bytes_shift_jint()); 383 __ movptr(rscratch2, (intptr_t) ShenandoahHeap::in_cset_fast_test_addr()); 384 __ movbool(rscratch2, Address(rscratch2, rscratch1, Address::times_1)); 385 __ testb(rscratch2, 0x1); 386 387 __ pop(rscratch2); 388 __ pop(rscratch1); 389 390 __ jcc(Assembler::zero, done); 391 392 __ push(rscratch1); 393 394 // Save possibly live regs. 395 if (dst != rax) { 396 __ push(rax); 397 } 398 if (dst != rbx) { 399 __ push(rbx); 400 } 401 if (dst != rcx) { 402 __ push(rcx); 403 } 404 if (dst != rdx) { 405 __ push(rdx); 406 } 407 if (dst != c_rarg1) { 408 __ push(c_rarg1); 409 } 410 411 __ subptr(rsp, 2 * Interpreter::stackElementSize); 412 __ movdbl(Address(rsp, 0), xmm0); 413 414 // Call into runtime 415 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahBarrierSet::write_barrier_IRT), dst); 416 __ mov(rscratch1, rax); 417 418 // Restore possibly live regs. 419 __ movdbl(xmm0, Address(rsp, 0)); 420 __ addptr(rsp, 2 * Interpreter::stackElementSize); 421 422 if (dst != c_rarg1) { 423 __ pop(c_rarg1); 424 } 425 if (dst != rdx) { 426 __ pop(rdx); 427 } 428 if (dst != rcx) { 429 __ pop(rcx); 430 } 431 if (dst != rbx) { 432 __ pop(rbx); 433 } 434 if (dst != rax) { 435 __ pop(rax); 436 } 437 438 // Move result into dst reg. 439 __ mov(dst, rscratch1); 440 441 __ pop(rscratch1); 442 443 __ bind(done); 444 #else 445 Unimplemented(); 446 #endif 447 } 448 449 void ShenandoahBarrierSetAssembler::storeval_barrier(MacroAssembler* masm, Register dst, Register tmp) { 450 if (ShenandoahStoreValReadBarrier || ShenandoahStoreValWriteBarrier || ShenandoahStoreValEnqueueBarrier) { 451 storeval_barrier_impl(masm, dst, tmp); 452 } 453 } 454 455 void ShenandoahBarrierSetAssembler::storeval_barrier_impl(MacroAssembler* masm, Register dst, Register tmp) { 456 assert(UseShenandoahGC && (ShenandoahStoreValReadBarrier || ShenandoahStoreValWriteBarrier || ShenandoahStoreValEnqueueBarrier), "should be enabled"); 457 458 if (dst == noreg) return; 459 460 #ifdef _LP64 461 if (ShenandoahStoreValWriteBarrier || ShenandoahStoreValEnqueueBarrier) { 462 Label is_null; 463 __ testptr(dst, dst); 464 __ jcc(Assembler::zero, is_null); 465 write_barrier_impl(masm, dst); 466 __ bind(is_null); 467 } 468 469 if (ShenandoahStoreValEnqueueBarrier) { 470 // The set of registers to be saved+restored is the same as in the write-barrier above. 471 // Those are the commonly used registers in the interpreter. 472 __ push(rbx); 473 __ push(rcx); 474 __ push(rdx); 475 __ push(c_rarg1); 476 __ subptr(rsp, 2 * Interpreter::stackElementSize); 477 __ movdbl(Address(rsp, 0), xmm0); 478 479 satb_write_barrier_pre(masm, noreg, dst, r15_thread, tmp, true, false); 480 __ movdbl(xmm0, Address(rsp, 0)); 481 __ addptr(rsp, 2 * Interpreter::stackElementSize); 482 __ pop(c_rarg1); 483 __ pop(rdx); 484 __ pop(rcx); 485 __ pop(rbx); 486 } 487 if (ShenandoahStoreValReadBarrier) { 488 read_barrier_impl(masm, dst); 489 } 490 #else 491 Unimplemented(); 492 #endif 493 } 494 495 void ShenandoahBarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, 496 Register dst, Address src, Register tmp1, Register tmp_thread) { 497 bool on_oop = type == T_OBJECT || type == T_ARRAY; 498 bool in_heap = (decorators & IN_HEAP) != 0; 499 bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0; 500 bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0; 501 bool on_reference = on_weak || on_phantom; 502 // tty->print_cr("RB src.base: %s", src.base()->name()); 503 // __ verify_oop(src.base(), "broken oop before RB"); 504 /* 505 if (in_heap) { 506 read_barrier_not_null(masm, src.base()); 507 } 508 */ 509 // __ verify_oop(src.base(), "broken oop before RB"); 510 BarrierSetAssembler::load_at(masm, decorators, type, dst, src, tmp1, tmp_thread); 511 if (ShenandoahKeepAliveBarrier && on_oop && on_reference) { 512 const Register thread = NOT_LP64(tmp_thread) LP64_ONLY(r15_thread); 513 NOT_LP64(__ get_thread(thread)); 514 515 // Generate the SATB pre-barrier code to log the value of 516 // the referent field in an SATB buffer. 517 shenandoah_write_barrier_pre(masm /* masm */, 518 noreg /* obj */, 519 dst /* pre_val */, 520 thread /* thread */, 521 tmp1 /* tmp */, 522 true /* tosca_live */, 523 true /* expand_call */); 524 } 525 } 526 527 void ShenandoahBarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, 528 Address dst, Register val, Register tmp1, Register tmp2) { 529 530 bool in_heap = (decorators & IN_HEAP) != 0; 531 bool in_concurrent_root = (decorators & IN_CONCURRENT_ROOT) != 0; 532 /* 533 if (in_heap) { 534 write_barrier(masm, dst.base()); 535 } 536 */ 537 if (type == T_OBJECT || type == T_ARRAY) { 538 bool needs_pre_barrier = in_heap || in_concurrent_root; 539 bool needs_post_barrier = val != noreg && in_heap && UseShenandoahMatrix; 540 541 Register tmp3 = LP64_ONLY(r8) NOT_LP64(rsi); 542 Register rthread = LP64_ONLY(r15_thread) NOT_LP64(rcx); 543 // flatten object address if needed 544 // We do it regardless of precise because we need the registers 545 if (dst.index() == noreg && dst.disp() == 0) { 546 if (dst.base() != tmp1) { 547 __ movptr(tmp1, dst.base()); 548 } 549 } else { 550 __ lea(tmp1, dst); 551 } 552 553 #ifndef _LP64 554 InterpreterMacroAssembler *imasm = static_cast<InterpreterMacroAssembler*>(masm); 555 #endif 556 557 NOT_LP64(__ get_thread(rcx)); 558 NOT_LP64(imasm->save_bcp()); 559 560 if (needs_pre_barrier) { 561 shenandoah_write_barrier_pre(masm /*masm*/, 562 tmp1 /* obj */, 563 tmp2 /* pre_val */, 564 rthread /* thread */, 565 tmp3 /* tmp */, 566 val != noreg /* tosca_live */, 567 false /* expand_call */); 568 } 569 if (val == noreg) { 570 BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg); 571 } else { 572 storeval_barrier(masm, val, tmp3); 573 Register new_val = val; 574 if (needs_post_barrier) { 575 if (UseCompressedOops) { 576 new_val = tmp2; 577 __ movptr(new_val, val); 578 } 579 } 580 BarrierSetAssembler::store_at(masm, decorators, type, Address(tmp1, 0), val, noreg, noreg); 581 582 if (needs_post_barrier) { 583 shenandoah_write_barrier_post(masm /*masm*/, 584 tmp1 /* store_adr */, 585 new_val /* new_val */, 586 rthread /* thread */, 587 tmp3 /* tmp */, 588 tmp2 /* tmp2 */); 589 } 590 } 591 NOT_LP64(imasm->restore_bcp()); 592 593 } else { 594 BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2); 595 } 596 } 597 598 void ShenandoahBarrierSetAssembler::obj_equals(MacroAssembler* masm, DecoratorSet decorators, Register op1, Register op2) { 599 __ cmpptr(op1, op2); 600 if (ShenandoahAcmpBarrier) { 601 Label done; 602 __ jccb(Assembler::equal, done); 603 read_barrier(masm, op1); 604 read_barrier(masm, op2); 605 __ cmpptr(op1, op2); 606 __ bind(done); 607 } 608 } 609 610 void ShenandoahBarrierSetAssembler::obj_equals_addr(MacroAssembler* masm, DecoratorSet decorators, Register src1, Address src2) { 611 __ cmpptr(src1, src2); 612 if (ShenandoahAcmpBarrier) { 613 Label done; 614 __ jccb(Assembler::equal, done); 615 __ movptr(rscratch2, src2); 616 read_barrier(masm, src1); 617 read_barrier(masm, rscratch2); 618 __ cmpptr(src1, rscratch2); 619 __ bind(done); 620 } 621 } 622 623 void ShenandoahBarrierSetAssembler::resolve_for_read(MacroAssembler* masm, DecoratorSet decorators, Register obj) { 624 bool oop_not_null = (decorators & OOP_NOT_NULL) != 0; 625 if (oop_not_null) { 626 read_barrier_not_null(masm, obj); 627 } else { 628 read_barrier(masm, obj); 629 } 630 } 631 632 void ShenandoahBarrierSetAssembler::resolve_for_write(MacroAssembler* masm, DecoratorSet decorators, Register obj) { 633 write_barrier(masm, obj); 634 }