src/share/vm/oops/objArrayKlass.inline.hpp

Wed, 02 Jan 2013 20:28:09 -0500

author
coleenp
date
Wed, 02 Jan 2013 20:28:09 -0500
changeset 4395
cc6a617fffd2
parent 4142
d8ce2825b193
child 4542
db9981fd3124
permissions
-rw-r--r--

8005494: SIGSEGV in Rewriter::relocate_and_link() when testing Weblogic with CompressedOops and KlassPtrs
Summary: Relocate functions with jsr's when rewriting so not repeated after reading shared archive
Reviewed-by: twisti, jrose

jcoomes@1746 1 /*
coleenp@4037 2 * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
jcoomes@1746 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jcoomes@1746 4 *
jcoomes@1746 5 * This code is free software; you can redistribute it and/or modify it
jcoomes@1746 6 * under the terms of the GNU General Public License version 2 only, as
jcoomes@1746 7 * published by the Free Software Foundation.
jcoomes@1746 8 *
jcoomes@1746 9 * This code is distributed in the hope that it will be useful, but WITHOUT
jcoomes@1746 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jcoomes@1746 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jcoomes@1746 12 * version 2 for more details (a copy is included in the LICENSE file that
jcoomes@1746 13 * accompanied this code).
jcoomes@1746 14 *
jcoomes@1746 15 * You should have received a copy of the GNU General Public License version
jcoomes@1746 16 * 2 along with this work; if not, write to the Free Software Foundation,
jcoomes@1746 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jcoomes@1746 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.
jcoomes@1746 22 *
jcoomes@1746 23 */
jcoomes@1746 24
stefank@2314 25 #ifndef SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP
stefank@2314 26 #define SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP
stefank@2314 27
coleenp@4037 28 #include "gc_implementation/shared/markSweep.inline.hpp"
stefank@2314 29 #include "oops/objArrayKlass.hpp"
stefank@2314 30 #ifndef SERIALGC
stefank@2314 31 #include "gc_implementation/parallelScavenge/psCompactionManager.inline.hpp"
stefank@2314 32 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
stefank@2314 33 #endif
stefank@2314 34
coleenp@4142 35 void ObjArrayKlass::oop_follow_contents(oop obj, int index) {
jcoomes@1746 36 if (UseCompressedOops) {
jcoomes@1746 37 objarray_follow_contents<narrowOop>(obj, index);
jcoomes@1746 38 } else {
jcoomes@1746 39 objarray_follow_contents<oop>(obj, index);
jcoomes@1746 40 }
jcoomes@1746 41 }
jcoomes@1746 42
jcoomes@1746 43 template <class T>
coleenp@4142 44 void ObjArrayKlass::objarray_follow_contents(oop obj, int index) {
jcoomes@1746 45 objArrayOop a = objArrayOop(obj);
jcoomes@1746 46 const size_t len = size_t(a->length());
jcoomes@1746 47 const size_t beg_index = size_t(index);
jcoomes@1746 48 assert(beg_index < len || len == 0, "index too large");
jcoomes@1746 49
jcoomes@1746 50 const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
jcoomes@1746 51 const size_t end_index = beg_index + stride;
jcoomes@1746 52 T* const base = (T*)a->base();
jcoomes@1746 53 T* const beg = base + beg_index;
jcoomes@1746 54 T* const end = base + end_index;
jcoomes@1746 55
jcoomes@1746 56 // Push the non-NULL elements of the next stride on the marking stack.
jcoomes@1746 57 for (T* e = beg; e < end; e++) {
jcoomes@1746 58 MarkSweep::mark_and_push<T>(e);
jcoomes@1746 59 }
jcoomes@1746 60
jcoomes@1746 61 if (end_index < len) {
jcoomes@1746 62 MarkSweep::push_objarray(a, end_index); // Push the continuation.
jcoomes@1746 63 }
jcoomes@1746 64 }
jcoomes@1746 65
jcoomes@1746 66 #ifndef SERIALGC
coleenp@4142 67 void ObjArrayKlass::oop_follow_contents(ParCompactionManager* cm, oop obj,
jcoomes@1746 68 int index) {
jcoomes@1746 69 if (UseCompressedOops) {
jcoomes@1746 70 objarray_follow_contents<narrowOop>(cm, obj, index);
jcoomes@1746 71 } else {
jcoomes@1746 72 objarray_follow_contents<oop>(cm, obj, index);
jcoomes@1746 73 }
jcoomes@1746 74 }
jcoomes@1746 75
jcoomes@1746 76 template <class T>
coleenp@4142 77 void ObjArrayKlass::objarray_follow_contents(ParCompactionManager* cm, oop obj,
jcoomes@1746 78 int index) {
jcoomes@1746 79 objArrayOop a = objArrayOop(obj);
jcoomes@1746 80 const size_t len = size_t(a->length());
jcoomes@1746 81 const size_t beg_index = size_t(index);
jcoomes@1746 82 assert(beg_index < len || len == 0, "index too large");
jcoomes@1746 83
jcoomes@1746 84 const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
jcoomes@1746 85 const size_t end_index = beg_index + stride;
jcoomes@1746 86 T* const base = (T*)a->base();
jcoomes@1746 87 T* const beg = base + beg_index;
jcoomes@1746 88 T* const end = base + end_index;
jcoomes@1746 89
jcoomes@1746 90 // Push the non-NULL elements of the next stride on the marking stack.
jcoomes@1746 91 for (T* e = beg; e < end; e++) {
jcoomes@1746 92 PSParallelCompact::mark_and_push<T>(cm, e);
jcoomes@1746 93 }
jcoomes@1746 94
jcoomes@1746 95 if (end_index < len) {
jcoomes@1746 96 cm->push_objarray(a, end_index); // Push the continuation.
jcoomes@1746 97 }
jcoomes@1746 98 }
jcoomes@1746 99 #endif // #ifndef SERIALGC
stefank@2314 100
stefank@2314 101 #endif // SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP

mercurial