< prev index next > src/hotspot/share/gc/serial/defNewGeneration.cpp
Print this page
// Will enter Full GC soon due to failed promotion. Must reset the mark word
// of objs in young-gen so that no objs are marked (forwarded) when Full GC
// starts. (The mark word is overloaded: `is_marked()` == `is_forwarded()`.)
struct ResetForwardedMarkWord : ObjectClosure {
void do_object(oop obj) override {
! if (obj->is_self_forwarded()) {
- obj->unset_self_forwarded();
- } else if (obj->is_forwarded()) {
- // To restore the klass-bits in the header.
- // Needed for object iteration to work properly.
- obj->set_mark(obj->forwardee()->prototype_mark());
- }
}
} cl;
eden()->object_iterate(&cl);
from()->object_iterate(&cl);
}
// Will enter Full GC soon due to failed promotion. Must reset the mark word
// of objs in young-gen so that no objs are marked (forwarded) when Full GC
// starts. (The mark word is overloaded: `is_marked()` == `is_forwarded()`.)
struct ResetForwardedMarkWord : ObjectClosure {
void do_object(oop obj) override {
! obj->reset_forwarded();
}
} cl;
eden()->object_iterate(&cl);
from()->object_iterate(&cl);
}
}
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 = nullptr;
// Try allocating obj in to-space (unless too old)
if (old->age() < tenuring_threshold()) {
obj = cast_to_oop(to()->allocate(s));
}
oop DefNewGeneration::copy_to_survivor_space(oop old) {
assert(is_in_reserved(old) && !old->is_forwarded(),
"shouldn't be scavenging this oop");
! size_t old_size = old->size();
+ size_t s = old->copy_size(old_size, old->mark());
+
oop obj = nullptr;
// Try allocating obj in to-space (unless too old)
if (old->age() < tenuring_threshold()) {
obj = cast_to_oop(to()->allocate(s));
// Prefetch beyond obj
const intx interval = PrefetchCopyIntervalInBytes;
Prefetch::write(obj, interval);
// Copy obj
! Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(old), cast_from_oop<HeapWord*>(obj), s);
ContinuationGCSupport::transform_stack_chunk(obj);
if (!new_obj_is_tenured) {
// 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);
if (SerialStringDedup::is_candidate_from_evacuation(obj, new_obj_is_tenured)) {
// Record old; request adds a new weak reference, which reference
// Prefetch beyond obj
const intx interval = PrefetchCopyIntervalInBytes;
Prefetch::write(obj, interval);
// Copy obj
! Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(old), cast_from_oop<HeapWord*>(obj), old_size);
ContinuationGCSupport::transform_stack_chunk(obj);
if (!new_obj_is_tenured) {
// Increment age if obj still in new generation
obj->incr_age();
age_table()->add(obj, s);
}
+ obj->initialize_hash_if_necessary(old);
+
// Done, insert forward pointer to obj in this header
old->forward_to(obj);
if (SerialStringDedup::is_candidate_from_evacuation(obj, new_obj_is_tenured)) {
// Record old; request adds a new weak reference, which reference
< prev index next >