RFR: 8332249: Micro-optimize Method.hashCode [v2]
    Per Minborg 
    pminborg at openjdk.org
       
    Wed Jun  5 13:48:01 UTC 2024
    
    
  
On Wed, 5 Jun 2024 13:41:10 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> 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.
Ahh. There was a benchmark in the initial message. Sorry.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19433#discussion_r1627818122
    
    
More information about the core-libs-dev
mailing list