RFR: 8279219: [REDO] C2 crash when allocating array of size too large [v3]

Roland Westrelin roland at openjdk.java.net
Fri Feb 11 09:05:10 UTC 2022


On Thu, 10 Feb 2022 19:32:55 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> src/hotspot/share/opto/graphKit.cpp line 3977:
>> 
>>> 3975:   Node* valid_length_test = _gvn.intcon(1);
>>> 3976:   if (ary_type->klass()->is_array_klass()) {
>>> 3977:     BasicType bt = ary_type->klass()->as_array_klass()->element_type()->basic_type();
>> 
>> FTR `array_element_basic_type()` is more appropriate here. 
>> `basic_type()` reports `T_INT` for all sub-word element types and it may lead to underestimation of maximum array length.
>
> Thinking more about it, it seems like a bug. For a large enough allocation, it may erroneously classify it as erroneous. Will it trigger wrong exception being thrown?

Thanks for looking at this.
That's not what I observe. bt = T_BYTE for new byte[..].

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

PR: https://git.openjdk.java.net/jdk/pull/6952


More information about the hotspot-compiler-dev mailing list