这篇教程C++ virtual_space函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中virtual_space函数的典型用法代码示例。如果您正苦于以下问题:C++ virtual_space函数的具体用法?C++ virtual_space怎么用?C++ virtual_space使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了virtual_space函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: assertvoid PSYoungGen::set_space_boundaries(size_t eden_size, size_t survivor_size) { assert(eden_size < virtual_space()->committed_size(), "just checking"); assert(eden_size > 0 && survivor_size > 0, "just checking"); // Initial layout is Eden, to, from. After swapping survivor spaces, // that leaves us with Eden, from, to, which is step one in our two // step resize-with-live-data procedure. char *eden_start = virtual_space()->low(); char *to_start = eden_start + eden_size; char *from_start = to_start + survivor_size; char *from_end = from_start + survivor_size; assert(from_end == virtual_space()->high(), "just checking"); assert(is_object_aligned((intptr_t)eden_start), "checking alignment"); assert(is_object_aligned((intptr_t)to_start), "checking alignment"); assert(is_object_aligned((intptr_t)from_start), "checking alignment"); MemRegion eden_mr((HeapWord*)eden_start, (HeapWord*)to_start); MemRegion to_mr ((HeapWord*)to_start, (HeapWord*)from_start); MemRegion from_mr((HeapWord*)from_start, (HeapWord*)from_end); eden_space()->initialize(eden_mr, true, ZapUnusedHeapArea); to_space()->initialize(to_mr , true, ZapUnusedHeapArea); from_space()->initialize(from_mr, true, ZapUnusedHeapArea);}
开发者ID:641252154,项目名称:HotSpot-JVM-Linux-x86-Research,代码行数:25,
示例2: from_space// This method assumes that from-space has live data and that// any shrinkage of the young gen is limited by location of// from-space.size_t PSYoungGen::available_to_live() { size_t delta_in_survivor = 0; ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); const size_t space_alignment = heap->intra_heap_alignment(); const size_t gen_alignment = heap->young_gen_alignment(); MutableSpace* space_shrinking = NULL; if (from_space()->end() > to_space()->end()) { space_shrinking = from_space(); } else { space_shrinking = to_space(); } // Include any space that is committed but not included in // the survivor spaces. assert(((HeapWord*)virtual_space()->high()) >= space_shrinking->end(), "Survivor space beyond high end"); size_t unused_committed = pointer_delta(virtual_space()->high(), space_shrinking->end(), sizeof(char)); if (space_shrinking->is_empty()) { // Don't let the space shrink to 0 assert(space_shrinking->capacity_in_bytes() >= space_alignment, "Space is too small"); delta_in_survivor = space_shrinking->capacity_in_bytes() - space_alignment; } else { delta_in_survivor = pointer_delta(space_shrinking->end(), space_shrinking->top(), sizeof(char)); } size_t delta_in_bytes = unused_committed + delta_in_survivor; delta_in_bytes = align_size_down(delta_in_bytes, gen_alignment); return delta_in_bytes;}
开发者ID:641252154,项目名称:HotSpot-JVM-Linux-x86-Research,代码行数:38,
示例3: assert_locked_or_safepoint// This method currently does not expect to expand into eden (i.e.,// the virtual space boundaries is expected to be consistent// with the eden boundaries..void PSYoungGen::post_resize() { assert_locked_or_safepoint(Heap_lock); assert((eden_space()->bottom() < to_space()->bottom()) && (eden_space()->bottom() < from_space()->bottom()), "Eden is assumed to be below the survivor spaces"); MemRegion cmr((HeapWord*)virtual_space()->low(), (HeapWord*)virtual_space()->high()); Universe::heap()->barrier_set()->resize_covered_region(cmr); space_invariants();}
开发者ID:641252154,项目名称:HotSpot-JVM-Linux-x86-Research,代码行数:14,
示例4: guaranteevoid PSYoungGen::space_invariants() { ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); const size_t alignment = heap->intra_heap_alignment(); // Currently, our eden size cannot shrink to zero guarantee(eden_space()->capacity_in_bytes() >= alignment, "eden too small"); guarantee(from_space()->capacity_in_bytes() >= alignment, "from too small"); guarantee(to_space()->capacity_in_bytes() >= alignment, "to too small"); // Relationship of spaces to each other char* eden_start = (char*)eden_space()->bottom(); char* eden_end = (char*)eden_space()->end(); char* from_start = (char*)from_space()->bottom(); char* from_end = (char*)from_space()->end(); char* to_start = (char*)to_space()->bottom(); char* to_end = (char*)to_space()->end(); guarantee(eden_start >= virtual_space()->low(), "eden bottom"); guarantee(eden_start < eden_end, "eden space consistency"); guarantee(from_start < from_end, "from space consistency"); guarantee(to_start < to_end, "to space consistency"); // Check whether from space is below to space if (from_start < to_start) { // Eden, from, to guarantee(eden_end <= from_start, "eden/from boundary"); guarantee(from_end <= to_start, "from/to boundary"); guarantee(to_end <= virtual_space()->high(), "to end"); } else { // Eden, to, from guarantee(eden_end <= to_start, "eden/to boundary"); guarantee(to_end <= from_start, "to/from boundary"); guarantee(from_end <= virtual_space()->high(), "from end"); } // More checks that the virtual space is consistent with the spaces assert(virtual_space()->committed_size() >= (eden_space()->capacity_in_bytes() + to_space()->capacity_in_bytes() + from_space()->capacity_in_bytes()), "Committed size is inconsistent"); assert(virtual_space()->committed_size() <= virtual_space()->reserved_size(), "Space invariant"); char* eden_top = (char*)eden_space()->top(); char* from_top = (char*)from_space()->top(); char* to_top = (char*)to_space()->top(); assert(eden_top <= virtual_space()->high(), "eden top"); assert(from_top <= virtual_space()->high(), "from top"); assert(to_top <= virtual_space()->high(), "to top"); virtual_space()->verify();}
开发者ID:641252154,项目名称:HotSpot-JVM-Linux-x86-Research,代码行数:51,
示例5: virtual_spacesize_t ASPSYoungGen::available_for_expansion() { size_t current_committed_size = virtual_space()->committed_size(); assert((gen_size_limit() >= current_committed_size), "generation size limit is wrong"); ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); size_t result = gen_size_limit() - current_committed_size; size_t result_aligned = align_size_down(result, heap->generation_alignment()); return result_aligned;}
开发者ID:campolake,项目名称:openjdk9,代码行数:9,
示例6: virtual_space// Return the number of bytes the young gen is willing give up.//// Future implementations could check the survivors and if to_space is in the// right place (below from_space), take a chunk from to_space.size_t ASPSYoungGen::available_for_contraction() { size_t uncommitted_bytes = virtual_space()->uncommitted_size(); if (uncommitted_bytes != 0) { return uncommitted_bytes; } if (eden_space()->is_empty()) { // Respect the minimum size for eden and for the young gen as a whole. ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); const size_t eden_alignment = heap->intra_heap_alignment(); const size_t gen_alignment = heap->young_gen_alignment(); assert(eden_space()->capacity_in_bytes() >= eden_alignment, "Alignment is wrong"); size_t eden_avail = eden_space()->capacity_in_bytes() - eden_alignment; eden_avail = align_size_down(eden_avail, gen_alignment); assert(virtual_space()->committed_size() >= min_gen_size(), "minimum gen size is wrong"); size_t gen_avail = virtual_space()->committed_size() - min_gen_size(); assert(virtual_space()->is_aligned(gen_avail), "not aligned"); const size_t max_contraction = MIN2(eden_avail, gen_avail); // See comment for ASPSOldGen::available_for_contraction() // for reasons the "increment" fraction is used. PSAdaptiveSizePolicy* policy = heap->size_policy(); size_t result = policy->eden_increment_aligned_down(max_contraction); size_t result_aligned = align_size_down(result, gen_alignment); if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr("ASPSYoungGen::available_for_contraction: %d K", result_aligned/K); gclog_or_tty->print_cr(" max_contraction %d K", max_contraction/K); gclog_or_tty->print_cr(" eden_avail %d K", eden_avail/K); gclog_or_tty->print_cr(" gen_avail %d K", gen_avail/K); } return result_aligned; } return 0;}
开发者ID:tetratec,项目名称:Runescape-Launcher,代码行数:46,
示例7: MemRegionvoid PSYoungGen::reset_survivors_after_shrink() { _reserved = MemRegion((HeapWord*)virtual_space()->low_boundary(), (HeapWord*)virtual_space()->high_boundary()); PSScavenge::reference_processor()->set_span(_reserved); MutableSpace* space_shrinking = NULL; if (from_space()->end() > to_space()->end()) { space_shrinking = from_space(); } else { space_shrinking = to_space(); } HeapWord* new_end = (HeapWord*)virtual_space()->high(); assert(new_end >= space_shrinking->bottom(), "Shrink was too large"); // Was there a shrink of the survivor space? if (new_end < space_shrinking->end()) { MemRegion mr(space_shrinking->bottom(), new_end); space_shrinking->initialize(mr, SpaceDecorator::DontClear, SpaceDecorator::Mangle); }}
开发者ID:641252154,项目名称:HotSpot-JVM-Linux-x86-Research,代码行数:22,
示例8: capacity_in_bytesvoid 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);}
开发者ID:641252154,项目名称:HotSpot-JVM-Linux-x86-Research,代码行数:14,
示例9: pointer_delta// The current implementation only considers to the end of eden.// If to_space is below from_space, to_space is not considered.// to_space can be.size_t ASPSYoungGen::available_to_live() { ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); const size_t alignment = heap->intra_heap_alignment(); // Include any space that is committed but is not in eden. size_t available = pointer_delta(eden_space()->bottom(), virtual_space()->low(), sizeof(char)); const size_t eden_capacity = eden_space()->capacity_in_bytes(); if (eden_space()->is_empty() && eden_capacity > alignment) { available += eden_capacity - alignment; } return available;}
开发者ID:tetratec,项目名称:Runescape-Launcher,代码行数:18,
示例10: virtual_spacebool PSYoungGen::resize_generation(size_t eden_size, size_t survivor_size) { const size_t alignment = virtual_space()->alignment(); size_t orig_size = virtual_space()->committed_size(); bool size_changed = false; // There used to be this guarantee there. // guarantee ((eden_size + 2*survivor_size) <= _max_gen_size, "incorrect input arguments"); // Code below forces this requirement. In addition the desired eden // size and disired survivor sizes are desired goals and may // exceed the total generation size. assert(min_gen_size() <= orig_size && orig_size <= max_size(), "just checking"); // Adjust new generation size const size_t eden_plus_survivors = align_size_up(eden_size + 2 * survivor_size, alignment); size_t desired_size = MAX2(MIN2(eden_plus_survivors, max_size()), min_gen_size()); assert(desired_size <= max_size(), "just checking"); if (desired_size > orig_size) { // Grow the generation size_t change = desired_size - orig_size; assert(change % alignment == 0, "just checking"); HeapWord* prev_high = (HeapWord*) virtual_space()->high(); if (!virtual_space()->expand_by(change)) { return false; // Error if we fail to resize! } if (ZapUnusedHeapArea) { // Mangle newly committed space immediately because it // can be done here more simply that after the new // spaces have been computed. HeapWord* new_high = (HeapWord*) virtual_space()->high(); MemRegion mangle_region(prev_high, new_high); SpaceMangler::mangle_region(mangle_region); } size_changed = true; } else if (desired_size < orig_size) { size_t desired_change = orig_size - desired_size; assert(desired_change % alignment == 0, "just checking"); desired_change = limit_gen_shrink(desired_change); if (desired_change > 0) { virtual_space()->shrink_by(desired_change); reset_survivors_after_shrink(); size_changed = true; } } else { if (Verbose && PrintGC) { if (orig_size == gen_size_limit()) { gclog_or_tty->print_cr("PSYoung generation size at maximum: " SIZE_FORMAT "K", orig_size/K); } else if (orig_size == min_gen_size()) { gclog_or_tty->print_cr("PSYoung generation size at minium: " SIZE_FORMAT "K", orig_size/K); } } } if (size_changed) { post_resize(); if (Verbose && PrintGC) { size_t current_size = virtual_space()->committed_size(); gclog_or_tty->print_cr("PSYoung generation size changed: " SIZE_FORMAT "K->" SIZE_FORMAT "K", orig_size/K, current_size/K); } } guarantee(eden_plus_survivors <= virtual_space()->committed_size() || virtual_space()->committed_size() == max_size(), "Sanity"); return true;}
开发者ID:641252154,项目名称:HotSpot-JVM-Linux-x86-Research,代码行数:77,
示例11: assertvoid PSPermGen::compute_new_size(size_t used_before_collection) { // Update our padded average of objects allocated in perm // gen between collections. assert(used_before_collection >= _last_used, "negative allocation amount since last GC?"); const size_t alloc_since_last_gc = used_before_collection - _last_used; _avg_size->sample(alloc_since_last_gc); const size_t current_live = used_in_bytes(); // Stash away the current amount live for the next call to this method. _last_used = current_live; // We have different alignment constraints than the rest of the heap. const size_t alignment = MAX2(MinPermHeapExpansion, virtual_space()->alignment()); // Compute the desired size: // The free space is the newly computed padded average, // so the desired size is what's live + the free space. size_t desired_size = current_live + (size_t)_avg_size->padded_average(); desired_size = align_size_up(desired_size, alignment); // ...and no larger or smaller than our max and min allowed. desired_size = MAX2(MIN2(desired_size, _max_gen_size), _min_gen_size); assert(desired_size <= _max_gen_size, "just checking"); const size_t size_before = _virtual_space->committed_size(); if (desired_size == size_before) { // no change, we're done return; } { // We'll be growing or shrinking the heap: in either case, // we need to hold a lock. MutexLocker x(ExpandHeap_lock); if (desired_size > size_before) { const size_t change_bytes = desired_size - size_before; const size_t aligned_change_bytes = align_size_up(change_bytes, alignment); expand_by(aligned_change_bytes); } else { // Shrinking const size_t change_bytes = size_before - desired_size; const size_t aligned_change_bytes = align_size_down(change_bytes, alignment); shrink(aligned_change_bytes); } } // While this code isn't controlled by AdaptiveSizePolicy, it's // convenient to see all resizing decsions under the same flag. if (PrintAdaptiveSizePolicy) { ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); gclog_or_tty->print_cr("AdaptiveSizePolicy::perm generation size: " "collection: %d " "(" SIZE_FORMAT ") -> (" SIZE_FORMAT ") ", heap->total_collections(), size_before, _virtual_space->committed_size()); }}
开发者ID:tetratec,项目名称:Runescape-Launcher,代码行数:65,
示例12: MIN3// Return the number of bytes available for resizing down the young// generation. This is the minimum of// input "bytes"// bytes to the minimum young gen size// bytes to the size currently being used + some small extrasize_t PSYoungGen::limit_gen_shrink(size_t bytes) { // Allow shrinkage into the current eden but keep eden large enough // to maintain the minimum young gen size bytes = MIN3(bytes, available_to_min_gen(), available_to_live()); return align_size_down(bytes, virtual_space()->alignment());}
开发者ID:641252154,项目名称:HotSpot-JVM-Linux-x86-Research,代码行数:11,
示例13: assertvoid ASPSYoungGen::resize_spaces(size_t requested_eden_size, size_t requested_survivor_size) { assert(UseAdaptiveSizePolicy, "sanity check"); assert(requested_eden_size > 0 && requested_survivor_size > 0, "just checking"); space_invariants(); // We require eden and to space to be empty if ((!eden_space()->is_empty()) || (!to_space()->is_empty())) { return; } if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr("PSYoungGen::resize_spaces(requested_eden_size: " SIZE_FORMAT ", requested_survivor_size: " SIZE_FORMAT ")", requested_eden_size, requested_survivor_size); gclog_or_tty->print_cr(" eden: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, eden_space()->bottom(), eden_space()->end(), pointer_delta(eden_space()->end(), eden_space()->bottom(), sizeof(char))); gclog_or_tty->print_cr(" from: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, from_space()->bottom(), from_space()->end(), pointer_delta(from_space()->end(), from_space()->bottom(), sizeof(char))); gclog_or_tty->print_cr(" to: [" PTR_FORMAT ".." PTR_FORMAT ") " SIZE_FORMAT, to_space()->bottom(), to_space()->end(), pointer_delta( to_space()->end(), to_space()->bottom(), sizeof(char))); } // There's nothing to do if the new sizes are the same as the current if (requested_survivor_size == to_space()->capacity_in_bytes() && requested_survivor_size == from_space()->capacity_in_bytes() && requested_eden_size == eden_space()->capacity_in_bytes()) { if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr(" capacities are the right sizes, returning"); } return; } char* eden_start = (char*)virtual_space()->low(); char* eden_end = (char*)eden_space()->end(); char* from_start = (char*)from_space()->bottom(); char* from_end = (char*)from_space()->end(); char* to_start = (char*)to_space()->bottom(); char* to_end = (char*)to_space()->end(); assert(eden_start < from_start, "Cannot push into from_space"); ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); const size_t alignment = heap->intra_heap_alignment(); const bool maintain_minimum = (requested_eden_size + 2 * requested_survivor_size) <= min_gen_size(); bool eden_from_to_order = from_start < to_start; // Check whether from space is below to space if (eden_from_to_order) { // Eden, from, to if (PrintAdaptiveSizePolicy && Verbose) { gclog_or_tty->print_cr(" Eden, from, to:"); } // Set eden // "requested_eden_size" is a goal for the size of eden // and may not be attainable. "eden_size" below is // calculated based on the location of from-space and // the goal for the size of eden. from-space is // fixed in place because it contains live data. // The calculation is done this way to avoid 32bit // overflow (i.e., eden_start + requested_eden_size // may too large for representation in 32bits). size_t eden_size; if (maintain_minimum) { // Only make eden larger than the requested size if // the minimum size of the generation has to be maintained. // This could be done in general but policy at a higher // level is determining a requested size for eden and that // should be honored unless there is a fundamental reason. eden_size = pointer_delta(from_start, eden_start, sizeof(char)); } else { eden_size = MIN2(requested_eden_size, pointer_delta(from_start, eden_start, sizeof(char))); } eden_end = eden_start + eden_size; assert(eden_end >= eden_start, "addition overflowed")//.........这里部分代码省略.........
开发者ID:tetratec,项目名称:Runescape-Launcher,代码行数:101,
注:本文中的virtual_space函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ vis_alignaddr函数代码示例 C++ virtqueue_kick函数代码示例 |