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

Print this page
rev 2722 : 7095194: G1: HeapRegion::GrainBytes, GrainWords, and CardsPerRegion should be size_t
Summary: Declare GrainBytes, GrainWords, and CardsPerRegion as size_t.
Reviewed-by:


4556 G1PrintRegionLivenessInfoClosure(outputStream* out, const char* phase_name)
4557   : _out(out),
4558     _total_used_bytes(0), _total_capacity_bytes(0),
4559     _total_prev_live_bytes(0), _total_next_live_bytes(0),
4560     _hum_used_bytes(0), _hum_capacity_bytes(0),
4561     _hum_prev_live_bytes(0), _hum_next_live_bytes(0) {
4562   G1CollectedHeap* g1h = G1CollectedHeap::heap();
4563   MemRegion g1_committed = g1h->g1_committed();
4564   MemRegion g1_reserved = g1h->g1_reserved();
4565   double now = os::elapsedTime();
4566 
4567   // Print the header of the output.
4568   _out->cr();
4569   _out->print_cr(G1PPRL_LINE_PREFIX" PHASE %s @ %1.3f", phase_name, now);
4570   _out->print_cr(G1PPRL_LINE_PREFIX" HEAP"
4571                  G1PPRL_SUM_ADDR_FORMAT("committed")
4572                  G1PPRL_SUM_ADDR_FORMAT("reserved")
4573                  G1PPRL_SUM_BYTE_FORMAT("region-size"),
4574                  g1_committed.start(), g1_committed.end(),
4575                  g1_reserved.start(), g1_reserved.end(),
4576                  (size_t)HeapRegion::GrainBytes);
4577   _out->print_cr(G1PPRL_LINE_PREFIX);
4578   _out->print_cr(G1PPRL_LINE_PREFIX
4579                  G1PPRL_TYPE_H_FORMAT
4580                  G1PPRL_ADDR_BASE_H_FORMAT
4581                  G1PPRL_BYTE_H_FORMAT
4582                  G1PPRL_BYTE_H_FORMAT
4583                  G1PPRL_BYTE_H_FORMAT
4584                  G1PPRL_DOUBLE_H_FORMAT,
4585                  "type", "address-range",
4586                  "used", "prev-live", "next-live", "gc-eff");
4587   _out->print_cr(G1PPRL_LINE_PREFIX
4588                  G1PPRL_TYPE_H_FORMAT
4589                  G1PPRL_ADDR_BASE_H_FORMAT
4590                  G1PPRL_BYTE_H_FORMAT
4591                  G1PPRL_BYTE_H_FORMAT
4592                  G1PPRL_BYTE_H_FORMAT
4593                  G1PPRL_DOUBLE_H_FORMAT,
4594                  "", "",
4595                  "(bytes)", "(bytes)", "(bytes)", "(bytes/ms)");
4596 }
4597 
4598 // It takes as a parameter a reference to one of the _hum_* fields, it
4599 // deduces the corresponding value for a region in a humongous region
4600 // series (either the region size, or what's left if the _hum_* field
4601 // is < the region size), and updates the _hum_* field accordingly.
4602 size_t G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* hum_bytes) {
4603   size_t bytes = 0;
4604   // The > 0 check is to deal with the prev and next live bytes which
4605   // could be 0.
4606   if (*hum_bytes > 0) {
4607     bytes = MIN2((size_t) HeapRegion::GrainBytes, *hum_bytes);
4608     *hum_bytes -= bytes;
4609   }
4610   return bytes;
4611 }
4612 
4613 // It deduces the values for a region in a humongous region series
4614 // from the _hum_* fields and updates those accordingly. It assumes
4615 // that that _hum_* fields have already been set up from the "starts
4616 // humongous" region and we visit the regions in address order.
4617 void G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* used_bytes,
4618                                                      size_t* capacity_bytes,
4619                                                      size_t* prev_live_bytes,
4620                                                      size_t* next_live_bytes) {
4621   assert(_hum_used_bytes > 0 && _hum_capacity_bytes > 0, "pre-condition");
4622   *used_bytes      = get_hum_bytes(&_hum_used_bytes);
4623   *capacity_bytes  = get_hum_bytes(&_hum_capacity_bytes);
4624   *prev_live_bytes = get_hum_bytes(&_hum_prev_live_bytes);
4625   *next_live_bytes = get_hum_bytes(&_hum_next_live_bytes);
4626 }
4627 




4556 G1PrintRegionLivenessInfoClosure(outputStream* out, const char* phase_name)
4557   : _out(out),
4558     _total_used_bytes(0), _total_capacity_bytes(0),
4559     _total_prev_live_bytes(0), _total_next_live_bytes(0),
4560     _hum_used_bytes(0), _hum_capacity_bytes(0),
4561     _hum_prev_live_bytes(0), _hum_next_live_bytes(0) {
4562   G1CollectedHeap* g1h = G1CollectedHeap::heap();
4563   MemRegion g1_committed = g1h->g1_committed();
4564   MemRegion g1_reserved = g1h->g1_reserved();
4565   double now = os::elapsedTime();
4566 
4567   // Print the header of the output.
4568   _out->cr();
4569   _out->print_cr(G1PPRL_LINE_PREFIX" PHASE %s @ %1.3f", phase_name, now);
4570   _out->print_cr(G1PPRL_LINE_PREFIX" HEAP"
4571                  G1PPRL_SUM_ADDR_FORMAT("committed")
4572                  G1PPRL_SUM_ADDR_FORMAT("reserved")
4573                  G1PPRL_SUM_BYTE_FORMAT("region-size"),
4574                  g1_committed.start(), g1_committed.end(),
4575                  g1_reserved.start(), g1_reserved.end(),
4576                  HeapRegion::GrainBytes);
4577   _out->print_cr(G1PPRL_LINE_PREFIX);
4578   _out->print_cr(G1PPRL_LINE_PREFIX
4579                  G1PPRL_TYPE_H_FORMAT
4580                  G1PPRL_ADDR_BASE_H_FORMAT
4581                  G1PPRL_BYTE_H_FORMAT
4582                  G1PPRL_BYTE_H_FORMAT
4583                  G1PPRL_BYTE_H_FORMAT
4584                  G1PPRL_DOUBLE_H_FORMAT,
4585                  "type", "address-range",
4586                  "used", "prev-live", "next-live", "gc-eff");
4587   _out->print_cr(G1PPRL_LINE_PREFIX
4588                  G1PPRL_TYPE_H_FORMAT
4589                  G1PPRL_ADDR_BASE_H_FORMAT
4590                  G1PPRL_BYTE_H_FORMAT
4591                  G1PPRL_BYTE_H_FORMAT
4592                  G1PPRL_BYTE_H_FORMAT
4593                  G1PPRL_DOUBLE_H_FORMAT,
4594                  "", "",
4595                  "(bytes)", "(bytes)", "(bytes)", "(bytes/ms)");
4596 }
4597 
4598 // It takes as a parameter a reference to one of the _hum_* fields, it
4599 // deduces the corresponding value for a region in a humongous region
4600 // series (either the region size, or what's left if the _hum_* field
4601 // is < the region size), and updates the _hum_* field accordingly.
4602 size_t G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* hum_bytes) {
4603   size_t bytes = 0;
4604   // The > 0 check is to deal with the prev and next live bytes which
4605   // could be 0.
4606   if (*hum_bytes > 0) {
4607     bytes = MIN2(HeapRegion::GrainBytes, *hum_bytes);
4608     *hum_bytes -= bytes;
4609   }
4610   return bytes;
4611 }
4612 
4613 // It deduces the values for a region in a humongous region series
4614 // from the _hum_* fields and updates those accordingly. It assumes
4615 // that that _hum_* fields have already been set up from the "starts
4616 // humongous" region and we visit the regions in address order.
4617 void G1PrintRegionLivenessInfoClosure::get_hum_bytes(size_t* used_bytes,
4618                                                      size_t* capacity_bytes,
4619                                                      size_t* prev_live_bytes,
4620                                                      size_t* next_live_bytes) {
4621   assert(_hum_used_bytes > 0 && _hum_capacity_bytes > 0, "pre-condition");
4622   *used_bytes      = get_hum_bytes(&_hum_used_bytes);
4623   *capacity_bytes  = get_hum_bytes(&_hum_capacity_bytes);
4624   *prev_live_bytes = get_hum_bytes(&_hum_prev_live_bytes);
4625   *next_live_bytes = get_hum_bytes(&_hum_next_live_bytes);
4626 }
4627