232 size_in_bytes, _thread);
233 }
234 }
235
236 void MemAllocator::Allocation::notify_allocation_dtrace_sampler() {
237 if (DTraceAllocProbes) {
238 // support for Dtrace object alloc event (no-op most of the time)
239 Klass* klass = obj()->klass();
240 size_t word_size = _allocator._word_size;
241 if (klass != NULL && klass->name() != NULL) {
242 SharedRuntime::dtrace_object_alloc(obj(), (int)word_size);
243 }
244 }
245 }
246
247 void MemAllocator::Allocation::notify_allocation() {
248 notify_allocation_low_memory_detector();
249 notify_allocation_jfr_sampler();
250 notify_allocation_dtrace_sampler();
251 notify_allocation_jvmti_sampler();
252 }
253
254 HeapWord* MemAllocator::allocate_outside_tlab(Allocation& allocation) const {
255 allocation._allocated_outside_tlab = true;
256 HeapWord* mem = Universe::heap()->mem_allocate(_word_size, &allocation._overhead_limit_exceeded);
257 if (mem == NULL) {
258 return mem;
259 }
260
261 NOT_PRODUCT(Universe::heap()->check_for_non_bad_heap_word_value(mem, _word_size));
262 size_t size_in_bytes = _word_size * HeapWordSize;
263 _thread->incr_allocated_bytes(size_in_bytes);
264
265 return mem;
266 }
267
268 HeapWord* MemAllocator::allocate_inside_tlab(Allocation& allocation) const {
269 assert(UseTLAB, "should use UseTLAB");
270
271 // Try allocating from an existing TLAB.
|
232 size_in_bytes, _thread);
233 }
234 }
235
236 void MemAllocator::Allocation::notify_allocation_dtrace_sampler() {
237 if (DTraceAllocProbes) {
238 // support for Dtrace object alloc event (no-op most of the time)
239 Klass* klass = obj()->klass();
240 size_t word_size = _allocator._word_size;
241 if (klass != NULL && klass->name() != NULL) {
242 SharedRuntime::dtrace_object_alloc(obj(), (int)word_size);
243 }
244 }
245 }
246
247 void MemAllocator::Allocation::notify_allocation() {
248 notify_allocation_low_memory_detector();
249 notify_allocation_jfr_sampler();
250 notify_allocation_dtrace_sampler();
251 notify_allocation_jvmti_sampler();
252 TSAN_RUNTIME_ONLY(
253 SharedRuntime::tsan_track_obj_with_size(obj(), (int)_allocator._word_size);
254 );
255 }
256
257 HeapWord* MemAllocator::allocate_outside_tlab(Allocation& allocation) const {
258 allocation._allocated_outside_tlab = true;
259 HeapWord* mem = Universe::heap()->mem_allocate(_word_size, &allocation._overhead_limit_exceeded);
260 if (mem == NULL) {
261 return mem;
262 }
263
264 NOT_PRODUCT(Universe::heap()->check_for_non_bad_heap_word_value(mem, _word_size));
265 size_t size_in_bytes = _word_size * HeapWordSize;
266 _thread->incr_allocated_bytes(size_in_bytes);
267
268 return mem;
269 }
270
271 HeapWord* MemAllocator::allocate_inside_tlab(Allocation& allocation) const {
272 assert(UseTLAB, "should use UseTLAB");
273
274 // Try allocating from an existing TLAB.
|