EA runs a first time, finds a non escaping allocation, splits unique
types, creates extra phi nodes, then `LoadFlat` nodes for that
allocation are expanded. EA runs a second time. At a `Region`, it
finds 2 `Phi` for alias 19:

1866  Phi  === 1206 1867 1858  [[ 1948 1304 1855 1317 1250 1936 1263 ]]  
#memory  Memory: 
@aryptr:flat:atomic:instptr:compiler/valhalla/inlinetypes/TestFlatArrayMemoryPhi$MyValue:BotPTR:exact
 *,iid=bot[int:2] 
(java/lang/Cloneable,java/io/Serializable):NotNull:exact:flat():atomic+any,iid=44,
 name=b1, idx=19; !orig=[1208],[1938],[1553],[1239] !jvms: 
TestFlatArrayMemoryPhi::test @ bci:34 (line 58)
2073  Phi  === 1206 1149 1858  [[ 1948 2061 ]]  #memory  Memory: 
@aryptr:flat:atomic:instptr:compiler/valhalla/inlinetypes/TestFlatArrayMemoryPhi$MyValue:BotPTR:exact
 *,iid=bot[int:2] 
(java/lang/Cloneable,java/io/Serializable):NotNull:exact:flat():atomic+any,iid=44,
 name=b1, idx=19; !orig=2060,[1208],[1938],[1553],[1239] !jvms: 
TestFlatArrayMemoryPhi::test @ bci:34 (line 58)


The first one was created by EA on its first run. The second was
created after the first round of EA: it's the result of the
transformation of `(Phi (MergeMem ))` into `(MergeMem (Phi ..) (Phi ..)`.

The second `Phi` references another bottom memory `Phi` (1149) and
that confuses the logic of EA.

The reason, that second `Phi` is created after EA is that initially
the bottom `Phi` has a `LoadFlat` as input but it gets removed because
it's from the non escaping allocation and the `Phi`'s input becomes a
`MergeMem`. To fix that, I propose that the logic that finds the
memory state for a particular alias during EA skips over `LoadFloat`
nodes: either a `LoadFloat` is for the current non escaping allocation
and it's going away anyway or it's from some other allocation and it's
unrelated.

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - un-problem list
 - shenandoah build fix
 - test & fix

Changes: https://git.openjdk.org/valhalla/pull/2459/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2459&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8374742
  Stats: 73 lines in 4 files changed: 67 ins; 5 del; 1 mod
  Patch: https://git.openjdk.org/valhalla/pull/2459.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2459/head:pull/2459

PR: https://git.openjdk.org/valhalla/pull/2459

Reply via email to