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 *
129 virtual void do_oop(narrowOop* p);
130 inline void do_oop_nv(oop* p);
131 inline void do_oop_nv(narrowOop* p);
132 };
133
134 class KlassScanClosure: public KlassClosure {
135 OopsInKlassOrGenClosure* _scavenge_closure;
136 // true if the the modified oops state should be saved.
137 bool _accumulate_modified_oops;
138 public:
139 KlassScanClosure(OopsInKlassOrGenClosure* scavenge_closure,
140 KlassRemSet* klass_rem_set_policy);
141 void do_klass(Klass* k);
142 };
143
144 class FilteringClosure: public ExtendedOopClosure {
145 private:
146 HeapWord* _boundary;
147 ExtendedOopClosure* _cl;
148 protected:
149 template <class T> inline void do_oop_work(T* p) {
150 T heap_oop = oopDesc::load_heap_oop(p);
151 if (!oopDesc::is_null(heap_oop)) {
152 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
153 if ((HeapWord*)obj < _boundary) {
154 _cl->do_oop(p);
155 }
156 }
157 }
158 public:
159 FilteringClosure(HeapWord* boundary, ExtendedOopClosure* cl) :
160 ExtendedOopClosure(cl->ref_processor()), _boundary(boundary),
161 _cl(cl) {}
162 virtual void do_oop(oop* p);
163 virtual void do_oop(narrowOop* p);
164 inline void do_oop_nv(oop* p) { FilteringClosure::do_oop_work(p); }
165 inline void do_oop_nv(narrowOop* p) { FilteringClosure::do_oop_work(p); }
166 virtual bool do_metadata() { return do_metadata_nv(); }
167 inline bool do_metadata_nv() { assert(!_cl->do_metadata(), "assumption broken, must change to 'return _cl->do_metadata()'"); return false; }
168 };
169
170 // Closure for scanning DefNewGeneration's weak references.
171 // NOTE: very much like ScanClosure but not derived from
172 // OopsInGenClosure -- weak references are processed all
173 // at once, with no notion of which generation they were in.
174 class ScanWeakRefClosure: public OopClosure {
175 protected:
176 DefNewGeneration* _g;
177 HeapWord* _boundary;
178 template <class T> inline void do_oop_work(T* p);
179 public:
180 ScanWeakRefClosure(DefNewGeneration* g);
181 virtual void do_oop(oop* p);
182 virtual void do_oop(narrowOop* p);
183 inline void do_oop_nv(oop* p);
184 inline void do_oop_nv(narrowOop* p);
185 };
|
1 /*
2 * Copyright (c) 2001, 2016, 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 *
129 virtual void do_oop(narrowOop* p);
130 inline void do_oop_nv(oop* p);
131 inline void do_oop_nv(narrowOop* p);
132 };
133
134 class KlassScanClosure: public KlassClosure {
135 OopsInKlassOrGenClosure* _scavenge_closure;
136 // true if the the modified oops state should be saved.
137 bool _accumulate_modified_oops;
138 public:
139 KlassScanClosure(OopsInKlassOrGenClosure* scavenge_closure,
140 KlassRemSet* klass_rem_set_policy);
141 void do_klass(Klass* k);
142 };
143
144 class FilteringClosure: public ExtendedOopClosure {
145 private:
146 HeapWord* _boundary;
147 ExtendedOopClosure* _cl;
148 protected:
149 template <class T> inline void do_oop_work(T* p);
150 public:
151 FilteringClosure(HeapWord* boundary, ExtendedOopClosure* cl) :
152 ExtendedOopClosure(cl->ref_processor()), _boundary(boundary),
153 _cl(cl) {}
154 virtual void do_oop(oop* p);
155 virtual void do_oop(narrowOop* p);
156 inline void do_oop_nv(oop* p);
157 inline void do_oop_nv(narrowOop* p);
158 virtual bool do_metadata() { return do_metadata_nv(); }
159 inline bool do_metadata_nv() { assert(!_cl->do_metadata(), "assumption broken, must change to 'return _cl->do_metadata()'"); return false; }
160 };
161
162 // Closure for scanning DefNewGeneration's weak references.
163 // NOTE: very much like ScanClosure but not derived from
164 // OopsInGenClosure -- weak references are processed all
165 // at once, with no notion of which generation they were in.
166 class ScanWeakRefClosure: public OopClosure {
167 protected:
168 DefNewGeneration* _g;
169 HeapWord* _boundary;
170 template <class T> inline void do_oop_work(T* p);
171 public:
172 ScanWeakRefClosure(DefNewGeneration* g);
173 virtual void do_oop(oop* p);
174 virtual void do_oop(narrowOop* p);
175 inline void do_oop_nv(oop* p);
176 inline void do_oop_nv(narrowOop* p);
177 };
|