comparison src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.cpp @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children c0492d52d55b
comparison
equal deleted inserted replaced
-1:000000000000 0:a61af66fc99e
1 /*
2 * Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 # include "incls/_precompiled.incl"
26 # include "incls/_vmPSOperations.cpp.incl"
27
28 // The following methods are used by the parallel scavenge collector
29 VM_ParallelGCFailedAllocation::VM_ParallelGCFailedAllocation(size_t size,
30 bool is_tlab, unsigned int gc_count) :
31 VM_GC_Operation(gc_count),
32 _size(size),
33 _is_tlab(is_tlab),
34 _result(NULL)
35 {
36 }
37
38 void VM_ParallelGCFailedAllocation::doit() {
39 JvmtiGCForAllocationMarker jgcm;
40 notify_gc_begin(false);
41
42 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
43 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "must be a ParallelScavengeHeap");
44
45 GCCauseSetter gccs(heap, _gc_cause);
46 _result = heap->failed_mem_allocate(_size, _is_tlab);
47
48 if (_result == NULL && GC_locker::is_active_and_needs_gc()) {
49 set_gc_locked();
50 }
51
52 notify_gc_end();
53 }
54
55 VM_ParallelGCFailedPermanentAllocation::VM_ParallelGCFailedPermanentAllocation(size_t size,
56 unsigned int gc_count, unsigned int full_gc_count) :
57 VM_GC_Operation(gc_count, full_gc_count, true /* full */),
58 _size(size),
59 _result(NULL)
60 {
61 }
62
63 void VM_ParallelGCFailedPermanentAllocation::doit() {
64 JvmtiGCFullMarker jgcm;
65 notify_gc_begin(true);
66
67 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
68 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "must be a ParallelScavengeHeap");
69
70 GCCauseSetter gccs(heap, _gc_cause);
71 _result = heap->failed_permanent_mem_allocate(_size);
72 notify_gc_end();
73 }
74
75 // Only used for System.gc() calls
76 VM_ParallelGCSystemGC::VM_ParallelGCSystemGC(unsigned int gc_count,
77 unsigned int full_gc_count,
78 GCCause::Cause gc_cause) :
79 VM_GC_Operation(gc_count, full_gc_count, true /* full */)
80 {
81 _gc_cause = gc_cause;
82 }
83
84 void VM_ParallelGCSystemGC::doit() {
85 JvmtiGCFullMarker jgcm;
86 notify_gc_begin(true);
87
88 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
89 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap,
90 "must be a ParallelScavengeHeap");
91
92 GCCauseSetter gccs(heap, _gc_cause);
93 if (_gc_cause == GCCause::_gc_locker
94 DEBUG_ONLY(|| _gc_cause == GCCause::_scavenge_alot)) {
95 // If (and only if) the scavenge fails, this will invoke a full gc.
96 heap->invoke_scavenge();
97 } else {
98 heap->invoke_full_gc(false);
99 }
100 notify_gc_end();
101 }