Tue, 11 Nov 2014 11:05:41 +0100
8056071: compiler/whitebox/IsMethodCompilableTest.java fails with 'method() is not compilable after 3 iterations'
Summary: Always use MDO if valid and always compile trivial methods with C1 if available.
Reviewed-by: kvn, iveresov
jcoomes@1746 | 1 | /* |
mikael@6198 | 2 | * Copyright (c) 2010, 2013, 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" |
jprovino@4542 | 30 | #include "utilities/macros.hpp" |
jprovino@4542 | 31 | #if INCLUDE_ALL_GCS |
stefank@2314 | 32 | #include "gc_implementation/parallelScavenge/psCompactionManager.inline.hpp" |
stefank@2314 | 33 | #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" |
jprovino@4542 | 34 | #endif // INCLUDE_ALL_GCS |
stefank@2314 | 35 | |
coleenp@4142 | 36 | void ObjArrayKlass::oop_follow_contents(oop obj, int index) { |
jcoomes@1746 | 37 | if (UseCompressedOops) { |
jcoomes@1746 | 38 | objarray_follow_contents<narrowOop>(obj, index); |
jcoomes@1746 | 39 | } else { |
jcoomes@1746 | 40 | objarray_follow_contents<oop>(obj, index); |
jcoomes@1746 | 41 | } |
jcoomes@1746 | 42 | } |
jcoomes@1746 | 43 | |
jcoomes@1746 | 44 | template <class T> |
coleenp@4142 | 45 | void ObjArrayKlass::objarray_follow_contents(oop obj, int index) { |
jcoomes@1746 | 46 | objArrayOop a = objArrayOop(obj); |
jcoomes@1746 | 47 | const size_t len = size_t(a->length()); |
jcoomes@1746 | 48 | const size_t beg_index = size_t(index); |
jcoomes@1746 | 49 | assert(beg_index < len || len == 0, "index too large"); |
jcoomes@1746 | 50 | |
jcoomes@1746 | 51 | const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride); |
jcoomes@1746 | 52 | const size_t end_index = beg_index + stride; |
jcoomes@1746 | 53 | T* const base = (T*)a->base(); |
jcoomes@1746 | 54 | T* const beg = base + beg_index; |
jcoomes@1746 | 55 | T* const end = base + end_index; |
jcoomes@1746 | 56 | |
jcoomes@1746 | 57 | // Push the non-NULL elements of the next stride on the marking stack. |
jcoomes@1746 | 58 | for (T* e = beg; e < end; e++) { |
jcoomes@1746 | 59 | MarkSweep::mark_and_push<T>(e); |
jcoomes@1746 | 60 | } |
jcoomes@1746 | 61 | |
jcoomes@1746 | 62 | if (end_index < len) { |
jcoomes@1746 | 63 | MarkSweep::push_objarray(a, end_index); // Push the continuation. |
jcoomes@1746 | 64 | } |
jcoomes@1746 | 65 | } |
jcoomes@1746 | 66 | |
jprovino@4542 | 67 | #if INCLUDE_ALL_GCS |
coleenp@4142 | 68 | void ObjArrayKlass::oop_follow_contents(ParCompactionManager* cm, oop obj, |
jcoomes@1746 | 69 | int index) { |
jcoomes@1746 | 70 | if (UseCompressedOops) { |
jcoomes@1746 | 71 | objarray_follow_contents<narrowOop>(cm, obj, index); |
jcoomes@1746 | 72 | } else { |
jcoomes@1746 | 73 | objarray_follow_contents<oop>(cm, obj, index); |
jcoomes@1746 | 74 | } |
jcoomes@1746 | 75 | } |
jcoomes@1746 | 76 | |
jcoomes@1746 | 77 | template <class T> |
coleenp@4142 | 78 | void ObjArrayKlass::objarray_follow_contents(ParCompactionManager* cm, oop obj, |
jcoomes@1746 | 79 | int index) { |
jcoomes@1746 | 80 | objArrayOop a = objArrayOop(obj); |
jcoomes@1746 | 81 | const size_t len = size_t(a->length()); |
jcoomes@1746 | 82 | const size_t beg_index = size_t(index); |
jcoomes@1746 | 83 | assert(beg_index < len || len == 0, "index too large"); |
jcoomes@1746 | 84 | |
jcoomes@1746 | 85 | const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride); |
jcoomes@1746 | 86 | const size_t end_index = beg_index + stride; |
jcoomes@1746 | 87 | T* const base = (T*)a->base(); |
jcoomes@1746 | 88 | T* const beg = base + beg_index; |
jcoomes@1746 | 89 | T* const end = base + end_index; |
jcoomes@1746 | 90 | |
jcoomes@1746 | 91 | // Push the non-NULL elements of the next stride on the marking stack. |
jcoomes@1746 | 92 | for (T* e = beg; e < end; e++) { |
jcoomes@1746 | 93 | PSParallelCompact::mark_and_push<T>(cm, e); |
jcoomes@1746 | 94 | } |
jcoomes@1746 | 95 | |
jcoomes@1746 | 96 | if (end_index < len) { |
jcoomes@1746 | 97 | cm->push_objarray(a, end_index); // Push the continuation. |
jcoomes@1746 | 98 | } |
jcoomes@1746 | 99 | } |
jprovino@4542 | 100 | #endif // INCLUDE_ALL_GCS |
stefank@2314 | 101 | |
stefank@2314 | 102 | #endif // SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP |