< prev index next >
src/share/vm/memory/generation.cpp
Print this page
rev 7420 : [mq]: removeOneContigSpaceGeneration
@@ -34,11 +34,10 @@
#include "memory/genCollectedHeap.hpp"
#include "memory/genMarkSweep.hpp"
#include "memory/genOopClosures.hpp"
#include "memory/genOopClosures.inline.hpp"
#include "memory/generation.hpp"
-#include "memory/generation.inline.hpp"
#include "memory/space.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/java.hpp"
#include "utilities/copy.hpp"
#include "utilities/events.hpp"
@@ -608,254 +607,5 @@
}
// Currently nothing to do.
void CardGeneration::prepare_for_verify() {}
-
-void OneContigSpaceCardGeneration::collect(bool full,
- bool clear_all_soft_refs,
- size_t size,
- bool is_tlab) {
- GenCollectedHeap* gch = GenCollectedHeap::heap();
-
- SpecializationStats::clear();
- // Temporarily expand the span of our ref processor, so
- // refs discovery is over the entire heap, not just this generation
- ReferenceProcessorSpanMutator
- x(ref_processor(), gch->reserved_region());
-
- STWGCTimer* gc_timer = GenMarkSweep::gc_timer();
- gc_timer->register_gc_start();
-
- SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer();
- gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
-
- GenMarkSweep::invoke_at_safepoint(_level, ref_processor(), clear_all_soft_refs);
-
- gc_timer->register_gc_end();
-
- gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
-
- SpecializationStats::print();
-}
-
-HeapWord*
-OneContigSpaceCardGeneration::expand_and_allocate(size_t word_size,
- bool is_tlab,
- bool parallel) {
- assert(!is_tlab, "OneContigSpaceCardGeneration does not support TLAB allocation");
- if (parallel) {
- MutexLocker x(ParGCRareEvent_lock);
- HeapWord* result = NULL;
- size_t byte_size = word_size * HeapWordSize;
- while (true) {
- expand(byte_size, _min_heap_delta_bytes);
- if (GCExpandToAllocateDelayMillis > 0) {
- os::sleep(Thread::current(), GCExpandToAllocateDelayMillis, false);
- }
- result = _the_space->par_allocate(word_size);
- if ( result != NULL) {
- return result;
- } else {
- // If there's not enough expansion space available, give up.
- if (_virtual_space.uncommitted_size() < byte_size) {
- return NULL;
- }
- // else try again
- }
- }
- } else {
- expand(word_size*HeapWordSize, _min_heap_delta_bytes);
- return _the_space->allocate(word_size);
- }
-}
-
-bool OneContigSpaceCardGeneration::expand(size_t bytes, size_t expand_bytes) {
- GCMutexLocker x(ExpandHeap_lock);
- return CardGeneration::expand(bytes, expand_bytes);
-}
-
-
-void OneContigSpaceCardGeneration::shrink(size_t bytes) {
- assert_locked_or_safepoint(ExpandHeap_lock);
- size_t size = ReservedSpace::page_align_size_down(bytes);
- if (size > 0) {
- shrink_by(size);
- }
-}
-
-
-size_t OneContigSpaceCardGeneration::capacity() const {
- return _the_space->capacity();
-}
-
-
-size_t OneContigSpaceCardGeneration::used() const {
- return _the_space->used();
-}
-
-
-size_t OneContigSpaceCardGeneration::free() const {
- return _the_space->free();
-}
-
-MemRegion OneContigSpaceCardGeneration::used_region() const {
- return the_space()->used_region();
-}
-
-size_t OneContigSpaceCardGeneration::unsafe_max_alloc_nogc() const {
- return _the_space->free();
-}
-
-size_t OneContigSpaceCardGeneration::contiguous_available() const {
- return _the_space->free() + _virtual_space.uncommitted_size();
-}
-
-bool OneContigSpaceCardGeneration::grow_by(size_t bytes) {
- assert_locked_or_safepoint(ExpandHeap_lock);
- bool result = _virtual_space.expand_by(bytes);
- if (result) {
- size_t new_word_size =
- heap_word_size(_virtual_space.committed_size());
- MemRegion mr(_the_space->bottom(), new_word_size);
- // Expand card table
- Universe::heap()->barrier_set()->resize_covered_region(mr);
- // Expand shared block offset array
- _bts->resize(new_word_size);
-
- // Fix for bug #4668531
- if (ZapUnusedHeapArea) {
- MemRegion mangle_region(_the_space->end(),
- (HeapWord*)_virtual_space.high());
- SpaceMangler::mangle_region(mangle_region);
- }
-
- // Expand space -- also expands space's BOT
- // (which uses (part of) shared array above)
- _the_space->set_end((HeapWord*)_virtual_space.high());
-
- // update the space and generation capacity counters
- update_counters();
-
- if (Verbose && PrintGC) {
- size_t new_mem_size = _virtual_space.committed_size();
- size_t old_mem_size = new_mem_size - bytes;
- gclog_or_tty->print_cr("Expanding %s from " SIZE_FORMAT "K by "
- SIZE_FORMAT "K to " SIZE_FORMAT "K",
- name(), old_mem_size/K, bytes/K, new_mem_size/K);
- }
- }
- return result;
-}
-
-
-bool OneContigSpaceCardGeneration::grow_to_reserved() {
- assert_locked_or_safepoint(ExpandHeap_lock);
- bool success = true;
- const size_t remaining_bytes = _virtual_space.uncommitted_size();
- if (remaining_bytes > 0) {
- success = grow_by(remaining_bytes);
- DEBUG_ONLY(if (!success) warning("grow to reserved failed");)
- }
- return success;
-}
-
-void OneContigSpaceCardGeneration::shrink_by(size_t bytes) {
- assert_locked_or_safepoint(ExpandHeap_lock);
- // Shrink committed space
- _virtual_space.shrink_by(bytes);
- // Shrink space; this also shrinks the space's BOT
- _the_space->set_end((HeapWord*) _virtual_space.high());
- size_t new_word_size = heap_word_size(_the_space->capacity());
- // Shrink the shared block offset array
- _bts->resize(new_word_size);
- MemRegion mr(_the_space->bottom(), new_word_size);
- // Shrink the card table
- Universe::heap()->barrier_set()->resize_covered_region(mr);
-
- if (Verbose && PrintGC) {
- size_t new_mem_size = _virtual_space.committed_size();
- size_t old_mem_size = new_mem_size + bytes;
- gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K",
- name(), old_mem_size/K, new_mem_size/K);
- }
-}
-
-// Currently nothing to do.
-void OneContigSpaceCardGeneration::prepare_for_verify() {}
-
-
-// Override for a card-table generation with one contiguous
-// space. NOTE: For reasons that are lost in the fog of history,
-// this code is used when you iterate over perm gen objects,
-// even when one uses CDS, where the perm gen has a couple of
-// other spaces; this is because CompactingPermGenGen derives
-// from OneContigSpaceCardGeneration. This should be cleaned up,
-// see CR 6897789..
-void OneContigSpaceCardGeneration::object_iterate(ObjectClosure* blk) {
- _the_space->object_iterate(blk);
-}
-
-void OneContigSpaceCardGeneration::space_iterate(SpaceClosure* blk,
- bool usedOnly) {
- blk->do_space(_the_space);
-}
-
-void OneContigSpaceCardGeneration::younger_refs_iterate(OopsInGenClosure* blk) {
- blk->set_generation(this);
- younger_refs_in_space_iterate(_the_space, blk);
- blk->reset_generation();
-}
-
-void OneContigSpaceCardGeneration::save_marks() {
- _the_space->set_saved_mark();
-}
-
-
-void OneContigSpaceCardGeneration::reset_saved_marks() {
- _the_space->reset_saved_mark();
-}
-
-
-bool OneContigSpaceCardGeneration::no_allocs_since_save_marks() {
- return _the_space->saved_mark_at_top();
-}
-
-#define OneContig_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix) \
- \
-void OneContigSpaceCardGeneration:: \
-oop_since_save_marks_iterate##nv_suffix(OopClosureType* blk) { \
- blk->set_generation(this); \
- _the_space->oop_since_save_marks_iterate##nv_suffix(blk); \
- blk->reset_generation(); \
- save_marks(); \
-}
-
-ALL_SINCE_SAVE_MARKS_CLOSURES(OneContig_SINCE_SAVE_MARKS_ITERATE_DEFN)
-
-#undef OneContig_SINCE_SAVE_MARKS_ITERATE_DEFN
-
-
-void OneContigSpaceCardGeneration::gc_epilogue(bool full) {
- _last_gc = WaterMark(the_space(), the_space()->top());
-
- // update the generation and space performance counters
- update_counters();
- if (ZapUnusedHeapArea) {
- the_space()->check_mangled_unused_area_complete();
- }
-}
-
-void OneContigSpaceCardGeneration::record_spaces_top() {
- assert(ZapUnusedHeapArea, "Not mangling unused space");
- the_space()->set_top_for_allocations();
-}
-
-void OneContigSpaceCardGeneration::verify() {
- the_space()->verify();
-}
-
-void OneContigSpaceCardGeneration::print_on(outputStream* st) const {
- Generation::print_on(st);
- st->print(" the");
- the_space()->print_on(st);
-}
< prev index next >