Mercurial > hg > graal-compiler
comparison src/cpu/x86/vm/c1_CodeStubs_x86.cpp @ 6615:09aad8452938
7190310: Inlining WeakReference.get(), and hoisting $referent may lead to non-terminating loops
Summary: In C2 add software membar after load from Reference.referent field to prevent commoning of loads across safepoint since GC can change its value. In C1 always generate Reference.get() intrinsic.
Reviewed-by: roland, twisti, dholmes, johnc
author | kvn |
---|---|
date | Mon, 20 Aug 2012 09:58:58 -0700 |
parents | a79cb7c55012 |
children | da91efe96a93 |
comparison
equal
deleted
inserted
replaced
6614:006050192a5a | 6615:09aad8452938 |
---|---|
486 __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::g1_pre_barrier_slow_id))); | 486 __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::g1_pre_barrier_slow_id))); |
487 __ jmp(_continuation); | 487 __ jmp(_continuation); |
488 | 488 |
489 } | 489 } |
490 | 490 |
491 void G1UnsafeGetObjSATBBarrierStub::emit_code(LIR_Assembler* ce) { | |
492 // At this point we know that offset == referent_offset. | |
493 // | |
494 // So we might have to emit: | |
495 // if (src == null) goto continuation. | |
496 // | |
497 // and we definitely have to emit: | |
498 // if (klass(src).reference_type == REF_NONE) goto continuation | |
499 // if (!marking_active) goto continuation | |
500 // if (pre_val == null) goto continuation | |
501 // call pre_barrier(pre_val) | |
502 // goto continuation | |
503 // | |
504 __ bind(_entry); | |
505 | |
506 assert(src()->is_register(), "sanity"); | |
507 Register src_reg = src()->as_register(); | |
508 | |
509 if (gen_src_check()) { | |
510 // The original src operand was not a constant. | |
511 // Generate src == null? | |
512 __ cmpptr(src_reg, (int32_t) NULL_WORD); | |
513 __ jcc(Assembler::equal, _continuation); | |
514 } | |
515 | |
516 // Generate src->_klass->_reference_type == REF_NONE)? | |
517 assert(tmp()->is_register(), "sanity"); | |
518 Register tmp_reg = tmp()->as_register(); | |
519 | |
520 __ load_klass(tmp_reg, src_reg); | |
521 | |
522 Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset()); | |
523 __ cmpb(ref_type_adr, REF_NONE); | |
524 __ jcc(Assembler::equal, _continuation); | |
525 | |
526 // Is marking active? | |
527 assert(thread()->is_register(), "precondition"); | |
528 Register thread_reg = thread()->as_pointer_register(); | |
529 | |
530 Address in_progress(thread_reg, in_bytes(JavaThread::satb_mark_queue_offset() + | |
531 PtrQueue::byte_offset_of_active())); | |
532 | |
533 if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { | |
534 __ cmpl(in_progress, 0); | |
535 } else { | |
536 assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption"); | |
537 __ cmpb(in_progress, 0); | |
538 } | |
539 __ jcc(Assembler::equal, _continuation); | |
540 | |
541 // val == null? | |
542 assert(val()->is_register(), "Precondition."); | |
543 Register val_reg = val()->as_register(); | |
544 | |
545 __ cmpptr(val_reg, (int32_t) NULL_WORD); | |
546 __ jcc(Assembler::equal, _continuation); | |
547 | |
548 ce->store_parameter(val()->as_register(), 0); | |
549 __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::g1_pre_barrier_slow_id))); | |
550 __ jmp(_continuation); | |
551 } | |
552 | |
553 jbyte* G1PostBarrierStub::_byte_map_base = NULL; | 491 jbyte* G1PostBarrierStub::_byte_map_base = NULL; |
554 | 492 |
555 jbyte* G1PostBarrierStub::byte_map_base_slow() { | 493 jbyte* G1PostBarrierStub::byte_map_base_slow() { |
556 BarrierSet* bs = Universe::heap()->barrier_set(); | 494 BarrierSet* bs = Universe::heap()->barrier_set(); |
557 assert(bs->is_a(BarrierSet::G1SATBCTLogging), | 495 assert(bs->is_a(BarrierSet::G1SATBCTLogging), |