RFR: 8142334: Improve lazy initialization of java.lang.invoke
Claes Redestad
claes.redestad at oracle.com
Thu Nov 12 15:55:01 UTC 2015
On 2015-11-12 14:47, Paul Sandoz wrote:
>> On 11 Nov 2015, at 15:32, Claes Redestad <claes.redestad at oracle.com> wrote:
>>
>> Paul,
>>
>> On 2015-11-10 11:55, Paul Sandoz wrote:
>>> DirectMethodHandle
>>> —
>>> 682 private static @Stable NamedFunction[] FUNCTIONS = new NamedFunction[NF_LIMIT];
>>>
>>> Invokers
>>> —
>>> 442 private static @Stable NamedFunction[] FUNCTIONS = new NamedFunction[NF_LIMIT];
>>>
>>> MethodHandleImpl
>>> —
>>> 1627 private static @Stable NamedFunction[] FUNCTIONS = new NamedFunction[NF_LIMIT];
>>>
>>>
>>> To be complete you could add “final”, thus it makes it clear that @Stable refers specifically to the array element.
>>>
>>> Paul.
>> Thanks for having a look and catching this:
>>
>> http://cr.openjdk.java.net/~redestad/8142334/webrev.03
>>
>> - added final keyword to FUNCTIONS and HANDLES
>> - added @Stable to ARRAYS, FILL_ARRAYS, and FILL_ARRAY_TO_RIGHT
>>
> MethodHandleImpl.java
> —
>
> 1413 private static final @Stable MethodHandle[] FILL_ARRAYS = new MethodHandle[FILL_ARRAYS_COUNT + 1];
> 1414
> 1415 private static MethodHandle getFillArray(int count) {
> 1416 assert (count > 0 && count <= FILL_ARRAYS_COUNT);
>
> Why FILL_ARRAYS_COUNT + 1 rather than FILL_ARRAYS_COUNT?
>
> Based on the previous code I would have expected the bounds to be:
>
> 0 < count < FILL_ARRAYS_COUNT
>
> Paul.
Yes. Updated http://cr.openjdk.java.net/~redestad/8142334/webrev.03
in-place.
/Claes
More information about the core-libs-dev
mailing list