Mercurial > hg > truffle
diff src/share/vm/gc_interface/collectedHeap.cpp @ 17727:cfd4aac53239
8030177: G1: Enable TLAB resizing
Reviewed-by: tschatzl, stefank, jmasa
author | brutisso |
---|---|
date | Mon, 27 Jan 2014 13:14:53 +0100 |
parents | 8f07aa079343 |
children | d8041d695d19 537c8e21b118 |
line wrap: on
line diff
--- a/src/share/vm/gc_interface/collectedHeap.cpp Thu Jan 23 12:08:28 2014 +0100 +++ b/src/share/vm/gc_interface/collectedHeap.cpp Mon Jan 27 13:14:53 2014 +0100 @@ -320,6 +320,21 @@ assert(thread->deferred_card_mark().is_empty(), "invariant"); } +size_t CollectedHeap::max_tlab_size() const { + // TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE]. + // This restriction could be removed by enabling filling with multiple arrays. + // If we compute that the reasonable way as + // header_size + ((sizeof(jint) * max_jint) / HeapWordSize) + // we'll overflow on the multiply, so we do the divide first. + // We actually lose a little by dividing first, + // but that just makes the TLAB somewhat smaller than the biggest array, + // which is fine, since we'll be able to fill that. + size_t max_int_size = typeArrayOopDesc::header_size(T_INT) + + sizeof(jint) * + ((juint) max_jint / (size_t) HeapWordSize); + return align_size_down(max_int_size, MinObjAlignment); +} + // Helper for ReduceInitialCardMarks. For performance, // compiled code may elide card-marks for initializing stores // to a newly allocated object along the fast-path. We