95
96 if (_allocated == 0) {
97 assert(_unused == 0,
98 err_msg("Inconsistency in PLAB stats: "
99 "_allocated: "SIZE_FORMAT", "
100 "_wasted: "SIZE_FORMAT", "
101 "_unused: "SIZE_FORMAT", "
102 "_used : "SIZE_FORMAT,
103 _allocated, _wasted, _unused, _used));
104
105 _allocated = 1;
106 }
107 double wasted_frac = (double)_unused/(double)_allocated;
108 size_t target_refills = (size_t)((wasted_frac*TargetSurvivorRatio)/
109 TargetPLABWastePct);
110 if (target_refills == 0) {
111 target_refills = 1;
112 }
113 _used = _allocated - _wasted - _unused;
114 size_t plab_sz = _used/(target_refills*no_of_gc_workers);
115 if (PrintPLAB) gclog_or_tty->print(" (plab_sz = %d ", plab_sz);
116 // Take historical weighted average
117 _filter.sample(plab_sz);
118 // Clip from above and below, and align to object boundary
119 plab_sz = MAX2(min_size(), (size_t)_filter.average());
120 plab_sz = MIN2(max_size(), plab_sz);
121 plab_sz = align_object_size(plab_sz);
122 // Latch the result
123 if (PrintPLAB) gclog_or_tty->print(" desired_plab_sz = %d) ", plab_sz);
124 _desired_plab_sz = plab_sz;
125 // Now clear the accumulators for next round:
126 // note this needs to be fixed in the case where we
127 // are retaining across scavenges. FIX ME !!! XXX
128 _allocated = 0;
129 _wasted = 0;
130 _unused = 0;
131 }
132
133 #ifndef PRODUCT
134 void ParGCAllocBuffer::print() {
135 gclog_or_tty->print("parGCAllocBuffer: _bottom: %p _top: %p _end: %p _hard_end: %p"
136 "_retained: %c _retained_filler: [%p,%p)\n",
137 _bottom, _top, _end, _hard_end,
138 "FT"[_retained], _retained_filler.start(), _retained_filler.end());
139 }
140 #endif // !PRODUCT
141
142 const size_t ParGCAllocBufferWithBOT::ChunkSizeInWords =
143 MIN2(CardTableModRefBS::par_chunk_heapword_alignment(),
|
95
96 if (_allocated == 0) {
97 assert(_unused == 0,
98 err_msg("Inconsistency in PLAB stats: "
99 "_allocated: "SIZE_FORMAT", "
100 "_wasted: "SIZE_FORMAT", "
101 "_unused: "SIZE_FORMAT", "
102 "_used : "SIZE_FORMAT,
103 _allocated, _wasted, _unused, _used));
104
105 _allocated = 1;
106 }
107 double wasted_frac = (double)_unused/(double)_allocated;
108 size_t target_refills = (size_t)((wasted_frac*TargetSurvivorRatio)/
109 TargetPLABWastePct);
110 if (target_refills == 0) {
111 target_refills = 1;
112 }
113 _used = _allocated - _wasted - _unused;
114 size_t plab_sz = _used/(target_refills*no_of_gc_workers);
115 if (PrintPLAB) gclog_or_tty->print(" (plab_sz = " SIZE_FORMAT " ", plab_sz);
116 // Take historical weighted average
117 _filter.sample(plab_sz);
118 // Clip from above and below, and align to object boundary
119 plab_sz = MAX2(min_size(), (size_t)_filter.average());
120 plab_sz = MIN2(max_size(), plab_sz);
121 plab_sz = align_object_size(plab_sz);
122 // Latch the result
123 if (PrintPLAB) gclog_or_tty->print(" desired_plab_sz = " SIZE_FORMAT ") ", plab_sz);
124 _desired_plab_sz = plab_sz;
125 // Now clear the accumulators for next round:
126 // note this needs to be fixed in the case where we
127 // are retaining across scavenges. FIX ME !!! XXX
128 _allocated = 0;
129 _wasted = 0;
130 _unused = 0;
131 }
132
133 #ifndef PRODUCT
134 void ParGCAllocBuffer::print() {
135 gclog_or_tty->print("parGCAllocBuffer: _bottom: %p _top: %p _end: %p _hard_end: %p"
136 "_retained: %c _retained_filler: [%p,%p)\n",
137 _bottom, _top, _end, _hard_end,
138 "FT"[_retained], _retained_filler.start(), _retained_filler.end());
139 }
140 #endif // !PRODUCT
141
142 const size_t ParGCAllocBufferWithBOT::ChunkSizeInWords =
143 MIN2(CardTableModRefBS::par_chunk_heapword_alignment(),
|