src/share/vm/memory/space.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/memory

src/share/vm/memory/space.cpp

Print this page
rev 7212 : [mq]: remove_get_gen


 372   set_compaction_top(bottom());
 373   _next_compaction_space = NULL;
 374 }
 375 
 376 void CompactibleSpace::clear(bool mangle_space) {
 377   Space::clear(mangle_space);
 378   _compaction_top = bottom();
 379 }
 380 
 381 HeapWord* CompactibleSpace::forward(oop q, size_t size,
 382                                     CompactPoint* cp, HeapWord* compact_top) {
 383   // q is alive
 384   // First check if we should switch compaction space
 385   assert(this == cp->space, "'this' should be current compaction space.");
 386   size_t compaction_max_size = pointer_delta(end(), compact_top);
 387   while (size > compaction_max_size) {
 388     // switch to next compaction space
 389     cp->space->set_compaction_top(compact_top);
 390     cp->space = cp->space->next_compaction_space();
 391     if (cp->space == NULL) {
 392       cp->gen = GenCollectedHeap::heap()->prev_gen(cp->gen);
 393       assert(cp->gen != NULL, "compaction must succeed");
 394       cp->space = cp->gen->first_compaction_space();
 395       assert(cp->space != NULL, "generation must have a first compaction space");
 396     }
 397     compact_top = cp->space->bottom();
 398     cp->space->set_compaction_top(compact_top);
 399     cp->threshold = cp->space->initialize_threshold();
 400     compaction_max_size = pointer_delta(cp->space->end(), compact_top);
 401   }
 402 
 403   // store the forwarding pointer into the mark word
 404   if ((HeapWord*)q != compact_top) {
 405     q->forward_to(oop(compact_top));
 406     assert(q->is_gc_marked(), "encoding the pointer should preserve the mark");
 407   } else {
 408     // if the object isn't moving we can just set the mark to the default
 409     // mark and handle it specially later on.
 410     q->init_mark();
 411     assert(q->forwardee() == NULL, "should be forwarded to NULL");
 412   }




 372   set_compaction_top(bottom());
 373   _next_compaction_space = NULL;
 374 }
 375 
 376 void CompactibleSpace::clear(bool mangle_space) {
 377   Space::clear(mangle_space);
 378   _compaction_top = bottom();
 379 }
 380 
 381 HeapWord* CompactibleSpace::forward(oop q, size_t size,
 382                                     CompactPoint* cp, HeapWord* compact_top) {
 383   // q is alive
 384   // First check if we should switch compaction space
 385   assert(this == cp->space, "'this' should be current compaction space.");
 386   size_t compaction_max_size = pointer_delta(end(), compact_top);
 387   while (size > compaction_max_size) {
 388     // switch to next compaction space
 389     cp->space->set_compaction_top(compact_top);
 390     cp->space = cp->space->next_compaction_space();
 391     if (cp->space == NULL) {
 392       cp->gen = GenCollectedHeap::heap()->young_gen();
 393       assert(cp->gen != NULL, "compaction must succeed");
 394       cp->space = cp->gen->first_compaction_space();
 395       assert(cp->space != NULL, "generation must have a first compaction space");
 396     }
 397     compact_top = cp->space->bottom();
 398     cp->space->set_compaction_top(compact_top);
 399     cp->threshold = cp->space->initialize_threshold();
 400     compaction_max_size = pointer_delta(cp->space->end(), compact_top);
 401   }
 402 
 403   // store the forwarding pointer into the mark word
 404   if ((HeapWord*)q != compact_top) {
 405     q->forward_to(oop(compact_top));
 406     assert(q->is_gc_marked(), "encoding the pointer should preserve the mark");
 407   } else {
 408     // if the object isn't moving we can just set the mark to the default
 409     // mark and handle it specially later on.
 410     q->init_mark();
 411     assert(q->forwardee() == NULL, "should be forwarded to NULL");
 412   }


src/share/vm/memory/space.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File