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

Fri, 10 May 2013 08:27:30 -0700

author
minqi
date
Fri, 10 May 2013 08:27:30 -0700
changeset 5097
92ef81e2f571
parent 4128
f81a7c0c618d
child 6876
710a3c8b516e
permissions
-rw-r--r--

8003557: NPG: Klass* const k should be const Klass* k.
Summary: With NPG, const KlassOop klass which is in fact a definition converted to Klass* const, which is not the original intention. The right usage is converting them to const Klass*.
Reviewed-by: coleenp, kvn
Contributed-by: yumin.qi@oracle.com

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_parallel(ObjectStartArray* start_array,
duke@435 64 MutableSpace* sp,
duke@435 65 HeapWord* space_top,
duke@435 66 PSPromotionManager* pm,
jmasa@3294 67 uint stripe_number,
jmasa@3294 68 uint stripe_total);
duke@435 69
duke@435 70 // Verification
duke@435 71 static void verify_all_young_refs_imprecise();
duke@435 72 static void verify_all_young_refs_precise();
duke@435 73
duke@435 74 bool addr_is_marked_imprecise(void *addr);
duke@435 75 bool addr_is_marked_precise(void *addr);
duke@435 76
duke@435 77 void set_card_newgen(void* addr) { jbyte* p = byte_for(addr); *p = verify_card; }
duke@435 78
duke@435 79 // Testers for entries
duke@435 80 static bool card_is_dirty(int value) { return value == dirty_card; }
duke@435 81 static bool card_is_newgen(int value) { return value == youngergen_card; }
duke@435 82 static bool card_is_clean(int value) { return value == clean_card; }
duke@435 83 static bool card_is_verify(int value) { return value == verify_card; }
duke@435 84
duke@435 85 // Card marking
coleenp@548 86 void inline_write_ref_field_gc(void* field, oop new_val) {
duke@435 87 jbyte* byte = byte_for(field);
duke@435 88 *byte = youngergen_card;
duke@435 89 }
duke@435 90
duke@435 91 // Adaptive size policy support
duke@435 92 // Allows adjustment of the base and size of the covered regions
duke@435 93 void resize_covered_region(MemRegion new_region);
duke@435 94 // Finds the covered region to resize based on the start address
duke@435 95 // of the covered regions.
duke@435 96 void resize_covered_region_by_start(MemRegion new_region);
duke@435 97 // Finds the covered region to resize based on the end address
duke@435 98 // of the covered regions.
duke@435 99 void resize_covered_region_by_end(int changed_region, MemRegion new_region);
duke@435 100 // Finds the lowest start address of a covered region that is
duke@435 101 // previous (i.e., lower index) to the covered region with index "ind".
duke@435 102 HeapWord* lowest_prev_committed_start(int ind) const;
duke@435 103
duke@435 104 #ifdef ASSERT
duke@435 105
duke@435 106 bool is_valid_card_address(jbyte* addr) {
duke@435 107 return (addr >= _byte_map) && (addr < _byte_map + _byte_map_size);
duke@435 108 }
duke@435 109
duke@435 110 #endif // ASSERT
duke@435 111 };
stefank@2314 112
stefank@2314 113 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP

mercurial