RFR: 8321619: Generational ZGC: ZColorStoreGoodOopClosure is only valid for young objects

Erik Österlund eosterlund at openjdk.org
Mon Dec 18 12:55:46 UTC 2023


When cloning object arrays, we should do something more similar to arraycopy. The intrinsics for C2 already do that, but there are colder paths where the runtime version of cloning is used, and objects being cloned can potentially end up in the old generation. This could hypothetically be a problem if the source object is being concurrently modified by an external thread, storing store good pointers into its elements. Then, the destination array will look like it doesn't need any store barriers, while in fact no entries have been inserted to the remembered set.

This patch modifies cold object array cloning to be done more like array copy and relaxes the related assert for primitive arrays, which is what triggered the assertion that opened this investigation.

I have tested generational ZGC tier 1-7, general testing tier 1-5, and confirmed the individual test that triggered the assert triggers without this fix and doesn't trigger with this fix.

-------------

Commit messages:
 - 8321619: Generational ZGC: ZColorStoreGoodOopClosure is only valid for young objects

Changes: https://git.openjdk.org/jdk/pull/17141/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17141&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8321619
  Stats: 28 lines in 3 files changed: 23 ins; 1 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/17141.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17141/head:pull/17141

PR: https://git.openjdk.org/jdk/pull/17141


More information about the hotspot-gc-dev mailing list