120
121 // Clear/invalidate below make use of the "prev_used_regions" saved earlier.
122 if (gch->young_gen()->used() == 0) {
123 // We've evacuated the young generation.
124 rs->clear_into_younger(old_gen);
125 } else {
126 // Invalidate the cards corresponding to the currently used
127 // region and clear those corresponding to the evacuated region.
128 rs->invalidate_or_clear(old_gen);
129 }
130
131 gch->prune_scavengable_nmethods();
132
133 // refs processing: clean slate
134 set_ref_processor(NULL);
135
136 // Update heap occupancy information which is used as
137 // input to soft ref clearing policy at the next gc.
138 Universe::update_heap_info_at_gc();
139
140 // Update time of last gc for all generations we collected
141 // (which currently is all the generations in the heap).
142 // We need to use a monotonically non-decreasing time in ms
143 // or we will see time-warp warnings and os::javaTimeMillis()
144 // does not guarantee monotonicity.
145 jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
146 gch->update_time_of_last_gc(now);
147
148 gch->trace_heap_after_gc(_gc_tracer);
149 }
150
151 void GenMarkSweep::allocate_stacks() {
152 GenCollectedHeap* gch = GenCollectedHeap::heap();
153 // Scratch request on behalf of old generation; will do no allocation.
154 ScratchBlock* scratch = gch->gather_scratch(gch->old_gen(), 0);
155
156 // $$$ To cut a corner, we'll only use the first scratch block, and then
157 // revert to malloc.
158 if (scratch != NULL) {
159 _preserved_count_max =
160 scratch->num_words * HeapWordSize / sizeof(PreservedMark);
161 } else {
162 _preserved_count_max = 0;
163 }
164
165 _preserved_marks = (PreservedMark*)scratch;
166 _preserved_count = 0;
|
120
121 // Clear/invalidate below make use of the "prev_used_regions" saved earlier.
122 if (gch->young_gen()->used() == 0) {
123 // We've evacuated the young generation.
124 rs->clear_into_younger(old_gen);
125 } else {
126 // Invalidate the cards corresponding to the currently used
127 // region and clear those corresponding to the evacuated region.
128 rs->invalidate_or_clear(old_gen);
129 }
130
131 gch->prune_scavengable_nmethods();
132
133 // refs processing: clean slate
134 set_ref_processor(NULL);
135
136 // Update heap occupancy information which is used as
137 // input to soft ref clearing policy at the next gc.
138 Universe::update_heap_info_at_gc();
139
140 Universe::heap()->next_whole_heap_examined();
141
142 gch->trace_heap_after_gc(_gc_tracer);
143 }
144
145 void GenMarkSweep::allocate_stacks() {
146 GenCollectedHeap* gch = GenCollectedHeap::heap();
147 // Scratch request on behalf of old generation; will do no allocation.
148 ScratchBlock* scratch = gch->gather_scratch(gch->old_gen(), 0);
149
150 // $$$ To cut a corner, we'll only use the first scratch block, and then
151 // revert to malloc.
152 if (scratch != NULL) {
153 _preserved_count_max =
154 scratch->num_words * HeapWordSize / sizeof(PreservedMark);
155 } else {
156 _preserved_count_max = 0;
157 }
158
159 _preserved_marks = (PreservedMark*)scratch;
160 _preserved_count = 0;
|