RFR: 8308603: Removing do_pending_ref/enclosing_ref from MetaspaceClosure
Coleen Phillimore
coleenp at openjdk.org
Tue May 23 15:09:35 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`.
src/hotspot/share/cds/archiveBuilder.cpp line 452:
> 450:
> 451: // We are dealing with 3 addresses:
> 452: // address o = ref->obj(): We have found an object whose address is o.
Are 'obj' oops ? We almost always refer to oops as obj but not other things. Is 'object' an oop? This operates on metadata right? I realize this terminology is pre-existing. I suggest changing obj and object in comments at least in the new code to either metadata() or ptr() even, metaptr() ? Unless this does move oops. I don't know this code.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14093#discussion_r1202160387
More information about the hotspot-runtime-dev
mailing list