Skip to content
Permalink
Browse files
8263041: Shenandoah: Cleanup C1 keep alive barrier check
Reviewed-by: shade, rkennke
  • Loading branch information
zhengyu123 committed Mar 8, 2021
1 parent 1f9ed90 commit a2b8858131ebc2a808d6e58decb264b7aff9134d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
@@ -220,27 +220,22 @@ void ShenandoahBarrierSetC1::load_at_resolved(LIRAccess& access, LIR_Opr result)
BarrierSetC1::load_at_resolved(access, result);
}

// 3: apply keep-alive barrier if ShenandoahSATBBarrier is set
if (ShenandoahSATBBarrier) {
bool is_weak = (decorators & ON_WEAK_OOP_REF) != 0;
bool is_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0;
// 3: apply keep-alive barrier for java.lang.ref.Reference if needed
if (ShenandoahBarrierSet::need_keep_alive_barrier(decorators, type)) {
bool is_anonymous = (decorators & ON_UNKNOWN_OOP_REF) != 0;
bool keep_alive = (decorators & AS_NO_KEEPALIVE) == 0;

if ((is_weak || is_phantom || is_anonymous) && keep_alive) {
// Register the value in the referent field with the pre-barrier
LabelObj *Lcont_anonymous;
if (is_anonymous) {
Lcont_anonymous = new LabelObj();
generate_referent_check(access, Lcont_anonymous);
}
pre_barrier(gen, access.access_emit_info(), decorators, LIR_OprFact::illegalOpr /* addr_opr */,
result /* pre_val */);
if (is_anonymous) {
__ branch_destination(Lcont_anonymous->label());
}

// Register the value in the referent field with the pre-barrier
LabelObj *Lcont_anonymous;
if (is_anonymous) {
Lcont_anonymous = new LabelObj();
generate_referent_check(access, Lcont_anonymous);
}
pre_barrier(gen, access.access_emit_info(), decorators, LIR_OprFact::illegalOpr /* addr_opr */,
result /* pre_val */);
if (is_anonymous) {
__ branch_destination(Lcont_anonymous->label());
}
}
}
}

class C1ShenandoahPreBarrierCodeGenClosure : public StubAssemblerCodeGenClosure {
@@ -551,7 +551,7 @@ Node* ShenandoahBarrierSetC2::load_at_resolved(C2Access& access, const Type* val
}
}

// 3: apply keep-alive barrier if needed
// 3: apply keep-alive barrier for java.lang.ref.Reference if needed
if (ShenandoahBarrierSet::need_keep_alive_barrier(decorators, type)) {
Node* top = Compile::current()->top();
Node* adr = access.addr().node();

0 comments on commit a2b8858

Please sign in to comment.