8293544: G1: Add comment in G1BarrierSetC1::pre_barrier

Reviewed-by: kbarrett, sjohanss
This commit is contained in:
Albert Mingkun Yang 2022-09-12 10:05:09 +00:00
parent 37df5f5625
commit d5aae0103a

View File

@ -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));