Strict long type casting
Ty Young
youngty1997 at gmail.com
Tue Apr 7 21:30:39 UTC 2020
On 4/7/20 3:54 PM, Maurizio Cimadamore wrote:
>
> On 07/04/2020 20:38, Ty Young wrote:
>> Question: can the JIT compiler still perform these optimizations if
>> the VarHandle(s) are stored in a Map so long as the references are
>> final? Currently(as shown in the code), I'm doing just that to cut
>> down on the amount of wasted memory on the exact same VarHandle(s) as
>> I'd otherwise have 60+ instances.
>
> I would expect a Map to obfuscate things too much for the JIT. Rather
> than having a Map, if you care about performances, I'd suggest to just
> declare all the common (final static) constants you need somewhere -
> and fetch them from that single place. That's at least how code
> typically operate with MethodHandle and VarHandle.
>
> Even storing them into arrays is not great in the absence of the
> @Stable annotation (which is only available to JDK code).
Thanks for the clarification. Is there any chance for this being done on
FMA's end?
>
> Maurizio
>
More information about the panama-dev
mailing list