author | apetrusenko |
Wed, 16 Apr 2008 12:58:03 +0400 | |
changeset 387 | 6b17ecb32336 |
parent 386 | 7f121b1192f2 |
child 5547 | f4b087cbb361 |
permissions | -rw-r--r-- |
1 | 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); |
|
386
7f121b1192f2
6539517: CR 6186200 should be extended to perm gen allocation to prevent spurious OOM's from perm gen
apetrusenko
parents:
1
diff
changeset
|
72 |
if (_result == NULL && GC_locker::is_active_and_needs_gc()) { |
7f121b1192f2
6539517: CR 6186200 should be extended to perm gen allocation to prevent spurious OOM's from perm gen
apetrusenko
parents:
1
diff
changeset
|
73 |
set_gc_locked(); |
7f121b1192f2
6539517: CR 6186200 should be extended to perm gen allocation to prevent spurious OOM's from perm gen
apetrusenko
parents:
1
diff
changeset
|
74 |
} |
1 | 75 |
notify_gc_end(); |
76 |
} |
|
77 |
||
78 |
// Only used for System.gc() calls |
|
79 |
VM_ParallelGCSystemGC::VM_ParallelGCSystemGC(unsigned int gc_count, |
|
80 |
unsigned int full_gc_count, |
|
81 |
GCCause::Cause gc_cause) : |
|
82 |
VM_GC_Operation(gc_count, full_gc_count, true /* full */) |
|
83 |
{ |
|
84 |
_gc_cause = gc_cause; |
|
85 |
} |
|
86 |
||
87 |
void VM_ParallelGCSystemGC::doit() { |
|
88 |
JvmtiGCFullMarker jgcm; |
|
89 |
notify_gc_begin(true); |
|
90 |
||
91 |
ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); |
|
92 |
assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, |
|
93 |
"must be a ParallelScavengeHeap"); |
|
94 |
||
95 |
GCCauseSetter gccs(heap, _gc_cause); |
|
96 |
if (_gc_cause == GCCause::_gc_locker |
|
97 |
DEBUG_ONLY(|| _gc_cause == GCCause::_scavenge_alot)) { |
|
98 |
// If (and only if) the scavenge fails, this will invoke a full gc. |
|
99 |
heap->invoke_scavenge(); |
|
100 |
} else { |
|
101 |
heap->invoke_full_gc(false); |
|
102 |
} |
|
103 |
notify_gc_end(); |
|
104 |
} |