1 /*
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
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 *
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_G1_G1REMSET_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1REMSET_HPP
27
28 #include "gc_implementation/g1/g1RemSetSummary.hpp"
29
30 // A G1RemSet provides ways of iterating over pointers into a selected
31 // collection set.
32
33 class G1CollectedHeap;
34 class ConcurrentG1Refine;
35 class G1ParPushHeapRSClosure;
36
37 // A G1RemSet in which each heap region has a rem set that records the
38 // external heap references into it. Uses a mod ref bs to track updates,
39 // so that they can be used to update the individual region remsets.
40
41 class G1RemSet: public CHeapObj<mtGC> {
42 private:
43 G1RemSetSummary _prev_period_summary;
44 protected:
45 G1CollectedHeap* _g1;
46 size_t _conc_refine_cards;
47 uint n_workers();
48
158 template <class T> void do_oop_work(T* p);
159
160 public:
161 UpdateRSOopClosure(G1RemSet* rs, uint worker_i = 0) :
162 _from(NULL), _rs(rs), _worker_i(worker_i)
163 {}
164
165 void set_from(HeapRegion* from) {
166 assert(from != NULL, "from region must be non-NULL");
167 _from = from;
168 }
169
170 virtual void do_oop(narrowOop* p) { do_oop_work(p); }
171 virtual void do_oop(oop* p) { do_oop_work(p); }
172
173 // Override: this closure is idempotent.
174 // bool idempotent() { return true; }
175 bool apply_to_weak_ref_discovered_field() { return true; }
176 };
177
178 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1REMSET_HPP
|
1 /*
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
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 *
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_G1_G1REMSET_HPP
26 #define SHARE_VM_GC_G1_G1REMSET_HPP
27
28 #include "gc/g1/g1RemSetSummary.hpp"
29
30 // A G1RemSet provides ways of iterating over pointers into a selected
31 // collection set.
32
33 class G1CollectedHeap;
34 class ConcurrentG1Refine;
35 class G1ParPushHeapRSClosure;
36
37 // A G1RemSet in which each heap region has a rem set that records the
38 // external heap references into it. Uses a mod ref bs to track updates,
39 // so that they can be used to update the individual region remsets.
40
41 class G1RemSet: public CHeapObj<mtGC> {
42 private:
43 G1RemSetSummary _prev_period_summary;
44 protected:
45 G1CollectedHeap* _g1;
46 size_t _conc_refine_cards;
47 uint n_workers();
48
158 template <class T> void do_oop_work(T* p);
159
160 public:
161 UpdateRSOopClosure(G1RemSet* rs, uint worker_i = 0) :
162 _from(NULL), _rs(rs), _worker_i(worker_i)
163 {}
164
165 void set_from(HeapRegion* from) {
166 assert(from != NULL, "from region must be non-NULL");
167 _from = from;
168 }
169
170 virtual void do_oop(narrowOop* p) { do_oop_work(p); }
171 virtual void do_oop(oop* p) { do_oop_work(p); }
172
173 // Override: this closure is idempotent.
174 // bool idempotent() { return true; }
175 bool apply_to_weak_ref_discovered_field() { return true; }
176 };
177
178 #endif // SHARE_VM_GC_G1_G1REMSET_HPP
|