71 #include "utilities/globalDefinitions.hpp" |
71 #include "utilities/globalDefinitions.hpp" |
72 #include "utilities/stack.inline.hpp" |
72 #include "utilities/stack.inline.hpp" |
73 |
73 |
74 size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0; |
74 size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0; |
75 |
75 |
76 // turn it on so that the contents of the young list (scan-only / |
|
77 // to-be-collected) are printed at "strategic" points before / during |
|
78 // / after the collection --- this is useful for debugging |
|
79 #define YOUNG_LIST_VERBOSE 0 |
|
80 // CURRENT STATUS |
|
81 // This file is under construction. Search for "FIXME". |
|
82 |
|
83 // INVARIANTS/NOTES |
76 // INVARIANTS/NOTES |
84 // |
77 // |
85 // All allocation activity covered by the G1CollectedHeap interface is |
78 // All allocation activity covered by the G1CollectedHeap interface is |
86 // serialized by acquiring the HeapLock. This happens in mem_allocate |
79 // serialized by acquiring the HeapLock. This happens in mem_allocate |
87 // and allocate_new_tlab, which are the "entry" points to the |
80 // and allocate_new_tlab, which are the "entry" points to the |
4077 // |
4070 // |
4078 // The elapsed time induced by the start time below deliberately elides |
4071 // The elapsed time induced by the start time below deliberately elides |
4079 // the possible verification above. |
4072 // the possible verification above. |
4080 double sample_start_time_sec = os::elapsedTime(); |
4073 double sample_start_time_sec = os::elapsedTime(); |
4081 |
4074 |
4082 #if YOUNG_LIST_VERBOSE |
|
4083 gclog_or_tty->print_cr("\nBefore recording pause start.\nYoung_list:"); |
|
4084 _young_list->print(); |
|
4085 g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty); |
|
4086 #endif // YOUNG_LIST_VERBOSE |
|
4087 |
|
4088 g1_policy()->record_collection_pause_start(sample_start_time_sec); |
4075 g1_policy()->record_collection_pause_start(sample_start_time_sec); |
4089 |
|
4090 #if YOUNG_LIST_VERBOSE |
|
4091 gclog_or_tty->print_cr("\nAfter recording pause start.\nYoung_list:"); |
|
4092 _young_list->print(); |
|
4093 #endif // YOUNG_LIST_VERBOSE |
|
4094 |
4076 |
4095 if (collector_state()->during_initial_mark_pause()) { |
4077 if (collector_state()->during_initial_mark_pause()) { |
4096 concurrent_mark()->checkpointRootsInitialPre(); |
4078 concurrent_mark()->checkpointRootsInitialPre(); |
4097 } |
4079 } |
4098 |
|
4099 #if YOUNG_LIST_VERBOSE |
|
4100 gclog_or_tty->print_cr("\nBefore choosing collection set.\nYoung_list:"); |
|
4101 _young_list->print(); |
|
4102 g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty); |
|
4103 #endif // YOUNG_LIST_VERBOSE |
|
4104 |
4080 |
4105 double time_remaining_ms = g1_policy()->finalize_young_cset_part(target_pause_time_ms); |
4081 double time_remaining_ms = g1_policy()->finalize_young_cset_part(target_pause_time_ms); |
4106 g1_policy()->finalize_old_cset_part(time_remaining_ms); |
4082 g1_policy()->finalize_old_cset_part(time_remaining_ms); |
4107 |
4083 |
4108 evacuation_info.set_collectionset_regions(g1_policy()->cset_region_length()); |
4084 evacuation_info.set_collectionset_regions(g1_policy()->cset_region_length()); |
4154 // GC alloc regions from this pause have been tagged |
4130 // GC alloc regions from this pause have been tagged |
4155 // as survivors and moved on to the survivor list. |
4131 // as survivors and moved on to the survivor list. |
4156 // Survivor regions will fail the !is_young() check. |
4132 // Survivor regions will fail the !is_young() check. |
4157 assert(check_young_list_empty(false /* check_heap */), |
4133 assert(check_young_list_empty(false /* check_heap */), |
4158 "young list should be empty"); |
4134 "young list should be empty"); |
4159 |
|
4160 #if YOUNG_LIST_VERBOSE |
|
4161 gclog_or_tty->print_cr("Before recording survivors.\nYoung List:"); |
|
4162 _young_list->print(); |
|
4163 #endif // YOUNG_LIST_VERBOSE |
|
4164 |
4135 |
4165 g1_policy()->record_survivor_regions(_young_list->survivor_length(), |
4136 g1_policy()->record_survivor_regions(_young_list->survivor_length(), |
4166 _young_list->first_survivor_region(), |
4137 _young_list->first_survivor_region(), |
4167 _young_list->last_survivor_region()); |
4138 _young_list->last_survivor_region()); |
4168 |
4139 |
4194 // this point. We do that later when we're sure that |
4165 // this point. We do that later when we're sure that |
4195 // the current thread has completed its logging output. |
4166 // the current thread has completed its logging output. |
4196 } |
4167 } |
4197 |
4168 |
4198 allocate_dummy_regions(); |
4169 allocate_dummy_regions(); |
4199 |
|
4200 #if YOUNG_LIST_VERBOSE |
|
4201 gclog_or_tty->print_cr("\nEnd of the pause.\nYoung_list:"); |
|
4202 _young_list->print(); |
|
4203 g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty); |
|
4204 #endif // YOUNG_LIST_VERBOSE |
|
4205 |
4170 |
4206 _allocator->init_mutator_alloc_region(); |
4171 _allocator->init_mutator_alloc_region(); |
4207 |
4172 |
4208 { |
4173 { |
4209 size_t expand_bytes = g1_policy()->expansion_amount(); |
4174 size_t expand_bytes = g1_policy()->expansion_amount(); |