RFR: 8353341: C2: removal of a Mod[DF]Node crashes when the node is already dead [v2]
Christian Hagedorn
chagedorn at openjdk.org
Wed Apr 2 07:45:41 UTC 2025
On Wed, 2 Apr 2025 07:42:37 GMT, Marc Chevalier <mchevalier at openjdk.org> wrote:
>> If the Mod[DF]Node has no control projection when it's being removed (because its result is unused), `extract_projections` will fail an assert. So, let's skip the removal.
>>
>> But that should happen only when the nodes are already unreachable (control input being transitively top). At the end of the day, the node should be dropped. because of that, so there is no rush, and let dead node deletion do the job.
>>
>> On the reduced reproducer, the crash is not common (even with `-XX:RepeatCompilation=300`, it might need more than a run to reproduce). So I've tried my fix on multiple thousands repeat compilations (by 300 packs) without a crash, and without having the modulo node alive at the end.
>>
>> Thanks,
>> Marc
>
> Marc Chevalier has updated the pull request incrementally with one additional commit since the last revision:
>
> Address review comments
Looks good!
src/hotspot/share/opto/divnode.cpp line 1522:
> 1520: bool result_is_unused = proj_out_or_null(TypeFunc::Parms) == nullptr;
> 1521: bool is_dead = proj_out_or_null(TypeFunc::Control) == nullptr;
> 1522: if (result_is_unused && !is_dead) {
Might be easier to read when it's flipped to avoid negation with `!` but I leave it up to you to decide which one you prefer :-)
bool not_dead = proj_out_or_null(TypeFunc::Control) != nullptr;
if (result_is_unused && not_dead) {
test/hotspot/jtreg/compiler/c2/irTests/FPModWithoutControlProj.java line 65:
> 63: }
> 64: iArr[1] += 5;
> 65:
Suggestion:
test/hotspot/jtreg/compiler/c2/irTests/FPModWithoutControlProj.java line 87:
> 85: }
> 86: iArr[1] += 5;
> 87:
Suggestion:
-------------
Marked as reviewed by chagedorn (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/24375#pullrequestreview-2734945309
PR Review Comment: https://git.openjdk.org/jdk/pull/24375#discussion_r2024255180
PR Review Comment: https://git.openjdk.org/jdk/pull/24375#discussion_r2024252459
PR Review Comment: https://git.openjdk.org/jdk/pull/24375#discussion_r2024252598
More information about the hotspot-compiler-dev
mailing list