65 // Raw memory allocation. This will try to do a TLAB allocation, and otherwise fall
66 // back to calling CollectedHeap::mem_allocate().
67 HeapWord* mem_allocate(Allocation& allocation) const;
68
69 virtual MemRegion obj_memory_range(oop obj) const {
70 return MemRegion(cast_from_oop<HeapWord*>(obj), _word_size);
71 }
72
73 public:
74 oop allocate() const;
75 virtual oop initialize(HeapWord* mem) const = 0;
76 };
77
78 class ObjAllocator: public MemAllocator {
79 public:
80 ObjAllocator(Klass* klass, size_t word_size, Thread* thread = Thread::current())
81 : MemAllocator(klass, word_size, thread) {}
82 virtual oop initialize(HeapWord* mem) const;
83 };
84
85 class ObjArrayAllocator: public MemAllocator {
86 const int _length;
87 const bool _do_zero;
88 protected:
89 virtual MemRegion obj_memory_range(oop obj) const;
90
91 public:
92 ObjArrayAllocator(Klass* klass, size_t word_size, int length, bool do_zero,
93 Thread* thread = Thread::current())
94 : MemAllocator(klass, word_size, thread),
95 _length(length),
96 _do_zero(do_zero) {}
97 virtual oop initialize(HeapWord* mem) const;
98 };
99
100 class ClassAllocator: public MemAllocator {
101 public:
102 ClassAllocator(Klass* klass, size_t word_size, Thread* thread = Thread::current())
103 : MemAllocator(klass, word_size, thread) {}
104 virtual oop initialize(HeapWord* mem) const;
|
65 // Raw memory allocation. This will try to do a TLAB allocation, and otherwise fall
66 // back to calling CollectedHeap::mem_allocate().
67 HeapWord* mem_allocate(Allocation& allocation) const;
68
69 virtual MemRegion obj_memory_range(oop obj) const {
70 return MemRegion(cast_from_oop<HeapWord*>(obj), _word_size);
71 }
72
73 public:
74 oop allocate() const;
75 virtual oop initialize(HeapWord* mem) const = 0;
76 };
77
78 class ObjAllocator: public MemAllocator {
79 public:
80 ObjAllocator(Klass* klass, size_t word_size, Thread* thread = Thread::current())
81 : MemAllocator(klass, word_size, thread) {}
82 virtual oop initialize(HeapWord* mem) const;
83 };
84
85 class ObjBufferAllocator: public MemAllocator {
86 public:
87 ObjBufferAllocator(Klass* klass, size_t word_size, Thread* thread = Thread::current())
88 : MemAllocator(klass, word_size, thread) {}
89 virtual oop initialize(HeapWord* mem) const;
90 };
91
92
93 class ObjArrayAllocator: public MemAllocator {
94 const int _length;
95 const bool _do_zero;
96 protected:
97 virtual MemRegion obj_memory_range(oop obj) const;
98
99 public:
100 ObjArrayAllocator(Klass* klass, size_t word_size, int length, bool do_zero,
101 Thread* thread = Thread::current())
102 : MemAllocator(klass, word_size, thread),
103 _length(length),
104 _do_zero(do_zero) {}
105 virtual oop initialize(HeapWord* mem) const;
106 };
107
108 class ClassAllocator: public MemAllocator {
109 public:
110 ClassAllocator(Klass* klass, size_t word_size, Thread* thread = Thread::current())
111 : MemAllocator(klass, word_size, thread) {}
112 virtual oop initialize(HeapWord* mem) const;
|