161 _preserved_count = 0; 162 } 163 164 165 void GenMarkSweep::deallocate_stacks() { 166 GenCollectedHeap* gch = GenCollectedHeap::heap(); 167 gch->release_scratch(); 168 169 _preserved_mark_stack.clear(true); 170 _preserved_oop_stack.clear(true); 171 _marking_stack.clear(); 172 _objarray_stack.clear(true); 173 } 174 175 void GenMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) { 176 // Recursively traverse all live objects and mark them 177 GCTraceTime(Info, gc, phases) tm("Phase 1: Mark live objects", _gc_timer); 178 179 GenCollectedHeap* gch = GenCollectedHeap::heap(); 180 181 // Because follow_root_closure is created statically, cannot 182 // use OopsInGenClosure constructor which takes a generation, 183 // as the Universe has not been created when the static constructors 184 // are run. 185 follow_root_closure.set_orig_generation(gch->old_gen()); 186 187 // Need new claim bits before marking starts. 188 ClassLoaderDataGraph::clear_claimed_marks(); 189 190 { 191 StrongRootsScope srs(1); 192 193 gch->full_process_roots(&srs, 194 false, // not the adjust phase 195 GenCollectedHeap::SO_None, 196 ClassUnloading, // only strong roots if ClassUnloading 197 // is enabled 198 &follow_root_closure, 199 &follow_cld_closure); 200 } 201 202 // Process reference objects found during marking 203 { 204 GCTraceTime(Debug, gc, phases) tm_m("Reference Processing", gc_timer()); 205 206 ref_processor()->setup_policy(clear_all_softrefs); 259 GCTraceTime(Info, gc, phases) tm("Phase 2: Compute new object addresses", _gc_timer); 260 261 gch->prepare_for_compaction(); 262 } 263 264 class GenAdjustPointersClosure: public GenCollectedHeap::GenClosure { 265 public: 266 void do_generation(Generation* gen) { 267 gen->adjust_pointers(); 268 } 269 }; 270 271 void GenMarkSweep::mark_sweep_phase3() { 272 GenCollectedHeap* gch = GenCollectedHeap::heap(); 273 274 // Adjust the pointers to reflect the new locations 275 GCTraceTime(Info, gc, phases) tm("Phase 3: Adjust pointers", gc_timer()); 276 277 // Need new claim bits for the pointer adjustment tracing. 278 ClassLoaderDataGraph::clear_claimed_marks(); 279 280 // Because the closure below is created statically, we cannot 281 // use OopsInGenClosure constructor which takes a generation, 282 // as the Universe has not been created when the static constructors 283 // are run. 284 adjust_pointer_closure.set_orig_generation(gch->old_gen()); 285 286 { 287 StrongRootsScope srs(1); 288 289 gch->full_process_roots(&srs, 290 true, // this is the adjust phase 291 GenCollectedHeap::SO_AllCodeCache, 292 false, // all roots 293 &adjust_pointer_closure, 294 &adjust_cld_closure); 295 } 296 297 gch->gen_process_weak_roots(&adjust_pointer_closure); 298 299 adjust_marks(); 300 GenAdjustPointersClosure blk; 301 gch->generation_iterate(&blk, true); 302 } 303 304 class GenCompactClosure: public GenCollectedHeap::GenClosure { | 161 _preserved_count = 0; 162 } 163 164 165 void GenMarkSweep::deallocate_stacks() { 166 GenCollectedHeap* gch = GenCollectedHeap::heap(); 167 gch->release_scratch(); 168 169 _preserved_mark_stack.clear(true); 170 _preserved_oop_stack.clear(true); 171 _marking_stack.clear(); 172 _objarray_stack.clear(true); 173 } 174 175 void GenMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) { 176 // Recursively traverse all live objects and mark them 177 GCTraceTime(Info, gc, phases) tm("Phase 1: Mark live objects", _gc_timer); 178 179 GenCollectedHeap* gch = GenCollectedHeap::heap(); 180 181 // Need new claim bits before marking starts. 182 ClassLoaderDataGraph::clear_claimed_marks(); 183 184 { 185 StrongRootsScope srs(1); 186 187 gch->full_process_roots(&srs, 188 false, // not the adjust phase 189 GenCollectedHeap::SO_None, 190 ClassUnloading, // only strong roots if ClassUnloading 191 // is enabled 192 &follow_root_closure, 193 &follow_cld_closure); 194 } 195 196 // Process reference objects found during marking 197 { 198 GCTraceTime(Debug, gc, phases) tm_m("Reference Processing", gc_timer()); 199 200 ref_processor()->setup_policy(clear_all_softrefs); 253 GCTraceTime(Info, gc, phases) tm("Phase 2: Compute new object addresses", _gc_timer); 254 255 gch->prepare_for_compaction(); 256 } 257 258 class GenAdjustPointersClosure: public GenCollectedHeap::GenClosure { 259 public: 260 void do_generation(Generation* gen) { 261 gen->adjust_pointers(); 262 } 263 }; 264 265 void GenMarkSweep::mark_sweep_phase3() { 266 GenCollectedHeap* gch = GenCollectedHeap::heap(); 267 268 // Adjust the pointers to reflect the new locations 269 GCTraceTime(Info, gc, phases) tm("Phase 3: Adjust pointers", gc_timer()); 270 271 // Need new claim bits for the pointer adjustment tracing. 272 ClassLoaderDataGraph::clear_claimed_marks(); 273 274 { 275 StrongRootsScope srs(1); 276 277 gch->full_process_roots(&srs, 278 true, // this is the adjust phase 279 GenCollectedHeap::SO_AllCodeCache, 280 false, // all roots 281 &adjust_pointer_closure, 282 &adjust_cld_closure); 283 } 284 285 gch->gen_process_weak_roots(&adjust_pointer_closure); 286 287 adjust_marks(); 288 GenAdjustPointersClosure blk; 289 gch->generation_iterate(&blk, true); 290 } 291 292 class GenCompactClosure: public GenCollectedHeap::GenClosure { |