143
144 // Update heap occupancy information which is used as
145 // input to soft ref clearing policy at the next gc.
146 Universe::update_heap_info_at_gc();
147
148 // Update time of last gc for all generations we collected
149 // (which currently is all the generations in the heap).
150 // We need to use a monotonically non-decreasing time in ms
151 // or we will see time-warp warnings and os::javaTimeMillis()
152 // does not guarantee monotonicity.
153 jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
154 gch->update_time_of_last_gc(now);
155
156 gch->trace_heap_after_gc(_gc_tracer);
157 }
158
159 void GenMarkSweep::allocate_stacks() {
160 GenCollectedHeap* gch = GenCollectedHeap::heap();
161 // Scratch request on behalf of oldest generation; will do no
162 // allocation.
163 ScratchBlock* scratch = gch->gather_scratch(gch->_gens[gch->_n_gens-1], 0);
164
165 // $$$ To cut a corner, we'll only use the first scratch block, and then
166 // revert to malloc.
167 if (scratch != NULL) {
168 _preserved_count_max =
169 scratch->num_words * HeapWordSize / sizeof(PreservedMark);
170 } else {
171 _preserved_count_max = 0;
172 }
173
174 _preserved_marks = (PreservedMark*)scratch;
175 _preserved_count = 0;
176 }
177
178
179 void GenMarkSweep::deallocate_stacks() {
180 if (!UseG1GC) {
181 GenCollectedHeap* gch = GenCollectedHeap::heap();
182 gch->release_scratch();
183 }
|
143
144 // Update heap occupancy information which is used as
145 // input to soft ref clearing policy at the next gc.
146 Universe::update_heap_info_at_gc();
147
148 // Update time of last gc for all generations we collected
149 // (which currently is all the generations in the heap).
150 // We need to use a monotonically non-decreasing time in ms
151 // or we will see time-warp warnings and os::javaTimeMillis()
152 // does not guarantee monotonicity.
153 jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
154 gch->update_time_of_last_gc(now);
155
156 gch->trace_heap_after_gc(_gc_tracer);
157 }
158
159 void GenMarkSweep::allocate_stacks() {
160 GenCollectedHeap* gch = GenCollectedHeap::heap();
161 // Scratch request on behalf of oldest generation; will do no
162 // allocation.
163 ScratchBlock* scratch = gch->gather_scratch(gch->get_gen(gch->_n_gens-1), 0);
164
165 // $$$ To cut a corner, we'll only use the first scratch block, and then
166 // revert to malloc.
167 if (scratch != NULL) {
168 _preserved_count_max =
169 scratch->num_words * HeapWordSize / sizeof(PreservedMark);
170 } else {
171 _preserved_count_max = 0;
172 }
173
174 _preserved_marks = (PreservedMark*)scratch;
175 _preserved_count = 0;
176 }
177
178
179 void GenMarkSweep::deallocate_stacks() {
180 if (!UseG1GC) {
181 GenCollectedHeap* gch = GenCollectedHeap::heap();
182 gch->release_scratch();
183 }
|