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

Wed, 23 Jan 2013 13:02:39 -0500

author
jprovino
date
Wed, 23 Jan 2013 13:02:39 -0500
changeset 4542
db9981fd3124
parent 4142
d8ce2825b193
child 6169
ad72068ac41e
permissions
-rw-r--r--

8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
Summary: Rename INCLUDE_ALTERNATE_GCS to INCLUDE_ALL_GCS and replace SERIALGC with INCLUDE_ALL_GCS.
Reviewed-by: coleenp, stefank

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

mercurial