177 if (matrix->is_connected(from_idx, to_idx)) {
178 num_incoming++;
179 }
180 }
181 if (num_incoming < ShenandoahPartialInboundThreshold) {
182 collection_set->add_region(region);
183 _heap->set_region_in_collection_set(to_idx, true);
184 }
185 }
186 // Second pass: find all root regions.
187 uint num_cset = collection_set->count();
188 for (uint idx = 0; idx < num_cset; idx++) {
189 ShenandoahHeapRegion* region = collection_set->get(idx);
190 uint to_idx = region->region_number();
191 assert(! region->is_humongous() && ! region->is_empty() && ! region->is_pinned(), "sanity");
192 assert(_heap->region_in_collection_set(to_idx), "more sanity");
193 for (uint from_idx = 0; from_idx < num_regions; from_idx++) {
194 if (matrix->is_connected(from_idx, to_idx)) {
195 ShenandoahHeapRegion* r = regions->get(from_idx);
196 if (! r->is_root() && ! _heap->region_in_collection_set(from_idx)) {
197 // TODO: Implement support for humongous roots:
198 // - quick impl: rewind to the head of the humongous object and use that
199 // - better impl: support scanning of humongous continuation regions
200 // and potentially avoid scanning the whole obj
201 guarantee(! r->is_humongous_continuation(), "unimplemented");
202 _root_regions->add_region(r);
203 r->set_root(true);
204 }
205 }
206 }
207 }
208 // Final pass: free regions.
209 for (uint to_idx = 0; to_idx < num_regions; to_idx++) {
210 ShenandoahHeapRegion* region = regions->get(to_idx);
211 if (! region->is_humongous() &&
212 ! region->is_pinned() &&
213 ! region->is_root() &&
214 ! _heap->in_collection_set(region)) {
215
216 free_set->add_region(region);
217 }
218 }
219 log_debug(gc, ergo)("got "SIZE_FORMAT" cset regions", collection_set->count());
220 log_debug(gc, ergo)("got "SIZE_FORMAT" root regions", _root_regions->count());
221 }
|
177 if (matrix->is_connected(from_idx, to_idx)) {
178 num_incoming++;
179 }
180 }
181 if (num_incoming < ShenandoahPartialInboundThreshold) {
182 collection_set->add_region(region);
183 _heap->set_region_in_collection_set(to_idx, true);
184 }
185 }
186 // Second pass: find all root regions.
187 uint num_cset = collection_set->count();
188 for (uint idx = 0; idx < num_cset; idx++) {
189 ShenandoahHeapRegion* region = collection_set->get(idx);
190 uint to_idx = region->region_number();
191 assert(! region->is_humongous() && ! region->is_empty() && ! region->is_pinned(), "sanity");
192 assert(_heap->region_in_collection_set(to_idx), "more sanity");
193 for (uint from_idx = 0; from_idx < num_regions; from_idx++) {
194 if (matrix->is_connected(from_idx, to_idx)) {
195 ShenandoahHeapRegion* r = regions->get(from_idx);
196 if (! r->is_root() && ! _heap->region_in_collection_set(from_idx)) {
197 _root_regions->add_region(r);
198 r->set_root(true);
199 }
200 }
201 }
202 }
203 // Final pass: free regions.
204 for (uint to_idx = 0; to_idx < num_regions; to_idx++) {
205 ShenandoahHeapRegion* region = regions->get(to_idx);
206 if (! region->is_humongous() &&
207 ! region->is_pinned() &&
208 ! region->is_root() &&
209 ! _heap->in_collection_set(region)) {
210
211 free_set->add_region(region);
212 }
213 }
214 log_debug(gc, ergo)("got "SIZE_FORMAT" cset regions", collection_set->count());
215 log_debug(gc, ergo)("got "SIZE_FORMAT" root regions", _root_regions->count());
216 }
|