RFR (S): 8058892: FILL_ARRAYS and ARRAYS are eagely initialized in MethodHandleImpl
vladimir.x.ivanov at oracle.com
Thu Oct 2 17:26:32 UTC 2014
Thanks for the review.
> * Since initialization order is important, why don't put the
> initialization in the existing static initializer? This will secure for
> inadvertent field reordering in future.
Good idea. Fixed.
> * Any reason two new fields are "private"? All other seem package-private.
These fields are intended for usage only in
MHI.varargsArray/buildFiller. They were private before and I decided to
keep that. It is fine for MH_*/NF_* to be used from other places in
j.l.i (e.g. NF_checkSpreadArgument is used in LambdaFormEditor).
> * Any performance problems if we actually count FILL_ARRAYS_COUNT in
> during the static initialization, instead of putting a magic value?
It's more about code structure than performance.
There's a dependency between FILL_ARRAYS size & LEFT_ARGS.
If FILL_ARRAYS_COUNT is moved to Lazy, LEFT_ARGS should be moved to Lazy
as well or LEFT_ARGS should be lazily initialized separately.
IMO it doesn't worth an effort.
> On 10/02/2014 08:55 PM, Vladimir Ivanov wrote:
>> Small update:
>> Need to reorder initialization sequence in MHI.Lazy. Initialized
>> FILL_ARRAYS and ARRAYS are required for later MH lookups.
>> Additional testing:
>> * jck (api/java_lang/invoke)
>> * jdk/java/lang/invoke, jdk/java/util/streams w/ "-ea -esa" and
>> Best regards,
>> Vladimir Ivanov
>> On 10/2/14, 7:52 PM, Vladimir Ivanov wrote:
>>> Core j.l.i classes are preloaded during VM startup in order to avoid
>>> possible deadlock when accessing JSR292-related functionality from
>>> multiple threads. After LF sharing-related changes, FILL_ARRAYS and
>>> ARRAYS are initialized too early. It affects startup time & footprint of
>>> applications that don't use JSR292.
>>> The fix is to move these fields into MHI.Lazy class, thus delaying their
>>> initialization to the first usage of JSR292 API.
>>> Testing: failing test, manual (measured HelloWorld app startup time;
>>> compared -XX:+PrintCompilation logs)
>>> Best regards,
>>> Vladimir Ivanov
>> mlvm-dev mailing list
>> mlvm-dev at openjdk.java.net
More information about the core-libs-dev