< prev index next > src/hotspot/share/gc/serial/markSweep.cpp
Print this page
MarkSweep::FollowRootClosure MarkSweep::follow_root_closure;
MarkAndPushClosure MarkSweep::mark_and_push_closure(ClassLoaderData::_claim_stw_fullgc_mark);
CLDToOopClosure MarkSweep::follow_cld_closure(&mark_and_push_closure, ClassLoaderData::_claim_stw_fullgc_mark);
- CLDToOopClosure MarkSweep::adjust_cld_closure(&adjust_pointer_closure, ClassLoaderData::_claim_stw_fullgc_adjust);
template <class T> void MarkSweep::KeepAliveClosure::do_oop_work(T* p) {
mark_and_push(p);
}
}
void MarkSweep::FollowRootClosure::do_oop(oop* p) { follow_root(p); }
void MarkSweep::FollowRootClosure::do_oop(narrowOop* p) { follow_root(p); }
+ template <bool ALT_FWD>
void PreservedMark::adjust_pointer() {
- MarkSweep::adjust_pointer(&_obj);
+ MarkSweep::adjust_pointer<ALT_FWD>(&_obj);
}
void PreservedMark::restore() {
_obj->set_mark(_mark);
}
java_lang_String::is_instance(obj) &&
SerialStringDedup::is_candidate_from_mark(obj)) {
_string_dedup_requests->add(obj);
}
+ // Do the transform while we still have the header intact,
+ // which might include important class information.
+ ContinuationGCSupport::transform_stack_chunk(obj);
+
// some marks may contain information we need to preserve so we store them away
// and overwrite the mark. We'll restore it at the end of markSweep.
markWord mark = obj->mark();
- obj->set_mark(markWord::prototype().set_marked());
-
- ContinuationGCSupport::transform_stack_chunk(obj);
+ obj->set_mark(obj->prototype_mark().set_marked());
if (obj->mark_must_be_preserved(mark)) {
preserve_mark(obj, mark);
}
}
template <typename T>
void MarkAndPushClosure::do_oop_work(T* p) { MarkSweep::mark_and_push(p); }
void MarkAndPushClosure::do_oop( oop* p) { do_oop_work(p); }
void MarkAndPushClosure::do_oop(narrowOop* p) { do_oop_work(p); }
- AdjustPointerClosure MarkSweep::adjust_pointer_closure;
-
- void MarkSweep::adjust_marks() {
+ template <bool ALT_FWD>
+ void MarkSweep::adjust_marks_impl() {
// adjust the oops we saved earlier
for (size_t i = 0; i < _preserved_count; i++) {
- _preserved_marks[i].adjust_pointer();
+ _preserved_marks[i].adjust_pointer<ALT_FWD>();
}
// deal with the overflow stack
StackIterator<PreservedMark, mtGC> iter(_preserved_overflow_stack);
while (!iter.is_empty()) {
PreservedMark* p = iter.next_addr();
- p->adjust_pointer();
+ p->adjust_pointer<ALT_FWD>();
+ }
+ }
+
+ void MarkSweep::adjust_marks() {
+ if (UseAltGCForwarding) {
+ adjust_marks_impl<true>();
+ } else {
+ adjust_marks_impl<false>();
}
}
void MarkSweep::restore_marks() {
log_trace(gc)("Restoring " SIZE_FORMAT " marks", _preserved_count + _preserved_overflow_stack.size());
< prev index next >