Path: blob/master/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp
40957 views
/*1* Copyright (c) 2017, 2020, Red Hat, Inc. 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_GC_SHENANDOAH_SHENANDOAHCOLLECTIONSET_INLINE_HPP25#define SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTIONSET_INLINE_HPP2627#include "gc/shenandoah/shenandoahCollectionSet.hpp"2829#include "gc/shenandoah/shenandoahHeap.hpp"30#include "gc/shenandoah/shenandoahHeap.inline.hpp"31#include "gc/shenandoah/shenandoahHeapRegion.hpp"3233bool ShenandoahCollectionSet::is_in(size_t region_idx) const {34assert(region_idx < _heap->num_regions(), "Sanity");35return _cset_map[region_idx] == 1;36}3738bool ShenandoahCollectionSet::is_in(ShenandoahHeapRegion* r) const {39return is_in(r->index());40}4142bool ShenandoahCollectionSet::is_in(oop p) const {43shenandoah_assert_in_heap_or_null(NULL, p);44return is_in_loc(cast_from_oop<void*>(p));45}4647bool ShenandoahCollectionSet::is_in_loc(void* p) const {48assert(p == NULL || _heap->is_in(p), "Must be in the heap");49uintx index = ((uintx) p) >> _region_size_bytes_shift;50// no need to subtract the bottom of the heap from p,51// _biased_cset_map is biased52return _biased_cset_map[index] == 1;53}5455#endif // SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTIONSET_INLINE_HPP565758