author | jprovino |
Tue, 02 Aug 2016 16:39:33 -0400 | |
changeset 40328 | a2851f5f1cf6 |
parent 38177 | b0c9cb06506b |
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 |
#ifndef SHARE_VM_GC_G1_G1CARDLIVEDATA_HPP |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
26 |
#define SHARE_VM_GC_G1_G1CARDLIVEDATA_HPP |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
27 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
28 |
#include "gc/g1/g1CollectedHeap.hpp" |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
29 |
#include "utilities/bitMap.hpp" |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
30 |
#include "utilities/globalDefinitions.hpp" |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
31 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
32 |
class G1CollectedHeap; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
33 |
class G1CMBitMap; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
34 |
class WorkGang; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
35 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
36 |
// Information about object liveness on the Java heap on a "card" basis. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
37 |
// Can be used for various purposes, like as remembered set for completely |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
38 |
// coarsened remembered sets, scrubbing remembered sets or estimating liveness. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
39 |
// This information is created as part of the concurrent marking cycle. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
40 |
class G1CardLiveData VALUE_OBJ_CLASS_SPEC { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
41 |
friend class G1CardLiveDataHelper; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
42 |
friend class G1VerifyCardLiveDataTask; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
43 |
private: |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
44 |
typedef BitMap::bm_word_t bm_word_t; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
45 |
// Store some additional information about the covered area to be able to test. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
46 |
size_t _max_capacity; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
47 |
size_t _cards_per_region; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
48 |
|
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37414
diff
changeset
|
49 |
// Regions may be reclaimed while concurrently creating live data (e.g. due to humongous |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37414
diff
changeset
|
50 |
// eager reclaim). This results in wrong live data for these regions at the end. |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37414
diff
changeset
|
51 |
// So we need to somehow detect these regions, and during live data finalization completely |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37414
diff
changeset
|
52 |
// recreate their information. |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37414
diff
changeset
|
53 |
// This _gc_timestamp_at_create tracks the global timestamp when live data creation |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37414
diff
changeset
|
54 |
// has started. Any regions with a higher time stamp have been cleared after that |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37414
diff
changeset
|
55 |
// point in time, and need re-finalization. |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37414
diff
changeset
|
56 |
// Unsynchronized access to this variable is okay, since this value is only set during a |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37414
diff
changeset
|
57 |
// concurrent phase, and read only at the Cleanup safepoint. I.e. there is always |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37414
diff
changeset
|
58 |
// full memory synchronization inbetween. |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37414
diff
changeset
|
59 |
uint _gc_timestamp_at_create; |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
60 |
// The per-card liveness bitmap. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
61 |
bm_word_t* _live_cards; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
62 |
size_t _live_cards_size_in_bits; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
63 |
// The per-region liveness bitmap. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
64 |
bm_word_t* _live_regions; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
65 |
size_t _live_regions_size_in_bits; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
66 |
// The bits in this bitmap contain for every card whether it contains |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
67 |
// at least part of at least one live object. |
38177 | 68 |
BitMapView live_cards_bm() const { return BitMapView(_live_cards, _live_cards_size_in_bits); } |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
69 |
// The bits in this bitmap indicate that a given region contains some live objects. |
38177 | 70 |
BitMapView live_regions_bm() const { return BitMapView(_live_regions, _live_regions_size_in_bits); } |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
71 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
72 |
// Allocate a "large" bitmap from virtual memory with the given size in bits. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
73 |
bm_word_t* allocate_large_bitmap(size_t size_in_bits); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
74 |
void free_large_bitmap(bm_word_t* map, size_t size_in_bits); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
75 |
|
38177 | 76 |
inline BitMapView live_card_bitmap(uint region); |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
77 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
78 |
inline bool is_card_live_at(BitMap::idx_t idx) const; |
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 |
size_t live_region_bitmap_size_in_bits() const; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
81 |
size_t live_card_bitmap_size_in_bits() const; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
82 |
public: |
37989
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37414
diff
changeset
|
83 |
uint gc_timestamp_at_create() const { return _gc_timestamp_at_create; } |
e0a0f4de45c4
8153170: Card Live Data does not correctly handle eager reclaim
tschatzl
parents:
37414
diff
changeset
|
84 |
|
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
85 |
inline bool is_region_live(uint region) const; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
86 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
87 |
inline void remove_nonlive_cards(uint region, BitMap* bm); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
88 |
inline void remove_nonlive_regions(BitMap* bm); |
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 |
G1CardLiveData(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
91 |
~G1CardLiveData(); |
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 |
void initialize(size_t max_capacity, uint num_max_regions); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
94 |
void pretouch(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
95 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
96 |
// Create the initial liveness data based on the marking result from the bottom |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
97 |
// to the ntams of every region in the heap and the marks in the given bitmap. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
98 |
void create(WorkGang* workers, G1CMBitMap* mark_bitmap); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
99 |
// Finalize the liveness data. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
100 |
void finalize(WorkGang* workers, G1CMBitMap* mark_bitmap); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
101 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
102 |
// Verify that the liveness count data created concurrently matches one created |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
103 |
// during this safepoint. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
104 |
void verify(WorkGang* workers, G1CMBitMap* actual_bitmap); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
105 |
// Clear all data structures, prepare for next processing. |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
106 |
void clear(WorkGang* workers); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
107 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
108 |
void verify_is_clear() PRODUCT_RETURN; |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
109 |
}; |
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 |
#endif /* SHARE_VM_GC_G1_G1CARDLIVEDATA_HPP */ |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
diff
changeset
|
112 |