src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp
changeset 51742 3dd95a83791b
parent 50866 cb4b07d61aac
child 53244 9807daeb47c4
equal deleted inserted replaced
51741:ed9b1200dd81 51742:3dd95a83791b
    55 
    55 
    56 inline size_t ThreadLocalAllocBuffer::compute_size(size_t obj_size) {
    56 inline size_t ThreadLocalAllocBuffer::compute_size(size_t obj_size) {
    57   // Compute the size for the new TLAB.
    57   // Compute the size for the new TLAB.
    58   // The "last" tlab may be smaller to reduce fragmentation.
    58   // The "last" tlab may be smaller to reduce fragmentation.
    59   // unsafe_max_tlab_alloc is just a hint.
    59   // unsafe_max_tlab_alloc is just a hint.
    60   const size_t available_size = Universe::heap()->unsafe_max_tlab_alloc(myThread()) /
    60   const size_t available_size = Universe::heap()->unsafe_max_tlab_alloc(thread()) / HeapWordSize;
    61                                                   HeapWordSize;
       
    62   size_t new_tlab_size = MIN3(available_size, desired_size() + align_object_size(obj_size), max_size());
    61   size_t new_tlab_size = MIN3(available_size, desired_size() + align_object_size(obj_size), max_size());
    63 
    62 
    64   // Make sure there's enough room for object and filler int[].
    63   // Make sure there's enough room for object and filler int[].
    65   if (new_tlab_size < compute_min_size(obj_size)) {
    64   if (new_tlab_size < compute_min_size(obj_size)) {
    66     // If there isn't enough room for the allocation, return failure.
    65     // If there isn't enough room for the allocation, return failure.
    90 
    89 
    91   log_develop_trace(gc, tlab)("TLAB: %s thread: " INTPTR_FORMAT " [id: %2d]"
    90   log_develop_trace(gc, tlab)("TLAB: %s thread: " INTPTR_FORMAT " [id: %2d]"
    92                               " obj: " SIZE_FORMAT
    91                               " obj: " SIZE_FORMAT
    93                               " free: " SIZE_FORMAT
    92                               " free: " SIZE_FORMAT
    94                               " waste: " SIZE_FORMAT,
    93                               " waste: " SIZE_FORMAT,
    95                               "slow", p2i(myThread()), myThread()->osthread()->thread_id(),
    94                               "slow", p2i(thread()), thread()->osthread()->thread_id(),
    96                               obj_size, free(), refill_waste_limit());
    95                               obj_size, free(), refill_waste_limit());
    97 }
    96 }
    98 
    97 
    99 #endif // SHARE_VM_GC_SHARED_THREADLOCALALLOCBUFFER_INLINE_HPP
    98 #endif // SHARE_VM_GC_SHARED_THREADLOCALALLOCBUFFER_INLINE_HPP