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 Thu Sep 19 22:40:50 2013
--- new/src/share/vm/memory/collectorPolicy.hpp Thu Sep 19 22:40:50 2013
*** 64,80 ****
--- 64,89 ----
// Requires that the concrete subclass sets the alignment constraints
// before calling.
virtual void initialize_flags();
virtual void initialize_size_info();
+ virtual void initialize_all() {
+ initialize_flags();
+ initialize_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;
+ // 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 is controlled by a sizing policy.
AdaptiveSizePolicy* _size_policy;
// Set to true when policy wants soft refs cleared.
// Reset to false by gc after it clears all soft refs.
*** 91,100 ****
--- 100,110 ----
_min_alignment(1),
_max_alignment(1),
_initial_heap_byte_size(0),
_max_heap_byte_size(0),
_min_heap_byte_size(0),
+ _max_heap_size_cmdline(false),
_size_policy(NULL),
_should_clear_all_soft_refs(false),
_all_soft_refs_clear(false)
{}
*** 194,203 ****
--- 204,216 ----
// 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;
*** 231,264 ****
--- 244,287 ----
void initialize_size_info();
// Try to allocate space by expanding the heap.
virtual HeapWord* expand_heap_and_allocate(size_t size, bool is_tlab);
+ // 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.
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; }
+
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();
}
HeapWord* mem_allocate_work(size_t size,
bool is_tlab,
*** 268,277 ****
--- 291,314 ----
// Adaptive size policy
virtual void initialize_size_policy(size_t init_eden_size,
size_t init_promo_size,
size_t init_survivor_size);
+
+ virtual void post_heap_initialize() {
+ // update global variables as required
+ assert(_max_gen0_size == MaxNewSize, "Wasn't this taken care of earlier?");
+ if (_max_gen0_size != MaxNewSize) {
+ FLAG_SET_ERGO(uintx, MaxNewSize, _max_gen0_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() {
+ return 64 * K * HeapWordSize;
+ }
};
// All of hotspot's current collectors are subtypes of this
// class. Currently, these collectors all use the same gen[0],
// but have different gen[1] types. If we add another subtype
*** 284,296 ****
--- 321,340 ----
size_t _initial_gen1_size;
size_t _max_gen1_size;
void initialize_flags();
void initialize_size_info();
void initialize_generations() { ShouldNotReachHere(); }
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; }
+
// Inherited methods
TwoGenerationCollectorPolicy* as_two_generation_policy() { return this; }
int number_of_generations() { return 2; }
BarrierSet::Name barrier_set_name() { return BarrierSet::CardTableModRef; }
src/share/vm/memory/collectorPolicy.hpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File