14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/classLoader.hpp"
27 #include "classfile/javaClasses.hpp"
28 #include "classfile/systemDictionary.hpp"
29 #include "classfile/vmSymbols.hpp"
30 #include "code/scopeDesc.hpp"
31 #include "compiler/compileBroker.hpp"
32 #include "interpreter/interpreter.hpp"
33 #include "interpreter/linkResolver.hpp"
34 #include "memory/oopFactory.hpp"
35 #include "memory/universe.inline.hpp"
36 #include "oops/instanceKlass.hpp"
37 #include "oops/objArrayOop.hpp"
38 #include "oops/oop.inline.hpp"
39 #include "oops/symbolOop.hpp"
40 #include "prims/jvm_misc.hpp"
41 #include "prims/jvmtiExport.hpp"
42 #include "prims/jvmtiThreadState.hpp"
43 #include "prims/privilegedStack.hpp"
44 #include "runtime/aprofiler.hpp"
45 #include "runtime/arguments.hpp"
46 #include "runtime/biasedLocking.hpp"
47 #include "runtime/deoptimization.hpp"
48 #include "runtime/fprofiler.hpp"
49 #include "runtime/frame.inline.hpp"
50 #include "runtime/init.hpp"
51 #include "runtime/interfaceSupport.hpp"
52 #include "runtime/java.hpp"
53 #include "runtime/javaCalls.hpp"
1682
1683 if (active_handles() != NULL) {
1684 JNIHandleBlock* block = active_handles();
1685 set_active_handles(NULL);
1686 JNIHandleBlock::release_block(block);
1687 }
1688
1689 if (free_handle_block() != NULL) {
1690 JNIHandleBlock* block = free_handle_block();
1691 set_free_handle_block(NULL);
1692 JNIHandleBlock::release_block(block);
1693 }
1694
1695 // These have to be removed while this is still a valid thread.
1696 remove_stack_guard_pages();
1697
1698 if (UseTLAB) {
1699 tlab().make_parsable(true); // retire TLAB
1700 }
1701
1702 if (jvmti_thread_state() != NULL) {
1703 JvmtiExport::cleanup_thread(this);
1704 }
1705
1706 #ifndef SERIALGC
1707 // We must flush G1-related buffers before removing a thread from
1708 // the list of active threads.
1709 if (UseG1GC) {
1710 flush_barrier_queues();
1711 }
1712 #endif
1713
1714 // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
1715 Threads::remove(this);
1716 }
1717
1718 #ifndef SERIALGC
1719 // Flush G1-related queues.
1720 void JavaThread::flush_barrier_queues() {
1721 satb_mark_queue().flush();
1722 dirty_card_queue().flush();
1723 }
1724
|
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/classLoader.hpp"
27 #include "classfile/javaClasses.hpp"
28 #include "classfile/systemDictionary.hpp"
29 #include "classfile/vmSymbols.hpp"
30 #include "code/scopeDesc.hpp"
31 #include "compiler/compileBroker.hpp"
32 #include "interpreter/interpreter.hpp"
33 #include "interpreter/linkResolver.hpp"
34 #include "jvmtifiles/jvmtiEnv.hpp"
35 #include "memory/oopFactory.hpp"
36 #include "memory/universe.inline.hpp"
37 #include "oops/instanceKlass.hpp"
38 #include "oops/objArrayOop.hpp"
39 #include "oops/oop.inline.hpp"
40 #include "oops/symbolOop.hpp"
41 #include "prims/jvm_misc.hpp"
42 #include "prims/jvmtiExport.hpp"
43 #include "prims/jvmtiThreadState.hpp"
44 #include "prims/privilegedStack.hpp"
45 #include "runtime/aprofiler.hpp"
46 #include "runtime/arguments.hpp"
47 #include "runtime/biasedLocking.hpp"
48 #include "runtime/deoptimization.hpp"
49 #include "runtime/fprofiler.hpp"
50 #include "runtime/frame.inline.hpp"
51 #include "runtime/init.hpp"
52 #include "runtime/interfaceSupport.hpp"
53 #include "runtime/java.hpp"
54 #include "runtime/javaCalls.hpp"
1683
1684 if (active_handles() != NULL) {
1685 JNIHandleBlock* block = active_handles();
1686 set_active_handles(NULL);
1687 JNIHandleBlock::release_block(block);
1688 }
1689
1690 if (free_handle_block() != NULL) {
1691 JNIHandleBlock* block = free_handle_block();
1692 set_free_handle_block(NULL);
1693 JNIHandleBlock::release_block(block);
1694 }
1695
1696 // These have to be removed while this is still a valid thread.
1697 remove_stack_guard_pages();
1698
1699 if (UseTLAB) {
1700 tlab().make_parsable(true); // retire TLAB
1701 }
1702
1703 if (JvmtiEnv::environments_might_exist()) {
1704 MutexLocker mu(JvmtiThreadState_lock);
1705 if (jvmti_thread_state() != NULL) {
1706 JvmtiExport::cleanup_thread(this);
1707 }
1708 }
1709
1710 #ifndef SERIALGC
1711 // We must flush G1-related buffers before removing a thread from
1712 // the list of active threads.
1713 if (UseG1GC) {
1714 flush_barrier_queues();
1715 }
1716 #endif
1717
1718 // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
1719 Threads::remove(this);
1720 }
1721
1722 #ifndef SERIALGC
1723 // Flush G1-related queues.
1724 void JavaThread::flush_barrier_queues() {
1725 satb_mark_queue().flush();
1726 dirty_card_queue().flush();
1727 }
1728
|