--- old/src/hotspot/share/runtime/jniHandles.hpp 2017-11-29 08:31:02.499940466 -0500 +++ new/src/hotspot/share/runtime/jniHandles.hpp 2017-11-29 08:31:02.318745955 -0500 @@ -48,6 +48,10 @@ template inline static oop resolve_impl(jobject handle); template static oop resolve_jweak(jweak handle); + // This method is not inlined in order to avoid circular includes between + // this header file and thread.hpp. + static bool current_thread_in_native(); + public: // Low tag bit in jobject used to distinguish a jweak. jweak is // type equivalent to jobject, but there are places where we need to @@ -230,6 +234,7 @@ template inline oop JNIHandles::resolve_impl(jobject handle) { assert(handle != NULL, "precondition"); + assert(!current_thread_in_native(), "must not be in native"); oop result; if (is_jweak(handle)) { // Unlikely result = resolve_jweak(handle);