src/share/vm/memory/genRemSet.cpp

Sat, 01 Sep 2012 13:25:18 -0400

author
coleenp
date
Sat, 01 Sep 2012 13:25:18 -0400
changeset 4037
da91efe96a93
parent 2314
f95d63e2154a
child 5818
ab68fc0101ce
permissions
-rw-r--r--

6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>

duke@435 1 /*
coleenp@4037 2 * Copyright (c) 2001, 2012, 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) {
duke@435 35 switch (nm) {
duke@435 36 case GenRemSet::CardTable:
duke@435 37 return CardTableRS::ct_max_alignment_constraint();
duke@435 38 default:
duke@435 39 guarantee(false, "Unrecognized GenRemSet type.");
duke@435 40 return (0); // Make Windows compiler happy
duke@435 41 }
duke@435 42 }
coleenp@4037 43
coleenp@4037 44 class HasAccumulatedModifiedOopsClosure : public KlassClosure {
coleenp@4037 45 bool _found;
coleenp@4037 46 public:
coleenp@4037 47 HasAccumulatedModifiedOopsClosure() : _found(false) {}
coleenp@4037 48 void do_klass(Klass* klass) {
coleenp@4037 49 if (_found) {
coleenp@4037 50 return;
coleenp@4037 51 }
coleenp@4037 52
coleenp@4037 53 if (klass->has_accumulated_modified_oops()) {
coleenp@4037 54 _found = true;
coleenp@4037 55 }
coleenp@4037 56 }
coleenp@4037 57 bool found() {
coleenp@4037 58 return _found;
coleenp@4037 59 }
coleenp@4037 60 };
coleenp@4037 61
coleenp@4037 62 bool KlassRemSet::mod_union_is_clear() {
coleenp@4037 63 HasAccumulatedModifiedOopsClosure closure;
coleenp@4037 64 ClassLoaderDataGraph::classes_do(&closure);
coleenp@4037 65
coleenp@4037 66 return !closure.found();
coleenp@4037 67 }
coleenp@4037 68
coleenp@4037 69
coleenp@4037 70 class ClearKlassModUnionClosure : public KlassClosure {
coleenp@4037 71 public:
coleenp@4037 72 void do_klass(Klass* klass) {
coleenp@4037 73 if (klass->has_accumulated_modified_oops()) {
coleenp@4037 74 klass->clear_accumulated_modified_oops();
coleenp@4037 75 }
coleenp@4037 76 }
coleenp@4037 77 };
coleenp@4037 78
coleenp@4037 79 void KlassRemSet::clear_mod_union() {
coleenp@4037 80 ClearKlassModUnionClosure closure;
coleenp@4037 81 ClassLoaderDataGraph::classes_do(&closure);
coleenp@4037 82 }

mercurial