1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,108 @@ 1.4 +/* 1.5 + * Copyright 2001-2003 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +class MutableSpace; 1.29 +class ObjectStartArray; 1.30 +class PSPromotionManager; 1.31 +class GCTaskQueue; 1.32 + 1.33 +class CardTableExtension : public CardTableModRefBS { 1.34 + private: 1.35 + // Support methods for resizing the card table. 1.36 + void resize_commit_uncommit(int changed_region, MemRegion new_region); 1.37 + void resize_update_card_table_entries(int changed_region, 1.38 + MemRegion new_region); 1.39 + void resize_update_committed_table(int changed_region, MemRegion new_region); 1.40 + void resize_update_covered_table(int changed_region, MemRegion new_region); 1.41 + 1.42 + protected: 1.43 + 1.44 + static void verify_all_young_refs_precise_helper(MemRegion mr); 1.45 + 1.46 + public: 1.47 + enum ExtendedCardValue { 1.48 + youngergen_card = CardTableModRefBS::CT_MR_BS_last_reserved + 1, 1.49 + verify_card = CardTableModRefBS::CT_MR_BS_last_reserved + 5 1.50 + }; 1.51 + 1.52 + CardTableExtension(MemRegion whole_heap, int max_covered_regions) : 1.53 + CardTableModRefBS(whole_heap, max_covered_regions) { } 1.54 + 1.55 + // Too risky for the 4/10/02 putback 1.56 + // BarrierSet::Name kind() { return BarrierSet::CardTableExtension; } 1.57 + 1.58 + // Scavenge support 1.59 + void scavenge_contents(ObjectStartArray* start_array, 1.60 + MutableSpace* sp, 1.61 + HeapWord* space_top, 1.62 + PSPromotionManager* pm); 1.63 + 1.64 + void scavenge_contents_parallel(ObjectStartArray* start_array, 1.65 + MutableSpace* sp, 1.66 + HeapWord* space_top, 1.67 + PSPromotionManager* pm, 1.68 + uint stripe_number); 1.69 + 1.70 + // Verification 1.71 + static void verify_all_young_refs_imprecise(); 1.72 + static void verify_all_young_refs_precise(); 1.73 + 1.74 + bool addr_is_marked_imprecise(void *addr); 1.75 + bool addr_is_marked_precise(void *addr); 1.76 + 1.77 + void set_card_newgen(void* addr) { jbyte* p = byte_for(addr); *p = verify_card; } 1.78 + 1.79 + // Testers for entries 1.80 + static bool card_is_dirty(int value) { return value == dirty_card; } 1.81 + static bool card_is_newgen(int value) { return value == youngergen_card; } 1.82 + static bool card_is_clean(int value) { return value == clean_card; } 1.83 + static bool card_is_verify(int value) { return value == verify_card; } 1.84 + 1.85 + // Card marking 1.86 + void inline_write_ref_field_gc(oop* field, oop new_val) { 1.87 + jbyte* byte = byte_for(field); 1.88 + *byte = youngergen_card; 1.89 + } 1.90 + 1.91 + // Adaptive size policy support 1.92 + // Allows adjustment of the base and size of the covered regions 1.93 + void resize_covered_region(MemRegion new_region); 1.94 + // Finds the covered region to resize based on the start address 1.95 + // of the covered regions. 1.96 + void resize_covered_region_by_start(MemRegion new_region); 1.97 + // Finds the covered region to resize based on the end address 1.98 + // of the covered regions. 1.99 + void resize_covered_region_by_end(int changed_region, MemRegion new_region); 1.100 + // Finds the lowest start address of a covered region that is 1.101 + // previous (i.e., lower index) to the covered region with index "ind". 1.102 + HeapWord* lowest_prev_committed_start(int ind) const; 1.103 + 1.104 +#ifdef ASSERT 1.105 + 1.106 + bool is_valid_card_address(jbyte* addr) { 1.107 + return (addr >= _byte_map) && (addr < _byte_map + _byte_map_size); 1.108 + } 1.109 + 1.110 +#endif // ASSERT 1.111 +};