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 // Signal that we have completed a visit to all live objects.
141 Universe::heap()->record_whole_heap_examined_timestamp();
142
143 gch->trace_heap_after_gc(_gc_tracer);
144 }
145
146 void GenMarkSweep::allocate_stacks() {
147 GenCollectedHeap* gch = GenCollectedHeap::heap();
148 // Scratch request on behalf of old generation; will do no allocation.
149 ScratchBlock* scratch = gch->gather_scratch(gch->old_gen(), 0);
150
151 // $$$ To cut a corner, we'll only use the first scratch block, and then
152 // revert to malloc.
153 if (scratch != NULL) {
154 _preserved_count_max =
155 scratch->num_words * HeapWordSize / sizeof(PreservedMark);
156 } else {
157 _preserved_count_max = 0;
158 }
159
160 _preserved_marks = (PreservedMark*)scratch;
161 _preserved_count = 0;
|