Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/jfr/leakprofiler/chains/bitset.hpp
48474 views
/*1* Copyright (c) 2014, 2018, 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_JFR_LEAKPROFILER_CHAINS_BITSET_HPP25#define SHARE_VM_JFR_LEAKPROFILER_CHAINS_BITSET_HPP2627#include "memory/allocation.hpp"28#include "oops/oopsHierarchy.hpp"29#include "utilities/bitMap.inline.hpp"3031class JfrVirtualMemory;32class MemRegion;3334class BitSet : public CHeapObj<mtTracing> {35private:36JfrVirtualMemory* _vmm;37const HeapWord* const _region_start;38BitMap _bits;39const size_t _region_size;4041public:42BitSet(const MemRegion& covered_region);43~BitSet();4445bool initialize();4647BitMap::idx_t mark_obj(const HeapWord* addr) {48const BitMap::idx_t bit = addr_to_bit(addr);49_bits.set_bit(bit);50return bit;51}5253BitMap::idx_t mark_obj(oop obj) {54return mark_obj((HeapWord*)obj);55}5657bool is_marked(const HeapWord* addr) const {58return is_marked(addr_to_bit(addr));59}6061bool is_marked(oop obj) const {62return is_marked((HeapWord*)obj);63}6465BitMap::idx_t size() const {66return _bits.size();67}6869BitMap::idx_t addr_to_bit(const HeapWord* addr) const {70return pointer_delta(addr, _region_start) >> LogMinObjAlignment;71}7273bool is_marked(const BitMap::idx_t bit) const {74return _bits.at(bit);75}76};7778#endif // SHARE_VM_JFR_LEAKPROFILER_CHAINS_BITSET_HPP798081