--- old/./42c9c92d320a.export 2015-03-25 13:37:37.844882369 +0100 +++ new/./42c9c92d320a.export 2015-03-25 13:37:37.764882373 +0100 @@ -24,12 +24,13 @@ dcqs.clear_n_completed_buffers(); assert(!dcqs.completed_buffers_exist_dirty(), "Completed buffers exist!"); } -@@ -3751,9 +3751,9 @@ +@@ -3751,10 +3751,10 @@ TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); -- int active_workers = workers()->active_workers(); -+ uint active_workers = workers()->active_workers(); +- int active_workers = (G1CollectedHeap::use_parallel_gc_threads() ? ++ uint active_workers = (G1CollectedHeap::use_parallel_gc_threads() ? + workers()->active_workers() : 1); double pause_start_sec = os::elapsedTime(); - g1_policy()->phase_times()->note_gc_start(active_workers); + g1_policy()->phase_times()->note_gc_start(active_workers, mark_in_progress()); @@ -108,7 +109,7 @@ // Now scan the complement of the collection set. G1CodeBlobClosure scavenge_cs_nmethods(scan_non_heap_weak_roots); -@@ -5073,14 +5064,13 @@ +@@ -5073,18 +5064,17 @@ G1RedirtyLoggedCardsTask(DirtyCardQueueSet* queue) : AbstractGangTask("Redirty Cards"), _queue(queue) { } virtual void work(uint worker_id) { @@ -117,7 +118,11 @@ + G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::RedirtyCards, worker_id); RedirtyLoggedCardTableEntryClosure cl; - _queue->par_apply_closure_to_all_completed_buffers(&cl); + if (G1CollectedHeap::heap()->use_parallel_gc_threads()) { + _queue->par_apply_closure_to_all_completed_buffers(&cl); + } else { + _queue->apply_closure_to_all_completed_buffers(&cl); + } - G1GCPhaseTimes* timer = G1CollectedHeap::heap()->g1_policy()->phase_times(); - timer->record_redirty_logged_cards_time_ms(worker_id, (os::elapsedTime() - start_time) * 1000.0); @@ -342,7 +347,7 @@ - buf.append(_print_format, val); - } + ~WorkerDataArray() { -+ FREE_C_HEAP_ARRAY(T, _data); ++ FREE_C_HEAP_ARRAY(T, _data, mtGC); } - if (G1Log::finest()) { @@ -833,7 +838,7 @@ - _last_redirty_logged_cards_processed_cards.print(3, "Redirtied Cards"); - } + par_phase_printer.print(RedirtyCards); - if (G1EagerReclaimHumongousObjects) { + if (G1ReclaimDeadHumongousObjectsAtYoungGC) { print_stats(2, "Humongous Register", _cur_fast_reclaim_humongous_register_time_ms); if (G1Log::finest()) { @@ -366,3 +559,17 @@ @@ -889,7 +894,7 @@ - } - - ~WorkerDataArray() { -- FREE_C_HEAP_ARRAY(T, _data); +- FREE_C_HEAP_ARRAY(T, _data, mtGC); - } - - void set(uint worker_i, T value) { @@ -1247,7 +1252,7 @@ } void G1StringDedup::unlink(BoolObjectClosure* is_alive) { -@@ -123,45 +123,39 @@ +@@ -123,49 +123,43 @@ class G1StringDedupUnlinkOrOopsDoTask : public AbstractGangTask { private: G1StringDedupUnlinkOrOopsDoClosure _cl; @@ -1263,7 +1268,7 @@ - _cl(is_alive, keep_alive, allow_resize_and_rehash) { - } + _cl(is_alive, keep_alive, allow_resize_and_rehash), _phase_times(phase_times) { } - + virtual void work(uint worker_id) { - double queue_fixup_start = os::elapsedTime(); - G1StringDedupQueue::unlink_or_oops_do(&_cl); @@ -1299,10 +1304,14 @@ - G1StringDedupUnlinkOrOopsDoTask task(is_alive, keep_alive, allow_resize_and_rehash); + G1StringDedupUnlinkOrOopsDoTask task(is_alive, keep_alive, allow_resize_and_rehash, phase_times); - G1CollectedHeap* g1h = G1CollectedHeap::heap(); - g1h->set_par_threads(); - g1h->workers()->run_task(&task); - g1h->set_par_threads(0); + if (G1CollectedHeap::use_parallel_gc_threads()) { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + g1h->set_par_threads(); + g1h->workers()->run_task(&task); + g1h->set_par_threads(0); + } else { + task.work(0); + } - - double fixup_time_ms = (os::elapsedTime() - fixup_start) * 1000.0; - g1p->phase_times()->record_string_dedup_fixup_time(fixup_time_ms); --- old/./b31893aea883.export 2015-03-25 13:37:38.020882362 +0100 +++ new/./b31893aea883.export 2015-03-25 13:37:37.936882365 +0100 @@ -123,8 +123,8 @@ -// Notes on implementation of parallelism in different tasks. -// --// G1ParVerifyTask uses heap_region_par_iterate() for parallelism. --// The number of GC workers is passed to heap_region_par_iterate(). +-// G1ParVerifyTask uses heap_region_par_iterate_chunked() for parallelism. +-// The number of GC workers is passed to heap_region_par_iterate_chunked(). -// It does use run_task() which sets _n_workers in the task. -// G1ParTask executes g1_process_roots() -> -// SharedHeap::process_roots() which calls eventually to @@ -336,7 +336,7 @@ -G1CollectedHeap:: -g1_process_roots(OopClosure* scan_non_heap_roots, - OopClosure* scan_non_heap_weak_roots, -- G1ParPushHeapRSClosure* scan_rs, +- OopsInHeapRegionClosure* scan_rs, - CLDClosure* scan_strong_clds, - CLDClosure* scan_weak_clds, - CodeBlobClosure* scan_strong_code, @@ -459,7 +459,7 @@ - // In the sequential case this param will be ignored. - void g1_process_roots(OopClosure* scan_non_heap_roots, - OopClosure* scan_non_heap_weak_roots, -- G1ParPushHeapRSClosure* scan_rs, +- OopsInHeapRegionClosure* scan_rs, - CLDClosure* scan_strong_clds, - CLDClosure* scan_weak_clds, - CodeBlobClosure* scan_strong_code, @@ -603,12 +603,13 @@ diff --git a/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/src/share/vm/gc_implementation/g1/g1RemSet.cpp --- a/src/share/vm/gc_implementation/g1/g1RemSet.cpp +++ b/src/share/vm/gc_implementation/g1/g1RemSet.cpp -@@ -79,7 +79,6 @@ +@@ -79,8 +79,7 @@ _cards_scanned(NULL), _total_cards_scanned(0), _prev_period_summary() { - _seq_task = new SubTasksDone(NumSeqTasks); - _cset_rs_update_cl = NEW_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, n_workers(), mtGC); + guarantee(n_workers() > 0, "There should be some workers"); + _cset_rs_update_cl = NEW_C_HEAP_ARRAY(OopsInHeapRegionClosure*, n_workers(), mtGC); for (uint i = 0; i < n_workers(); i++) { _cset_rs_update_cl[i] = NULL; @@ -90,7 +89,6 @@ @@ -661,7 +662,7 @@ + +#include "precompiled.hpp" + -+#include "classfile/stringTable.hpp" ++#include "classfile/symbolTable.hpp" +#include "classfile/systemDictionary.hpp" +#include "code/codeCache.hpp" +#include "gc_implementation/g1/bufferingOopClosure.hpp" @@ -754,7 +755,7 @@ + _g1h(g1h), + _process_strong_tasks(new SubTasksDone(G1RP_PS_NumElements)), + _srs(g1h), -+ _lock(Mutex::leaf, "G1 Root Scanning barrier lock", false, Monitor::_safepoint_check_never), ++ _lock(Mutex::leaf, "G1 Root Scanning barrier lock", false), + _n_workers_discovered_strong_classes(0) {} + +void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots, @@ -1273,9 +1274,10 @@ if (younger_gens_as_roots) { - if (!_gen_process_roots_tasks->is_task_claimed(GCH_PS_younger_gens)) { + if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) { - if (level == 1) { - not_older_gens->set_generation(_young_gen); - _young_gen->oop_iterate(not_older_gens); + for (int i = 0; i < level; i++) { + not_older_gens->set_generation(_gens[i]); + _gens[i]->oop_iterate(not_older_gens); + @@ -607,43 +721,18 @@ older_gens->reset_generation(); } @@ -1324,9 +1326,10 @@ - SharedHeap::process_weak_roots(root_closure); - // "Local" "weak" refs + JNIHandles::weak_oops_do(&always_true, root_closure); - _young_gen->ref_processor()->weak_oops_do(root_closure); - _old_gen->ref_processor()->weak_oops_do(root_closure); - } + for (int i = 0; i < _n_gens; i++) { + _gens[i]->ref_processor()->weak_oops_do(root_closure); + } + diff --git a/src/share/vm/memory/genCollectedHeap.hpp b/src/share/vm/memory/genCollectedHeap.hpp --- a/src/share/vm/memory/genCollectedHeap.hpp +++ b/src/share/vm/memory/genCollectedHeap.hpp @@ -1416,7 +1419,7 @@ #include "utilities/copy.hpp" #include "utilities/workgroup.hpp" -@@ -40,32 +39,12 @@ +@@ -40,33 +39,13 @@ SharedHeap* SharedHeap::_sh; @@ -1438,6 +1441,7 @@ SharedHeap::SharedHeap(CollectorPolicy* policy_) : CollectedHeap(), _collector_policy(policy_), + _rem_set(NULL), - _strong_roots_scope(NULL), _strong_roots_parity(0), - _process_strong_tasks(new SubTasksDone(SH_PS_NumElements)), @@ -1447,8 +1451,8 @@ - vm_exit_during_initialization("Failed necessary allocation."); - } _sh = this; // ch is static, should be set only once. - if (UseConcMarkSweepGC || UseG1GC) { - _workers = new FlexibleWorkGang("GC Thread", ParallelGCThreads, + if ((UseParNewGC || + (UseConcMarkSweepGC && (CMSParallelInitialMarkEnabled || @@ -79,14 +58,6 @@ } } @@ -1517,7 +1521,7 @@ - } -} - --Monitor* SharedHeap::StrongRootsScope::_lock = new Monitor(Mutex::leaf, "StrongRootsScope lock", false, Monitor::_safepoint_check_never); +-Monitor* SharedHeap::StrongRootsScope::_lock = new Monitor(Mutex::leaf, "StrongRootsScope lock", false); - -void SharedHeap::StrongRootsScope::mark_worker_done_with_threads(uint n_workers) { - // The Thread work barrier is only needed by G1 Class Unloading. --- old/./b8448a4717da.export 2015-03-25 13:37:38.220882354 +0100 +++ new/./b8448a4717da.export 2015-03-25 13:37:38.140882357 +0100 @@ -330,12 +330,12 @@ /* * @test TestGCLogMessages -- * @bug 8035406 8027295 8035398 8019342 8027959 8048179 -+ * @bug 8035406 8027295 8035398 8019342 8027959 8048179 8027962 +- * @bug 8035406 8027295 8035398 8019342 8027959 ++ * @bug 8035406 8027295 8035398 8019342 8027959 8027962 * @summary Ensure that the PrintGCDetails output for a minor GC with G1 * includes the expected necessary messages. * @key gc -@@ -34,131 +34,159 @@ +@@ -34,128 +34,158 @@ import com.oracle.java.testlibrary.OutputAnalyzer; public class TestGCLogMessages { @@ -373,7 +373,6 @@ - output.shouldNotContain("[String Dedup Fixup"); - output.shouldNotContain("[Young Free CSet"); - output.shouldNotContain("[Non-Young Free CSet"); -- output.shouldNotContain("[Humongous Register"); - output.shouldNotContain("[Humongous Reclaim"); - output.shouldHaveExitValue(0); + private LogMessageWithLevel allLogMessages[] = new LogMessageWithLevel[] { @@ -405,7 +404,6 @@ + new LogMessageWithLevel("Non-Young Free CSet", Level.FINEST), + // Humongous Eager Reclaim + new LogMessageWithLevel("Humongous Reclaim", Level.FINER), -+ new LogMessageWithLevel("Humongous Register", Level.FINER), + }; - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", @@ -436,10 +434,9 @@ - output.shouldContain("[String Dedup Fixup"); - output.shouldNotContain("[Young Free CSet"); - output.shouldNotContain("[Non-Young Free CSet"); -- output.shouldContain("[Humongous Register"); +- output.shouldContain("[Humongous Reclaim"); - output.shouldNotContain("[Humongous Total"); - output.shouldNotContain("[Humongous Candidate"); -- output.shouldContain("[Humongous Reclaim"); - output.shouldNotContain("[Humongous Reclaimed"); - output.shouldHaveExitValue(0); + private void testNormalLogs() throws Exception { @@ -467,10 +464,9 @@ - output.shouldContain("[String Dedup Fixup"); - output.shouldContain("[Young Free CSet"); - output.shouldContain("[Non-Young Free CSet"); -- output.shouldContain("[Humongous Register"); +- output.shouldContain("[Humongous Reclaim"); - output.shouldContain("[Humongous Total"); - output.shouldContain("[Humongous Candidate"); -- output.shouldContain("[Humongous Reclaim"); - output.shouldContain("[Humongous Reclaimed"); - output.shouldHaveExitValue(0); - } @@ -482,8 +478,8 @@ - private static void testWithToSpaceExhaustionLogs() throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", -- "-Xmx32M", -- "-Xmn16M", +- "-Xmx10M", +- "-Xmn5M", - "-XX:+PrintGCDetails", - GCTestWithToSpaceExhaustion.class.getName()); + output = new OutputAnalyzer(pb.start()); @@ -504,8 +500,8 @@ + GCTest.class.getName()); - pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", -- "-Xmx32M", -- "-Xmn16M", +- "-Xmx10M", +- "-Xmn5M", - "-XX:+PrintGCDetails", - "-XX:+UnlockExperimentalVMOptions", - "-XX:G1LogLevel=finest", @@ -567,7 +563,7 @@ - private static byte[] garbage; - private static byte[] largeObject; - public static void main(String [] args) { -- largeObject = new byte[16*1024*1024]; +- largeObject = new byte[5*1024*1024]; - System.out.println("Creating garbage"); - // create 128MB of garbage. This should result in at least one GC, - // some of them with to-space exhaustion.