--- old/src/share/vm/gc/g1/g1CollectedHeap.cpp 2017-02-23 11:22:47.082170331 +0100 +++ new/src/share/vm/gc/g1/g1CollectedHeap.cpp 2017-02-23 11:22:46.958165478 +0100 @@ -3528,7 +3528,7 @@ undo_waste * HeapWordSize / K); } -class G1StringSymbolTableUnlinkTask : public AbstractGangTask { +class G1StringAndSymbolCleaningTask : public AbstractGangTask { private: BoolObjectClosure* _is_alive; G1StringDedupUnlinkOrOopsDoClosure _dedup_closure; @@ -3547,7 +3547,7 @@ bool _process_string_dedup; public: - G1StringSymbolTableUnlinkTask(BoolObjectClosure* is_alive, bool process_strings, bool process_symbols, bool process_string_dedup) : + G1StringAndSymbolCleaningTask(BoolObjectClosure* is_alive, bool process_strings, bool process_symbols, bool process_string_dedup) : AbstractGangTask("String/Symbol Unlinking"), _is_alive(is_alive), _dedup_closure(is_alive, NULL, false), @@ -3565,7 +3565,7 @@ } } - ~G1StringSymbolTableUnlinkTask() { + ~G1StringAndSymbolCleaningTask() { guarantee(!_process_strings || StringTable::parallel_claimed_index() >= _initial_string_table_size, "claim value %d after unlink less than initial string table size %d", StringTable::parallel_claimed_index(), _initial_string_table_size); @@ -3834,7 +3834,7 @@ // To minimize the remark pause times, the tasks below are done in parallel. class G1ParallelCleaningTask : public AbstractGangTask { private: - G1StringSymbolTableUnlinkTask _string_symbol_task; + G1StringAndSymbolCleaningTask _string_symbol_task; G1CodeCacheUnloadingTask _code_cache_task; G1KlassCleaningTask _klass_cleaning_task; @@ -3871,8 +3871,8 @@ }; -void G1CollectedHeap::full_cleaning(BoolObjectClosure* is_alive, - bool class_unloading_occurred) { +void G1CollectedHeap::complete_cleaning(BoolObjectClosure* is_alive, + bool class_unloading_occurred) { uint n_workers = workers()->active_workers(); G1ParallelCleaningTask g1_unlink_task(is_alive, n_workers, class_unloading_occurred); @@ -3888,7 +3888,7 @@ return; } - G1StringSymbolTableUnlinkTask g1_unlink_task(is_alive, process_strings, process_symbols, process_string_dedup); + G1StringAndSymbolCleaningTask g1_unlink_task(is_alive, process_strings, process_symbols, process_string_dedup); workers()->run_task(&g1_unlink_task); } --- old/src/share/vm/gc/g1/g1CollectedHeap.hpp 2017-02-23 11:22:47.722195377 +0100 +++ new/src/share/vm/gc/g1/g1CollectedHeap.hpp 2017-02-23 11:22:47.598190525 +0100 @@ -1404,10 +1404,15 @@ void rebuild_strong_code_roots(); // Partial cleaning used when class unloading is disabled. + // Let the caller choose what structures to clean out: + // - StringTable + // - SymbolTable + // - StringDeduplication structures void partial_cleaning(BoolObjectClosure* is_alive, bool unlink_strings, bool unlink_symbols, bool unlink_string_dedup); - // Full parallel cleaning when class unloading is enabled. - void full_cleaning(BoolObjectClosure* is_alive, bool class_unloading_occurred); + // Complete cleaning used when class unloading is enabled. + // Cleans out all structures handled by partial_cleaning and also the CodeCache. + void complete_cleaning(BoolObjectClosure* is_alive, bool class_unloading_occurred); // Redirty logged cards in the refinement queue. void redirty_logged_cards(); --- old/src/share/vm/gc/g1/g1ConcurrentMark.cpp 2017-02-23 11:22:48.394221676 +0100 +++ new/src/share/vm/gc/g1/g1ConcurrentMark.cpp 2017-02-23 11:22:48.246215884 +0100 @@ -1773,7 +1773,7 @@ if (ClassUnloadingWithConcurrentMark) { GCTraceTime(Debug, gc, phases) debug("Class Unloading", _gc_timer_cm); bool purged_classes = SystemDictionary::do_unloading(&g1_is_alive, false /* Defer klass cleaning */); - g1h->full_cleaning(&g1_is_alive, purged_classes); + g1h->complete_cleaning(&g1_is_alive, purged_classes); } else { GCTraceTime(Debug, gc, phases) debug("Cleanup", _gc_timer_cm); // No need to clean string table and symbol table as they are treated as strong roots when --- old/src/share/vm/gc/g1/g1MarkSweep.cpp 2017-02-23 11:22:49.106249540 +0100 +++ new/src/share/vm/gc/g1/g1MarkSweep.cpp 2017-02-23 11:22:48.974244374 +0100 @@ -167,7 +167,7 @@ // Unload classes and purge the SystemDictionary. bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive); - g1h->full_cleaning(&GenMarkSweep::is_alive, purged_class); + g1h->complete_cleaning(&GenMarkSweep::is_alive, purged_class); } else { GCTraceTime(Debug, gc, phases) trace("Cleanup", gc_timer()); g1h->partial_cleaning(&GenMarkSweep::is_alive, true, true, G1StringDedup::is_enabled());