void PSYoungGen::print_on(outputStream* st) const { st->print(" %-15s", "PSYoungGen"); if (PrintGCDetails && Verbose) { st->print(" total " SIZE_FORMAT ", used " SIZE_FORMAT, capacity_in_bytes(), used_in_bytes()); } else { st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", capacity_in_bytes()/K, used_in_bytes()/K); } virtual_space()->print_space_boundaries_on(st); st->print(" eden"); eden_space()->print_on(st); st->print(" from"); from_space()->print_on(st); st->print(" to "); to_space()->print_on(st); }
/// grow_pod - This is an implementation of the grow() method which only works /// on POD-like datatypes and is out of line to reduce code duplication. void SmallVectorBase::grow_pod(size_t MinSizeInBytes, size_t TSize) { size_t CurSizeBytes = size_in_bytes(); size_t NewCapacityInBytes = 2 * capacity_in_bytes() + TSize; // Always grow. if (NewCapacityInBytes < MinSizeInBytes) NewCapacityInBytes = MinSizeInBytes; void *NewElts; if (this->isSmall()) { NewElts = malloc(NewCapacityInBytes); // Copy the elements over. No need to run dtors on PODs. memcpy(NewElts, this->BeginX, CurSizeBytes); } else { // If this wasn't grown from the inline copy, grow the allocated space. NewElts = realloc(this->BeginX, NewCapacityInBytes); } this->EndX = (char*)NewElts+CurSizeBytes; this->BeginX = NewElts; this->CapacityX = (char*)this->BeginX + NewCapacityInBytes; }
void PSYoungGen::print_used_change(size_t prev_used) const { gclog_or_tty->print(" [%s:", name()); gclog_or_tty->print(" " SIZE_FORMAT "K" "->" SIZE_FORMAT "K" "(" SIZE_FORMAT "K)", prev_used / K, used_in_bytes() / K, capacity_in_bytes() / K); gclog_or_tty->print("]"); }
void PSOldGen::print_on(outputStream* st) const { st->print(" %-15s", name()); st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", capacity_in_bytes()/K, used_in_bytes()/K); st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")", _virtual_space.low_boundary(), _virtual_space.high(), _virtual_space.high_boundary()); st->print(" object"); object_space()->print_on(st); }
void PSYoungGen::resize(size_t eden_size, size_t survivor_size) { // Resize the generation if needed. If the generation resize // reports false, do not attempt to resize the spaces. if (resize_generation(eden_size, survivor_size)) { // Then we lay out the spaces inside the generation resize_spaces(eden_size, survivor_size); space_invariants(); if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr("Young generation size: " "desired eden: " SIZE_FORMAT " survivor: " SIZE_FORMAT " used: " SIZE_FORMAT " capacity: " SIZE_FORMAT " gen limits: " SIZE_FORMAT " / " SIZE_FORMAT, eden_size, survivor_size, used_in_bytes(), capacity_in_bytes(), _max_gen_size, min_gen_size()); } } }
size_t MutableNUMASpace::tlab_capacity(Thread *thr) const { guarantee(thr != NULL, "No thread"); int lgrp_id = thr->lgrp_id(); if (lgrp_id == -1) { // This case can occur after the topology of the system has // changed. Thread can change their location, the new home // group will be determined during the first allocation // attempt. For now we can safely assume that all spaces // have equal size because the whole space will be reinitialized. if (lgrp_spaces()->length() > 0) { return capacity_in_bytes() / lgrp_spaces()->length(); } else { assert(false, "There should be at least one locality group"); return 0; } } // That's the normal case, where we know the locality group of the thread. int i = lgrp_spaces()->find(&lgrp_id, LGRPSpace::equals); if (i == -1) { return 0; } return lgrp_spaces()->at(i)->space()->capacity_in_bytes(); }
void PSOldGen::resize(size_t desired_free_space) { ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); const size_t alignment = heap->min_alignment(); const size_t size_before = _virtual_space.committed_size(); size_t new_size = used_in_bytes() + desired_free_space; new_size = align_size_up(new_size, alignment); assert(_max_gen_size == reserved().byte_size(), "max new size problem?"); // Adjust according to our min and max new_size = MAX2(MIN2(new_size, _max_gen_size), _min_gen_size); const size_t current_size = capacity_in_bytes(); if (new_size == current_size) { // No change requested return; } if (new_size > current_size) { size_t change_bytes = new_size - current_size; expand(change_bytes); } else { size_t change_bytes = current_size - new_size; // shrink doesn't grab this lock, expand does. Is that right? MutexLocker x(ExpandHeap_lock); shrink(change_bytes); } if (PrintAdaptiveSizePolicy) { gclog_or_tty->print_cr("AdaptiveSizePolicy::old generation size: " "collection: %d " "(" SIZE_FORMAT ") -> (" SIZE_FORMAT ") ", heap->total_collections(), size_before, _virtual_space.committed_size()); } }
void ImmutableSpace::print_short() const { tty->print(" space " SIZE_FORMAT "K, 100%% used", capacity_in_bytes() / K); }