src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp

Tue, 24 Jun 2014 16:20:15 +0200

author
stefank
date
Tue, 24 Jun 2014 16:20:15 +0200
changeset 6982
4c1b88a53c74
parent 4037
da91efe96a93
child 7535
7ae4e26cb1e0
permissions
-rw-r--r--

8046670: Make CMS metadata aware closures applicable for other collectors
Reviewed-by: ehelin, mgerdin

duke@435 1 /*
coleenp@4037 2 * Copyright (c) 2007, 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 #ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_INLINE_HPP
stefank@2314 26 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_INLINE_HPP
stefank@2314 27
stefank@2314 28 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp"
stefank@2314 29 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp"
coleenp@4037 30 #include "oops/oop.inline.hpp"
stefank@2314 31
duke@435 32 // Trim our work_queue so its length is below max at return
duke@435 33 inline void Par_MarkRefsIntoAndScanClosure::trim_queue(uint max) {
duke@435 34 while (_work_queue->size() > max) {
duke@435 35 oop newOop;
duke@435 36 if (_work_queue->pop_local(newOop)) {
duke@435 37 assert(newOop->is_oop(), "Expected an oop");
duke@435 38 assert(_bit_map->isMarked((HeapWord*)newOop),
duke@435 39 "only grey objects on this stack");
duke@435 40 // iterate over the oops in this oop, marking and pushing
duke@435 41 // the ones in CMS heap (i.e. in _span).
duke@435 42 newOop->oop_iterate(&_par_pushAndMarkClosure);
duke@435 43 }
duke@435 44 }
duke@435 45 }
duke@435 46
stefank@6982 47 // MetadataAwareOopClosure and MetadataAwareOopsInGenClosure are duplicated,
coleenp@4037 48 // until we get rid of OopsInGenClosure.
coleenp@4037 49
stefank@6982 50 inline void MetadataAwareOopsInGenClosure::do_klass_nv(Klass* k) {
coleenp@4037 51 ClassLoaderData* cld = k->class_loader_data();
coleenp@4037 52 do_class_loader_data(cld);
jmasa@1370 53 }
stefank@6982 54 inline void MetadataAwareOopsInGenClosure::do_klass(Klass* k) { do_klass_nv(k); }
duke@435 55
stefank@6982 56 inline void MetadataAwareOopsInGenClosure::do_class_loader_data(ClassLoaderData* cld) {
coleenp@4037 57 assert(_klass_closure._oop_closure == this, "Must be");
coleenp@4037 58
coleenp@4037 59 bool claim = true; // Must claim the class loader data before processing.
coleenp@4037 60 cld->oops_do(_klass_closure._oop_closure, &_klass_closure, claim);
ysr@1376 61 }
ysr@1376 62
stefank@2314 63 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_INLINE_HPP

mercurial