--- old/src/hotspot/share/code/debugInfo.cpp 2017-11-22 22:41:59.557787828 -0800 +++ new/src/hotspot/share/code/debugInfo.cpp 2017-11-22 22:41:59.198755307 -0800 @@ -28,6 +28,8 @@ #include "code/nmethod.hpp" #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" +#include "runtime/interfaceSupport.hpp" +#include "runtime/thread.hpp" // Constructors @@ -209,14 +211,22 @@ // ConstantOopWriteValue void ConstantOopWriteValue::write_on(DebugInfoWriteStream* stream) { - assert(JNIHandles::resolve(value()) == NULL || - Universe::heap()->is_in_reserved(JNIHandles::resolve(value())), - "Should be in heap"); +#ifdef ASSERT + { + // cannot use ThreadInVMfromNative here since in case of JVMCI compiler, + // thread is already in VM state. + ThreadInVMfromUnknown tiv; + assert(JNIHandles::resolve(value()) == NULL || + Universe::heap()->is_in_reserved(JNIHandles::resolve(value())), + "Should be in heap"); + } +#endif stream->write_int(CONSTANT_OOP_CODE); stream->write_handle(value()); } void ConstantOopWriteValue::print_on(outputStream* st) const { + ThreadInVMfromNative tiv(JavaThread::current()); JNIHandles::resolve(value())->print_value_on(st); }