src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp
changeset 50866 cb4b07d61aac
parent 50101 1560c3a7fbbf
child 51742 3dd95a83791b
equal deleted inserted replaced
50865:2c3edd0a6222 50866:cb4b07d61aac
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    51     return obj;
    51     return obj;
    52   }
    52   }
    53   return NULL;
    53   return NULL;
    54 }
    54 }
    55 
    55 
    56 inline bool ThreadLocalAllocBuffer::undo_allocate(HeapWord* obj, size_t size) {
       
    57   invariants();
       
    58 
       
    59   if (!is_last_allocation(obj, size)) {
       
    60     return false;
       
    61   }
       
    62 
       
    63   set_top(obj);
       
    64 
       
    65   invariants();
       
    66   return true;
       
    67 }
       
    68 
       
    69 inline size_t ThreadLocalAllocBuffer::compute_size(size_t obj_size) {
    56 inline size_t ThreadLocalAllocBuffer::compute_size(size_t obj_size) {
    70   // Compute the size for the new TLAB.
    57   // Compute the size for the new TLAB.
    71   // The "last" tlab may be smaller to reduce fragmentation.
    58   // The "last" tlab may be smaller to reduce fragmentation.
    72   // unsafe_max_tlab_alloc is just a hint.
    59   // unsafe_max_tlab_alloc is just a hint.
    73   const size_t available_size = Universe::heap()->unsafe_max_tlab_alloc(myThread()) /
    60   const size_t available_size = Universe::heap()->unsafe_max_tlab_alloc(myThread()) /