125 GenCollectedHeap(GenCollectorPolicy *policy); 126 127 WorkGang* workers() const { return _workers; } 128 129 // Returns JNI_OK on success 130 virtual jint initialize(); 131 132 // Reserve aligned space for the heap as needed by the contained generations. 133 char* allocate(size_t alignment, ReservedSpace* heap_rs); 134 135 // Does operations required after initialization has been done. 136 void post_initialize(); 137 138 // Initialize ("weak") refs processing support 139 virtual void ref_processing_init(); 140 141 virtual Name kind() const { 142 return CollectedHeap::GenCollectedHeap; 143 } 144 145 Generation* young_gen() const { return _young_gen; } 146 Generation* old_gen() const { return _old_gen; } 147 148 bool is_young_gen(const Generation* gen) const { return gen == _young_gen; } 149 bool is_old_gen(const Generation* gen) const { return gen == _old_gen; } 150 151 // The generational collector policy. 152 GenCollectorPolicy* gen_policy() const { return _gen_policy; } 153 154 virtual CollectorPolicy* collector_policy() const { return gen_policy(); } 155 156 // Adaptive size policy 157 virtual AdaptiveSizePolicy* size_policy() { 158 return gen_policy()->size_policy(); 159 } 160 161 // Return the (conservative) maximum heap alignment 162 static size_t conservative_max_heap_alignment() { 163 return Generation::GenGrain; 164 } 312 // Update above counter, as appropriate, at the end of a concurrent GC cycle 313 unsigned int update_full_collections_completed(unsigned int count); 314 315 // Update "time of last gc" for all generations to "now". 316 void update_time_of_last_gc(jlong now) { 317 _young_gen->update_time_of_last_gc(now); 318 _old_gen->update_time_of_last_gc(now); 319 } 320 321 // Update the gc statistics for each generation. 322 void update_gc_stats(Generation* current_generation, bool full) { 323 _old_gen->update_gc_stats(current_generation, full); 324 } 325 326 bool no_gc_in_progress() { return !is_gc_active(); } 327 328 // Override. 329 void prepare_for_verify(); 330 331 // Override. 332 void verify(bool silent, VerifyOption option); 333 334 // Override. 335 virtual void print_on(outputStream* st) const; 336 virtual void print_gc_threads_on(outputStream* st) const; 337 virtual void gc_threads_do(ThreadClosure* tc) const; 338 virtual void print_tracing_info() const; 339 virtual void print_on_error(outputStream* st) const; 340 341 // PrintGC, PrintGCDetails support 342 void print_heap_change(size_t prev_used) const; 343 344 // The functions below are helper functions that a subclass of 345 // "CollectedHeap" can use in the implementation of its virtual 346 // functions. 347 348 class GenClosure : public StackObj { 349 public: 350 virtual void do_generation(Generation* gen) = 0; 351 }; 352 353 // Apply "cl.do_generation" to all generations in the heap 354 // If "old_to_young" determines the order. 355 void generation_iterate(GenClosure* cl, bool old_to_young); 356 357 // Return "true" if all generations have reached the 358 // maximal committed limit that they can reach, without a garbage 359 // collection. 360 virtual bool is_maximal_no_gc() const; 361 362 // This function returns the CardTableRS object that allows us to scan | 125 GenCollectedHeap(GenCollectorPolicy *policy); 126 127 WorkGang* workers() const { return _workers; } 128 129 // Returns JNI_OK on success 130 virtual jint initialize(); 131 132 // Reserve aligned space for the heap as needed by the contained generations. 133 char* allocate(size_t alignment, ReservedSpace* heap_rs); 134 135 // Does operations required after initialization has been done. 136 void post_initialize(); 137 138 // Initialize ("weak") refs processing support 139 virtual void ref_processing_init(); 140 141 virtual Name kind() const { 142 return CollectedHeap::GenCollectedHeap; 143 } 144 145 virtual const char* name() const { 146 if (UseConcMarkSweepGC) { 147 return "Concurrent Mark Sweep"; 148 } else { 149 return "Serial"; 150 } 151 } 152 153 Generation* young_gen() const { return _young_gen; } 154 Generation* old_gen() const { return _old_gen; } 155 156 bool is_young_gen(const Generation* gen) const { return gen == _young_gen; } 157 bool is_old_gen(const Generation* gen) const { return gen == _old_gen; } 158 159 // The generational collector policy. 160 GenCollectorPolicy* gen_policy() const { return _gen_policy; } 161 162 virtual CollectorPolicy* collector_policy() const { return gen_policy(); } 163 164 // Adaptive size policy 165 virtual AdaptiveSizePolicy* size_policy() { 166 return gen_policy()->size_policy(); 167 } 168 169 // Return the (conservative) maximum heap alignment 170 static size_t conservative_max_heap_alignment() { 171 return Generation::GenGrain; 172 } 320 // Update above counter, as appropriate, at the end of a concurrent GC cycle 321 unsigned int update_full_collections_completed(unsigned int count); 322 323 // Update "time of last gc" for all generations to "now". 324 void update_time_of_last_gc(jlong now) { 325 _young_gen->update_time_of_last_gc(now); 326 _old_gen->update_time_of_last_gc(now); 327 } 328 329 // Update the gc statistics for each generation. 330 void update_gc_stats(Generation* current_generation, bool full) { 331 _old_gen->update_gc_stats(current_generation, full); 332 } 333 334 bool no_gc_in_progress() { return !is_gc_active(); } 335 336 // Override. 337 void prepare_for_verify(); 338 339 // Override. 340 void verify(VerifyOption option); 341 342 // Override. 343 virtual void print_on(outputStream* st) const; 344 virtual void print_gc_threads_on(outputStream* st) const; 345 virtual void gc_threads_do(ThreadClosure* tc) const; 346 virtual void print_tracing_info() const; 347 virtual void print_on_error(outputStream* st) const; 348 349 void print_heap_change(size_t young_prev_used, size_t old_prev_used) const; 350 351 // The functions below are helper functions that a subclass of 352 // "CollectedHeap" can use in the implementation of its virtual 353 // functions. 354 355 class GenClosure : public StackObj { 356 public: 357 virtual void do_generation(Generation* gen) = 0; 358 }; 359 360 // Apply "cl.do_generation" to all generations in the heap 361 // If "old_to_young" determines the order. 362 void generation_iterate(GenClosure* cl, bool old_to_young); 363 364 // Return "true" if all generations have reached the 365 // maximal committed limit that they can reach, without a garbage 366 // collection. 367 virtual bool is_maximal_no_gc() const; 368 369 // This function returns the CardTableRS object that allows us to scan |