--- old/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp 2015-03-18 09:47:43.715051545 +0100 +++ new/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp 2015-03-18 09:47:43.571045658 +0100 @@ -3093,10 +3093,10 @@ G1VerifyCodeRootBlobClosure blobsCl(&codeRootsCl); { - G1RootProcessor root_processor(this, false /* trace_metadata */); + G1RootProcessor root_processor(this); root_processor.process_all_roots(&rootsCl, &cldCl, - &blobsCl); + &blobsCl); } bool failures = rootsCl.failures() || codeRootsCl.failures(); @@ -4450,6 +4450,8 @@ CLDClosure* strong_cld_cl; CLDClosure* weak_cld_cl; + bool trace_metadata = false; + if (_g1h->g1_policy()->during_initial_mark_pause()) { // We also need to mark copied objects. strong_root_cl = &scan_mark_root_cl; @@ -4457,6 +4459,7 @@ if (ClassUnloadingWithConcurrentMark) { weak_root_cl = &scan_mark_weak_root_cl; weak_cld_cl = &scan_mark_weak_cld_cl; + trace_metadata = true; } else { weak_root_cl = &scan_mark_root_cl; weak_cld_cl = &scan_mark_cld_cl; @@ -4474,6 +4477,7 @@ weak_root_cl, strong_cld_cl, weak_cld_cl, + trace_metadata, worker_id); G1ParPushHeapRSClosure push_heap_rs_cl(_g1h, &pss); @@ -5464,13 +5468,10 @@ double end_par_time_sec; { - const bool during_im = g1_policy()->during_initial_mark_pause(); - const bool trace_metadata = during_im && ClassUnloadingWithConcurrentMark; - - G1RootProcessor root_processor(this, trace_metadata); + G1RootProcessor root_processor(this); G1ParTask g1_par_task(this, _task_queues, &root_processor); // InitialMark needs claim bits to keep track of the marked-through CLDs. - if (during_im) { + if (g1_policy()->during_initial_mark_pause()) { ClassLoaderDataGraph::clear_claimed_marks(); } --- old/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp 2015-03-18 09:47:44.499083593 +0100 +++ new/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp 2015-03-18 09:47:44.411079996 +0100 @@ -133,7 +133,7 @@ MarkingCodeBlobClosure follow_code_closure(&GenMarkSweep::follow_root_closure, !CodeBlobToOopClosure::FixRelocations); { - G1RootProcessor root_processor(g1h, true /* trace_metadata */); + G1RootProcessor root_processor(g1h); root_processor.process_strong_roots(&GenMarkSweep::follow_root_closure, &GenMarkSweep::follow_cld_closure, &follow_code_closure); @@ -245,7 +245,7 @@ CodeBlobToOopClosure adjust_code_closure(&GenMarkSweep::adjust_pointer_closure, CodeBlobToOopClosure::FixRelocations); { - G1RootProcessor root_processor(g1h, false /* trace_metadata */); + G1RootProcessor root_processor(g1h); root_processor.process_all_roots(&GenMarkSweep::adjust_pointer_closure, &GenMarkSweep::adjust_cld_closure, &adjust_code_closure); --- old/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp 2015-03-18 09:47:45.063106649 +0100 +++ new/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp 2015-03-18 09:47:44.971102888 +0100 @@ -113,18 +113,18 @@ } } -G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h, bool trace_metadata) : +G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h) : _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), - _n_workers_discovered_strong_classes(0), - _trace_metadata(trace_metadata) {} + _n_workers_discovered_strong_classes(0) {} void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots, OopClosure* scan_non_heap_weak_roots, CLDClosure* scan_strong_clds, CLDClosure* scan_weak_clds, + bool trace_metadata, uint worker_i) { // First scan the shared roots. double ext_roots_start = os::elapsedTime(); @@ -139,14 +139,14 @@ G1CodeBlobClosure root_code_blobs(scan_non_heap_roots); process_java_roots(strong_roots, - _trace_metadata ? scan_strong_clds : NULL, + trace_metadata ? scan_strong_clds : NULL, scan_strong_clds, - _trace_metadata ? NULL : scan_weak_clds, + trace_metadata ? NULL : scan_weak_clds, &root_code_blobs); // This is the point where this worker thread will not find more strong CLDs/nmethods. // Report this so G1 can synchronize the strong and weak CLDs/nmethods processing. - if (_trace_metadata) { + if (trace_metadata) { worker_has_discovered_all_strong_classes(); } @@ -161,7 +161,7 @@ _g1h->ref_processor_cm()->weak_oops_do(&buf_scan_non_heap_roots); } - if (_trace_metadata) { + if (trace_metadata) { // Barrier to make sure all workers passed // the strong CLD and strong nmethods phases. wait_until_all_strong_classes_discovered(); --- old/src/share/vm/gc_implementation/g1/g1RootProcessor.hpp 2015-03-18 09:47:45.575127578 +0100 +++ new/src/share/vm/gc_implementation/g1/g1RootProcessor.hpp 2015-03-18 09:47:45.491124144 +0100 @@ -50,7 +50,6 @@ // Used to implement the Thread work barrier. Monitor _lock; volatile jint _n_workers_discovered_strong_classes; - const bool _trace_metadata; enum G1H_process_roots_tasks { G1RP_PS_Universe_oops_do, @@ -81,7 +80,7 @@ OopClosure* scan_non_heap_weak_roots); public: - G1RootProcessor(G1CollectedHeap* g1h, bool trace_metadata); + G1RootProcessor(G1CollectedHeap* g1h); // Apply closures to the strongly and weakly reachable roots in the system // in a single pass. @@ -90,6 +89,7 @@ OopClosure* scan_non_heap_weak_roots, CLDClosure* scan_strong_clds, CLDClosure* scan_weak_clds, + bool trace_metadata, uint worker_i); // Apply oops, clds and blobs to all strongly reachable roots in the system