RFR: 8310297: assert(static_cast<T1>(result) == thing) with ctw
David Holmes
dholmes at openjdk.org
Wed Jun 21 07:34:03 UTC 2023
On Tue, 20 Jun 2023 20:05:44 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
> checked_cast<> doesn't work with the initializers in classfiles because even though javac will complain like:
>
> ByteFieldInitTest.java:32: error: incompatible types: possible lossy conversion from int to byte
> static byte b = 0x80;
> ^
> 1 error
>
> classfiles can have this value and we've always treated this as a negative signed value. Removed the checked_cast for javaClasses static final initializers.
>
> Tested with tier1 on all platforms and added a test.
Looks good. I'm somewhat surprised we don't have any existing test (JCK?) for this. JVMS only requires that the argument to a putfield/putstatic is an int in these cases.
Thanks.
-------------
Marked as reviewed by dholmes (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14571#pullrequestreview-1489962024
More information about the hotspot-runtime-dev
mailing list