Path: blob/master/src/hotspot/share/gc/shared/cardTableRS.hpp
40957 views
/*1* Copyright (c) 2001, 2021, 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_GC_SHARED_CARDTABLERS_HPP25#define SHARE_GC_SHARED_CARDTABLERS_HPP2627#include "gc/shared/cardTable.hpp"28#include "memory/memRegion.hpp"29#include "oops/oop.hpp"3031class DirtyCardToOopClosure;32class Generation;33class Space;3435// This RemSet uses a card table both as shared data structure36// for a mod ref barrier set and for the rem set information.3738class CardTableRS : public CardTable {39friend class VMStructs;40// Below are private classes used in impl.41friend class VerifyCTSpaceClosure;42friend class ClearNoncleanCardWrapper;4344void verify_space(Space* s, HeapWord* gen_start);4546public:47CardTableRS(MemRegion whole_heap);4849void younger_refs_in_space_iterate(Space* sp, HeapWord* gen_boundary, OopIterateClosure* cl);5051virtual void verify_used_region_at_save_marks(Space* sp) const NOT_DEBUG_RETURN;5253void inline_write_ref_field_gc(void* field) {54CardValue* byte = byte_for(field);55*byte = dirty_card_val();56}5758bool is_aligned(HeapWord* addr) {59return is_card_aligned(addr);60}6162void verify();63void initialize();6465void clear_into_younger(Generation* old_gen);6667void invalidate_or_clear(Generation* old_gen);6869// Iterate over the portion of the card-table which covers the given70// region mr in the given space and apply cl to any dirty sub-regions71// of mr. Clears the dirty cards as they are processed.72void non_clean_card_iterate(Space* sp,73HeapWord* gen_boundary,74MemRegion mr,75OopIterateClosure* cl,76CardTableRS* ct);7778virtual bool is_in_young(oop obj) const;79};8081class ClearNoncleanCardWrapper: public MemRegionClosure {82DirtyCardToOopClosure* _dirty_card_closure;83CardTableRS* _ct;8485public:8687typedef CardTable::CardValue CardValue;88private:89// Clears the given card, return true if the corresponding card should be90// processed.91inline bool clear_card(CardValue* entry);92// check alignment of pointer93bool is_word_aligned(CardValue* entry);9495public:96ClearNoncleanCardWrapper(DirtyCardToOopClosure* dirty_card_closure, CardTableRS* ct);97void do_MemRegion(MemRegion mr);98};99100#endif // SHARE_GC_SHARED_CARDTABLERS_HPP101102103