The provided test fails with an assertion in `Parse::array_store()` due to 
checking an old outdated type and the assert being off.

We improve the array type in `inline_array_null_guard()` here because we are 
storing `null`:
https://github.com/openjdk/valhalla/blob/6adeca933a1361c6f44f51c9c266bd1a20a42380/src/hotspot/share/opto/graphKit.cpp#L4041-L4045

We return the casted array but do not update `array_type` in the caller (i.e. 
in `Parse::array_store()`). We then continue and hit this assert which also 
seems wrong:
https://github.com/openjdk/valhalla/blob/6adeca933a1361c6f44f51c9c266bd1a20a42380/src/hotspot/share/opto/parse2.cpp#L263

What we actually want to check is that we either have a known non-flat array, 
in which case the `BoolNode` for the just emitted `flat_array_test()` folded to 
a constant, which we can also check over the current array type, or that we 
find a proper flat array check with a `FlatArrayCheckNode`.

I also squeezed in three unrelated comment updates in `graphKit.cpp` and 
`type.cpp` provided by @marc-chevalier since it's not worth to file an extra 
issue just for that.

Thanks,
Christian

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

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

Commit messages:
 - Fix + Marc's comment updates

Changes: https://git.openjdk.org/valhalla/pull/2614/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2614&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8387612
  Stats: 64 lines in 4 files changed: 57 ins; 4 del; 3 mod
  Patch: https://git.openjdk.org/valhalla/pull/2614.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2614/head:pull/2614

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

Reply via email to