src/share/vm/memory/collectorPolicy.hpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/memory/collectorPolicy.hpp Fri Oct 25 15:32:44 2013
--- new/src/share/vm/memory/collectorPolicy.hpp Fri Oct 25 15:32:44 2013
*** 59,79 ****
--- 59,85 ----
class CollectorPolicy : public CHeapObj<mtGC> {
protected:
GCPolicyCounters* _gc_policy_counters;
// Requires that the concrete subclass sets the alignment constraints
// before calling.
+ virtual void initialize_alignments();
virtual void initialize_flags();
virtual void initialize_size_info();
+ virtual void assert_flags();
+ virtual void assert_size_info();
+
size_t _initial_heap_byte_size;
size_t _max_heap_byte_size;
size_t _min_heap_byte_size;
! size_t _min_alignment;
! size_t _max_alignment;
! size_t _space_alignment;
! size_t _heap_alignment;
+
+ // Needed to keep information if MaxHeapSize was set on the command line
+ // when the flag value is aligned etc by ergonomics
+ bool _max_heap_size_cmdline;
// The sizing of the heap are controlled by a sizing policy.
AdaptiveSizePolicy* _size_policy;
// Set to true when policy wants soft refs cleared.
*** 85,111 ****
--- 91,114 ----
// set to false each time gc returns to the mutator. For example, in the
// ParallelScavengeHeap case the latter would be done toward the end of
// mem_allocate() where it returns op.result()
bool _all_soft_refs_clear;
! CollectorPolicy() :
_min_alignment(1),
_max_alignment(1),
_initial_heap_byte_size(0),
_max_heap_byte_size(0),
_min_heap_byte_size(0),
_size_policy(NULL),
_should_clear_all_soft_refs(false),
_all_soft_refs_clear(false)
{}
! CollectorPolicy();
public:
+ virtual void initialize_all() {
+ initialize_alignments();
+ initialize_flags();
+ initialize_size_info();
+ }
+
// Return maximum heap alignment that may be imposed by the policy
! static size_t compute_max_alignment();
! static size_t compute_heap_alignment();
! size_t min_alignment() { return _min_alignment; }
! size_t max_alignment() { return _max_alignment; }
! size_t space_alignment() { return _space_alignment; }
! size_t heap_alignment() { return _heap_alignment; }
size_t initial_heap_byte_size() { return _initial_heap_byte_size; }
size_t max_heap_byte_size() { return _max_heap_byte_size; }
size_t min_heap_byte_size() { return _min_heap_byte_size; }
*** 193,202 ****
--- 196,208 ----
// Returns true if a collector has eden space with soft end.
virtual bool has_soft_ended_eden() {
return false;
}
+ // Do any updates required to global flags that are due to heap initialization
+ // changes
+ virtual void post_heap_initialize() = 0;
};
class ClearedAllSoftRefs : public StackObj {
bool _clear_all_soft_refs;
CollectorPolicy* _collector_policy;
*** 217,271 ****
--- 223,292 ----
protected:
size_t _min_gen0_size;
size_t _initial_gen0_size;
size_t _max_gen0_size;
+ // _gen_alignment and _space_alignment will have the same value most of the
+ // time. When using large pages they can differ.
+ size_t _gen_alignment;
+
GenerationSpec **_generations;
// Return true if an allocation should be attempted in the older
// generation if it fails in the younger generation. Return
// false, otherwise.
virtual bool should_try_older_generation_allocation(size_t word_size) const;
+ void initialize_alignments();
void initialize_flags();
void initialize_size_info();
+ void assert_flags();
+ void assert_size_info();
+
// Try to allocate space by expanding the heap.
virtual HeapWord* expand_heap_and_allocate(size_t size, bool is_tlab);
// Scale the base_size by NewRation according to
+ // Compute max heap alignment
+ size_t compute_max_alignment();
+
+ // Scale the base_size by NewRatio according to
// result = base_size / (NewRatio + 1)
// and align by min_alignment()
size_t scale_by_NewRatio_aligned(size_t base_size);
! // Bound the value by the given maximum minus the min_alignment
// min_alignment.
size_t bound_minus_alignment(size_t desired_size, size_t maximum_size);
public:
+ GenCollectorPolicy() : CollectorPolicy(), _min_gen0_size(0), _initial_gen0_size(0),
+ _max_gen0_size(0), _generations(NULL) {}
+
// Accessors
size_t min_gen0_size() { return _min_gen0_size; }
size_t initial_gen0_size() { return _initial_gen0_size; }
size_t max_gen0_size() { return _max_gen0_size; }
+ size_t gen_alignment() { return _gen_alignment; }
virtual int number_of_generations() = 0;
virtual GenerationSpec **generations() {
assert(_generations != NULL, "Sanity check");
return _generations;
}
virtual GenCollectorPolicy* as_generation_policy() { return this; }
! virtual void initialize_generations() = 0;
! virtual void initialize_generations() { };
virtual void initialize_all() {
! initialize_flags();
initialize_size_info();
! CollectorPolicy::initialize_all();
initialize_generations();
}
+ size_t young_gen_size_lower_bound();
+
HeapWord* mem_allocate_work(size_t size,
bool is_tlab,
bool* gc_overhead_limit_was_exceeded);
HeapWord *satisfy_failed_allocation(size_t size, bool is_tlab);
*** 273,285 ****
--- 294,309 ----
// Adaptive size policy
virtual void initialize_size_policy(size_t init_eden_size,
size_t init_promo_size,
size_t init_survivor_size);
// The alignment used for eden and survivors within the young gen
// and for boundary between young gen and old gen.
static size_t intra_heap_alignment() {
+ virtual void post_heap_initialize() {
+ assert(_max_gen0_size == MaxNewSize, "Should be taken care of by initialize_size_info");
+ }
+
+ // The alignment used for boundary between young gen and old gen
+ static size_t default_gen_alignment() {
return 64 * K * HeapWordSize;
}
};
// All of hotspot's current collectors are subtypes of this
*** 294,306 ****
--- 318,335 ----
size_t _initial_gen1_size;
size_t _max_gen1_size;
void initialize_flags();
void initialize_size_info();
void initialize_generations() { ShouldNotReachHere(); }
+
+ void assert_flags();
+ void assert_size_info();
public:
+ TwoGenerationCollectorPolicy() : GenCollectorPolicy(), _min_gen1_size(0),
+ _initial_gen1_size(0), _max_gen1_size(0) {}
+
// Accessors
size_t min_gen1_size() { return _min_gen1_size; }
size_t initial_gen1_size() { return _initial_gen1_size; }
size_t max_gen1_size() { return _max_gen1_size; }
*** 322,332 ****
--- 351,361 ----
class MarkSweepPolicy : public TwoGenerationCollectorPolicy {
protected:
void initialize_generations();
public:
! MarkSweepPolicy();
! MarkSweepPolicy() {}
MarkSweepPolicy* as_mark_sweep_policy() { return this; }
void initialize_gc_policy_counters();
};
src/share/vm/memory/collectorPolicy.hpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File