Soliciting opinions on JDK-8219412
Brian Goetz
brian.goetz at oracle.com
Fri Jan 13 16:24:42 UTC 2023
Yeah, I think the observation is not a particularly significant one. Yes, indy-heavy translation schemes often use more CP slots, which in turn could hasten the “damn, I have to split this class up” problem. But its an incremental effect at best.
Also, while the “obvious” bootstrap signature is having each enum name stored as a Constant_String_info in the constant pool, which does require one slot per case, that’s not the only encoding. You could pass a single string of the form “A;B;C” and split it at link time; we do something similar with the record bootstraps for equals/hashCode/toString.
On Jan 13, 2023, at 11:13 AM, Archie Cobbs <archie.cobbs at gmail.com<mailto:archie.cobbs at gmail.com>> wrote:
On Thu, Jan 12, 2023 at 7:17 AM Maxim Degtyarev <mdegtyarev at gmail.com<mailto:mdegtyarev at gmail.com>> wrote:
> The static argument list identifies the enum constants (by string) corresponding to the case numbers.
This will decrease theoretical maximum of switch blocks in enum switch statement due to constant pool size limitations. So it may affect some code with huge switches over enum.
Just trying to make sure I understand this...
The list of identifiers that gets passed to SwitchBootstraps.enumSwitch() is stored in an array, and the array is built from individual strings pulled from the constant pool.
So is this what you're saying: the number of switch cases is limited by how many entries the constant pool can hold? (I think that's 2^16 - 1)
If that's the case, then doesn't that bug already exist in the compiler in TransPatterns.handleSwitch()?
-Archie
--
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20230113/59c8c194/attachment.htm>
More information about the compiler-dev
mailing list