本文整理汇总了C++中eden函数的典型用法代码示例。如果您正苦于以下问题:C++ eden函数的具体用法?C++ eden怎么用?C++ eden使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eden函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: clear_should_allocate_from_space
void DefNewGeneration::gc_epilogue(bool full) {
// Check if the heap is approaching full after a collection has
// been done. Generally the young generation is empty at
// a minimum at the end of a collection. If it is not, then
// the heap is approaching full.
GenCollectedHeap* gch = GenCollectedHeap::heap();
clear_should_allocate_from_space();
if (collection_attempt_is_safe()) {
gch->clear_incremental_collection_will_fail();
} else {
gch->set_incremental_collection_will_fail();
if (full) { // we seem to be running out of space
set_should_allocate_from_space();
}
}
if (ZapUnusedHeapArea) {
eden()->check_mangled_unused_area_complete();
from()->check_mangled_unused_area_complete();
to()->check_mangled_unused_area_complete();
}
// update the generation and space performance counters
update_counters();
gch->collector_policy()->counters()->update_counters();
}
开发者ID:tetratec,项目名称:Runescape-Launcher,代码行数:26,代码来源:defNewGeneration.cpp
示例2: space_iterate
void DefNewGeneration::space_iterate(SpaceClosure* blk,
bool usedOnly) {
blk->do_space(eden());
blk->do_space(from());
if (!usedOnly)
blk->do_space(to());
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:7,代码来源:defNewGeneration.cpp
示例3: eden
HeapWord* DefNewGeneration::allocate(size_t word_size,
bool is_large_noref,
bool is_tlab) {
// This is the slow-path allocation for the DefNewGeneration.
// Most allocations are fast-path in compiled code.
// We try to allocate from the eden. If that works, we are happy.
// Note that since DefNewGeneration supports lock-free allocation, we
// have to use it here, as well.
HeapWord* result = eden()->par_allocate(word_size);
if (result == NULL) {
// Tell the next generation we reached a limit.
HeapWord* new_limit =
next_gen()->allocation_limit_reached(eden(), eden()->top(), word_size);
if (new_limit != NULL) {
eden()->set_soft_end(new_limit);
result = eden()->par_allocate(word_size);
} else {
assert(eden()->soft_end() == eden()->end(),
"invalid state after allocation_limit_reached returned null")
}
// If the eden is full and the last collection bailed out, we are running
// out of heap space, and we try to allocate the from-space, too.
// allocate_from_space can't be inlined because that would introduce a
// circular dependency at compile time.
if (result == NULL) {
result = allocate_from_space(word_size);
}
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:29,代码来源:defNewGeneration.inline.hpp
示例4: eden
void DefNewGeneration::print_on(outputStream* st) const {
Generation::print_on(st);
st->print(" eden");
eden()->print_on(st);
st->print(" from");
from()->print_on(st);
st->print(" to ");
to()->print_on(st);
}
开发者ID:tetratec,项目名称:Runescape-Launcher,代码行数:9,代码来源:defNewGeneration.cpp
示例5: addr_to_arena_id
int DefNewGeneration::addr_to_arena_id(void* addr) {
if (eden()->contains(addr)) return 0;
if (from()->contains(addr)) {
return (from()->bottom() < to()->bottom()) ? 1 : 2;
}
if (to()->contains(addr)) {
return (from()->bottom() < to()->bottom()) ? 2 : 1;
}
// Otherwise...
return -3;
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:11,代码来源:defNewGeneration.cpp
示例6: compute_survivor_size
void DefNewGeneration::compute_space_boundaries(uintx minimum_eden_size) {
// All space sizes must be multiples of car size in order for the CarTable to work.
// Note that the CarTable is used with and without train gc (for fast lookup).
uintx alignment = CarSpace::car_size();
// Compute sizes
uintx size = _virtual_space.committed_size();
uintx survivor_size = compute_survivor_size(size, alignment);
uintx eden_size = size - (2*survivor_size);
assert(eden_size > 0 && survivor_size <= eden_size, "just checking");
if (eden_size < minimum_eden_size) {
// May happen due to 64Kb rounding, if so adjust eden size back up
minimum_eden_size = align_size_up(minimum_eden_size, alignment);
uintx maximum_survivor_size = (size - minimum_eden_size) / 2;
uintx unaligned_survivor_size =
align_size_down(maximum_survivor_size, alignment);
survivor_size = MAX2(unaligned_survivor_size, alignment);
eden_size = size - (2*survivor_size);
assert(eden_size > 0 && survivor_size <= eden_size, "just checking");
assert(eden_size >= minimum_eden_size, "just checking");
}
char *eden_start = _virtual_space.low();
char *from_start = eden_start + eden_size;
char *to_start = from_start + survivor_size;
char *to_end = to_start + survivor_size;
assert(to_end == _virtual_space.high(), "just checking");
assert(Space::is_aligned((HeapWord*)eden_start), "checking alignment");
assert(Space::is_aligned((HeapWord*)from_start), "checking alignment");
assert(Space::is_aligned((HeapWord*)to_start), "checking alignment");
MemRegion edenMR((HeapWord*)eden_start, (HeapWord*)from_start);
MemRegion fromMR((HeapWord*)from_start, (HeapWord*)to_start);
MemRegion toMR ((HeapWord*)to_start, (HeapWord*)to_end);
eden()->initialize(edenMR, (minimum_eden_size == 0));
from()->initialize(fromMR, true);
to()->initialize(toMR , true);
if (jvmpi::is_event_enabled(JVMPI_EVENT_ARENA_NEW)) {
CollectedHeap* ch = Universe::heap();
jvmpi::post_arena_new_event(ch->addr_to_arena_id(eden_start), "Eden");
jvmpi::post_arena_new_event(ch->addr_to_arena_id(from_start), "Semi");
jvmpi::post_arena_new_event(ch->addr_to_arena_id(to_start), "Semi");
}
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:48,代码来源:defNewGeneration.cpp
示例7: eden
void DefNewGeneration::remove_forwarding_pointers() {
RemoveForwardPointerClosure rspc;
eden()->object_iterate(&rspc);
from()->object_iterate(&rspc);
// Now restore saved marks, if any.
assert(_objs_with_preserved_marks.size() == _preserved_marks_of_objs.size(),
"should be the same");
while (!_objs_with_preserved_marks.is_empty()) {
oop obj = _objs_with_preserved_marks.pop();
markOop m = _preserved_marks_of_objs.pop();
obj->set_mark(m);
}
_objs_with_preserved_marks.clear(true);
_preserved_marks_of_objs.clear(true);
}
开发者ID:4T-Shirt,项目名称:OpenJDK-Research,代码行数:16,代码来源:defNewGeneration.cpp
示例8: from
void DefNewGeneration::swap_spaces() {
ContiguousSpace* s = from();
_from_space = to();
_to_space = s;
eden()->set_next_compaction_space(from());
// The to-space is normally empty before a compaction so need
// not be considered. The exception is during promotion
// failure handling when to-space can contain live objects.
from()->set_next_compaction_space(NULL);
if (UsePerfData) {
CSpaceCounters* c = _from_counters;
_from_counters = _to_counters;
_to_counters = c;
}
}
开发者ID:4T-Shirt,项目名称:OpenJDK-Research,代码行数:16,代码来源:defNewGeneration.cpp
示例9: main
int main()
{
world odd;
world even;
int i;
init(odd);
init(even);
eden(even);
// simulation
for (i = 0; i < CYCLES; ++i) {
if ((i % 2)) {
update(even,odd);
dele(odd);
}
else {
update(odd,even);
dele(even);
}
}
}
开发者ID:BackupTheBerlios,项目名称:useoa-rose-svn,代码行数:20,代码来源:rose_life.C
示例10: level
void DefNewGeneration::compute_new_size() {
// This is called after a gc that includes the following generation
// (which is required to exist.) So from-space will normally be empty.
// Note that we check both spaces, since if scavenge failed they revert roles.
// If not we bail out (otherwise we would have to relocate the objects)
if (!from()->is_empty() || !to()->is_empty()) {
return;
}
int next_level = level() + 1;
GenCollectedHeap* gch = GenCollectedHeap::heap();
assert(next_level < gch->_n_gens,
"DefNewGeneration cannot be an oldest gen");
Generation* next_gen = gch->_gens[next_level];
size_t old_size = next_gen->capacity();
size_t new_size_before = _virtual_space.committed_size();
size_t min_new_size = spec()->init_size();
size_t max_new_size = reserved().byte_size();
assert(min_new_size <= new_size_before &&
new_size_before <= max_new_size,
"just checking");
// All space sizes must be multiples of Generation::GenGrain.
size_t alignment = Generation::GenGrain;
// Compute desired new generation size based on NewRatio and
// NewSizeThreadIncrease
size_t desired_new_size = old_size/NewRatio;
int threads_count = Threads::number_of_non_daemon_threads();
size_t thread_increase_size = threads_count * NewSizeThreadIncrease;
desired_new_size = align_size_up(desired_new_size + thread_increase_size, alignment);
// Adjust new generation size
desired_new_size = MAX2(MIN2(desired_new_size, max_new_size), min_new_size);
assert(desired_new_size <= max_new_size, "just checking");
bool changed = false;
if (desired_new_size > new_size_before) {
size_t change = desired_new_size - new_size_before;
assert(change % alignment == 0, "just checking");
if (expand(change)) {
changed = true;
}
// If the heap failed to expand to the desired size,
// "changed" will be false. If the expansion failed
// (and at this point it was expected to succeed),
// ignore the failure (leaving "changed" as false).
}
if (desired_new_size < new_size_before && eden()->is_empty()) {
// bail out of shrinking if objects in eden
size_t change = new_size_before - desired_new_size;
assert(change % alignment == 0, "just checking");
_virtual_space.shrink_by(change);
changed = true;
}
if (changed) {
// The spaces have already been mangled at this point but
// may not have been cleared (set top = bottom) and should be.
// Mangling was done when the heap was being expanded.
compute_space_boundaries(eden()->used(),
SpaceDecorator::Clear,
SpaceDecorator::DontMangle);
MemRegion cmr((HeapWord*)_virtual_space.low(),
(HeapWord*)_virtual_space.high());
Universe::heap()->barrier_set()->resize_covered_region(cmr);
if (Verbose && PrintGC) {
size_t new_size_after = _virtual_space.committed_size();
size_t eden_size_after = eden()->capacity();
size_t survivor_size_after = from()->capacity();
gclog_or_tty->print("New generation size " SIZE_FORMAT "K->"
SIZE_FORMAT "K [eden="
SIZE_FORMAT "K,survivor=" SIZE_FORMAT "K]",
new_size_before/K, new_size_after/K,
eden_size_after/K, survivor_size_after/K);
if (WizardMode) {
gclog_or_tty->print("[allowed " SIZE_FORMAT "K extra for %d threads]",
thread_increase_size/K, threads_count);
}
gclog_or_tty->cr();
}
}
}
开发者ID:4T-Shirt,项目名称:OpenJDK-Research,代码行数:82,代码来源:defNewGeneration.cpp
示例11: assert
void DefNewGeneration::compute_space_boundaries(uintx minimum_eden_size,
bool clear_space,
bool mangle_space) {
uintx alignment =
GenCollectedHeap::heap()->collector_policy()->space_alignment();
// If the spaces are being cleared (only done at heap initialization
// currently), the survivor spaces need not be empty.
// Otherwise, no care is taken for used areas in the survivor spaces
// so check.
assert(clear_space || (to()->is_empty() && from()->is_empty()),
"Initialization of the survivor spaces assumes these are empty");
// Compute sizes
uintx size = _virtual_space.committed_size();
uintx survivor_size = compute_survivor_size(size, alignment);
uintx eden_size = size - (2*survivor_size);
assert(eden_size > 0 && survivor_size <= eden_size, "just checking");
if (eden_size < minimum_eden_size) {
// May happen due to 64Kb rounding, if so adjust eden size back up
minimum_eden_size = align_size_up(minimum_eden_size, alignment);
uintx maximum_survivor_size = (size - minimum_eden_size) / 2;
uintx unaligned_survivor_size =
align_size_down(maximum_survivor_size, alignment);
survivor_size = MAX2(unaligned_survivor_size, alignment);
eden_size = size - (2*survivor_size);
assert(eden_size > 0 && survivor_size <= eden_size, "just checking");
assert(eden_size >= minimum_eden_size, "just checking");
}
char *eden_start = _virtual_space.low();
char *from_start = eden_start + eden_size;
char *to_start = from_start + survivor_size;
char *to_end = to_start + survivor_size;
assert(to_end == _virtual_space.high(), "just checking");
assert(Space::is_aligned((HeapWord*)eden_start), "checking alignment");
assert(Space::is_aligned((HeapWord*)from_start), "checking alignment");
assert(Space::is_aligned((HeapWord*)to_start), "checking alignment");
MemRegion edenMR((HeapWord*)eden_start, (HeapWord*)from_start);
MemRegion fromMR((HeapWord*)from_start, (HeapWord*)to_start);
MemRegion toMR ((HeapWord*)to_start, (HeapWord*)to_end);
// A minimum eden size implies that there is a part of eden that
// is being used and that affects the initialization of any
// newly formed eden.
bool live_in_eden = minimum_eden_size > 0;
// If not clearing the spaces, do some checking to verify that
// the space are already mangled.
if (!clear_space) {
// Must check mangling before the spaces are reshaped. Otherwise,
// the bottom or end of one space may have moved into another
// a failure of the check may not correctly indicate which space
// is not properly mangled.
if (ZapUnusedHeapArea) {
HeapWord* limit = (HeapWord*) _virtual_space.high();
eden()->check_mangled_unused_area(limit);
from()->check_mangled_unused_area(limit);
to()->check_mangled_unused_area(limit);
}
}
// Reset the spaces for their new regions.
eden()->initialize(edenMR,
clear_space && !live_in_eden,
SpaceDecorator::Mangle);
// If clear_space and live_in_eden, we will not have cleared any
// portion of eden above its top. This can cause newly
// expanded space not to be mangled if using ZapUnusedHeapArea.
// We explicitly do such mangling here.
if (ZapUnusedHeapArea && clear_space && live_in_eden && mangle_space) {
eden()->mangle_unused_area();
}
from()->initialize(fromMR, clear_space, mangle_space);
to()->initialize(toMR, clear_space, mangle_space);
// Set next compaction spaces.
eden()->set_next_compaction_space(from());
// The to-space is normally empty before a compaction so need
// not be considered. The exception is during promotion
// failure handling when to-space can contain live objects.
from()->set_next_compaction_space(NULL);
}
开发者ID:4T-Shirt,项目名称:OpenJDK-Research,代码行数:86,代码来源:defNewGeneration.cpp
示例12: assert
void DefNewGeneration::record_spaces_top() {
assert(ZapUnusedHeapArea, "Not mangling unused space");
eden()->set_top_for_allocations();
to()->set_top_for_allocations();
from()->set_top_for_allocations();
}
开发者ID:tetratec,项目名称:Runescape-Launcher,代码行数:6,代码来源:defNewGeneration.cpp
注:本文中的eden函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论