< prev index next >
src/share/vm/gc_implementation/shenandoah/shenandoahCollectionSet.cpp
Print this page
rev 10542 : [backport] Constify ShHeapRegionSet and ShCollectionSet
rev 10543 : [backport] Application pacing precision fixes
rev 10598 : [backport] Shenandoah changes to allow enabling -Wreorder
*** 30,48 ****
#include "gc_implementation/shenandoah/shenandoahHeapRegionSet.hpp"
#include "runtime/atomic.hpp"
#include "utilities/copy.hpp"
ShenandoahCollectionSet::ShenandoahCollectionSet(ShenandoahHeap* heap, HeapWord* heap_base) :
! _garbage(0), _live_data(0), _heap(heap), _region_count(0),
! _map_size(heap->num_regions()), _current_index(0) {
// Use 1-byte data type
STATIC_ASSERT(sizeof(jbyte) == 1);
- _cset_map = NEW_C_HEAP_ARRAY(jbyte, _map_size, mtGC);
- // Bias cset map's base address for fast test if an oop is in cset
- _biased_cset_map = _cset_map - ((uintx)heap_base >> ShenandoahHeapRegion::region_size_bytes_shift());
-
// Initialize cset map
Copy::zero_to_bytes(_cset_map, _map_size);
}
void ShenandoahCollectionSet::add_region(ShenandoahHeapRegion* r) {
--- 30,52 ----
#include "gc_implementation/shenandoah/shenandoahHeapRegionSet.hpp"
#include "runtime/atomic.hpp"
#include "utilities/copy.hpp"
ShenandoahCollectionSet::ShenandoahCollectionSet(ShenandoahHeap* heap, HeapWord* heap_base) :
! _map_size(heap->num_regions()),
! _region_size_bytes_shift(ShenandoahHeapRegion::region_size_bytes_shift()),
! _cset_map(NEW_C_HEAP_ARRAY(jbyte, _map_size, mtGC)),
! _biased_cset_map(_cset_map - ((uintx)heap_base >> _region_size_bytes_shift)),
! _heap(heap),
! _garbage(0),
! _live_data(0),
! _used(0),
! _region_count(0),
! _current_index(0) {
// Use 1-byte data type
STATIC_ASSERT(sizeof(jbyte) == 1);
// Initialize cset map
Copy::zero_to_bytes(_cset_map, _map_size);
}
void ShenandoahCollectionSet::add_region(ShenandoahHeapRegion* r) {
*** 51,60 ****
--- 55,65 ----
assert(!is_in(r), "Already in collection set");
_cset_map[r->region_number()] = 1;
_region_count ++;
_garbage += r->garbage();
_live_data += r->get_live_data_bytes();
+ _used += r->used();
}
void ShenandoahCollectionSet::remove_region(ShenandoahHeapRegion* r) {
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at a safepoint");
assert(Thread::current()->is_VM_thread(), "Must be VMThread");
*** 84,93 ****
--- 89,99 ----
}
#endif
_garbage = 0;
_live_data = 0;
+ _used = 0;
_region_count = 0;
_current_index = 0;
}
< prev index next >