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

Print this page




3754 
3755     statsOnly( int tmp_size = _task_queue->size();
3756                if (tmp_size > _local_max_size) {
3757                  _local_max_size = tmp_size;
3758                }
3759                _local_pushes += n );
3760   }
3761 
3762   // this operation was quite expensive, so decrease the limits
3763   decrease_limits();
3764 }
3765 
3766 void CMTask::drain_local_queue(bool partially) {
3767   if (has_aborted()) return;
3768 
3769   // Decide what the target size is, depending whether we're going to
3770   // drain it partially (so that other tasks can steal if they run out
3771   // of things to do) or totally (at the very end).
3772   size_t target_size;
3773   if (partially) {
3774     target_size = MIN2((size_t)_task_queue->max_elems()/3, GCDrainStackTargetSize);
3775   } else {
3776     target_size = 0;
3777   }
3778 
3779   if (_task_queue->size() > target_size) {
3780     if (_cm->verbose_high()) {
3781       gclog_or_tty->print_cr("[%u] draining local queue, target size = " SIZE_FORMAT,
3782                              _worker_id, target_size);
3783     }
3784 
3785     oop obj;
3786     bool ret = _task_queue->pop_local(obj);
3787     while (ret) {
3788       statsOnly( ++_local_pops );
3789 
3790       if (_cm->verbose_high()) {
3791         gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id,
3792                                p2i((void*) obj));
3793       }
3794 


4592                 G1PPRL_BYTE_H_FORMAT
4593                 G1PPRL_BYTE_H_FORMAT
4594                 G1PPRL_BYTE_H_FORMAT
4595                 G1PPRL_DOUBLE_H_FORMAT
4596                 G1PPRL_BYTE_H_FORMAT
4597                 G1PPRL_BYTE_H_FORMAT,
4598                 "", "",
4599                 "(bytes)", "(bytes)", "(bytes)", "(bytes/ms)",
4600                 "(bytes)", "(bytes)");
4601 }
4602 
4603 // It takes as a parameter a reference to one of the _hum_* fields, it
4604 // deduces the corresponding value for a region in a humongous region
4605 // series (either the region size, or what's left if the _hum_* field
4606 // is < the region size), and updates the _hum_* field accordingly.
4607 size_t G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* hum_bytes) {
4608   size_t bytes = 0;
4609   // The > 0 check is to deal with the prev and next live bytes which
4610   // could be 0.
4611   if (*hum_bytes > 0) {
4612     bytes = MIN2(HeapRegion::GrainBytes, *hum_bytes);
4613     *hum_bytes -= bytes;
4614   }
4615   return bytes;
4616 }
4617 
4618 // It deduces the values for a region in a humongous region series
4619 // from the _hum_* fields and updates those accordingly. It assumes
4620 // that that _hum_* fields have already been set up from the "starts
4621 // humongous" region and we visit the regions in address order.
4622 void G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* used_bytes,
4623                                                      size_t* capacity_bytes,
4624                                                      size_t* prev_live_bytes,
4625                                                      size_t* next_live_bytes) {
4626   assert(_hum_used_bytes > 0 && _hum_capacity_bytes > 0, "pre-condition");
4627   *used_bytes      = get_hum_bytes(&_hum_used_bytes);
4628   *capacity_bytes  = get_hum_bytes(&_hum_capacity_bytes);
4629   *prev_live_bytes = get_hum_bytes(&_hum_prev_live_bytes);
4630   *next_live_bytes = get_hum_bytes(&_hum_next_live_bytes);
4631 }
4632 




3754 
3755     statsOnly( int tmp_size = _task_queue->size();
3756                if (tmp_size > _local_max_size) {
3757                  _local_max_size = tmp_size;
3758                }
3759                _local_pushes += n );
3760   }
3761 
3762   // this operation was quite expensive, so decrease the limits
3763   decrease_limits();
3764 }
3765 
3766 void CMTask::drain_local_queue(bool partially) {
3767   if (has_aborted()) return;
3768 
3769   // Decide what the target size is, depending whether we're going to
3770   // drain it partially (so that other tasks can steal if they run out
3771   // of things to do) or totally (at the very end).
3772   size_t target_size;
3773   if (partially) {
3774     target_size = MIN2((_task_queue->max_elems()/3), GCDrainStackTargetSize);
3775   } else {
3776     target_size = 0;
3777   }
3778 
3779   if (_task_queue->size() > target_size) {
3780     if (_cm->verbose_high()) {
3781       gclog_or_tty->print_cr("[%u] draining local queue, target size = " SIZE_FORMAT,
3782                              _worker_id, target_size);
3783     }
3784 
3785     oop obj;
3786     bool ret = _task_queue->pop_local(obj);
3787     while (ret) {
3788       statsOnly( ++_local_pops );
3789 
3790       if (_cm->verbose_high()) {
3791         gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id,
3792                                p2i((void*) obj));
3793       }
3794 


4592                 G1PPRL_BYTE_H_FORMAT
4593                 G1PPRL_BYTE_H_FORMAT
4594                 G1PPRL_BYTE_H_FORMAT
4595                 G1PPRL_DOUBLE_H_FORMAT
4596                 G1PPRL_BYTE_H_FORMAT
4597                 G1PPRL_BYTE_H_FORMAT,
4598                 "", "",
4599                 "(bytes)", "(bytes)", "(bytes)", "(bytes/ms)",
4600                 "(bytes)", "(bytes)");
4601 }
4602 
4603 // It takes as a parameter a reference to one of the _hum_* fields, it
4604 // deduces the corresponding value for a region in a humongous region
4605 // series (either the region size, or what's left if the _hum_* field
4606 // is < the region size), and updates the _hum_* field accordingly.
4607 size_t G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* hum_bytes) {
4608   size_t bytes = 0;
4609   // The > 0 check is to deal with the prev and next live bytes which
4610   // could be 0.
4611   if (*hum_bytes > 0) {
4612     bytes = MIN2(HeapRegion::GrainBytes, (size_t)*hum_bytes);
4613     *hum_bytes -= bytes;
4614   }
4615   return bytes;
4616 }
4617 
4618 // It deduces the values for a region in a humongous region series
4619 // from the _hum_* fields and updates those accordingly. It assumes
4620 // that that _hum_* fields have already been set up from the "starts
4621 // humongous" region and we visit the regions in address order.
4622 void G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* used_bytes,
4623                                                      size_t* capacity_bytes,
4624                                                      size_t* prev_live_bytes,
4625                                                      size_t* next_live_bytes) {
4626   assert(_hum_used_bytes > 0 && _hum_capacity_bytes > 0, "pre-condition");
4627   *used_bytes      = get_hum_bytes(&_hum_used_bytes);
4628   *capacity_bytes  = get_hum_bytes(&_hum_capacity_bytes);
4629   *prev_live_bytes = get_hum_bytes(&_hum_prev_live_bytes);
4630   *next_live_bytes = get_hum_bytes(&_hum_next_live_bytes);
4631 }
4632