170 const int alignment = markOopDesc::biased_lock_alignment; |
170 const int alignment = markOopDesc::biased_lock_alignment; |
171 size_t aligned_size = size + (alignment - sizeof(intptr_t)); |
171 size_t aligned_size = size + (alignment - sizeof(intptr_t)); |
172 void* real_malloc_addr = throw_excpt? AllocateHeap(aligned_size, flags, CURRENT_PC) |
172 void* real_malloc_addr = throw_excpt? AllocateHeap(aligned_size, flags, CURRENT_PC) |
173 : AllocateHeap(aligned_size, flags, CURRENT_PC, |
173 : AllocateHeap(aligned_size, flags, CURRENT_PC, |
174 AllocFailStrategy::RETURN_NULL); |
174 AllocFailStrategy::RETURN_NULL); |
175 void* aligned_addr = (void*) align_size_up((intptr_t) real_malloc_addr, alignment); |
175 void* aligned_addr = align_ptr_up(real_malloc_addr, alignment); |
176 assert(((uintptr_t) aligned_addr + (uintptr_t) size) <= |
176 assert(((uintptr_t) aligned_addr + (uintptr_t) size) <= |
177 ((uintptr_t) real_malloc_addr + (uintptr_t) aligned_size), |
177 ((uintptr_t) real_malloc_addr + (uintptr_t) aligned_size), |
178 "JavaThread alignment code overflowed allocated storage"); |
178 "JavaThread alignment code overflowed allocated storage"); |
179 if (aligned_addr != real_malloc_addr) { |
179 if (aligned_addr != real_malloc_addr) { |
180 log_info(biasedlocking)("Aligned thread " INTPTR_FORMAT " to " INTPTR_FORMAT, |
180 log_info(biasedlocking)("Aligned thread " INTPTR_FORMAT " to " INTPTR_FORMAT, |
284 #endif // CHECK_UNHANDLED_OOPS |
284 #endif // CHECK_UNHANDLED_OOPS |
285 #ifdef ASSERT |
285 #ifdef ASSERT |
286 if (UseBiasedLocking) { |
286 if (UseBiasedLocking) { |
287 assert((((uintptr_t) this) & (markOopDesc::biased_lock_alignment - 1)) == 0, "forced alignment of thread object failed"); |
287 assert((((uintptr_t) this) & (markOopDesc::biased_lock_alignment - 1)) == 0, "forced alignment of thread object failed"); |
288 assert(this == _real_malloc_address || |
288 assert(this == _real_malloc_address || |
289 this == (void*) align_size_up((intptr_t) _real_malloc_address, markOopDesc::biased_lock_alignment), |
289 this == align_ptr_up(_real_malloc_address, (int)markOopDesc::biased_lock_alignment), |
290 "bug in forced alignment of thread objects"); |
290 "bug in forced alignment of thread objects"); |
291 } |
291 } |
292 #endif // ASSERT |
292 #endif // ASSERT |
293 } |
293 } |
294 |
294 |