< prev index next >

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

Print this page

248   // or a MaxMetaspaceSize has been specified on the command line.
249   _result = _loader_data->metaspace_non_null()->expand_and_allocate(_size, _mdtype);
250   if (_result != NULL) {
251     return;
252   }
253 
254   // If expansion failed, do a collection clearing soft references.
255   heap->collect_as_vm_thread(GCCause::_metadata_GC_clear_soft_refs);
256   _result = _loader_data->metaspace_non_null()->allocate(_size, _mdtype);
257   if (_result != NULL) {
258     return;
259   }
260 
261   log_debug(gc)("After Metaspace GC failed to allocate size " SIZE_FORMAT, _size);
262 
263   if (GCLocker::is_active_and_needs_gc()) {
264     set_gc_locked();
265   }
266 }
267 
























268 VM_CollectForAllocation::VM_CollectForAllocation(size_t word_size, uint gc_count_before, GCCause::Cause cause)
269     : VM_GC_Operation(gc_count_before, cause), _word_size(word_size), _result(NULL) {
270   // Only report if operation was really caused by an allocation.
271   if (_word_size != 0) {
272     AllocTracer::send_allocation_requiring_gc_event(_word_size * HeapWordSize, GCId::peek());
273   }
274 }

248   // or a MaxMetaspaceSize has been specified on the command line.
249   _result = _loader_data->metaspace_non_null()->expand_and_allocate(_size, _mdtype);
250   if (_result != NULL) {
251     return;
252   }
253 
254   // If expansion failed, do a collection clearing soft references.
255   heap->collect_as_vm_thread(GCCause::_metadata_GC_clear_soft_refs);
256   _result = _loader_data->metaspace_non_null()->allocate(_size, _mdtype);
257   if (_result != NULL) {
258     return;
259   }
260 
261   log_debug(gc)("After Metaspace GC failed to allocate size " SIZE_FORMAT, _size);
262 
263   if (GCLocker::is_active_and_needs_gc()) {
264     set_gc_locked();
265   }
266 }
267 
268 VM_CollectForCodeCacheAllocation::VM_CollectForCodeCacheAllocation(uint gc_count_before,
269                                                                    uint full_gc_count_before,
270                                                                    GCCause::Cause gc_cause)
271     : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true) {
272 }
273 
274 void VM_CollectForCodeCacheAllocation::doit() {
275   SvcGCMarker sgcm(SvcGCMarker::FULL);
276 
277   CollectedHeap* heap = Universe::heap();
278   GCCauseSetter gccs(heap, _gc_cause);
279 
280   log_debug(gc)("Full GC for CodeCache");
281 
282   // Don't clear the soft refs yet.
283   heap->collect_as_vm_thread(GCCause::_codecache_GC_threshold);
284 
285   log_debug(gc)("After GC for CodeCache");
286 
287   if (GCLocker::is_active_and_needs_gc()) {
288     set_gc_locked();
289   }
290 }
291 
292 VM_CollectForAllocation::VM_CollectForAllocation(size_t word_size, uint gc_count_before, GCCause::Cause cause)
293     : VM_GC_Operation(gc_count_before, cause), _word_size(word_size), _result(NULL) {
294   // Only report if operation was really caused by an allocation.
295   if (_word_size != 0) {
296     AllocTracer::send_allocation_requiring_gc_event(_word_size * HeapWordSize, GCId::peek());
297   }
298 }
< prev index next >