RFR: 8359344: C2: Malformed control flow after intrinsic bailout [v2]

Marc Chevalier mchevalier at openjdk.org
Tue Jul 8 13:44:45 UTC 2025


On Mon, 7 Jul 2025 07:18:11 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

>> Marc Chevalier has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Remove useless loop
>
> src/hotspot/share/opto/library_call.cpp line 1732:
> 
>> 1730:     return false;
>> 1731:   }
>> 1732:   destruct_map_clone(old_state.map);
> 
> I think `destruct_map_clone` could be refactored to take a `SavedState`.

I've made an override of destruct_map_clone taking a SavedState (and delegating to the existing one) rather than changing the existing one for the following reasons:
- `destruct_map_clone` is in `GraphKit` so doesn't know about `SavedState`. Either I'd need to bring `SavedState` to the base class (useless visibility) (or something with forward declarations...) or move `destruct_map_clone` to the derived class `LibraryCallKit`
- `destruct_map_clone` makes sense to have next to `clone_map`. But `clone_map` is used also in `GraphKit`, so not possible to move to the derived class
- The existing `destruct_map_clone` doesn't need a `SavedState` and makes sense without. Requiring more information just make it less usable, but it's fine to have a thin adapter that one can by-pass if one has a `SafePointNode` and not a whole `SavedState`.

> test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java line 104:
> 
>> 102:     public static final String START = "(\\d+(\\s){2}(";
>> 103:     public static final String MID = ".*)+(\\s){2}===.*";
>> 104:     public static final String END = ")";
> 
> I don't like exposing these outside the IR framework but then again I don't really have an idea on how to check the "graph should not have both nodes" invariant. Maybe we should extend the `counts` annotation to support something like `@IR(counts = {IRNode.CallStaticJava, IRNode.OpaqueNotNull, "<= 1"} [...]`?

As discussed, I now have a JBS issue about this, and I factored the duplicated regex into a single final String with name and comment.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25936#discussion_r2192570629
PR Review Comment: https://git.openjdk.org/jdk/pull/25936#discussion_r2192574207


More information about the graal-dev mailing list