2100 } |
2100 } |
2101 |
2101 |
2102 size_t G1CollectedHeap::unsafe_max_tlab_alloc(Thread* ignored) const { |
2102 size_t G1CollectedHeap::unsafe_max_tlab_alloc(Thread* ignored) const { |
2103 // Return the remaining space in the cur alloc region, but not less than |
2103 // Return the remaining space in the cur alloc region, but not less than |
2104 // the min TLAB size. |
2104 // the min TLAB size. |
2105 // Also, no more than half the region size, since we can't allow tlabs to |
2105 |
2106 // grow big enough to accomodate humongous objects. |
2106 // Also, this value can be at most the humongous object threshold, |
2107 |
2107 // since we can't allow tlabs to grow big enough to accomodate |
2108 // We need to story it locally, since it might change between when we |
2108 // humongous objects. |
2109 // test for NULL and when we use it later. |
2109 |
|
2110 // We need to store the cur alloc region locally, since it might change |
|
2111 // between when we test for NULL and when we use it later. |
2110 ContiguousSpace* cur_alloc_space = _cur_alloc_region; |
2112 ContiguousSpace* cur_alloc_space = _cur_alloc_region; |
|
2113 size_t max_tlab_size = _humongous_object_threshold_in_words * wordSize; |
|
2114 |
2111 if (cur_alloc_space == NULL) { |
2115 if (cur_alloc_space == NULL) { |
2112 return HeapRegion::GrainBytes/2; |
2116 return max_tlab_size; |
2113 } else { |
2117 } else { |
2114 return MAX2(MIN2(cur_alloc_space->free(), |
2118 return MIN2(MAX2(cur_alloc_space->free(), (size_t)MinTLABSize), |
2115 (size_t)(HeapRegion::GrainBytes/2)), |
2119 max_tlab_size); |
2116 (size_t)MinTLABSize); |
|
2117 } |
2120 } |
2118 } |
2121 } |
2119 |
2122 |
2120 HeapWord* G1CollectedHeap::allocate_new_tlab(size_t size) { |
2123 HeapWord* G1CollectedHeap::allocate_new_tlab(size_t size) { |
2121 bool dummy; |
2124 bool dummy; |