Mercurial > hg > truffle
diff src/share/vm/memory/padded.inline.hpp @ 17760:5479cb006184
8036860: Pad and cache-align the BiasedMappedArray
Summary: Pad and cache-align BiasedMappedArray instances by default to avoid performance variability problems due to false sharing, as instances of this data structures are typically used for performance sensitive code.
Reviewed-by: brutisso, stefank
author | tschatzl |
---|---|
date | Mon, 24 Mar 2014 15:31:00 +0100 |
parents | d7070f371770 |
children |
line wrap: on
line diff
--- a/src/share/vm/memory/padded.inline.hpp Mon Mar 24 15:30:56 2014 +0100 +++ b/src/share/vm/memory/padded.inline.hpp Mon Mar 24 15:31:00 2014 +0100 @@ -76,3 +76,13 @@ return result; } + +template <class T, MEMFLAGS flags, size_t alignment> +T* PaddedPrimitiveArray<T, flags, alignment>::create_unfreeable(size_t length) { + // Allocate a chunk of memory large enough to allow for some alignment. + void* chunk = AllocateHeap(length * sizeof(T) + alignment, flags); + + memset(chunk, 0, length * sizeof(T) + alignment); + + return (T*)align_pointer_up(chunk, alignment); +}