Wed, 03 Sep 2014 09:25:44 +0200
Merge
duke@435 | 1 | /* |
mikael@6198 | 2 | * Copyright (c) 2005, 2013, 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 | inline oop oopDesc::forward_to_atomic(oop p) { |
duke@435 | 58 | assert(ParNewGeneration::is_legal_forward_ptr(p), |
duke@435 | 59 | "illegal forwarding pointer value."); |
duke@435 | 60 | markOop oldMark = mark(); |
duke@435 | 61 | markOop forwardPtrMark = markOopDesc::encode_pointer_as_mark(p); |
duke@435 | 62 | markOop curMark; |
duke@435 | 63 | |
duke@435 | 64 | assert(forwardPtrMark->decode_pointer() == p, "encoding must be reversable"); |
duke@435 | 65 | assert(sizeof(markOop) == sizeof(intptr_t), "CAS below requires this."); |
duke@435 | 66 | |
johnc@2334 | 67 | while (!oldMark->is_marked()) { |
duke@435 | 68 | curMark = (markOop)Atomic::cmpxchg_ptr(forwardPtrMark, &_mark, oldMark); |
johnc@2334 | 69 | assert(is_forwarded(), "object should have been forwarded"); |
duke@435 | 70 | if (curMark == oldMark) { |
duke@435 | 71 | return NULL; |
duke@435 | 72 | } |
johnc@2334 | 73 | // If the CAS was unsuccessful then curMark->is_marked() |
johnc@2334 | 74 | // should return true as another thread has CAS'd in another |
johnc@2334 | 75 | // forwarding pointer. |
duke@435 | 76 | oldMark = curMark; |
duke@435 | 77 | } |
duke@435 | 78 | return forwardee(); |
duke@435 | 79 | } |
duke@435 | 80 | |
stefank@2314 | 81 | #endif // SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP |