RFR: 8332249: Micro-optimize Method.hashCode [v2]

Per Minborg pminborg at openjdk.org
Wed Jun 5 13:43:59 UTC 2024


On Wed, 5 Jun 2024 13:37:15 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> Interesting, don't know about hotspot internals so I can't diagnose the exact cause of this regression.
>
> In order to be eligible for constant folding, the benchmark must declare the `Method hashCodeMethod;` as `static final`.
> 
> It is hard for me to understand why a `@Stable` annotation should have a detrimental performance impact on an instance field.
> 
> Can we see a benchmark on Arm Neoverse N1 with the field declared `@Stable` compared to not declared `@Stable`? Also, if the field is `static final`, how would it look like?

As a note, If we would have access to the contemplated `StableValue` and `hash` was declared even as an _instance variable_ `StableValue<Integer>` in a regular class, then it would be trusted and would be eligible for constant folding due to the VM will have special rules for  fields of StableValue type.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19433#discussion_r1627810415


More information about the core-libs-dev mailing list