Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_stats/CopyForwardStats.hpp
5986 views
1
2
/*******************************************************************************
3
* Copyright (c) 1991, 2021 IBM Corp. and others
4
*
5
* This program and the accompanying materials are made available under
6
* the terms of the Eclipse Public License 2.0 which accompanies this
7
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
8
* or the Apache License, Version 2.0 which accompanies this distribution and
9
* is available at https://www.apache.org/licenses/LICENSE-2.0.
10
*
11
* This Source Code may also be made available under the following
12
* Secondary Licenses when the conditions for such availability set
13
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
14
* General Public License, version 2 with the GNU Classpath
15
* Exception [1] and GNU General Public License, version 2 with the
16
* OpenJDK Assembly Exception [2].
17
*
18
* [1] https://www.gnu.org/software/classpath/license.html
19
* [2] http://openjdk.java.net/legal/assembly-exception.html
20
*
21
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
22
*******************************************************************************/
23
24
/**
25
* @file
26
* @ingroup GC_Stats
27
*/
28
29
#if !defined(COPYFORWARDSTATS_HPP_)
30
#define COPYFORWARDSTATS_HPP_
31
32
#include "CopyForwardStatsCore.hpp"
33
#include "j9cfg.h"
34
#include "j9comp.h"
35
#include "j9port.h"
36
#include "modronbase.h"
37
#include "modronopt.h"
38
39
#if defined(J9VM_GC_VLHGC)
40
41
#include "ReferenceStats.hpp"
42
43
/**
44
* Storage for statistics relevant to a copy forward collector.
45
* @ingroup GC_Stats
46
*/
47
class MM_CopyForwardStats : public MM_CopyForwardStatsCore
48
{
49
/*
50
* Data members
51
*/
52
public:
53
/* The below stats include both marked and copied cases */
54
uintptr_t _unfinalizedCandidates; /**< unfinalized objects that are candidates to be finalized visited this cycle */
55
uintptr_t _unfinalizedEnqueued; /**< unfinalized objects that are enqueued during this cycle (MUST be less than or equal _unfinalizedCandidates) */
56
57
uintptr_t _ownableSynchronizerCandidates; /**< number of ownable synchronizer objects visited this cycle */
58
uintptr_t _ownableSynchronizerSurvived; /**< number of ownable synchronizer objects survived this cycle */
59
60
MM_ReferenceStats _weakReferenceStats; /**< Weak reference stats for the cycle */
61
MM_ReferenceStats _softReferenceStats; /**< Soft reference stats for the cycle */
62
MM_ReferenceStats _phantomReferenceStats; /**< Phantom reference stats for the cycle */
63
64
uintptr_t _stringConstantsCleared; /**< The number of string constants that have been cleared during marking */
65
uintptr_t _stringConstantsCandidates; /**< The number of string constants that have been visited in string table during marking */
66
67
uintptr_t _monitorReferenceCleared; /**< The number of monitor references that have been cleared during marking */
68
uintptr_t _monitorReferenceCandidates; /**< The number of monitor references that have been visited in monitor table during marking */
69
70
#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)
71
uintptr_t _doubleMappedArrayletsCleared; /**< The number of double mapped arraylets that have been cleared durign marking */
72
uintptr_t _doubleMappedArrayletsCandidates; /**< The number of double mapped arraylets that have been visited during marking */
73
#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */
74
75
uint64_t _cycleStartTime; /**< The start time of a copy forward cycle */
76
77
private:
78
79
/*
80
* Function members
81
*/
82
public:
83
84
MMINLINE void clear() {
85
86
MM_CopyForwardStatsCore::clear();
87
88
_unfinalizedCandidates = 0;
89
_unfinalizedEnqueued = 0;
90
91
_ownableSynchronizerCandidates = 0;
92
_ownableSynchronizerSurvived = 0;
93
94
_weakReferenceStats.clear();
95
_softReferenceStats.clear();
96
_phantomReferenceStats.clear();
97
98
_stringConstantsCleared = 0;
99
_stringConstantsCandidates = 0;
100
101
_monitorReferenceCleared = 0;
102
_monitorReferenceCandidates = 0;
103
104
#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)
105
_doubleMappedArrayletsCleared = 0;
106
_doubleMappedArrayletsCandidates = 0;
107
#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */
108
}
109
110
/**
111
* Merge the given stat structures values into the receiver.
112
* @note This method is NOT thread safe.
113
*/
114
void merge(MM_CopyForwardStats *stats) {
115
MM_CopyForwardStatsCore::merge(stats);
116
_unfinalizedCandidates += stats->_unfinalizedCandidates;
117
_unfinalizedEnqueued += stats->_unfinalizedEnqueued;
118
119
_ownableSynchronizerSurvived += stats->_ownableSynchronizerSurvived;
120
121
_weakReferenceStats.merge(&stats->_weakReferenceStats);
122
_softReferenceStats.merge(&stats->_softReferenceStats);
123
_phantomReferenceStats.merge(&stats->_phantomReferenceStats);
124
125
_stringConstantsCleared += stats->_stringConstantsCleared;
126
_stringConstantsCandidates += stats->_stringConstantsCandidates;
127
128
_monitorReferenceCleared += stats->_monitorReferenceCleared;
129
_monitorReferenceCandidates += stats->_monitorReferenceCandidates;
130
131
#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)
132
_doubleMappedArrayletsCleared += stats->_doubleMappedArrayletsCleared;
133
_doubleMappedArrayletsCandidates += stats->_doubleMappedArrayletsCandidates;
134
#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */
135
}
136
137
MM_CopyForwardStats() :
138
MM_CopyForwardStatsCore()
139
, _unfinalizedCandidates(0)
140
, _unfinalizedEnqueued(0)
141
, _ownableSynchronizerCandidates(0)
142
, _ownableSynchronizerSurvived(0)
143
, _weakReferenceStats()
144
, _softReferenceStats()
145
, _phantomReferenceStats()
146
, _stringConstantsCleared(0)
147
, _stringConstantsCandidates(0)
148
, _monitorReferenceCleared(0)
149
, _monitorReferenceCandidates(0)
150
#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)
151
, _doubleMappedArrayletsCleared(0)
152
, _doubleMappedArrayletsCandidates(0)
153
#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */
154
{}
155
};
156
157
#endif /* J9VM_GC_VLHGC */
158
#endif /* COPYFORWARDSTATS_HPP_ */
159
160