714 cleanup_workers->run_task(&cleanup);
715 } else {
716 // Serial cleanup using VMThread.
717 ParallelSPCleanupTask cleanup(1, &deflate_counters);
718 StrongRootsScope srs(1);
719 cleanup.work(0);
720 }
721
722 // Needs to be done single threaded by the VMThread. This walks
723 // the thread stacks looking for references to metadata before
724 // deciding to remove it from the metaspaces.
725 if (ClassLoaderDataGraph::should_clean_metaspaces_and_reset()) {
726 const char* name = "cleanup live ClassLoaderData metaspaces";
727 TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
728 ClassLoaderDataGraph::walk_metadata_and_clean_metaspaces();
729 }
730
731 // Finish monitor deflation.
732 ObjectSynchronizer::finish_deflate_idle_monitors(&deflate_counters);
733
734 }
735
736
737 bool SafepointSynchronize::safepoint_safe(JavaThread *thread, JavaThreadState state) {
738 switch(state) {
739 case _thread_in_native:
740 // native threads are safe if they have no java stack or have walkable stack
741 return !thread->has_last_Java_frame() || thread->frame_anchor()->walkable();
742
743 // blocked threads should have already have walkable stack
744 case _thread_blocked:
745 assert(!thread->has_last_Java_frame() || thread->frame_anchor()->walkable(), "blocked and not walkable");
746 return true;
747
748 default:
749 return false;
750 }
751 }
752
|
714 cleanup_workers->run_task(&cleanup);
715 } else {
716 // Serial cleanup using VMThread.
717 ParallelSPCleanupTask cleanup(1, &deflate_counters);
718 StrongRootsScope srs(1);
719 cleanup.work(0);
720 }
721
722 // Needs to be done single threaded by the VMThread. This walks
723 // the thread stacks looking for references to metadata before
724 // deciding to remove it from the metaspaces.
725 if (ClassLoaderDataGraph::should_clean_metaspaces_and_reset()) {
726 const char* name = "cleanup live ClassLoaderData metaspaces";
727 TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
728 ClassLoaderDataGraph::walk_metadata_and_clean_metaspaces();
729 }
730
731 // Finish monitor deflation.
732 ObjectSynchronizer::finish_deflate_idle_monitors(&deflate_counters);
733
734 assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer");
735 }
736
737
738 bool SafepointSynchronize::safepoint_safe(JavaThread *thread, JavaThreadState state) {
739 switch(state) {
740 case _thread_in_native:
741 // native threads are safe if they have no java stack or have walkable stack
742 return !thread->has_last_Java_frame() || thread->frame_anchor()->walkable();
743
744 // blocked threads should have already have walkable stack
745 case _thread_blocked:
746 assert(!thread->has_last_Java_frame() || thread->frame_anchor()->walkable(), "blocked and not walkable");
747 return true;
748
749 default:
750 return false;
751 }
752 }
753
|