annotate src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp @ 1552:c18cbe5936b8

6941466: Oracle rebranding changes for Hotspot repositories Summary: Change all the Sun copyrights to Oracle copyright Reviewed-by: ohair
author trims
date Thu, 27 May 2010 19:08:38 -0700
parents bb843ebc7c55
children f95d63e2154a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1520
diff changeset
2 * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1520
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1520
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1520
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // The VM_CMS_Operation is slightly different from
a61af66fc99e Initial load
duke
parents:
diff changeset
26 // a VM_GC_Operation -- and would not have subclassed easily
a61af66fc99e Initial load
duke
parents:
diff changeset
27 // to VM_GC_Operation without several changes to VM_GC_Operation.
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // To minimize the changes, we have replicated some of the VM_GC_Operation
a61af66fc99e Initial load
duke
parents:
diff changeset
29 // functionality here. We will consolidate that back by doing subclassing
a61af66fc99e Initial load
duke
parents:
diff changeset
30 // as appropriate in Dolphin.
a61af66fc99e Initial load
duke
parents:
diff changeset
31 //
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // VM_Operation
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // VM_CMS_Operation
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // - implements the common portion of work done in support
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // of CMS' stop-world phases (initial mark and remark).
a61af66fc99e Initial load
duke
parents:
diff changeset
36 //
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // VM_CMS_Initial_Mark
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // VM_CMS_Final_Mark
a61af66fc99e Initial load
duke
parents:
diff changeset
39 //
a61af66fc99e Initial load
duke
parents:
diff changeset
40
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // Forward decl.
a61af66fc99e Initial load
duke
parents:
diff changeset
42 class CMSCollector;
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44 class VM_CMS_Operation: public VM_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
45 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
46 CMSCollector* _collector; // associated collector
a61af66fc99e Initial load
duke
parents:
diff changeset
47 bool _prologue_succeeded; // whether doit_prologue succeeded
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 bool lost_race() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51 // java.lang.ref.Reference support
a61af66fc99e Initial load
duke
parents:
diff changeset
52 void acquire_pending_list_lock();
a61af66fc99e Initial load
duke
parents:
diff changeset
53 void release_and_notify_pending_list_lock();
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
56 VM_CMS_Operation(CMSCollector* collector):
a61af66fc99e Initial load
duke
parents:
diff changeset
57 _collector(collector),
a61af66fc99e Initial load
duke
parents:
diff changeset
58 _prologue_succeeded(false) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
59 ~VM_CMS_Operation() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // The legal collector state for executing this CMS op.
a61af66fc99e Initial load
duke
parents:
diff changeset
62 virtual const CMSCollector::CollectorState legal_state() const = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // Whether the pending list lock needs to be held
a61af66fc99e Initial load
duke
parents:
diff changeset
65 virtual const bool needs_pll() const = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // Execute operations in the context of the caller,
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // prior to execution of the vm operation itself.
a61af66fc99e Initial load
duke
parents:
diff changeset
69 virtual bool doit_prologue();
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // Execute operations in the context of the caller,
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // following completion of the vm operation.
a61af66fc99e Initial load
duke
parents:
diff changeset
72 virtual void doit_epilogue();
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 virtual bool evaluate_at_safepoint() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
75 virtual bool is_cheap_allocated() const { return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
76 virtual bool allow_nested_vm_operations() const { return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
77 bool prologue_succeeded() const { return _prologue_succeeded; }
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 void verify_before_gc();
a61af66fc99e Initial load
duke
parents:
diff changeset
80 void verify_after_gc();
a61af66fc99e Initial load
duke
parents:
diff changeset
81 };
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 // VM_CMS_Operation for the initial marking phase of CMS.
a61af66fc99e Initial load
duke
parents:
diff changeset
85 class VM_CMS_Initial_Mark: public VM_CMS_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
87 VM_CMS_Initial_Mark(CMSCollector* _collector) :
a61af66fc99e Initial load
duke
parents:
diff changeset
88 VM_CMS_Operation(_collector) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 virtual VMOp_Type type() const { return VMOp_CMS_Initial_Mark; }
a61af66fc99e Initial load
duke
parents:
diff changeset
91 virtual void doit();
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 virtual const CMSCollector::CollectorState legal_state() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 return CMSCollector::InitialMarking;
a61af66fc99e Initial load
duke
parents:
diff changeset
95 }
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97 virtual const bool needs_pll() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
98 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
99 }
a61af66fc99e Initial load
duke
parents:
diff changeset
100 };
a61af66fc99e Initial load
duke
parents:
diff changeset
101
a61af66fc99e Initial load
duke
parents:
diff changeset
102 // VM_CMS_Operation for the final remark phase of CMS.
a61af66fc99e Initial load
duke
parents:
diff changeset
103 class VM_CMS_Final_Remark: public VM_CMS_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
104 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
105 VM_CMS_Final_Remark(CMSCollector* _collector) :
a61af66fc99e Initial load
duke
parents:
diff changeset
106 VM_CMS_Operation(_collector) {}
a61af66fc99e Initial load
duke
parents:
diff changeset
107 virtual VMOp_Type type() const { return VMOp_CMS_Final_Remark; }
a61af66fc99e Initial load
duke
parents:
diff changeset
108 virtual void doit();
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 virtual const CMSCollector::CollectorState legal_state() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
111 return CMSCollector::FinalMarking;
a61af66fc99e Initial load
duke
parents:
diff changeset
112 }
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 virtual const bool needs_pll() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
116 }
a61af66fc99e Initial load
duke
parents:
diff changeset
117 };
a61af66fc99e Initial load
duke
parents:
diff changeset
118
a61af66fc99e Initial load
duke
parents:
diff changeset
119
a61af66fc99e Initial load
duke
parents:
diff changeset
120 // VM operation to invoke a concurrent collection of the heap as a
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // GenCollectedHeap heap.
a61af66fc99e Initial load
duke
parents:
diff changeset
122 class VM_GenCollectFullConcurrent: public VM_GC_Operation {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
124 VM_GenCollectFullConcurrent(unsigned int gc_count_before,
a61af66fc99e Initial load
duke
parents:
diff changeset
125 unsigned int full_gc_count_before,
a61af66fc99e Initial load
duke
parents:
diff changeset
126 GCCause::Cause gc_cause)
a61af66fc99e Initial load
duke
parents:
diff changeset
127 : VM_GC_Operation(gc_count_before, full_gc_count_before, true /* full */) {
a61af66fc99e Initial load
duke
parents:
diff changeset
128 _gc_cause = gc_cause;
1520
bb843ebc7c55 6919638: CMS: ExplicitGCInvokesConcurrent misinteracts with gc locker
ysr
parents: 0
diff changeset
129 assert(FullGCCount_lock != NULL, "Error");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
130 assert(UseAsyncConcMarkSweepGC, "Else will hang caller");
a61af66fc99e Initial load
duke
parents:
diff changeset
131 }
a61af66fc99e Initial load
duke
parents:
diff changeset
132 ~VM_GenCollectFullConcurrent() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
133 virtual VMOp_Type type() const { return VMOp_GenCollectFullConcurrent; }
a61af66fc99e Initial load
duke
parents:
diff changeset
134 virtual void doit();
a61af66fc99e Initial load
duke
parents:
diff changeset
135 virtual void doit_epilogue();
a61af66fc99e Initial load
duke
parents:
diff changeset
136 virtual bool is_cheap_allocated() const { return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
137 virtual bool evaluate_at_safepoint() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
138 };