1374
|
1 |
/*
|
3261
|
2 |
* Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
|
1374
|
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/_vm_operations_g1.cpp.incl"
|
|
27 |
|
|
28 |
void VM_G1CollectForAllocation::doit() {
|
|
29 |
JvmtiGCForAllocationMarker jgcm;
|
|
30 |
G1CollectedHeap* g1h = G1CollectedHeap::heap();
|
|
31 |
_res = g1h->satisfy_failed_allocation(_size);
|
|
32 |
assert(g1h->is_in_or_null(_res), "result not in heap");
|
|
33 |
}
|
|
34 |
|
|
35 |
void VM_G1CollectFull::doit() {
|
|
36 |
JvmtiGCFullMarker jgcm;
|
|
37 |
G1CollectedHeap* g1h = G1CollectedHeap::heap();
|
|
38 |
GCCauseSetter x(g1h, _gc_cause);
|
|
39 |
g1h->do_full_collection(false /* clear_all_soft_refs */);
|
|
40 |
}
|
|
41 |
|
|
42 |
void VM_G1IncCollectionPause::doit() {
|
|
43 |
JvmtiGCForAllocationMarker jgcm;
|
|
44 |
G1CollectedHeap* g1h = G1CollectedHeap::heap();
|
|
45 |
GCCauseSetter x(g1h, GCCause::_g1_inc_collection_pause);
|
2344
|
46 |
g1h->do_collection_pause_at_safepoint();
|
1374
|
47 |
}
|
|
48 |
|
|
49 |
void VM_CGC_Operation::doit() {
|
|
50 |
gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
|
|
51 |
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
|
|
52 |
TraceTime t(_printGCMessage, PrintGC, true, gclog_or_tty);
|
|
53 |
SharedHeap* sh = SharedHeap::heap();
|
|
54 |
// This could go away if CollectedHeap gave access to _gc_is_active...
|
|
55 |
if (sh != NULL) {
|
|
56 |
IsGCActiveMark x;
|
|
57 |
_cl->do_void();
|
|
58 |
} else {
|
|
59 |
_cl->do_void();
|
|
60 |
}
|
|
61 |
}
|
|
62 |
|
|
63 |
bool VM_CGC_Operation::doit_prologue() {
|
|
64 |
Heap_lock->lock();
|
|
65 |
SharedHeap::heap()->_thread_holds_heap_lock_for_gc = true;
|
|
66 |
return true;
|
|
67 |
}
|
|
68 |
|
|
69 |
void VM_CGC_Operation::doit_epilogue() {
|
|
70 |
SharedHeap::heap()->_thread_holds_heap_lock_for_gc = false;
|
|
71 |
Heap_lock->unlock();
|
|
72 |
}
|