RFR: 8255466: C2 crashes at ciObject::get_oop() const+0x0

Vladimir Ivanov vlivanov at openjdk.java.net
Wed Oct 28 08:43:20 UTC 2020


On Wed, 28 Oct 2020 02:19:42 GMT, Vladimir Kozlov <kvn 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.

It would be nice to have a regression test for it.

Otherwise, looks good.

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.

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

Marked as reviewed by vlivanov (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/890


More information about the hotspot-compiler-dev mailing list