src/share/vm/oops/oop.pcgc.inline.hpp

Mon, 09 Mar 2009 13:28:46 -0700

author
xdono
date
Mon, 09 Mar 2009 13:28:46 -0700
changeset 1014
0fbdb4381b99
parent 631
d1605aabd0a1
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6814575: Update copyright year
Summary: Update copyright for files that have been modified in 2009, up to 03/09
Reviewed-by: katleman, tbell, ohair

duke@435 1 /*
xdono@631 2 * Copyright 2005-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
duke@435 25 inline void oopDesc::update_contents(ParCompactionManager* cm) {
duke@435 26 // The klass field must be updated before anything else
duke@435 27 // can be done.
duke@435 28 DEBUG_ONLY(klassOopDesc* original_klass = klass());
duke@435 29
duke@435 30 // Can the option to update and/or copy be moved up in the
duke@435 31 // call chain to avoid calling into here?
duke@435 32
duke@435 33 if (PSParallelCompact::should_update_klass(klass())) {
duke@435 34 update_header();
duke@435 35 assert(klass()->is_klass(), "Not updated correctly");
duke@435 36 } else {
duke@435 37 assert(klass()->is_klass(), "Not updated");
duke@435 38 }
duke@435 39
duke@435 40 Klass* new_klass = blueprint();
duke@435 41 if (!new_klass->oop_is_typeArray()) {
duke@435 42 // It might contain oops beyond the header, so take the virtual call.
duke@435 43 new_klass->oop_update_pointers(cm, this);
duke@435 44 }
duke@435 45 // Else skip it. The typeArrayKlass in the header never needs scavenging.
duke@435 46 }
duke@435 47
duke@435 48 inline void oopDesc::update_contents(ParCompactionManager* cm,
duke@435 49 HeapWord* begin_limit,
duke@435 50 HeapWord* end_limit) {
duke@435 51 // The klass field must be updated before anything else
duke@435 52 // can be done.
duke@435 53 debug_only(klassOopDesc* original_klass = klass());
duke@435 54
duke@435 55 update_contents(cm, klass(), begin_limit, end_limit);
duke@435 56 }
duke@435 57
duke@435 58 inline void oopDesc::update_contents(ParCompactionManager* cm,
duke@435 59 klassOop old_klass,
duke@435 60 HeapWord* begin_limit,
duke@435 61 HeapWord* end_limit) {
duke@435 62
duke@435 63 klassOop updated_klass =
duke@435 64 PSParallelCompact::summary_data().calc_new_klass(old_klass);
duke@435 65
duke@435 66 // Needs to be boundary aware for the 64 bit case
duke@435 67 // update_header();
duke@435 68 // The klass has moved. Is the location of the klass
duke@435 69 // within the limits?
coleenp@548 70 if ((((HeapWord*)&_metadata._klass) >= begin_limit) &&
coleenp@548 71 (((HeapWord*)&_metadata._klass) < end_limit)) {
duke@435 72 set_klass(updated_klass);
duke@435 73 }
duke@435 74
duke@435 75 Klass* klass = updated_klass->klass_part();
duke@435 76 if (!klass->oop_is_typeArray()) {
duke@435 77 // It might contain oops beyond the header, so take the virtual call.
duke@435 78 klass->oop_update_pointers(cm, this, begin_limit, end_limit);
duke@435 79 }
duke@435 80 // Else skip it. The typeArrayKlass in the header never needs scavenging.
duke@435 81 }
duke@435 82
duke@435 83 inline void oopDesc::follow_contents(ParCompactionManager* cm) {
duke@435 84 assert (PSParallelCompact::mark_bitmap()->is_marked(this),
duke@435 85 "should be marked");
duke@435 86 blueprint()->oop_follow_contents(cm, this);
duke@435 87 }
duke@435 88
duke@435 89 // Used by parallel old GC.
duke@435 90
duke@435 91 inline void oopDesc::follow_header(ParCompactionManager* cm) {
coleenp@548 92 if (UseCompressedOops) {
coleenp@548 93 PSParallelCompact::mark_and_push(cm, compressed_klass_addr());
coleenp@548 94 } else {
coleenp@548 95 PSParallelCompact::mark_and_push(cm, klass_addr());
coleenp@548 96 }
duke@435 97 }
duke@435 98
duke@435 99 inline oop oopDesc::forward_to_atomic(oop p) {
duke@435 100 assert(ParNewGeneration::is_legal_forward_ptr(p),
duke@435 101 "illegal forwarding pointer value.");
duke@435 102 markOop oldMark = mark();
duke@435 103 markOop forwardPtrMark = markOopDesc::encode_pointer_as_mark(p);
duke@435 104 markOop curMark;
duke@435 105
duke@435 106 assert(forwardPtrMark->decode_pointer() == p, "encoding must be reversable");
duke@435 107 assert(sizeof(markOop) == sizeof(intptr_t), "CAS below requires this.");
duke@435 108
duke@435 109 while (!is_forwarded()) {
duke@435 110 curMark = (markOop)Atomic::cmpxchg_ptr(forwardPtrMark, &_mark, oldMark);
duke@435 111 if (curMark == oldMark) {
duke@435 112 assert(is_forwarded(), "the CAS should have succeeded.");
duke@435 113 return NULL;
duke@435 114 }
duke@435 115 oldMark = curMark;
duke@435 116 }
duke@435 117 return forwardee();
duke@435 118 }
duke@435 119
duke@435 120 inline void oopDesc::update_header() {
coleenp@548 121 if (UseCompressedOops) {
coleenp@548 122 PSParallelCompact::adjust_pointer(compressed_klass_addr());
coleenp@548 123 } else {
coleenp@548 124 PSParallelCompact::adjust_pointer(klass_addr());
coleenp@548 125 }
duke@435 126 }
duke@435 127
duke@435 128 inline void oopDesc::update_header(HeapWord* beg_addr, HeapWord* end_addr) {
coleenp@548 129 if (UseCompressedOops) {
coleenp@548 130 PSParallelCompact::adjust_pointer(compressed_klass_addr(),
coleenp@548 131 beg_addr, end_addr);
coleenp@548 132 } else {
coleenp@548 133 PSParallelCompact::adjust_pointer(klass_addr(), beg_addr, end_addr);
coleenp@548 134 }
duke@435 135 }

mercurial