91
92 class ObjArrayAllocator: public MemAllocator {
93 protected:
94 const int _length;
95 const bool _do_zero;
96
97 void mem_zap_start_padding(HeapWord* mem) const PRODUCT_RETURN;
98 void mem_zap_end_padding(HeapWord* mem) const PRODUCT_RETURN;
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
107 virtual oop initialize(HeapWord* mem) const;
108 };
109
110 class ClassAllocator: public MemAllocator {
111 public:
112 ClassAllocator(Klass* klass, size_t word_size, Thread* thread = Thread::current())
113 : MemAllocator(klass, word_size, thread) {}
114
115 virtual oop initialize(HeapWord* mem) const;
116 };
117
118 // Manages a scope where a failed heap allocation results in
119 // suppression of JVMTI "resource exhausted" events and
120 // throwing a shared, backtrace-less OOME instance.
121 // Used for OOMEs that will not be propagated to user code.
122 class InternalOOMEMark: public StackObj {
123 private:
124 bool _outer;
125 JavaThread* _thread;
126
127 public:
128 explicit InternalOOMEMark(JavaThread* thread) {
129 assert(thread != nullptr, "nullptr is not supported");
130 _outer = thread->is_in_internal_oome_mark();
131 thread->set_is_in_internal_oome_mark(true);
132 _thread = thread;
133 }
|
91
92 class ObjArrayAllocator: public MemAllocator {
93 protected:
94 const int _length;
95 const bool _do_zero;
96
97 void mem_zap_start_padding(HeapWord* mem) const PRODUCT_RETURN;
98 void mem_zap_end_padding(HeapWord* mem) const PRODUCT_RETURN;
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
107 virtual oop initialize(HeapWord* mem) const;
108 };
109
110 class ClassAllocator: public MemAllocator {
111 size_t _base_size;
112 public:
113 ClassAllocator(Klass* klass, size_t word_size, size_t base_size, Thread* thread = Thread::current())
114 : MemAllocator(klass, word_size, thread),
115 _base_size(base_size) {}
116
117 virtual oop initialize(HeapWord* mem) const;
118 };
119
120 // Manages a scope where a failed heap allocation results in
121 // suppression of JVMTI "resource exhausted" events and
122 // throwing a shared, backtrace-less OOME instance.
123 // Used for OOMEs that will not be propagated to user code.
124 class InternalOOMEMark: public StackObj {
125 private:
126 bool _outer;
127 JavaThread* _thread;
128
129 public:
130 explicit InternalOOMEMark(JavaThread* thread) {
131 assert(thread != nullptr, "nullptr is not supported");
132 _outer = thread->is_in_internal_oome_mark();
133 thread->set_is_in_internal_oome_mark(true);
134 _thread = thread;
135 }
|