src/share/vm/memory/genRemSet.cpp

Tue, 16 Feb 2016 21:42:29 +0000

author
poonam
date
Tue, 16 Feb 2016 21:42:29 +0000
changeset 8308
6acf14e730dd
parent 6198
55fb97c4c58d
child 6876
710a3c8b516e
permissions
-rw-r--r--

8072725: Provide more granular levels for GC verification
Summary: Add option VerifySubSet to selectively verify the memory sub-systems
Reviewed-by: kevinw, jmasa

duke@435 1 /*
mikael@6198 2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
coleenp@4037 26 #include "classfile/classLoaderData.hpp"
stefank@2314 27 #include "memory/cardTableRS.hpp"
stefank@2314 28 #include "memory/genRemSet.hpp"
stefank@2314 29
duke@435 30 // This kind of "BarrierSet" allows a "CollectedHeap" to detect and
duke@435 31 // enumerate ref fields that have been modified (since the last
duke@435 32 // enumeration.)
duke@435 33
duke@435 34 uintx GenRemSet::max_alignment_constraint(Name nm) {
jwilhelm@5818 35 assert(nm == GenRemSet::CardTable, "Unrecognized GenRemSet type.");
jwilhelm@5818 36 return CardTableRS::ct_max_alignment_constraint();
duke@435 37 }
coleenp@4037 38
coleenp@4037 39 class HasAccumulatedModifiedOopsClosure : public KlassClosure {
coleenp@4037 40 bool _found;
coleenp@4037 41 public:
coleenp@4037 42 HasAccumulatedModifiedOopsClosure() : _found(false) {}
coleenp@4037 43 void do_klass(Klass* klass) {
coleenp@4037 44 if (_found) {
coleenp@4037 45 return;
coleenp@4037 46 }
coleenp@4037 47
coleenp@4037 48 if (klass->has_accumulated_modified_oops()) {
coleenp@4037 49 _found = true;
coleenp@4037 50 }
coleenp@4037 51 }
coleenp@4037 52 bool found() {
coleenp@4037 53 return _found;
coleenp@4037 54 }
coleenp@4037 55 };
coleenp@4037 56
coleenp@4037 57 bool KlassRemSet::mod_union_is_clear() {
coleenp@4037 58 HasAccumulatedModifiedOopsClosure closure;
coleenp@4037 59 ClassLoaderDataGraph::classes_do(&closure);
coleenp@4037 60
coleenp@4037 61 return !closure.found();
coleenp@4037 62 }
coleenp@4037 63
coleenp@4037 64
coleenp@4037 65 class ClearKlassModUnionClosure : public KlassClosure {
coleenp@4037 66 public:
coleenp@4037 67 void do_klass(Klass* klass) {
coleenp@4037 68 if (klass->has_accumulated_modified_oops()) {
coleenp@4037 69 klass->clear_accumulated_modified_oops();
coleenp@4037 70 }
coleenp@4037 71 }
coleenp@4037 72 };
coleenp@4037 73
coleenp@4037 74 void KlassRemSet::clear_mod_union() {
coleenp@4037 75 ClearKlassModUnionClosure closure;
coleenp@4037 76 ClassLoaderDataGraph::classes_do(&closure);
coleenp@4037 77 }

mercurial