RFR: 8262739: String inflation C2 intrinsic prevents insertion of anti-dependencies [v2]

Tobias Hartmann thartmann at openjdk.java.net
Tue Mar 16 13:00:28 UTC 2021


> The string inflation intrinsic `StrInflatedCopyNode` which converts the String internal byte[] to char[] has `bottom_type` `Type::MEMORY`:
> https://github.com/openjdk/jdk/blob/f71e8a61988cc9f095a4f034636baf04c3f48f77/src/hotspot/share/opto/intrinsicnode.hpp#L143-L145
> 
> Memory users (i.e. loads) should therefore be checked for nearby anti-dependent stores:
> https://github.com/openjdk/jdk/blob/f71e8a61988cc9f095a4f034636baf04c3f48f77/src/hotspot/share/opto/node.cpp#L1482-L1486
> 
> However, since `InstructForm::captures_bottom_type` returns `false` for `StrInflatedCopyNode`, after matching, the corresponding `MachNode` version will have `bottom_type` `Type::BOTTOM` and no anti-dependency analysis will be performed for its users. Scheduling then incorrectly orders loads from the char array with anti-dependent stores to the same array, leading to incorrect results.
> 
> `StrCompressedCopyNode` does not need this because it has `TypeInt::INT` as  `bottom_type` (the memory output is handled via a `SCMemProjNode`):
> https://github.com/openjdk/jdk/blob/f71e8a61988cc9f095a4f034636baf04c3f48f77/src/hotspot/share/opto/intrinsicnode.hpp#L131-L133
> 
> Thanks,
> Tobias

Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision:

  Moved check out of ifdef

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3025/files
  - new: https://git.openjdk.java.net/jdk/pull/3025/files/c132b1eb..7660c4c2

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3025&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3025&range=00-01

  Stats: 2 lines in 1 file changed: 1 ins; 1 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3025.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3025/head:pull/3025

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


More information about the hotspot-compiler-dev mailing list