RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v2]
Aggelos Biboudis
abimpoudis at openjdk.org
Thu Sep 28 17:50:29 UTC 2023
On Thu, 28 Sep 2023 16:46:11 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:
>> This is the first draft of a patch for Primitive types in patterns, instanceof, and switch (Preview).
>>
>> Draft spec here: https://cr.openjdk.org/~abimpoudis/instanceof/instanceof-20230913/specs/instanceof-jls.html
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Apply suggestions from code review
>
> Co-authored-by: Raffaello Giulietti <raffaello.giulietti at oracle.com>
At the moment the translation is uniform, (simply) computing the method name from the static types of the arguments and generating calls to those methods. This happens from two places, one from the `instanceof`:
> https://github.com/openjdk/jdk/pull/15638/files#diff-bc0df6dce7f74078bfca1e90bec75d7bb3d8b338933be725da78f0a8a7a0c78dR2999
and one from the `SwitchBootstraps` for `switch` (open the SwitchBootstraps file to see the diff, Github doesn't open it automatically):
> https://github.com/openjdk/jdk/pull/15638/files#diff-d71d82d68cc87a9c7179421f4a57eacdba822eb3e6a2b413ddb35f0b891a3764R246
I will try to find a good way to share code between the two places, by avoiding the further duplication of the code (@mcimadamore, @vicente-romero-oracle, @lahodaj any ideas?).
In any case (with code duplication or not) maybe I can introduce a small table to "string intern" those names and avoid this computation altogether (including the map that you wrote above).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15638#issuecomment-1739759884
More information about the compiler-dev
mailing list