Integrated: 8308603: Removing do_pending_ref/enclosing_ref from MetaspaceClosure
Ioi Lam
iklam at openjdk.org
Sat Jun 10 19:35:49 UTC 2023
On Tue, 23 May 2023 01:47:18 GMT, Ioi Lam <iklam at openjdk.org> wrote:
> **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
This pull request has now been integrated.
Changeset: 16c3d53b
Author: Ioi Lam <iklam at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/16c3d53b1bb60b1c1570731041f564bf13b45098
Stats: 129 lines in 4 files changed: 43 ins; 64 del; 22 mod
8308603: Removing do_pending_ref/enclosing_ref from MetaspaceClosure
Reviewed-by: ccheung
-------------
PR: https://git.openjdk.org/jdk/pull/14093
More information about the hotspot-runtime-dev
mailing list