RFR: 8263376: CTW (Shenandoah): assert(mems <= 1) failed: No node right after call if multiple mem projections
Roland Westrelin
roland at openjdk.java.net
Mon Mar 15 10:12:19 UTC 2021
This is another case of anti-dependence analysis being too conservative.
In TestBadRawMemoryAfterCall.test2(), test
if (i == 42) {
is split thru the Phi that merges values from the fallthru and
exception paths. As a consequence, control flow at the call is
roughly:
a.m() call
| \
fallthru exception
| |
if (i == 42) |
| \ |
| Region1
\ /
Region2
When anti-dependence analysis runs for the load after the call, it
starts from the memory state out of the call on the fallthru path. One
use is a memory Phi at Region2 (say Phi2). Another path leads to
Region1 at, say, Phi1.
When anti-dependence analysis then goes over Phis, it processes Phi2,
goes over the its inputs and finds that 2 are reachable: the one that
has a direct edge to the memory state on the fallthru path and the one
from Phi1. As a consequence, control for the load is set to be right
after the call, which is too conservative.
When following the memory edges, the code stops at Phi1. It doesn't
process uses of Phi1. Any anti-dependence that's needed between the
load and Phi1 is then taken into account when Phis are processed. When
inputs to Phi2 are processed, considering the Phi2->Phi1 is too
conservative. As mentioned above, anti-dependences for Phi1 are taken
into account separately. I think it's true for all Phi->Phi edges that
they can be safely ignored. That's what I propose as a fix.
-------------
Commit messages:
- test & fix
Changes: https://git.openjdk.java.net/jdk/pull/3006/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3006&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8263376
Stats: 29 lines in 2 files changed: 24 ins; 0 del; 5 mod
Patch: https://git.openjdk.java.net/jdk/pull/3006.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/3006/head:pull/3006
PR: https://git.openjdk.java.net/jdk/pull/3006
More information about the shenandoah-dev
mailing list