Mercurial > hg > graal-jvmci-8
comparison src/cpu/sparc/vm/c1_CodeStubs_sparc.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 |
---|---|
433 __ br(Assembler::always, false, Assembler::pt, _continuation); | 433 __ br(Assembler::always, false, Assembler::pt, _continuation); |
434 __ delayed()->nop(); | 434 __ delayed()->nop(); |
435 | 435 |
436 } | 436 } |
437 | 437 |
438 void G1UnsafeGetObjSATBBarrierStub::emit_code(LIR_Assembler* ce) { | |
439 // At this point we know that offset == referent_offset. | |
440 // | |
441 // So we might have to emit: | |
442 // if (src == null) goto continuation. | |
443 // | |
444 // and we definitely have to emit: | |
445 // if (klass(src).reference_type == REF_NONE) goto continuation | |
446 // if (!marking_active) goto continuation | |
447 // if (pre_val == null) goto continuation | |
448 // call pre_barrier(pre_val) | |
449 // goto continuation | |
450 // | |
451 __ bind(_entry); | |
452 | |
453 assert(src()->is_register(), "sanity"); | |
454 Register src_reg = src()->as_register(); | |
455 | |
456 if (gen_src_check()) { | |
457 // The original src operand was not a constant. | |
458 // Generate src == null? | |
459 if (__ is_in_wdisp16_range(_continuation)) { | |
460 __ br_null(src_reg, /*annul*/false, Assembler::pt, _continuation); | |
461 } else { | |
462 __ cmp(src_reg, G0); | |
463 __ brx(Assembler::equal, false, Assembler::pt, _continuation); | |
464 } | |
465 __ delayed()->nop(); | |
466 } | |
467 | |
468 // Generate src->_klass->_reference_type() == REF_NONE)? | |
469 assert(tmp()->is_register(), "sanity"); | |
470 Register tmp_reg = tmp()->as_register(); | |
471 | |
472 __ load_klass(src_reg, tmp_reg); | |
473 | |
474 Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset()); | |
475 __ ldub(ref_type_adr, tmp_reg); | |
476 | |
477 // _reference_type field is of type ReferenceType (enum) | |
478 assert(REF_NONE == 0, "check this code"); | |
479 __ cmp_zero_and_br(Assembler::equal, tmp_reg, _continuation, /*annul*/false, Assembler::pt); | |
480 __ delayed()->nop(); | |
481 | |
482 // Is marking active? | |
483 assert(thread()->is_register(), "precondition"); | |
484 Register thread_reg = thread()->as_pointer_register(); | |
485 | |
486 Address in_progress(thread_reg, in_bytes(JavaThread::satb_mark_queue_offset() + | |
487 PtrQueue::byte_offset_of_active())); | |
488 | |
489 if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { | |
490 __ ld(in_progress, tmp_reg); | |
491 } else { | |
492 assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption"); | |
493 __ ldsb(in_progress, tmp_reg); | |
494 } | |
495 | |
496 __ cmp_zero_and_br(Assembler::equal, tmp_reg, _continuation, /*annul*/false, Assembler::pt); | |
497 __ delayed()->nop(); | |
498 | |
499 // val == null? | |
500 assert(val()->is_register(), "Precondition."); | |
501 Register val_reg = val()->as_register(); | |
502 | |
503 if (__ is_in_wdisp16_range(_continuation)) { | |
504 __ br_null(val_reg, /*annul*/false, Assembler::pt, _continuation); | |
505 } else { | |
506 __ cmp(val_reg, G0); | |
507 __ brx(Assembler::equal, false, Assembler::pt, _continuation); | |
508 } | |
509 __ delayed()->nop(); | |
510 | |
511 __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id)); | |
512 __ delayed()->mov(val_reg, G4); | |
513 __ br(Assembler::always, false, Assembler::pt, _continuation); | |
514 __ delayed()->nop(); | |
515 } | |
516 | |
517 jbyte* G1PostBarrierStub::_byte_map_base = NULL; | 438 jbyte* G1PostBarrierStub::_byte_map_base = NULL; |
518 | 439 |
519 jbyte* G1PostBarrierStub::byte_map_base_slow() { | 440 jbyte* G1PostBarrierStub::byte_map_base_slow() { |
520 BarrierSet* bs = Universe::heap()->barrier_set(); | 441 BarrierSet* bs = Universe::heap()->barrier_set(); |
521 assert(bs->is_a(BarrierSet::G1SATBCTLogging), | 442 assert(bs->is_a(BarrierSet::G1SATBCTLogging), |