8066566: Refactor ParNewGeneration to contain ParNewTracer
Reviewed-by: ehelin, kbarrett
This commit is contained in:
parent
2c63608419
commit
20bfd4cf7c
@ -308,7 +308,7 @@ public:
|
||||
|
||||
inline ParScanThreadState& thread_state(int i);
|
||||
|
||||
void trace_promotion_failed(YoungGCTracer& gc_tracer);
|
||||
void trace_promotion_failed(const YoungGCTracer* gc_tracer);
|
||||
void reset(int active_workers, bool promotion_failed);
|
||||
void flush();
|
||||
|
||||
@ -357,10 +357,10 @@ inline ParScanThreadState& ParScanThreadStateSet::thread_state(int i)
|
||||
return ((ParScanThreadState*)_data)[i];
|
||||
}
|
||||
|
||||
void ParScanThreadStateSet::trace_promotion_failed(YoungGCTracer& gc_tracer) {
|
||||
void ParScanThreadStateSet::trace_promotion_failed(const YoungGCTracer* gc_tracer) {
|
||||
for (int i = 0; i < length(); ++i) {
|
||||
if (thread_state(i).promotion_failed()) {
|
||||
gc_tracer.report_promotion_failed(thread_state(i).promotion_failed_info());
|
||||
gc_tracer->report_promotion_failed(thread_state(i).promotion_failed_info());
|
||||
thread_state(i).promotion_failed_info().reset();
|
||||
}
|
||||
}
|
||||
@ -883,7 +883,7 @@ void EvacuateFollowersClosureGeneral::do_void() {
|
||||
|
||||
// A Generation that does parallel young-gen collection.
|
||||
|
||||
void ParNewGeneration::handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set, ParNewTracer& gc_tracer) {
|
||||
void ParNewGeneration::handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set) {
|
||||
assert(_promo_failure_scan_stack.is_empty(), "post condition");
|
||||
_promo_failure_scan_stack.clear(true); // Clear cached segments.
|
||||
|
||||
@ -899,10 +899,10 @@ void ParNewGeneration::handle_promotion_failed(GenCollectedHeap* gch, ParScanThr
|
||||
_next_gen->promotion_failure_occurred();
|
||||
|
||||
// Trace promotion failure in the parallel GC threads
|
||||
thread_state_set.trace_promotion_failed(gc_tracer);
|
||||
thread_state_set.trace_promotion_failed(gc_tracer());
|
||||
// Single threaded code may have reported promotion failure to the global state
|
||||
if (_promotion_failed_info.has_failed()) {
|
||||
gc_tracer.report_promotion_failed(_promotion_failed_info);
|
||||
_gc_tracer.report_promotion_failed(_promotion_failed_info);
|
||||
}
|
||||
// Reset the PromotionFailureALot counters.
|
||||
NOT_PRODUCT(Universe::heap()->reset_promotion_should_fail();)
|
||||
@ -941,9 +941,8 @@ void ParNewGeneration::collect(bool full,
|
||||
}
|
||||
assert(to()->is_empty(), "Else not collection_attempt_is_safe");
|
||||
|
||||
ParNewTracer gc_tracer;
|
||||
gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start());
|
||||
gch->trace_heap_before_gc(&gc_tracer);
|
||||
_gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start());
|
||||
gch->trace_heap_before_gc(gc_tracer());
|
||||
|
||||
init_assuming_no_promotion_failure();
|
||||
|
||||
@ -952,7 +951,7 @@ void ParNewGeneration::collect(bool full,
|
||||
size_policy->minor_collection_begin();
|
||||
}
|
||||
|
||||
GCTraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL, gc_tracer.gc_id());
|
||||
GCTraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL, _gc_tracer.gc_id());
|
||||
// Capture heap used before collection (for printing).
|
||||
size_t gch_prev_used = gch->used();
|
||||
|
||||
@ -994,7 +993,7 @@ void ParNewGeneration::collect(bool full,
|
||||
|
||||
// Trace and reset failed promotion info.
|
||||
if (promotion_failed()) {
|
||||
thread_state_set.trace_promotion_failed(gc_tracer);
|
||||
thread_state_set.trace_promotion_failed(gc_tracer());
|
||||
}
|
||||
|
||||
// Process (weak) reference objects found during scavenge.
|
||||
@ -1015,16 +1014,16 @@ void ParNewGeneration::collect(bool full,
|
||||
ParNewRefProcTaskExecutor task_executor(*this, thread_state_set);
|
||||
stats = rp->process_discovered_references(&is_alive, &keep_alive,
|
||||
&evacuate_followers, &task_executor,
|
||||
_gc_timer, gc_tracer.gc_id());
|
||||
_gc_timer, _gc_tracer.gc_id());
|
||||
} else {
|
||||
thread_state_set.flush();
|
||||
gch->set_par_threads(0); // 0 ==> non-parallel.
|
||||
gch->save_marks();
|
||||
stats = rp->process_discovered_references(&is_alive, &keep_alive,
|
||||
&evacuate_followers, NULL,
|
||||
_gc_timer, gc_tracer.gc_id());
|
||||
_gc_timer, _gc_tracer.gc_id());
|
||||
}
|
||||
gc_tracer.report_gc_reference_stats(stats);
|
||||
_gc_tracer.report_gc_reference_stats(stats);
|
||||
if (!promotion_failed()) {
|
||||
// Swap the survivor spaces.
|
||||
eden()->clear(SpaceDecorator::Mangle);
|
||||
@ -1049,7 +1048,7 @@ void ParNewGeneration::collect(bool full,
|
||||
|
||||
adjust_desired_tenuring_threshold();
|
||||
} else {
|
||||
handle_promotion_failed(gch, thread_state_set, gc_tracer);
|
||||
handle_promotion_failed(gch, thread_state_set);
|
||||
}
|
||||
// set new iteration safe limit for the survivor spaces
|
||||
from()->set_concurrent_iteration_safe_limit(from()->top());
|
||||
@ -1088,12 +1087,12 @@ void ParNewGeneration::collect(bool full,
|
||||
}
|
||||
rp->verify_no_references_recorded();
|
||||
|
||||
gch->trace_heap_after_gc(&gc_tracer);
|
||||
gc_tracer.report_tenuring_threshold(tenuring_threshold());
|
||||
gch->trace_heap_after_gc(gc_tracer());
|
||||
_gc_tracer.report_tenuring_threshold(tenuring_threshold());
|
||||
|
||||
_gc_timer->register_gc_end();
|
||||
|
||||
gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
|
||||
_gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
|
||||
}
|
||||
|
||||
static int sum;
|
||||
|
@ -333,6 +333,9 @@ class ParNewGeneration: public DefNewGeneration {
|
||||
// references to live referent.
|
||||
DefNewGeneration::IsAliveClosure _is_alive_closure;
|
||||
|
||||
// GC tracer that should be used during collection.
|
||||
ParNewTracer _gc_tracer;
|
||||
|
||||
static oop real_forwardee_slow(oop obj);
|
||||
static void waste_some_time();
|
||||
|
||||
@ -340,7 +343,7 @@ class ParNewGeneration: public DefNewGeneration {
|
||||
// word being overwritten with a self-forwarding-pointer.
|
||||
void preserve_mark_if_necessary(oop obj, markOop m);
|
||||
|
||||
void handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set, ParNewTracer& gc_tracer);
|
||||
void handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set);
|
||||
|
||||
protected:
|
||||
|
||||
@ -411,6 +414,10 @@ class ParNewGeneration: public DefNewGeneration {
|
||||
return _plab_stats.desired_plab_sz();
|
||||
}
|
||||
|
||||
const ParNewTracer* gc_tracer() const {
|
||||
return &_gc_tracer;
|
||||
}
|
||||
|
||||
static oop real_forwardee(oop obj);
|
||||
|
||||
DEBUG_ONLY(static bool is_legal_forward_ptr(oop p);)
|
||||
|
@ -663,7 +663,7 @@ void ParallelScavengeHeap::print_heap_change(size_t prev_used) {
|
||||
}
|
||||
}
|
||||
|
||||
void ParallelScavengeHeap::trace_heap(GCWhen::Type when, GCTracer* gc_tracer) {
|
||||
void ParallelScavengeHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) {
|
||||
const PSHeapSummary& heap_summary = create_ps_heap_summary();
|
||||
gc_tracer->report_gc_heap_summary(when, heap_summary);
|
||||
|
||||
|
@ -64,7 +64,7 @@ class ParallelScavengeHeap : public CollectedHeap {
|
||||
// The task manager
|
||||
static GCTaskManager* _gc_task_manager;
|
||||
|
||||
void trace_heap(GCWhen::Type when, GCTracer* tracer);
|
||||
void trace_heap(GCWhen::Type when, const GCTracer* tracer);
|
||||
|
||||
protected:
|
||||
static inline size_t total_invocations();
|
||||
|
@ -162,7 +162,7 @@ void YoungGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* t
|
||||
_tenuring_threshold = UNSET_TENURING_THRESHOLD;
|
||||
}
|
||||
|
||||
void YoungGCTracer::report_promotion_failed(const PromotionFailedInfo& pf_info) {
|
||||
void YoungGCTracer::report_promotion_failed(const PromotionFailedInfo& pf_info) const {
|
||||
assert_set_gc_id();
|
||||
|
||||
send_promotion_failed_event(pf_info);
|
||||
|
@ -153,7 +153,7 @@ class YoungGCTracer : public GCTracer {
|
||||
virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
|
||||
|
||||
public:
|
||||
void report_promotion_failed(const PromotionFailedInfo& pf_info);
|
||||
void report_promotion_failed(const PromotionFailedInfo& pf_info) const;
|
||||
void report_tenuring_threshold(const uint tenuring_threshold);
|
||||
|
||||
/*
|
||||
|
@ -132,7 +132,7 @@ void CollectedHeap::unregister_nmethod(nmethod* nm) {
|
||||
assert_locked_or_safepoint(CodeCache_lock);
|
||||
}
|
||||
|
||||
void CollectedHeap::trace_heap(GCWhen::Type when, GCTracer* gc_tracer) {
|
||||
void CollectedHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) {
|
||||
const GCHeapSummary& heap_summary = create_heap_summary();
|
||||
gc_tracer->report_gc_heap_summary(when, heap_summary);
|
||||
|
||||
@ -140,11 +140,11 @@ void CollectedHeap::trace_heap(GCWhen::Type when, GCTracer* gc_tracer) {
|
||||
gc_tracer->report_metaspace_summary(when, metaspace_summary);
|
||||
}
|
||||
|
||||
void CollectedHeap::trace_heap_before_gc(GCTracer* gc_tracer) {
|
||||
void CollectedHeap::trace_heap_before_gc(const GCTracer* gc_tracer) {
|
||||
trace_heap(GCWhen::BeforeGC, gc_tracer);
|
||||
}
|
||||
|
||||
void CollectedHeap::trace_heap_after_gc(GCTracer* gc_tracer) {
|
||||
void CollectedHeap::trace_heap_after_gc(const GCTracer* gc_tracer) {
|
||||
trace_heap(GCWhen::AfterGC, gc_tracer);
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ class CollectedHeap : public CHeapObj<mtInternal> {
|
||||
// Fill with a single object (either an int array or a java.lang.Object).
|
||||
static inline void fill_with_object_impl(HeapWord* start, size_t words, bool zap = true);
|
||||
|
||||
virtual void trace_heap(GCWhen::Type when, GCTracer* tracer);
|
||||
virtual void trace_heap(GCWhen::Type when, const GCTracer* tracer);
|
||||
|
||||
// Verification functions
|
||||
virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size)
|
||||
@ -606,8 +606,8 @@ class CollectedHeap : public CHeapObj<mtInternal> {
|
||||
virtual void register_nmethod(nmethod* nm);
|
||||
virtual void unregister_nmethod(nmethod* nm);
|
||||
|
||||
void trace_heap_before_gc(GCTracer* gc_tracer);
|
||||
void trace_heap_after_gc(GCTracer* gc_tracer);
|
||||
void trace_heap_before_gc(const GCTracer* gc_tracer);
|
||||
void trace_heap_after_gc(const GCTracer* gc_tracer);
|
||||
|
||||
// Heap verification
|
||||
virtual void verify(bool silent, VerifyOption option) = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user