5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 void objArrayKlass::oop_follow_contents(oop obj, int index) { 26 if (UseCompressedOops) { 27 objarray_follow_contents<narrowOop>(obj, index); 28 } else { 29 objarray_follow_contents<oop>(obj, index); 30 } 31 } 32 33 template <class T> 34 void objArrayKlass::objarray_follow_contents(oop obj, int index) { 35 objArrayOop a = objArrayOop(obj); 36 const size_t len = size_t(a->length()); 37 const size_t beg_index = size_t(index); 38 assert(beg_index < len || len == 0, "index too large"); 39 40 const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride); 41 const size_t end_index = beg_index + stride; 42 T* const base = (T*)a->base(); 43 T* const beg = base + beg_index; 44 T* const end = base + end_index; 70 const size_t len = size_t(a->length()); 71 const size_t beg_index = size_t(index); 72 assert(beg_index < len || len == 0, "index too large"); 73 74 const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride); 75 const size_t end_index = beg_index + stride; 76 T* const base = (T*)a->base(); 77 T* const beg = base + beg_index; 78 T* const end = base + end_index; 79 80 // Push the non-NULL elements of the next stride on the marking stack. 81 for (T* e = beg; e < end; e++) { 82 PSParallelCompact::mark_and_push<T>(cm, e); 83 } 84 85 if (end_index < len) { 86 cm->push_objarray(a, end_index); // Push the continuation. 87 } 88 } 89 #endif // #ifndef SERIALGC | 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP 26 #define SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP 27 28 #include "oops/objArrayKlass.hpp" 29 #ifndef SERIALGC 30 #include "gc_implementation/parallelScavenge/psCompactionManager.inline.hpp" 31 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp" 32 #endif 33 34 void objArrayKlass::oop_follow_contents(oop obj, int index) { 35 if (UseCompressedOops) { 36 objarray_follow_contents<narrowOop>(obj, index); 37 } else { 38 objarray_follow_contents<oop>(obj, index); 39 } 40 } 41 42 template <class T> 43 void objArrayKlass::objarray_follow_contents(oop obj, int index) { 44 objArrayOop a = objArrayOop(obj); 45 const size_t len = size_t(a->length()); 46 const size_t beg_index = size_t(index); 47 assert(beg_index < len || len == 0, "index too large"); 48 49 const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride); 50 const size_t end_index = beg_index + stride; 51 T* const base = (T*)a->base(); 52 T* const beg = base + beg_index; 53 T* const end = base + end_index; 79 const size_t len = size_t(a->length()); 80 const size_t beg_index = size_t(index); 81 assert(beg_index < len || len == 0, "index too large"); 82 83 const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride); 84 const size_t end_index = beg_index + stride; 85 T* const base = (T*)a->base(); 86 T* const beg = base + beg_index; 87 T* const end = base + end_index; 88 89 // Push the non-NULL elements of the next stride on the marking stack. 90 for (T* e = beg; e < end; e++) { 91 PSParallelCompact::mark_and_push<T>(cm, e); 92 } 93 94 if (end_index < len) { 95 cm->push_objarray(a, end_index); // Push the continuation. 96 } 97 } 98 #endif // #ifndef SERIALGC 99 100 #endif // SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP |