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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_CMS_VMCMSOPERATIONS_HPP
26 #define SHARE_VM_GC_CMS_VMCMSOPERATIONS_HPP
27
28 #include "gc/cms/concurrentMarkSweepGeneration.hpp"
29 #include "gc/shared/gcCause.hpp"
30 #include "gc/shared/vmGCOperations.hpp"
31 #include "runtime/vm_operations.hpp"
32
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
|
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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_CMS_VMCMSOPERATIONS_HPP
26 #define SHARE_VM_GC_CMS_VMCMSOPERATIONS_HPP
27
28 #include "gc/cms/concurrentMarkSweepGeneration.hpp"
29 #include "gc/shared/gcCause.hpp"
30 #include "gc/shared/gcId.hpp"
31 #include "gc/shared/vmGCOperations.hpp"
32 #include "runtime/vm_operations.hpp"
33
34 // The VM_CMS_Operation is slightly different from
35 // a VM_GC_Operation -- and would not have subclassed easily
36 // to VM_GC_Operation without several changes to VM_GC_Operation.
37 // To minimize the changes, we have replicated some of the VM_GC_Operation
38 // functionality here. We will consolidate that back by doing subclassing
39 // as appropriate in Dolphin.
40 //
41 // VM_Operation
42 // VM_CMS_Operation
43 // - implements the common portion of work done in support
44 // of CMS' stop-world phases (initial mark and remark).
45 //
46 // VM_CMS_Initial_Mark
47 // VM_CMS_Final_Mark
48 //
49
50 // Forward decl.
51 class CMSCollector;
52
53 class VM_CMS_Operation: public VM_Operation {
54 protected:
55 CMSCollector* _collector; // associated collector
56 bool _prologue_succeeded; // whether doit_prologue succeeded
57 uint _gc_id;
58
59 bool lost_race() const;
60
61 // java.lang.ref.Reference support
62 void acquire_pending_list_lock();
63 void release_and_notify_pending_list_lock();
64
65 public:
66 VM_CMS_Operation(CMSCollector* collector):
67 _collector(collector),
68 _prologue_succeeded(false),
69 _gc_id(GCId::current()) {}
70 ~VM_CMS_Operation() {}
71
72 // The legal collector state for executing this CMS op.
73 virtual const CMSCollector::CollectorState legal_state() const = 0;
74
75 // Whether the pending list lock needs to be held
76 virtual const bool needs_pll() const = 0;
77
78 // Execute operations in the context of the caller,
79 // prior to execution of the vm operation itself.
80 virtual bool doit_prologue();
81 // Execute operations in the context of the caller,
82 // following completion of the vm operation.
83 virtual void doit_epilogue();
84
85 virtual bool evaluate_at_safepoint() const { return true; }
86 virtual bool is_cheap_allocated() const { return false; }
87 virtual bool allow_nested_vm_operations() const { return false; }
88 bool prologue_succeeded() const { return _prologue_succeeded; }
89
|