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 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_IMPLEMENTATION_SHARED_VMGCOPERATIONS_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_VMGCOPERATIONS_HPP
27
28 #include "memory/heapInspection.hpp"
29 #include "runtime/handles.hpp"
30 #include "runtime/jniHandles.hpp"
31 #include "runtime/synchronizer.hpp"
32 #include "runtime/vm_operations.hpp"
33 #include "prims/jvmtiExport.hpp"
34
35 // The following class hierarchy represents
36 // a set of operations (VM_Operation) related to GC.
37 //
38 // VM_Operation
39 // VM_GC_Operation
40 // VM_GC_HeapInspection
41 // VM_GenCollectForAllocation
42 // VM_GenCollectFull
43 // VM_GenCollectFullConcurrent
44 // VM_ParallelGCFailedAllocation
45 // VM_ParallelGCSystemGC
46 // VM_GC_Operation
47 // - implements methods common to all classes in the hierarchy:
87 bool full = false) {
88 _full = full;
89 _prologue_succeeded = false;
90 _gc_count_before = gc_count_before;
91
92 // A subclass constructor will likely overwrite the following
93 _gc_cause = _cause;
94
95 _gc_locked = false;
96
97 _full_gc_count_before = full_gc_count_before;
98 // In ParallelScavengeHeap::mem_allocate() collections can be
99 // executed within a loop and _all_soft_refs_clear can be set
100 // true after they have been cleared by a collection and another
101 // collection started so that _all_soft_refs_clear can be true
102 // when this collection is started. Don't assert that
103 // _all_soft_refs_clear have to be false here even though
104 // mutators have run. Soft refs will be cleared again in this
105 // collection.
106 }
107 ~VM_GC_Operation() {
108 CollectedHeap* ch = Universe::heap();
109 ch->collector_policy()->set_all_soft_refs_clear(false);
110 }
111
112 // Acquire the reference synchronization lock
113 virtual bool doit_prologue();
114 // Do notifyAll (if needed) and release held lock
115 virtual void doit_epilogue();
116
117 virtual bool allow_nested_vm_operations() const { return true; }
118 bool prologue_succeeded() const { return _prologue_succeeded; }
119
120 void set_gc_locked() { _gc_locked = true; }
121 bool gc_locked() const { return _gc_locked; }
122
123 static void notify_gc_begin(bool full = false);
124 static void notify_gc_end();
125 };
126
127
128 class VM_GC_HeapInspection: public VM_GC_Operation {
129 private:
130 outputStream* _out;
|
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 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_IMPLEMENTATION_SHARED_VMGCOPERATIONS_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_VMGCOPERATIONS_HPP
27
28 #include "gc_interface/collectedHeap.hpp"
29 #include "memory/heapInspection.hpp"
30 #include "runtime/handles.hpp"
31 #include "runtime/jniHandles.hpp"
32 #include "runtime/synchronizer.hpp"
33 #include "runtime/vm_operations.hpp"
34 #include "prims/jvmtiExport.hpp"
35
36 // The following class hierarchy represents
37 // a set of operations (VM_Operation) related to GC.
38 //
39 // VM_Operation
40 // VM_GC_Operation
41 // VM_GC_HeapInspection
42 // VM_GenCollectForAllocation
43 // VM_GenCollectFull
44 // VM_GenCollectFullConcurrent
45 // VM_ParallelGCFailedAllocation
46 // VM_ParallelGCSystemGC
47 // VM_GC_Operation
48 // - implements methods common to all classes in the hierarchy:
88 bool full = false) {
89 _full = full;
90 _prologue_succeeded = false;
91 _gc_count_before = gc_count_before;
92
93 // A subclass constructor will likely overwrite the following
94 _gc_cause = _cause;
95
96 _gc_locked = false;
97
98 _full_gc_count_before = full_gc_count_before;
99 // In ParallelScavengeHeap::mem_allocate() collections can be
100 // executed within a loop and _all_soft_refs_clear can be set
101 // true after they have been cleared by a collection and another
102 // collection started so that _all_soft_refs_clear can be true
103 // when this collection is started. Don't assert that
104 // _all_soft_refs_clear have to be false here even though
105 // mutators have run. Soft refs will be cleared again in this
106 // collection.
107 }
108 ~VM_GC_Operation();
109
110 // Acquire the reference synchronization lock
111 virtual bool doit_prologue();
112 // Do notifyAll (if needed) and release held lock
113 virtual void doit_epilogue();
114
115 virtual bool allow_nested_vm_operations() const { return true; }
116 bool prologue_succeeded() const { return _prologue_succeeded; }
117
118 void set_gc_locked() { _gc_locked = true; }
119 bool gc_locked() const { return _gc_locked; }
120
121 static void notify_gc_begin(bool full = false);
122 static void notify_gc_end();
123 };
124
125
126 class VM_GC_HeapInspection: public VM_GC_Operation {
127 private:
128 outputStream* _out;
|