Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp
32285 views
/*1* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP25#define SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP2627#include "gc_implementation/shared/markSweep.inline.hpp"28#include "oops/objArrayKlass.hpp"29#include "utilities/macros.hpp"30#if INCLUDE_ALL_GCS31#include "gc_implementation/parallelScavenge/psCompactionManager.inline.hpp"32#include "gc_implementation/parallelScavenge/psParallelCompact.hpp"33#endif // INCLUDE_ALL_GCS3435void ObjArrayKlass::oop_follow_contents(oop obj, int index) {36if (UseCompressedOops) {37objarray_follow_contents<narrowOop>(obj, index);38} else {39objarray_follow_contents<oop>(obj, index);40}41}4243template <class T>44void ObjArrayKlass::objarray_follow_contents(oop obj, int index) {45objArrayOop a = objArrayOop(obj);46const size_t len = size_t(a->length());47const size_t beg_index = size_t(index);48assert(beg_index < len || len == 0, "index too large");4950const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);51const size_t end_index = beg_index + stride;52T* const base = (T*)a->base();53T* const beg = base + beg_index;54T* const end = base + end_index;5556// Push the non-NULL elements of the next stride on the marking stack.57for (T* e = beg; e < end; e++) {58MarkSweep::mark_and_push<T>(e);59}6061if (end_index < len) {62MarkSweep::push_objarray(a, end_index); // Push the continuation.63}64}6566#if INCLUDE_ALL_GCS67void ObjArrayKlass::oop_follow_contents(ParCompactionManager* cm, oop obj,68int index) {69if (UseCompressedOops) {70objarray_follow_contents<narrowOop>(cm, obj, index);71} else {72objarray_follow_contents<oop>(cm, obj, index);73}74}7576template <class T>77void ObjArrayKlass::objarray_follow_contents(ParCompactionManager* cm, oop obj,78int index) {79objArrayOop a = objArrayOop(obj);80const size_t len = size_t(a->length());81const size_t beg_index = size_t(index);82assert(beg_index < len || len == 0, "index too large");8384const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);85const size_t end_index = beg_index + stride;86T* const base = (T*)a->base();87T* const beg = base + beg_index;88T* const end = base + end_index;8990// Push the non-NULL elements of the next stride on the marking stack.91for (T* e = beg; e < end; e++) {92PSParallelCompact::mark_and_push<T>(cm, e);93}9495if (end_index < len) {96cm->push_objarray(a, end_index); // Push the continuation.97}98}99#endif // INCLUDE_ALL_GCS100101#endif // SHARE_VM_OOPS_OBJARRAYKLASS_INLINE_HPP102103104