RFR: 8199149: Improve the exception message thrown by VarHandle of unsupported operation [v4]
Mandy Chung
mchung at openjdk.org
Thu Jul 20 16:58:01 UTC 2023
On Thu, 20 Jul 2023 16:26:51 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> I think this is a worthy change: see https://github.com/openjdk/jdk/pull/14943/files#diff-556b309ea2df3f5bfe8229de944183ef19750ce4511d0328cd59af2ce2b61ae2R135
>> that `VarHandle.AccessMode.values()` is called every time a polymorphic VH call is linked.
>>
>> If the startup cost from array allocation is really problematic, we can make it stable and allocate `VALUES` on demand (at `valueFromOrdinal` calls).
>
> Ah, so it looks like we are creating this array already, in adding the `valueFromOrdinal` method allows sharing. That sounds good!
The overhead is just one time allocation of an array of length 31, which is a very small array which I don't think such small array creation impacts as much.
I should have replaced other uses of `AccessMode.values()`. I will include that change in this patch.
@liach I don't know about `AccessType.values()` which seems to me not worth the change to add `valueFromOrdinal` as only calls that 6 times.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14928#discussion_r1269725114
More information about the core-libs-dev
mailing list