1951 // 6282335 JNI DetachCurrentThread spec states that all Java monitors |
1951 // 6282335 JNI DetachCurrentThread spec states that all Java monitors |
1952 // held by this thread must be released. The spec does not distinguish |
1952 // held by this thread must be released. The spec does not distinguish |
1953 // between JNI-acquired and regular Java monitors. We can only see |
1953 // between JNI-acquired and regular Java monitors. We can only see |
1954 // regular Java monitors here if monitor enter-exit matching is broken. |
1954 // regular Java monitors here if monitor enter-exit matching is broken. |
1955 // |
1955 // |
1956 // Optionally release any monitors for regular JavaThread exits. This |
|
1957 // is provided as a work around for any bugs in monitor enter-exit |
|
1958 // matching. This can be expensive so it is not enabled by default. |
|
1959 // |
|
1960 // ensure_join() ignores IllegalThreadStateExceptions, and so does |
1956 // ensure_join() ignores IllegalThreadStateExceptions, and so does |
1961 // ObjectSynchronizer::release_monitors_owned_by_thread(). |
1957 // ObjectSynchronizer::release_monitors_owned_by_thread(). |
1962 if (exit_type == jni_detach || ObjectMonitor::Knob_ExitRelease) { |
1958 if (exit_type == jni_detach) { |
1963 // Sanity check even though JNI DetachCurrentThread() would have |
1959 // Sanity check even though JNI DetachCurrentThread() would have |
1964 // returned JNI_ERR if there was a Java frame. JavaThread exit |
1960 // returned JNI_ERR if there was a Java frame. JavaThread exit |
1965 // should be done executing Java code by the time we get here. |
1961 // should be done executing Java code by the time we get here. |
1966 assert(!this->has_last_Java_frame(), |
1962 assert(!this->has_last_Java_frame(), |
1967 "should not have a Java frame when detaching or exiting"); |
1963 "should not have a Java frame when detaching or exiting"); |