RFR: 8163370: Reduce number of classes loaded by common usage of java.lang.invoke

Aleksey Shipilev aleksey.shipilev at gmail.com
Wed Aug 10 15:34:46 UTC 2016

On 08/10/2016 06:20 PM, Claes Redestad wrote:
> On 2016-08-10 17:07, Aleksey Shipilev wrote:
>> On 08/09/2016 03:04 PM, Claes Redestad wrote:
>>> please review this set of small changes to reduce the number of classes
>>> defined and pulled in when initializing java.lang.invoke
>>> Webrev: http://cr.openjdk.java.net/~redestad/8163370/webrev/
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8163370
>> I'm too late here, but the change in StringConcatFactory code style is
>> for the worse, IMO. Having a switch over enum does add readability. You
>> might get the same class-count reduce effect by exposing the
>> RecipeElement.tag as byte/int and switching over it.
> Not sure I agree on readability, but using a int/byte works for me. Do
> we expect the number of tags to increase over time?

We used to have much more tags than \1 and \2, we might introduce more
in a backwards-compatible manner.

Maybe syncing up RecipeElement.tag values with the actual tag values
from the recipe could count as cleanup. I.e. make RecipeElement store
either TAG_CONST or TAG_ARG in its "tag" field, and later switch over
the tags.


More information about the core-libs-dev mailing list