src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp

Tue, 17 Oct 2017 12:58:25 +0800

author
aoqi
date
Tue, 17 Oct 2017 12:58:25 +0800
changeset 7994
04ff2f6cd0eb
parent 7535
7ae4e26cb1e0
permissions
-rw-r--r--

merge

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1REMSET_INLINE_HPP
aoqi@0 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1REMSET_INLINE_HPP
aoqi@0 27
aoqi@0 28 #include "gc_implementation/g1/g1RemSet.hpp"
tschatzl@6937 29 #include "gc_implementation/g1/heapRegion.hpp"
aoqi@0 30 #include "gc_implementation/g1/heapRegionRemSet.hpp"
aoqi@0 31 #include "oops/oop.inline.hpp"
aoqi@0 32
aoqi@0 33 inline uint G1RemSet::n_workers() {
aoqi@0 34 if (_g1->workers() != NULL) {
aoqi@0 35 return _g1->workers()->total_workers();
aoqi@0 36 } else {
aoqi@0 37 return 1;
aoqi@0 38 }
aoqi@0 39 }
aoqi@0 40
aoqi@0 41 template <class T>
aoqi@0 42 inline void G1RemSet::write_ref(HeapRegion* from, T* p) {
aoqi@0 43 par_write_ref(from, p, 0);
aoqi@0 44 }
aoqi@0 45
aoqi@0 46 template <class T>
aoqi@0 47 inline void G1RemSet::par_write_ref(HeapRegion* from, T* p, int tid) {
aoqi@0 48 oop obj = oopDesc::load_decode_heap_oop(p);
brutisso@7049 49 if (obj == NULL) {
brutisso@7049 50 return;
brutisso@7049 51 }
brutisso@7049 52
aoqi@0 53 #ifdef ASSERT
aoqi@0 54 // can't do because of races
aoqi@0 55 // assert(obj == NULL || obj->is_oop(), "expected an oop");
aoqi@0 56
aoqi@0 57 // Do the safe subset of is_oop
aoqi@0 58 #ifdef CHECK_UNHANDLED_OOPS
brutisso@7049 59 oopDesc* o = obj.obj();
aoqi@0 60 #else
brutisso@7049 61 oopDesc* o = obj;
aoqi@0 62 #endif // CHECK_UNHANDLED_OOPS
brutisso@7049 63 assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned");
brutisso@7049 64 assert(Universe::heap()->is_in_reserved(obj), "must be in heap");
aoqi@0 65 #endif // ASSERT
aoqi@0 66
aoqi@0 67 assert(from == NULL || from->is_in_reserved(p), "p is not in from");
aoqi@0 68
aoqi@0 69 HeapRegion* to = _g1->heap_region_containing(obj);
brutisso@7049 70 if (from != to) {
aoqi@0 71 assert(to->rem_set() != NULL, "Need per-region 'into' remsets.");
aoqi@0 72 to->rem_set()->add_reference(p, tid);
aoqi@0 73 }
aoqi@0 74 }
aoqi@0 75
aoqi@0 76 template <class T>
aoqi@0 77 inline void UpdateRSOopClosure::do_oop_work(T* p) {
aoqi@0 78 assert(_from != NULL, "from region must be non-NULL");
aoqi@0 79 _rs->par_write_ref(_from, p, _worker_i);
aoqi@0 80 }
aoqi@0 81
aoqi@0 82 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1REMSET_INLINE_HPP

mercurial