RFR: JDK-8294902: Undefined Behavior in C2 regalloc with null references [v4]

Vladimir Ivanov vlivanov at openjdk.org
Wed Nov 30 20:04:42 UTC 2022


On Tue, 1 Nov 2022 23:55:48 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> Andrew Haley has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains ten commits:
>> 
>>  - Migrate postaloc.cpp migrated away from references to pointers when it comes to Node_List.
>>    
>>    Co-authored-by: Vladimir Ivanov <vaivanov at openjdk.org>
>>  - Merge from JDK head
>>  - Revert "Push ScopedValue tests"
>>    
>>    This reverts commit d298edfa9eda48ace9a27f83d38320fe6ba79e67.
>>  - Push ScopedValue tests
>>  - More
>>  - Next
>>  - Next
>>  - Next
>>  - Next
>
> src/hotspot/share/opto/bytecodeInfo.cpp line 66:
> 
>> 64:     assert(!caller_jvms->should_reexecute(), "there should be no reexecute bytecode with inlining");
>> 65:   }
>> 66:   assert(_caller_jvms == NULL
> 
> I'd reshape the code and either get rid of `_caller_jvms` initialization on line 47 or replace it with `_caller_jvms(NULL),`. 
> 
> Then, I'd guard `_caller_jvms` initialization by `caller_jvms != NULL` and move the assert under the guard:
> 
>   if (caller_jvms != NULL) {
>     // Keep a private copy of the caller_jvms:
>     _caller_jvms = new (C) JVMState(caller_jvms->method(), caller_tree->caller_jvms());
>     _caller_jvms->set_bci(caller_jvms->bci());
>     assert(!caller_jvms->should_reexecute(), "there should be no reexecute bytecode with inlining");
>     assert(caller_jvms->same_calls_as(_caller_jvms), "consistent JVMS");
>   }
> 
> 
> Or introduce a helper method which does a shallow copy of `caller_jvms` as part of initializing store on line 47.

Please, initialize `_caller_jvms` to `NULL` (on line 47), switch the null check to `caller_jvms` (on line 60), and  move the assert under the null check.

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

PR: https://git.openjdk.org/jdk/pull/10920


More information about the hotspot-dev mailing list