RFR: 8240281: Remove failing assertion code when selecting first memory state in SuperWord::co_locate_pack

Christian Hagedorn chagedorn at openjdk.java.net
Wed Feb 10 09:02:55 UTC 2021


While working on [JDK-8238438](https://bugs.openjdk.java.net/browse/JDK-8238438), it was not clear if there is a case where `SuperWord::co_locate_pack()` should pick the memory state of the first load of a pack. We could not find an example and therefore added an `assert(false)` and left the code there to clean it up at some point if the assert was never hit. 

Now, a newly found fuzzer test showed that are cases where we need to pick the first memory state, triggering the `assert(false)`. In the test case `test()`, a store and a load pack are created but the store pack is filtered in `SuperWord::filter_packs()`. The load `x += iArrFld[j]` must read the old value before the store `iArrFld[j] = j` overrides it. Therefore, the load vector must be executed before any of the stores to `iArrFld[j]`. This, however, is not the case if we pick the memory state of the last load which results in wrong values for `iArrFld`: The stores and the loads are dependent and some of the stores are already executed before the load vector. 

The fix is to remove the assertion code added by JDK-8238438 and keep the code for selecting the first memory state of a load pack.

Thanks,
Christian

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

Commit messages:
 - Remove trailing whitespaces
 - 8240281: Remove failing assertion code when selecting first memory state in SuperWord::co_locate_pack

Changes: https://git.openjdk.java.net/jdk/pull/2495/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2495&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8240281
  Stats: 146 lines in 2 files changed: 134 ins; 5 del; 7 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2495.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2495/head:pull/2495

PR: https://git.openjdk.java.net/jdk/pull/2495


More information about the hotspot-compiler-dev mailing list