src/share/vm/gc/shared/generation.cpp

Print this page




 303     s->safe_object_iterate(_cl);
 304   }
 305   GenerationSafeObjIterateClosure(ObjectClosure* cl) : _cl(cl) {}
 306 };
 307 
 308 void Generation::safe_object_iterate(ObjectClosure* cl) {
 309   GenerationSafeObjIterateClosure blk(cl);
 310   space_iterate(&blk);
 311 }
 312 
 313 void Generation::prepare_for_compaction(CompactPoint* cp) {
 314   // Generic implementation, can be specialized
 315   CompactibleSpace* space = first_compaction_space();
 316   while (space != NULL) {
 317     space->prepare_for_compaction(cp);
 318     space = space->next_compaction_space();
 319   }
 320 }
 321 
 322 class AdjustPointersClosure: public SpaceClosure {

 323  public:


 324   void do_space(Space* sp) {
 325     sp->adjust_pointers();
 326   }
 327 };
 328 
 329 void Generation::adjust_pointers() {
 330   // Note that this is done over all spaces, not just the compactible
 331   // ones.
 332   AdjustPointersClosure blk;
 333   space_iterate(&blk, true);
 334 }
 335 
 336 void Generation::compact() {
 337   CompactibleSpace* sp = first_compaction_space();
 338   while (sp != NULL) {
 339     sp->compact();
 340     sp = sp->next_compaction_space();
 341   }
 342 }


 303     s->safe_object_iterate(_cl);
 304   }
 305   GenerationSafeObjIterateClosure(ObjectClosure* cl) : _cl(cl) {}
 306 };
 307 
 308 void Generation::safe_object_iterate(ObjectClosure* cl) {
 309   GenerationSafeObjIterateClosure blk(cl);
 310   space_iterate(&blk);
 311 }
 312 
 313 void Generation::prepare_for_compaction(CompactPoint* cp) {
 314   // Generic implementation, can be specialized
 315   CompactibleSpace* space = first_compaction_space();
 316   while (space != NULL) {
 317     space->prepare_for_compaction(cp);
 318     space = space->next_compaction_space();
 319   }
 320 }
 321 
 322 class AdjustPointersClosure: public SpaceClosure {
 323   MarkSweep* _ms;
 324  public:
 325   AdjustPointersClosure(MarkSweep *ms) : _ms(ms) {}
 326   ~AdjustPointersClosure() {}
 327   void do_space(Space* sp) {
 328     sp->adjust_pointers(_ms);
 329   }
 330 };
 331 
 332 void Generation::adjust_pointers(MarkSweep *ms) {
 333   // Note that this is done over all spaces, not just the compactible
 334   // ones.
 335   AdjustPointersClosure blk(ms);
 336   space_iterate(&blk, true);
 337 }
 338 
 339 void Generation::compact() {
 340   CompactibleSpace* sp = first_compaction_space();
 341   while (sp != NULL) {
 342     sp->compact();
 343     sp = sp->next_compaction_space();
 344   }
 345 }