Sat, 23 Nov 2013 12:25:13 +0100
8028128: Add a type safe alternative for working with counter based data
Reviewed-by: dholmes, egahlin
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 | |
coleenp@4037 | 47 | // CMSOopClosure and CMSoopsInGenClosure are duplicated, |
coleenp@4037 | 48 | // until we get rid of OopsInGenClosure. |
coleenp@4037 | 49 | |
coleenp@4037 | 50 | inline void CMSOopClosure::do_klass(Klass* k) { do_klass_nv(k); } |
coleenp@4037 | 51 | inline void CMSOopsInGenClosure::do_klass(Klass* k) { do_klass_nv(k); } |
coleenp@4037 | 52 | |
coleenp@4037 | 53 | inline void CMSOopClosure::do_klass_nv(Klass* k) { |
coleenp@4037 | 54 | ClassLoaderData* cld = k->class_loader_data(); |
coleenp@4037 | 55 | do_class_loader_data(cld); |
jmasa@1370 | 56 | } |
coleenp@4037 | 57 | inline void CMSOopsInGenClosure::do_klass_nv(Klass* k) { |
coleenp@4037 | 58 | ClassLoaderData* cld = k->class_loader_data(); |
coleenp@4037 | 59 | do_class_loader_data(cld); |
duke@435 | 60 | } |
duke@435 | 61 | |
coleenp@4037 | 62 | inline void CMSOopClosure::do_class_loader_data(ClassLoaderData* cld) { |
coleenp@4037 | 63 | assert(_klass_closure._oop_closure == this, "Must be"); |
coleenp@4037 | 64 | |
coleenp@4037 | 65 | bool claim = true; // Must claim the class loader data before processing. |
coleenp@4037 | 66 | cld->oops_do(_klass_closure._oop_closure, &_klass_closure, claim); |
coleenp@4037 | 67 | } |
coleenp@4037 | 68 | inline void CMSOopsInGenClosure::do_class_loader_data(ClassLoaderData* cld) { |
coleenp@4037 | 69 | assert(_klass_closure._oop_closure == this, "Must be"); |
coleenp@4037 | 70 | |
coleenp@4037 | 71 | bool claim = true; // Must claim the class loader data before processing. |
coleenp@4037 | 72 | cld->oops_do(_klass_closure._oop_closure, &_klass_closure, claim); |
ysr@1376 | 73 | } |
ysr@1376 | 74 | |
ysr@1376 | 75 | |
stefank@2314 | 76 | #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_INLINE_HPP |