On Thu, 11 Jun 2026 10:02:12 GMT, Roland Westrelin <[email protected]> wrote:

>> The bug is caused by a mismatch in the way `LoadFlat` and `StoreFlat`
>> are handled in `ConnectionGraph::find_inst_mem()` and
>> `MemNode::optimize_simple_memory_chain()`. Once EA has run a first
>> time, found some value array allocations as non escaping, and removed
>> their `LoadFlat`/`StoreFlat`, igvn runs and is able to further
>> transform the memory subgraph which introduces inconsistencies that
>> are then caught the next time EA runs.
>> 
>> The fix tries to make sure `ConnectionGraph::find_inst_mem()` and
>> `MemNode::optimize_simple_memory_chain()` handle `LoadFlat` and
>> `StoreFlat` similarly.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Roland Westrelin has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains 11 commits:
> 
>  - review
>  - Merge branch 'lworld' into JDK-8385328
>  - more
>  - review
>  - review
>  - Merge branch 'lworld' into JDK-8385328
>  - more
>  - review
>  - whitespaces
>  - more
>  - ... and 1 more: 
> https://git.openjdk.org/valhalla/compare/abebcaa0...fa48b671

src/hotspot/share/opto/type.hpp line 1550:

> 1548:   int  instance_id()             const { return _instance_id; }
> 1549:   bool is_known_instance_field() const { return is_known_instance() && 
> _offset.get() >= 0; }
> 1550:   bool same_instance_as(const TypeOopPtr* t) const { return 
> instance_id() == t->instance_id(); }

Can we not assert is_known_instance() here?  If that only makes sense for EA 
code, then this could be moved to a static helper in escape.cpp.  My main 
concern is comparing two instance IDs if either side can be <= 0.  Other code 
doing a similar comparison checks is_known_instance() first.  To make this 
general purpose, I think it would need to use something like

meet_instance_id(t->instance_id()) == t->instance_id()

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2489#discussion_r3395512216

Reply via email to