RFR: 8255471: ZGC: Rework root iterators and closures

Stefan Karlsson stefank at openjdk.java.net
Thu Oct 29 11:06:56 UTC 2020


Today we have the ZRootsIteratorClosure type to cater for the different type of roots and their containers (oop storage, threads, nmethods, runtime oop data structures). This closure is then passed down and applied to the different containers. We split the root sets into different sets: concurrent strong, concurrent weak, and non-concurrent weak. Not all of those sets contain all types of containers. This forces some of the code to implement, or at least consider, parts of the ZRootsIteratorClosure interface that it doesn't care about. It also moves some of the closure logic into shared code, even when it's only used by one of the closures.

I propose that we turn this inside out, and use direct closures that match the visited containers (NMethodClosure for nmethods, et.c.). The intention is to make it a bit easier to see from the call sites what code is run and, hopefully, making localized changes stay more local in the code.

Note: I started this code with a version building upon https://bugs.openjdk.java.net/browse/JDK-8212879, but I don't want to wait for that work to finish before sending this out, so the current patch contains handling of non-conurrent weak roots. As soon as that gets integrated, we can get rid of the ZWeakSerial and the associated non-concurrent weak roots handling.

I've tested this on tier1-7 on linux x64.

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

Commit messages:
 - 8255471: ZGC: Rework root iterators and closures

Changes: https://git.openjdk.java.net/jdk/pull/928/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=928&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8255471
  Stats: 583 lines in 17 files changed: 231 ins; 202 del; 150 mod
  Patch: https://git.openjdk.java.net/jdk/pull/928.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/928/head:pull/928

PR: https://git.openjdk.java.net/jdk/pull/928



More information about the hotspot-gc-dev mailing list