RFR: 8358339: Handle MethodCounters::_method backlinks after JDK-8355003

Coleen Phillimore coleenp at openjdk.org
Wed Jun 4 11:46:15 UTC 2025


On Mon, 2 Jun 2025 18:41:42 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Found this when reading mainline-vs-premain webrev. [JDK-8355003](https://bugs.openjdk.org/browse/JDK-8355003) introduced a backlink to `Method*` in `MethodCounters`. I believe we need to handle that backlink at least in `CodeBuffer::finalize_oop_references()`. premain does this, while mainline does not. Also, amusingly, we have `MethodCounters::is_methodCounters`, but not the super-class `Metadata::is_methodCounters`. 
> 
> I pulled in the hunks that use `is_methodCounters()` and `MethodCounters::method()` from premain into this PR.
> 
> Additional testing:
>  - [x] Linux x86_64 server fastdebug, `runtime/cds`
>  - [x] Linux x86_64 server fastdebug, `tier1`
>  - [x] Linux x86_64 server fastdebug, `all`

My repo was two weeks old so I didn't see this change to give MethodCounters a vptr, and don't know why.  At worst the backpointer to Method* in MethodCounters is redundant with the Method* that you're creating the oop_references for, but it shouldn't create two oops.
ie, md == ((MethodCounter*)m)->method();
But maybe that's not the case here.

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

Marked as reviewed by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25599#pullrequestreview-2896407247


More information about the hotspot-dev mailing list