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 #include "precompiled.hpp"
26 #include "logging/log.hpp"
27 #include "gc/g1/concurrentMarkThread.hpp"
28 #include "gc/g1/g1CollectedHeap.hpp"
29 #include "gc/g1/g1CollectedHeap.inline.hpp"
30 #include "gc/g1/g1HeapVerifier.hpp"
31 #include "gc/g1/g1MarkSweep.hpp"
32 #include "gc/g1/g1Policy.hpp"
33 #include "gc/g1/g1RemSet.hpp"
34 #include "gc/g1/g1RootProcessor.hpp"
35 #include "gc/g1/heapRegion.hpp"
36 #include "gc/g1/heapRegion.inline.hpp"
37 #include "gc/g1/heapRegionRemSet.hpp"
38 #include "gc/g1/g1StringDedup.hpp"
39 #include "memory/resourceArea.hpp"
40 #include "oops/oop.inline.hpp"
41
42 class VerifyRootsClosure: public OopClosure {
43 private:
44 G1CollectedHeap* _g1h;
45 VerifyOption _vo;
46 bool _failures;
47 public:
48 // _vo == UsePrevMarking -> use "prev" marking information,
49 // _vo == UseNextMarking -> use "next" marking information,
50 // _vo == UseMarkWord -> use mark word from object header.
51 VerifyRootsClosure(VerifyOption vo) :
222 }
223
224 o->oop_iterate_no_header(&isLive);
225 if (!_hr->obj_allocated_since_prev_marking(o)) {
226 size_t obj_size = o->size(); // Make sure we don't overflow
227 _live_bytes += (obj_size * HeapWordSize);
228 }
229 }
230 }
231 size_t live_bytes() { return _live_bytes; }
232 };
233
234 class VerifyArchiveOopClosure: public OopClosure {
235 public:
236 VerifyArchiveOopClosure(HeapRegion *hr) { }
237 void do_oop(narrowOop *p) { do_oop_work(p); }
238 void do_oop( oop *p) { do_oop_work(p); }
239
240 template <class T> void do_oop_work(T *p) {
241 oop obj = oopDesc::load_decode_heap_oop(p);
242 guarantee(obj == NULL || G1MarkSweep::in_archive_range(obj),
243 "Archive object at " PTR_FORMAT " references a non-archive object at " PTR_FORMAT,
244 p2i(p), p2i(obj));
245 }
246 };
247
248 class VerifyArchiveRegionClosure: public ObjectClosure {
249 public:
250 VerifyArchiveRegionClosure(HeapRegion *hr) { }
251 // Verify that all object pointers are to archive regions.
252 void do_object(oop o) {
253 VerifyArchiveOopClosure checkOop(NULL);
254 assert(o != NULL, "Should not be here for NULL oops");
255 o->oop_iterate_no_header(&checkOop);
256 }
257 };
258
259 class VerifyRegionClosure: public HeapRegionClosure {
260 private:
261 bool _par;
262 VerifyOption _vo;
|
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 #include "precompiled.hpp"
26 #include "logging/log.hpp"
27 #include "gc/g1/concurrentMarkThread.hpp"
28 #include "gc/g1/g1Allocator.inline.hpp"
29 #include "gc/g1/g1CollectedHeap.hpp"
30 #include "gc/g1/g1CollectedHeap.inline.hpp"
31 #include "gc/g1/g1HeapVerifier.hpp"
32 #include "gc/g1/g1Policy.hpp"
33 #include "gc/g1/g1RemSet.hpp"
34 #include "gc/g1/g1RootProcessor.hpp"
35 #include "gc/g1/heapRegion.hpp"
36 #include "gc/g1/heapRegion.inline.hpp"
37 #include "gc/g1/heapRegionRemSet.hpp"
38 #include "gc/g1/g1StringDedup.hpp"
39 #include "memory/resourceArea.hpp"
40 #include "oops/oop.inline.hpp"
41
42 class VerifyRootsClosure: public OopClosure {
43 private:
44 G1CollectedHeap* _g1h;
45 VerifyOption _vo;
46 bool _failures;
47 public:
48 // _vo == UsePrevMarking -> use "prev" marking information,
49 // _vo == UseNextMarking -> use "next" marking information,
50 // _vo == UseMarkWord -> use mark word from object header.
51 VerifyRootsClosure(VerifyOption vo) :
222 }
223
224 o->oop_iterate_no_header(&isLive);
225 if (!_hr->obj_allocated_since_prev_marking(o)) {
226 size_t obj_size = o->size(); // Make sure we don't overflow
227 _live_bytes += (obj_size * HeapWordSize);
228 }
229 }
230 }
231 size_t live_bytes() { return _live_bytes; }
232 };
233
234 class VerifyArchiveOopClosure: public OopClosure {
235 public:
236 VerifyArchiveOopClosure(HeapRegion *hr) { }
237 void do_oop(narrowOop *p) { do_oop_work(p); }
238 void do_oop( oop *p) { do_oop_work(p); }
239
240 template <class T> void do_oop_work(T *p) {
241 oop obj = oopDesc::load_decode_heap_oop(p);
242 guarantee(obj == NULL || G1ArchiveAllocator::is_archive_object(obj),
243 "Archive object at " PTR_FORMAT " references a non-archive object at " PTR_FORMAT,
244 p2i(p), p2i(obj));
245 }
246 };
247
248 class VerifyArchiveRegionClosure: public ObjectClosure {
249 public:
250 VerifyArchiveRegionClosure(HeapRegion *hr) { }
251 // Verify that all object pointers are to archive regions.
252 void do_object(oop o) {
253 VerifyArchiveOopClosure checkOop(NULL);
254 assert(o != NULL, "Should not be here for NULL oops");
255 o->oop_iterate_no_header(&checkOop);
256 }
257 };
258
259 class VerifyRegionClosure: public HeapRegionClosure {
260 private:
261 bool _par;
262 VerifyOption _vo;
|