< prev index next >
src/share/vm/gc_implementation/shenandoah/shenandoahMarkingContext.cpp
Print this page
rev 10658 : [backport] Single marking bitmap
rev 10660 : [backport] Refactor bitmap cleaning
rev 10772 : [backport] Update copyrights
*** 1,7 ****
/*
! * Copyright (c) 2018, Red Hat, Inc. and/or its affiliates.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
--- 1,7 ----
/*
! * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
*** 27,36 ****
--- 27,37 ----
#include "gc_implementation/shenandoah/shenandoahHeap.inline.hpp"
#include "gc_implementation/shenandoah/shenandoahHeapRegion.inline.hpp"
#include "gc_implementation/shenandoah/shenandoahMarkingContext.hpp"
ShenandoahMarkingContext::ShenandoahMarkingContext(MemRegion heap_region, MemRegion bitmap_region, size_t num_regions) :
+ _top_bitmaps(NEW_C_HEAP_ARRAY(HeapWord*, num_regions, mtGC)),
_top_at_mark_starts_base(NEW_C_HEAP_ARRAY(HeapWord*, num_regions, mtGC)),
_top_at_mark_starts(_top_at_mark_starts_base -
((uintx) heap_region.start() >> ShenandoahHeapRegion::region_size_bytes_shift())) {
_mark_bit_map.initialize(heap_region, bitmap_region);
}
*** 49,64 ****
bool ShenandoahMarkingContext::is_bitmap_clear_range(HeapWord* start, HeapWord* end) const {
return _mark_bit_map.getNextMarkedWordAddress(start, end) == end;
}
! void ShenandoahMarkingContext::set_top_at_mark_start(size_t region_number, HeapWord* addr) {
! _top_at_mark_starts_base[region_number] = addr;
}
! HeapWord* ShenandoahMarkingContext::top_at_mark_start(size_t region_number) const {
! return _top_at_mark_starts_base[region_number];
}
! void ShenandoahMarkingContext::clear_bitmap(HeapWord* start, HeapWord* end) {
! _mark_bit_map.clear_range_large(MemRegion(start, end));
}
--- 50,113 ----
bool ShenandoahMarkingContext::is_bitmap_clear_range(HeapWord* start, HeapWord* end) const {
return _mark_bit_map.getNextMarkedWordAddress(start, end) == end;
}
! void ShenandoahMarkingContext::initialize_top_at_mark_start(ShenandoahHeapRegion* r) {
! size_t idx = r->region_number();
! HeapWord *bottom = r->bottom();
! _top_at_mark_starts_base[idx] = bottom;
! _top_bitmaps[idx] = bottom;
}
! void ShenandoahMarkingContext::capture_top_at_mark_start(ShenandoahHeapRegion *r) {
! size_t region_number = r->region_number();
! HeapWord* old_tams = _top_at_mark_starts_base[region_number];
! HeapWord* new_tams = r->top();
!
! assert(new_tams >= old_tams,
! err_msg("Region " SIZE_FORMAT", TAMS updates should be monotonic: " PTR_FORMAT " -> " PTR_FORMAT,
! region_number, p2i(old_tams), p2i(new_tams)));
! assert(is_bitmap_clear_range(old_tams, new_tams),
! err_msg("Region " SIZE_FORMAT ", bitmap should be clear while adjusting TAMS: " PTR_FORMAT " -> " PTR_FORMAT,
! region_number, p2i(old_tams), p2i(new_tams)));
!
! _top_at_mark_starts_base[region_number] = new_tams;
! _top_bitmaps[region_number] = new_tams;
! }
!
! void ShenandoahMarkingContext::reset_top_at_mark_start(ShenandoahHeapRegion* r) {
! _top_at_mark_starts_base[r->region_number()] = r->bottom();
! }
!
! HeapWord* ShenandoahMarkingContext::top_at_mark_start(ShenandoahHeapRegion* r) const {
! return _top_at_mark_starts_base[r->region_number()];
! }
!
! void ShenandoahMarkingContext::reset_top_bitmap(ShenandoahHeapRegion* r) {
! assert(is_bitmap_clear_range(r->bottom(), r->end()),
! err_msg("Region " SIZE_FORMAT " should have no marks in bitmap", r->region_number()));
! _top_bitmaps[r->region_number()] = r->bottom();
! }
!
! void ShenandoahMarkingContext::clear_bitmap(ShenandoahHeapRegion* r) {
! HeapWord* bottom = r->bottom();
! HeapWord* top_bitmap = _top_bitmaps[r->region_number()];
! if (top_bitmap > bottom) {
! _mark_bit_map.clear_range_large(MemRegion(bottom, top_bitmap));
! _top_bitmaps[r->region_number()] = bottom;
! }
! assert(is_bitmap_clear_range(bottom, r->end()),
! err_msg("Region " SIZE_FORMAT " should have no marks in bitmap", r->region_number()));
! }
!
! bool ShenandoahMarkingContext::is_complete() {
! return _is_complete.is_set();
! }
!
! void ShenandoahMarkingContext::mark_complete() {
! _is_complete.set();
}
! void ShenandoahMarkingContext::mark_incomplete() {
! _is_complete.unset();
}
< prev index next >