60 bool _prologue_succeeded; // whether doit_prologue succeeded 61 uint _gc_id; 62 63 bool lost_race() const; 64 65 // java.lang.ref.Reference support 66 void acquire_pending_list_lock(); 67 void release_and_notify_pending_list_lock(); 68 69 public: 70 VM_CMS_Operation(CMSCollector* collector): 71 _collector(collector), 72 _prologue_succeeded(false), 73 _gc_id(GCId::current()) {} 74 ~VM_CMS_Operation() {} 75 76 // The legal collector state for executing this CMS op. 77 virtual const CMSCollector::CollectorState legal_state() const = 0; 78 79 // Whether the pending list lock needs to be held 80 virtual const bool needs_pll() const = 0; 81 82 // Execute operations in the context of the caller, 83 // prior to execution of the vm operation itself. 84 virtual bool doit_prologue(); 85 // Execute operations in the context of the caller, 86 // following completion of the vm operation. 87 virtual void doit_epilogue(); 88 89 virtual bool evaluate_at_safepoint() const { return true; } 90 virtual bool is_cheap_allocated() const { return false; } 91 virtual bool allow_nested_vm_operations() const { return false; } 92 bool prologue_succeeded() const { return _prologue_succeeded; } 93 94 void verify_before_gc(); 95 void verify_after_gc(); 96 }; 97 98 99 // VM_CMS_Operation for the initial marking phase of CMS. 100 class VM_CMS_Initial_Mark: public VM_CMS_Operation { 101 public: 102 VM_CMS_Initial_Mark(CMSCollector* _collector) : 103 VM_CMS_Operation(_collector) {} 104 105 virtual VMOp_Type type() const { return VMOp_CMS_Initial_Mark; } 106 virtual void doit(); 107 108 virtual const CMSCollector::CollectorState legal_state() const { 109 return CMSCollector::InitialMarking; 110 } 111 112 virtual const bool needs_pll() const { 113 return false; 114 } 115 }; 116 117 // VM_CMS_Operation for the final remark phase of CMS. 118 class VM_CMS_Final_Remark: public VM_CMS_Operation { 119 public: 120 VM_CMS_Final_Remark(CMSCollector* _collector) : 121 VM_CMS_Operation(_collector) {} 122 virtual VMOp_Type type() const { return VMOp_CMS_Final_Remark; } 123 virtual void doit(); 124 125 virtual const CMSCollector::CollectorState legal_state() const { 126 return CMSCollector::FinalMarking; 127 } 128 129 virtual const bool needs_pll() const { 130 return true; 131 } 132 }; 133 134 135 // VM operation to invoke a concurrent collection of the heap as a 136 // GenCollectedHeap heap. 137 class VM_GenCollectFullConcurrent: public VM_GC_Operation { 138 public: 139 VM_GenCollectFullConcurrent(uint gc_count_before, 140 uint full_gc_count_before, 141 GCCause::Cause gc_cause) 142 : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */) 143 { 144 assert(FullGCCount_lock != NULL, "Error"); 145 } 146 ~VM_GenCollectFullConcurrent() {} 147 virtual VMOp_Type type() const { return VMOp_GenCollectFullConcurrent; } 148 virtual void doit(); 149 virtual void doit_epilogue(); | 60 bool _prologue_succeeded; // whether doit_prologue succeeded 61 uint _gc_id; 62 63 bool lost_race() const; 64 65 // java.lang.ref.Reference support 66 void acquire_pending_list_lock(); 67 void release_and_notify_pending_list_lock(); 68 69 public: 70 VM_CMS_Operation(CMSCollector* collector): 71 _collector(collector), 72 _prologue_succeeded(false), 73 _gc_id(GCId::current()) {} 74 ~VM_CMS_Operation() {} 75 76 // The legal collector state for executing this CMS op. 77 virtual const CMSCollector::CollectorState legal_state() const = 0; 78 79 // Whether the pending list lock needs to be held 80 virtual const bool needs_pending_list_lock() const = 0; 81 82 // Execute operations in the context of the caller, 83 // prior to execution of the vm operation itself. 84 virtual bool doit_prologue(); 85 // Execute operations in the context of the caller, 86 // following completion of the vm operation. 87 virtual void doit_epilogue(); 88 89 virtual bool evaluate_at_safepoint() const { return true; } 90 virtual bool is_cheap_allocated() const { return false; } 91 virtual bool allow_nested_vm_operations() const { return false; } 92 bool prologue_succeeded() const { return _prologue_succeeded; } 93 94 void verify_before_gc(); 95 void verify_after_gc(); 96 }; 97 98 99 // VM_CMS_Operation for the initial marking phase of CMS. 100 class VM_CMS_Initial_Mark: public VM_CMS_Operation { 101 public: 102 VM_CMS_Initial_Mark(CMSCollector* _collector) : 103 VM_CMS_Operation(_collector) {} 104 105 virtual VMOp_Type type() const { return VMOp_CMS_Initial_Mark; } 106 virtual void doit(); 107 108 virtual const CMSCollector::CollectorState legal_state() const { 109 return CMSCollector::InitialMarking; 110 } 111 112 virtual const bool needs_pending_list_lock() const { 113 return false; 114 } 115 }; 116 117 // VM_CMS_Operation for the final remark phase of CMS. 118 class VM_CMS_Final_Remark: public VM_CMS_Operation { 119 public: 120 VM_CMS_Final_Remark(CMSCollector* _collector) : 121 VM_CMS_Operation(_collector) {} 122 virtual VMOp_Type type() const { return VMOp_CMS_Final_Remark; } 123 virtual void doit(); 124 125 virtual const CMSCollector::CollectorState legal_state() const { 126 return CMSCollector::FinalMarking; 127 } 128 129 virtual const bool needs_pending_list_lock() const { 130 return true; 131 } 132 }; 133 134 135 // VM operation to invoke a concurrent collection of the heap as a 136 // GenCollectedHeap heap. 137 class VM_GenCollectFullConcurrent: public VM_GC_Operation { 138 public: 139 VM_GenCollectFullConcurrent(uint gc_count_before, 140 uint full_gc_count_before, 141 GCCause::Cause gc_cause) 142 : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */) 143 { 144 assert(FullGCCount_lock != NULL, "Error"); 145 } 146 ~VM_GenCollectFullConcurrent() {} 147 virtual VMOp_Type type() const { return VMOp_GenCollectFullConcurrent; } 148 virtual void doit(); 149 virtual void doit_epilogue(); |