Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp @ 8733:9def4075da6d
8008079: G1: Add nextObject routine to CMBitMapRO and replace nextWord
Summary: Update the task local finger to the start of the next object when marking aborts, in order to avoid the redundant scanning of all 0's when the marking task restarts, if otherwise updating to the next word. In addition, reuse the routine nextObject() in routine iterate().
Reviewed-by: johnc, ysr
Contributed-by: tamao <tao.mao@oracle.com>
author | tamao |
---|---|
date | Tue, 05 Mar 2013 15:36:56 -0800 |
parents | a181f3a124dd |
children |
rev | line source |
---|---|
0 | 1 /* |
2225 | 2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
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 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_VMCMSOPERATIONS_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_VMCMSOPERATIONS_HPP | |
27 | |
28 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp" | |
29 #include "gc_implementation/shared/vmGCOperations.hpp" | |
30 #include "gc_interface/gcCause.hpp" | |
31 #include "runtime/vm_operations.hpp" | |
32 | |
0 | 33 // The VM_CMS_Operation is slightly different from |
34 // a VM_GC_Operation -- and would not have subclassed easily | |
35 // to VM_GC_Operation without several changes to VM_GC_Operation. | |
36 // To minimize the changes, we have replicated some of the VM_GC_Operation | |
37 // functionality here. We will consolidate that back by doing subclassing | |
38 // as appropriate in Dolphin. | |
39 // | |
40 // VM_Operation | |
41 // VM_CMS_Operation | |
42 // - implements the common portion of work done in support | |
43 // of CMS' stop-world phases (initial mark and remark). | |
44 // | |
45 // VM_CMS_Initial_Mark | |
46 // VM_CMS_Final_Mark | |
47 // | |
48 | |
49 // Forward decl. | |
50 class CMSCollector; | |
51 | |
52 class VM_CMS_Operation: public VM_Operation { | |
53 protected: | |
54 CMSCollector* _collector; // associated collector | |
55 bool _prologue_succeeded; // whether doit_prologue succeeded | |
56 | |
57 bool lost_race() const; | |
58 | |
59 // java.lang.ref.Reference support | |
60 void acquire_pending_list_lock(); | |
61 void release_and_notify_pending_list_lock(); | |
62 | |
63 public: | |
64 VM_CMS_Operation(CMSCollector* collector): | |
65 _collector(collector), | |
66 _prologue_succeeded(false) {} | |
67 ~VM_CMS_Operation() {} | |
68 | |
69 // The legal collector state for executing this CMS op. | |
70 virtual const CMSCollector::CollectorState legal_state() const = 0; | |
71 | |
72 // Whether the pending list lock needs to be held | |
73 virtual const bool needs_pll() const = 0; | |
74 | |
75 // Execute operations in the context of the caller, | |
76 // prior to execution of the vm operation itself. | |
77 virtual bool doit_prologue(); | |
78 // Execute operations in the context of the caller, | |
79 // following completion of the vm operation. | |
80 virtual void doit_epilogue(); | |
81 | |
82 virtual bool evaluate_at_safepoint() const { return true; } | |
83 virtual bool is_cheap_allocated() const { return false; } | |
84 virtual bool allow_nested_vm_operations() const { return false; } | |
85 bool prologue_succeeded() const { return _prologue_succeeded; } | |
86 | |
87 void verify_before_gc(); | |
88 void verify_after_gc(); | |
89 }; | |
90 | |
91 | |
92 // VM_CMS_Operation for the initial marking phase of CMS. | |
93 class VM_CMS_Initial_Mark: public VM_CMS_Operation { | |
94 public: | |
95 VM_CMS_Initial_Mark(CMSCollector* _collector) : | |
96 VM_CMS_Operation(_collector) {} | |
97 | |
98 virtual VMOp_Type type() const { return VMOp_CMS_Initial_Mark; } | |
99 virtual void doit(); | |
100 | |
101 virtual const CMSCollector::CollectorState legal_state() const { | |
102 return CMSCollector::InitialMarking; | |
103 } | |
104 | |
105 virtual const bool needs_pll() const { | |
106 return false; | |
107 } | |
108 }; | |
109 | |
110 // VM_CMS_Operation for the final remark phase of CMS. | |
111 class VM_CMS_Final_Remark: public VM_CMS_Operation { | |
112 public: | |
113 VM_CMS_Final_Remark(CMSCollector* _collector) : | |
114 VM_CMS_Operation(_collector) {} | |
115 virtual VMOp_Type type() const { return VMOp_CMS_Final_Remark; } | |
116 virtual void doit(); | |
117 | |
118 virtual const CMSCollector::CollectorState legal_state() const { | |
119 return CMSCollector::FinalMarking; | |
120 } | |
121 | |
122 virtual const bool needs_pll() const { | |
123 return true; | |
124 } | |
125 }; | |
126 | |
127 | |
128 // VM operation to invoke a concurrent collection of the heap as a | |
129 // GenCollectedHeap heap. | |
130 class VM_GenCollectFullConcurrent: public VM_GC_Operation { | |
2365
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
2225
diff
changeset
|
131 bool _disabled_icms; |
0 | 132 public: |
133 VM_GenCollectFullConcurrent(unsigned int gc_count_before, | |
134 unsigned int full_gc_count_before, | |
135 GCCause::Cause gc_cause) | |
2365
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
2225
diff
changeset
|
136 : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */), |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
2225
diff
changeset
|
137 _disabled_icms(false) |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
2225
diff
changeset
|
138 { |
1520
bb843ebc7c55
6919638: CMS: ExplicitGCInvokesConcurrent misinteracts with gc locker
ysr
parents:
0
diff
changeset
|
139 assert(FullGCCount_lock != NULL, "Error"); |
0 | 140 assert(UseAsyncConcMarkSweepGC, "Else will hang caller"); |
141 } | |
142 ~VM_GenCollectFullConcurrent() {} | |
143 virtual VMOp_Type type() const { return VMOp_GenCollectFullConcurrent; } | |
144 virtual void doit(); | |
145 virtual void doit_epilogue(); | |
146 virtual bool is_cheap_allocated() const { return false; } | |
147 virtual bool evaluate_at_safepoint() const; | |
148 }; | |
1972 | 149 |
150 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_VMCMSOPERATIONS_HPP |