68 Generation* _old_gen;
69
70 GenerationSpec** _gen_specs;
71
72 // The singleton Gen Remembered Set.
73 GenRemSet* _rem_set;
74
75 // The generational collector policy.
76 GenCollectorPolicy* _gen_policy;
77
78 // Indicates that the most recent previous incremental collection failed.
79 // The flag is cleared when an action is taken that might clear the
80 // condition that caused that incremental collection to fail.
81 bool _incremental_collection_failed;
82
83 // In support of ExplicitGCInvokesConcurrent functionality
84 unsigned int _full_collections_completed;
85
86 // Data structure for claiming the (potentially) parallel tasks in
87 // (gen-specific) roots processing.
88 SubTasksDone* _gen_process_roots_tasks;
89 SubTasksDone* gen_process_roots_tasks() { return _gen_process_roots_tasks; }
90
91 // Collects the given generation.
92 void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
93 bool run_verification, bool clear_soft_refs,
94 bool restore_marks_for_biased_locking);
95
96 // In block contents verification, the number of header words to skip
97 NOT_PRODUCT(static size_t _skip_header_HeapWords;)
98
99 protected:
100 // Helper functions for allocation
101 HeapWord* attempt_allocation(size_t size,
102 bool is_tlab,
103 bool first_only);
104
105 // Helper function for two callbacks below.
106 // Considers collection of the first max_level+1 generations.
107 void do_collection(bool full,
108 bool clear_all_soft_refs,
109 size_t size,
391 return _young_gen;
392 } else {
393 return _old_gen;
394 }
395 }
396
397 int n_gens() const {
398 assert(_n_gens == gen_policy()->number_of_generations(), "Sanity");
399 return _n_gens;
400 }
401
402 // This function returns the "GenRemSet" object that allows us to scan
403 // generations in a fully generational heap.
404 GenRemSet* rem_set() { return _rem_set; }
405
406 // Convenience function to be used in situations where the heap type can be
407 // asserted to be this type.
408 static GenCollectedHeap* heap();
409
410 void set_par_threads(uint t);
411
412 // Invoke the "do_oop" method of one of the closures "not_older_gens"
413 // or "older_gens" on root locations for the generation at
414 // "level". (The "older_gens" closure is used for scanning references
415 // from older generations; "not_older_gens" is used everywhere else.)
416 // If "younger_gens_as_roots" is false, younger generations are
417 // not scanned as roots; in this case, the caller must be arranging to
418 // scan the younger generations itself. (For example, a generation might
419 // explicitly mark reachable objects in younger generations, to avoid
420 // excess storage retention.)
421 // The "so" argument determines which of the roots
422 // the closure is applied to:
423 // "SO_None" does none;
424 private:
425 void gen_process_roots(int level,
426 bool younger_gens_as_roots,
427 bool activate_scope,
428 SharedHeap::ScanningOption so,
429 OopsInGenClosure* not_older_gens,
430 OopsInGenClosure* weak_roots,
431 OopsInGenClosure* older_gens,
432 CLDClosure* cld_closure,
433 CLDClosure* weak_cld_closure,
434 CodeBlobClosure* code_closure);
435
436 public:
437 static const bool StrongAndWeakRoots = false;
438 static const bool StrongRootsOnly = true;
439
440 void gen_process_roots(int level,
441 bool younger_gens_as_roots,
442 bool activate_scope,
443 SharedHeap::ScanningOption so,
444 bool only_strong_roots,
445 OopsInGenClosure* not_older_gens,
446 OopsInGenClosure* older_gens,
447 CLDClosure* cld_closure);
448
449 // Apply "root_closure" to all the weak roots of the system.
450 // These include JNI weak roots, string table,
451 // and referents of reachable weak refs.
452 void gen_process_weak_roots(OopClosure* root_closure);
453
454 // Set the saved marks of generations, if that makes sense.
455 // In particular, if any generation might iterate over the oops
456 // in other generations, it should call this method.
457 void save_marks();
458
459 // Apply "cur->do_oop" or "older->do_oop" to all the oops in objects
460 // allocated since the last call to save_marks in generations at or above
461 // "level". The "cur" closure is
462 // applied to references in the generation at "level", and the "older"
463 // closure to older generations.
|
68 Generation* _old_gen;
69
70 GenerationSpec** _gen_specs;
71
72 // The singleton Gen Remembered Set.
73 GenRemSet* _rem_set;
74
75 // The generational collector policy.
76 GenCollectorPolicy* _gen_policy;
77
78 // Indicates that the most recent previous incremental collection failed.
79 // The flag is cleared when an action is taken that might clear the
80 // condition that caused that incremental collection to fail.
81 bool _incremental_collection_failed;
82
83 // In support of ExplicitGCInvokesConcurrent functionality
84 unsigned int _full_collections_completed;
85
86 // Data structure for claiming the (potentially) parallel tasks in
87 // (gen-specific) roots processing.
88 SubTasksDone* _process_strong_tasks;
89
90 // Collects the given generation.
91 void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
92 bool run_verification, bool clear_soft_refs,
93 bool restore_marks_for_biased_locking);
94
95 // In block contents verification, the number of header words to skip
96 NOT_PRODUCT(static size_t _skip_header_HeapWords;)
97
98 protected:
99 // Helper functions for allocation
100 HeapWord* attempt_allocation(size_t size,
101 bool is_tlab,
102 bool first_only);
103
104 // Helper function for two callbacks below.
105 // Considers collection of the first max_level+1 generations.
106 void do_collection(bool full,
107 bool clear_all_soft_refs,
108 size_t size,
390 return _young_gen;
391 } else {
392 return _old_gen;
393 }
394 }
395
396 int n_gens() const {
397 assert(_n_gens == gen_policy()->number_of_generations(), "Sanity");
398 return _n_gens;
399 }
400
401 // This function returns the "GenRemSet" object that allows us to scan
402 // generations in a fully generational heap.
403 GenRemSet* rem_set() { return _rem_set; }
404
405 // Convenience function to be used in situations where the heap type can be
406 // asserted to be this type.
407 static GenCollectedHeap* heap();
408
409 void set_par_threads(uint t);
410 void set_n_termination(uint t);
411
412 // Invoke the "do_oop" method of one of the closures "not_older_gens"
413 // or "older_gens" on root locations for the generation at
414 // "level". (The "older_gens" closure is used for scanning references
415 // from older generations; "not_older_gens" is used everywhere else.)
416 // If "younger_gens_as_roots" is false, younger generations are
417 // not scanned as roots; in this case, the caller must be arranging to
418 // scan the younger generations itself. (For example, a generation might
419 // explicitly mark reachable objects in younger generations, to avoid
420 // excess storage retention.)
421 // The "so" argument determines which of the roots
422 // the closure is applied to:
423 // "SO_None" does none;
424 enum ScanningOption {
425 SO_None = 0x0,
426 SO_AllCodeCache = 0x8,
427 SO_ScavengeCodeCache = 0x10
428 };
429
430 private:
431 void process_roots(bool activate_scope,
432 ScanningOption so,
433 OopClosure* strong_roots,
434 OopClosure* weak_roots,
435 CLDClosure* strong_cld_closure,
436 CLDClosure* weak_cld_closure,
437 CodeBlobClosure* code_roots);
438
439 void gen_process_roots(int level,
440 bool younger_gens_as_roots,
441 bool activate_scope,
442 ScanningOption so,
443 OopsInGenClosure* not_older_gens,
444 OopsInGenClosure* weak_roots,
445 OopsInGenClosure* older_gens,
446 CLDClosure* cld_closure,
447 CLDClosure* weak_cld_closure,
448 CodeBlobClosure* code_closure);
449
450 public:
451 static const bool StrongAndWeakRoots = false;
452 static const bool StrongRootsOnly = true;
453
454 void gen_process_roots(int level,
455 bool younger_gens_as_roots,
456 bool activate_scope,
457 ScanningOption so,
458 bool only_strong_roots,
459 OopsInGenClosure* not_older_gens,
460 OopsInGenClosure* older_gens,
461 CLDClosure* cld_closure);
462
463 // Apply "root_closure" to all the weak roots of the system.
464 // These include JNI weak roots, string table,
465 // and referents of reachable weak refs.
466 void gen_process_weak_roots(OopClosure* root_closure);
467
468 // Set the saved marks of generations, if that makes sense.
469 // In particular, if any generation might iterate over the oops
470 // in other generations, it should call this method.
471 void save_marks();
472
473 // Apply "cur->do_oop" or "older->do_oop" to all the oops in objects
474 // allocated since the last call to save_marks in generations at or above
475 // "level". The "cur" closure is
476 // applied to references in the generation at "level", and the "older"
477 // closure to older generations.
|