本文整理汇总了C++中oop::forward_to方法的典型用法代码示例。如果您正苦于以下问题:C++ oop::forward_to方法的具体用法?C++ oop::forward_to怎么用?C++ oop::forward_to使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oop
的用法示例。
在下文中一共展示了oop::forward_to方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_object
void do_object(oop obj) {
if (obj->is_shared()) {
return;
}
if (obj->is_gc_marked() && obj->forwardee() == NULL) {
int s = obj->size();
oop sh_obj = (oop)_space->allocate(s);
if (sh_obj == NULL) {
if (_read_only) {
warning("\nThe permanent generation read only space is not large "
"enough to \npreload requested classes. Use "
"-XX:SharedReadOnlySize= to increase \nthe initial "
"size of the read only space.\n");
} else {
warning("\nThe permanent generation read write space is not large "
"enough to \npreload requested classes. Use "
"-XX:SharedReadWriteSize= to increase \nthe initial "
"size of the read write space.\n");
}
exit(2);
}
if (PrintSharedSpaces && Verbose && WizardMode) {
tty->print_cr("\nMoveMarkedObjects: " PTR_FORMAT " -> " PTR_FORMAT " %s", obj, sh_obj,
(_read_only ? "ro" : "rw"));
}
Copy::aligned_disjoint_words((HeapWord*)obj, (HeapWord*)sh_obj, s);
obj->forward_to(sh_obj);
if (_read_only) {
// Readonly objects: set hash value to self pointer and make gc_marked.
sh_obj->forward_to(sh_obj);
} else {
sh_obj->init_mark();
}
}
}
示例2: handle_promotion_failure
void DefNewGeneration::handle_promotion_failure(oop old) {
log_debug(gc, promotion)("Promotion failure size = %d) ", old->size());
_promotion_failed = true;
_promotion_failed_info.register_copy_failure(old->size());
preserve_mark_if_necessary(old, old->mark());
// forward to self
old->forward_to(old);
_promo_failure_scan_stack.push(old);
if (!_promo_failure_drain_in_progress) {
// prevent recursion in copy_to_survivor_space()
_promo_failure_drain_in_progress = true;
drain_promo_failure_scan_stack();
_promo_failure_drain_in_progress = false;
}
}
示例3: copy_to_survivor_space
oop DefNewGeneration::copy_to_survivor_space(oop old, oop* from) {
assert(is_in_reserved(old) && !old->is_forwarded(),
"shouldn't be scavenging this oop");
size_t s = old->size();
oop obj = NULL;
// Try allocating obj in to-space (unless too old or won't fit or JVMPI
// enabled)
if (old->age() < tenuring_threshold() &&
!Universe::jvmpi_slow_allocation()) {
obj = (oop) to()->allocate(s);
}
// Otherwise try allocating obj tenured
if (obj == NULL) {
obj = _next_gen->promote(old, s, from);
if (obj == NULL) {
// A failed promotion likely means the MaxLiveObjectEvacuationRatio flag
// is incorrectly set. In any case, its seriously wrong to be here!
vm_exit_out_of_memory(s*wordSize, "promotion");
}
} else {
// Prefetch beyond obj
const intx interval = PrefetchCopyIntervalInBytes;
atomic::prefetch_write(obj, interval);
// Copy obj
Memory::copy_words_aligned((HeapWord*)old, (HeapWord*)obj, s);
// Increment age if obj still in new generation
obj->incr_age();
age_table()->add(obj, s);
}
if (Universe::jvmpi_move_event_enabled()) {
Universe::jvmpi_object_move(old, obj);
}
// Done, insert forward pointer to obj in this header
old->forward_to(obj);
return obj;
}
示例4: copy_to_survivor_space
oop DefNewGeneration::copy_to_survivor_space(oop old) {
assert(is_in_reserved(old) && !old->is_forwarded(),
"shouldn't be scavenging this oop");
size_t s = old->size();
oop obj = NULL;
// Try allocating obj in to-space (unless too old)
if (old->age() < tenuring_threshold()) {
obj = (oop) to()->allocate(s);
}
// Otherwise try allocating obj tenured
if (obj == NULL) {
obj = _next_gen->promote(old, s);
if (obj == NULL) {
if (!HandlePromotionFailure) {
// A failed promotion likely means the MaxLiveObjectEvacuationRatio flag
// is incorrectly set. In any case, its seriously wrong to be here!
vm_exit_out_of_memory(s*wordSize, "promotion");
}
handle_promotion_failure(old);
return old;
}
} else {
// Prefetch beyond obj
const intx interval = PrefetchCopyIntervalInBytes;
Prefetch::write(obj, interval);
// Copy obj
Copy::aligned_disjoint_words((HeapWord*)old, (HeapWord*)obj, s);
// Increment age if obj still in new generation
obj->incr_age();
age_table()->add(obj, s);
}
// Done, insert forward pointer to obj in this header
old->forward_to(obj);
return obj;
}
示例5: copy_to_survivor_space
oop DefNewGeneration::copy_to_survivor_space(oop old) {
assert(is_in_reserved(old) && !old->is_forwarded(),
"shouldn't be scavenging this oop");
size_t s = old->size();
oop obj = NULL;
// Try allocating obj in to-space (unless too old)
if (old->age() < tenuring_threshold()) {
obj = (oop) to()->allocate(s);
}
// Otherwise try allocating obj tenured
if (obj == NULL) {
obj = _next_gen->promote(old, s);
if (obj == NULL) {
handle_promotion_failure(old);
return old;
}
} else {
// Prefetch beyond obj
const intx interval = PrefetchCopyIntervalInBytes;
Prefetch::write(obj, interval);
// Copy obj
Copy::aligned_disjoint_words((HeapWord*)old, (HeapWord*)obj, s);
// Increment age if obj still in new generation
obj->incr_age();
age_table()->add(obj, s);
}
// Done, insert forward pointer to obj in this header
old->forward_to(obj);
return obj;
}