15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_GC_SHARED_MEMALLOCATOR_HPP
26 #define SHARE_GC_SHARED_MEMALLOCATOR_HPP
27
28 #include "memory/memRegion.hpp"
29 #include "oops/oopsHierarchy.hpp"
30 #include "runtime/javaThread.hpp"
31 #include "utilities/exceptions.hpp"
32 #include "utilities/globalDefinitions.hpp"
33 #include "utilities/macros.hpp"
34
35 // These fascilities are used for allocating, and initializing newly allocated objects.
36
37 class MemAllocator: StackObj {
38 protected:
39 class Allocation;
40
41 Thread* const _thread;
42 Klass* const _klass;
43 const size_t _word_size;
44
45 // Allocate from the current thread's TLAB, without taking a new TLAB (no safepoint).
46 HeapWord* mem_allocate_inside_tlab_fast() const;
47
48 private:
49 // Allocate in a TLAB. Could allocate a new TLAB, and therefore potentially safepoint.
50 HeapWord* mem_allocate_inside_tlab_slow(Allocation& allocation) const;
51
52 // Allocate outside a TLAB. Could safepoint.
53 HeapWord* mem_allocate_outside_tlab(Allocation& allocation) const;
54
55 protected:
|
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_GC_SHARED_MEMALLOCATOR_HPP
26 #define SHARE_GC_SHARED_MEMALLOCATOR_HPP
27
28 #include "memory/memRegion.hpp"
29 #include "oops/oopsHierarchy.hpp"
30 #include "runtime/javaThread.hpp"
31 #include "utilities/exceptions.hpp"
32 #include "utilities/globalDefinitions.hpp"
33 #include "utilities/macros.hpp"
34
35 // These facilities are used for allocating, and initializing newly allocated objects.
36
37 class MemAllocator: StackObj {
38 protected:
39 class Allocation;
40
41 Thread* const _thread;
42 Klass* const _klass;
43 const size_t _word_size;
44
45 // Allocate from the current thread's TLAB, without taking a new TLAB (no safepoint).
46 HeapWord* mem_allocate_inside_tlab_fast() const;
47
48 private:
49 // Allocate in a TLAB. Could allocate a new TLAB, and therefore potentially safepoint.
50 HeapWord* mem_allocate_inside_tlab_slow(Allocation& allocation) const;
51
52 // Allocate outside a TLAB. Could safepoint.
53 HeapWord* mem_allocate_outside_tlab(Allocation& allocation) const;
54
55 protected:
|