Skip to content

Commit

Permalink
[JIT] Replace LoadLoad membar with load-acquire
Browse files Browse the repository at this point in the history
Summary: In nmethod entry barrier, use lighter instruction.

Testing: CICD

Reviewers: mmyxym, kuaiwei

Issue: #174
  • Loading branch information
linade committed Feb 11, 2025
1 parent cb3eb86 commit e8087ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm, Label* slo
Assembler::Condition condition = slow_path == nullptr ? Assembler::EQ : Assembler::NE;
Label& barrier_target = slow_path == nullptr ? skip_barrier : *slow_path;

__ ldrw(rscratch1, *guard);
if (ReplaceLLMemBarWithLoadAcquire == false) {
__ ldrw(rscratch1, *guard);
}

if (patching_type == NMethodPatchingType::stw_instruction_and_data_patch) {
// With STW patching, no data or instructions are updated concurrently,
Expand Down Expand Up @@ -350,7 +352,13 @@ void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm, Label* slo
assert(patching_type == NMethodPatchingType::conc_data_patch, "must be");
// Subsequent loads of oops must occur after load of guard value.
// BarrierSetNMethod::disarm sets guard with release semantics.
__ membar(__ LoadLoad);
if (ReplaceLLMemBarWithLoadAcquire) {
__ adr(rscratch1, *guard);
// ldapr is better on paper, but not significant enough to justify a change.
__ ldarw(rscratch1, rscratch1);
} else {
__ membar(__ LoadLoad);
}
Address thread_disarmed_addr(rthread, in_bytes(bs_nm->thread_disarmed_guard_value_offset()));
__ ldrw(rscratch2, thread_disarmed_addr);
__ cmpw(rscratch1, rscratch2);
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/runtime/globals_ext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
constraint) \
product(bool, UseNewCode4, false, DIAGNOSTIC, \
"Testing Only: Use the new version while testing") \
\
product(bool, ReplaceLLMemBarWithLoadAcquire, false, \
"Replace LoadLoad membar with load-acquire") \

#endif // SHARE_RUNTIME_GLOBALS_EXT_HPP

0 comments on commit e8087ef

Please sign in to comment.