6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
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/stringTable.hpp"
27 #include "classfile/symbolTable.hpp"
28 #include "classfile/systemDictionary.hpp"
29 #include "code/codeCache.hpp"
30 #include "code/icBuffer.hpp"
31 #include "code/nmethod.hpp"
32 #include "code/pcDesc.hpp"
33 #include "code/scopeDesc.hpp"
34 #include "gc/shared/collectedHeap.hpp"
35 #include "gc/shared/gcLocker.inline.hpp"
36 #include "gc/shared/strongRootsScope.hpp"
37 #include "gc/shared/workgroup.hpp"
38 #include "interpreter/interpreter.hpp"
39 #include "logging/log.hpp"
40 #include "logging/logStream.hpp"
41 #include "memory/resourceArea.hpp"
42 #include "memory/universe.inline.hpp"
43 #include "oops/oop.inline.hpp"
44 #include "oops/symbol.hpp"
45 #include "runtime/atomic.hpp"
601
602 if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_STRING_TABLE_REHASH)) {
603 if (StringTable::needs_rehashing()) {
604 const char* name = "rehashing string table";
605 EventSafepointCleanupTask event;
606 TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
607 StringTable::rehash_table();
608 event_safepoint_cleanup_task_commit(event, name);
609 }
610 }
611
612 if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_CLD_PURGE)) {
613 // CMS delays purging the CLDG until the beginning of the next safepoint and to
614 // make sure concurrent sweep is done
615 const char* name = "purging class loader data graph";
616 EventSafepointCleanupTask event;
617 TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
618 ClassLoaderDataGraph::purge_if_needed();
619 event_safepoint_cleanup_task_commit(event, name);
620 }
621 _subtasks.all_tasks_completed(_num_workers);
622 }
623 };
624
625 // Various cleaning tasks that should be done periodically at safepoints.
626 void SafepointSynchronize::do_cleanup_tasks() {
627
628 TraceTime timer("safepoint cleanup tasks", TRACETIME_LOG(Info, safepoint, cleanup));
629
630 // Prepare for monitor deflation.
631 DeflateMonitorCounters deflate_counters;
632 ObjectSynchronizer::prepare_deflate_idle_monitors(&deflate_counters);
633
634 CollectedHeap* heap = Universe::heap();
635 assert(heap != NULL, "heap not initialized yet?");
636 WorkGang* cleanup_workers = heap->get_safepoint_workers();
637 if (cleanup_workers != NULL) {
638 // Parallel cleanup using GC provided thread pool.
639 uint num_cleanup_workers = cleanup_workers->active_workers();
640 ParallelSPCleanupTask cleanup(num_cleanup_workers, &deflate_counters);
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
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/classLoaderData.hpp"
27 #include "classfile/stringTable.hpp"
28 #include "classfile/symbolTable.hpp"
29 #include "classfile/systemDictionary.hpp"
30 #include "code/codeCache.hpp"
31 #include "code/icBuffer.hpp"
32 #include "code/nmethod.hpp"
33 #include "code/pcDesc.hpp"
34 #include "code/scopeDesc.hpp"
35 #include "gc/shared/collectedHeap.hpp"
36 #include "gc/shared/gcLocker.inline.hpp"
37 #include "gc/shared/strongRootsScope.hpp"
38 #include "gc/shared/workgroup.hpp"
39 #include "interpreter/interpreter.hpp"
40 #include "logging/log.hpp"
41 #include "logging/logStream.hpp"
42 #include "memory/resourceArea.hpp"
43 #include "memory/universe.inline.hpp"
44 #include "oops/oop.inline.hpp"
45 #include "oops/symbol.hpp"
46 #include "runtime/atomic.hpp"
602
603 if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_STRING_TABLE_REHASH)) {
604 if (StringTable::needs_rehashing()) {
605 const char* name = "rehashing string table";
606 EventSafepointCleanupTask event;
607 TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
608 StringTable::rehash_table();
609 event_safepoint_cleanup_task_commit(event, name);
610 }
611 }
612
613 if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_CLD_PURGE)) {
614 // CMS delays purging the CLDG until the beginning of the next safepoint and to
615 // make sure concurrent sweep is done
616 const char* name = "purging class loader data graph";
617 EventSafepointCleanupTask event;
618 TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
619 ClassLoaderDataGraph::purge_if_needed();
620 event_safepoint_cleanup_task_commit(event, name);
621 }
622
623 if (!_subtasks.is_task_claimed(SafepointSynchronize::SAFEPOINT_CLEANUP_SYSTEM_DICTIONARY_RESIZE)) {
624 const char* name = "resizing system dictionaries";
625 EventSafepointCleanupTask event;
626 TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup));
627 ClassLoaderDataGraph::resize_if_needed();
628 event_safepoint_cleanup_task_commit(event, name);
629 }
630 _subtasks.all_tasks_completed(_num_workers);
631 }
632 };
633
634 // Various cleaning tasks that should be done periodically at safepoints.
635 void SafepointSynchronize::do_cleanup_tasks() {
636
637 TraceTime timer("safepoint cleanup tasks", TRACETIME_LOG(Info, safepoint, cleanup));
638
639 // Prepare for monitor deflation.
640 DeflateMonitorCounters deflate_counters;
641 ObjectSynchronizer::prepare_deflate_idle_monitors(&deflate_counters);
642
643 CollectedHeap* heap = Universe::heap();
644 assert(heap != NULL, "heap not initialized yet?");
645 WorkGang* cleanup_workers = heap->get_safepoint_workers();
646 if (cleanup_workers != NULL) {
647 // Parallel cleanup using GC provided thread pool.
648 uint num_cleanup_workers = cleanup_workers->active_workers();
649 ParallelSPCleanupTask cleanup(num_cleanup_workers, &deflate_counters);
|