< prev index next >

src/share/vm/memory/padded.hpp

Print this page

        

*** 31,41 **** // Bytes needed to pad type to avoid cache-line sharing; alignment should be the // expected cache line size (a power of two). The first addend avoids sharing // when the start address is not a multiple of alignment; the second maintains // alignment of starting addresses that happen to be a multiple. #define PADDING_SIZE(type, alignment) \ ! ((alignment) + align_size_up_(sizeof(type), alignment)) // Templates to create a subclass padded to avoid cache line sharing. These are // effective only when applied to derived-most (leaf) classes. // When no args are passed to the base ctor. --- 31,41 ---- // Bytes needed to pad type to avoid cache-line sharing; alignment should be the // expected cache line size (a power of two). The first addend avoids sharing // when the start address is not a multiple of alignment; the second maintains // alignment of starting addresses that happen to be a multiple. #define PADDING_SIZE(type, alignment) \ ! ((alignment) + align_up_(sizeof(type), (alignment))) // Templates to create a subclass padded to avoid cache line sharing. These are // effective only when applied to derived-most (leaf) classes. // When no args are passed to the base ctor.
*** 66,76 **** template <class T> class PaddedEndImpl<T, /*pad_size*/ 0> : public T { // No padding. }; ! #define PADDED_END_SIZE(type, alignment) (align_size_up_(sizeof(type), alignment) - sizeof(type)) // More memory conservative implementation of Padded. The subclass adds the // minimal amount of padding needed to make the size of the objects be aligned. // This will help reducing false sharing, // if the start address is a multiple of alignment. --- 66,76 ---- template <class T> class PaddedEndImpl<T, /*pad_size*/ 0> : public T { // No padding. }; ! #define PADDED_END_SIZE(type, alignment) (align_up_(sizeof(type), (alignment)) - sizeof(type)) // More memory conservative implementation of Padded. The subclass adds the // minimal amount of padding needed to make the size of the objects be aligned. // This will help reducing false sharing, // if the start address is a multiple of alignment.
< prev index next >