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

Wed, 25 Jan 2012 17:40:51 -0500

author
jiangli
date
Wed, 25 Jan 2012 17:40:51 -0500
changeset 3526
a79cb7c55012
parent 2314
f95d63e2154a
child 4037
da91efe96a93
permissions
-rw-r--r--

7132690: InstanceKlass:_reference_type should be u1 type
Summary: Change InstanceKlass::_reference_type to u1 type.
Reviewed-by: dholmes, coleenp, acorn
Contributed-by: Jiangli Zhou <jiangli.zhou@oracle.com>

jcoomes@1746 1 /*
trims@1907 2 * Copyright (c) 2010, 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
stefank@2314 28 #include "oops/objArrayKlass.hpp"
stefank@2314 29 #ifndef SERIALGC
stefank@2314 30 #include "gc_implementation/parallelScavenge/psCompactionManager.inline.hpp"
stefank@2314 31 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
stefank@2314 32 #endif
stefank@2314 33
jcoomes@1746 34 void objArrayKlass::oop_follow_contents(oop obj, int index) {
jcoomes@1746 35 if (UseCompressedOops) {
jcoomes@1746 36 objarray_follow_contents<narrowOop>(obj, index);
jcoomes@1746 37 } else {
jcoomes@1746 38 objarray_follow_contents<oop>(obj, index);
jcoomes@1746 39 }
jcoomes@1746 40 }
jcoomes@1746 41
jcoomes@1746 42 template <class T>
jcoomes@1746 43 void objArrayKlass::objarray_follow_contents(oop obj, int index) {
jcoomes@1746 44 objArrayOop a = objArrayOop(obj);
jcoomes@1746 45 const size_t len = size_t(a->length());
jcoomes@1746 46 const size_t beg_index = size_t(index);
jcoomes@1746 47 assert(beg_index < len || len == 0, "index too large");
jcoomes@1746 48
jcoomes@1746 49 const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
jcoomes@1746 50 const size_t end_index = beg_index + stride;
jcoomes@1746 51 T* const base = (T*)a->base();
jcoomes@1746 52 T* const beg = base + beg_index;
jcoomes@1746 53 T* const end = base + end_index;
jcoomes@1746 54
jcoomes@1746 55 // Push the non-NULL elements of the next stride on the marking stack.
jcoomes@1746 56 for (T* e = beg; e < end; e++) {
jcoomes@1746 57 MarkSweep::mark_and_push<T>(e);
jcoomes@1746 58 }
jcoomes@1746 59
jcoomes@1746 60 if (end_index < len) {
jcoomes@1746 61 MarkSweep::push_objarray(a, end_index); // Push the continuation.
jcoomes@1746 62 }
jcoomes@1746 63 }
jcoomes@1746 64
jcoomes@1746 65 #ifndef SERIALGC
jcoomes@1746 66 void objArrayKlass::oop_follow_contents(ParCompactionManager* cm, oop obj,
jcoomes@1746 67 int index) {
jcoomes@1746 68 if (UseCompressedOops) {
jcoomes@1746 69 objarray_follow_contents<narrowOop>(cm, obj, index);
jcoomes@1746 70 } else {
jcoomes@1746 71 objarray_follow_contents<oop>(cm, obj, index);
jcoomes@1746 72 }
jcoomes@1746 73 }
jcoomes@1746 74
jcoomes@1746 75 template <class T>
jcoomes@1746 76 void objArrayKlass::objarray_follow_contents(ParCompactionManager* cm, oop obj,
jcoomes@1746 77 int index) {
jcoomes@1746 78 objArrayOop a = objArrayOop(obj);
jcoomes@1746 79 const size_t len = size_t(a->length());
jcoomes@1746 80 const size_t beg_index = size_t(index);
jcoomes@1746 81 assert(beg_index < len || len == 0, "index too large");
jcoomes@1746 82
jcoomes@1746 83 const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
jcoomes@1746 84 const size_t end_index = beg_index + stride;
jcoomes@1746 85 T* const base = (T*)a->base();
jcoomes@1746 86 T* const beg = base + beg_index;
jcoomes@1746 87 T* const end = base + end_index;
jcoomes@1746 88
jcoomes@1746 89 // Push the non-NULL elements of the next stride on the marking stack.
jcoomes@1746 90 for (T* e = beg; e < end; e++) {
jcoomes@1746 91 PSParallelCompact::mark_and_push<T>(cm, e);
jcoomes@1746 92 }
jcoomes@1746 93
jcoomes@1746 94 if (end_index < len) {
jcoomes@1746 95 cm->push_objarray(a, end_index); // Push the continuation.
jcoomes@1746 96 }
jcoomes@1746 97 }
jcoomes@1746 98 #endif // #ifndef SERIALGC
stefank@2314 99
stefank@2314 100 #endif // SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP

mercurial