src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp

Thu, 22 Sep 2011 10:57:37 -0700

author
johnc
date
Thu, 22 Sep 2011 10:57:37 -0700
changeset 3175
4dfb2df418f2
parent 2314
f95d63e2154a
child 3294
bca17e38de00
permissions
-rw-r--r--

6484982: G1: process references during evacuation pauses
Summary: G1 now uses two reference processors - one is used by concurrent marking and the other is used by STW GCs (both full and incremental evacuation pauses). In an evacuation pause, the reference processor is embedded into the closures used to scan objects. Doing so causes causes reference objects to be 'discovered' by the reference processor. At the end of the evacuation pause, these discovered reference objects are processed - preserving (and copying) referent objects (and their reachable graphs) as appropriate.
Reviewed-by: ysr, jwilhelm, brutisso, stefank, tonyp

duke@435 1 /*
jmasa@1967 2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP
stefank@2314 26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP
stefank@2314 27
stefank@2314 28 #include "memory/cardTableModRefBS.hpp"
stefank@2314 29
duke@435 30 class MutableSpace;
duke@435 31 class ObjectStartArray;
duke@435 32 class PSPromotionManager;
duke@435 33 class GCTaskQueue;
duke@435 34
duke@435 35 class CardTableExtension : public CardTableModRefBS {
duke@435 36 private:
duke@435 37 // Support methods for resizing the card table.
jmasa@1967 38 // resize_commit_uncommit() returns true if the pages were committed or
jmasa@1967 39 // uncommitted
jmasa@1967 40 bool resize_commit_uncommit(int changed_region, MemRegion new_region);
duke@435 41 void resize_update_card_table_entries(int changed_region,
duke@435 42 MemRegion new_region);
duke@435 43 void resize_update_committed_table(int changed_region, MemRegion new_region);
duke@435 44 void resize_update_covered_table(int changed_region, MemRegion new_region);
duke@435 45
duke@435 46 protected:
duke@435 47
duke@435 48 static void verify_all_young_refs_precise_helper(MemRegion mr);
duke@435 49
duke@435 50 public:
duke@435 51 enum ExtendedCardValue {
duke@435 52 youngergen_card = CardTableModRefBS::CT_MR_BS_last_reserved + 1,
duke@435 53 verify_card = CardTableModRefBS::CT_MR_BS_last_reserved + 5
duke@435 54 };
duke@435 55
duke@435 56 CardTableExtension(MemRegion whole_heap, int max_covered_regions) :
duke@435 57 CardTableModRefBS(whole_heap, max_covered_regions) { }
duke@435 58
duke@435 59 // Too risky for the 4/10/02 putback
duke@435 60 // BarrierSet::Name kind() { return BarrierSet::CardTableExtension; }
duke@435 61
duke@435 62 // Scavenge support
duke@435 63 void scavenge_contents(ObjectStartArray* start_array,
duke@435 64 MutableSpace* sp,
duke@435 65 HeapWord* space_top,
duke@435 66 PSPromotionManager* pm);
duke@435 67
duke@435 68 void scavenge_contents_parallel(ObjectStartArray* start_array,
duke@435 69 MutableSpace* sp,
duke@435 70 HeapWord* space_top,
duke@435 71 PSPromotionManager* pm,
duke@435 72 uint stripe_number);
duke@435 73
duke@435 74 // Verification
duke@435 75 static void verify_all_young_refs_imprecise();
duke@435 76 static void verify_all_young_refs_precise();
duke@435 77
duke@435 78 bool addr_is_marked_imprecise(void *addr);
duke@435 79 bool addr_is_marked_precise(void *addr);
duke@435 80
duke@435 81 void set_card_newgen(void* addr) { jbyte* p = byte_for(addr); *p = verify_card; }
duke@435 82
duke@435 83 // Testers for entries
duke@435 84 static bool card_is_dirty(int value) { return value == dirty_card; }
duke@435 85 static bool card_is_newgen(int value) { return value == youngergen_card; }
duke@435 86 static bool card_is_clean(int value) { return value == clean_card; }
duke@435 87 static bool card_is_verify(int value) { return value == verify_card; }
duke@435 88
duke@435 89 // Card marking
coleenp@548 90 void inline_write_ref_field_gc(void* field, oop new_val) {
duke@435 91 jbyte* byte = byte_for(field);
duke@435 92 *byte = youngergen_card;
duke@435 93 }
duke@435 94
duke@435 95 // Adaptive size policy support
duke@435 96 // Allows adjustment of the base and size of the covered regions
duke@435 97 void resize_covered_region(MemRegion new_region);
duke@435 98 // Finds the covered region to resize based on the start address
duke@435 99 // of the covered regions.
duke@435 100 void resize_covered_region_by_start(MemRegion new_region);
duke@435 101 // Finds the covered region to resize based on the end address
duke@435 102 // of the covered regions.
duke@435 103 void resize_covered_region_by_end(int changed_region, MemRegion new_region);
duke@435 104 // Finds the lowest start address of a covered region that is
duke@435 105 // previous (i.e., lower index) to the covered region with index "ind".
duke@435 106 HeapWord* lowest_prev_committed_start(int ind) const;
duke@435 107
duke@435 108 #ifdef ASSERT
duke@435 109
duke@435 110 bool is_valid_card_address(jbyte* addr) {
duke@435 111 return (addr >= _byte_map) && (addr < _byte_map + _byte_map_size);
duke@435 112 }
duke@435 113
duke@435 114 #endif // ASSERT
duke@435 115 };
stefank@2314 116
stefank@2314 117 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP

mercurial