Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_trace/TgcExtensions.hpp
5985 views
1
2
/*******************************************************************************
3
* Copyright (c) 1991, 2019 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_Trace
27
*/
28
29
#if !defined(TGCEXTENSIONS_HPP_)
30
#define TGCEXTENSIONS_HPP_
31
32
#include "j9.h"
33
#include "j9cfg.h"
34
35
#include "BaseNonVirtual.hpp"
36
#include "GCExtensions.hpp"
37
#include "TgcBacktrace.hpp"
38
#include "TgcDump.hpp"
39
#include "TgcExclusiveaccess.hpp"
40
#include "TgcExcessivegc.hpp"
41
#include "TgcFreelist.hpp"
42
#include "TgcHeap.hpp"
43
#include "TgcParallel.hpp"
44
#include "TgcAllocation.hpp"
45
#include "TgcTerse.hpp"
46
#include "TgcNuma.hpp"
47
48
#if defined(J9VM_GC_MODRON_STANDARD)
49
#include "TgcConcurrent.hpp"
50
#include "TgcConcurrentcardcleaning.hpp"
51
#include "TgcScavenger.hpp"
52
#endif /* defined(J9VM_GC_MODRON_STANDARD) */
53
54
#if defined(J9VM_GC_MODRON_STANDARD)
55
/**
56
* Structure holding information relating to tgc tracing for compaction.
57
*/
58
typedef struct TgcCompactionExtensions {
59
UDATA unused;
60
} TgcCompactionExtensions;
61
#endif /* defined(J9VM_GC_MODRON_STANDARD) */
62
63
#if defined(J9VM_GC_VLHGC)
64
/**
65
* Structure holding information relating to tgc tracing for compaction.
66
*/
67
typedef struct TgcWriteOnceCompactionExtensions {
68
UDATA unused;
69
} TgcWriteOnceCompactionExtensions;
70
71
/**
72
* Structure holding information relating to tgc tracing for inter-region remembered set demographics.
73
*/
74
typedef struct TgcInterRegionRememberedSetDemographicsExtension {
75
UDATA incrementCount; /**< A persistent counter of how many times the demographic data has been printed */
76
J9HashTable *classHashTable; /**< A shared hash table of class data, repopulated in each iteration */
77
UDATA errorCount; /**< A shared count of errors, reset in each increment */
78
UDATA totalRememberedObjects; /**< A shared count of total remembered objects, reset in each increment */
79
omrthread_monitor_t mutex; /**< A monitor used to protect the shared resources when parallel threads merge their results */
80
} TgcInterRegionRememberedSetDemographicsExtension;
81
#endif /* J9VM_GC_VLHGC */
82
83
/**
84
* Class for handling trace information.
85
* This class stores state information and variables needed by the
86
* functions associated with the trace output.
87
*/
88
class MM_TgcExtensions : public MM_BaseNonVirtual
89
{
90
/*
91
* Data members
92
*/
93
private:
94
J9PortLibrary* _portLibrary; /**< The port library to use for TGC */
95
IDATA _outputFile; /**< The file handle TGC output should be written to */
96
protected:
97
public:
98
/* data used to save parsed requests whatever are compatible with GC policy or not */
99
bool _allocationRequested; /**< true if "allocation" option is parsed */
100
bool _largeAllocationRequested; /**< true if "largeAllocation" option is parsed */
101
bool _largeAllocationVerboseRequested; /**< true if "_largeAllocationVerboseRequested" option is parsed */
102
bool _backtraceRequested; /**< true if "backtrace" option is parsed */
103
bool _compactionRequested; /**< true if "compaction" option is parsed */
104
bool _concurrentRequested; /**< true if "concurrent" option is parsed */
105
bool _cardCleaningRequested; /**< true if "cardcleaning" option is parsed */
106
bool _dumpRequested; /**< true if "dump" option is parsed */
107
bool _exclusiveAccessRequested; /**< true if "exclusiveaccess" option is parsed */
108
bool _excessiveGCRequested; /**< true if "excessivegc" option is parsed */
109
bool _freeListSummaryRequested; /**< true if "freeListSummary" option is parsed */
110
bool _freeListRequested; /**< true if "freeList" option is parsed */
111
bool _heapRequested; /**< true if "heap" option is parsed */
112
bool _parallelRequested; /**< true if "parallel" option is parsed */
113
bool _rootScannerRequested; /**< true if "rootscantime" option is parsed */
114
bool _scavengerRequested; /**< true if "scavenger" option is parsed */
115
bool _scavengerSurvivalStatsRequested; /**< true if "scavengerSurvivalStats" option is parsed */
116
bool _scavengerMemoryStatsRequested; /**< true if "scavengerMemoryStats" option is parsed */
117
bool _terseRequested; /**< true if "terse" option is parsed */
118
bool _interRegionRememberedSetRequested; /**< true if "rememberedSetCardList" option is parsed */
119
bool _interRegionRememberedSetDemographicsRequested; /**< true if "rememberedSetDemographics" option is parsed */
120
bool _numaRequested; /**< true if "numa" option is parsed */
121
bool _allocationContextRequested; /**< true if "allocationContext" option is parsed */
122
bool _intelligentCompactRequested; /**< true if "intelligentCompact" option is parsed */
123
bool _dynamicCollectionSetRequested; /**< true if "dynamicCollectionSet" option is parsed */
124
bool _projectedStatsRequested; /**< true if "projectedStats" option is parsed */
125
bool _writeOnceCompactTimingRequested; /**< true if "writeOnceCompactTiming" option is parsed */
126
bool _copyForwardRequested; /**< true if "copyForward" option is parsed */
127
bool _interRegionReferencesRequested; /**< true if "interRegionReferences" option is parsed */
128
bool _sizeClassesRequested; /**< true if "sizeClasses" option is parsed */
129
130
TgcBacktraceExtensions _backtrace;
131
TgcDumpExtensions _dump;
132
TgcExclusiveAccessExtensions _exclusiveAccess;
133
TgcExcessiveGCExtensions _excessiveGC;
134
TgcFreeListExtensions _freeList;
135
TgcParallelExtensions _parallel;
136
TgcTerseExtensions _terse;
137
138
#if defined(J9VM_GC_MODRON_STANDARD)
139
TgcCompactionExtensions _compaction;
140
TgcConcurrentExtensions _concurrent;
141
TgcConcurrentCardCleaningExtensions _cardCleaning;
142
TgcScavengerExtensions _scavenger;
143
#endif /* defined(J9VM_GC_MODRON_STANDARD) */
144
145
#if defined(J9VM_GC_VLHGC)
146
TgcNumaExtensions _numa;
147
TgcWriteOnceCompactionExtensions _writeOnceCompaction;
148
U_8 *_rsclDistinctFlagArray; /* hash table used for distinct card list detection */
149
void *_dynamicCollectionSetData; /**< Private data used by dynamic collection set TGC extensions */
150
TgcInterRegionRememberedSetDemographicsExtension _interRegionRememberedSetDemographics;
151
#endif /* J9VM_GC_VLHGC */
152
153
/*
154
* Function members
155
*/
156
private:
157
protected:
158
/**
159
* Construct a new TGC extensions object
160
* @param extensions[in] the GC extensions
161
*/
162
MM_TgcExtensions(MM_GCExtensions *extensions);
163
164
/**
165
* Tear down a TGC extensions object
166
* @param extensions[in] the GC extensions
167
*/
168
void tearDown(MM_GCExtensions *extensions);
169
170
public:
171
/**
172
* Fetch the cached port library pointer
173
* @return the cached port library pointer
174
*/
175
J9PortLibrary* getPortLibrary() { return _portLibrary; }
176
177
/**
178
* Print TGC output to stderr or the TGC output file
179
* @param format[in] a format string, see j9tty_printf
180
* @param args[in] arguments to be formatted
181
*/
182
void vprintf(const char *format, va_list args);
183
184
/**
185
* Print TGC output to stderr or the TGC output file
186
* @param format[in] a format string, see j9tty_printf
187
* @param ...[in] arguments to be formatted
188
*/
189
void printf(const char *format, ...);
190
191
/**
192
* Set the output file for TGC output.
193
* @param filename[in] the name of the file to open
194
* @return true on success, false on failure
195
*/
196
bool setOutputFile(const char* filename);
197
198
/**
199
* Allocate and initialize a new TGC extensions object
200
* @param extensions[in] the GC extensions
201
* @return an initialized instance, or NULL on failure
202
*/
203
static MM_TgcExtensions * newInstance(MM_GCExtensions *extensions);
204
205
/**
206
* Tear down and free the TGC extensions object
207
* @param extensions[in] the GC extensions
208
*/
209
void kill(MM_GCExtensions *extensions);
210
211
/**
212
* Get the TGC extensions object from the GC Extensions object
213
* @param extensions[in] the GC extensions object
214
* @return the TGC extensions
215
*/
216
static MM_TgcExtensions* getExtensions(MM_GCExtensions* extensions) { return (MM_TgcExtensions*)extensions->tgcExtensions; }
217
218
/**
219
* Get the TGC extensions object from the J9JavaVM struct
220
* @param javaVM[in] the J9JavaVM struct
221
* @return the TGC extensions
222
*/
223
static MM_TgcExtensions* getExtensions(J9JavaVM* javaVM) { return getExtensions(MM_GCExtensions::getExtensions(javaVM)); }
224
225
/**
226
* Get the TGC extensions object from the J9JavaVM struct
227
* @param javaVM[in] the J9JavaVM struct
228
* @return the TGC extensions
229
*/
230
static MM_TgcExtensions* getExtensions(OMR_VMThread* omrVMThread) { return getExtensions(MM_GCExtensions::getExtensions(omrVMThread)); }
231
232
/**
233
* Get the TGC extensions object from a J9VMThread struct
234
* @param vmThread[in] a J9VMThread struct
235
* @return the TGC extensions
236
*/
237
static MM_TgcExtensions* getExtensions(J9VMThread* vmThread) { return getExtensions(vmThread->javaVM); }
238
};
239
240
#endif /* TGCEXTENSIONS_HPP_ */
241
242
243