When C2 allocates in the slow path, it performs a safepoint poll on the way back to the compiled code. In this safepoint poll, objects can racingly become relocation promoted to the old generation. Such objects would require write barriers to track remembered set changes. But the C2 compiled code speculatively assumes that just allocated objects do not require such write barriers.
The code in ZBarrierSet::on_slowpath_allocation_exit tries to guard against that and detect such races, and deoptimize the frame should it happen.
Unfortunately, the check is racy when the tenuring threshold gets lowered, making the checks insufficient. The result is potentially lost remembered set entries.
This bug relates a lot toJDK-8371200 which fixed this race for flip promoted pages. This bug fixes a related issue for relocation promoted pages.
The code in ZBarrierSet::on_slowpath_allocation_exit tries to guard against that and detect such races, and deoptimize the frame should it happen.
Unfortunately, the check is racy when the tenuring threshold gets lowered, making the checks insufficient. The result is potentially lost remembered set entries.
This bug relates a lot to
- relates to
-
JDK-8371200 ZGC: C2 allocation deopt race
-
- Resolved
-
- links to
-
Review(master)
openjdk/jdk/28558