duke@435: /* jmasa@1967: * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. duke@435: * duke@435: */ duke@435: stefank@2314: #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP stefank@2314: #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP stefank@2314: stefank@2314: #include "memory/cardTableModRefBS.hpp" stefank@2314: duke@435: class MutableSpace; duke@435: class ObjectStartArray; duke@435: class PSPromotionManager; duke@435: class GCTaskQueue; duke@435: duke@435: class CardTableExtension : public CardTableModRefBS { duke@435: private: duke@435: // Support methods for resizing the card table. jmasa@1967: // resize_commit_uncommit() returns true if the pages were committed or jmasa@1967: // uncommitted jmasa@1967: bool resize_commit_uncommit(int changed_region, MemRegion new_region); duke@435: void resize_update_card_table_entries(int changed_region, duke@435: MemRegion new_region); duke@435: void resize_update_committed_table(int changed_region, MemRegion new_region); duke@435: void resize_update_covered_table(int changed_region, MemRegion new_region); duke@435: duke@435: protected: duke@435: duke@435: static void verify_all_young_refs_precise_helper(MemRegion mr); duke@435: duke@435: public: duke@435: enum ExtendedCardValue { duke@435: youngergen_card = CardTableModRefBS::CT_MR_BS_last_reserved + 1, duke@435: verify_card = CardTableModRefBS::CT_MR_BS_last_reserved + 5 duke@435: }; duke@435: duke@435: CardTableExtension(MemRegion whole_heap, int max_covered_regions) : duke@435: CardTableModRefBS(whole_heap, max_covered_regions) { } duke@435: duke@435: // Too risky for the 4/10/02 putback duke@435: // BarrierSet::Name kind() { return BarrierSet::CardTableExtension; } duke@435: duke@435: // Scavenge support duke@435: void scavenge_contents_parallel(ObjectStartArray* start_array, duke@435: MutableSpace* sp, duke@435: HeapWord* space_top, duke@435: PSPromotionManager* pm, jmasa@3294: uint stripe_number, jmasa@3294: uint stripe_total); duke@435: duke@435: // Verification duke@435: static void verify_all_young_refs_imprecise(); duke@435: static void verify_all_young_refs_precise(); duke@435: duke@435: bool addr_is_marked_imprecise(void *addr); duke@435: bool addr_is_marked_precise(void *addr); duke@435: duke@435: void set_card_newgen(void* addr) { jbyte* p = byte_for(addr); *p = verify_card; } duke@435: duke@435: // Testers for entries duke@435: static bool card_is_dirty(int value) { return value == dirty_card; } duke@435: static bool card_is_newgen(int value) { return value == youngergen_card; } duke@435: static bool card_is_clean(int value) { return value == clean_card; } duke@435: static bool card_is_verify(int value) { return value == verify_card; } duke@435: duke@435: // Card marking coleenp@548: void inline_write_ref_field_gc(void* field, oop new_val) { duke@435: jbyte* byte = byte_for(field); duke@435: *byte = youngergen_card; duke@435: } duke@435: duke@435: // Adaptive size policy support duke@435: // Allows adjustment of the base and size of the covered regions duke@435: void resize_covered_region(MemRegion new_region); duke@435: // Finds the covered region to resize based on the start address duke@435: // of the covered regions. duke@435: void resize_covered_region_by_start(MemRegion new_region); duke@435: // Finds the covered region to resize based on the end address duke@435: // of the covered regions. duke@435: void resize_covered_region_by_end(int changed_region, MemRegion new_region); duke@435: // Finds the lowest start address of a covered region that is duke@435: // previous (i.e., lower index) to the covered region with index "ind". duke@435: HeapWord* lowest_prev_committed_start(int ind) const; duke@435: duke@435: #ifdef ASSERT duke@435: duke@435: bool is_valid_card_address(jbyte* addr) { duke@435: return (addr >= _byte_map) && (addr < _byte_map + _byte_map_size); duke@435: } duke@435: duke@435: #endif // ASSERT duke@435: }; stefank@2314: stefank@2314: #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP