annotate src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp @ 844:bd02caa94611

6862919: Update copyright year Summary: Update copyright for files that have been modified in 2009, up to 07/09 Reviewed-by: tbell, ohair
author xdono
date Tue, 28 Jul 2009 12:12:40 -0700
parents 96b229c54d1e
children 18f526145aea
rev   line source
ysr@342 1 /*
xdono@844 2 * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
ysr@342 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ysr@342 4 *
ysr@342 5 * This code is free software; you can redistribute it and/or modify it
ysr@342 6 * under the terms of the GNU General Public License version 2 only, as
ysr@342 7 * published by the Free Software Foundation.
ysr@342 8 *
ysr@342 9 * This code is distributed in the hope that it will be useful, but WITHOUT
ysr@342 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ysr@342 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ysr@342 12 * version 2 for more details (a copy is included in the LICENSE file that
ysr@342 13 * accompanied this code).
ysr@342 14 *
ysr@342 15 * You should have received a copy of the GNU General Public License version
ysr@342 16 * 2 along with this work; if not, write to the Free Software Foundation,
ysr@342 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ysr@342 18 *
ysr@342 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
ysr@342 20 * CA 95054 USA or visit www.sun.com if you need additional information or
ysr@342 21 * have any questions.
ysr@342 22 *
ysr@342 23 */
ysr@342 24
ysr@342 25 inline size_t G1RemSet::n_workers() {
ysr@342 26 if (_g1->workers() != NULL) {
ysr@342 27 return _g1->workers()->total_workers();
ysr@342 28 } else {
ysr@342 29 return 1;
ysr@342 30 }
ysr@342 31 }
ysr@342 32
ysr@342 33 inline void HRInto_G1RemSet::write_ref_nv(HeapRegion* from, oop* p) {
iveresov@616 34 par_write_ref(from, p, 0);
ysr@342 35 }
ysr@342 36
ysr@342 37 inline void HRInto_G1RemSet::write_ref(HeapRegion* from, oop* p) {
ysr@342 38 write_ref_nv(from, p);
ysr@342 39 }
ysr@342 40
ysr@342 41 inline bool HRInto_G1RemSet::self_forwarded(oop obj) {
ysr@342 42 bool result = (obj->is_forwarded() && (obj->forwardee()== obj));
ysr@342 43 return result;
ysr@342 44 }
ysr@342 45
ysr@342 46 inline void HRInto_G1RemSet::par_write_ref(HeapRegion* from, oop* p, int tid) {
ysr@342 47 oop obj = *p;
ysr@342 48 #ifdef ASSERT
ysr@342 49 // can't do because of races
ysr@342 50 // assert(obj == NULL || obj->is_oop(), "expected an oop");
ysr@342 51
ysr@342 52 // Do the safe subset of is_oop
ysr@342 53 if (obj != NULL) {
ysr@342 54 #ifdef CHECK_UNHANDLED_OOPS
ysr@342 55 oopDesc* o = obj.obj();
ysr@342 56 #else
ysr@342 57 oopDesc* o = obj;
ysr@342 58 #endif // CHECK_UNHANDLED_OOPS
ysr@342 59 assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned");
ysr@342 60 assert(Universe::heap()->is_in_reserved(obj), "must be in heap");
ysr@342 61 }
ysr@342 62 #endif // ASSERT
ysr@342 63 assert(from == NULL || from->is_in_reserved(p),
ysr@342 64 "p is not in from");
ysr@342 65 HeapRegion* to = _g1->heap_region_containing(obj);
ysr@342 66 // The test below could be optimized by applying a bit op to to and from.
ysr@342 67 if (to != NULL && from != NULL && from != to) {
iveresov@616 68 // There is a tricky infinite loop if we keep pushing
iveresov@616 69 // self forwarding pointers onto our _new_refs list.
iveresov@616 70 // The _par_traversal_in_progress flag is true during the collection pause,
iveresov@616 71 // false during the evacuation failure handing.
iveresov@616 72 if (_par_traversal_in_progress &&
iveresov@616 73 to->in_collection_set() && !self_forwarded(obj)) {
iveresov@616 74 _new_refs[tid]->push(p);
iveresov@616 75 // Deferred updates to the Cset are either discarded (in the normal case),
iveresov@616 76 // or processed (if an evacuation failure occurs) at the end
iveresov@616 77 // of the collection.
iveresov@616 78 // See HRInto_G1RemSet::cleanup_after_oops_into_collection_set_do().
apetrusenko@677 79 } else {
ysr@342 80 #if G1_REM_SET_LOGGING
ysr@342 81 gclog_or_tty->print_cr("Adding " PTR_FORMAT " (" PTR_FORMAT ") to RS"
ysr@342 82 " for region [" PTR_FORMAT ", " PTR_FORMAT ")",
ysr@342 83 p, obj,
ysr@342 84 to->bottom(), to->end());
ysr@342 85 #endif
ysr@342 86 assert(to->rem_set() != NULL, "Need per-region 'into' remsets.");
apetrusenko@677 87 to->rem_set()->add_reference(p, tid);
ysr@342 88 }
ysr@342 89 }
ysr@342 90 }
apetrusenko@626 91
apetrusenko@626 92 inline void UpdateRSOopClosure::do_oop(narrowOop* p) {
apetrusenko@626 93 guarantee(false, "NYI");
apetrusenko@626 94 }
apetrusenko@626 95
apetrusenko@626 96 inline void UpdateRSOopClosure::do_oop(oop* p) {
apetrusenko@626 97 assert(_from != NULL, "from region must be non-NULL");
apetrusenko@626 98 _rs->par_write_ref(_from, p, _worker_i);
apetrusenko@626 99 }