8178489: Make align functions more type safe and consistent

Reviewed-by: mgerdin, rehn
This commit is contained in:
Stefan Karlsson 2017-04-12 17:53:18 +02:00
parent 229f386a8f
commit 0fcf645cff
49 changed files with 134 additions and 140 deletions

View file

@ -172,7 +172,7 @@ void* Thread::allocate(size_t size, bool throw_excpt, MEMFLAGS flags) {
void* real_malloc_addr = throw_excpt? AllocateHeap(aligned_size, flags, CURRENT_PC)
: AllocateHeap(aligned_size, flags, CURRENT_PC,
AllocFailStrategy::RETURN_NULL);
void* aligned_addr = (void*) align_size_up((intptr_t) real_malloc_addr, alignment);
void* aligned_addr = align_ptr_up(real_malloc_addr, alignment);
assert(((uintptr_t) aligned_addr + (uintptr_t) size) <=
((uintptr_t) real_malloc_addr + (uintptr_t) aligned_size),
"JavaThread alignment code overflowed allocated storage");
@ -286,7 +286,7 @@ Thread::Thread() {
if (UseBiasedLocking) {
assert((((uintptr_t) this) & (markOopDesc::biased_lock_alignment - 1)) == 0, "forced alignment of thread object failed");
assert(this == _real_malloc_address ||
this == (void*) align_size_up((intptr_t) _real_malloc_address, markOopDesc::biased_lock_alignment),
this == align_ptr_up(_real_malloc_address, (int)markOopDesc::biased_lock_alignment),
"bug in forced alignment of thread objects");
}
#endif // ASSERT