< prev index next >

src/hotspot/share/gc/shared/memAllocator.cpp

Print this page




 212 
 213     _thread->heap_sampler().check_for_sampling(obj_h(), size_in_bytes, bytes_since_last);
 214   }
 215 
 216   if (_tlab_end_reset_for_sample || _allocated_tlab_size != 0) {
 217     // Tell tlab to forget bytes_since_last if we passed it to the heap sampler.
 218     _thread->tlab().set_sample_end(bytes_since_last != 0);
 219   }
 220 }
 221 
 222 void MemAllocator::Allocation::notify_allocation_low_memory_detector() {
 223   // support low memory notifications (no-op if not enabled)
 224   LowMemoryDetector::detect_low_memory_for_collected_pools();
 225 }
 226 
 227 void MemAllocator::Allocation::notify_allocation_jfr_sampler() {
 228   HeapWord* mem = (HeapWord*)obj();
 229   size_t size_in_bytes = _allocator._word_size * HeapWordSize;
 230 
 231   if (_allocated_outside_tlab) {
 232     AllocTracer::send_allocation_outside_tlab(_allocator._klass, mem, size_in_bytes, _thread);
 233   } else if (_allocated_tlab_size != 0) {
 234     // TLAB was refilled
 235     AllocTracer::send_allocation_in_new_tlab(_allocator._klass, mem, _allocated_tlab_size * HeapWordSize,
 236                                              size_in_bytes, _thread);
 237   }
 238 }
 239 
 240 void MemAllocator::Allocation::notify_allocation_dtrace_sampler() {
 241   if (DTraceAllocProbes) {
 242     // support for Dtrace object alloc event (no-op most of the time)
 243     Klass* klass = _allocator._klass;
 244     size_t word_size = _allocator._word_size;
 245     if (klass != NULL && klass->name() != NULL) {
 246       SharedRuntime::dtrace_object_alloc(obj(), (int)word_size);
 247     }
 248   }
 249 }
 250 
 251 void MemAllocator::Allocation::notify_allocation() {
 252   notify_allocation_low_memory_detector();
 253   notify_allocation_jfr_sampler();
 254   notify_allocation_dtrace_sampler();
 255   notify_allocation_jvmti_sampler();
 256 }
 257 
 258 HeapWord* MemAllocator::allocate_outside_tlab(Allocation& allocation) const {
 259   allocation._allocated_outside_tlab = true;
 260   HeapWord* mem = Universe::heap()->mem_allocate(_word_size, &allocation._overhead_limit_exceeded);
 261   if (mem == NULL) {
 262     return mem;
 263   }




 212 
 213     _thread->heap_sampler().check_for_sampling(obj_h(), size_in_bytes, bytes_since_last);
 214   }
 215 
 216   if (_tlab_end_reset_for_sample || _allocated_tlab_size != 0) {
 217     // Tell tlab to forget bytes_since_last if we passed it to the heap sampler.
 218     _thread->tlab().set_sample_end(bytes_since_last != 0);
 219   }
 220 }
 221 
 222 void MemAllocator::Allocation::notify_allocation_low_memory_detector() {
 223   // support low memory notifications (no-op if not enabled)
 224   LowMemoryDetector::detect_low_memory_for_collected_pools();
 225 }
 226 
 227 void MemAllocator::Allocation::notify_allocation_jfr_sampler() {
 228   HeapWord* mem = (HeapWord*)obj();
 229   size_t size_in_bytes = _allocator._word_size * HeapWordSize;
 230 
 231   if (_allocated_outside_tlab) {
 232     AllocTracer::send_allocation_outside_tlab(obj()->klass(), mem, size_in_bytes, _thread);
 233   } else if (_allocated_tlab_size != 0) {
 234     // TLAB was refilled
 235     AllocTracer::send_allocation_in_new_tlab(obj()->klass(), mem, _allocated_tlab_size * HeapWordSize,
 236                                              size_in_bytes, _thread);
 237   }
 238 }
 239 
 240 void MemAllocator::Allocation::notify_allocation_dtrace_sampler() {
 241   if (DTraceAllocProbes) {
 242     // support for Dtrace object alloc event (no-op most of the time)
 243     Klass* klass = obj()->klass();
 244     size_t word_size = _allocator._word_size;
 245     if (klass != NULL && klass->name() != NULL) {
 246       SharedRuntime::dtrace_object_alloc(obj(), (int)word_size);
 247     }
 248   }
 249 }
 250 
 251 void MemAllocator::Allocation::notify_allocation() {
 252   notify_allocation_low_memory_detector();
 253   notify_allocation_jfr_sampler();
 254   notify_allocation_dtrace_sampler();
 255   notify_allocation_jvmti_sampler();
 256 }
 257 
 258 HeapWord* MemAllocator::allocate_outside_tlab(Allocation& allocation) const {
 259   allocation._allocated_outside_tlab = true;
 260   HeapWord* mem = Universe::heap()->mem_allocate(_word_size, &allocation._overhead_limit_exceeded);
 261   if (mem == NULL) {
 262     return mem;
 263   }


< prev index next >