< prev index next >
src/hotspot/share/gc/shared/genCollectedHeap.hpp
Print this page
*** 25,45 ****
#ifndef SHARE_VM_GC_SHARED_GENCOLLECTEDHEAP_HPP
#define SHARE_VM_GC_SHARED_GENCOLLECTEDHEAP_HPP
#include "gc/shared/adaptiveSizePolicy.hpp"
#include "gc/shared/collectedHeap.hpp"
- #include "gc/shared/collectorPolicy.hpp"
#include "gc/shared/generation.hpp"
class StrongRootsScope;
class SubTasksDone;
class WorkGang;
// A "GenCollectedHeap" is a CollectedHeap that uses generational
// collection. It has two generations, young and old.
class GenCollectedHeap : public CollectedHeap {
- friend class GenCollectorPolicy;
friend class Generation;
friend class DefNewGeneration;
friend class TenuredGeneration;
friend class ConcurrentMarkSweepGeneration;
friend class CMSCollector;
--- 25,48 ----
#ifndef SHARE_VM_GC_SHARED_GENCOLLECTEDHEAP_HPP
#define SHARE_VM_GC_SHARED_GENCOLLECTEDHEAP_HPP
#include "gc/shared/adaptiveSizePolicy.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/generation.hpp"
+ #include "gc/shared/genSettings.hpp"
+ #include "gc/shared/softRefGenPolicy.hpp"
+ class CardTableRS;
+ class GCPolicyCounters;
+ class SoftRefGenPolicy;
class StrongRootsScope;
class SubTasksDone;
class WorkGang;
// A "GenCollectedHeap" is a CollectedHeap that uses generational
// collection. It has two generations, young and old.
class GenCollectedHeap : public CollectedHeap {
friend class Generation;
friend class DefNewGeneration;
friend class TenuredGeneration;
friend class ConcurrentMarkSweepGeneration;
friend class CMSCollector;
*** 59,76 ****
YoungGen,
OldGen
};
private:
Generation* _young_gen;
Generation* _old_gen;
// The singleton CardTable Remembered Set.
CardTableRS* _rem_set;
! // The generational collector policy.
! GenCollectorPolicy* _gen_policy;
// Indicates that the most recent previous incremental collection failed.
// The flag is cleared when an action is taken that might clear the
// condition that caused that incremental collection to fail.
bool _incremental_collection_failed;
--- 62,88 ----
YoungGen,
OldGen
};
private:
+ const GenSettings _settings;
+
Generation* _young_gen;
Generation* _old_gen;
+ GenerationSpec* _young_gen_spec;
+ GenerationSpec* _old_gen_spec;
+
// The singleton CardTable Remembered Set.
CardTableRS* _rem_set;
! // The sizing of the heap is controlled by a sizing policy.
! AdaptiveSizePolicy* _size_policy;
!
! SoftRefGenPolicy _soft_ref_gen_policy;
!
! GCPolicyCounters* _gc_policy_counters;
// Indicates that the most recent previous incremental collection failed.
// The flag is cleared when an action is taken that might clear the
// condition that caused that incremental collection to fail.
bool _incremental_collection_failed;
*** 82,92 ****
void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
bool run_verification, bool clear_soft_refs,
bool restore_marks_for_biased_locking);
// Reserve aligned space for the heap as needed by the contained generations.
! char* allocate(size_t alignment, ReservedSpace* heap_rs);
// Initialize ("weak") refs processing support
void ref_processing_init();
protected:
--- 94,104 ----
void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
bool run_verification, bool clear_soft_refs,
bool restore_marks_for_biased_locking);
// Reserve aligned space for the heap as needed by the contained generations.
! char* allocate(size_t alignment, size_t min_heap_byte_size, ReservedSpace* heap_rs);
// Initialize ("weak") refs processing support
void ref_processing_init();
protected:
*** 141,177 ****
// Does the "cause" of GC indicate that
// we absolutely __must__ clear soft refs?
bool must_clear_all_soft_refs();
! GenCollectedHeap(GenCollectorPolicy *policy);
virtual void check_gen_kinds() = 0;
public:
// Returns JNI_OK on success
virtual jint initialize();
// Does operations required after initialization has been done.
void post_initialize();
Generation* young_gen() const { return _young_gen; }
Generation* old_gen() const { return _old_gen; }
bool is_young_gen(const Generation* gen) const { return gen == _young_gen; }
bool is_old_gen(const Generation* gen) const { return gen == _old_gen; }
! // The generational collector policy.
! GenCollectorPolicy* gen_policy() const { return _gen_policy; }
!
! virtual CollectorPolicy* collector_policy() const { return gen_policy(); }
// Adaptive size policy
! virtual AdaptiveSizePolicy* size_policy() {
! return gen_policy()->size_policy();
! }
// Return the (conservative) maximum heap alignment
static size_t conservative_max_heap_alignment() {
return Generation::GenGrain;
}
--- 153,207 ----
// Does the "cause" of GC indicate that
// we absolutely __must__ clear soft refs?
bool must_clear_all_soft_refs();
! GenCollectedHeap(const GenSettings& settings,
! Generation::Name young,
! Generation::Name old);
virtual void check_gen_kinds() = 0;
public:
// Returns JNI_OK on success
virtual jint initialize();
+ virtual void initialize_size_policy(size_t init_eden_size,
+ size_t init_promo_size,
+ size_t init_survivor_size);
+
+ // Create the jstat counters for the GC policy.
+ virtual void initialize_gc_policy_counters() = 0;
+
+ void initialize_gc_policy_counters_helper(const char* name);
+ void initialize_generations(Generation::Name young,
+ Generation::Name old,
+ const GenSettings& s);
+
// Does operations required after initialization has been done.
void post_initialize();
+ virtual size_t space_alignment() const;
+ virtual size_t heap_alignment() const;
+
Generation* young_gen() const { return _young_gen; }
Generation* old_gen() const { return _old_gen; }
bool is_young_gen(const Generation* gen) const { return gen == _young_gen; }
bool is_old_gen(const Generation* gen) const { return gen == _old_gen; }
! virtual SoftRefPolicy* soft_ref_policy();
// Adaptive size policy
! virtual AdaptiveSizePolicy* size_policy();
!
! GenerationSpec* young_gen_spec() const;
! GenerationSpec* old_gen_spec() const;
!
! // Performance Counter support
! GCPolicyCounters* counters();
// Return the (conservative) maximum heap alignment
static size_t conservative_max_heap_alignment() {
return Generation::GenGrain;
}
*** 454,463 ****
--- 484,502 ----
oop obj,
size_t obj_size);
private:
+ // Return true if an allocation should be attempted in the older generation
+ // if it fails in the younger generation. Return false, otherwise.
+ bool should_try_older_generation_allocation(size_t word_size) const;
+
+ // Try to allocate space by expanding the heap.
+ virtual HeapWord* expand_heap_and_allocate(size_t size, bool is_tlab);
+
+ HeapWord* mem_allocate_work(size_t size, bool is_tlab, bool* gc_overhead_limit_was_exceeded);
+
// Override
void check_for_non_bad_heap_word_value(HeapWord* addr,
size_t size) PRODUCT_RETURN;
// For use by mark-sweep. As implemented, mark-sweep-compact is global
< prev index next >