Integrated: 8323682: C2: guard check is not generated in Arrays.copyOfRange intrinsic when allocation is eliminated by EA
Daniel Lundén
dlunden at openjdk.org
Wed Apr 3 05:53:15 UTC 2024
On Mon, 25 Mar 2024 13:28:32 GMT, Daniel Lundén <dlunden at openjdk.org> wrote:
> The library intrinsic `_copyOfRange` does not add a guard for start indices that are larger than the length of the source arrays. Macro expansion of `ArrayCopy` nodes later adds such a guard, but in certain situations escape analysis may result in removing the `ArrayCopy` node before it is expanded. The result is incorrect behavior of the compiled program (as the missing guard may have relevant side effects, such as throwing an exception).
>
> ### Changeset
>
> - Add the missing guard (start index <= source array length).
> - Add a regression test.
>
> ### Testing
>
> - [GitHub Actions](https://github.com/dlunde/jdk/actions/runs/8437807452)
> - tier1 to tier5 on windows-x64, linux-x64, linux-aarch64, macosx-x64, and macosx-aarch64.
This pull request has now been integrated.
Changeset: 92f5c0be
Author: Daniel Lundén <dlunden at openjdk.org>
Committer: Tobias Hartmann <thartmann at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/92f5c0be8e3b47343b54a26940df691faaf49b23
Stats: 71 lines in 3 files changed: 65 ins; 1 del; 5 mod
8323682: C2: guard check is not generated in Arrays.copyOfRange intrinsic when allocation is eliminated by EA
Reviewed-by: thartmann, kvn
-------------
PR: https://git.openjdk.org/jdk/pull/18472
More information about the hotspot-compiler-dev
mailing list