RFR: 8152641: Plugin to generate BMH$Species classes ahead-of-time
Mandy Chung
mandy.chung at oracle.com
Fri Mar 25 15:00:21 UTC 2016
> On Mar 25, 2016, at 7:58 AM, Claes Redestad <claes.redestad at oracle.com> wrote:
>
> Hi,
>
> On 2016-03-25 11:11, Peter Levart wrote:
>> Hi Claes, Mandy,
>>
>> On 03/25/2016 02:51 AM, Mandy Chung wrote:
>>> Hi Claes,
>>>
>>> This is a good interesting work to generate BoundMethodHandle$Species_* classes at link time. This will save the class generation time. Instead of Class.forName, you may want to have a class (similar to SystemModules [1]) that will be updated at link time so that BoundMethodHandle can reference it statically to determine what species are generated at link time and even return statically Class<?> of the generated class.
>>
>> You may still want to load this classes lazily when needed. Otherwise the BMH.CLASS_CACHE could simply be pre-populated with name -> Class<?> entries at appropriate early time.
>
> I think laziness is a good property here, since it won't penalize modular applications that choose to instruct jlink to pregenerate a lot of BMH classes.
>
> Perhaps we can allow for static resolve + lazy classload by emitting a switch equivalent to:
>
> switch (types) {
> case "LL":
> return Species_LL.class;
> case "L3":
> return Species_L3.class;
> ..
> default:
> return generateBMHSpeciesClass(types);
> }
>
This is exactly what I was thinking.
Mandy
More information about the jigsaw-dev
mailing list