Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/gc/shared/cardTableRS.hpp
40957 views
1
/*
2
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*
23
*/
24
25
#ifndef SHARE_GC_SHARED_CARDTABLERS_HPP
26
#define SHARE_GC_SHARED_CARDTABLERS_HPP
27
28
#include "gc/shared/cardTable.hpp"
29
#include "memory/memRegion.hpp"
30
#include "oops/oop.hpp"
31
32
class DirtyCardToOopClosure;
33
class Generation;
34
class Space;
35
36
// This RemSet uses a card table both as shared data structure
37
// for a mod ref barrier set and for the rem set information.
38
39
class CardTableRS : public CardTable {
40
friend class VMStructs;
41
// Below are private classes used in impl.
42
friend class VerifyCTSpaceClosure;
43
friend class ClearNoncleanCardWrapper;
44
45
void verify_space(Space* s, HeapWord* gen_start);
46
47
public:
48
CardTableRS(MemRegion whole_heap);
49
50
void younger_refs_in_space_iterate(Space* sp, HeapWord* gen_boundary, OopIterateClosure* cl);
51
52
virtual void verify_used_region_at_save_marks(Space* sp) const NOT_DEBUG_RETURN;
53
54
void inline_write_ref_field_gc(void* field) {
55
CardValue* byte = byte_for(field);
56
*byte = dirty_card_val();
57
}
58
59
bool is_aligned(HeapWord* addr) {
60
return is_card_aligned(addr);
61
}
62
63
void verify();
64
void initialize();
65
66
void clear_into_younger(Generation* old_gen);
67
68
void invalidate_or_clear(Generation* old_gen);
69
70
// Iterate over the portion of the card-table which covers the given
71
// region mr in the given space and apply cl to any dirty sub-regions
72
// of mr. Clears the dirty cards as they are processed.
73
void non_clean_card_iterate(Space* sp,
74
HeapWord* gen_boundary,
75
MemRegion mr,
76
OopIterateClosure* cl,
77
CardTableRS* ct);
78
79
virtual bool is_in_young(oop obj) const;
80
};
81
82
class ClearNoncleanCardWrapper: public MemRegionClosure {
83
DirtyCardToOopClosure* _dirty_card_closure;
84
CardTableRS* _ct;
85
86
public:
87
88
typedef CardTable::CardValue CardValue;
89
private:
90
// Clears the given card, return true if the corresponding card should be
91
// processed.
92
inline bool clear_card(CardValue* entry);
93
// check alignment of pointer
94
bool is_word_aligned(CardValue* entry);
95
96
public:
97
ClearNoncleanCardWrapper(DirtyCardToOopClosure* dirty_card_closure, CardTableRS* ct);
98
void do_MemRegion(MemRegion mr);
99
};
100
101
#endif // SHARE_GC_SHARED_CARDTABLERS_HPP
102
103