diff -r c97db0855565 -r 758c07667682 src/share/vm/memory/gcLocker.hpp --- a/src/share/vm/memory/gcLocker.hpp Tue Feb 04 17:38:01 2020 +0800 +++ b/src/share/vm/memory/gcLocker.hpp Tue Feb 04 18:13:14 2020 +0800 @@ -26,6 +26,7 @@ #define SHARE_VM_MEMORY_GCLOCKER_HPP #include "gc_interface/collectedHeap.hpp" +#include "gc_interface/gcCause.hpp" #include "memory/genCollectedHeap.hpp" #include "memory/universe.hpp" #include "oops/oop.hpp" @@ -57,6 +58,7 @@ static volatile bool _needs_gc; // heap is filling, we need a GC // note: bool is typedef'd as jint static volatile bool _doing_gc; // unlock_critical() is doing a GC + static uint _total_collections; // value for _gc_locker collection #ifdef ASSERT // This lock count is updated for all operations and is used to @@ -116,6 +118,12 @@ // Sets _needs_gc if is_active() is true. Returns is_active(). static bool check_active_before_gc(); + // Return true if the designated collection is a GCLocker request + // that should be discarded. Returns true if cause == GCCause::_gc_locker + // and the given total collection value indicates a collection has been + // done since the GCLocker request was made. + static bool should_discard(GCCause::Cause cause, uint total_collections); + // Stalls the caller (who should not be in a jni critical section) // until needs_gc() clears. Note however that needs_gc() may be // set at a subsequent safepoint and/or cleared under the