< prev index next >
src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp
Print this page
rev 51547 : Refactor to group marking bitmap and TAMS structure in one class ShenandoahMarkingContext
rev 51548 : [mq]: refactor-marking-context.01
*** 39,48 ****
--- 39,49 ----
#include "gc/shenandoah/shenandoahHeapRegionSet.hpp"
#include "gc/shenandoah/shenandoahHeap.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp"
#include "gc/shenandoah/shenandoahHeuristics.hpp"
+ #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
#include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
#include "gc/shenandoah/shenandoahTraversalGC.hpp"
#include "gc/shenandoah/shenandoahRootProcessor.hpp"
#include "gc/shenandoah/shenandoahStringDedup.hpp"
#include "gc/shenandoah/shenandoahTaskqueue.hpp"
*** 110,120 ****
void do_buffer(void** buffer, size_t size) {
for (size_t i = 0; i < size; ++i) {
oop* p = (oop*) &buffer[i];
oop obj = RawAccess<>::oop_load(p);
shenandoah_assert_not_forwarded(p, obj);
! if (_heap->mark_next(obj)) {
_queue->push(ShenandoahMarkTask(obj));
}
}
}
};
--- 111,121 ----
void do_buffer(void** buffer, size_t size) {
for (size_t i = 0; i < size; ++i) {
oop* p = (oop*) &buffer[i];
oop obj = RawAccess<>::oop_load(p);
shenandoah_assert_not_forwarded(p, obj);
! if (_heap->next_marking_context()->mark(obj)) {
_queue->push(ShenandoahMarkTask(obj));
}
}
}
};
*** 334,354 ****
void ShenandoahTraversalGC::prepare_regions() {
ShenandoahHeap* heap = ShenandoahHeap::heap();
size_t num_regions = heap->num_regions();
ShenandoahConnectionMatrix* matrix = _heap->connection_matrix();
!
for (size_t i = 0; i < num_regions; i++) {
ShenandoahHeapRegion* region = heap->get_region(i);
if (heap->is_bitmap_slice_committed(region)) {
if (_traversal_set.is_in(i)) {
! heap->set_next_top_at_mark_start(region->bottom(), region->top());
region->clear_live_data();
! assert(heap->is_next_bitmap_clear_range(region->bottom(), region->end()), "bitmap for traversal regions must be cleared");
} else {
// Everything outside the traversal set is always considered live.
! heap->set_next_top_at_mark_start(region->bottom(), region->bottom());
}
if (_root_regions.is_in(i)) {
assert(!region->in_collection_set(), "roots must not overlap with cset");
matrix->clear_region_outbound(i);
// Since root region can be allocated at, we should bound the scans
--- 335,355 ----
void ShenandoahTraversalGC::prepare_regions() {
ShenandoahHeap* heap = ShenandoahHeap::heap();
size_t num_regions = heap->num_regions();
ShenandoahConnectionMatrix* matrix = _heap->connection_matrix();
! ShenandoahMarkingContext* const ctx = _heap->next_marking_context();
for (size_t i = 0; i < num_regions; i++) {
ShenandoahHeapRegion* region = heap->get_region(i);
if (heap->is_bitmap_slice_committed(region)) {
if (_traversal_set.is_in(i)) {
! ctx->set_top_at_mark_start(region->region_number(), region->top());
region->clear_live_data();
! assert(ctx->is_bitmap_clear_range(region->bottom(), region->end()), "bitmap for traversal regions must be cleared");
} else {
// Everything outside the traversal set is always considered live.
! ctx->set_top_at_mark_start(region->region_number(), region->bottom());
}
if (_root_regions.is_in(i)) {
assert(!region->in_collection_set(), "roots must not overlap with cset");
matrix->clear_region_outbound(i);
// Since root region can be allocated at, we should bound the scans
*** 365,375 ****
_heap->collection_set()->clear();
assert(_heap->collection_set()->count() == 0, "collection set not clear");
_heap->make_parsable(true);
! assert(_heap->is_next_bitmap_clear(), "need clean mark bitmap");
ShenandoahFreeSet* free_set = _heap->free_set();
ShenandoahCollectionSet* collection_set = _heap->collection_set();
// Find collection set
--- 366,376 ----
_heap->collection_set()->clear();
assert(_heap->collection_set()->count() == 0, "collection set not clear");
_heap->make_parsable(true);
! assert(_heap->next_marking_context()->is_bitmap_clear(), "need clean mark bitmap");
ShenandoahFreeSet* free_set = _heap->free_set();
ShenandoahCollectionSet* collection_set = _heap->collection_set();
// Find collection set
*** 708,727 ****
// Clear immediate garbage regions.
size_t num_regions = _heap->num_regions();
ShenandoahHeapRegionSet* traversal_regions = traversal_set();
ShenandoahFreeSet* free_regions = _heap->free_set();
free_regions->clear();
for (size_t i = 0; i < num_regions; i++) {
ShenandoahHeapRegion* r = _heap->get_region(i);
! bool not_allocated = _heap->next_top_at_mark_start(r->bottom()) == r->top();
bool candidate = traversal_regions->is_in(r) && !r->has_live() && not_allocated;
if (r->is_humongous_start() && candidate) {
// Trash humongous.
HeapWord* humongous_obj = r->bottom() + BrooksPointer::word_size();
! assert(!_heap->is_marked_next(oop(humongous_obj)), "must not be marked");
r->make_trash();
while (i + 1 < num_regions && _heap->get_region(i + 1)->is_humongous_continuation()) {
i++;
r = _heap->get_region(i);
assert(r->is_humongous_continuation(), "must be humongous continuation");
--- 709,729 ----
// Clear immediate garbage regions.
size_t num_regions = _heap->num_regions();
ShenandoahHeapRegionSet* traversal_regions = traversal_set();
ShenandoahFreeSet* free_regions = _heap->free_set();
+ ShenandoahMarkingContext* const ctx = _heap->next_marking_context();
free_regions->clear();
for (size_t i = 0; i < num_regions; i++) {
ShenandoahHeapRegion* r = _heap->get_region(i);
! bool not_allocated = ctx->top_at_mark_start(r->region_number()) == r->top();
bool candidate = traversal_regions->is_in(r) && !r->has_live() && not_allocated;
if (r->is_humongous_start() && candidate) {
// Trash humongous.
HeapWord* humongous_obj = r->bottom() + BrooksPointer::word_size();
! assert(!ctx->is_marked(oop(humongous_obj)), "must not be marked");
r->make_trash();
while (i + 1 < num_regions && _heap->get_region(i + 1)->is_humongous_continuation()) {
i++;
r = _heap->get_region(i);
assert(r->is_humongous_continuation(), "must be humongous continuation");
< prev index next >