On Mon, 18 May 2026 09:06:30 GMT, Tobias Hartmann <[email protected]> wrote:

>> src/hotspot/share/opto/inlinetypenode.cpp line 1460:
>> 
>>> 1458:   PhaseGVN& gvn = kit->gvn();
>>> 1459:   // The flat field loads are dependent on both the array layout 
>>> checks as well as the range check.
>>> 1460:   DecoratorSet decorators = IN_HEAP | IS_ARRAY | MO_UNORDERED | 
>>> C2_CONTROL_DEPENDENT_LOAD | C2_UNKNOWN_CONTROL_LOAD;
>> 
>> Do we need both `C2_CONTROL_DEPENDENT_LOAD` and `C2_UNKNOWN_CONTROL_LOAD 
>> here?
>> Also, if the value is known null free and non atomic at compile time (the 
>> runtime checks control fold and the loads are control dependent on the range 
>> check), wouldn't we want to not pin the load?
>
>> Do we need both C2_CONTROL_DEPENDENT_LOAD and `C2_UNKNOWN_CONTROL_LOAD here?
> 
> I took this from `ArrayCopyNode::load` where we have both as well (I think 
> you did that with JDK-8323274 :slightly_smiling_face: ). We also have both in 
> a few other places, for example in the `needs_range_check` branch in 
> `Parse::array_load` (added with JDK-8333889).
> 
>> Also, if the value is known null free and non atomic at compile time (the 
>> runtime checks control fold and the loads are control dependent on the range 
>> check), wouldn't we want to not pin the load?
> 
> You mean if the array layout is known at compile time and the load is 
> directly below the the range check? Yes, I think in that case we would want 
> to not pin the load. Seems a bit risky / non-trivial though. Are you fine 
> with deferring to a follow-up enhancement?

> > Do we need both C2_CONTROL_DEPENDENT_LOAD and `C2_UNKNOWN_CONTROL_LOAD here?
> 
> I took this from `ArrayCopyNode::load` where we have both as well (I think 
> you did that with JDK-8323274 🙂 ). We also have both in a few other places, 
> for example in the `needs_range_check` branch in `Parse::array_load` (added 
> with JDK-8333889).

Right. We need both because the first one causes the control to be set and the 
second to set the dependency type.

> > Also, if the value is known null free and non atomic at compile time (the 
> > runtime checks control fold and the loads are control dependent on the 
> > range check), wouldn't we want to not pin the load?
> 
> You mean if the array layout is known at compile time and the load is 
> directly below the the range check? Yes, I think in that case we would want 
> to not pin the load. Seems a bit risky / non-trivial though. Are you fine 
> with deferring to a follow-up enhancement?

Sure.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2445#discussion_r3259402927

Reply via email to