## Problem Analysis

The stress test `compiler/valhalla/inlinetypes/TestAcmpWithUnstableIf.java`, 
which uses the `StressUnstableIfTrap` flag, failed intermittently with the 
assert "no node with a side effect" during C2 compilation. I tracked down the 
origin of the failure to the raw store of the unstable if trap stress counter 
that was missing a memory edge to the backedge phi and thus had no side effect 
in the loop, which lead to the aforementioned assert. During parsing, the 
missing memory edge gets discarded with as vestigial parsing state when 
`do_if()` ends up `stopped()`. However, the effect of the stress counter should 
still be wired back into the backedge since it will be incremented in the next 
iteration.

## Patch Description

To prevent the stress counters memory state being lost to `PreserveJVMState`, I 
pass it to the caller over an out-parameter and `set_memory` with that node, 
similar to what is already done for control. This is only necessary for the two 
last invocation of `do_if()` in `do_acmp()` where they are actually allowed to 
trap. Further, this PR reenables `StressUnstableIfTrap` in 
`compiler/valhalla/inlinetypes/TestAcmpWithUnstableIf.java`.

## Testing

- [ ] tier1,tier2,tier3 plus internal stress testing

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

Commit messages:
 - Cosmetic changes
 - Add regression test
 - Reenable test
 - Add stress counter in acmp to backedge phi when stopped

Changes: https://git.openjdk.org/valhalla/pull/1716/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1716&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8367244
  Stats: 85 lines in 4 files changed: 77 ins; 2 del; 6 mod
  Patch: https://git.openjdk.org/valhalla/pull/1716.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1716/head:pull/1716

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

Reply via email to