[code-reflection] RFR: Include boolean in primitive type conversions.
Adam Sotona
asotona at openjdk.org
Wed Sep 18 09:16:18 UTC 2024
On Tue, 17 Sep 2024 07:25:58 GMT, Adam Sotona <asotona at openjdk.org> wrote:
> There is a big difference in `boolean` role in JLS and JVMS. While in JLS it is not allowed to cast between `boolean` and other primitive numeric types (obviously because it is not a numeric type). On the other side in the bytecode it is very hard to differentiate between `byte`, `boolean`, `short`, `char` and `int`. `BytecodeLift` actually inserts an explicit `ConvOp` in the situations where the sub-int type detection failed and it needs to by adjusted on the fly. Explicit `ConvOp` works for conversions between primitive numeric types according to JLS, however `Interpreter` fails on `ConvOp` from and to booleans. `BytecodeGenerator` accepts such conversions (as Class-File API also directly supports conversions between all primitive types, see `CodeBuilder::conversion`).
>
> I'm proposing to add `boolean` into the matrix of supported types for `ConvOp`.
>
> Please review.
>
> Thanks,
> Adam
Thank you!
-------------
PR Comment: https://git.openjdk.org/babylon/pull/232#issuecomment-2357922964
More information about the babylon-dev
mailing list