< prev index next >
src/hotspot/share/gc/g1/heapRegion.cpp
Print this page
rev 56811 : imported patch 8189737-heapregion-remove-space-inheritance
*** 33,53 ****
#include "gc/g1/heapRegionBounds.inline.hpp"
#include "gc/g1/heapRegionManager.inline.hpp"
#include "gc/g1/heapRegionRemSet.hpp"
#include "gc/g1/heapRegionTracer.hpp"
#include "gc/shared/genOopClosures.inline.hpp"
- #include "gc/shared/space.inline.hpp"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
#include "memory/iterator.inline.hpp"
#include "memory/resourceArea.hpp"
#include "oops/access.inline.hpp"
#include "oops/compressedOops.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/atomic.hpp"
#include "runtime/orderAccess.hpp"
- #include "utilities/growableArray.hpp"
int HeapRegion::LogOfHRGrainBytes = 0;
int HeapRegion::LogOfHRGrainWords = 0;
int HeapRegion::LogCardsPerRegion = 0;
size_t HeapRegion::GrainBytes = 0;
--- 33,51 ----
*** 232,242 ****
}
HeapRegion::HeapRegion(uint hrm_index,
G1BlockOffsetTable* bot,
MemRegion mr) :
! G1ContiguousSpace(bot),
_rem_set(NULL),
_hrm_index(hrm_index),
_type(),
_humongous_start_region(NULL),
_evacuation_failed(false),
--- 230,246 ----
}
HeapRegion::HeapRegion(uint hrm_index,
G1BlockOffsetTable* bot,
MemRegion mr) :
! _bottom(NULL),
! _end(NULL),
! _top(NULL),
! _compaction_top(NULL),
! _bot_part(bot, this),
! _par_alloc_lock(Mutex::leaf, "HeapRegion par alloc lock", true),
! _pre_dummy_top(NULL),
_rem_set(NULL),
_hrm_index(hrm_index),
_type(),
_humongous_start_region(NULL),
_evacuation_failed(false),
*** 256,269 ****
}
void HeapRegion::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
assert(_rem_set->is_empty(), "Remembered set must be empty");
! G1ContiguousSpace::initialize(mr, clear_space, mangle_space);
- hr_clear(false /*par*/, false /*clear_space*/);
set_top(bottom());
}
void HeapRegion::report_region_type_change(G1HeapRegionTraceType::Type to) {
HeapRegionTracer::send_region_type_change(_hrm_index,
get_trace_type(),
--- 260,283 ----
}
void HeapRegion::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
assert(_rem_set->is_empty(), "Remembered set must be empty");
! assert(Universe::on_page_boundary(mr.start()) && Universe::on_page_boundary(mr.end()),
! "invalid space boundaries");
!
! set_bottom(mr.start());
! set_end(mr.end());
! if (clear_space) {
! clear(mangle_space);
! }
set_top(bottom());
+ set_compaction_top(bottom());
+ reset_bot();
+
+ hr_clear(false /*par*/, false /*clear_space*/);
}
void HeapRegion::report_region_type_change(G1HeapRegionTraceType::Type to) {
HeapRegionTracer::send_region_type_change(_hrm_index,
get_trace_type(),
*** 442,451 ****
--- 456,466 ----
*failures = true;
}
}
void HeapRegion::print() const { print_on(tty); }
+
void HeapRegion::print_on(outputStream* st) const {
st->print("|%4u", this->_hrm_index);
st->print("|" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT,
p2i(bottom()), p2i(top()), p2i(end()));
st->print("|%3d%%", (int) ((double) used() * 100 / capacity()));
*** 634,646 ****
// This closure provides its own oop verification code.
debug_only(virtual bool should_verify_oops() { return false; })
};
- // This really ought to be commoned up into OffsetTableContigSpace somehow.
- // We would need a mechanism to make that code skip dead objects.
-
void HeapRegion::verify(VerifyOption vo,
bool* failures) const {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
*failures = false;
HeapWord* p = bottom();
--- 649,658 ----
*** 826,898 ****
bool failures = false;
verify_rem_set(VerifyOption_G1UsePrevMarking, &failures);
guarantee(!failures, "HeapRegion RemSet verification failed");
}
! void HeapRegion::prepare_for_compaction(CompactPoint* cp) {
! // Not used for G1 anymore, but pure virtual in Space.
! ShouldNotReachHere();
! }
!
! // G1OffsetTableContigSpace code; copied from space.cpp. Hope this can go
! // away eventually.
!
! void G1ContiguousSpace::clear(bool mangle_space) {
set_top(bottom());
! CompactibleSpace::clear(mangle_space);
reset_bot();
}
- #ifndef PRODUCT
- void G1ContiguousSpace::mangle_unused_area() {
- mangle_unused_area_complete();
- }
! void G1ContiguousSpace::mangle_unused_area_complete() {
SpaceMangler::mangle_region(MemRegion(top(), end()));
}
#endif
! void G1ContiguousSpace::print() const {
! print_short();
! tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", "
! INTPTR_FORMAT ", " INTPTR_FORMAT ")",
! p2i(bottom()), p2i(top()), p2i(_bot_part.threshold()), p2i(end()));
! }
!
! HeapWord* G1ContiguousSpace::initialize_threshold() {
return _bot_part.initialize_threshold();
}
! HeapWord* G1ContiguousSpace::cross_threshold(HeapWord* start,
! HeapWord* end) {
_bot_part.alloc_block(start, end);
return _bot_part.threshold();
}
! void G1ContiguousSpace::safe_object_iterate(ObjectClosure* blk) {
! object_iterate(blk);
! }
!
! void G1ContiguousSpace::object_iterate(ObjectClosure* blk) {
HeapWord* p = bottom();
while (p < top()) {
if (block_is_obj(p)) {
blk->do_object(oop(p));
}
p += block_size(p);
}
}
-
- G1ContiguousSpace::G1ContiguousSpace(G1BlockOffsetTable* bot) :
- _top(NULL),
- _bot_part(bot, this),
- _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true),
- _pre_dummy_top(NULL)
- {
- }
-
- void G1ContiguousSpace::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
- CompactibleSpace::initialize(mr, clear_space, mangle_space);
- _top = bottom();
- set_saved_mark_word(NULL);
- reset_bot();
- }
--- 838,876 ----
bool failures = false;
verify_rem_set(VerifyOption_G1UsePrevMarking, &failures);
guarantee(!failures, "HeapRegion RemSet verification failed");
}
! void HeapRegion::clear(bool mangle_space) {
set_top(bottom());
! set_compaction_top(bottom());
!
! if (ZapUnusedHeapArea && mangle_space) {
! mangle_unused_area();
! }
reset_bot();
}
! #ifndef PRODUCT
! void HeapRegion::mangle_unused_area() {
SpaceMangler::mangle_region(MemRegion(top(), end()));
}
#endif
! HeapWord* HeapRegion::initialize_threshold() {
return _bot_part.initialize_threshold();
}
! HeapWord* HeapRegion::cross_threshold(HeapWord* start, HeapWord* end) {
_bot_part.alloc_block(start, end);
return _bot_part.threshold();
}
! void HeapRegion::object_iterate(ObjectClosure* blk) {
HeapWord* p = bottom();
while (p < top()) {
if (block_is_obj(p)) {
blk->do_object(oop(p));
}
p += block_size(p);
}
}
< prev index next >