RFR: 8320128: Clean up Parse constructor for OSR [v2]

Aleksey Shipilev shade at openjdk.org
Wed Jan 3 17:26:43 UTC 2024


On Tue, 21 Nov 2023 06:00:29 GMT, Xin Liu <xliu at openjdk.org> wrote:

>> There's a special case for the constructor of Parse. If current compilation is OSR and it is handling the top-level method(depth() == 1), then
>> 
>> 1. _tf = C->tf();
>> 2. _entry_bci = C->entry_bci();
>> 3. _flow = method()->get_osr_flow_analysis(_entry_bci);
>> 
>> We don't need to assign those member data twice. We can also factor out _flow->failing() for the special case and normal cases. 
>> 
>> It's worth mentioning that we can't save ciTypeFlow computation because
>> get_osr_flow_analysis(_entry_bci) actually needs get_flow_analysis(method()).
>
> Xin Liu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update according to reviewer's feedback.

This looks reasonable. I have a few cosmetic comments/suggestions.

src/hotspot/share/opto/parse1.cpp line 513:

> 511:           tty->print("OSR @%d ", _entry_bci);
> 512:         }
> 513:         tty->print_cr("type flow bailout: %s", _flow->failure_reason());

Not sure if we want to keep the single `print_cr` for log atomicity reasons. I think this would be good too:



if (is_osr_parse()) {
  tty->print_cr("OSR @%d type flow bailout: %s", _entry_bci, _flow->failure_reason());
} else {
  tty->print_cr("type flow bailout: %s", _flow->failure_reason());
}

src/hotspot/share/opto/parse1.cpp line 529:

> 527:   }
> 528: 
> 529: #ifdef ASSERT

I think the goal for this `#ifdef` block is to eliminate even the `if (depth() == 1)` in product builds. Yes, most of the code is dead, but it is safer not to rely on it. Leave it as is.

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

Marked as reviewed by shade (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/16669#pullrequestreview-1802720853
PR Review Comment: https://git.openjdk.org/jdk/pull/16669#discussion_r1440702469
PR Review Comment: https://git.openjdk.org/jdk/pull/16669#discussion_r1440685800


More information about the hotspot-compiler-dev mailing list