Skip to content

Commit

Permalink
8292194: G1 nmethod entry barrier disarm value wraps around too early
Browse files Browse the repository at this point in the history
Reviewed-by: ayang, tschatzl
  • Loading branch information
fisk committed Aug 24, 2022
1 parent d3fed12 commit a45a4b9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/hotspot/share/gc/shared/barrierSetNMethod.cpp
Expand Up @@ -117,8 +117,14 @@ class BarrierSetNMethodArmClosure : public ThreadClosure {
void BarrierSetNMethod::arm_all_nmethods() {
// Change to a new global GC phase. Doing this requires changing the thread-local
// disarm value for all threads, to reflect the new GC phase.
// We wrap around at INT_MAX. That means that we assume nmethods won't have ABA
// problems in their nmethod disarm values after INT_MAX - 1 GCs. Every time a GC
// completes, ABA problems are removed, but if a concurrent GC is started and then
// aborted N times, that is when there could be ABA problems. If there are anything
// close to INT_MAX - 1 GCs starting without being able to finish, something is
// seriously wrong.
++_current_phase;
if (_current_phase == 4) {
if (_current_phase == INT_MAX) {
_current_phase = 1;
}
BarrierSetNMethodArmClosure cl(_current_phase);
Expand Down

1 comment on commit a45a4b9

@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.