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

Tue, 23 Nov 2010 13:22:55 -0800

author
stefank
date
Tue, 23 Nov 2010 13:22:55 -0800
changeset 2314
f95d63e2154a
parent 1907
c18cbe5936b8
child 2334
3cd116fd11be
permissions
-rw-r--r--

6989984: Use standard include model for Hospot
Summary: Replaced MakeDeps and the includeDB files with more standardized solutions.
Reviewed-by: coleenp, kvn, kamg

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

mercurial