Path: blob/master/src/hotspot/share/gc/parallel/psCardTable.hpp
41152 views
/*1* Copyright (c) 2001, 2019, 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_PARALLEL_PSCARDTABLE_HPP25#define SHARE_GC_PARALLEL_PSCARDTABLE_HPP2627#include "gc/shared/cardTable.hpp"28#include "oops/oop.hpp"2930class MutableSpace;31class ObjectStartArray;32class PSPromotionManager;3334class PSCardTable: public CardTable {35private:36// Support methods for resizing the card table.37// resize_commit_uncommit() returns true if the pages were committed or38// uncommitted39bool resize_commit_uncommit(int changed_region, MemRegion new_region);40void resize_update_card_table_entries(int changed_region,41MemRegion new_region);42void resize_update_committed_table(int changed_region, MemRegion new_region);43void resize_update_covered_table(int changed_region, MemRegion new_region);4445void verify_all_young_refs_precise_helper(MemRegion mr);4647enum ExtendedCardValue {48youngergen_card = CT_MR_BS_last_reserved + 1,49verify_card = CT_MR_BS_last_reserved + 550};5152public:53PSCardTable(MemRegion whole_heap) : CardTable(whole_heap) {}5455static CardValue youngergen_card_val() { return youngergen_card; }56static CardValue verify_card_val() { return verify_card; }5758// Scavenge support59void scavenge_contents_parallel(ObjectStartArray* start_array,60MutableSpace* sp,61HeapWord* space_top,62PSPromotionManager* pm,63uint stripe_number,64uint stripe_total);6566bool addr_is_marked_imprecise(void *addr);67bool addr_is_marked_precise(void *addr);6869void set_card_newgen(void* addr) { CardValue* p = byte_for(addr); *p = verify_card; }7071// Testers for entries72static bool card_is_dirty(int value) { return value == dirty_card; }73static bool card_is_newgen(int value) { return value == youngergen_card; }74static bool card_is_clean(int value) { return value == clean_card; }75static bool card_is_verify(int value) { return value == verify_card; }7677// Card marking78void inline_write_ref_field_gc(void* field, oop new_val) {79CardValue* byte = byte_for(field);80*byte = youngergen_card;81}8283// ReduceInitialCardMarks support84bool is_in_young(oop obj) const;8586// Adaptive size policy support87// Allows adjustment of the base and size of the covered regions88void resize_covered_region(MemRegion new_region);89// Finds the covered region to resize based on the start address90// of the covered regions.91void resize_covered_region_by_start(MemRegion new_region);92// Finds the covered region to resize based on the end address93// of the covered regions.94void resize_covered_region_by_end(int changed_region, MemRegion new_region);95// Finds the lowest start address of a covered region that is96// previous (i.e., lower index) to the covered region with index "ind".97HeapWord* lowest_prev_committed_start(int ind) const;9899#ifdef ASSERT100bool is_valid_card_address(CardValue* addr) {101return (addr >= _byte_map) && (addr < _byte_map + _byte_map_size);102}103#endif // ASSERT104105// Verification106void verify_all_young_refs_imprecise();107void verify_all_young_refs_precise();108};109110#endif // SHARE_GC_PARALLEL_PSCARDTABLE_HPP111112113