1.1 --- a/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Tue Jul 17 17:07:44 2018 +0200 1.2 +++ b/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Fri Jul 20 03:07:49 2018 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -135,9 +135,16 @@ 1.11 MarkingCodeBlobClosure follow_code_closure(&GenMarkSweep::follow_root_closure, !CodeBlobToOopClosure::FixRelocations); 1.12 { 1.13 G1RootProcessor root_processor(g1h); 1.14 - root_processor.process_strong_roots(&GenMarkSweep::follow_root_closure, 1.15 - &GenMarkSweep::follow_cld_closure, 1.16 - &follow_code_closure); 1.17 + if (ClassUnloading) { 1.18 + root_processor.process_strong_roots(&GenMarkSweep::follow_root_closure, 1.19 + &GenMarkSweep::follow_cld_closure, 1.20 + &follow_code_closure); 1.21 + } else { 1.22 + root_processor.process_all_roots_no_string_table( 1.23 + &GenMarkSweep::follow_root_closure, 1.24 + &GenMarkSweep::follow_cld_closure, 1.25 + &follow_code_closure); 1.26 + } 1.27 } 1.28 1.29 // Process reference objects found during marking 1.30 @@ -158,15 +165,17 @@ 1.31 // This is the point where the entire marking should have completed. 1.32 assert(GenMarkSweep::_marking_stack.is_empty(), "Marking should have completed"); 1.33 1.34 - // Unload classes and purge the SystemDictionary. 1.35 - bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive); 1.36 + if (ClassUnloading) { 1.37 1.38 - // Unload nmethods. 1.39 - CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class); 1.40 + // Unload classes and purge the SystemDictionary. 1.41 + bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive); 1.42 1.43 - // Prune dead klasses from subklass/sibling/implementor lists. 1.44 - Klass::clean_weak_klass_links(&GenMarkSweep::is_alive); 1.45 + // Unload nmethods. 1.46 + CodeCache::do_unloading(&GenMarkSweep::is_alive, purged_class); 1.47 1.48 + // Prune dead klasses from subklass/sibling/implementor lists. 1.49 + Klass::clean_weak_klass_links(&GenMarkSweep::is_alive); 1.50 + } 1.51 // Delete entries for dead interned string and clean up unreferenced symbols in symbol table. 1.52 G1CollectedHeap::heap()->unlink_string_and_symbol_table(&GenMarkSweep::is_alive); 1.53