hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp
changeset 360 21d113ecbf6a
parent 1 489c9b5090e2
child 971 f0b20be4165d
child 670 ddf3e9583f2f
equal deleted inserted replaced
357:f4edb0d9f109 360:21d113ecbf6a
   166       if (!UseParallelOldGC || !VerifyParallelOldWithMarkSweep) {
   166       if (!UseParallelOldGC || !VerifyParallelOldWithMarkSweep) {
   167         if (start_array)
   167         if (start_array)
   168           start_array->allocate_block(compact_top);
   168           start_array->allocate_block(compact_top);
   169       }
   169       }
   170 
   170 
   171       debug_only(MarkSweep::register_live_oop(oop(q), size));
   171       VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(oop(q), size));
   172       compact_top += size;
   172       compact_top += size;
   173       assert(compact_top <= dest->space()->end(),
   173       assert(compact_top <= dest->space()->end(),
   174         "Exceeding space in destination");
   174         "Exceeding space in destination");
   175 
   175 
   176       q += size;
   176       q += size;
   232             // Update object start array
   232             // Update object start array
   233             if (start_array)
   233             if (start_array)
   234               start_array->allocate_block(compact_top);
   234               start_array->allocate_block(compact_top);
   235           }
   235           }
   236 
   236 
   237           debug_only(MarkSweep::register_live_oop(oop(q), sz));
   237           VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(oop(q), sz));
   238           compact_top += sz;
   238           compact_top += sz;
   239           assert(compact_top <= dest->space()->end(),
   239           assert(compact_top <= dest->space()->end(),
   240             "Exceeding space in destination");
   240             "Exceeding space in destination");
   241 
   241 
   242           q = end;
   242           q = end;
   324     // reinitialized the mark word during the previous pass, so we can't
   324     // reinitialized the mark word during the previous pass, so we can't
   325     // use is_gc_marked for the traversal.
   325     // use is_gc_marked for the traversal.
   326     HeapWord* end = _first_dead;
   326     HeapWord* end = _first_dead;
   327 
   327 
   328     while (q < end) {
   328     while (q < end) {
   329       debug_only(MarkSweep::track_interior_pointers(oop(q)));
   329       VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));
   330 
       
   331       // point all the oops to the new location
   330       // point all the oops to the new location
   332       size_t size = oop(q)->adjust_pointers();
   331       size_t size = oop(q)->adjust_pointers();
   333 
   332       VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());
   334       debug_only(MarkSweep::check_interior_pointers());
   333       VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));
   335 
       
   336       debug_only(MarkSweep::validate_live_oop(oop(q), size));
       
   337 
       
   338       q += size;
   334       q += size;
   339     }
   335     }
   340 
   336 
   341     if (_first_dead == t) {
   337     if (_first_dead == t) {
   342       q = t;
   338       q = t;
   352   while (q < t) {
   348   while (q < t) {
   353     // prefetch beyond q
   349     // prefetch beyond q
   354     Prefetch::write(q, interval);
   350     Prefetch::write(q, interval);
   355     if (oop(q)->is_gc_marked()) {
   351     if (oop(q)->is_gc_marked()) {
   356       // q is alive
   352       // q is alive
   357       debug_only(MarkSweep::track_interior_pointers(oop(q)));
   353       VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));
   358       // point all the oops to the new location
   354       // point all the oops to the new location
   359       size_t size = oop(q)->adjust_pointers();
   355       size_t size = oop(q)->adjust_pointers();
   360       debug_only(MarkSweep::check_interior_pointers());
   356       VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());
   361       debug_only(MarkSweep::validate_live_oop(oop(q), size));
   357       VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));
   362       debug_only(prev_q = q);
   358       debug_only(prev_q = q);
   363       q += size;
   359       q += size;
   364     } else {
   360     } else {
   365       // q is not a live object, so its mark should point at the next
   361       // q is not a live object, so its mark should point at the next
   366       // live object
   362       // live object
   390     HeapWord* const end = _first_dead;
   386     HeapWord* const end = _first_dead;
   391 
   387 
   392     while (q < end) {
   388     while (q < end) {
   393       size_t size = oop(q)->size();
   389       size_t size = oop(q)->size();
   394       assert(!oop(q)->is_gc_marked(), "should be unmarked (special dense prefix handling)");
   390       assert(!oop(q)->is_gc_marked(), "should be unmarked (special dense prefix handling)");
   395       debug_only(MarkSweep::live_oop_moved_to(q, size, q));
   391       VALIDATE_MARK_SWEEP_ONLY(MarkSweep::live_oop_moved_to(q, size, q));
   396       debug_only(prev_q = q);
   392       debug_only(prev_q = q);
   397       q += size;
   393       q += size;
   398     }
   394     }
   399 #endif
   395 #endif
   400 
   396 
   425 
   421 
   426       // prefetch beyond compaction_top
   422       // prefetch beyond compaction_top
   427       Prefetch::write(compaction_top, copy_interval);
   423       Prefetch::write(compaction_top, copy_interval);
   428 
   424 
   429       // copy object and reinit its mark
   425       // copy object and reinit its mark
   430       debug_only(MarkSweep::live_oop_moved_to(q, size, compaction_top));
   426       VALIDATE_MARK_SWEEP_ONLY(MarkSweep::live_oop_moved_to(q, size, compaction_top));
   431       assert(q != compaction_top, "everything in this pass should be moving");
   427       assert(q != compaction_top, "everything in this pass should be moving");
   432       Copy::aligned_conjoint_words(q, compaction_top, size);
   428       Copy::aligned_conjoint_words(q, compaction_top, size);
   433       oop(compaction_top)->init_mark();
   429       oop(compaction_top)->init_mark();
   434       assert(oop(compaction_top)->klass() != NULL, "should have a class");
   430       assert(oop(compaction_top)->klass() != NULL, "should have a class");
   435 
   431