1 /* |
1 /* |
2 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
52 if (_result == NULL && GC_locker::is_active_and_needs_gc()) { |
52 if (_result == NULL && GC_locker::is_active_and_needs_gc()) { |
53 set_gc_locked(); |
53 set_gc_locked(); |
54 } |
54 } |
55 } |
55 } |
56 |
56 |
57 VM_ParallelGCFailedPermanentAllocation::VM_ParallelGCFailedPermanentAllocation(size_t size, |
|
58 unsigned int gc_count, unsigned int full_gc_count) : |
|
59 VM_GC_Operation(gc_count, GCCause::_allocation_failure, full_gc_count, true /* full */), |
|
60 _size(size), |
|
61 _result(NULL) |
|
62 { |
|
63 } |
|
64 |
|
65 void VM_ParallelGCFailedPermanentAllocation::doit() { |
|
66 SvcGCMarker sgcm(SvcGCMarker::FULL); |
|
67 |
|
68 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); |
|
69 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "must be a ParallelScavengeHeap"); |
|
70 |
|
71 GCCauseSetter gccs(heap, _gc_cause); |
|
72 _result = heap->failed_permanent_mem_allocate(_size); |
|
73 if (_result == NULL && GC_locker::is_active_and_needs_gc()) { |
|
74 set_gc_locked(); |
|
75 } |
|
76 } |
|
77 |
|
78 // Only used for System.gc() calls |
57 // Only used for System.gc() calls |
79 VM_ParallelGCSystemGC::VM_ParallelGCSystemGC(unsigned int gc_count, |
58 VM_ParallelGCSystemGC::VM_ParallelGCSystemGC(unsigned int gc_count, |
80 unsigned int full_gc_count, |
59 unsigned int full_gc_count, |
81 GCCause::Cause gc_cause) : |
60 GCCause::Cause gc_cause) : |
82 VM_GC_Operation(gc_count, gc_cause, full_gc_count, true /* full */) |
61 VM_GC_Operation(gc_count, gc_cause, full_gc_count, true /* full */) |
94 if (_gc_cause == GCCause::_gc_locker |
73 if (_gc_cause == GCCause::_gc_locker |
95 DEBUG_ONLY(|| _gc_cause == GCCause::_scavenge_alot)) { |
74 DEBUG_ONLY(|| _gc_cause == GCCause::_scavenge_alot)) { |
96 // If (and only if) the scavenge fails, this will invoke a full gc. |
75 // If (and only if) the scavenge fails, this will invoke a full gc. |
97 heap->invoke_scavenge(); |
76 heap->invoke_scavenge(); |
98 } else { |
77 } else { |
99 heap->invoke_full_gc(false); |
78 heap->do_full_collection(false); |
100 } |
79 } |
101 } |
80 } |