RFR: 8308603: Removing do_pending_ref/enclosing_ref from MetaspaceClosure [v2]

Ioi Lam iklam at openjdk.org
Fri Jun 9 23:05:23 UTC 2023


> **The problem**
> 
> MetaspaceClosure is used to traverse all *pointers* in the metaspace objects. It works recursively. A pointer is represented by the `MetaspaceClosure::Ref` type. For example, if you have
> 
> 
> InstanceKlass* a = ..., *b = ...;
> a->_super = b;
> 
> 
> When we are traversing the pointer `a->_super`, we create a `Ref` that records the address of `b` and `&a->super`. However, we currently don't remember the address of `a` in the `Ref`. As a result, when processing the `Ref` inside a `push(Ref* ref)` function, we need to call `MetaspaceClosure::enclousing_ref()` to get to `a`, so that we can mark pointers inside it.
> 
> The reason for`do_pending_ref` is even more convoluted. Please see [JDK-8308603](https://bugs.openjdk.org/browse/JDK-8308603) for more details.
> 
> **The fix**
> 
> The code can be much more readable if we simply remember  `a` in the `Ref`.
> 
> **More info**
> 
> A more in-depth discussion of the use of the MetaspaceClosure API in CDS can be found at:
> - https://github.com/iklam/tools/blob/main/NOTES/cds_status_2023.md#33-copying-of-class-metadata

Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - @calvinccheung review comment: fixed typo
 - Merge branch 'master' into 8308603-remove-metaspace-closure-do-pending-ref
 - 8308603: Removing do_pending_ref() and enclosing_ref() from MetaspaceClosure

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/14093/files
  - new: https://git.openjdk.org/jdk/pull/14093/files/fecc2a42..75024c46

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=14093&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14093&range=00-01

  Stats: 91477 lines in 1407 files changed: 73730 ins; 10939 del; 6808 mod
  Patch: https://git.openjdk.org/jdk/pull/14093.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14093/head:pull/14093

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


More information about the hotspot-runtime-dev mailing list