author | kbarrett |
Tue, 30 Aug 2016 23:48:16 -0400 | |
changeset 40892 | 330a02d935ad |
parent 40655 | 9f644073d3a0 |
child 46618 | d503911aa948 |
permissions | -rw-r--r-- |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
1 |
/* |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
4 |
* |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
8 |
* |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
13 |
* accompanied this code). |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
14 |
* |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
18 |
* |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
21 |
* questions. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
22 |
* |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
23 |
*/ |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
24 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
26 |
#include "gc/g1/g1CollectedHeap.inline.hpp" |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
27 |
#include "gc/g1/g1ConcurrentMark.inline.hpp" |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
28 |
#include "gc/g1/g1CardLiveData.inline.hpp" |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
29 |
#include "gc/g1/suspendibleThreadSet.hpp" |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
30 |
#include "gc/shared/workgroup.hpp" |
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
31 |
#include "logging/log.hpp" |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
32 |
#include "memory/universe.hpp" |
40655
9f644073d3a0
8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents:
38177
diff
changeset
|
33 |
#include "runtime/atomic.hpp" |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
34 |
#include "runtime/globals.hpp" |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
35 |
#include "runtime/os.hpp" |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
36 |
#include "utilities/bitMap.inline.hpp" |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
37 |
#include "utilities/debug.hpp" |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
38 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
39 |
G1CardLiveData::G1CardLiveData() : |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
40 |
_max_capacity(0), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
41 |
_cards_per_region(0), |
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
42 |
_gc_timestamp_at_create(0), |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
43 |
_live_regions(NULL), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
44 |
_live_regions_size_in_bits(0), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
45 |
_live_cards(NULL), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
46 |
_live_cards_size_in_bits(0) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
47 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
48 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
49 |
G1CardLiveData::~G1CardLiveData() { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
50 |
free_large_bitmap(_live_cards, _live_cards_size_in_bits); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
51 |
free_large_bitmap(_live_regions, _live_regions_size_in_bits); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
52 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
53 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
54 |
G1CardLiveData::bm_word_t* G1CardLiveData::allocate_large_bitmap(size_t size_in_bits) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
55 |
size_t size_in_words = BitMap::calc_size_in_words(size_in_bits); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
56 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
57 |
bm_word_t* map = MmapArrayAllocator<bm_word_t, mtGC>::allocate(size_in_words); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
58 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
59 |
return map; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
60 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
61 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
62 |
void G1CardLiveData::free_large_bitmap(bm_word_t* bitmap, size_t size_in_bits) { |
38061
5fe046aef3b9
8154838: G1CardLiveData::free_large_bitmap() uses wrong calculation to determine the number of words
tschatzl
parents:
37989
diff
changeset
|
63 |
MmapArrayAllocator<bm_word_t, mtGC>::free(bitmap, BitMap::calc_size_in_words(size_in_bits)); |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
64 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
65 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
66 |
void G1CardLiveData::initialize(size_t max_capacity, uint num_max_regions) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
67 |
assert(max_capacity % num_max_regions == 0, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
68 |
"Given capacity must be evenly divisible by region size."); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
69 |
size_t region_size = max_capacity / num_max_regions; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
70 |
assert(region_size % (G1SATBCardTableModRefBS::card_size * BitsPerWord) == 0, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
71 |
"Region size must be evenly divisible by area covered by a single word."); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
72 |
_max_capacity = max_capacity; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
73 |
_cards_per_region = region_size / G1SATBCardTableModRefBS::card_size; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
74 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
75 |
_live_regions_size_in_bits = live_region_bitmap_size_in_bits(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
76 |
_live_regions = allocate_large_bitmap(_live_regions_size_in_bits); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
77 |
_live_cards_size_in_bits = live_card_bitmap_size_in_bits(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
78 |
_live_cards = allocate_large_bitmap(_live_cards_size_in_bits); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
79 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
80 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
81 |
void G1CardLiveData::pretouch() { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
82 |
live_cards_bm().pretouch(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
83 |
live_regions_bm().pretouch(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
84 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
85 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
86 |
size_t G1CardLiveData::live_region_bitmap_size_in_bits() const { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
87 |
return _max_capacity / (_cards_per_region << G1SATBCardTableModRefBS::card_shift); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
88 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
89 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
90 |
size_t G1CardLiveData::live_card_bitmap_size_in_bits() const { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
91 |
return _max_capacity >> G1SATBCardTableModRefBS::card_shift; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
92 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
93 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
94 |
// Helper class that provides functionality to generate the Live Data Count |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
95 |
// information. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
96 |
class G1CardLiveDataHelper VALUE_OBJ_CLASS_SPEC { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
97 |
private: |
38177 | 98 |
BitMapView _region_bm; |
99 |
BitMapView _card_bm; |
|
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
100 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
101 |
// The card number of the bottom of the G1 heap. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
102 |
// Used in biasing indices into accounting card bitmaps. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
103 |
BitMap::idx_t _heap_card_bias; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
104 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
105 |
// Utility routine to set an exclusive range of bits on the given |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
106 |
// bitmap, optimized for very small ranges. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
107 |
// There must be at least one bit to set. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
108 |
void set_card_bitmap_range(BitMap::idx_t start_idx, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
109 |
BitMap::idx_t end_idx) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
110 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
111 |
// Set the exclusive bit range [start_idx, end_idx). |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
112 |
assert((end_idx - start_idx) > 0, "at least one bit"); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
113 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
114 |
// For small ranges use a simple loop; otherwise use set_range. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
115 |
// The range is made up of the cards that are spanned by an object/mem |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
116 |
// region so 8 cards will allow up to object sizes up to 4K to be handled |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
117 |
// using the loop. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
118 |
if ((end_idx - start_idx) <= 8) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
119 |
for (BitMap::idx_t i = start_idx; i < end_idx; i += 1) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
120 |
_card_bm.set_bit(i); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
121 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
122 |
} else { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
123 |
_card_bm.set_range(start_idx, end_idx); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
124 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
125 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
126 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
127 |
// We cache the last mark set. This avoids setting the same bit multiple times. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
128 |
// This is particularly interesting for dense bitmaps, as this avoids doing |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
129 |
// lots of work most of the time. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
130 |
BitMap::idx_t _last_marked_bit_idx; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
131 |
|
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
132 |
void clear_card_bitmap_range(HeapWord* start, HeapWord* end) { |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
133 |
BitMap::idx_t start_idx = card_live_bitmap_index_for(start); |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
134 |
BitMap::idx_t end_idx = card_live_bitmap_index_for((HeapWord*)align_ptr_up(end, CardTableModRefBS::card_size)); |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
135 |
|
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
136 |
_card_bm.clear_range(start_idx, end_idx); |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
137 |
} |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
138 |
|
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
139 |
// Mark the card liveness bitmap for the object spanning from start to end. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
140 |
void mark_card_bitmap_range(HeapWord* start, HeapWord* end) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
141 |
BitMap::idx_t start_idx = card_live_bitmap_index_for(start); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
142 |
BitMap::idx_t end_idx = card_live_bitmap_index_for((HeapWord*)align_ptr_up(end, CardTableModRefBS::card_size)); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
143 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
144 |
assert((end_idx - start_idx) > 0, "Trying to mark zero sized range."); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
145 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
146 |
if (start_idx == _last_marked_bit_idx) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
147 |
start_idx++; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
148 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
149 |
if (start_idx == end_idx) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
150 |
return; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
151 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
152 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
153 |
// Set the bits in the card bitmap for the cards spanned by this object. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
154 |
set_card_bitmap_range(start_idx, end_idx); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
155 |
_last_marked_bit_idx = end_idx - 1; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
156 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
157 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
158 |
void reset_mark_cache() { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
159 |
_last_marked_bit_idx = (BitMap::idx_t)-1; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
160 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
161 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
162 |
public: |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
163 |
// Returns the index in the per-card liveness count bitmap |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
164 |
// for the given address |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
165 |
inline BitMap::idx_t card_live_bitmap_index_for(HeapWord* addr) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
166 |
// Below, the term "card num" means the result of shifting an address |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
167 |
// by the card shift -- address 0 corresponds to card number 0. One |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
168 |
// must subtract the card num of the bottom of the heap to obtain a |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
169 |
// card table index. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
170 |
BitMap::idx_t card_num = uintptr_t(addr) >> CardTableModRefBS::card_shift; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
171 |
return card_num - _heap_card_bias; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
172 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
173 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
174 |
// Takes a region that's not empty (i.e., it has at least one |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
175 |
// live object in it and sets its corresponding bit on the region |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
176 |
// bitmap to 1. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
177 |
void set_bit_for_region(HeapRegion* hr) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
178 |
_region_bm.par_set_bit(hr->hrm_index()); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
179 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
180 |
|
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
181 |
void reset_live_data(HeapRegion* hr) { |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
182 |
clear_card_bitmap_range(hr->next_top_at_mark_start(), hr->end()); |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
183 |
} |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
184 |
|
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
185 |
// Mark the range of bits covered by allocations done since the last marking |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
186 |
// in the given heap region, i.e. from NTAMS to top of the given region. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
187 |
// Returns if there has been some allocation in this region since the last marking. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
188 |
bool mark_allocated_since_marking(HeapRegion* hr) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
189 |
reset_mark_cache(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
190 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
191 |
HeapWord* ntams = hr->next_top_at_mark_start(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
192 |
HeapWord* top = hr->top(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
193 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
194 |
assert(hr->bottom() <= ntams && ntams <= hr->end(), "Preconditions."); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
195 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
196 |
// Mark the allocated-since-marking portion... |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
197 |
if (ntams < top) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
198 |
mark_card_bitmap_range(ntams, top); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
199 |
return true; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
200 |
} else { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
201 |
return false; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
202 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
203 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
204 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
205 |
// Mark the range of bits covered by live objects on the mark bitmap between |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
206 |
// bottom and NTAMS of the given region. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
207 |
// Returns the number of live bytes marked within that area for the given |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
208 |
// heap region. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
209 |
size_t mark_marked_during_marking(G1CMBitMap* mark_bitmap, HeapRegion* hr) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
210 |
reset_mark_cache(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
211 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
212 |
size_t marked_bytes = 0; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
213 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
214 |
HeapWord* ntams = hr->next_top_at_mark_start(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
215 |
HeapWord* start = hr->bottom(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
216 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
217 |
if (ntams <= start) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
218 |
// Skip empty regions. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
219 |
return 0; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
220 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
221 |
if (hr->is_humongous()) { |
37471
6ba3e52c2bd6
8153843: G1CardLiveDataHelper incorrectly sets next_live_bytes on dead humongous regions
mgerdin
parents:
37414
diff
changeset
|
222 |
HeapRegion* start_region = hr->humongous_start_region(); |
6ba3e52c2bd6
8153843: G1CardLiveDataHelper incorrectly sets next_live_bytes on dead humongous regions
mgerdin
parents:
37414
diff
changeset
|
223 |
if (mark_bitmap->isMarked(start_region->bottom())) { |
6ba3e52c2bd6
8153843: G1CardLiveDataHelper incorrectly sets next_live_bytes on dead humongous regions
mgerdin
parents:
37414
diff
changeset
|
224 |
mark_card_bitmap_range(start, hr->top()); |
6ba3e52c2bd6
8153843: G1CardLiveDataHelper incorrectly sets next_live_bytes on dead humongous regions
mgerdin
parents:
37414
diff
changeset
|
225 |
return pointer_delta(hr->top(), start, 1); |
6ba3e52c2bd6
8153843: G1CardLiveDataHelper incorrectly sets next_live_bytes on dead humongous regions
mgerdin
parents:
37414
diff
changeset
|
226 |
} else { |
6ba3e52c2bd6
8153843: G1CardLiveDataHelper incorrectly sets next_live_bytes on dead humongous regions
mgerdin
parents:
37414
diff
changeset
|
227 |
// Humongous start object was actually dead. |
6ba3e52c2bd6
8153843: G1CardLiveDataHelper incorrectly sets next_live_bytes on dead humongous regions
mgerdin
parents:
37414
diff
changeset
|
228 |
return 0; |
6ba3e52c2bd6
8153843: G1CardLiveDataHelper incorrectly sets next_live_bytes on dead humongous regions
mgerdin
parents:
37414
diff
changeset
|
229 |
} |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
230 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
231 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
232 |
assert(start <= hr->end() && start <= ntams && ntams <= hr->end(), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
233 |
"Preconditions not met - " |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
234 |
"start: " PTR_FORMAT ", ntams: " PTR_FORMAT ", end: " PTR_FORMAT, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
235 |
p2i(start), p2i(ntams), p2i(hr->end())); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
236 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
237 |
// Find the first marked object at or after "start". |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
238 |
start = mark_bitmap->getNextMarkedWordAddress(start, ntams); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
239 |
while (start < ntams) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
240 |
oop obj = oop(start); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
241 |
size_t obj_size = obj->size(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
242 |
HeapWord* obj_end = start + obj_size; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
243 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
244 |
assert(obj_end <= hr->end(), "Humongous objects must have been handled elsewhere."); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
245 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
246 |
mark_card_bitmap_range(start, obj_end); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
247 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
248 |
// Add the size of this object to the number of marked bytes. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
249 |
marked_bytes += obj_size * HeapWordSize; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
250 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
251 |
// Find the next marked object after this one. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
252 |
start = mark_bitmap->getNextMarkedWordAddress(obj_end, ntams); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
253 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
254 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
255 |
return marked_bytes; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
256 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
257 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
258 |
G1CardLiveDataHelper(G1CardLiveData* live_data, HeapWord* base_address) : |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
259 |
_region_bm(live_data->live_regions_bm()), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
260 |
_card_bm(live_data->live_cards_bm()) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
261 |
// Calculate the card number for the bottom of the heap. Used |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
262 |
// in biasing indexes into the accounting card bitmaps. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
263 |
_heap_card_bias = |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
264 |
uintptr_t(base_address) >> CardTableModRefBS::card_shift; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
265 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
266 |
}; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
267 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
268 |
class G1CreateCardLiveDataTask: public AbstractGangTask { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
269 |
// Aggregate the counting data that was constructed concurrently |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
270 |
// with marking. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
271 |
class G1CreateLiveDataClosure : public HeapRegionClosure { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
272 |
G1CardLiveDataHelper _helper; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
273 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
274 |
G1CMBitMap* _mark_bitmap; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
275 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
276 |
G1ConcurrentMark* _cm; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
277 |
public: |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
278 |
G1CreateLiveDataClosure(G1CollectedHeap* g1h, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
279 |
G1ConcurrentMark* cm, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
280 |
G1CMBitMap* mark_bitmap, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
281 |
G1CardLiveData* live_data) : |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
282 |
HeapRegionClosure(), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
283 |
_helper(live_data, g1h->reserved_region().start()), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
284 |
_mark_bitmap(mark_bitmap), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
285 |
_cm(cm) { } |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
286 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
287 |
bool doHeapRegion(HeapRegion* hr) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
288 |
size_t marked_bytes = _helper.mark_marked_during_marking(_mark_bitmap, hr); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
289 |
if (marked_bytes > 0) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
290 |
hr->add_to_marked_bytes(marked_bytes); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
291 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
292 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
293 |
return (_cm->do_yield_check() && _cm->has_aborted()); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
294 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
295 |
}; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
296 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
297 |
G1ConcurrentMark* _cm; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
298 |
G1CardLiveData* _live_data; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
299 |
HeapRegionClaimer _hr_claimer; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
300 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
301 |
public: |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
302 |
G1CreateCardLiveDataTask(G1CMBitMap* bitmap, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
303 |
G1CardLiveData* live_data, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
304 |
uint n_workers) : |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
305 |
AbstractGangTask("G1 Create Live Data"), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
306 |
_live_data(live_data), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
307 |
_hr_claimer(n_workers) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
308 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
309 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
310 |
void work(uint worker_id) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
311 |
SuspendibleThreadSetJoiner sts_join; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
312 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
313 |
G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
314 |
G1ConcurrentMark* cm = g1h->concurrent_mark(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
315 |
G1CreateLiveDataClosure cl(g1h, cm, cm->nextMarkBitMap(), _live_data); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
316 |
g1h->heap_region_par_iterate(&cl, worker_id, &_hr_claimer); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
317 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
318 |
}; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
319 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
320 |
void G1CardLiveData::create(WorkGang* workers, G1CMBitMap* mark_bitmap) { |
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
321 |
_gc_timestamp_at_create = G1CollectedHeap::heap()->get_gc_time_stamp(); |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
322 |
|
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
323 |
uint n_workers = workers->active_workers(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
324 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
325 |
G1CreateCardLiveDataTask cl(mark_bitmap, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
326 |
this, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
327 |
n_workers); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
328 |
workers->run_task(&cl); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
329 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
330 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
331 |
class G1FinalizeCardLiveDataTask: public AbstractGangTask { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
332 |
// Finalizes the liveness counting data. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
333 |
// Sets the bits corresponding to the interval [NTAMS, top] |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
334 |
// (which contains the implicitly live objects) in the |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
335 |
// card liveness bitmap. Also sets the bit for each region |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
336 |
// containing live data, in the region liveness bitmap. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
337 |
class G1FinalizeCardLiveDataClosure: public HeapRegionClosure { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
338 |
private: |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
339 |
G1CardLiveDataHelper _helper; |
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
340 |
|
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
341 |
uint _gc_timestamp_at_create; |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
342 |
|
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
343 |
bool has_been_reclaimed(HeapRegion* hr) const { |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
344 |
return hr->get_gc_time_stamp() > _gc_timestamp_at_create; |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
345 |
} |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
346 |
public: |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
347 |
G1FinalizeCardLiveDataClosure(G1CollectedHeap* g1h, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
348 |
G1CMBitMap* bitmap, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
349 |
G1CardLiveData* live_data) : |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
350 |
HeapRegionClosure(), |
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
351 |
_helper(live_data, g1h->reserved_region().start()), |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
352 |
_gc_timestamp_at_create(live_data->gc_timestamp_at_create()) { } |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
353 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
354 |
bool doHeapRegion(HeapRegion* hr) { |
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
355 |
if (has_been_reclaimed(hr)) { |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
356 |
_helper.reset_live_data(hr); |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
357 |
} |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
358 |
bool allocated_since_marking = _helper.mark_allocated_since_marking(hr); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
359 |
if (allocated_since_marking || hr->next_marked_bytes() > 0) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
360 |
_helper.set_bit_for_region(hr); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
361 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
362 |
return false; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
363 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
364 |
}; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
365 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
366 |
G1CMBitMap* _bitmap; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
367 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
368 |
G1CardLiveData* _live_data; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
369 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
370 |
HeapRegionClaimer _hr_claimer; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
371 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
372 |
public: |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
373 |
G1FinalizeCardLiveDataTask(G1CMBitMap* bitmap, G1CardLiveData* live_data, uint n_workers) : |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
374 |
AbstractGangTask("G1 Finalize Card Live Data"), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
375 |
_bitmap(bitmap), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
376 |
_live_data(live_data), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
377 |
_hr_claimer(n_workers) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
378 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
379 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
380 |
void work(uint worker_id) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
381 |
G1FinalizeCardLiveDataClosure cl(G1CollectedHeap::heap(), _bitmap, _live_data); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
382 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
383 |
G1CollectedHeap::heap()->heap_region_par_iterate(&cl, worker_id, &_hr_claimer); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
384 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
385 |
}; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
386 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
387 |
void G1CardLiveData::finalize(WorkGang* workers, G1CMBitMap* mark_bitmap) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
388 |
// Finalize the live data. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
389 |
G1FinalizeCardLiveDataTask cl(mark_bitmap, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
390 |
this, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
391 |
workers->active_workers()); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
392 |
workers->run_task(&cl); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
393 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
394 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
395 |
class G1ClearCardLiveDataTask : public AbstractGangTask { |
38177 | 396 |
BitMapView _bitmap; |
397 |
size_t _num_chunks; |
|
398 |
size_t _cur_chunk; |
|
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
399 |
public: |
38177 | 400 |
G1ClearCardLiveDataTask(const BitMapView& bitmap, size_t num_tasks) : |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
401 |
AbstractGangTask("G1 Clear Card Live Data"), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
402 |
_bitmap(bitmap), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
403 |
_num_chunks(num_tasks), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
404 |
_cur_chunk(0) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
405 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
406 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
407 |
static size_t chunk_size() { return M; } |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
408 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
409 |
virtual void work(uint worker_id) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
410 |
while (true) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
411 |
size_t to_process = Atomic::add(1, &_cur_chunk) - 1; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
412 |
if (to_process >= _num_chunks) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
413 |
break; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
414 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
415 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
416 |
BitMap::idx_t start = M * BitsPerByte * to_process; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
417 |
BitMap::idx_t end = MIN2(start + M * BitsPerByte, _bitmap.size()); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
418 |
_bitmap.clear_range(start, end); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
419 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
420 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
421 |
}; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
422 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
423 |
void G1CardLiveData::clear(WorkGang* workers) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
424 |
guarantee(Universe::is_fully_initialized(), "Should not call this during initialization."); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
425 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
426 |
size_t const num_chunks = align_size_up(live_cards_bm().size_in_bytes(), G1ClearCardLiveDataTask::chunk_size()) / G1ClearCardLiveDataTask::chunk_size(); |
38157
49d65a3ea6b6
8155229: Tune thread usage for live data clearing
tschatzl
parents:
38061
diff
changeset
|
427 |
uint const num_workers = (uint)MIN2(num_chunks, (size_t)workers->active_workers()); |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
428 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
429 |
G1ClearCardLiveDataTask cl(live_cards_bm(), num_chunks); |
38157
49d65a3ea6b6
8155229: Tune thread usage for live data clearing
tschatzl
parents:
38061
diff
changeset
|
430 |
|
49d65a3ea6b6
8155229: Tune thread usage for live data clearing
tschatzl
parents:
38061
diff
changeset
|
431 |
log_debug(gc, ergo)("Running %s using %u workers for " SIZE_FORMAT " work units.", cl.name(), num_workers, num_chunks); |
49d65a3ea6b6
8155229: Tune thread usage for live data clearing
tschatzl
parents:
38061
diff
changeset
|
432 |
workers->run_task(&cl, num_workers); |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
433 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
434 |
// The region live bitmap is always very small, even for huge heaps. Clear |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
435 |
// directly. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
436 |
live_regions_bm().clear(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
437 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
438 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
439 |
class G1VerifyCardLiveDataTask: public AbstractGangTask { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
440 |
// Heap region closure used for verifying the live count data |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
441 |
// that was created concurrently and finalized during |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
442 |
// the remark pause. This closure is applied to the heap |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
443 |
// regions during the STW cleanup pause. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
444 |
class G1VerifyCardLiveDataClosure: public HeapRegionClosure { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
445 |
private: |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
446 |
G1CollectedHeap* _g1h; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
447 |
G1CMBitMap* _mark_bitmap; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
448 |
G1CardLiveDataHelper _helper; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
449 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
450 |
G1CardLiveData* _act_live_data; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
451 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
452 |
G1CardLiveData* _exp_live_data; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
453 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
454 |
int _failures; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
455 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
456 |
// Completely recreates the live data count for the given heap region and |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
457 |
// returns the number of bytes marked. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
458 |
size_t create_live_data_count(HeapRegion* hr) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
459 |
size_t bytes_marked = _helper.mark_marked_during_marking(_mark_bitmap, hr); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
460 |
bool allocated_since_marking = _helper.mark_allocated_since_marking(hr); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
461 |
if (allocated_since_marking || bytes_marked > 0) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
462 |
_helper.set_bit_for_region(hr); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
463 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
464 |
return bytes_marked; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
465 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
466 |
public: |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
467 |
G1VerifyCardLiveDataClosure(G1CollectedHeap* g1h, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
468 |
G1CMBitMap* mark_bitmap, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
469 |
G1CardLiveData* act_live_data, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
470 |
G1CardLiveData* exp_live_data) : |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
471 |
_g1h(g1h), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
472 |
_mark_bitmap(mark_bitmap), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
473 |
_helper(exp_live_data, g1h->reserved_region().start()), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
474 |
_act_live_data(act_live_data), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
475 |
_exp_live_data(exp_live_data), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
476 |
_failures(0) { } |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
477 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
478 |
int failures() const { return _failures; } |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
479 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
480 |
bool doHeapRegion(HeapRegion* hr) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
481 |
int failures = 0; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
482 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
483 |
// Walk the marking bitmap for this region and set the corresponding bits |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
484 |
// in the expected region and card bitmaps. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
485 |
size_t exp_marked_bytes = create_live_data_count(hr); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
486 |
size_t act_marked_bytes = hr->next_marked_bytes(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
487 |
// Verify the marked bytes for this region. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
488 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
489 |
if (exp_marked_bytes != act_marked_bytes) { |
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
490 |
log_error(gc)("Expected marked bytes " SIZE_FORMAT " != actual marked bytes " SIZE_FORMAT " in region %u", exp_marked_bytes, act_marked_bytes, hr->hrm_index()); |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
491 |
failures += 1; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
492 |
} else if (exp_marked_bytes > HeapRegion::GrainBytes) { |
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
493 |
log_error(gc)("Expected marked bytes " SIZE_FORMAT " larger than possible " SIZE_FORMAT " in region %u", exp_marked_bytes, HeapRegion::GrainBytes, hr->hrm_index()); |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
494 |
failures += 1; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
495 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
496 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
497 |
// Verify the bit, for this region, in the actual and expected |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
498 |
// (which was just calculated) region bit maps. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
499 |
uint index = hr->hrm_index(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
500 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
501 |
bool expected = _exp_live_data->is_region_live(index); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
502 |
bool actual = _act_live_data->is_region_live(index); |
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
503 |
if (expected != actual) { |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
504 |
log_error(gc)("Expected liveness %d not equal actual %d in region %u", expected, actual, hr->hrm_index()); |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
505 |
failures += 1; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
506 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
507 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
508 |
// Verify that the card bit maps for the cards spanned by the current |
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
509 |
// region match. |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
510 |
BitMap::idx_t start_idx = _helper.card_live_bitmap_index_for(hr->bottom()); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
511 |
BitMap::idx_t end_idx = _helper.card_live_bitmap_index_for(hr->top()); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
512 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
513 |
for (BitMap::idx_t i = start_idx; i < end_idx; i+=1) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
514 |
expected = _exp_live_data->is_card_live_at(i); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
515 |
actual = _act_live_data->is_card_live_at(i); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
516 |
|
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
517 |
if (expected != actual) { |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37471
diff
changeset
|
518 |
log_error(gc)("Expected card liveness %d not equal actual card liveness %d at card " SIZE_FORMAT " in region %u", expected, actual, i, hr->hrm_index()); |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
519 |
failures += 1; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
520 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
521 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
522 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
523 |
_failures += failures; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
524 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
525 |
// We could stop iteration over the heap when we |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
526 |
// find the first violating region by returning true. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
527 |
return false; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
528 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
529 |
}; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
530 |
protected: |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
531 |
G1CollectedHeap* _g1h; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
532 |
G1CMBitMap* _mark_bitmap; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
533 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
534 |
G1CardLiveData* _act_live_data; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
535 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
536 |
G1CardLiveData _exp_live_data; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
537 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
538 |
int _failures; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
539 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
540 |
HeapRegionClaimer _hr_claimer; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
541 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
542 |
public: |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
543 |
G1VerifyCardLiveDataTask(G1CMBitMap* bitmap, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
544 |
G1CardLiveData* act_live_data, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
545 |
uint n_workers) |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
546 |
: AbstractGangTask("G1 Verify Card Live Data"), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
547 |
_g1h(G1CollectedHeap::heap()), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
548 |
_mark_bitmap(bitmap), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
549 |
_act_live_data(act_live_data), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
550 |
_exp_live_data(), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
551 |
_failures(0), |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
552 |
_hr_claimer(n_workers) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
553 |
assert(VerifyDuringGC, "don't call this otherwise"); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
554 |
_exp_live_data.initialize(_g1h->max_capacity(), _g1h->max_regions()); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
555 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
556 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
557 |
void work(uint worker_id) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
558 |
G1VerifyCardLiveDataClosure cl(_g1h, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
559 |
_mark_bitmap, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
560 |
_act_live_data, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
561 |
&_exp_live_data); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
562 |
_g1h->heap_region_par_iterate(&cl, worker_id, &_hr_claimer); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
563 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
564 |
Atomic::add(cl.failures(), &_failures); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
565 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
566 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
567 |
int failures() const { return _failures; } |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
568 |
}; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
569 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
570 |
void G1CardLiveData::verify(WorkGang* workers, G1CMBitMap* actual_bitmap) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
571 |
ResourceMark rm; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
572 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
573 |
G1VerifyCardLiveDataTask cl(actual_bitmap, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
574 |
this, |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
575 |
workers->active_workers()); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
576 |
workers->run_task(&cl); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
577 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
578 |
guarantee(cl.failures() == 0, "Unexpected accounting failures"); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
579 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
580 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
581 |
#ifndef PRODUCT |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
582 |
void G1CardLiveData::verify_is_clear() { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
583 |
assert(live_cards_bm().count_one_bits() == 0, "Live cards bitmap must be clear."); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
584 |
assert(live_regions_bm().count_one_bits() == 0, "Live regions bitmap must be clear."); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
585 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
586 |
#endif |