Integrated: 8262739: String inflation C2 intrinsic prevents insertion of anti-dependencies
Tobias Hartmann
thartmann at openjdk.java.net
Mon Mar 29 12:43:45 UTC 2021
On Tue, 16 Mar 2021 11:12:34 GMT, Tobias Hartmann <thartmann 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
This pull request has now been integrated.
Changeset: 3caea470
Author: Tobias Hartmann <thartmann at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/3caea470
Stats: 65 lines in 2 files changed: 65 ins; 0 del; 0 mod
8262739: String inflation C2 intrinsic prevents insertion of anti-dependencies
Reviewed-by: neliasso, chagedorn
-------------
PR: https://git.openjdk.java.net/jdk/pull/3025
More information about the hotspot-compiler-dev
mailing list