|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
78 | 78 | #include "logging/log.hpp"
|
79 | 79 | #include "memory/allocation.hpp"
|
80 | 80 | #include "memory/iterator.hpp"
|
| 81 | +#include "memory/heapInspection.hpp" |
81 | 82 | #include "memory/metaspaceShared.hpp"
|
82 | 83 | #include "memory/resourceArea.hpp"
|
83 | 84 | #include "oops/access.inline.hpp"
|
@@ -152,6 +153,9 @@ void G1RegionMappingChangedListener::on_commit(uint start_idx, size_t num_region
|
152 | 153 | reset_from_card_cache(start_idx, num_regions);
|
153 | 154 | }
|
154 | 155 |
|
| 156 | +void G1CollectedHeap::run_task(AbstractGangTask* task) { |
| 157 | + workers()->run_task(task, workers()->active_workers()); |
| 158 | +} |
155 | 159 |
|
156 | 160 | HeapRegion* G1CollectedHeap::new_heap_region(uint hrs_index,
|
157 | 161 | MemRegion mr) {
|
@@ -2120,6 +2124,30 @@ void G1CollectedHeap::object_iterate(ObjectClosure* cl) {
|
2120 | 2124 | heap_region_iterate(&blk);
|
2121 | 2125 | }
|
2122 | 2126 |
|
| 2127 | +class G1ParallelObjectIterator : public ParallelObjectIterator { |
| 2128 | +private: |
| 2129 | + G1CollectedHeap* _heap; |
| 2130 | + HeapRegionClaimer _claimer; |
| 2131 | + |
| 2132 | +public: |
| 2133 | + G1ParallelObjectIterator(uint thread_num) : |
| 2134 | + _heap(G1CollectedHeap::heap()), |
| 2135 | + _claimer(thread_num == 0 ? G1CollectedHeap::heap()->workers()->active_workers() : thread_num) {} |
| 2136 | + |
| 2137 | + virtual void object_iterate(ObjectClosure* cl, uint worker_id) { |
| 2138 | + _heap->object_iterate_parallel(cl, worker_id, &_claimer); |
| 2139 | + } |
| 2140 | +}; |
| 2141 | + |
| 2142 | +ParallelObjectIterator* G1CollectedHeap::parallel_object_iterator(uint thread_num) { |
| 2143 | + return new G1ParallelObjectIterator(thread_num); |
| 2144 | +} |
| 2145 | + |
| 2146 | +void G1CollectedHeap::object_iterate_parallel(ObjectClosure* cl, uint worker_id, HeapRegionClaimer* claimer) { |
| 2147 | + IterateObjectClosureRegionClosure blk(cl); |
| 2148 | + heap_region_par_iterate_from_worker_offset(&blk, claimer, worker_id); |
| 2149 | +} |
| 2150 | + |
2123 | 2151 | void G1CollectedHeap::keep_alive(oop obj) {
|
2124 | 2152 | G1BarrierSet::enqueue(obj);
|
2125 | 2153 | }
|
|
0 commit comments