hotspot/src/share/vm/runtime/thread.cpp
changeset 14083 103054a71a30
parent 13978 50ecf9f35089
child 14120 7d298141c258
equal deleted inserted replaced
14082:7425bbf64ead 14083:103054a71a30
   175 void* Thread::allocate(size_t size, bool throw_excpt, MEMFLAGS flags) {
   175 void* Thread::allocate(size_t size, bool throw_excpt, MEMFLAGS flags) {
   176   if (UseBiasedLocking) {
   176   if (UseBiasedLocking) {
   177     const int alignment = markOopDesc::biased_lock_alignment;
   177     const int alignment = markOopDesc::biased_lock_alignment;
   178     size_t aligned_size = size + (alignment - sizeof(intptr_t));
   178     size_t aligned_size = size + (alignment - sizeof(intptr_t));
   179     void* real_malloc_addr = throw_excpt? AllocateHeap(aligned_size, flags, CURRENT_PC)
   179     void* real_malloc_addr = throw_excpt? AllocateHeap(aligned_size, flags, CURRENT_PC)
   180                                           : os::malloc(aligned_size, flags, CURRENT_PC);
   180                                           : AllocateHeap(aligned_size, flags, CURRENT_PC,
       
   181                                               AllocFailStrategy::RETURN_NULL);
   181     void* aligned_addr     = (void*) align_size_up((intptr_t) real_malloc_addr, alignment);
   182     void* aligned_addr     = (void*) align_size_up((intptr_t) real_malloc_addr, alignment);
   182     assert(((uintptr_t) aligned_addr + (uintptr_t) size) <=
   183     assert(((uintptr_t) aligned_addr + (uintptr_t) size) <=
   183            ((uintptr_t) real_malloc_addr + (uintptr_t) aligned_size),
   184            ((uintptr_t) real_malloc_addr + (uintptr_t) aligned_size),
   184            "JavaThread alignment code overflowed allocated storage");
   185            "JavaThread alignment code overflowed allocated storage");
   185     if (TraceBiasedLocking) {
   186     if (TraceBiasedLocking) {
   189     }
   190     }
   190     ((Thread*) aligned_addr)->_real_malloc_address = real_malloc_addr;
   191     ((Thread*) aligned_addr)->_real_malloc_address = real_malloc_addr;
   191     return aligned_addr;
   192     return aligned_addr;
   192   } else {
   193   } else {
   193     return throw_excpt? AllocateHeap(size, flags, CURRENT_PC)
   194     return throw_excpt? AllocateHeap(size, flags, CURRENT_PC)
   194                        : os::malloc(size, flags, CURRENT_PC);
   195                        : AllocateHeap(size, flags, CURRENT_PC, AllocFailStrategy::RETURN_NULL);
   195   }
   196   }
   196 }
   197 }
   197 
   198 
   198 void Thread::operator delete(void* p) {
   199 void Thread::operator delete(void* p) {
   199   if (UseBiasedLocking) {
   200   if (UseBiasedLocking) {