RFR: 8350118: Simplify the layout access VarHandle [v2]
    Maurizio Cimadamore 
    mcimadamore at openjdk.org
       
    Fri Feb 28 10:35:06 UTC 2025
    
    
  
On Thu, 27 Feb 2025 14:17:27 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> Well, the reason I removed the eager init is that their creation in clinit is super costly. Also I think one pair of getter + creator is better than 3 pairs.
>
>> ...  their creation in clinit is super costly
> 
> You mean because threads can not race to initialize? I'd think the extra stack walks to create 3 lookups might offset that though...
Another possible option -- if we don't like this, is to put the constants in an holder class. As @JornVernee  says, most of the times the fields are used together. Re. initialization cost, I agree with @liach as I have observed the same thing -- these helper method handles lead to some bytecode spinning -- which is better to delay if not strictly needed?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23720#discussion_r1975182862
    
    
More information about the core-libs-dev
mailing list