Two examples of the current API:
inline intptr_t align_size_up(intptr_t size, intptr_t alignment);
inline void* align_ptr_up(const void* ptr, size_t alignment);
I propose that we change the API to use templates to return the aligned value as the same type as the type of the unaligned input.
The proposed API would look like this:
template <typename T, typename A>
inline T align_size_up(T size, A alignment);
template <typename T, typename A>
inline T* align_ptr_up(T* ptr, A alignment);
and a follow-up RFE would get rid of _size_ and _ptr_ from the names.
Usages of these align functions would then look like:
size_t aligned_size = align_up(alloc_size, os::vm_page_size())
HeapWord* aligned_top = align_up(top, region_size)
- blocks
-
JDK-8178499 Remove _ptr_ and _size_ infixes from align functions
-
- Resolved
-
-
JDK-8178501 Replace usages of align macros with calls to the align inline functions
-
- Resolved
-
- relates to
-
JDK-8178490 Usages of is_object_aligned with pointers are broken
-
- Resolved
-
-
JDK-8178491 -Xss and -XX:ThreadStackSize argument parsing truncates bits
-
- Resolved
-
-
JDK-8178495 Bug in the align_size_up_ macro
-
- Resolved
-
-
JDK-8178497 Bug in MutableNUMASpace::ensure_parsability
-
- Closed
-
-
JDK-8178500 Replace usages of round_to and round_down with align_up and align_down
-
- Resolved
-