src/share/vm/memory/sharedHeap.cpp

Print this page
rev 4551 : 8015237: Parallelize string table scanning during strong root processing
Summary: Parallelize the scanning of the intern string table by having each GC worker claim a given number of buckets. Changes were also reviewed by Per Liden <per.liden@oracle.com>.
Reviewed-by: tschatzl, stefank, twisti

*** 1,7 **** /* ! * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 44,54 **** SH_PS_ObjectSynchronizer_oops_do, SH_PS_FlatProfiler_oops_do, SH_PS_Management_oops_do, SH_PS_SystemDictionary_oops_do, SH_PS_jvmti_oops_do, - SH_PS_StringTable_oops_do, SH_PS_CodeCache_oops_do, // Leave this one last. SH_PS_NumElements }; --- 44,53 ----
*** 133,142 **** --- 132,143 ---- SharedHeap::StrongRootsScope::StrongRootsScope(SharedHeap* outer, bool activate) : MarkScope(activate) { if (_active) { outer->change_strong_roots_parity(); + // Zero the claimed high water mark in the StringTable + StringTable::clear_parallel_claimed_index(); } } SharedHeap::StrongRootsScope::~StrongRootsScope() { // nothing particular
*** 161,176 **** perm_gen()->ref_processor()->weak_oops_do(roots); } // Global (strong) JNI handles if (!_process_strong_tasks->is_task_claimed(SH_PS_JNIHandles_oops_do)) JNIHandles::oops_do(roots); // All threads execute this; the individual threads are task groups. ! if (ParallelGCThreads > 0) { Threads::possibly_parallel_oops_do(roots, code_roots); } else { Threads::oops_do(roots, code_roots); } if (!_process_strong_tasks-> is_task_claimed(SH_PS_ObjectSynchronizer_oops_do)) ObjectSynchronizer::oops_do(roots); if (!_process_strong_tasks->is_task_claimed(SH_PS_FlatProfiler_oops_do)) FlatProfiler::oops_do(roots); if (!_process_strong_tasks->is_task_claimed(SH_PS_Management_oops_do)) --- 162,179 ---- perm_gen()->ref_processor()->weak_oops_do(roots); } // Global (strong) JNI handles if (!_process_strong_tasks->is_task_claimed(SH_PS_JNIHandles_oops_do)) JNIHandles::oops_do(roots); + // All threads execute this; the individual threads are task groups. ! if (CollectedHeap::use_parallel_gc_threads()) { Threads::possibly_parallel_oops_do(roots, code_roots); } else { Threads::oops_do(roots, code_roots); } + if (!_process_strong_tasks-> is_task_claimed(SH_PS_ObjectSynchronizer_oops_do)) ObjectSynchronizer::oops_do(roots); if (!_process_strong_tasks->is_task_claimed(SH_PS_FlatProfiler_oops_do)) FlatProfiler::oops_do(roots); if (!_process_strong_tasks->is_task_claimed(SH_PS_Management_oops_do))
*** 184,199 **** } else if (so & SO_SystemClasses) { SystemDictionary::always_strong_oops_do(roots); } } ! if (!_process_strong_tasks->is_task_claimed(SH_PS_StringTable_oops_do)) { if (so & SO_Strings || (!collecting_perm_gen && !JavaObjectsInPerm)) { StringTable::oops_do(roots); } if (JavaObjectsInPerm) { // Verify the string table contents are in the perm gen NOT_PRODUCT(StringTable::oops_do(&assert_is_perm_closure)); } } if (!_process_strong_tasks->is_task_claimed(SH_PS_CodeCache_oops_do)) { --- 187,210 ---- } else if (so & SO_SystemClasses) { SystemDictionary::always_strong_oops_do(roots); } } ! // All threads execute the following. A specific chunk of buckets ! // from the StringTable are the individual tasks. if (so & SO_Strings || (!collecting_perm_gen && !JavaObjectsInPerm)) { + if (CollectedHeap::use_parallel_gc_threads()) { + StringTable::possibly_parallel_oops_do(roots); + } else { StringTable::oops_do(roots); } + } if (JavaObjectsInPerm) { // Verify the string table contents are in the perm gen + if (CollectedHeap::use_parallel_gc_threads()) { + NOT_PRODUCT(StringTable::possibly_parallel_oops_do(&assert_is_perm_closure)); + } else { NOT_PRODUCT(StringTable::oops_do(&assert_is_perm_closure)); } } if (!_process_strong_tasks->is_task_claimed(SH_PS_CodeCache_oops_do)) {