/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "gc_implementation/parallelScavenge/psVirtualspace.hpp"
#include "gc_implementation/shared/collectorCounters.hpp"
#include "gc_implementation/shared/gcTrace.hpp"
#include "memory/allocation.hpp"
class GCTaskManager;
class GCTaskQueue;
class OopStack;
class ReferenceProcessor;
class ParallelScavengeHeap;
class ParallelScavengeTracer;
class PSIsAliveClosure;
class PSRefProcTaskExecutor;
class STWGCTimer;
friend class PSIsAliveClosure;
friend class PSKeepAliveClosure;
friend class PSPromotionManager;
enum ScavengeSkippedCause {
not_skipped = 0,
};
// Saved value of to_space->top(), used to prevent objects in to_space from
// being rescanned.
// Number of consecutive attempts to scavenge that were skipped
static int _consecutive_skipped_scavenges;
protected:
// This is used to decide if an oop should be scavenged,
// cards should be marked, etc.
static Stack<markOop, mtGC> _preserved_mark_stack; // List of marks to be restored after failed promotion
static void clean_up_failed_promotion();
static bool should_attempt_scavenge();
static inline void save_to_space_top_before_gc();
// Private accessors
static CardTableExtension* const card_table() { assert(_card_table != NULL, "Sanity"); return _card_table; }
public:
// Accessors
static int consecutive_skipped_scavenges()
{ return _consecutive_skipped_scavenges; }
// Performance Counters
// Used by scavenge_contents && psMarkSweep
return _ref_processor;
}
// Used to add tasks
static GCTaskManager* const gc_task_manager();
// The promotion managers tell us if they encountered overflow
}
// Adaptive size policy support. When the young generation/old generation
// boundary moves, _young_generation_boundary must be reset
}
// Called by parallelScavengeHeap to init the tenuring threshold
static void initialize();
// Scavenge entry point. This may invoke a full gc; return true if so.
static bool invoke();
// Return true if a collection was done; false otherwise.
static bool invoke_no_policy();
// If an attempt to promote fails, this method is invoked
template <class T> static inline bool should_scavenge(T* p);
// These call should_scavenge() above and, if it returns true, also check that
// the object was not newly copied into to_space. The version with the bool
// argument is a convenience wrapper that fetches the to_space pointer from
// the heap and calls the other version (if the arg is true).
template <class T> static inline bool should_scavenge(T* p, bool check_to_space);
template <class T, bool promote_immediately>
// Is an object in the young generation
// This assumes that the HeapWord argument is in the heap,
// so it only checks one side of the complete predicate.
return result;
}
};
#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_HPP