45 |
45 |
46 _space = new ContiguousSpace(); |
46 _space = new ContiguousSpace(); |
47 _space->initialize(committed_region, /* clear_space = */ true, /* mangle_space = */ true); |
47 _space->initialize(committed_region, /* clear_space = */ true, /* mangle_space = */ true); |
48 |
48 |
49 // Precompute hot fields |
49 // Precompute hot fields |
50 _max_tlab_size = MIN2(CollectedHeap::max_tlab_size(), EpsilonMaxTLABSize / HeapWordSize); |
50 _max_tlab_size = MIN2(CollectedHeap::max_tlab_size(), align_object_size(EpsilonMaxTLABSize / HeapWordSize)); |
51 _step_counter_update = MIN2<size_t>(max_byte_size / 16, EpsilonUpdateCountersStep); |
51 _step_counter_update = MIN2<size_t>(max_byte_size / 16, EpsilonUpdateCountersStep); |
52 _step_heap_print = (EpsilonPrintHeapSteps == 0) ? SIZE_MAX : (max_byte_size / EpsilonPrintHeapSteps); |
52 _step_heap_print = (EpsilonPrintHeapSteps == 0) ? SIZE_MAX : (max_byte_size / EpsilonPrintHeapSteps); |
53 _decay_time_ns = (int64_t) EpsilonTLABDecayTime * NANOSECS_PER_MILLISEC; |
53 _decay_time_ns = (int64_t) EpsilonTLABDecayTime * NANOSECS_PER_MILLISEC; |
54 |
54 |
55 // Enable monitoring |
55 // Enable monitoring |
215 size = MAX2(min_size, MIN2(_max_tlab_size, size)); |
215 size = MAX2(min_size, MIN2(_max_tlab_size, size)); |
216 |
216 |
217 // Always honor alignment |
217 // Always honor alignment |
218 size = align_up(size, MinObjAlignment); |
218 size = align_up(size, MinObjAlignment); |
219 |
219 |
|
220 // Check that adjustments did not break local and global invariants |
|
221 assert(is_object_aligned(size), |
|
222 "Size honors object alignment: " SIZE_FORMAT, size); |
|
223 assert(min_size <= size, |
|
224 "Size honors min size: " SIZE_FORMAT " <= " SIZE_FORMAT, min_size, size); |
|
225 assert(size <= _max_tlab_size, |
|
226 "Size honors max size: " SIZE_FORMAT " <= " SIZE_FORMAT, size, _max_tlab_size); |
|
227 assert(size <= CollectedHeap::max_tlab_size(), |
|
228 "Size honors global max size: " SIZE_FORMAT " <= " SIZE_FORMAT, size, CollectedHeap::max_tlab_size()); |
|
229 |
220 if (log_is_enabled(Trace, gc)) { |
230 if (log_is_enabled(Trace, gc)) { |
221 ResourceMark rm; |
231 ResourceMark rm; |
222 log_trace(gc)("TLAB size for \"%s\" (Requested: " SIZE_FORMAT "K, Min: " SIZE_FORMAT |
232 log_trace(gc)("TLAB size for \"%s\" (Requested: " SIZE_FORMAT "K, Min: " SIZE_FORMAT |
223 "K, Max: " SIZE_FORMAT "K, Ergo: " SIZE_FORMAT "K) -> " SIZE_FORMAT "K", |
233 "K, Max: " SIZE_FORMAT "K, Ergo: " SIZE_FORMAT "K) -> " SIZE_FORMAT "K", |
224 thread->name(), |
234 thread->name(), |