< prev index next >
src/hotspot/share/runtime/jniHandles.hpp
Print this page
@@ -46,10 +46,14 @@
template<bool external_guard> inline static oop guard_value(oop value);
template<bool external_guard> inline static oop resolve_impl(jobject handle);
template<bool external_guard> 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
// be able to distinguish jweak values from other jobjects, and
// is_weak_global_handle is unsuitable for performance reasons. To
@@ -228,10 +232,11 @@
// external_guard is true if called from resolve_external_guard.
template<bool external_guard>
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<external_guard>(handle);
} else {
result = jobject_ref(handle);
< prev index next >