comparison src/share/vm/memory/collectorPolicy.hpp @ 14518:d8041d695d19

Merged with jdk9/dev/hotspot changeset 3812c088b945
author twisti
date Tue, 11 Mar 2014 18:45:59 -0700
parents f7f0c6a77d6d
children 4ca6dc0799b6
comparison
equal deleted inserted replaced
14141:f97c5ec83832 14518:d8041d695d19
74 74
75 size_t _space_alignment; 75 size_t _space_alignment;
76 size_t _heap_alignment; 76 size_t _heap_alignment;
77 77
78 // Needed to keep information if MaxHeapSize was set on the command line 78 // Needed to keep information if MaxHeapSize was set on the command line
79 // when the flag value is aligned etc by ergonomics 79 // when the flag value is aligned etc by ergonomics.
80 bool _max_heap_size_cmdline; 80 bool _max_heap_size_cmdline;
81 81
82 // The sizing of the heap are controlled by a sizing policy. 82 // The sizing of the heap is controlled by a sizing policy.
83 AdaptiveSizePolicy* _size_policy; 83 AdaptiveSizePolicy* _size_policy;
84 84
85 // Set to true when policy wants soft refs cleared. 85 // Set to true when policy wants soft refs cleared.
86 // Reset to false by gc after it clears all soft refs. 86 // Reset to false by gc after it clears all soft refs.
87 bool _should_clear_all_soft_refs; 87 bool _should_clear_all_soft_refs;
100 initialize_alignments(); 100 initialize_alignments();
101 initialize_flags(); 101 initialize_flags();
102 initialize_size_info(); 102 initialize_size_info();
103 } 103 }
104 104
105 // Return maximum heap alignment that may be imposed by the policy 105 // Return maximum heap alignment that may be imposed by the policy.
106 static size_t compute_heap_alignment(); 106 static size_t compute_heap_alignment();
107 107
108 size_t space_alignment() { return _space_alignment; } 108 size_t space_alignment() { return _space_alignment; }
109 size_t heap_alignment() { return _heap_alignment; } 109 size_t heap_alignment() { return _heap_alignment; }
110 110
178 // failure. 178 // failure.
179 virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data, 179 virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
180 size_t size, 180 size_t size,
181 Metaspace::MetadataType mdtype); 181 Metaspace::MetadataType mdtype);
182 182
183 // Performace Counter support 183 // Performance Counter support
184 GCPolicyCounters* counters() { return _gc_policy_counters; } 184 GCPolicyCounters* counters() { return _gc_policy_counters; }
185 185
186 // Create the jstat counters for the GC policy. By default, policy's 186 // Create the jstat counters for the GC policy. By default, policy's
187 // don't have associated counters, and we complain if this is invoked. 187 // don't have associated counters, and we complain if this is invoked.
188 virtual void initialize_gc_policy_counters() { 188 virtual void initialize_gc_policy_counters() {
218 } 218 }
219 } 219 }
220 }; 220 };
221 221
222 class GenCollectorPolicy : public CollectorPolicy { 222 class GenCollectorPolicy : public CollectorPolicy {
223 friend class TestGenCollectorPolicy;
223 protected: 224 protected:
224 size_t _min_gen0_size; 225 size_t _min_gen0_size;
225 size_t _initial_gen0_size; 226 size_t _initial_gen0_size;
226 size_t _max_gen0_size; 227 size_t _max_gen0_size;
227 228
229 // time. When using large pages they can differ. 230 // time. When using large pages they can differ.
230 size_t _gen_alignment; 231 size_t _gen_alignment;
231 232
232 GenerationSpec **_generations; 233 GenerationSpec **_generations;
233 234
234 // Return true if an allocation should be attempted in the older 235 // Return true if an allocation should be attempted in the older generation
235 // generation if it fails in the younger generation. Return 236 // if it fails in the younger generation. Return false, otherwise.
236 // false, otherwise.
237 virtual bool should_try_older_generation_allocation(size_t word_size) const; 237 virtual bool should_try_older_generation_allocation(size_t word_size) const;
238 238
239 void initialize_flags(); 239 void initialize_flags();
240 void initialize_size_info(); 240 void initialize_size_info();
241 241
243 DEBUG_ONLY(void assert_size_info();) 243 DEBUG_ONLY(void assert_size_info();)
244 244
245 // Try to allocate space by expanding the heap. 245 // Try to allocate space by expanding the heap.
246 virtual HeapWord* expand_heap_and_allocate(size_t size, bool is_tlab); 246 virtual HeapWord* expand_heap_and_allocate(size_t size, bool is_tlab);
247 247
248 // Compute max heap alignment 248 // Compute max heap alignment.
249 size_t compute_max_alignment(); 249 size_t compute_max_alignment();
250 250
251 // Scale the base_size by NewRatio according to 251 // Scale the base_size by NewRatio according to
252 // result = base_size / (NewRatio + 1) 252 // result = base_size / (NewRatio + 1)
253 // and align by min_alignment() 253 // and align by min_alignment()
254 size_t scale_by_NewRatio_aligned(size_t base_size); 254 size_t scale_by_NewRatio_aligned(size_t base_size);
255 255
256 // Bound the value by the given maximum minus the min_alignment 256 // Bound the value by the given maximum minus the min_alignment.
257 size_t bound_minus_alignment(size_t desired_size, size_t maximum_size); 257 size_t bound_minus_alignment(size_t desired_size, size_t maximum_size);
258 258
259 public: 259 public:
260 GenCollectorPolicy(); 260 GenCollectorPolicy();
261 261