RFR: 8270533: AArch64: size_fits_all_mem_uses should return false if its output is a CAS

Andrew Haley aph at openjdk.java.net
Thu Jul 15 09:38:27 UTC 2021


`size_fits_all_mem_uses(AddPNode)` is used to determine if an add with shift expression can be used as an input to a MemNode. However, it is not correct when one of its outputs is a CAS. This causes a crash when a single AddPNode feeds a CAS and an ordinary MemNode.

This bug is probably latent in the current HotSpot because `pd_clone_address_expressions()` clones AddPNodes that are used as inputs to MemNodes, so `size_fits_all_mem_uses()` never sees a CAS as one of its outputs. The matcher for a CompareAndSwapX node doesn't call `size_fits_all_mem_uses()`, so this can only happen when the same expression feeds both an ordinary MemNode and a CompareAndSwapX.

This bug has been back-ported to JDK 8u, so it must be fixed there. Even though the bug is latent in current HotSpot, it should be fixed.

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

Commit messages:
 - 8270533: AArch64: size_fits_all_mem_uses should return false if its output is a CAS

Changes: https://git.openjdk.java.net/jdk/pull/4790/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4790&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8270533
  Stats: 7 lines in 1 file changed: 7 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4790.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4790/head:pull/4790

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


More information about the hotspot-compiler-dev mailing list