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/symbolTable.hpp"
27 #include "code/codeCache.hpp"
28 #include "gc_implementation/g1/concurrentMark.inline.hpp"
29 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
30 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
31 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
32 #include "gc_implementation/g1/g1ErgoVerbose.hpp"
33 #include "gc_implementation/g1/g1Log.hpp"
34 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
35 #include "gc_implementation/g1/g1RemSet.hpp"
36 #include "gc_implementation/g1/heapRegion.inline.hpp"
37 #include "gc_implementation/g1/heapRegionManager.inline.hpp"
38 #include "gc_implementation/g1/heapRegionRemSet.hpp"
39 #include "gc_implementation/g1/heapRegionSet.inline.hpp"
40 #include "gc_implementation/shared/vmGCOperations.hpp"
41 #include "gc_implementation/shared/gcTimer.hpp"
42 #include "gc_implementation/shared/gcTrace.hpp"
43 #include "gc_implementation/shared/gcTraceTime.hpp"
44 #include "memory/allocation.hpp"
45 #include "memory/genOopClosures.inline.hpp"
2585 assert(rp->num_q() == active_workers, "why not");
2586
2587 rp->enqueue_discovered_references(executor);
2588
2589 rp->verify_no_references_recorded();
2590 assert(!rp->discovery_enabled(), "Post condition");
2591 }
2592
2593 if (has_overflown()) {
2594 // We can not trust g1_is_alive if the marking stack overflowed
2595 return;
2596 }
2597
2598 assert(_markStack.isEmpty(), "Marking should have completed");
2599
2600 // Unload Klasses, String, Symbols, Code Cache, etc.
2601 {
2602 G1RemarkGCTraceTime trace("Unloading", G1Log::finer());
2603
2604 if (ClassUnloadingWithConcurrentMark) {
2605 bool purged_classes;
2606
2607 {
2608 G1RemarkGCTraceTime trace("System Dictionary Unloading", G1Log::finest());
2609 purged_classes = SystemDictionary::do_unloading(&g1_is_alive);
2610 }
2611
2612 {
2613 G1RemarkGCTraceTime trace("Parallel Unloading", G1Log::finest());
2614 weakRefsWorkParallelPart(&g1_is_alive, purged_classes);
2615 }
2616 }
2617
2618 if (G1StringDedup::is_enabled()) {
2619 G1RemarkGCTraceTime trace("String Deduplication Unlink", G1Log::finest());
2620 G1StringDedup::unlink(&g1_is_alive);
2621 }
2622 }
2623 }
2624
2625 void ConcurrentMark::swapMarkBitMaps() {
2626 CMBitMapRO* temp = _prevMarkBitMap;
2627 _prevMarkBitMap = (CMBitMapRO*)_nextMarkBitMap;
2628 _nextMarkBitMap = (CMBitMap*) temp;
2629 }
2630
2631 class CMObjectClosure;
2632
2633 // Closure for iterating over objects, currently only used for
2634 // processing SATB buffers.
2635 class CMObjectClosure : public ObjectClosure {
|
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/metadataOnStackMark.hpp"
27 #include "classfile/symbolTable.hpp"
28 #include "code/codeCache.hpp"
29 #include "gc_implementation/g1/concurrentMark.inline.hpp"
30 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
31 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
32 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
33 #include "gc_implementation/g1/g1ErgoVerbose.hpp"
34 #include "gc_implementation/g1/g1Log.hpp"
35 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
36 #include "gc_implementation/g1/g1RemSet.hpp"
37 #include "gc_implementation/g1/heapRegion.inline.hpp"
38 #include "gc_implementation/g1/heapRegionManager.inline.hpp"
39 #include "gc_implementation/g1/heapRegionRemSet.hpp"
40 #include "gc_implementation/g1/heapRegionSet.inline.hpp"
41 #include "gc_implementation/shared/vmGCOperations.hpp"
42 #include "gc_implementation/shared/gcTimer.hpp"
43 #include "gc_implementation/shared/gcTrace.hpp"
44 #include "gc_implementation/shared/gcTraceTime.hpp"
45 #include "memory/allocation.hpp"
46 #include "memory/genOopClosures.inline.hpp"
2586 assert(rp->num_q() == active_workers, "why not");
2587
2588 rp->enqueue_discovered_references(executor);
2589
2590 rp->verify_no_references_recorded();
2591 assert(!rp->discovery_enabled(), "Post condition");
2592 }
2593
2594 if (has_overflown()) {
2595 // We can not trust g1_is_alive if the marking stack overflowed
2596 return;
2597 }
2598
2599 assert(_markStack.isEmpty(), "Marking should have completed");
2600
2601 // Unload Klasses, String, Symbols, Code Cache, etc.
2602 {
2603 G1RemarkGCTraceTime trace("Unloading", G1Log::finer());
2604
2605 if (ClassUnloadingWithConcurrentMark) {
2606 // Cleaning of klasses depends on correct information from MetadataMarkOnStack. The CodeCache::mark_on_stack
2607 // part is too slow to be done serially, so it is handled during the weakRefsWorkParallelPart phase.
2608 // Defer the cleaning until we have complete on_stack data.
2609 MetadataOnStackMark md_on_stack(false /* Don't visit the code cache at this point */);
2610
2611 bool purged_classes;
2612
2613 {
2614 G1RemarkGCTraceTime trace("System Dictionary Unloading", G1Log::finest());
2615 purged_classes = SystemDictionary::do_unloading(&g1_is_alive, false /* Defer klass cleaning */);
2616 }
2617
2618 {
2619 G1RemarkGCTraceTime trace("Parallel Unloading", G1Log::finest());
2620 weakRefsWorkParallelPart(&g1_is_alive, purged_classes);
2621 }
2622
2623 {
2624 G1RemarkGCTraceTime trace("Deallocate Metadata", G1Log::finest());
2625 ClassLoaderDataGraph::free_deallocate_lists();
2626 }
2627 }
2628
2629 if (G1StringDedup::is_enabled()) {
2630 G1RemarkGCTraceTime trace("String Deduplication Unlink", G1Log::finest());
2631 G1StringDedup::unlink(&g1_is_alive);
2632 }
2633 }
2634 }
2635
2636 void ConcurrentMark::swapMarkBitMaps() {
2637 CMBitMapRO* temp = _prevMarkBitMap;
2638 _prevMarkBitMap = (CMBitMapRO*)_nextMarkBitMap;
2639 _nextMarkBitMap = (CMBitMap*) temp;
2640 }
2641
2642 class CMObjectClosure;
2643
2644 // Closure for iterating over objects, currently only used for
2645 // processing SATB buffers.
2646 class CMObjectClosure : public ObjectClosure {
|