RFR: 8339192: Native annotation parsing code of deprecated annotations causes crash [v2]
Chen Liang
liach at openjdk.org
Tue Sep 17 05:54:03 UTC 2024
On Tue, 17 Sep 2024 05:48:08 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> src/hotspot/share/classfile/classFileParser.cpp line 1174:
>>
>>> 1172: if (cp->is_within_bounds(boolean_value_index) &&
>>> 1173: cp->tag_at(boolean_value_index).is_int() &&
>>> 1174: cp->int_at(boolean_value_index) == 1) {
>>
>> Should we use `== 1` or `(... & 1) == 1` for boolean conversions?
>
> This is pre-existing code. As far as I am aware we will always encode booleans as either 1 or 0 in a `CONSTANT_Integer` in the CP. The JVMS doesn't clearly specify this, except for boolean arrays, but it is what our tools do.
jvms specifies the convention of 1 for true and 0 for false. We can technically ignore other values, but in instructions like bastore it takes a bitwise and per jvms.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21030#discussion_r1762379518
More information about the hotspot-runtime-dev
mailing list