3733
3734 statsOnly( int tmp_size = _task_queue->size();
3735 if (tmp_size > _local_max_size) {
3736 _local_max_size = tmp_size;
3737 }
3738 _local_pushes += n );
3739 }
3740
3741 // this operation was quite expensive, so decrease the limits
3742 decrease_limits();
3743 }
3744
3745 void CMTask::drain_local_queue(bool partially) {
3746 if (has_aborted()) return;
3747
3748 // Decide what the target size is, depending whether we're going to
3749 // drain it partially (so that other tasks can steal if they run out
3750 // of things to do) or totally (at the very end).
3751 size_t target_size;
3752 if (partially) {
3753 target_size = MIN2((size_t)_task_queue->max_elems()/3, GCDrainStackTargetSize);
3754 } else {
3755 target_size = 0;
3756 }
3757
3758 if (_task_queue->size() > target_size) {
3759 if (_cm->verbose_high()) {
3760 gclog_or_tty->print_cr("[%u] draining local queue, target size = " SIZE_FORMAT,
3761 _worker_id, target_size);
3762 }
3763
3764 oop obj;
3765 bool ret = _task_queue->pop_local(obj);
3766 while (ret) {
3767 statsOnly( ++_local_pops );
3768
3769 if (_cm->verbose_high()) {
3770 gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id,
3771 p2i((void*) obj));
3772 }
3773
4571 G1PPRL_BYTE_H_FORMAT
4572 G1PPRL_BYTE_H_FORMAT
4573 G1PPRL_BYTE_H_FORMAT
4574 G1PPRL_DOUBLE_H_FORMAT
4575 G1PPRL_BYTE_H_FORMAT
4576 G1PPRL_BYTE_H_FORMAT,
4577 "", "",
4578 "(bytes)", "(bytes)", "(bytes)", "(bytes/ms)",
4579 "(bytes)", "(bytes)");
4580 }
4581
4582 // It takes as a parameter a reference to one of the _hum_* fields, it
4583 // deduces the corresponding value for a region in a humongous region
4584 // series (either the region size, or what's left if the _hum_* field
4585 // is < the region size), and updates the _hum_* field accordingly.
4586 size_t G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* hum_bytes) {
4587 size_t bytes = 0;
4588 // The > 0 check is to deal with the prev and next live bytes which
4589 // could be 0.
4590 if (*hum_bytes > 0) {
4591 bytes = MIN2(HeapRegion::GrainBytes, *hum_bytes);
4592 *hum_bytes -= bytes;
4593 }
4594 return bytes;
4595 }
4596
4597 // It deduces the values for a region in a humongous region series
4598 // from the _hum_* fields and updates those accordingly. It assumes
4599 // that that _hum_* fields have already been set up from the "starts
4600 // humongous" region and we visit the regions in address order.
4601 void G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* used_bytes,
4602 size_t* capacity_bytes,
4603 size_t* prev_live_bytes,
4604 size_t* next_live_bytes) {
4605 assert(_hum_used_bytes > 0 && _hum_capacity_bytes > 0, "pre-condition");
4606 *used_bytes = get_hum_bytes(&_hum_used_bytes);
4607 *capacity_bytes = get_hum_bytes(&_hum_capacity_bytes);
4608 *prev_live_bytes = get_hum_bytes(&_hum_prev_live_bytes);
4609 *next_live_bytes = get_hum_bytes(&_hum_next_live_bytes);
4610 }
4611
|
3733
3734 statsOnly( int tmp_size = _task_queue->size();
3735 if (tmp_size > _local_max_size) {
3736 _local_max_size = tmp_size;
3737 }
3738 _local_pushes += n );
3739 }
3740
3741 // this operation was quite expensive, so decrease the limits
3742 decrease_limits();
3743 }
3744
3745 void CMTask::drain_local_queue(bool partially) {
3746 if (has_aborted()) return;
3747
3748 // Decide what the target size is, depending whether we're going to
3749 // drain it partially (so that other tasks can steal if they run out
3750 // of things to do) or totally (at the very end).
3751 size_t target_size;
3752 if (partially) {
3753 target_size = MIN2((_task_queue->max_elems()/3), GCDrainStackTargetSize);
3754 } else {
3755 target_size = 0;
3756 }
3757
3758 if (_task_queue->size() > target_size) {
3759 if (_cm->verbose_high()) {
3760 gclog_or_tty->print_cr("[%u] draining local queue, target size = " SIZE_FORMAT,
3761 _worker_id, target_size);
3762 }
3763
3764 oop obj;
3765 bool ret = _task_queue->pop_local(obj);
3766 while (ret) {
3767 statsOnly( ++_local_pops );
3768
3769 if (_cm->verbose_high()) {
3770 gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id,
3771 p2i((void*) obj));
3772 }
3773
4571 G1PPRL_BYTE_H_FORMAT
4572 G1PPRL_BYTE_H_FORMAT
4573 G1PPRL_BYTE_H_FORMAT
4574 G1PPRL_DOUBLE_H_FORMAT
4575 G1PPRL_BYTE_H_FORMAT
4576 G1PPRL_BYTE_H_FORMAT,
4577 "", "",
4578 "(bytes)", "(bytes)", "(bytes)", "(bytes/ms)",
4579 "(bytes)", "(bytes)");
4580 }
4581
4582 // It takes as a parameter a reference to one of the _hum_* fields, it
4583 // deduces the corresponding value for a region in a humongous region
4584 // series (either the region size, or what's left if the _hum_* field
4585 // is < the region size), and updates the _hum_* field accordingly.
4586 size_t G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* hum_bytes) {
4587 size_t bytes = 0;
4588 // The > 0 check is to deal with the prev and next live bytes which
4589 // could be 0.
4590 if (*hum_bytes > 0) {
4591 bytes = MIN2(HeapRegion::GrainBytes, (size_t)*hum_bytes);
4592 *hum_bytes -= bytes;
4593 }
4594 return bytes;
4595 }
4596
4597 // It deduces the values for a region in a humongous region series
4598 // from the _hum_* fields and updates those accordingly. It assumes
4599 // that that _hum_* fields have already been set up from the "starts
4600 // humongous" region and we visit the regions in address order.
4601 void G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* used_bytes,
4602 size_t* capacity_bytes,
4603 size_t* prev_live_bytes,
4604 size_t* next_live_bytes) {
4605 assert(_hum_used_bytes > 0 && _hum_capacity_bytes > 0, "pre-condition");
4606 *used_bytes = get_hum_bytes(&_hum_used_bytes);
4607 *capacity_bytes = get_hum_bytes(&_hum_capacity_bytes);
4608 *prev_live_bytes = get_hum_bytes(&_hum_prev_live_bytes);
4609 *next_live_bytes = get_hum_bytes(&_hum_next_live_bytes);
4610 }
4611
|