comparison src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.cpp @ 22937:af8f16ac392c

8066771: Refactor VM GC operations caused by allocation failure Reviewed-by: brutisso, jmasa
author mlarsson
date Thu, 09 Apr 2015 15:59:26 +0200
parents fb69749583e8
children
comparison
equal deleted inserted replaced
22936:fb69749583e8 22937:af8f16ac392c
30 #include "gc_implementation/parallelScavenge/vmPSOperations.hpp" 30 #include "gc_implementation/parallelScavenge/vmPSOperations.hpp"
31 #include "memory/gcLocker.inline.hpp" 31 #include "memory/gcLocker.inline.hpp"
32 #include "utilities/dtrace.hpp" 32 #include "utilities/dtrace.hpp"
33 33
34 // The following methods are used by the parallel scavenge collector 34 // The following methods are used by the parallel scavenge collector
35 VM_ParallelGCFailedAllocation::VM_ParallelGCFailedAllocation(size_t size, 35 VM_ParallelGCFailedAllocation::VM_ParallelGCFailedAllocation(size_t word_size,
36 uint gc_count) : 36 uint gc_count) :
37 VM_GC_Operation(gc_count, GCCause::_allocation_failure), 37 VM_CollectForAllocation(word_size, gc_count, GCCause::_allocation_failure) {
38 _size(size), 38 assert(word_size != 0, "An allocation should always be requested with this operation.");
39 _result(NULL)
40 {
41 } 39 }
42 40
43 void VM_ParallelGCFailedAllocation::doit() { 41 void VM_ParallelGCFailedAllocation::doit() {
44 SvcGCMarker sgcm(SvcGCMarker::MINOR); 42 SvcGCMarker sgcm(SvcGCMarker::MINOR);
45 43
46 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); 44 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
47 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "must be a ParallelScavengeHeap"); 45 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "must be a ParallelScavengeHeap");
48 46
49 GCCauseSetter gccs(heap, _gc_cause); 47 GCCauseSetter gccs(heap, _gc_cause);
50 _result = heap->failed_mem_allocate(_size); 48 _result = heap->failed_mem_allocate(_word_size);
51 49
52 if (_result == NULL && GC_locker::is_active_and_needs_gc()) { 50 if (_result == NULL && GC_locker::is_active_and_needs_gc()) {
53 set_gc_locked(); 51 set_gc_locked();
54 } 52 }
55 } 53 }