Skip to content

Commit

Permalink
8293544: G1: Add comment in G1BarrierSetC1::pre_barrier
Browse files Browse the repository at this point in the history
Reviewed-by: kbarrett, sjohanss
  • Loading branch information
albertnetymk committed Sep 12, 2022
1 parent 37df5f5 commit d5aae01
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/hotspot/share/gc/g1/c1/g1BarrierSetC1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ void G1BarrierSetC1::pre_barrier(LIRAccess& access, LIR_Opr addr_opr,
in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset()),
flag_type);
// Read the marking-in-progress flag.
// Note: When loading pre_val requires patching, i.e. do_load == true &&
// patch == true, a safepoint can occur while patching. This makes the
// pre-barrier non-atomic and invalidates the marking-in-progress check.
// Therefore, in the presence of patching, we must repeat the same
// marking-in-progress checking before calling into the Runtime. For
// simplicity, we do this check unconditionally (regardless of the presence
// of patching) in the runtime stub
// (G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub).
LIR_Opr flag_val = gen->new_register(T_INT);
__ load(mark_active_flag_addr, flag_val);
__ cmp(lir_cond_notEqual, flag_val, LIR_OprFact::intConst(0));
Expand Down

1 comment on commit d5aae01

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.