RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v42]

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Jan 24 12:17:38 UTC 2024


On Wed, 24 Jan 2024 11:53:52 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

>> This is the proposed patch for Primitive types in patterns, instanceof, and switch (Preview).
>> 
>> Draft spec here: https://cr.openjdk.org/~abimpoudis/instanceof/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Set previewEnabled properly in SwitchBootstraps

src/java.base/share/classes/java/lang/runtime/ExactConversionsSupport.java line 34:

> 32:  * may be used, for example, by Java compiler implementations to implement
> 33:  * checks for {@code instanceof} and pattern matching runtime implementations.
> 34:  * Unconditionally exact testing conversions do not require a corresponding

"... do not require a corresponding action at runtime" ... and, for this reason, method corresponding to these conversions are omitted here

src/java.base/share/classes/java/lang/runtime/ExactConversionsSupport.java line 37:

> 35:  * action at run time.
> 36:  * <p>
> 37:  * The run time conversion checks examine whether loss of information would

You provide examples for runtime conversions - it would be useful, before this para, to also have examples of an inexact conversion, an exact conversion and an unconditionally exact conversion (before diving into the details of how the runtime check is performed for floating points).

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1464828250
PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1464826696


More information about the core-libs-dev mailing list