There's an assert in ConstantOopWriteValue::write_on() which does JNIHandles::resolve(). The problem is current thread is compiler thread and it isn't in VM (but in native) at that moment. So, it's unsafe to resolve a handle and access the naked oop.
void ConstantOopWriteValue::write_on(DebugInfoWriteStream* stream) {
assert(JNIHandles::resolve(value()) == NULL ||
Universe::heap()->is_in_reserved(JNIHandles::resolve(value())),
"Should be in heap");
stream->write_int(CONSTANT_OOP_CODE);
stream->write_handle(value());
}
Original report:
http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2017-November/027546.html