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

Fri, 16 Nov 2012 09:19:12 -0500

author
coleenp
date
Fri, 16 Nov 2012 09:19:12 -0500
changeset 4280
80e866b1d053
parent 4142
d8ce2825b193
child 4542
db9981fd3124
permissions
-rw-r--r--

Merge

duke@435 1 /*
coleenp@4037 2 * Copyright (c) 2005, 2012, 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.
coleenp@4037 40 DEBUG_ONLY(Klass* original_klass = klass());
duke@435 41
coleenp@4037 42 Klass* new_klass = klass();
duke@435 43 if (!new_klass->oop_is_typeArray()) {
duke@435 44 // It might contain oops beyond the header, so take the virtual call.
duke@435 45 new_klass->oop_update_pointers(cm, this);
duke@435 46 }
coleenp@4142 47 // Else skip it. The TypeArrayKlass in the header never needs scavenging.
duke@435 48 }
duke@435 49
duke@435 50 inline void oopDesc::follow_contents(ParCompactionManager* cm) {
duke@435 51 assert (PSParallelCompact::mark_bitmap()->is_marked(this),
duke@435 52 "should be marked");
coleenp@4037 53 klass()->oop_follow_contents(cm, this);
duke@435 54 }
duke@435 55
duke@435 56 // Used by parallel old GC.
duke@435 57
duke@435 58 inline oop oopDesc::forward_to_atomic(oop p) {
duke@435 59 assert(ParNewGeneration::is_legal_forward_ptr(p),
duke@435 60 "illegal forwarding pointer value.");
duke@435 61 markOop oldMark = mark();
duke@435 62 markOop forwardPtrMark = markOopDesc::encode_pointer_as_mark(p);
duke@435 63 markOop curMark;
duke@435 64
duke@435 65 assert(forwardPtrMark->decode_pointer() == p, "encoding must be reversable");
duke@435 66 assert(sizeof(markOop) == sizeof(intptr_t), "CAS below requires this.");
duke@435 67
johnc@2334 68 while (!oldMark->is_marked()) {
duke@435 69 curMark = (markOop)Atomic::cmpxchg_ptr(forwardPtrMark, &_mark, oldMark);
johnc@2334 70 assert(is_forwarded(), "object should have been forwarded");
duke@435 71 if (curMark == oldMark) {
duke@435 72 return NULL;
duke@435 73 }
johnc@2334 74 // If the CAS was unsuccessful then curMark->is_marked()
johnc@2334 75 // should return true as another thread has CAS'd in another
johnc@2334 76 // forwarding pointer.
duke@435 77 oldMark = curMark;
duke@435 78 }
duke@435 79 return forwardee();
duke@435 80 }
duke@435 81
coleenp@4037 82 inline void oopDesc::update_header(ParCompactionManager* cm) {
coleenp@4037 83 PSParallelCompact::adjust_klass(cm, klass());
duke@435 84 }
duke@435 85
stefank@2314 86 #endif // SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP

mercurial