< prev index next >

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

Print this page

        

*** 85,94 **** --- 85,95 ---- #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"
*** 5011,5015 **** --- 5012,5053 ---- } GrowableArray<MemoryPool*> G1CollectedHeap::memory_pools() { return _g1mm->memory_pools(); } + + class G1ParHeapInspectTask: public ParHeapInspectTask { + private: + HeapRegionClaimer _claimer; + public: + G1ParHeapInspectTask(G1CollectedHeap* heap, KlassInfoTable* shared_cit, + BoolObjectClosure* filter, size_t* shared_missed_count, + size_t thread_num) : + ParHeapInspectTask(heap, shared_cit, filter, shared_missed_count, thread_num), + _claimer(thread_num == 0 ? heap->workers()->active_workers() : thread_num) { } + void do_object_iterate_parallel(ObjectClosure* cl, uint worker_id) { + ((G1CollectedHeap*)getHeap())->object_iterate_parallel(cl, worker_id, &_claimer); + } + }; + + bool G1CollectedHeap::run_par_heap_inspect_task(KlassInfoTable* cit, + BoolObjectClosure* filter, + size_t* missed_count, size_t thread_num) { + G1ParHeapInspectTask task(this, cit, filter, missed_count, thread_num); + return object_iterate_try_parallel(&task, thread_num) && task.is_success(); + } + + 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); + } + + bool G1CollectedHeap::object_iterate_try_parallel(AbstractGangTask* task, size_t par_thread_num) { + if (task == NULL) { + return false; + } + par_thread_num = MIN2((uint)par_thread_num, workers()->total_workers()); + workers()->run_task(task, par_thread_num); + return true; + } + +
< prev index next >