Fri, 29 Apr 2011 14:59:04 -0400
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
Summary: We should only undirty cards after we decide that they are not on a young region, not before. The fix also includes improvements to the verify_dirty_region() method which print out which cards were not found dirty.
Reviewed-by: johnc, brutisso
ysr@777 | 1 | /* |
tonyp@2469 | 2 | * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. |
ysr@777 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ysr@777 | 4 | * |
ysr@777 | 5 | * This code is free software; you can redistribute it and/or modify it |
ysr@777 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ysr@777 | 7 | * published by the Free Software Foundation. |
ysr@777 | 8 | * |
ysr@777 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
ysr@777 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ysr@777 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ysr@777 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
ysr@777 | 13 | * accompanied this code). |
ysr@777 | 14 | * |
ysr@777 | 15 | * You should have received a copy of the GNU General Public License version |
ysr@777 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
ysr@777 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ysr@777 | 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. |
ysr@777 | 22 | * |
ysr@777 | 23 | */ |
ysr@777 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP |
stefank@2314 | 26 | #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "gc_implementation/g1/heapRegion.hpp" |
stefank@2314 | 29 | #include "utilities/growableArray.hpp" |
stefank@2314 | 30 | |
ysr@777 | 31 | class HeapRegion; |
ysr@777 | 32 | class HeapRegionClosure; |
ysr@777 | 33 | |
ysr@777 | 34 | class HeapRegionSeq: public CHeapObj { |
ysr@777 | 35 | |
ysr@777 | 36 | // _regions is kept sorted by start address order, and no two regions are |
ysr@777 | 37 | // overlapping. |
ysr@777 | 38 | GrowableArray<HeapRegion*> _regions; |
ysr@777 | 39 | |
ysr@777 | 40 | // The index in "_regions" at which to start the next allocation search. |
ysr@777 | 41 | // (For efficiency only; private to obj_allocate after initialization.) |
ysr@777 | 42 | int _alloc_search_start; |
ysr@777 | 43 | |
tonyp@2472 | 44 | // Finds a contiguous set of empty regions of length num, starting |
tonyp@2472 | 45 | // from a given index. |
tonyp@2472 | 46 | int find_contiguous_from(int from, size_t num); |
ysr@777 | 47 | |
ysr@777 | 48 | // Currently, we're choosing collection sets in a round-robin fashion, |
ysr@777 | 49 | // starting here. |
ysr@777 | 50 | int _next_rr_candidate; |
ysr@777 | 51 | |
ysr@777 | 52 | // The bottom address of the bottom-most region, or else NULL if there |
ysr@777 | 53 | // are no regions in the sequence. |
ysr@777 | 54 | char* _seq_bottom; |
ysr@777 | 55 | |
ysr@777 | 56 | public: |
ysr@777 | 57 | // Initializes "this" to the empty sequence of regions. |
iveresov@828 | 58 | HeapRegionSeq(const size_t max_size); |
ysr@777 | 59 | |
ysr@777 | 60 | // Adds "hr" to "this" sequence. Requires "hr" not to overlap with |
ysr@777 | 61 | // any region already in "this". (Will perform better if regions are |
ysr@777 | 62 | // inserted in ascending address order.) |
ysr@777 | 63 | void insert(HeapRegion* hr); |
ysr@777 | 64 | |
ysr@777 | 65 | // Given a HeapRegion*, returns its index within _regions, |
ysr@777 | 66 | // or returns -1 if not found. |
ysr@777 | 67 | int find(HeapRegion* hr); |
ysr@777 | 68 | |
ysr@777 | 69 | // Requires the index to be valid, and return the region at the index. |
ysr@777 | 70 | HeapRegion* at(size_t i) { return _regions.at((int)i); } |
ysr@777 | 71 | |
ysr@777 | 72 | // Return the number of regions in the sequence. |
ysr@777 | 73 | size_t length(); |
ysr@777 | 74 | |
ysr@777 | 75 | // Returns the number of contiguous regions at the end of the sequence |
ysr@777 | 76 | // that are available for allocation. |
ysr@777 | 77 | size_t free_suffix(); |
ysr@777 | 78 | |
tonyp@2643 | 79 | // Find a contiguous set of empty regions of length num and return |
tonyp@2643 | 80 | // the index of the first region or -1 if the search was unsuccessful. |
tonyp@2472 | 81 | int find_contiguous(size_t num); |
ysr@777 | 82 | |
ysr@777 | 83 | // Apply the "doHeapRegion" method of "blk" to all regions in "this", |
ysr@777 | 84 | // in address order, terminating the iteration early |
ysr@777 | 85 | // if the "doHeapRegion" method returns "true". |
ysr@777 | 86 | void iterate(HeapRegionClosure* blk); |
ysr@777 | 87 | |
ysr@777 | 88 | // Apply the "doHeapRegion" method of "blk" to all regions in "this", |
ysr@777 | 89 | // starting at "r" (or first region, if "r" is NULL), in a circular |
ysr@777 | 90 | // manner, terminating the iteration early if the "doHeapRegion" method |
ysr@777 | 91 | // returns "true". |
ysr@777 | 92 | void iterate_from(HeapRegion* r, HeapRegionClosure* blk); |
ysr@777 | 93 | |
ysr@777 | 94 | // As above, but start from a given index in the sequence |
ysr@777 | 95 | // instead of a given heap region. |
ysr@777 | 96 | void iterate_from(int idx, HeapRegionClosure* blk); |
ysr@777 | 97 | |
ysr@777 | 98 | // Requires "shrink_bytes" to be a multiple of the page size and heap |
ysr@777 | 99 | // region granularity. Deletes as many "rightmost" completely free heap |
ysr@777 | 100 | // regions from the sequence as comprise shrink_bytes bytes. Returns the |
ysr@777 | 101 | // MemRegion indicating the region those regions comprised, and sets |
ysr@777 | 102 | // "num_regions_deleted" to the number of regions deleted. |
ysr@777 | 103 | MemRegion shrink_by(size_t shrink_bytes, size_t& num_regions_deleted); |
ysr@777 | 104 | |
ysr@777 | 105 | // If "addr" falls within a region in the sequence, return that region, |
ysr@777 | 106 | // or else NULL. |
tonyp@2469 | 107 | inline HeapRegion* addr_to_region(const void* addr); |
ysr@777 | 108 | |
ysr@777 | 109 | void print(); |
ysr@777 | 110 | |
apetrusenko@1112 | 111 | // Prints out runs of empty regions. |
apetrusenko@1112 | 112 | void print_empty_runs(); |
ysr@777 | 113 | |
ysr@777 | 114 | }; |
stefank@2314 | 115 | |
stefank@2314 | 116 | #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP |