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