RFR: 8331194: NPE in ArrayCreationTree.java with -XX:-UseCompressedOops [v5]

Vladimir Kozlov kvn at openjdk.org
Tue Jul 16 17:01:57 UTC 2024


On Tue, 16 Jul 2024 08:27:30 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Cesar Soares Lucas has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix test package path.
>
> src/hotspot/share/opto/output.cpp line 990:
> 
>> 988:     }
>> 989: 
>> 990:     ObjectValue* other = (ObjectValue*) sv_for_node_id(objs, n->_idx);
> 
> Is the cast here necessary? I see them generally in the file... but not sure why.
> 
> ObjectValue*
> PhaseOutput::sv_for_node_id(GrowableArray<ScopeValue*> *objs, int id) {

Because `objs` array may contains 3 types of objects: `ScopeValue`, `ObjectValue` and `ObjectMergeValue`.
I would leave this code as it is for this PR but suggest to file followup RFE to clean this up.
Instead of such casts we should use `as_ObjectValue()` and `as_ObjectMergeValue()` which have asserts to check type.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20087#discussion_r1679758877


More information about the hotspot-compiler-dev mailing list