提交 7830f2dd 编写于 作者: J jcoomes

7146343: PS invoke methods should indicate the type of gc done

Reviewed-by: stefank, jmasa
上级 33a49849
...@@ -100,12 +100,12 @@ void PSMarkSweep::invoke(bool maximum_heap_compaction) { ...@@ -100,12 +100,12 @@ void PSMarkSweep::invoke(bool maximum_heap_compaction) {
// This method contains no policy. You should probably // This method contains no policy. You should probably
// be calling invoke() instead. // be calling invoke() instead.
void PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) { bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
assert(ref_processor() != NULL, "Sanity"); assert(ref_processor() != NULL, "Sanity");
if (GC_locker::check_active_before_gc()) { if (GC_locker::check_active_before_gc()) {
return; return false;
} }
ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
...@@ -382,6 +382,8 @@ void PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) { ...@@ -382,6 +382,8 @@ void PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
#ifdef TRACESPINNING #ifdef TRACESPINNING
ParallelTaskTerminator::print_termination_counts(); ParallelTaskTerminator::print_termination_counts();
#endif #endif
return true;
} }
bool PSMarkSweep::absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_policy, bool PSMarkSweep::absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_policy,
......
/* /*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -78,7 +78,7 @@ class PSMarkSweep : public MarkSweep { ...@@ -78,7 +78,7 @@ class PSMarkSweep : public MarkSweep {
public: public:
static void invoke(bool clear_all_softrefs); static void invoke(bool clear_all_softrefs);
static void invoke_no_policy(bool clear_all_softrefs); static bool invoke_no_policy(bool clear_all_softrefs);
static void initialize(); static void initialize();
......
...@@ -1993,12 +1993,12 @@ bool ParallelCompactData::region_contains(size_t region_index, HeapWord* addr) { ...@@ -1993,12 +1993,12 @@ bool ParallelCompactData::region_contains(size_t region_index, HeapWord* addr) {
// This method contains no policy. You should probably // This method contains no policy. You should probably
// be calling invoke() instead. // be calling invoke() instead.
void PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
assert(ref_processor() != NULL, "Sanity"); assert(ref_processor() != NULL, "Sanity");
if (GC_locker::check_active_before_gc()) { if (GC_locker::check_active_before_gc()) {
return; return false;
} }
TimeStamp marking_start; TimeStamp marking_start;
...@@ -2248,6 +2248,8 @@ void PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { ...@@ -2248,6 +2248,8 @@ void PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
#ifdef TRACESPINNING #ifdef TRACESPINNING
ParallelTaskTerminator::print_termination_counts(); ParallelTaskTerminator::print_termination_counts();
#endif #endif
return true;
} }
bool PSParallelCompact::absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_policy, bool PSParallelCompact::absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_policy,
......
/* /*
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -1057,7 +1057,7 @@ class PSParallelCompact : AllStatic { ...@@ -1057,7 +1057,7 @@ class PSParallelCompact : AllStatic {
} }
static void invoke(bool maximum_heap_compaction); static void invoke(bool maximum_heap_compaction);
static void invoke_no_policy(bool maximum_heap_compaction); static bool invoke_no_policy(bool maximum_heap_compaction);
static void post_initialize(); static void post_initialize();
// Perform initialization for PSParallelCompact that requires // Perform initialization for PSParallelCompact that requires
......
...@@ -215,36 +215,41 @@ void PSRefProcTaskExecutor::execute(EnqueueTask& task) ...@@ -215,36 +215,41 @@ void PSRefProcTaskExecutor::execute(EnqueueTask& task)
// //
// Note that this method should only be called from the vm_thread while // Note that this method should only be called from the vm_thread while
// at a safepoint! // at a safepoint!
void PSScavenge::invoke() { bool PSScavenge::invoke() {
assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint"); assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread"); assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread");
assert(!Universe::heap()->is_gc_active(), "not reentrant"); assert(!Universe::heap()->is_gc_active(), "not reentrant");
ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); ParallelScavengeHeap* const heap = (ParallelScavengeHeap*)Universe::heap();
assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
PSAdaptiveSizePolicy* policy = heap->size_policy(); PSAdaptiveSizePolicy* policy = heap->size_policy();
IsGCActiveMark mark; IsGCActiveMark mark;
bool scavenge_was_done = PSScavenge::invoke_no_policy(); const bool scavenge_done = PSScavenge::invoke_no_policy();
const bool need_full_gc = !scavenge_done ||
policy->should_full_GC(heap->old_gen()->free_in_bytes());
bool full_gc_done = false;
PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters(); if (UsePerfData) {
if (UsePerfData) PSGCAdaptivePolicyCounters* const counters = heap->gc_policy_counters();
counters->update_full_follows_scavenge(0); const int ffs_val = need_full_gc ? full_follows_scavenge : not_skipped;
if (!scavenge_was_done || counters->update_full_follows_scavenge(ffs_val);
policy->should_full_GC(heap->old_gen()->free_in_bytes())) { }
if (UsePerfData)
counters->update_full_follows_scavenge(full_follows_scavenge); if (need_full_gc) {
GCCauseSetter gccs(heap, GCCause::_adaptive_size_policy); GCCauseSetter gccs(heap, GCCause::_adaptive_size_policy);
CollectorPolicy* cp = heap->collector_policy(); CollectorPolicy* cp = heap->collector_policy();
const bool clear_all_softrefs = cp->should_clear_all_soft_refs(); const bool clear_all_softrefs = cp->should_clear_all_soft_refs();
if (UseParallelOldGC) { if (UseParallelOldGC) {
PSParallelCompact::invoke_no_policy(clear_all_softrefs); full_gc_done = PSParallelCompact::invoke_no_policy(clear_all_softrefs);
} else { } else {
PSMarkSweep::invoke_no_policy(clear_all_softrefs); full_gc_done = PSMarkSweep::invoke_no_policy(clear_all_softrefs);
} }
} }
return full_gc_done;
} }
// This method contains no policy. You should probably // This method contains no policy. You should probably
......
...@@ -117,10 +117,9 @@ class PSScavenge: AllStatic { ...@@ -117,10 +117,9 @@ class PSScavenge: AllStatic {
// Called by parallelScavengeHeap to init the tenuring threshold // Called by parallelScavengeHeap to init the tenuring threshold
static void initialize(); static void initialize();
// Scavenge entry point // Scavenge entry point. This may invoke a full gc; return true if so.
static void invoke(); static bool invoke();
// Return true is a collection was done. Return // Return true if a collection was done; false otherwise.
// false if the collection was skipped.
static bool invoke_no_policy(); static bool invoke_no_policy();
// If an attempt to promote fails, this method is invoked // If an attempt to promote fails, this method is invoked
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册