< prev index next >
src/share/vm/gc/shenandoah/shenandoahHeapRegion.cpp
Print this page
rev 13079 : Add humongous regions support to partial GC.
*** 47,56 ****
--- 47,57 ----
_region_number(index),
_live_data(0),
reserved(MemRegion(start, regionSizeWords)),
_humongous_start(false),
_humongous_continuation(false),
+ _humongous_obj_array(false),
_recycled(true),
_root(false),
_new_top(NULL),
_critical_pins(0) {
*** 213,231 ****
--- 214,259 ----
return NULL; // all done
}
void ShenandoahHeapRegion::oop_iterate(ExtendedOopClosure* blk) {
if (is_empty()) return;
+ if (is_humongous_obj_array()) {
+ oop_iterate_humongous(blk);
+ } else {
+ oop_iterate_objects(blk);
+ }
+ }
+
+ void ShenandoahHeapRegion::oop_iterate_objects(ExtendedOopClosure* blk) {
+ assert(! is_humongous_obj_array(), "no humongous obj array here");
+ assert(! is_humongous_continuation(), "no humongous continuation here");
+ // Note: it is ok to have a humongous start region here, e.g. in the case
+ // of an int[]. We might want to visit its header.
HeapWord* obj_addr = bottom() + BrooksPointer::word_size();
HeapWord* t = top();
// Could call objects iterate, but this is easier.
while (obj_addr < t) {
oop obj = oop(obj_addr);
obj_addr += obj->oop_iterate_size(blk) + BrooksPointer::word_size();
}
}
+ void ShenandoahHeapRegion::oop_iterate_humongous(ExtendedOopClosure* blk) {
+ assert(is_humongous_obj_array(), "only humongous obj array here");
+ // Find head.
+ ShenandoahHeapRegionSet* regions = _heap->regions();
+ uint idx = region_number();
+ ShenandoahHeapRegion* r = regions->get(idx);
+ while (! r->is_humongous_start()) {
+ idx--;
+ r = regions->get(idx);
+ }
+ assert(r->is_humongous_start(), "need humongous head here");
+ objArrayOop array = objArrayOop(r->bottom() + BrooksPointer::word_size());
+ array->oop_iterate(blk, MemRegion(bottom(), top()));
+ }
+
void ShenandoahHeapRegion::fill_region() {
ShenandoahHeap* sh = (ShenandoahHeap*) Universe::heap();
if (free() > (BrooksPointer::word_size() + CollectedHeap::min_fill_size())) {
HeapWord* filler = allocate(BrooksPointer::word_size());
*** 241,250 ****
--- 269,282 ----
void ShenandoahHeapRegion::set_humongous_continuation(bool continuation) {
_humongous_continuation = continuation;
}
+ void ShenandoahHeapRegion::set_humongous_obj_array(bool obj_array) {
+ _humongous_obj_array = obj_array;
+ }
+
bool ShenandoahHeapRegion::is_humongous() const {
return _humongous_start || _humongous_continuation;
}
bool ShenandoahHeapRegion::is_humongous_start() const {
*** 253,267 ****
--- 285,304 ----
bool ShenandoahHeapRegion::is_humongous_continuation() const {
return _humongous_continuation;
}
+ bool ShenandoahHeapRegion::is_humongous_obj_array() const {
+ return _humongous_continuation;
+ }
+
void ShenandoahHeapRegion::recycle() {
ContiguousSpace::initialize(reserved, true, false);
clear_live_data();
_humongous_start = false;
_humongous_continuation = false;
+ _humongous_obj_array = false;
_recycled = true;
_root = false;
set_in_collection_set(false);
// Reset C-TAMS pointer to ensure size-based iteration, everything
// in that regions is going to be new objects.
< prev index next >