本文整理汇总了C++中oop::oop_iterate方法的典型用法代码示例。如果您正苦于以下问题:C++ oop::oop_iterate方法的具体用法?C++ oop::oop_iterate怎么用?C++ oop::oop_iterate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oop
的用法示例。
在下文中一共展示了oop::oop_iterate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_object
// Card marks are not precise. The current system can leave us with
// a mismash of precise marks and beginning of object marks. This means
// we test for missing precise marks first. If any are found, we don't
// fail unless the object head is also unmarked.
virtual void do_object(oop obj) {
CheckForUnmarkedOops object_check(_young_gen, _card_table);
obj->oop_iterate(&object_check);
if (object_check.has_unmarked_oop()) {
assert(_card_table->addr_is_marked_imprecise(obj), "Found unmarked young_gen object");
}
}
示例2: mark_object_recursive_skipping_klasses
static void mark_object_recursive_skipping_klasses(oop obj) {
mark_object(obj);
if (obj != NULL) {
MarkObjectsSkippingKlassesOopClosure mark_all;
obj->oop_iterate(&mark_all);
}
}
示例3: do_object
void do_object(oop obj) {
obj->oop_iterate_header(&resolve);
obj->oop_iterate(&resolve);
assert(obj->klass()->is_shared(), "Klass not pointing into shared space.");
// If the object is a Java object or class which might (in the
// future) contain a reference to a young gen object, add it to the
// list.
if (obj->is_klass() || obj->is_instance()) {
if (obj->is_klass() ||
obj->is_a(SystemDictionary::Class_klass()) ||
obj->is_a(SystemDictionary::Throwable_klass())) {
// Do nothing
}
else if (obj->is_a(SystemDictionary::String_klass())) {
// immutable objects.
} else {
// someone added an object we hadn't accounted for.
ShouldNotReachHere();
}
}
}
示例4: do_object
void do_object(oop obj) {
obj->oop_iterate(&look_in_object);
}
示例5: do_object
void ObjectToOopClosure::do_object(oop obj) {
obj->oop_iterate(_cl);
}
示例6: do_object
// <original comment>
// The original idea here was to coalesce evacuated and dead objects.
// However that caused complications with the block offset table (BOT).
// In particular if there were two TLABs, one of them partially refined.
// |----- TLAB_1--------|----TLAB_2-~~~(partially refined part)~~~|
// The BOT entries of the unrefined part of TLAB_2 point to the start
// of TLAB_2. If the last object of the TLAB_1 and the first object
// of TLAB_2 are coalesced, then the cards of the unrefined part
// would point into middle of the filler object.
// The current approach is to not coalesce and leave the BOT contents intact.
// </original comment>
//
// We now reset the BOT when we start the object iteration over the
// region and refine its entries for every object we come across. So
// the above comment is not really relevant and we should be able
// to coalesce dead objects if we want to.
void do_object(oop obj) {
HeapWord* obj_addr = (HeapWord*) obj;
assert(_hr->is_in(obj_addr), "sanity");
size_t obj_size = obj->size();
HeapWord* obj_end = obj_addr + obj_size;
if (_end_of_last_gap != obj_addr) {
// there was a gap before obj_addr
_last_gap_threshold = _hr->cross_threshold(_end_of_last_gap, obj_addr);
}
if (obj->is_forwarded() && obj->forwardee() == obj) {
// The object failed to move.
// We consider all objects that we find self-forwarded to be
// live. What we'll do is that we'll update the prev marking
// info so that they are all under PTAMS and explicitly marked.
if (!_cm->isPrevMarked(obj)) {
_cm->markPrev(obj);
}
if (_during_initial_mark) {
// For the next marking info we'll only mark the
// self-forwarded objects explicitly if we are during
// initial-mark (since, normally, we only mark objects pointed
// to by roots if we succeed in copying them). By marking all
// self-forwarded objects we ensure that we mark any that are
// still pointed to be roots. During concurrent marking, and
// after initial-mark, we don't need to mark any objects
// explicitly and all objects in the CSet are considered
// (implicitly) live. So, we won't mark them explicitly and
// we'll leave them over NTAMS.
_cm->grayRoot(obj, obj_size, _worker_id, _hr);
}
_marked_bytes += (obj_size * HeapWordSize);
obj->set_mark(markOopDesc::prototype());
// While we were processing RSet buffers during the collection,
// we actually didn't scan any cards on the collection set,
// since we didn't want to update remembered sets with entries
// that point into the collection set, given that live objects
// from the collection set are about to move and such entries
// will be stale very soon.
// This change also dealt with a reliability issue which
// involved scanning a card in the collection set and coming
// across an array that was being chunked and looking malformed.
// The problem is that, if evacuation fails, we might have
// remembered set entries missing given that we skipped cards on
// the collection set. So, we'll recreate such entries now.
obj->oop_iterate(_update_rset_cl);
} else {
// The object has been either evacuated or is dead. Fill it with a
// dummy object.
MemRegion mr(obj_addr, obj_size);
CollectedHeap::fill_with_object(mr);
// must nuke all dead objects which we skipped when iterating over the region
_cm->clearRangePrevBitmap(MemRegion(_end_of_last_gap, obj_end));
}
_end_of_last_gap = obj_end;
_last_obj_threshold = _hr->cross_threshold(obj_addr, obj_end);
}