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

Vladimir Ivanov vlivanov at openjdk.java.net
Thu Feb 10 19:36:21 UTC 2022


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

>> Roland Westrelin has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>> 
>>  - review
>>  - Merge branch 'master' into JDK-8279219
>>  - review
>>  - tests & fix
>>  - Revert "8279204: [BACKOUT] JDK-8278413: C2 crash when allocating array of size too large"
>>    
>>    This reverts commit 04ad668921abbd71dfbc474eed6f1760f7a541b1.
>
> 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?

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

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


More information about the hotspot-compiler-dev mailing list