src/share/vm/memory/defNewGeneration.inline.hpp

Sun, 11 Oct 2009 16:19:25 -0700

author
jcoomes
date
Sun, 11 Oct 2009 16:19:25 -0700
changeset 1844
cff162798819
parent 631
d1605aabd0a1
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6888953: some calls to function-like macros are missing semicolons
Reviewed-by: pbk, kvn

duke@435 1 /*
xdono@631 2 * Copyright 2001-2008 Sun Microsystems, Inc. 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 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
coleenp@548 25 // Methods of protected closure types
coleenp@548 26
coleenp@548 27 template <class T>
coleenp@548 28 inline void DefNewGeneration::KeepAliveClosure::do_oop_work(T* p) {
coleenp@548 29 #ifdef ASSERT
coleenp@548 30 {
coleenp@548 31 // We never expect to see a null reference being processed
coleenp@548 32 // as a weak reference.
coleenp@548 33 assert (!oopDesc::is_null(*p), "expected non-null ref");
coleenp@548 34 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
coleenp@548 35 assert (obj->is_oop(), "expected an oop while scanning weak refs");
coleenp@548 36 }
coleenp@548 37 #endif // ASSERT
coleenp@548 38
coleenp@548 39 _cl->do_oop_nv(p);
coleenp@548 40
coleenp@548 41 // Card marking is trickier for weak refs.
coleenp@548 42 // This oop is a 'next' field which was filled in while we
coleenp@548 43 // were discovering weak references. While we might not need
coleenp@548 44 // to take a special action to keep this reference alive, we
coleenp@548 45 // will need to dirty a card as the field was modified.
coleenp@548 46 //
coleenp@548 47 // Alternatively, we could create a method which iterates through
coleenp@548 48 // each generation, allowing them in turn to examine the modified
coleenp@548 49 // field.
coleenp@548 50 //
coleenp@548 51 // We could check that p is also in an older generation, but
coleenp@548 52 // dirty cards in the youngest gen are never scanned, so the
coleenp@548 53 // extra check probably isn't worthwhile.
coleenp@548 54 if (Universe::heap()->is_in_reserved(p)) {
coleenp@548 55 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
coleenp@548 56 _rs->inline_write_ref_field_gc(p, obj);
coleenp@548 57 }
duke@435 58 }
duke@435 59
coleenp@548 60 template <class T>
coleenp@548 61 inline void DefNewGeneration::FastKeepAliveClosure::do_oop_work(T* p) {
coleenp@548 62 #ifdef ASSERT
coleenp@548 63 {
coleenp@548 64 // We never expect to see a null reference being processed
coleenp@548 65 // as a weak reference.
coleenp@548 66 assert (!oopDesc::is_null(*p), "expected non-null ref");
coleenp@548 67 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
coleenp@548 68 assert (obj->is_oop(), "expected an oop while scanning weak refs");
duke@435 69 }
coleenp@548 70 #endif // ASSERT
duke@435 71
coleenp@548 72 _cl->do_oop_nv(p);
coleenp@548 73
coleenp@548 74 // Optimized for Defnew generation if it's the youngest generation:
coleenp@548 75 // we set a younger_gen card if we have an older->youngest
coleenp@548 76 // generation pointer.
coleenp@548 77 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
coleenp@548 78 if (((HeapWord*)obj < _boundary) && Universe::heap()->is_in_reserved(p)) {
coleenp@548 79 _rs->inline_write_ref_field_gc(p, obj);
duke@435 80 }
duke@435 81 }

mercurial