RFR: JDK-8294902: Undefined Behavior in C2 regalloc with null references [v5]
Andrew Haley
aph at openjdk.org
Thu Dec 1 17:25:34 UTC 2022
On Wed, 30 Nov 2022 20:00:04 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
>> 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.
I'm sorry, I've been looking at this for a while, and I can't figure out what "move the assert under the null check" means. There are three asserts here, and two of them are under the `if (caller_jvms != NULL)` check.
-------------
PR: https://git.openjdk.org/jdk/pull/10920
More information about the hotspot-dev
mailing list