RFR: 8346836: C2: Verify CastII/CastLL bounds at runtime [v10]
Emanuel Peter
epeter at openjdk.org
Thu Apr 24 06:29:53 UTC 2025
On Tue, 22 Apr 2025 17:10:34 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> Hi,
>>
>> This patch adds a develop flag `VerifyConstraintCasts`, which will verify the correctness of `CastIINode`s and `CastLLNode`s at runtime and crash the VM if the dynamic value lies outside the type value range.
>>
>> Please take a look, thanks a lot.
>
> Quan Anh Mai has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 16 additional commits since the last revision:
>
> - Reconstruct FP
> - aarch64 support
> - Merge branch 'master' into verifycast
> - assert CastLL
> - reviews
> - make the flag diagnostic
> - Merge branch 'master' into verifycast
> - draft
> - Merge branch 'master' into verifycast
> - Merge branch 'master' into verifycast
> - ... and 6 more: https://git.openjdk.org/jdk/compare/a581f95f...8d140fd9
Wow, this looks even much better with the improved printing on failure now!
Just out of curiosity: Is the whole `reconstruct_frame_pointer` mechanism general enough so that we could use it in other places as well? It is not super important to me any more, but I've wanted to have something like this for `VerifyAlignVector` already :)
test/hotspot/jtreg/compiler/c2/TestVerifyConstraintCasts.java line 28:
> 26: * @bug 8346836
> 27: * @requires vm.debug == true & vm.flavor == "server"
> 28: * @summary Run with -Xcomp to test -XX:+StressGCM -XX:VerifyConstraintCasts=1 in debug builds.
Nit: you are also running it with `-XX:VerifyConstraintCasts=1`. I would just keep the summary more generic.
Suggestion:
* @summary Empty main program to run with flag VerifyConstraintCasts.
-------------
Marked as reviewed by epeter (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/22880#pullrequestreview-2789859060
PR Review Comment: https://git.openjdk.org/jdk/pull/22880#discussion_r2057632123
More information about the hotspot-compiler-dev
mailing list