< prev index next > src/hotspot/share/gc/serial/defNewGeneration.cpp
Print this page
#include "gc/shared/gcLocker.hpp"
#include "gc/shared/gcPolicyCounters.hpp"
#include "gc/shared/gcTimer.hpp"
#include "gc/shared/gcTrace.hpp"
#include "gc/shared/gcTraceTime.inline.hpp"
- #include "gc/shared/preservedMarks.inline.hpp"
#include "gc/shared/referencePolicy.hpp"
#include "gc/shared/referenceProcessorPhaseTimes.hpp"
#include "gc/shared/space.hpp"
#include "gc/shared/spaceDecorator.hpp"
#include "gc/shared/strongRootsScope.hpp"
size_t min_size,
size_t max_size,
const char* policy)
: Generation(rs, initial_size),
_promotion_failed(false),
- _preserved_marks_set(false /* in_c_heap */),
_promo_failure_drain_in_progress(false),
_should_allocate_from_space(false),
_string_dedup_requests()
{
MemRegion cmr((HeapWord*)_virtual_space.low(),
// These can be shared for all code paths
IsAliveClosure is_alive(this);
age_table()->clear();
to()->clear(SpaceDecorator::Mangle);
- // The preserved marks should be empty at the start of the GC.
- _preserved_marks_set.init(1);
YoungGenScanClosure young_gen_cl(this);
OldGenScanClosure old_gen_cl(this);
FastEvacuateFollowersClosure evacuate_followers(heap,
_gc_tracer->report_promotion_failed(_promotion_failed_info);
// Reset the PromotionFailureALot counters.
NOT_PRODUCT(heap->reset_promotion_should_fail();)
}
- // We should have processed and cleared all the preserved marks.
- _preserved_marks_set.reclaim();
heap->trace_heap_after_gc(_gc_tracer);
_gc_timer->register_gc_end();
// 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_forwarded()) {
! obj->init_mark();
}
}
} cl;
eden()->object_iterate(&cl);
from()->object_iterate(&cl);
-
- restore_preserved_marks();
- }
-
- void DefNewGeneration::restore_preserved_marks() {
- _preserved_marks_set.restore(nullptr);
}
void DefNewGeneration::handle_promotion_failure(oop old) {
log_debug(gc, promotion)("Promotion failure size = " SIZE_FORMAT ") ", old->size());
_promotion_failed = true;
_promotion_failed_info.register_copy_failure(old->size());
- _preserved_marks_set.get()->push_if_necessary(old, old->mark());
ContinuationGCSupport::transform_stack_chunk(old);
// 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()
// 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()) {
+ obj->forward_safe_init_mark();
}
}
} cl;
eden()->object_iterate(&cl);
from()->object_iterate(&cl);
}
void DefNewGeneration::handle_promotion_failure(oop old) {
log_debug(gc, promotion)("Promotion failure size = " SIZE_FORMAT ") ", old->size());
_promotion_failed = true;
_promotion_failed_info.register_copy_failure(old->size());
ContinuationGCSupport::transform_stack_chunk(old);
// forward to self
! old->forward_to_self();
_promo_failure_scan_stack.push(old);
if (!_promo_failure_drain_in_progress) {
// prevent recursion in copy_to_survivor_space()
< prev index next >