< prev index next >

src/share/vm/gc_implementation/g1/concurrentMark.cpp

Print this page
rev 7903 : imported patch skip_stale


3548 void CMTask::reset(CMBitMap* nextMarkBitMap) {
3549   guarantee(nextMarkBitMap != NULL, "invariant");
3550 
3551   if (_cm->verbose_low()) {
3552     gclog_or_tty->print_cr("[%u] resetting", _worker_id);
3553   }
3554 
3555   _nextMarkBitMap                = nextMarkBitMap;
3556   clear_region_fields();
3557 
3558   _calls                         = 0;
3559   _elapsed_time_ms               = 0.0;
3560   _termination_time_ms           = 0.0;
3561   _termination_start_time_ms     = 0.0;
3562 
3563 #if _MARKING_STATS_
3564   _local_pushes                  = 0;
3565   _local_pops                    = 0;
3566   _local_max_size                = 0;
3567   _objs_scanned                  = 0;

3568   _global_pushes                 = 0;
3569   _global_pops                   = 0;
3570   _global_max_size               = 0;
3571   _global_transfers_to           = 0;
3572   _global_transfers_from         = 0;
3573   _regions_claimed               = 0;
3574   _objs_found_on_bitmap          = 0;
3575   _satb_buffers_processed        = 0;
3576   _steal_attempts                = 0;
3577   _steals                        = 0;
3578   _aborted                       = 0;
3579   _aborted_overflow              = 0;
3580   _aborted_cm_aborted            = 0;
3581   _aborted_yield                 = 0;
3582   _aborted_timed_out             = 0;
3583   _aborted_satb                  = 0;
3584   _aborted_termination           = 0;
3585 #endif // _MARKING_STATS_
3586 }
3587 


3801     target_size = 0;
3802   }
3803 
3804   if (_task_queue->size() > target_size) {
3805     if (_cm->verbose_high()) {
3806       gclog_or_tty->print_cr("[%u] draining local queue, target size = " SIZE_FORMAT,
3807                              _worker_id, target_size);
3808     }
3809 
3810     oop obj;
3811     bool ret = _task_queue->pop_local(obj);
3812     while (ret) {
3813       statsOnly( ++_local_pops );
3814 
3815       if (_cm->verbose_high()) {
3816         gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id,
3817                                p2i((void*) obj));
3818       }
3819 
3820       assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" );
3821       assert(!_g1h->is_on_master_free_list(
3822                   _g1h->heap_region_containing((HeapWord*) obj)), "invariant");
3823 





3824       scan_object(obj);

3825 
3826       if (_task_queue->size() <= target_size || has_aborted()) {
3827         ret = false;
3828       } else {
3829         ret = _task_queue->pop_local(obj);
3830       }
3831     }
3832 
3833     if (_cm->verbose_high()) {
3834       gclog_or_tty->print_cr("[%u] drained local queue, size = %u",
3835                              _worker_id, _task_queue->size());
3836     }
3837   }
3838 }
3839 
3840 void CMTask::drain_global_stack(bool partially) {
3841   if (has_aborted()) return;
3842 
3843   // We have a policy to drain the local queue before we attempt to
3844   // drain the global stack.


3931   gclog_or_tty->print_cr("  Clock Intervals (cum): num = %d, avg = %1.2lfms, sd = %1.2lfms",
3932                          _all_clock_intervals_ms.num(), _all_clock_intervals_ms.avg(),
3933                          _all_clock_intervals_ms.sd());
3934   gclog_or_tty->print_cr("                         max = %1.2lfms, total = %1.2lfms",
3935                          _all_clock_intervals_ms.maximum(),
3936                          _all_clock_intervals_ms.sum());
3937   gclog_or_tty->print_cr("  Clock Causes (cum): scanning = %d, marking = %d",
3938                          _clock_due_to_scanning, _clock_due_to_marking);
3939   gclog_or_tty->print_cr("  Objects: scanned = %d, found on the bitmap = %d",
3940                          _objs_scanned, _objs_found_on_bitmap);
3941   gclog_or_tty->print_cr("  Local Queue:  pushes = %d, pops = %d, max size = %d",
3942                          _local_pushes, _local_pops, _local_max_size);
3943   gclog_or_tty->print_cr("  Global Stack: pushes = %d, pops = %d, max size = %d",
3944                          _global_pushes, _global_pops, _global_max_size);
3945   gclog_or_tty->print_cr("                transfers to = %d, transfers from = %d",
3946                          _global_transfers_to,_global_transfers_from);
3947   gclog_or_tty->print_cr("  Regions: claimed = %d", _regions_claimed);
3948   gclog_or_tty->print_cr("  SATB buffers: processed = %d", _satb_buffers_processed);
3949   gclog_or_tty->print_cr("  Steals: attempts = %d, successes = %d",
3950                          _steal_attempts, _steals);


3951   gclog_or_tty->print_cr("  Aborted: %d, due to", _aborted);
3952   gclog_or_tty->print_cr("    overflow: %d, global abort: %d, yield: %d",
3953                          _aborted_overflow, _aborted_cm_aborted, _aborted_yield);
3954   gclog_or_tty->print_cr("    time out: %d, SATB: %d, termination: %d",
3955                          _aborted_timed_out, _aborted_satb, _aborted_termination);
3956 #endif // _MARKING_STATS_
3957 }
3958 
3959 /*****************************************************************************
3960 
3961     The do_marking_step(time_target_ms, ...) method is the building
3962     block of the parallel marking framework. It can be called in parallel
3963     with other invocations of do_marking_step() on different tasks
3964     (but only one per task, obviously) and concurrently with the
3965     mutator threads, or during remark, hence it eliminates the need
3966     for two versions of the code. When called during remark, it will
3967     pick up from where the task left off during the concurrent marking
3968     phase. Interestingly, tasks are also claimable during evacuation
3969     pauses too, since do_marking_step() ensures that it aborts before
3970     it needs to yield.


4307     // tasks might be pushing objects to it concurrently.
4308     assert(_cm->out_of_regions() && _task_queue->size() == 0,
4309            "only way to reach here");
4310 
4311     if (_cm->verbose_low()) {
4312       gclog_or_tty->print_cr("[%u] starting to steal", _worker_id);
4313     }
4314 
4315     while (!has_aborted()) {
4316       oop obj;
4317       statsOnly( ++_steal_attempts );
4318 
4319       if (_cm->try_stealing(_worker_id, &_hash_seed, obj)) {
4320         if (_cm->verbose_medium()) {
4321           gclog_or_tty->print_cr("[%u] stolen "PTR_FORMAT" successfully",
4322                                  _worker_id, p2i((void*) obj));
4323         }
4324 
4325         statsOnly( ++_steals );
4326 



4327         assert(_nextMarkBitMap->isMarked((HeapWord*) obj),
4328                "any stolen object should be marked");
4329         scan_object(obj);

4330 
4331         // And since we're towards the end, let's totally drain the
4332         // local queue and global stack.
4333         drain_local_queue(false);
4334         drain_global_stack(false);
4335       } else {
4336         break;
4337       }
4338     }
4339   }
4340 
4341   // If we are about to wrap up and go into termination, check if we
4342   // should raise the overflow flag.
4343   if (do_termination && !has_aborted()) {
4344     if (_cm->force_overflow()->should_force()) {
4345       _cm->set_has_overflown();
4346       regular_clock_call();
4347     }
4348   }
4349 




3548 void CMTask::reset(CMBitMap* nextMarkBitMap) {
3549   guarantee(nextMarkBitMap != NULL, "invariant");
3550 
3551   if (_cm->verbose_low()) {
3552     gclog_or_tty->print_cr("[%u] resetting", _worker_id);
3553   }
3554 
3555   _nextMarkBitMap                = nextMarkBitMap;
3556   clear_region_fields();
3557 
3558   _calls                         = 0;
3559   _elapsed_time_ms               = 0.0;
3560   _termination_time_ms           = 0.0;
3561   _termination_start_time_ms     = 0.0;
3562 
3563 #if _MARKING_STATS_
3564   _local_pushes                  = 0;
3565   _local_pops                    = 0;
3566   _local_max_size                = 0;
3567   _objs_scanned                  = 0;
3568   _stale_humongous_queue_entries = 0;
3569   _global_pushes                 = 0;
3570   _global_pops                   = 0;
3571   _global_max_size               = 0;
3572   _global_transfers_to           = 0;
3573   _global_transfers_from         = 0;
3574   _regions_claimed               = 0;
3575   _objs_found_on_bitmap          = 0;
3576   _satb_buffers_processed        = 0;
3577   _steal_attempts                = 0;
3578   _steals                        = 0;
3579   _aborted                       = 0;
3580   _aborted_overflow              = 0;
3581   _aborted_cm_aborted            = 0;
3582   _aborted_yield                 = 0;
3583   _aborted_timed_out             = 0;
3584   _aborted_satb                  = 0;
3585   _aborted_termination           = 0;
3586 #endif // _MARKING_STATS_
3587 }
3588 


3802     target_size = 0;
3803   }
3804 
3805   if (_task_queue->size() > target_size) {
3806     if (_cm->verbose_high()) {
3807       gclog_or_tty->print_cr("[%u] draining local queue, target size = " SIZE_FORMAT,
3808                              _worker_id, target_size);
3809     }
3810 
3811     oop obj;
3812     bool ret = _task_queue->pop_local(obj);
3813     while (ret) {
3814       statsOnly( ++_local_pops );
3815 
3816       if (_cm->verbose_high()) {
3817         gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id,
3818                                p2i((void*) obj));
3819       }
3820 
3821       assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" );


3822 
3823       if (is_stale_humongous_queue_entry(obj)) {
3824         statsOnly( ++stale_humongous_queue_entries );
3825       } else {
3826         assert(!_g1h->is_on_master_free_list(
3827                  _g1h->heap_region_containing(obj)), "invariant");
3828         scan_object(obj);
3829       }
3830 
3831       if (_task_queue->size() <= target_size || has_aborted()) {
3832         ret = false;
3833       } else {
3834         ret = _task_queue->pop_local(obj);
3835       }
3836     }
3837 
3838     if (_cm->verbose_high()) {
3839       gclog_or_tty->print_cr("[%u] drained local queue, size = %u",
3840                              _worker_id, _task_queue->size());
3841     }
3842   }
3843 }
3844 
3845 void CMTask::drain_global_stack(bool partially) {
3846   if (has_aborted()) return;
3847 
3848   // We have a policy to drain the local queue before we attempt to
3849   // drain the global stack.


3936   gclog_or_tty->print_cr("  Clock Intervals (cum): num = %d, avg = %1.2lfms, sd = %1.2lfms",
3937                          _all_clock_intervals_ms.num(), _all_clock_intervals_ms.avg(),
3938                          _all_clock_intervals_ms.sd());
3939   gclog_or_tty->print_cr("                         max = %1.2lfms, total = %1.2lfms",
3940                          _all_clock_intervals_ms.maximum(),
3941                          _all_clock_intervals_ms.sum());
3942   gclog_or_tty->print_cr("  Clock Causes (cum): scanning = %d, marking = %d",
3943                          _clock_due_to_scanning, _clock_due_to_marking);
3944   gclog_or_tty->print_cr("  Objects: scanned = %d, found on the bitmap = %d",
3945                          _objs_scanned, _objs_found_on_bitmap);
3946   gclog_or_tty->print_cr("  Local Queue:  pushes = %d, pops = %d, max size = %d",
3947                          _local_pushes, _local_pops, _local_max_size);
3948   gclog_or_tty->print_cr("  Global Stack: pushes = %d, pops = %d, max size = %d",
3949                          _global_pushes, _global_pops, _global_max_size);
3950   gclog_or_tty->print_cr("                transfers to = %d, transfers from = %d",
3951                          _global_transfers_to,_global_transfers_from);
3952   gclog_or_tty->print_cr("  Regions: claimed = %d", _regions_claimed);
3953   gclog_or_tty->print_cr("  SATB buffers: processed = %d", _satb_buffers_processed);
3954   gclog_or_tty->print_cr("  Steals: attempts = %d, successes = %d",
3955                          _steal_attempts, _steals);
3956   gclog_or_tty->print_cr("  Skipped stale humongous queue entries = %d",
3957                          _stale_humongous_queue_entries);
3958   gclog_or_tty->print_cr("  Aborted: %d, due to", _aborted);
3959   gclog_or_tty->print_cr("    overflow: %d, global abort: %d, yield: %d",
3960                          _aborted_overflow, _aborted_cm_aborted, _aborted_yield);
3961   gclog_or_tty->print_cr("    time out: %d, SATB: %d, termination: %d",
3962                          _aborted_timed_out, _aborted_satb, _aborted_termination);
3963 #endif // _MARKING_STATS_
3964 }
3965 
3966 /*****************************************************************************
3967 
3968     The do_marking_step(time_target_ms, ...) method is the building
3969     block of the parallel marking framework. It can be called in parallel
3970     with other invocations of do_marking_step() on different tasks
3971     (but only one per task, obviously) and concurrently with the
3972     mutator threads, or during remark, hence it eliminates the need
3973     for two versions of the code. When called during remark, it will
3974     pick up from where the task left off during the concurrent marking
3975     phase. Interestingly, tasks are also claimable during evacuation
3976     pauses too, since do_marking_step() ensures that it aborts before
3977     it needs to yield.


4314     // tasks might be pushing objects to it concurrently.
4315     assert(_cm->out_of_regions() && _task_queue->size() == 0,
4316            "only way to reach here");
4317 
4318     if (_cm->verbose_low()) {
4319       gclog_or_tty->print_cr("[%u] starting to steal", _worker_id);
4320     }
4321 
4322     while (!has_aborted()) {
4323       oop obj;
4324       statsOnly( ++_steal_attempts );
4325 
4326       if (_cm->try_stealing(_worker_id, &_hash_seed, obj)) {
4327         if (_cm->verbose_medium()) {
4328           gclog_or_tty->print_cr("[%u] stolen "PTR_FORMAT" successfully",
4329                                  _worker_id, p2i((void*) obj));
4330         }
4331 
4332         statsOnly( ++_steals );
4333 
4334         if (is_stale_humongous_queue_entry(obj)) {
4335           statsOnly( ++stale_humongous_queue_entries );
4336         } else {
4337           assert(_nextMarkBitMap->isMarked((HeapWord*) obj),
4338                  "any stolen object should be marked");
4339           scan_object(obj);
4340         }
4341 
4342         // And since we're towards the end, let's totally drain the
4343         // local queue and global stack.
4344         drain_local_queue(false);
4345         drain_global_stack(false);
4346       } else {
4347         break;
4348       }
4349     }
4350   }
4351 
4352   // If we are about to wrap up and go into termination, check if we
4353   // should raise the overflow flag.
4354   if (do_termination && !has_aborted()) {
4355     if (_cm->force_overflow()->should_force()) {
4356       _cm->set_has_overflown();
4357       regular_clock_call();
4358     }
4359   }
4360 


< prev index next >