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

Wed, 27 Apr 2016 01:25:04 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:25:04 +0800
changeset 0
f90c822e73f8
child 1
2d8a650513c2
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/
changeset: 6782:28b50d07f6f8
tag: jdk8u25-b17

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

mercurial