RFR: 8255466: C2 crashes at ciObject::get_oop() const+0x0
Vladimir Kozlov
kvn at openjdk.java.net
Wed Oct 28 16:42:46 UTC 2020
On Wed, 28 Oct 2020 08:40:31 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
>> Graal testing hit this issue with product VM. Tom R. suggested that it could be the case of reflective unsafe static field access that would eventually be optimized away because the Class is null:
>> `if (staticFieldBase != null) {
>> return Unsafe.getInt(staticFieldBase, Unsafe.staticFieldOffset(field));
>> }`
>>
>> I suggest to replace assert with runtime check. Note, `o` value is assigned to `_const_oop` so semantically new code is the same except additional runtime check.
>>
>> I also noticed that const_oop is accessed without check for NULL in new Vector API code. I added check there too.
>>
>> Passed tier1-3 testing.
>
> src/hotspot/share/opto/type.cpp line 3047:
>
>> 3045: _is_ptr_to_narrowoop = false;
>> 3046: } else if (klass() == ciEnv::current()->Class_klass() &&
>> 3047: _offset >= InstanceMirrorKlass::offset_of_static_fields()) {
>
> You could turn the assert into the check in the enclosing `if`. IMO it makes the code clearer.
In that case it would fall into `Instance fields` code below under `} else {` which I don't want.
-------------
PR: https://git.openjdk.java.net/jdk/pull/890
More information about the hotspot-compiler-dev
mailing list