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

Tobias Hartmann thartmann at openjdk.java.net
Tue Mar 16 12:13:08 UTC 2021


On Tue, 16 Mar 2021 12:03:03 GMT, Nils Eliasson <neliasso at openjdk.org> wrote:

>> 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
>
> Looks good.

Thanks for the review, Nils!

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

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


More information about the hotspot-compiler-dev mailing list