RFR: 8320128: Clean up Parse constructor for OSR

Xin Liu xliu at openjdk.org
Tue Nov 21 04:34:04 UTC 2023


On Mon, 20 Nov 2023 06:36:36 GMT, Tobias Hartmann <thartmann 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()).
>
> src/hotspot/share/opto/parse1.cpp line 502:
> 
>> 500:   } else {
>> 501:     _tf = TypeFunc::make(method());
>> 502:     _entry_bci = InvocationEntryBci;
> 
> This is already set in line 404, right? Should it be removed there?

yes, I intend to remove it too. I forgot it.

> src/hotspot/share/opto/parse1.cpp line 511:
> 
>> 509: #ifndef PRODUCT
>> 510:       if (PrintOpto && (Verbose || WizardMode)) {
>> 511:         if (_entry_bci != InvocationEntryBci) {
> 
> Suggestion:
> 
>         if (C->is_osr_compilation()) {

This is not exactly the same. we want to execute this statement if and only if (C->is_osr_compilation() && depth() == 1)!  


tty->print("OSR @%d ", _entry_bci);


for OSR, Parsing is still recursive. In callee's Parse,  _entry_bci is InvocationEntryBci but C->is_osr_compilation() is true. 

if _entry_bci != InvocationEntryBci is true, it's only possible from 'depth() == 1 && C->is_osr_compilation())' above.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16669#discussion_r1400015591
PR Review Comment: https://git.openjdk.org/jdk/pull/16669#discussion_r1400015517


More information about the hotspot-compiler-dev mailing list