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 *
1995 }
1996
1997 #ifndef PRODUCT
1998 class VerifyNoCSetOops VALUE_OBJ_CLASS_SPEC {
1999 private:
2000 G1CollectedHeap* _g1h;
2001 const char* _phase;
2002 int _info;
2003
2004 public:
2005 VerifyNoCSetOops(const char* phase, int info = -1) :
2006 _g1h(G1CollectedHeap::heap()),
2007 _phase(phase),
2008 _info(info)
2009 { }
2010
2011 void operator()(oop obj) const {
2012 guarantee(G1CMObjArrayProcessor::is_array_slice(obj) || obj->is_oop(),
2013 "Non-oop " PTR_FORMAT ", phase: %s, info: %d",
2014 p2i(obj), _phase, _info);
2015 guarantee(G1CMObjArrayProcessor::is_array_slice(obj) || !_g1h->obj_in_cs(obj),
2016 "obj: " PTR_FORMAT " in CSet, phase: %s, info: %d",
2017 p2i(obj), _phase, _info);
2018 }
2019 };
2020
2021 void G1ConcurrentMark::verify_no_cset_oops() {
2022 assert(SafepointSynchronize::is_at_safepoint(), "should be at a safepoint");
2023 if (!G1CollectedHeap::heap()->collector_state()->mark_in_progress()) {
2024 return;
2025 }
2026
2027 // Verify entries on the global mark stack
2028 _global_mark_stack.iterate(VerifyNoCSetOops("Stack"));
2029
2030 // Verify entries on the task queues
2031 for (uint i = 0; i < _max_worker_id; ++i) {
2032 G1CMTaskQueue* queue = _task_queues->queue(i);
2033 queue->iterate(VerifyNoCSetOops("Queue", i));
2034 }
2035
|
1 /*
2 * Copyright (c) 2001, 2017, 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 *
1995 }
1996
1997 #ifndef PRODUCT
1998 class VerifyNoCSetOops VALUE_OBJ_CLASS_SPEC {
1999 private:
2000 G1CollectedHeap* _g1h;
2001 const char* _phase;
2002 int _info;
2003
2004 public:
2005 VerifyNoCSetOops(const char* phase, int info = -1) :
2006 _g1h(G1CollectedHeap::heap()),
2007 _phase(phase),
2008 _info(info)
2009 { }
2010
2011 void operator()(oop obj) const {
2012 guarantee(G1CMObjArrayProcessor::is_array_slice(obj) || obj->is_oop(),
2013 "Non-oop " PTR_FORMAT ", phase: %s, info: %d",
2014 p2i(obj), _phase, _info);
2015 guarantee(G1CMObjArrayProcessor::is_array_slice(obj) || !_g1h->is_in_cset(obj),
2016 "obj: " PTR_FORMAT " in CSet, phase: %s, info: %d",
2017 p2i(obj), _phase, _info);
2018 }
2019 };
2020
2021 void G1ConcurrentMark::verify_no_cset_oops() {
2022 assert(SafepointSynchronize::is_at_safepoint(), "should be at a safepoint");
2023 if (!G1CollectedHeap::heap()->collector_state()->mark_in_progress()) {
2024 return;
2025 }
2026
2027 // Verify entries on the global mark stack
2028 _global_mark_stack.iterate(VerifyNoCSetOops("Stack"));
2029
2030 // Verify entries on the task queues
2031 for (uint i = 0; i < _max_worker_id; ++i) {
2032 G1CMTaskQueue* queue = _task_queues->queue(i);
2033 queue->iterate(VerifyNoCSetOops("Queue", i));
2034 }
2035
|