src/share/vm/utilities/globalDefinitions.hpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/utilities/globalDefinitions.hpp Tue Aug 13 14:15:19 2013
--- new/src/share/vm/utilities/globalDefinitions.hpp Tue Aug 13 14:15:19 2013
*** 408,417 ****
--- 408,419 ----
inline intptr_t align_size_down(intptr_t size, intptr_t alignment) {
return align_size_down_(size, alignment);
}
+ #define is_size_aligned_(size, alignment) ((size) == (align_size_up_(size, alignment)))
+
// Align objects by rounding up their size, in HeapWord units.
#define align_object_size_(size) align_size_up_(size, MinObjAlignment)
inline intptr_t align_object_size(intptr_t size) {
*** 426,435 ****
--- 428,441 ----
inline intptr_t align_object_offset(intptr_t offset) {
return align_size_up(offset, HeapWordsPerLong);
}
+ inline void* align_pointer_up(const void* addr, size_t size) {
+ return (void*) align_size_up_((uintptr_t)addr, size);
+ }
+
// Clamp an address to be within a specific page
// 1. If addr is on the page it is returned as is
// 2. If addr is above the page_address the start of the *next* page will be returned
// 3. Otherwise, if addr is below the page_address the start of the page will be returned
inline address clamp_address_in_page(address addr, address page_address, intptr_t page_size) {
*** 447,482 ****
--- 453,462 ----
// The expected size in bytes of a cache line, used to pad data structures.
#define DEFAULT_CACHE_LINE_SIZE 64
// 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.
template <class T, size_t alignment = DEFAULT_CACHE_LINE_SIZE>
class Padded: public T {
private:
char _pad_buf_[PADDING_SIZE(T, alignment)];
};
// When either 0 or 1 args may be passed to the base ctor.
template <class T, typename Arg1T, size_t alignment = DEFAULT_CACHE_LINE_SIZE>
class Padded01: public T {
public:
Padded01(): T() { }
Padded01(Arg1T arg1): T(arg1) { }
private:
char _pad_buf_[PADDING_SIZE(T, alignment)];
};
//----------------------------------------------------------------------------------------------------
// Utility macros for compilers
// used to silence compiler warnings
src/share/vm/utilities/globalDefinitions.hpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File