< prev index next >

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Print this page
rev 60195 : webrev06

*** 87,96 **** --- 87,97 ---- #include "gc/shared/weakProcessor.inline.hpp" #include "gc/shared/workerPolicy.hpp" #include "logging/log.hpp" #include "memory/allocation.hpp" #include "memory/iterator.hpp" + #include "memory/heapInspection.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/access.inline.hpp" #include "oops/compressedOops.inline.hpp" #include "oops/oop.inline.hpp"
*** 159,171 **** // The from card cache is not the memory that is actually committed. So we cannot // take advantage of the zero_filled parameter. reset_from_card_cache(start_idx, num_regions); } ! Tickspan G1CollectedHeap::run_task(AbstractGangTask* task) { ! Ticks start = Ticks::now(); workers()->run_task(task, workers()->active_workers()); return Ticks::now() - start; } HeapRegion* G1CollectedHeap::new_heap_region(uint hrs_index, MemRegion mr) { --- 160,176 ---- // The from card cache is not the memory that is actually committed. So we cannot // take advantage of the zero_filled parameter. reset_from_card_cache(start_idx, num_regions); } ! void G1CollectedHeap::run_task(AbstractGangTask* task) { workers()->run_task(task, workers()->active_workers()); + } + + Tickspan G1CollectedHeap::run_task_timed(AbstractGangTask* task) { + Ticks start = Ticks::now(); + run_task(task); return Ticks::now() - start; } HeapRegion* G1CollectedHeap::new_heap_region(uint hrs_index, MemRegion mr) {
*** 3698,3708 **** phase_times()->record_prepare_heap_roots_time_ms((Ticks::now() - start).seconds() * 1000.0); } { G1PrepareEvacuationTask g1_prep_task(this); ! Tickspan task_time = run_task(&g1_prep_task); phase_times()->record_register_regions(task_time.seconds() * 1000.0, g1_prep_task.humongous_total(), g1_prep_task.humongous_candidates()); } --- 3703,3713 ---- phase_times()->record_prepare_heap_roots_time_ms((Ticks::now() - start).seconds() * 1000.0); } { G1PrepareEvacuationTask g1_prep_task(this); ! Tickspan task_time = run_task_timed(&g1_prep_task); phase_times()->record_register_regions(task_time.seconds() * 1000.0, g1_prep_task.humongous_total(), g1_prep_task.humongous_candidates()); }
*** 3848,3858 **** Ticks start_processing = Ticks::now(); { G1RootProcessor root_processor(this, num_workers); G1EvacuateRegionsTask g1_par_task(this, per_thread_states, _task_queues, &root_processor, num_workers); ! task_time = run_task(&g1_par_task); // Closing the inner scope will execute the destructor for the G1RootProcessor object. // To extract its code root fixup time we measure total time of this scope and // subtract from the time the WorkGang task took. } Tickspan total_processing = Ticks::now() - start_processing; --- 3853,3863 ---- Ticks start_processing = Ticks::now(); { G1RootProcessor root_processor(this, num_workers); G1EvacuateRegionsTask g1_par_task(this, per_thread_states, _task_queues, &root_processor, num_workers); ! task_time = run_task_timed(&g1_par_task); // Closing the inner scope will execute the destructor for the G1RootProcessor object. // To extract its code root fixup time we measure total time of this scope and // subtract from the time the WorkGang task took. } Tickspan total_processing = Ticks::now() - start_processing;
*** 3887,3897 **** Ticks start_processing = Ticks::now(); { G1MarkScope code_mark_scope; G1EvacuateOptionalRegionsTask task(per_thread_states, _task_queues, workers()->active_workers()); ! task_time = run_task(&task); // See comment in evacuate_collection_set() for the reason of the scope. } Tickspan total_processing = Ticks::now() - start_processing; G1GCPhaseTimes* p = phase_times(); --- 3892,3902 ---- Ticks start_processing = Ticks::now(); { G1MarkScope code_mark_scope; G1EvacuateOptionalRegionsTask task(per_thread_states, _task_queues, workers()->active_workers()); ! task_time = run_task_timed(&task); // See comment in evacuate_collection_set() for the reason of the scope. } Tickspan total_processing = Ticks::now() - start_processing; G1GCPhaseTimes* p = phase_times();
*** 4914,4918 **** --- 4919,4947 ---- } GrowableArray<MemoryPool*> G1CollectedHeap::memory_pools() { return _g1mm->memory_pools(); } + + class G1ParallelObjectIterator : public ParallelObjectIterator { + private: + G1CollectedHeap* _heap; + HeapRegionClaimer _claimer; + + public: + G1ParallelObjectIterator(uint thread_num) : + _heap(G1CollectedHeap::heap()), + _claimer(thread_num == 0 ? G1CollectedHeap::heap()->workers()->active_workers() : thread_num) {} + + virtual void object_iterate(ObjectClosure* cl, uint worker_id) { + _heap->object_iterate_parallel(cl, worker_id, &_claimer); + } + }; + + ParallelObjectIterator* G1CollectedHeap::parallel_object_iterator(uint thread_num) { + return new G1ParallelObjectIterator(thread_num); + } + + void G1CollectedHeap::object_iterate_parallel(ObjectClosure* cl, uint worker_id, HeapRegionClaimer* claimer) { + IterateObjectClosureRegionClosure blk(cl); + heap_region_par_iterate_from_worker_offset(&blk, claimer, worker_id); + }
< prev index next >