Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/control/J9Options.hpp
6000 views
1
/*******************************************************************************
2
* Copyright (c) 2000, 2022 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* 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
21
*******************************************************************************/
22
23
#ifndef J9_OPTIONS_INCL
24
#define J9_OPTIONS_INCL
25
26
/*
27
* The following #define and typedef must appear before any #includes in this file
28
*/
29
#ifndef J9_OPTIONS_CONNECTOR
30
#define J9_OPTIONS_CONNECTOR
31
namespace J9 { class Options; }
32
namespace J9 { typedef J9::Options OptionsConnector; }
33
#endif
34
35
#include "control/OMROptions.hpp"
36
37
#include <stdint.h>
38
#include "control/OptionsUtil.hpp"
39
#include "env/jittypes.h"
40
#if defined(J9VM_OPT_JITSERVER)
41
namespace TR { class CompilationInfoPerThreadBase; }
42
#endif /* defined(J9VM_OPT_JITSERVER) */
43
44
namespace J9
45
{
46
47
class OMR_EXTENSIBLE Options : public OMR::OptionsConnector
48
{
49
public:
50
51
Options() : OMR::OptionsConnector() {}
52
53
Options(TR_Memory * m,
54
int32_t index,
55
int32_t lineNumber,
56
TR_ResolvedMethod *compilee,
57
void *oldStartPC,
58
TR_OptimizationPlan *optimizationPlan,
59
bool isAOT=false,
60
int32_t compThreadID=-1)
61
: OMR::OptionsConnector(m,index,lineNumber,compilee,oldStartPC,optimizationPlan,isAOT,compThreadID)
62
{}
63
64
Options(TR::Options &other) : OMR::OptionsConnector(other) {}
65
66
67
68
static bool _doNotProcessEnvVars;
69
70
static bool _reportByteCodeInfoAtCatchBlock;
71
/** \brief
72
* Returns the _reportByteCodeInfoAtCatchBlock
73
*
74
* \details
75
* reportByteCodeInfoAtCatchBlock defines whether Byte Code Information should be reported on a catch block.
76
*
77
*/
78
static inline bool getReportByteCodeInfoAtCatchBlock() { return _reportByteCodeInfoAtCatchBlock; }
79
/** \brief
80
* Setter for _reportByteCodeInfoAtCatchBlock
81
*
82
*/
83
static inline bool setReportByteCodeInfoAtCatchBlock(bool b = true) { return _reportByteCodeInfoAtCatchBlock = b; }
84
85
static int32_t _samplingFrequencyInIdleMode;
86
static int32_t getSamplingFrequencyInIdleMode() {return _samplingFrequencyInIdleMode;}
87
88
#if defined(J9VM_OPT_JITSERVER)
89
static int32_t _statisticsFrequency;
90
static int32_t getStatisticsFrequency() {return _statisticsFrequency;}
91
92
static uint32_t _compilationSequenceNumber;
93
#endif /* defined(J9VM_OPT_JITSERVER) */
94
95
static int32_t _samplingFrequencyInDeepIdleMode;
96
static int32_t getSamplingFrequencyInDeepIdleMode() {return _samplingFrequencyInDeepIdleMode;}
97
98
static int32_t _highActiveThreadThreshold;
99
static int32_t getHighActiveThreadThreshold() {return _highActiveThreadThreshold;}
100
101
static int32_t _veryHighActiveThreadThreshold;
102
static int32_t getVeryHighActiveThreadThreshold() {return _veryHighActiveThreadThreshold;}
103
104
static int32_t _maxCheckcastProfiledClassTests;
105
static int32_t getCheckcastMaxProfiledClassTests() {return _maxCheckcastProfiledClassTests;}
106
107
static int32_t _maxOnsiteCacheSlotForInstanceOf;
108
/** \brief
109
* Returns the _maxOnsiteCacheSlotForInstanceOf
110
*
111
* \details
112
* maxOnsiteCacheSlotForInstanceOf node defines number of onsite cache slots to generate per site of instanceOf
113
* Set this value to 0 to disable generation of onsite cache test for instanceOf
114
*
115
*/
116
static int32_t getMaxOnsiteCacheSlotForInstanceOf() {return _maxOnsiteCacheSlotForInstanceOf;}
117
/** \brief
118
* Setter for _maxOnsiteCacheSlotForInstanceOf
119
*
120
*/
121
static int32_t setMaxOnsiteCacheSlotForInstanceOf(int32_t m) {return _maxOnsiteCacheSlotForInstanceOf = m;}
122
123
static int32_t _resetCountThreshold;
124
125
static int32_t _scorchingSampleThreshold;
126
static int32_t _conservativeScorchingSampleThreshold; // used when many CPUs
127
128
static int32_t _upperBoundNumProcForScaling;
129
static int32_t _lowerBoundNumProcForScaling;
130
static int32_t _veryHotSampleThreshold;
131
static int32_t _relaxedCompilationLimitsSampleThreshold;
132
static int32_t _sampleThresholdVariationAllowance;
133
static int32_t _cpuEntitlementForConservativeScorching;
134
135
static int32_t _sampleHeartbeatInterval;
136
static int32_t getSamplingHeartbeatInterval() { return _sampleHeartbeatInterval;}
137
138
static int32_t _sampleDontSwitchToProfilingThreshold;
139
static int32_t _stackSize;
140
static int32_t _profilerStackSize;
141
static int32_t _smallMethodBytecodeSizeThreshold; // used on setting invocation counts
142
static int32_t _smallMethodBytecodeSizeThresholdForCold; // used in GCR filtering
143
static int32_t _smallMethodBytecodeSizeThresholdForJITServerAOTCache; // for determining which methods to convert to AOT done remotely
144
145
static int32_t _countForMethodsCompiledDuringStartup;
146
static int32_t getCountForMethodsCompiledDuringStartup() { return _countForMethodsCompiledDuringStartup; }
147
148
static int32_t _countForLoopyBootstrapMethods;
149
static int32_t _countForLooplessBootstrapMethods;
150
static int32_t getCountForLoopyBootstrapMethods() { return _countForLoopyBootstrapMethods; }
151
static int32_t getCountForLooplessBootstrapMethods() { return _countForLooplessBootstrapMethods; }
152
153
// fast JNI option
154
static TR::SimpleRegex *_jniAccelerator;
155
static TR::SimpleRegex * getJniAccelerator() { return _jniAccelerator; }
156
static void setJniAccelerator(TR::SimpleRegex *ja) { _jniAccelerator = ja; }
157
158
static int32_t _classLoadingPhaseInterval;
159
static int32_t _experimentalClassLoadPhaseInterval;
160
static int32_t _classLoadingPhaseThreshold;
161
static int32_t _classLoadingPhaseVariance;
162
static int32_t _classLoadingRateAverage;
163
static int32_t _secondaryClassLoadingPhaseThreshold;
164
static int32_t _numClassLoadPhaseQuiesceIntervals;
165
static int32_t _bigAppSampleThresholdAdjust; //shift value assigned to certain big app's ho and scorching threshold
166
static int32_t _availableCPUPercentage;
167
static int32_t _userClassLoadingPhaseThreshold;
168
static bool _userClassLoadingPhase;
169
170
static int32_t _cpuCompTimeExpensiveThreshold;
171
int32_t getCpuCompTimeExpensiveThreshold() { return _cpuCompTimeExpensiveThreshold; }
172
173
static uintptr_t _compThreadAffinityMask;
174
static int32_t _interpreterSamplingThreshold;
175
static int32_t _interpreterSamplingDivisor;
176
static int32_t _interpreterSamplingThresholdInStartupMode;
177
static int32_t _interpreterSamplingThresholdInJSR292;
178
static int32_t _activeThreadsThreshold; // -1 means 'determine dynamically', 0 means feature disabled
179
static int32_t _samplingThreadExpirationTime;
180
static int32_t _compilationExpirationTime;
181
static int32_t _catchSamplingSizeThreshold;
182
static int32_t _compilationThreadPriorityCode; // a number between 0 and 4
183
static int32_t _disableIProfilerClassUnloadThreshold;
184
static int32_t _iprofilerReactivateThreshold;
185
static int32_t _iprofilerIntToTotalSampleRatio;
186
static int32_t _iprofilerSamplesBeforeTurningOff;
187
static int32_t _iprofilerNumOutstandingBuffers;
188
static int32_t _iprofilerBufferMaxPercentageToDiscard;
189
static int32_t _iProfilerBufferInterarrivalTimeToExitDeepIdle; // ms
190
static int32_t _iprofilerBufferSize; //iprofilerbuffer size in kb
191
192
static int32_t _maxIprofilingCount; // when invocation count is larger than
193
// this value Iprofiler will not collect data
194
static int32_t _maxIprofilingCountInStartupMode; // same as above but value is used
195
// during STARTUP phase (and only during classLoadPhase)
196
static int32_t _iprofilerFailRateThreshold; // will reactivate Iprofiler if failure rate exceeds this threshold
197
static int32_t _iprofilerFailHistorySize;
198
static int32_t _iProfilerMemoryConsumptionLimit;
199
static int32_t _IprofilerOffSubtractionFactor;
200
static int32_t _IprofilerOffDivisionFactor;
201
202
static int32_t _LoopyMethodSubtractionFactor;
203
static int32_t _LoopyMethodDivisionFactor;
204
205
static int32_t _localCSEFrequencyThreshold;
206
static int32_t _profileAllTheTime;
207
static int32_t _seriousCompFailureThreshold; // above this threshold we generate a trace point in the Snap file
208
static bool _useCPUsToDetermineMaxNumberOfCompThreadsToActivate;
209
210
static int32_t _numCodeCachesToCreateAtStartup;
211
static int32_t getNumCodeCachesToCreateAtStartup() { return _numCodeCachesToCreateAtStartup; }
212
213
static int32_t _dataCacheQuantumSize;
214
static int32_t _dataCacheMinQuanta;
215
static int32_t getDataCacheQuantumSize() { return _dataCacheQuantumSize; }
216
static int32_t getDataCacheMinQuanta() { return _dataCacheMinQuanta; }
217
218
static size_t _scratchSpaceLimitKBWhenLowVirtualMemory;
219
static size_t getScratchSpaceLimitKBWhenLowVirtualMemory() { return _scratchSpaceLimitKBWhenLowVirtualMemory; }
220
221
static int32_t _scratchSpaceFactorWhenJSR292Workload;
222
static int32_t getScratchSpaceFactorWhenJSR292Workload() { return _scratchSpaceFactorWhenJSR292Workload; }
223
224
static size_t _scratchSpaceLimitForHotCompilations; // Only used under -Xtune:throughput
225
static size_t getScratchSpaceLimitForHotCompilations() { return _scratchSpaceLimitForHotCompilations; }
226
227
#if defined(J9VM_OPT_JITSERVER)
228
static int32_t _scratchSpaceFactorWhenJITServerWorkload;
229
static int32_t getScratchSpaceFactorWhenJITServerWorkload() { return _scratchSpaceFactorWhenJITServerWorkload; }
230
#endif /* defined(J9VM_OPT_JITSERVER) */
231
232
static int32_t _lowVirtualMemoryMBThreshold;
233
static int32_t getLowVirtualMemoryMBThreshold() { return _lowVirtualMemoryMBThreshold; }
234
235
static int32_t _safeReservePhysicalMemoryValue;
236
inline static int32_t getSafeReservePhysicalMemoryValue() { return _safeReservePhysicalMemoryValue; }
237
inline static void setSafeReservePhysicalMemoryValue(int32_t size) { _safeReservePhysicalMemoryValue = size; }
238
239
static int32_t _updateFreeMemoryMinPeriod;
240
inline static int32_t getUpdateFreeMemoryMinPeriod() { return _updateFreeMemoryMinPeriod; }
241
inline static void setUpdateFreeMemoryMinPeriod(int32_t value) { _updateFreeMemoryMinPeriod = value; }
242
243
static int32_t _numDLTBufferMatchesToEagerlyIssueCompReq;
244
static int32_t _dltPostponeThreshold;
245
246
247
248
static int32_t _minSamplingPeriod;
249
int32_t getMinSamplingPeriod() {return _minSamplingPeriod;}
250
static int32_t _compilationBudget;
251
252
static int32_t _compYieldStatsThreshold;
253
static int32_t _compYieldStatsHeartbeatPeriod;
254
static int32_t _numberOfUserClassesLoaded;
255
static int32_t _numQueuedInvReqToDowngradeOptLevel;
256
static int32_t _qszThresholdToDowngradeOptLevel;
257
static int32_t _qsziThresholdToDowngradeDuringCLP;
258
static int32_t _qszThresholdToDowngradeOptLevelDuringStartup;
259
static int32_t _cpuUtilThresholdForStarvation;
260
static int32_t _qszLimit; // maximum size of the compilation queue
261
static int32_t _compPriorityQSZThreshold;
262
static int32_t _GCRQueuedThresholdForCounting; // if too many GCR are queued we stop counting
263
static int32_t _minimumSuperclassArraySize; //size of the minimum superclass array
264
265
static int32_t _TLHPrefetchSize;
266
static int32_t _TLHPrefetchLineSize;
267
static int32_t _TLHPrefetchLineCount;
268
static int32_t _TLHPrefetchStaggeredLineCount;
269
static int32_t _TLHPrefetchBoundaryLineCount;
270
static int32_t _TLHPrefetchTLHEndLineCount;
271
static int32_t _numFirstTimeCompilationsToExitIdleMode; // use large number to disable the feature
272
273
#if defined(J9VM_OPT_JITSERVER)
274
static int64_t _oldAge;
275
static int64_t _oldAgeUnderLowMemory;
276
static int64_t _timeBetweenPurges;
277
static bool _shareROMClasses;
278
static int32_t _sharedROMClassCacheNumPartitions;
279
static int32_t _reconnectWaitTimeMs;
280
static const uint32_t DEFAULT_JITCLIENT_TIMEOUT = 10000; // ms
281
static const uint32_t DEFAULT_JITSERVER_TIMEOUT = 30000; // ms
282
#endif /* defined(J9VM_OPT_JITSERVER) */
283
284
static int32_t _waitTimeToEnterIdleMode;
285
static int32_t _waitTimeToEnterDeepIdleMode;
286
static int32_t _waitTimeToExitStartupMode;
287
static int32_t _waitTimeToGCR;
288
static int32_t _waitTimeToStartIProfiler;
289
static int32_t _compilationDelayTime;
290
291
static int32_t _invocationThresholdToTriggerLowPriComp; // we trigger an LPQ comp req only if the method
292
// was invoked at least this many times
293
static int32_t _aotMethodThreshold; // when number of methods found in shared cache exceeds this threshold
294
// we stop AOTing new methods to be put in shared cache UNLESS
295
static int32_t _aotMethodCompilesThreshold; // we have already AOT compiled at least this many methods
296
// complication due to zOS trade scenario: two JVMs share a cache
297
static int32_t _aotWarmSCCThreshold; // if there are at least that many AOT bodies in SCC at startup
298
// then we declare the SCC to be warm
299
static int32_t _largeTranslationTime; // usec
300
static int32_t _weightOfAOTLoad;
301
static int32_t _weightOfJSR292;
302
303
static int32_t _hwprofilerNumOutstandingBuffers;
304
305
static TR_YesNoMaybe _hwProfilerEnabled;
306
static uint32_t _hwprofilerHotOptLevelThreshold;
307
static uint32_t _hwprofilerScorchingOptLevelThreshold;
308
static uint32_t _hwprofilerWarmOptLevelThreshold;
309
static uint32_t _hwprofilerReducedWarmOptLevelThreshold;
310
static uint32_t _hwprofilerAOTWarmOptLevelThreshold;
311
static uint32_t _hwprofilerLastOptLevel;
312
static uint32_t _hwprofilerRecompilationInterval;
313
static uint32_t _hwprofilerRIBufferPoolSize;
314
static int32_t _hwProfilerRIBufferProcessingFrequency;
315
static int32_t _hwProfilerRecompFrequencyThreshold;
316
static int32_t _hwProfilerRecompDecisionWindow;
317
static int32_t _numDowngradesToTurnRION;
318
static int32_t _qszThresholdToTurnRION;
319
static int32_t _qszMaxThresholdToRIDowngrade;
320
static int32_t _qszMinThresholdToRIDowngrade;
321
static int32_t _hwProfilerBufferMaxPercentageToDiscard;
322
323
static uint32_t _hwprofilerPRISamplingRate;
324
325
static uint32_t _hwProfilerExpirationTime;
326
327
static uint32_t _hwprofilerRIBufferThreshold;
328
static uint32_t _hwprofilerZRIBufferSize;
329
static uint32_t _hwprofilerZRIMode;
330
static uint32_t _hwprofilerZRIRGS;
331
static uint32_t _hwprofilerZRISF;
332
333
static int32_t _expensiveCompWeight; // weight of a comp request to be considered expensive
334
static int32_t _jProfilingEnablementSampleThreshold;
335
336
static bool _aggressiveLockReservation;
337
338
static void printPID();
339
340
341
342
343
344
345
static char *kcaOffsets(char *option, void *, TR::OptionTable *entry);
346
347
static char *gcOnResolveOption(char *option, void *, TR::OptionTable *entry);
348
349
static char *tprofOption(char *option, void *, TR::OptionTable *entry);
350
351
static char *loadLimitOption(char *option, void *, TR::OptionTable *entry);
352
353
static char *loadLimitfileOption(char *option, void *, TR::OptionTable *entry);
354
355
static char *vmStateOption(char *option, void *, TR::OptionTable *entry);
356
357
static char *setJitConfigRuntimeFlag(char *option, void *base, TR::OptionTable *entry);
358
static char *resetJitConfigRuntimeFlag(char *option, void *base, TR::OptionTable *entry);
359
static char *setJitConfigNumericValue(char *option, void *base, TR::OptionTable *entry);
360
361
static bool useCompressedPointers();
362
static char *limitOption(char *option, void *, TR::OptionTable *entry);
363
static char *inlinefileOption(char *option, void *, TR::OptionTable *entry);
364
static char *limitfileOption(char *option, void *, TR::OptionTable *entry);
365
static char *versionOption(char *option, void *, TR::OptionTable *entry);
366
367
/** \brief
368
* Set memory manager functions related configuration.
369
*
370
* \param vm
371
* J9JavaVM pointer.
372
*
373
* \param jitConfig
374
* J9JITConfig pointer.
375
*/
376
void preProcessMmf(J9JavaVM *vm, J9JITConfig *jitConfig);
377
378
/** \brief
379
* Set compiler mode.
380
*
381
* \param vm
382
* J9JavaVM pointer.
383
*
384
* \param jitConfig
385
* J9JITConfig pointer.
386
*/
387
void preProcessMode(J9JavaVM *vm, J9JITConfig *jitConfig);
388
389
/** \brief
390
* Set JNI related configuration.
391
*
392
* \param vm
393
* J9JavaVM pointer.
394
*/
395
void preProcessJniAccelerator(J9JavaVM *vm);
396
397
/** \brief
398
* Increase code cache total size based on codecachetotal options.
399
*
400
* \param vm
401
* J9JavaVM pointer.
402
*
403
* \param jitConfig
404
* J9JITConfig pointer.
405
*/
406
void preProcessCodeCacheIncreaseTotalSize(J9JavaVM *vm, J9JITConfig *jitConfig);
407
408
/** \brief
409
* Set print code cache usage option.
410
*
411
* \param vm
412
* J9JavaVM pointer.
413
*/
414
void preProcessCodeCachePrintCodeCache(J9JavaVM *vm);
415
416
/** \brief
417
* Set large code page size and flags.
418
*
419
* \param vm
420
* J9JavaVM pointer.
421
*
422
* \param jitConfig
423
* J9JITConfig pointer.
424
*
425
* \return true if successfully processed large code page size and flags.
426
*/
427
bool preProcessCodeCacheXlpCodeCache(J9JavaVM *vm, J9JITConfig *jitConfig);
428
429
/** \brief
430
* Set code cache related configuration.
431
*
432
* \param vm
433
* J9JavaVM pointer.
434
*
435
* \param jitConfig
436
* J9JITConfig pointer.
437
*
438
* \return true if successfully processed code cache related
439
*/
440
bool preProcessCodeCache(J9JavaVM *vm, J9JITConfig *jitConfig);
441
442
/** \brief
443
* Set sampling thread expiration time.
444
*
445
* \param vm
446
* J9JavaVM pointer.
447
*/
448
void preProcessSamplingExpirationTime(J9JavaVM *vm);
449
450
/** \brief
451
* Set number of usable compilation threads.
452
*
453
* \param vm
454
* J9JavaVM pointer.
455
*
456
* \param jitConfig
457
* J9JITConfig pointer.
458
*/
459
void preProcessCompilationThreads(J9JavaVM *vm, J9JITConfig *jitConfig);
460
461
/** \brief
462
* Set thread local heap related configuration.
463
*
464
* \param vm
465
* J9JavaVM pointer.
466
*/
467
void preProcessTLHPrefetch(J9JavaVM *vm);
468
469
/** \brief
470
* Set hardware profiler related configuration.
471
*
472
* \param vm
473
* J9JavaVM pointer.
474
*/
475
void preProcessHwProfiler(J9JavaVM *vm);
476
477
/** \brief
478
* Set deterministic mode related configuration.
479
*
480
* \param vm
481
* J9JavaVM pointer.
482
*/
483
void preProcessDeterministicMode(J9JavaVM *vm);
484
485
/** \brief
486
* Set jit server related configuration.
487
*
488
* \param vm
489
* J9JavaVM pointer.
490
*
491
* \param jitConfig
492
* J9JITConfig pointer.
493
*
494
* \return true if successfully set jit server related configuration.
495
*/
496
bool preProcessJitServer(J9JavaVM *vm, J9JITConfig *jitConfig);
497
498
bool fePreProcess(void *base);
499
bool fePostProcessAOT(void *base);
500
bool fePostProcessJIT(void *base);
501
bool feLatePostProcess(void *base, TR::OptionSet *optionSet);
502
bool showOptionsInEffect();
503
bool showPID();
504
void openLogFiles(J9JITConfig *jitConfig);
505
506
#if defined(J9VM_OPT_JITSERVER)
507
void setupJITServerOptions();
508
509
static std::string packOptions(const TR::Options *origOptions);
510
static TR::Options *unpackOptions(char *clientOptions, size_t clientOptionsSize, TR::CompilationInfoPerThreadBase* compInfoPT,
511
TR_J9VMBase *fe, TR_Memory *trMemory);
512
static std::string packLogFile(TR::FILE *fp);
513
int writeLogFileFromServer(const std::string& logFileContent);
514
void setLogFileForClientOptions(int suffixNumber = 0);
515
void closeLogFileForClientOptions();
516
#endif /* defined(J9VM_OPT_JITSERVER) */
517
};
518
519
}
520
521
#endif
522
523