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