src/share/vm/memory/collectorPolicy.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/memory/collectorPolicy.hpp

src/share/vm/memory/collectorPolicy.hpp

Print this page

        

*** 59,79 **** class CollectorPolicy : public CHeapObj<mtGC> { protected: GCPolicyCounters* _gc_policy_counters; ! // Requires that the concrete subclass sets the alignment constraints ! // before calling. virtual void initialize_flags(); virtual void 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; // The sizing of the heap are controlled by a sizing policy. AdaptiveSizePolicy* _size_policy; // Set to true when policy wants soft refs cleared. --- 59,85 ---- class CollectorPolicy : public CHeapObj<mtGC> { protected: GCPolicyCounters* _gc_policy_counters; ! virtual void initialize_alignments() = 0; virtual void initialize_flags(); virtual void initialize_size_info(); + DEBUG_ONLY(virtual void assert_flags();) + DEBUG_ONLY(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 _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 **** // 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) ! {} public: // Return maximum heap alignment that may be imposed by the policy ! static size_t compute_max_alignment(); ! size_t min_alignment() { return _min_alignment; } ! size_t max_alignment() { return _max_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; } --- 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(); 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_heap_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 **** protected: size_t _min_gen0_size; size_t _initial_gen0_size; size_t _max_gen0_size; 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_flags(); void initialize_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 // 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: // 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_all() { ! initialize_flags(); ! initialize_size_info(); initialize_generations(); } 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); --- 223,290 ---- 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_flags(); void initialize_size_info(); + DEBUG_ONLY(void assert_flags();) + DEBUG_ONLY(void assert_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(); + // 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() { }; virtual void initialize_all() { ! 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,286 **** // 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() { ! return 64 * K * HeapWordSize; } }; // All of hotspot's current collectors are subtypes of this // class. Currently, these collectors all use the same gen[0], --- 292,303 ---- // 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() { ! assert(_max_gen0_size == MaxNewSize, "Should be taken care of by initialize_size_info"); } }; // All of hotspot's current collectors are subtypes of this // class. Currently, these collectors all use the same gen[0],
*** 294,306 **** size_t _initial_gen1_size; size_t _max_gen1_size; void initialize_flags(); void initialize_size_info(); ! void initialize_generations() { ShouldNotReachHere(); } public: // 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; } --- 311,328 ---- size_t _initial_gen1_size; size_t _max_gen1_size; void initialize_flags(); void initialize_size_info(); ! ! DEBUG_ONLY(void assert_flags();) ! DEBUG_ONLY(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; }
*** 319,332 **** const size_t heap_size, const size_t min_gen1_size); }; class MarkSweepPolicy : public TwoGenerationCollectorPolicy { protected: void initialize_generations(); public: ! MarkSweepPolicy(); MarkSweepPolicy* as_mark_sweep_policy() { return this; } void initialize_gc_policy_counters(); }; --- 341,355 ---- const size_t heap_size, const size_t min_gen1_size); }; class MarkSweepPolicy : public TwoGenerationCollectorPolicy { protected: + void initialize_alignments(); void initialize_generations(); public: ! 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