Sat, 30 Oct 2010 11:45:35 -0700
6981788: GC map generator sometimes picks up the wrong kind of instruction operand
Summary: Distinguish pool indexes from cache indexes in recently changed code.
Reviewed-by: never
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 | |
jcoomes@1746 | 25 | void objArrayKlass::oop_follow_contents(oop obj, int index) { |
jcoomes@1746 | 26 | if (UseCompressedOops) { |
jcoomes@1746 | 27 | objarray_follow_contents<narrowOop>(obj, index); |
jcoomes@1746 | 28 | } else { |
jcoomes@1746 | 29 | objarray_follow_contents<oop>(obj, index); |
jcoomes@1746 | 30 | } |
jcoomes@1746 | 31 | } |
jcoomes@1746 | 32 | |
jcoomes@1746 | 33 | template <class T> |
jcoomes@1746 | 34 | void objArrayKlass::objarray_follow_contents(oop obj, int index) { |
jcoomes@1746 | 35 | objArrayOop a = objArrayOop(obj); |
jcoomes@1746 | 36 | const size_t len = size_t(a->length()); |
jcoomes@1746 | 37 | const size_t beg_index = size_t(index); |
jcoomes@1746 | 38 | assert(beg_index < len || len == 0, "index too large"); |
jcoomes@1746 | 39 | |
jcoomes@1746 | 40 | const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride); |
jcoomes@1746 | 41 | const size_t end_index = beg_index + stride; |
jcoomes@1746 | 42 | T* const base = (T*)a->base(); |
jcoomes@1746 | 43 | T* const beg = base + beg_index; |
jcoomes@1746 | 44 | T* const end = base + end_index; |
jcoomes@1746 | 45 | |
jcoomes@1746 | 46 | // Push the non-NULL elements of the next stride on the marking stack. |
jcoomes@1746 | 47 | for (T* e = beg; e < end; e++) { |
jcoomes@1746 | 48 | MarkSweep::mark_and_push<T>(e); |
jcoomes@1746 | 49 | } |
jcoomes@1746 | 50 | |
jcoomes@1746 | 51 | if (end_index < len) { |
jcoomes@1746 | 52 | MarkSweep::push_objarray(a, end_index); // Push the continuation. |
jcoomes@1746 | 53 | } |
jcoomes@1746 | 54 | } |
jcoomes@1746 | 55 | |
jcoomes@1746 | 56 | #ifndef SERIALGC |
jcoomes@1746 | 57 | void objArrayKlass::oop_follow_contents(ParCompactionManager* cm, oop obj, |
jcoomes@1746 | 58 | int index) { |
jcoomes@1746 | 59 | if (UseCompressedOops) { |
jcoomes@1746 | 60 | objarray_follow_contents<narrowOop>(cm, obj, index); |
jcoomes@1746 | 61 | } else { |
jcoomes@1746 | 62 | objarray_follow_contents<oop>(cm, obj, index); |
jcoomes@1746 | 63 | } |
jcoomes@1746 | 64 | } |
jcoomes@1746 | 65 | |
jcoomes@1746 | 66 | template <class T> |
jcoomes@1746 | 67 | void objArrayKlass::objarray_follow_contents(ParCompactionManager* cm, oop obj, |
jcoomes@1746 | 68 | int index) { |
jcoomes@1746 | 69 | objArrayOop a = objArrayOop(obj); |
jcoomes@1746 | 70 | const size_t len = size_t(a->length()); |
jcoomes@1746 | 71 | const size_t beg_index = size_t(index); |
jcoomes@1746 | 72 | assert(beg_index < len || len == 0, "index too large"); |
jcoomes@1746 | 73 | |
jcoomes@1746 | 74 | const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride); |
jcoomes@1746 | 75 | const size_t end_index = beg_index + stride; |
jcoomes@1746 | 76 | T* const base = (T*)a->base(); |
jcoomes@1746 | 77 | T* const beg = base + beg_index; |
jcoomes@1746 | 78 | T* const end = base + end_index; |
jcoomes@1746 | 79 | |
jcoomes@1746 | 80 | // Push the non-NULL elements of the next stride on the marking stack. |
jcoomes@1746 | 81 | for (T* e = beg; e < end; e++) { |
jcoomes@1746 | 82 | PSParallelCompact::mark_and_push<T>(cm, e); |
jcoomes@1746 | 83 | } |
jcoomes@1746 | 84 | |
jcoomes@1746 | 85 | if (end_index < len) { |
jcoomes@1746 | 86 | cm->push_objarray(a, end_index); // Push the continuation. |
jcoomes@1746 | 87 | } |
jcoomes@1746 | 88 | } |
jcoomes@1746 | 89 | #endif // #ifndef SERIALGC |