RFR: 8223923: C2: Missing interference with mismatched unsafe accesses

Vladimir Ivanov vlivanov at openjdk.java.net
Tue Aug 17 16:26:43 UTC 2021


Memory effects of mixed or mismatched unsafe accesses aren't properly tracked, so every problematic access is wrapped into a pair of `MemBarCPUOrder` nodes to isolate it from the rest of the memory graph. But `MemNode::can_see_stored_value()` unconditionally steps over `MemBarCPUOrder` and exposes problematic `MergeMem` nodes.  

Proposed fix forbids stepping over `MemBarCPUOrder` nodes when looking for an earlier store into the same location.

Alternatively, a new kind of barrier could be introduced specifically for isolation purposes, but I didn't spot any issues during performance testing with the current patch to justify more complex solution. 

Testing: hs-tier1 - hs-tier6, performance testing.

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

Commit messages:
 - 8223923: C2: Missing interference with mismatched unsafe accesses

Changes: https://git.openjdk.java.net/jdk/pull/5146/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5146&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8223923
  Stats: 84 lines in 2 files changed: 76 ins; 2 del; 6 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5146.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5146/head:pull/5146

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


More information about the hotspot-compiler-dev mailing list