Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp
38920 views
/*1* Copyright (c) 2001, 2010, 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_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP25#define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP2627#include "memory/cardTableModRefBS.hpp"2829class MutableSpace;30class ObjectStartArray;31class PSPromotionManager;32class GCTaskQueue;3334class CardTableExtension : public CardTableModRefBS {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);4445protected:4647static void verify_all_young_refs_precise_helper(MemRegion mr);4849public:50enum ExtendedCardValue {51youngergen_card = CardTableModRefBS::CT_MR_BS_last_reserved + 1,52verify_card = CardTableModRefBS::CT_MR_BS_last_reserved + 553};5455CardTableExtension(MemRegion whole_heap, int max_covered_regions) :56CardTableModRefBS(whole_heap, max_covered_regions) { }5758// Too risky for the 4/10/02 putback59// BarrierSet::Name kind() { return BarrierSet::CardTableExtension; }6061// Scavenge support62void scavenge_contents_parallel(ObjectStartArray* start_array,63MutableSpace* sp,64HeapWord* space_top,65PSPromotionManager* pm,66uint stripe_number,67uint stripe_total);6869// Verification70static void verify_all_young_refs_imprecise();71static void verify_all_young_refs_precise();7273bool addr_is_marked_imprecise(void *addr);74bool addr_is_marked_precise(void *addr);7576void set_card_newgen(void* addr) { jbyte* p = byte_for(addr); *p = verify_card; }7778// Testers for entries79static bool card_is_dirty(int value) { return value == dirty_card; }80static bool card_is_newgen(int value) { return value == youngergen_card; }81static bool card_is_clean(int value) { return value == clean_card; }82static bool card_is_verify(int value) { return value == verify_card; }8384// Card marking85void inline_write_ref_field_gc(void* field, oop new_val) {86jbyte* byte = byte_for(field);87*byte = youngergen_card;88}8990// Adaptive size policy support91// Allows adjustment of the base and size of the covered regions92void resize_covered_region(MemRegion new_region);93// Finds the covered region to resize based on the start address94// of the covered regions.95void resize_covered_region_by_start(MemRegion new_region);96// Finds the covered region to resize based on the end address97// of the covered regions.98void resize_covered_region_by_end(int changed_region, MemRegion new_region);99// Finds the lowest start address of a covered region that is100// previous (i.e., lower index) to the covered region with index "ind".101HeapWord* lowest_prev_committed_start(int ind) const;102103#ifdef ASSERT104105bool is_valid_card_address(jbyte* addr) {106return (addr >= _byte_map) && (addr < _byte_map + _byte_map_size);107}108109#endif // ASSERT110};111112#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP113114115