aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm/memory/genCollectedHeap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/vm/memory/genCollectedHeap.cpp')
-rw-r--r--src/share/vm/memory/genCollectedHeap.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/share/vm/memory/genCollectedHeap.cpp b/src/share/vm/memory/genCollectedHeap.cpp
index ddf0a860c..daa0a06bf 100644
--- a/src/share/vm/memory/genCollectedHeap.cpp
+++ b/src/share/vm/memory/genCollectedHeap.cpp
@@ -796,8 +796,11 @@ void GenCollectedHeap::collect(GCCause::Cause cause) {
#else // INCLUDE_ALL_GCS
ShouldNotReachHere();
#endif // INCLUDE_ALL_GCS
- } else if (cause == GCCause::_wb_young_gc) {
- // minor collection for WhiteBox API
+ } else if ((cause == GCCause::_wb_young_gc) ||
+ (cause == GCCause::_gc_locker)) {
+ // minor collection for WhiteBox or GCLocker.
+ // _gc_locker collections upgraded by GCLockerInvokesConcurrent
+ // are handled above and never discarded.
collect(cause, 0);
} else {
#ifdef ASSERT
@@ -835,6 +838,11 @@ void GenCollectedHeap::collect_locked(GCCause::Cause cause, int max_level) {
// Read the GC count while holding the Heap_lock
unsigned int gc_count_before = total_collections();
unsigned int full_gc_count_before = total_full_collections();
+
+ if (GC_locker::should_discard(cause, gc_count_before)) {
+ return;
+ }
+
{
MutexUnlocker mu(Heap_lock); // give up heap lock, execute gets it back
VM_GenCollectFull op(gc_count_before, full_gc_count_before,
@@ -887,24 +895,16 @@ void GenCollectedHeap::do_full_collection(bool clear_all_soft_refs) {
void GenCollectedHeap::do_full_collection(bool clear_all_soft_refs,
int max_level) {
- int local_max_level;
- if (!incremental_collection_will_fail(false /* don't consult_young */) &&
- gc_cause() == GCCause::_gc_locker) {
- local_max_level = 0;
- } else {
- local_max_level = max_level;
- }
do_collection(true /* full */,
clear_all_soft_refs /* clear_all_soft_refs */,
0 /* size */,
false /* is_tlab */,
- local_max_level /* max_level */);
+ max_level /* max_level */);
// Hack XXX FIX ME !!!
// A scavenge may not have been attempted, or may have
// been attempted and failed, because the old gen was too full
- if (local_max_level == 0 && gc_cause() == GCCause::_gc_locker &&
- incremental_collection_will_fail(false /* don't consult_young */)) {
+ if (gc_cause() == GCCause::_gc_locker && incremental_collection_failed()) {
if (PrintGCDetails) {
gclog_or_tty->print_cr("GC locker: Trying a full collection "
"because scavenge failed");