Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/shenandoah/shenandoahCollectionSet.hpp
38920 views
/*1* Copyright (c) 2016, 2018, Red Hat, Inc. All rights reserved.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation.6*7* This code is distributed in the hope that it will be useful, but WITHOUT8* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License10* version 2 for more details (a copy is included in the LICENSE file that11* accompanied this code).12*13* You should have received a copy of the GNU General Public License version14* 2 along with this work; if not, write to the Free Software Foundation,15* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.16*17* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA18* or visit www.oracle.com if you need additional information or have any19* questions.20*21*/2223#ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTIONSET_HPP24#define SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTIONSET_HPP2526#include "memory/allocation.hpp"27#include "gc_implementation/shenandoah/shenandoahHeap.hpp"28#include "gc_implementation/shenandoah/shenandoahHeapRegion.hpp"29#include "gc_implementation/shenandoah/shenandoahPadding.hpp"3031class ShenandoahCollectionSet : public CHeapObj<mtGC> {32friend class ShenandoahHeap;33private:34size_t const _map_size;35size_t const _region_size_bytes_shift;36ReservedSpace _map_space;37char* const _cset_map;38// Bias cset map's base address for fast test if an oop is in cset39char* const _biased_cset_map;4041ShenandoahHeap* const _heap;4243size_t _garbage;44size_t _used;45size_t _region_count;4647shenandoah_padding(0);48volatile jint _current_index;49shenandoah_padding(1);5051public:52ShenandoahCollectionSet(ShenandoahHeap* heap, ReservedSpace space, char* heap_base);5354// Add region to collection set55void add_region(ShenandoahHeapRegion* r);5657// MT version58ShenandoahHeapRegion* claim_next();5960// Single-thread version61ShenandoahHeapRegion* next();6263size_t count() const { return _region_count; }64bool is_empty() const { return _region_count == 0; }6566void clear_current_index() {67_current_index = 0;68}6970inline bool is_in(ShenandoahHeapRegion* r) const;71inline bool is_in(size_t region_idx) const;72inline bool is_in(oop obj) const;73inline bool is_in_loc(void* loc) const;7475void print_on(outputStream* out) const;7677size_t used() const { return _used; }78size_t garbage() const { return _garbage; }79void clear();8081private:82char* map_address() const {83return _cset_map;84}85char* biased_map_address() const {86return _biased_cset_map;87}88};8990#endif //SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTIONSET_HPP919293