rev 10869 : [mq]: 8153170-kim-review
1 /* 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_GC_G1_G1CARDLIVEDATA_HPP 26 #define SHARE_VM_GC_G1_G1CARDLIVEDATA_HPP 27 28 #include "gc/g1/g1CollectedHeap.hpp" 29 #include "utilities/bitMap.hpp" 30 #include "utilities/globalDefinitions.hpp" 31 32 class G1CollectedHeap; 33 class G1CMBitMap; 34 class WorkGang; 35 36 // Information about object liveness on the Java heap on a "card" basis. 37 // Can be used for various purposes, like as remembered set for completely 38 // coarsened remembered sets, scrubbing remembered sets or estimating liveness. 39 // This information is created as part of the concurrent marking cycle. 40 class G1CardLiveData VALUE_OBJ_CLASS_SPEC { 41 friend class G1CardLiveDataHelper; 42 friend class G1VerifyCardLiveDataTask; 43 private: 44 typedef BitMap::bm_word_t bm_word_t; 45 // Store some additional information about the covered area to be able to test. 46 size_t _max_capacity; 47 size_t _cards_per_region; 48 49 // The per-card liveness bitmap. 50 bm_word_t* _live_cards; 51 size_t _live_cards_size_in_bits; 52 // The per-region liveness bitmap. 53 bm_word_t* _live_regions; 54 size_t _live_regions_size_in_bits; 55 // The bits in this bitmap contain for every card whether it contains 56 // at least part of at least one live object. 57 BitMap live_cards_bm() const { return BitMap(_live_cards, _live_cards_size_in_bits); } 58 // The bits in this bitmap indicate that a given region contains some live objects. 59 BitMap live_regions_bm() const { return BitMap(_live_regions, _live_regions_size_in_bits); } 60 61 // Allocate a "large" bitmap from virtual memory with the given size in bits. 62 bm_word_t* allocate_large_bitmap(size_t size_in_bits); 63 void free_large_bitmap(bm_word_t* map, size_t size_in_bits); 64 65 inline BitMap live_card_bitmap(uint region); 66 67 inline bool is_card_live_at(BitMap::idx_t idx) const; 68 69 size_t live_region_bitmap_size_in_bits() const; 70 size_t live_card_bitmap_size_in_bits() const; 71 public: 72 inline bool is_region_live(uint region) const; 73 74 inline void remove_nonlive_cards(uint region, BitMap* bm); 75 inline void remove_nonlive_regions(BitMap* bm); 76 77 G1CardLiveData(); 78 ~G1CardLiveData(); 79 80 void initialize(size_t max_capacity, uint num_max_regions); 81 void pretouch(); 82 83 // Create the initial liveness data based on the marking result from the bottom 84 // to the ntams of every region in the heap and the marks in the given bitmap. 85 void create(WorkGang* workers, G1CMBitMap* mark_bitmap); 86 // Finalize the liveness data. 87 void finalize(WorkGang* workers, G1CMBitMap* mark_bitmap); 88 89 // Verify that the liveness count data created concurrently matches one created 90 // during this safepoint. 91 void verify(WorkGang* workers, G1CMBitMap* actual_bitmap); 92 // Clear all data structures, prepare for next processing. 93 void clear(WorkGang* workers); 94 95 void verify_is_clear() PRODUCT_RETURN; 96 }; 97 98 #endif /* SHARE_VM_GC_G1_G1CARDLIVEDATA_HPP */ 99 --- EOF ---