annotate src/hotspot/share/gc/g1/g1CodeBlobClosure.cpp @ 49273:216c2aabbf1f

8196602: Change HeapRegionClosure to comply to naming conventions Reviewed-by: kbarrett, sjohanss
author tschatzl
date Fri, 09 Feb 2018 11:51:40 +0100
parents a001553763bc
children 77fb0be7d19f
rev   line source
mgerdin@32617 1 /*
tschatzl@46282 2 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
mgerdin@32617 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mgerdin@32617 4 *
mgerdin@32617 5 * This code is free software; you can redistribute it and/or modify it
mgerdin@32617 6 * under the terms of the GNU General Public License version 2 only, as
mgerdin@32617 7 * published by the Free Software Foundation.
mgerdin@32617 8 *
mgerdin@32617 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mgerdin@32617 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mgerdin@32617 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mgerdin@32617 12 * version 2 for more details (a copy is included in the LICENSE file that
mgerdin@32617 13 * accompanied this code).
mgerdin@32617 14 *
mgerdin@32617 15 * You should have received a copy of the GNU General Public License version
mgerdin@32617 16 * 2 along with this work; if not, write to the Free Software Foundation,
mgerdin@32617 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mgerdin@32617 18 *
mgerdin@32617 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
mgerdin@32617 20 * or visit www.oracle.com if you need additional information or have any
mgerdin@32617 21 * questions.
mgerdin@32617 22 *
mgerdin@32617 23 */
mgerdin@32617 24
mgerdin@32617 25 #include "precompiled.hpp"
mgerdin@32617 26 #include "code/nmethod.hpp"
mgerdin@32617 27 #include "gc/g1/g1CodeBlobClosure.hpp"
mgerdin@32617 28 #include "gc/g1/g1CollectedHeap.inline.hpp"
mgerdin@32617 29 #include "gc/g1/heapRegion.hpp"
mgerdin@32617 30 #include "gc/g1/heapRegionRemSet.hpp"
mgerdin@32617 31 #include "oops/oop.inline.hpp"
mgerdin@32617 32
mgerdin@32617 33 template <typename T>
mgerdin@32617 34 void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop_work(T* p) {
mgerdin@32617 35 _work->do_oop(p);
mgerdin@32617 36 T oop_or_narrowoop = oopDesc::load_heap_oop(p);
mgerdin@32617 37 if (!oopDesc::is_null(oop_or_narrowoop)) {
mgerdin@32617 38 oop o = oopDesc::decode_heap_oop_not_null(oop_or_narrowoop);
david@33786 39 HeapRegion* hr = _g1h->heap_region_containing(o);
tschatzl@46282 40 assert(!_g1h->is_in_cset(o) || hr->rem_set()->strong_code_roots_list_contains(_nm), "if o still in collection set then evacuation failed and nm must already be in the remset");
mgerdin@32617 41 hr->add_strong_code_root(_nm);
mgerdin@32617 42 }
mgerdin@32617 43 }
mgerdin@32617 44
mgerdin@32617 45 void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop(oop* o) {
mgerdin@32617 46 do_oop_work(o);
mgerdin@32617 47 }
mgerdin@32617 48
mgerdin@32617 49 void G1CodeBlobClosure::HeapRegionGatheringOopClosure::do_oop(narrowOop* o) {
mgerdin@32617 50 do_oop_work(o);
mgerdin@32617 51 }
mgerdin@32617 52
mgerdin@32617 53 void G1CodeBlobClosure::do_code_blob(CodeBlob* cb) {
mgerdin@32617 54 nmethod* nm = cb->as_nmethod_or_null();
mgerdin@32617 55 if (nm != NULL) {
mgerdin@32617 56 if (!nm->test_set_oops_do_mark()) {
mgerdin@32617 57 _oc.set_nm(nm);
mgerdin@32617 58 nm->oops_do(&_oc);
mgerdin@32617 59 nm->fix_oop_relocations();
mgerdin@32617 60 }
mgerdin@32617 61 }
mgerdin@32617 62 }
mgerdin@32617 63