Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/control/J9Options.cpp
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
#include "control/J9Options.hpp"
24
25
#include <algorithm>
26
#if defined(J9VM_OPT_JITSERVER)
27
#include <random>
28
#endif /* defined(J9VM_OPT_JITSERVER) */
29
#include <ctype.h>
30
#include <stdint.h>
31
#include "jitprotos.h"
32
#include "j2sever.h"
33
#include "j9.h"
34
#include "j9cfg.h"
35
#include "j9modron.h"
36
#include "jvminit.h"
37
#if defined(J9VM_OPT_JITSERVER)
38
#include "j9vmnls.h"
39
#include "omrformatconsts.h"
40
#endif /* defined(J9VM_OPT_JITSERVER) */
41
#include "codegen/CodeGenerator.hpp"
42
#include "compile/Compilation.hpp"
43
#include "control/Recompilation.hpp"
44
#include "control/RecompilationInfo.hpp"
45
#include "env/CompilerEnv.hpp"
46
#include "env/IO.hpp"
47
#include "env/VMJ9.h"
48
#include "env/VerboseLog.hpp"
49
#include "env/jittypes.h"
50
#include "infra/SimpleRegex.hpp"
51
#include "control/CompilationRuntime.hpp"
52
#include "control/CompilationThread.hpp"
53
#include "runtime/IProfiler.hpp"
54
#if defined(J9VM_OPT_JITSERVER)
55
#include "env/j9methodServer.hpp"
56
#include "control/JITServerCompilationThread.hpp"
57
#endif /* defined(J9VM_OPT_JITSERVER) */
58
59
#if defined(J9VM_OPT_SHARED_CLASSES)
60
#include "j9jitnls.h"
61
#endif
62
63
#define SET_OPTION_BIT(x) TR::Options::setBit, offsetof(OMR::Options,_options[(x)&TR_OWM]), ((x)&~TR_OWM)
64
65
// For use with TPROF only, disable JVMPI hooks even if -Xrun is specified.
66
// The only hook that is required is J9HOOK_COMPILED_METHOD_LOAD.
67
//
68
bool enableCompiledMethodLoadHookOnly = false;
69
70
// -----------------------------------------------------------------------------
71
// Static data initialization
72
// -----------------------------------------------------------------------------
73
74
bool J9::Options::_doNotProcessEnvVars = false; // set through XX options in Java
75
bool J9::Options::_reportByteCodeInfoAtCatchBlock = false;
76
int32_t J9::Options::_samplingFrequencyInIdleMode = 1000; // ms
77
#if defined(J9VM_OPT_JITSERVER)
78
int32_t J9::Options::_statisticsFrequency = 0; // ms
79
uint32_t J9::Options::_compilationSequenceNumber = 0;
80
static const size_t JITSERVER_LOG_FILENAME_MAX_SIZE = 1025;
81
#endif /* defined(J9VM_OPT_JITSERVER) */
82
int32_t J9::Options::_samplingFrequencyInDeepIdleMode = 100000; // ms
83
int32_t J9::Options::_resetCountThreshold = 0; // Disable the feature
84
int32_t J9::Options::_scorchingSampleThreshold = 240;
85
int32_t J9::Options::_conservativeScorchingSampleThreshold = 80; // used when many CPUs (> _upperBoundNumProc)
86
int32_t J9::Options::_upperBoundNumProcForScaling = 64; // used for scaling _scorchingSampleThreshold based on numProc
87
int32_t J9::Options::_lowerBoundNumProcForScaling = 8; // used for scaling _scorchingSampleThreshold based on numProd]c
88
int32_t J9::Options::_veryHotSampleThreshold = 480;
89
int32_t J9::Options::_relaxedCompilationLimitsSampleThreshold = 120; // normally should be lower than the scorchingSampleThreshold
90
int32_t J9::Options::_sampleThresholdVariationAllowance = 30;
91
92
int32_t J9::Options::_maxCheckcastProfiledClassTests = 3;
93
int32_t J9::Options::_maxOnsiteCacheSlotForInstanceOf = 0; // Setting this value to zero will disable onsite cache in instanceof.
94
int32_t J9::Options::_cpuEntitlementForConservativeScorching = 801; // 801 means more than 800%, i.e. 8 cpus
95
// A very large number disables the feature
96
int32_t J9::Options::_sampleHeartbeatInterval = 10;
97
int32_t J9::Options::_sampleDontSwitchToProfilingThreshold = 3000; // default=1% use large value to disable// To be tuned
98
int32_t J9::Options::_stackSize = 1024;
99
int32_t J9::Options::_profilerStackSize = 128;
100
101
int32_t J9::Options::_smallMethodBytecodeSizeThreshold = 0;
102
int32_t J9::Options::_smallMethodBytecodeSizeThresholdForCold = -1; // -1 means not set (or disabled)
103
int32_t J9::Options::_smallMethodBytecodeSizeThresholdForJITServerAOTCache = 0; // 0 means disabled; good values to try 0-32
104
105
int32_t J9::Options::_countForMethodsCompiledDuringStartup = 10;
106
107
int32_t J9::Options::_countForLoopyBootstrapMethods = -1; // -1 means feature disabled
108
int32_t J9::Options::_countForLooplessBootstrapMethods = -1; // -1 means feature disabled
109
110
TR::SimpleRegex *J9::Options::_jniAccelerator = NULL;
111
112
int32_t J9::Options::_classLoadingPhaseInterval = 500; // ms
113
int32_t J9::Options::_experimentalClassLoadPhaseInterval = 40;
114
int32_t J9::Options::_classLoadingPhaseThreshold = 155; // classes per second
115
int32_t J9::Options::_classLoadingPhaseVariance = 70; // percentage 0..99
116
int32_t J9::Options::_classLoadingRateAverage = 800; // classes per second
117
int32_t J9::Options::_secondaryClassLoadingPhaseThreshold = 10000;
118
int32_t J9::Options::_numClassLoadPhaseQuiesceIntervals = 1;
119
int32_t J9::Options::_userClassLoadingPhaseThreshold = 5;
120
bool J9::Options::_userClassLoadingPhase = false;
121
122
int32_t J9::Options::_bigAppSampleThresholdAdjust = 3; //amount to shift the hot and scorching threshold
123
int32_t J9::Options::_availableCPUPercentage = 100;
124
int32_t J9::Options::_cpuCompTimeExpensiveThreshold = 4000;
125
uintptr_t J9::Options::_compThreadAffinityMask = 0;
126
127
#if defined(J9VM_OPT_JITSERVER)
128
int64_t J9::Options::_oldAge = 1000 * 60 * 1000; // 1000 minutes
129
int64_t J9::Options::_oldAgeUnderLowMemory = 1000 * 60 * 5; // 5 minutes
130
int64_t J9::Options::_timeBetweenPurges = 1000 * 60 * 1; // 1 minute
131
bool J9::Options::_shareROMClasses = false;
132
int32_t J9::Options::_sharedROMClassCacheNumPartitions = 16;
133
int32_t J9::Options::_reconnectWaitTimeMs = 1000;
134
int32_t J9::Options::_highActiveThreadThreshold = -1;
135
int32_t J9::Options::_veryHighActiveThreadThreshold = -1;
136
#endif /* defined(J9VM_OPT_JITSERVER) */
137
138
int32_t J9::Options::_interpreterSamplingThreshold = 300;
139
int32_t J9::Options::_interpreterSamplingDivisor = TR_DEFAULT_INTERPRETER_SAMPLING_DIVISOR;
140
int32_t J9::Options::_interpreterSamplingThresholdInStartupMode = TR_DEFAULT_INITIAL_BCOUNT; // 3000
141
int32_t J9::Options::_interpreterSamplingThresholdInJSR292 = TR_DEFAULT_INITIAL_COUNT - 2; // Run stuff twice before getting too excited about interpreter ticks
142
int32_t J9::Options::_activeThreadsThreshold = 0; // -1 means 'determine dynamically', 0 means feature disabled
143
int32_t J9::Options::_samplingThreadExpirationTime = -1;
144
int32_t J9::Options::_compilationExpirationTime = -1;
145
146
int32_t J9::Options::_minSamplingPeriod = 10; // ms
147
int32_t J9::Options::_compilationBudget = 0; // ms; 0 means disabled
148
149
int32_t J9::Options::_catchSamplingSizeThreshold = -1; // measured in nodes; -1 means not initialized
150
int32_t J9::Options::_compilationThreadPriorityCode = 4; // these codes are converted into
151
// priorities in startCompilationThread
152
int32_t J9::Options::_disableIProfilerClassUnloadThreshold = 20000;// The usefulness of IProfiling is questionable at this point
153
int32_t J9::Options::_iprofilerReactivateThreshold=10;
154
int32_t J9::Options::_iprofilerIntToTotalSampleRatio=2;
155
int32_t J9::Options::_iprofilerSamplesBeforeTurningOff = 1000000; // samples
156
int32_t J9::Options::_iprofilerNumOutstandingBuffers = 10;
157
int32_t J9::Options::_iprofilerBufferMaxPercentageToDiscard = 0;
158
int32_t J9::Options::_iProfilerBufferInterarrivalTimeToExitDeepIdle = 5000; // 5 seconds
159
int32_t J9::Options::_iprofilerBufferSize = 1024;
160
#ifdef TR_HOST_64BIT
161
int32_t J9::Options::_iProfilerMemoryConsumptionLimit=32*1024*1024;
162
#else
163
int32_t J9::Options::_iProfilerMemoryConsumptionLimit=18*1024*1024;
164
#endif
165
int32_t J9::Options::_IprofilerOffSubtractionFactor = 500;
166
int32_t J9::Options::_IprofilerOffDivisionFactor = 16;
167
168
169
170
int32_t J9::Options::_maxIprofilingCount = TR_DEFAULT_INITIAL_COUNT; // 3000
171
int32_t J9::Options::_maxIprofilingCountInStartupMode = TR_QUICKSTART_INITIAL_COUNT; // 1000
172
int32_t J9::Options::_iprofilerFailRateThreshold = 70; // percent 1-100
173
int32_t J9::Options::_iprofilerFailHistorySize = 10; // percent 1-100
174
175
int32_t J9::Options::_compYieldStatsThreshold = 1000; // usec
176
int32_t J9::Options::_compYieldStatsHeartbeatPeriod = 0; // ms
177
int32_t J9::Options::_numberOfUserClassesLoaded = 0;
178
int32_t J9::Options::_compPriorityQSZThreshold = 200;
179
int32_t J9::Options::_numQueuedInvReqToDowngradeOptLevel = 20; // If more than 20 inv req are queued we compiled them at cold
180
int32_t J9::Options::_qszThresholdToDowngradeOptLevel = -1; // not yet set
181
int32_t J9::Options::_qsziThresholdToDowngradeDuringCLP = 0; // -1 or 0 disables the feature and reverts to old behavior
182
int32_t J9::Options::_qszThresholdToDowngradeOptLevelDuringStartup = 100000; // a large number disables the feature
183
int32_t J9::Options::_cpuUtilThresholdForStarvation = 25; // 25%
184
int32_t J9::Options::_qszLimit = 5000; // when limit is reached the JIT will postpone new compilation requests
185
186
// If too many GCR are queued we stop counting.
187
// Use a large value to disable the feature. 400 is a good default
188
// Don't use a value smaller than GCR_HYSTERESIS==100
189
int32_t J9::Options::_GCRQueuedThresholdForCounting = 1000000; // 400;
190
191
int32_t J9::Options::_minimumSuperclassArraySize = 5;
192
int32_t J9::Options::_TLHPrefetchSize = 0;
193
int32_t J9::Options::_TLHPrefetchLineSize = 0;
194
int32_t J9::Options::_TLHPrefetchLineCount = 0;
195
int32_t J9::Options::_TLHPrefetchStaggeredLineCount = 0;
196
int32_t J9::Options::_TLHPrefetchBoundaryLineCount = 0;
197
int32_t J9::Options::_TLHPrefetchTLHEndLineCount = 0;
198
199
int32_t J9::Options::_numFirstTimeCompilationsToExitIdleMode = 25; // Use a large number to disable the feature
200
int32_t J9::Options::_waitTimeToEnterIdleMode = 5000; // ms
201
int32_t J9::Options::_waitTimeToEnterDeepIdleMode = 50000; // ms
202
int32_t J9::Options::_waitTimeToExitStartupMode = DEFAULT_WAIT_TIME_TO_EXIT_STARTUP_MODE; // ms
203
int32_t J9::Options::_waitTimeToGCR = 10000; // ms
204
int32_t J9::Options::_waitTimeToStartIProfiler = 1000; // ms
205
int32_t J9::Options::_compilationDelayTime = 0; // sec; 0 means disabled
206
207
int32_t J9::Options::_invocationThresholdToTriggerLowPriComp = 250;
208
209
int32_t J9::Options::_aotMethodThreshold = 200;
210
int32_t J9::Options::_aotMethodCompilesThreshold = 200;
211
int32_t J9::Options::_aotWarmSCCThreshold = 200;
212
213
int32_t J9::Options::_largeTranslationTime = -1; // usec
214
int32_t J9::Options::_weightOfAOTLoad = 1; // must be between 0 and 256
215
int32_t J9::Options::_weightOfJSR292 = 12; // must be between 0 and 256
216
217
TR_YesNoMaybe J9::Options::_hwProfilerEnabled = TR_maybe;
218
int32_t J9::Options::_hwprofilerNumOutstandingBuffers = 256; // 1MB / 4KB buffers
219
220
// These numbers are cast into floats divided by 10000
221
uint32_t J9::Options::_hwprofilerWarmOptLevelThreshold = 1; // 0.0001
222
uint32_t J9::Options::_hwprofilerReducedWarmOptLevelThreshold=0; // 0 ==> upgrade methods with just 1 tick in any given interval
223
uint32_t J9::Options::_hwprofilerAOTWarmOptLevelThreshold = 10; // 0.001
224
uint32_t J9::Options::_hwprofilerHotOptLevelThreshold = 100; // 0.01
225
uint32_t J9::Options::_hwprofilerScorchingOptLevelThreshold = 1250; // 0.125
226
227
uint32_t J9::Options::_hwprofilerLastOptLevel = warm; // warm
228
uint32_t J9::Options::_hwprofilerRecompilationInterval = 10000;
229
uint32_t J9::Options::_hwprofilerRIBufferThreshold = 50; // process buffer when it is at least 50% full
230
uint32_t J9::Options::_hwprofilerRIBufferPoolSize = 1 * 1024 * 1024; // 1 MB
231
int32_t J9::Options::_hwProfilerRIBufferProcessingFrequency= 0; // process buffer every time
232
int32_t J9::Options::_hwProfilerRecompFrequencyThreshold = 5000; // less than 1 in 5000 will turn RI off
233
234
int32_t J9::Options::_hwProfilerRecompDecisionWindow = 5000; // Should be at least as big as _hwProfilerRecompFrequencyThreshold
235
int32_t J9::Options::_numDowngradesToTurnRION = 250;
236
int32_t J9::Options::_qszThresholdToTurnRION = 100;
237
int32_t J9::Options::_qszMaxThresholdToRIDowngrade = 250;
238
int32_t J9::Options::_qszMinThresholdToRIDowngrade = 50; // should be smaller than _qszMaxThresholdToRIDowngrade
239
uint32_t J9::Options::_hwprofilerPRISamplingRate = 500000;
240
241
int32_t J9::Options::_hwProfilerBufferMaxPercentageToDiscard = 5;
242
uint32_t J9::Options::_hwProfilerExpirationTime = 0; // ms; 0 means disabled
243
uint32_t J9::Options::_hwprofilerZRIBufferSize = 4 * 1024; // 4 kb
244
uint32_t J9::Options::_hwprofilerZRIMode = 0; // cycle based profiling
245
uint32_t J9::Options::_hwprofilerZRIRGS = 0; // only collect instruction records
246
uint32_t J9::Options::_hwprofilerZRISF = 10000000;
247
248
int32_t J9::Options::_LoopyMethodSubtractionFactor = 500;
249
int32_t J9::Options::_LoopyMethodDivisionFactor = 16;
250
251
int32_t J9::Options::_localCSEFrequencyThreshold = 1000;
252
int32_t J9::Options::_profileAllTheTime = 0;
253
254
int32_t J9::Options::_seriousCompFailureThreshold = 10; // above this threshold we generate a trace point in the Snap file
255
256
bool J9::Options::_useCPUsToDetermineMaxNumberOfCompThreadsToActivate = false;
257
int32_t J9::Options::_numCodeCachesToCreateAtStartup = 0; // 0 means no change from default which is 1
258
259
int32_t J9::Options::_dataCacheQuantumSize = 64;
260
int32_t J9::Options::_dataCacheMinQuanta = 2;
261
262
int32_t J9::Options::_updateFreeMemoryMinPeriod = 500; // 500 ms
263
264
265
size_t J9::Options::_scratchSpaceLimitKBWhenLowVirtualMemory = 64*1024; // 64MB; currently, only used on 32 bit Windows
266
267
int32_t J9::Options::_scratchSpaceFactorWhenJSR292Workload = JSR292_SCRATCH_SPACE_FACTOR;
268
size_t J9::Options::_scratchSpaceLimitForHotCompilations = 512 * 1024 * 1024; // 512 MB
269
#if defined(J9VM_OPT_JITSERVER)
270
int32_t J9::Options::_scratchSpaceFactorWhenJITServerWorkload = 2;
271
#endif /* defined(J9VM_OPT_JITSERVER) */
272
int32_t J9::Options::_lowVirtualMemoryMBThreshold = 300; // Used on 32 bit Windows, Linux, 31 bit z/OS, Linux
273
int32_t J9::Options::_safeReservePhysicalMemoryValue = 32 << 20; // 32 MB
274
275
int32_t J9::Options::_numDLTBufferMatchesToEagerlyIssueCompReq = 8; //a value of 1 or less disables the DLT tracking mechanism
276
int32_t J9::Options::_dltPostponeThreshold = 2;
277
278
int32_t J9::Options::_expensiveCompWeight = TR::CompilationInfo::JSR292_WEIGHT;
279
int32_t J9::Options::_jProfilingEnablementSampleThreshold = 10000;
280
281
bool J9::Options::_aggressiveLockReservation = false;
282
283
//************************************************************************
284
//
285
// Options handling - the following code implements the VM-specific
286
// jit command-line options.
287
//
288
// Options processing is table-driven, the table for VM-specific options
289
// here (see Options.hpp for a description of the table entries).
290
//
291
//************************************************************************
292
293
// Helper routines to parse and format -Xlp:codecache Options
294
enum TR_XlpCodeCacheOptions
295
{
296
XLPCC_PARSING_FIRST_OPTION,
297
XLPCC_PARSING_OPTION,
298
XLPCC_PARSING_COMMA,
299
XLPCC_PARSING_ERROR
300
};
301
302
// Returns large page flag type string for error handling.
303
char *
304
getLargePageTypeString(UDATA pageFlags)
305
{
306
if (0 != (J9PORT_VMEM_PAGE_FLAG_PAGEABLE & pageFlags))
307
return "pageable";
308
else if (0 != (J9PORT_VMEM_PAGE_FLAG_FIXED & pageFlags))
309
return "nonpageable";
310
else
311
return "not used";
312
}
313
314
// Formats size to be in terms of X bytes to XX(K/M/G) for printing
315
void
316
qualifiedSize(UDATA *byteSize, char **qualifier)
317
{
318
UDATA size;
319
320
size = *byteSize;
321
*qualifier = "";
322
if(!(size % 1024)) {
323
size /= 1024;
324
*qualifier = "K";
325
if(size && !(size % 1024)) {
326
size /= 1024;
327
*qualifier = "M";
328
if(size && !(size % 1024)) {
329
size /= 1024;
330
*qualifier = "G";
331
}
332
}
333
}
334
*byteSize = size;
335
}
336
337
338
bool
339
J9::Options::useCompressedPointers()
340
{
341
return TR::Compiler->om.compressObjectReferences();
342
}
343
344
345
#ifdef DEBUG
346
#define BUILD_TYPE "(debug)"
347
#else
348
#define BUILD_TYPE ""
349
#endif
350
351
char *
352
J9::Options::versionOption(char * option, void * base, TR::OptionTable *entry)
353
{
354
J9JITConfig * jitConfig = (J9JITConfig*)base;
355
PORT_ACCESS_FROM_JAVAVM(jitConfig->javaVM);
356
j9tty_printf(PORTLIB, "JIT: using build \"%s %s\" %s\n", __DATE__, __TIME__, BUILD_TYPE);
357
j9tty_printf(PORTLIB, "JIT level: %s\n", TR_BUILD_NAME);
358
return option;
359
}
360
#undef BUILD_TYPE
361
362
363
char *
364
J9::Options::limitOption(char * option, void * base, TR::OptionTable *entry)
365
{
366
if (!J9::Options::getDebug() && !J9::Options::createDebug())
367
return 0;
368
369
if (J9::Options::getJITCmdLineOptions() == NULL)
370
{
371
// if JIT options are NULL, means we're processing AOT options now
372
return J9::Options::getDebug()->limitOption(option, base, entry, TR::Options::getAOTCmdLineOptions(), false);
373
}
374
else
375
{
376
// otherwise, we're processing JIT options
377
return J9::Options::getDebug()->limitOption(option, base, entry, TR::Options::getJITCmdLineOptions(), false);
378
}
379
}
380
381
382
char *
383
J9::Options::limitfileOption(char * option, void * base, TR::OptionTable *entry)
384
{
385
if (!J9::Options::getDebug() && !J9::Options::createDebug())
386
return 0;
387
388
J9JITConfig * jitConfig = (J9JITConfig*)base;
389
TR_PseudoRandomNumbersListElement **pseudoRandomNumbersListPtr = NULL;
390
if (jitConfig != 0)
391
{
392
TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig);
393
pseudoRandomNumbersListPtr = compInfo->getPersistentInfo()->getPseudoRandomNumbersListPtr();
394
}
395
396
if (J9::Options::getJITCmdLineOptions() == NULL)
397
{
398
// if JIT options are NULL, means we're processing AOT options now
399
return J9::Options::getDebug()->limitfileOption(option, base, entry, TR::Options::getAOTCmdLineOptions(), false, pseudoRandomNumbersListPtr);
400
}
401
else
402
{
403
// otherwise, we're processing JIT options
404
return J9::Options::getDebug()->limitfileOption(option, base, entry, TR::Options::getJITCmdLineOptions(), false, pseudoRandomNumbersListPtr);
405
}
406
}
407
408
char *
409
J9::Options::inlinefileOption(char * option, void * base, TR::OptionTable *entry)
410
{
411
if (!J9::Options::getDebug() && !J9::Options::createDebug())
412
return 0;
413
414
if (J9::Options::getJITCmdLineOptions() == NULL)
415
{
416
// if JIT options are NULL, means we're processing AOT options now
417
return J9::Options::getDebug()->inlinefileOption(option, base, entry, TR::Options::getAOTCmdLineOptions());
418
}
419
else
420
{
421
// otherwise, we're processing JIT options
422
return J9::Options::getDebug()->inlinefileOption(option, base, entry, TR::Options::getJITCmdLineOptions());
423
}
424
}
425
426
427
struct vmX
428
{
429
uint32_t _xstate;
430
const char *_xname;
431
int32_t _xsize;
432
};
433
434
435
static const struct vmX vmSharedStateArray[] =
436
{
437
{J9VMSTATE_SHAREDCLASS_FIND, "J9VMSTATE_SHAREDCLASS_FIND", 0}, //9 0x80001
438
{J9VMSTATE_SHAREDCLASS_STORE, "J9VMSTATE_SHAREDCLASS_STORE", 0}, //10 0x80002
439
{J9VMSTATE_SHAREDCLASS_MARKSTALE, "J9VMSTATE_SHAREDCLASS_MARKSTALE", 0}, //11 0x80003
440
{J9VMSTATE_SHAREDAOT_FIND, "J9VMSTATE_SHAREDAOT_FIND", 0}, //12 0x80004
441
{J9VMSTATE_SHAREDAOT_STORE, "J9VMSTATE_SHAREDAOT_STORE", 0}, //13 0x80005
442
{J9VMSTATE_SHAREDDATA_FIND, "J9VMSTATE_SHAREDDATA_FIND", 0}, //14 0x80006
443
{J9VMSTATE_SHAREDDATA_STORE, "J9VMSTATE_SHAREDDATA_STORE", 0}, //15 0x80007
444
{J9VMSTATE_SHAREDCHARARRAY_FIND, "J9VMSTATE_SHAREDCHARARRAY_FIND", 0}, //16 0x80008
445
{J9VMSTATE_SHAREDCHARARRAY_STORE, "J9VMSTATE_SHAREDCHARARRAY_STORE", 0}, //17 0x80009
446
{J9VMSTATE_ATTACHEDDATA_STORE, "J9VMSTATE_ATTACHEDDATA_STORE", 0}, //18 0x8000a
447
{J9VMSTATE_ATTACHEDDATA_FIND, "J9VMSTATE_ATTACHEDDATA_FIND", 0}, //19 0x8000b
448
{J9VMSTATE_ATTACHEDDATA_UPDATE, "J9VMSTATE_ATTACHEDDATA_UPDATE", 0}, //20 0x8000c
449
};
450
451
452
static const struct vmX vmJniStateArray[] =
453
{
454
{J9VMSTATE_JNI, "J9VMSTATE_JNI", 0}, //4 0x40000
455
{J9VMSTATE_JNI_FROM_JIT, "J9VMSTATE_JNI_FROM_JIT", 0}, // 0x40001
456
};
457
458
459
static const struct vmX vmStateArray[] =
460
{
461
{0xdead, "unknown", 0}, //0
462
{J9VMSTATE_INTERPRETER, "J9VMSTATE_INTERPRETER", 0}, //1 0x10000
463
{J9VMSTATE_GC, "J9VMSTATE_GC", 0}, //2 0x20000
464
{J9VMSTATE_GROW_STACK, "J9VMSTATE_GROW_STACK", 0}, //3 0x30000
465
{J9VMSTATE_JNI, "special", 2}, //4 0x40000
466
{J9VMSTATE_JIT, "J9VMSTATE_JIT", 0}, //5 0x50000
467
{J9VMSTATE_BCVERIFY, "J9VMSTATE_BCVERIFY", 0}, //6 0x60000
468
{J9VMSTATE_RTVERIFY, "J9VMSTATE_RTVERIFY", 0}, //7 0x70000
469
{J9VMSTATE_SHAREDCLASS_FIND, "special", 12}, //8 0x80000
470
{J9VMSTATE_SNW_STACK_VALIDATE, "J9VMSTATE_SNW_STACK_VALIDATE", 0}, //9 0x110000
471
{J9VMSTATE_GP, "J9VMSTATE_GP", 0} //10 0xFFFF0000
472
};
473
474
475
namespace J9
476
{
477
478
char *
479
Options::gcOnResolveOption(char * option, void * base, TR::OptionTable *entry)
480
{
481
J9JITConfig * jitConfig = (J9JITConfig*)base;
482
483
jitConfig->gcOnResolveThreshold = 0;
484
jitConfig->runtimeFlags |= J9JIT_SCAVENGE_ON_RESOLVE;
485
if (* option == '=')
486
{
487
for (option++; * option >= '0' && * option <= '9'; option++)
488
jitConfig->gcOnResolveThreshold = jitConfig->gcOnResolveThreshold *10 + * option - '0';
489
}
490
entry->msgInfo = jitConfig->gcOnResolveThreshold;
491
return option;
492
}
493
494
495
char *
496
Options::vmStateOption(char * option, void * base, TR::OptionTable *entry)
497
{
498
J9JITConfig * jitConfig = (J9JITConfig*)base;
499
PORT_ACCESS_FROM_JAVAVM(jitConfig->javaVM);
500
char *p = option;
501
int32_t state = strtol(option, &p, 16);
502
if (state > 0)
503
{
504
uint32_t index = (state >> 16) & 0xFF;
505
bool invalidState = false;
506
if (!isValidVmStateIndex(index))
507
invalidState = true;
508
509
if (!invalidState)
510
{
511
uint32_t origState = vmStateArray[index]._xstate;
512
switch (index)
513
{
514
case ((J9VMSTATE_JNI>>16) & 0xF):
515
invalidState = true;
516
if ((state & 0xFFFF0) == origState)
517
{
518
int32_t lowState = state & 0xF;
519
if (lowState >= 0 && lowState < vmStateArray[index]._xsize)
520
{
521
invalidState = false;
522
j9tty_printf(PORTLIB, "vmState [0x%x]: {%s}\n", state, vmJniStateArray[lowState]._xname);
523
}
524
}
525
break;
526
case ((J9VMSTATE_SHAREDCLASS_FIND>>16) & 0xF):
527
invalidState = true;
528
if ((state & 0xFFFF0) == (origState & 0xFFFF0))
529
{
530
int32_t lowState = state & 0xF;
531
if (lowState >= 0x1 && lowState <= vmStateArray[index]._xsize)
532
{
533
invalidState = false;
534
j9tty_printf(PORTLIB, "vmState [0x%x]: {%s}\n", state, vmSharedStateArray[--lowState]._xname);
535
}
536
}
537
break;
538
case ((J9VMSTATE_JIT >> 16) & 0xF):
539
{
540
if ((state & 0xFF00) == 0) // ILGeneratorPhase
541
{
542
j9tty_printf(PORTLIB, "vmState [0x%x]: {%s} {ILGeneration}\n", state, vmStateArray[index]._xname);
543
}
544
else if ((state & J9VMSTATE_JIT_OPTIMIZER) == J9VMSTATE_JIT_OPTIMIZER)
545
{
546
OMR::Optimizations opts = static_cast<OMR::Optimizations>((state & 0xFF00) >> 8);
547
if (opts < OMR::numOpts)
548
{
549
j9tty_printf(PORTLIB, "vmState [0x%x]: {%s} {%s}\n", state, vmStateArray[index]._xname, OMR::Optimizer::getOptimizationName(opts));
550
}
551
else
552
j9tty_printf(PORTLIB, "vmState [0x%x]: {%s} {Illegal optimization number}\n", state, vmStateArray[index]._xname);
553
}
554
else if ((state & J9VMSTATE_JIT_CODEGEN) == J9VMSTATE_JIT_CODEGEN)
555
{
556
TR::CodeGenPhase::PhaseValue phase = static_cast<TR::CodeGenPhase::PhaseValue>(state & 0xFF);
557
if ( phase < TR::CodeGenPhase::getNumPhases())
558
j9tty_printf(PORTLIB, "vmState [0x%x]: {%s} {%s}\n", state, vmStateArray[index]._xname, TR::CodeGenPhase::getName(phase));
559
else
560
j9tty_printf(PORTLIB, "vmState [0x%x]: {%s} {Illegal codegen phase number}\n", state, vmStateArray[index]._xname);
561
}
562
else
563
invalidState = true;
564
}
565
break;
566
default:
567
if (state != origState)
568
invalidState = true;
569
else
570
j9tty_printf(PORTLIB, "vmState [0x%x]: {%s}\n", state, vmStateArray[index]._xname);
571
break;
572
}
573
}
574
575
if (invalidState)
576
j9tty_printf(PORTLIB, "vmState [0x%x]: not a valid vmState\n", state);
577
}
578
else
579
{
580
// a bad vmState, eat it up atleast
581
//
582
j9tty_printf(PORTLIB, "vmState [0x%x]: not a valid vmState\n", state);
583
}
584
for (; *p; p++);
585
586
return p;
587
}
588
589
590
char *
591
Options::loadLimitOption(char * option, void * base, TR::OptionTable *entry)
592
{
593
if (!TR::Options::getDebug() && !TR::Options::createDebug())
594
return 0;
595
if (TR::Options::getJITCmdLineOptions() == NULL)
596
{
597
// if JIT options are NULL, means we're processing AOT options now
598
return TR::Options::getDebug()->limitOption(option, base, entry, TR::Options::getAOTCmdLineOptions(), true);
599
}
600
else
601
{
602
// otherwise, we're processing JIT options
603
J9JITConfig * jitConfig = (J9JITConfig*)base;
604
PORT_ACCESS_FROM_JAVAVM(jitConfig->javaVM);
605
// otherwise, we're processing JIT options
606
j9tty_printf(PORTLIB, "<JIT: loadLimit option should be specified on -Xaot --> '%s'>\n", option);
607
return option;
608
//return J9::Options::getDebug()->limitOption(option, base, entry, getJITCmdLineOptions(), true);
609
}
610
}
611
612
613
char *
614
Options::loadLimitfileOption(char * option, void * base, TR::OptionTable *entry)
615
{
616
if (!TR::Options::getDebug() && !TR::Options::createDebug())
617
return 0;
618
619
J9JITConfig * jitConfig = (J9JITConfig*)base;
620
TR_PseudoRandomNumbersListElement **pseudoRandomNumbersListPtr = NULL;
621
if (jitConfig != 0)
622
{
623
TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig);
624
pseudoRandomNumbersListPtr = compInfo->getPersistentInfo()->getPseudoRandomNumbersListPtr();
625
}
626
627
if (TR::Options::getJITCmdLineOptions() == NULL)
628
{
629
// if JIT options are NULL, means we're processing AOT options now
630
return TR::Options::getDebug()->limitfileOption(option, base, entry, TR::Options::getAOTCmdLineOptions(), true /* new param */, pseudoRandomNumbersListPtr);
631
}
632
else
633
{
634
J9JITConfig * jitConfig = (J9JITConfig*)base;
635
PORT_ACCESS_FROM_JAVAVM(jitConfig->javaVM);
636
// otherwise, we're processing JIT options
637
j9tty_printf(PORTLIB, "<JIT: loadLimitfile option should be specified on -Xaot --> '%s'>\n", option);
638
return option;
639
}
640
}
641
642
643
char *
644
Options::tprofOption(char * option, void * base, TR::OptionTable *entry)
645
{
646
J9JITConfig * jitConfig = (J9JITConfig*)base;
647
PORT_ACCESS_FROM_JAVAVM(jitConfig->javaVM);
648
enableCompiledMethodLoadHookOnly = true;
649
return option;
650
}
651
652
char *
653
Options::setJitConfigRuntimeFlag(char *option, void *base, TR::OptionTable *entry)
654
{
655
J9JITConfig *jitConfig = (J9JITConfig*)_feBase;
656
jitConfig->runtimeFlags |= entry->parm2;
657
return option;
658
}
659
660
char *
661
Options::resetJitConfigRuntimeFlag(char *option, void *base, TR::OptionTable *entry)
662
{
663
J9JITConfig *jitConfig = (J9JITConfig*)_feBase;
664
jitConfig->runtimeFlags &= ~(entry->parm2);
665
return option;
666
}
667
668
char *
669
Options::setJitConfigNumericValue(char *option, void *base, TR::OptionTable *entry)
670
{
671
char *jitConfig = (char*)_feBase;
672
// All numeric fields in jitConfig are declared as UDATA
673
*((intptr_t*)(jitConfig + entry->parm1)) = (intptr_t)TR::Options::getNumericValue(option);
674
return option;
675
}
676
677
}
678
679
#define SET_JITCONFIG_RUNTIME_FLAG(x) J9::Options::setJitConfigRuntimeFlag, 0, (x), "F", NOT_IN_SUBSET
680
#define RESET_JITCONFIG_RUNTIME_FLAG(x) J9::Options::resetJitConfigRuntimeFlag, 0, (x), "F", NOT_IN_SUBSET
681
682
// DMDM: hack
683
TR::OptionTable OMR::Options::_feOptions[] = {
684
685
{"activeThreadsThresholdForInterpreterSampling=", "M<nnn>\tSampling does not affect invocation count beyond this threshold",
686
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_activeThreadsThreshold, 0, "F%d", NOT_IN_SUBSET },
687
{"aotMethodCompilesThreshold=", "R<nnn>\tIf this many AOT methods are compiled before exceeding aotMethodThreshold, don't stop AOT compiling",
688
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_aotMethodCompilesThreshold, 0, "F%d", NOT_IN_SUBSET},
689
{"aotMethodThreshold=", "R<nnn>\tNumber of methods found in shared cache after which we stop AOTing",
690
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_aotMethodThreshold, 0, "F%d", NOT_IN_SUBSET},
691
{"aotWarmSCCThreshold=", "R<nnn>\tNumber of methods found in shared cache at startup to declare SCC as warm",
692
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_aotWarmSCCThreshold, 0, "F%d", NOT_IN_SUBSET },
693
{"availableCPUPercentage=", "M<nnn>\tUse it when java process has a fraction of a CPU. Number 1..99 ",
694
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_availableCPUPercentage, 0, "F%d", NOT_IN_SUBSET},
695
{"bcLimit=", "C<nnn>\tbytecode size limit",
696
TR::Options::setJitConfigNumericValue, offsetof(J9JITConfig, bcSizeLimit), 0, "P%d"},
697
{"bcountForBootstrapMethods=", "M<nnn>\tcount for loopy methods belonging to bootstrap classes. "
698
"Used in no AOT cases",
699
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_countForLoopyBootstrapMethods, 250, "F%d", NOT_IN_SUBSET },
700
{"bigAppSampleThresholdAdjust=", "O\tadjust the hot and scorching threshold for certain 'big' apps",
701
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_bigAppSampleThresholdAdjust, 0, "F%d", NOT_IN_SUBSET},
702
{"catchSamplingSizeThreshold=", "R<nnn>\tThe sample counter will not be decremented in a catch block "
703
"if the number of nodes in the compiled method exceeds this threshold",
704
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_catchSamplingSizeThreshold, 0, "F%d", NOT_IN_SUBSET},
705
{"classLoadPhaseInterval=", "O<nnn>\tnumber of sampling ticks before we run "
706
"again the code for a class loading phase detection",
707
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_classLoadingPhaseInterval, 0, "P%d", NOT_IN_SUBSET},
708
{"classLoadPhaseQuiesceIntervals=", "O<nnn>\tnumber of intervals we remain in classLoadPhase after it ended",
709
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_numClassLoadPhaseQuiesceIntervals, 0, "F%d", NOT_IN_SUBSET},
710
{"classLoadPhaseThreshold=", "O<nnn>\tnumber of classes loaded per sampling tick that "
711
"needs to be attained to enter the class loading phase. "
712
"Specify a very large value to disable this optimization",
713
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_classLoadingPhaseThreshold, 0, "P%d", NOT_IN_SUBSET},
714
{"classLoadPhaseVariance=", "O<nnn>\tHow much the classLoadPhaseThreshold can deviate from "
715
"its average value (as a percentage). Specify an integer 0-99",
716
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_classLoadingPhaseVariance, 0, "F%d", NOT_IN_SUBSET},
717
{"classLoadRateAverage=", "O<nnn>\tnumber of classes loaded per second on an average machine",
718
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_classLoadingRateAverage, 0, "F%d", NOT_IN_SUBSET},
719
{"clinit", "D\tforce compilation of <clinit> methods", SET_JITCONFIG_RUNTIME_FLAG(J9JIT_COMPILE_CLINIT) },
720
{"code=", "C<nnn>\tcode cache size, in KB",
721
TR::Options::setJitConfigNumericValue, offsetof(J9JITConfig, codeCacheKB), 0, "F%d (KB)"},
722
{"codepad=", "C<nnn>\ttotal code cache pad size, in KB",
723
TR::Options::setJitConfigNumericValue, offsetof(J9JITConfig, codeCachePadKB), 0, "F%d (KB)"},
724
{"codetotal=", "C<nnn>\ttotal code memory limit, in KB",
725
TR::Options::setJitConfigNumericValue, offsetof(J9JITConfig, codeCacheTotalKB), 0, "F%d (KB)"},
726
{"compilationBudget=", "O<nnn>\tnumber of usec. Used to better interleave compilation"
727
"with computation. Use 80000 as a starting point",
728
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_compilationBudget, 0, "P%d", NOT_IN_SUBSET},
729
{"compilationDelayTime=", "M<nnn>\tnumber of seconds after which we allow compiling",
730
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_compilationDelayTime, 0, "F%d", NOT_IN_SUBSET },
731
{"compilationExpirationTime=", "R<nnn>\tnumber of seconds after which point we will stop compiling",
732
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_compilationExpirationTime, 0, "F%d", NOT_IN_SUBSET},
733
{"compilationPriorityQSZThreshold=", "M<nnn>\tCompilation queue size threshold when priority of post-profiling"
734
"compilation requests is increased",
735
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_compPriorityQSZThreshold , 0, "F%d", NOT_IN_SUBSET},
736
{"compilationQueueSizeLimit=", "R<nnn>\tWhen limit is reached, first-time compilations are postponed by replenishing the invocation count",
737
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_qszLimit, 0, "F%d", NOT_IN_SUBSET},
738
{"compilationThreadAffinityMask=", "M<nnn>\taffinity mask for compilation threads. Use hexa without 0x",
739
TR::Options::setStaticHexadecimal, (intptr_t)&TR::Options::_compThreadAffinityMask, 0, "F%d", NOT_IN_SUBSET},
740
{"compilationYieldStatsHeartbeatPeriod=", "M<nnn>\tperiodically print stats about compilation yield points "
741
"Period is in ms. Default is 0 which means don't do it. "
742
"Values between 1 and 99 ms will be upgraded to 100 ms.",
743
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_compYieldStatsHeartbeatPeriod, 0, "F%d", NOT_IN_SUBSET},
744
{"compilationYieldStatsThreshold=", "M<nnn>\tprint stats about compilation yield points if the "
745
"threshold is exceeded. Default 1000 usec. ",
746
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_compYieldStatsThreshold, 0, "F%d", NOT_IN_SUBSET},
747
{"compThreadPriority=", "M<nnn>\tThe priority of the compilation thread. "
748
"Use an integer between 0 and 4. Default is 4 (highest priority)",
749
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_compilationThreadPriorityCode, 0, "F%d", NOT_IN_SUBSET},
750
{"conservativeScorchingSampleThreshold=", "R<nnn>\tLower bound for scorchingSamplingThreshold when scaling based on numProc",
751
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_conservativeScorchingSampleThreshold, 0, "F%d", NOT_IN_SUBSET},
752
{"countForBootstrapMethods=", "M<nnn>\tcount for loopless methods belonging to bootstrap classes. "
753
"Used in no AOT cases",
754
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_countForLooplessBootstrapMethods, 1000, "F%d", NOT_IN_SUBSET },
755
{"cpuCompTimeExpensiveThreshold=", "M<nnn>\tthreshold for when hot & very-hot compilations occupied enough cpu time to be considered expensive in millisecond",
756
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_cpuCompTimeExpensiveThreshold, 0, "F%d", NOT_IN_SUBSET},
757
{"cpuEntitlementForConservativeScorching=", "M<nnn>\tPercentage. 200 means two full cpus",
758
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_cpuEntitlementForConservativeScorching, 0, "F%d", NOT_IN_SUBSET },
759
{"cpuUtilThresholdForStarvation=", "M<nnn>\tThreshold for deciding that a comp thread is not starved",
760
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_cpuUtilThresholdForStarvation , 0, "F%d", NOT_IN_SUBSET},
761
{"data=", "C<nnn>\tdata cache size, in KB",
762
TR::Options::setJitConfigNumericValue, offsetof(J9JITConfig, dataCacheKB), 0, "F%d (KB)"},
763
{"dataCacheMinQuanta=", "I<nnn>\tMinimum number of quantums per data cache allocation",
764
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_dataCacheMinQuanta, 0, "F%d", NOT_IN_SUBSET},
765
{"dataCacheQuantumSize=", "I<nnn>\tLargest guaranteed common byte multiple of data cache allocations. This value will be rounded up for pointer alignment.",
766
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_dataCacheQuantumSize, 0, "F%d", NOT_IN_SUBSET},
767
{"datatotal=", "C<nnn>\ttotal data memory limit, in KB",
768
TR::Options::setJitConfigNumericValue, offsetof(J9JITConfig, dataCacheTotalKB), 0, "F%d (KB)"},
769
{"disableIProfilerClassUnloadThreshold=", "R<nnn>\tNumber of classes that can be unloaded before we disable the IProfiler",
770
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_disableIProfilerClassUnloadThreshold, 0, "F%d", NOT_IN_SUBSET},
771
{"dltPostponeThreshold=", "M<nnn>\tNumber of dlt attempts inv. count for a method is seen not advancing",
772
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_dltPostponeThreshold, 0, "F%d", NOT_IN_SUBSET },
773
{"exclude=", "D<xxx>\tdo not compile methods beginning with xxx", TR::Options::limitOption, 1, 0, "P%s"},
774
{"expensiveCompWeight=", "M<nnn>\tweight of a comp request to be considered expensive",
775
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_expensiveCompWeight, 0, "F%d", NOT_IN_SUBSET },
776
{"experimentalClassLoadPhaseInterval=", "O<nnn>\tnumber of sampling ticks to stay in a class load phase",
777
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_experimentalClassLoadPhaseInterval, 0, "P%d", NOT_IN_SUBSET},
778
{"gcNotify", "L\tlog scavenge/ggc notifications to stdout", SET_JITCONFIG_RUNTIME_FLAG(J9JIT_GC_NOTIFY) },
779
{"gcOnResolve", "D[=<nnn>]\tscavenge on every resolve, or every resolve after nnn",
780
TR::Options::gcOnResolveOption, 0, 0, "F=%d"},
781
{"GCRQueuedThresholdForCounting=", "M<nnn>\tDisable GCR counting if number of queued GCR requests exceeds this threshold",
782
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_GCRQueuedThresholdForCounting , 0, "F%d", NOT_IN_SUBSET},
783
#ifdef DEBUG
784
{"gcTrace=", "D<nnn>\ttrace gc stack walks after gc number nnn",
785
TR::Options::setJitConfigNumericValue, offsetof(J9JITConfig, gcTraceThreshold), 0, "F%d"},
786
#endif
787
#if defined(J9VM_OPT_JITSERVER)
788
{"highActiveThreadThreshold=", " \tDefines what is a high Threshold for active compilations",
789
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_highActiveThreadThreshold, 0, "F%d"},
790
#endif /* defined(J9VM_OPT_JITSERVER) */
791
{"HWProfilerAOTWarmOptLevelThreshold=", "O<nnn>\tAOT Warm Opt Level Threshold",
792
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerAOTWarmOptLevelThreshold, 0, "F%d", NOT_IN_SUBSET},
793
{"HWProfilerBufferMaxPercentageToDiscard=", "O<nnn>\tpercentage of HW profiling buffers "
794
"that JIT is allowed to discard instead of processing",
795
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwProfilerBufferMaxPercentageToDiscard, 0, "F%d", NOT_IN_SUBSET},
796
{"HWProfilerDisableAOT", "O<nnn>\tDisable RI AOT",
797
SET_OPTION_BIT(TR_HWProfilerDisableAOT), "F", NOT_IN_SUBSET},
798
{"HWProfilerDisableRIOverPrivageLinkage","O<nnn>\tDisable RI over private linkage",
799
SET_OPTION_BIT(TR_HWProfilerDisableRIOverPrivateLinkage), "F", NOT_IN_SUBSET},
800
{"HWProfilerExpirationTime=", "R<nnn>\t",
801
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwProfilerExpirationTime, 0, "F%d", NOT_IN_SUBSET },
802
{"HWProfilerHotOptLevelThreshold=", "O<nnn>\tHot Opt Level Threshold",
803
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerHotOptLevelThreshold, 0, "F%d", NOT_IN_SUBSET},
804
{"HWProfilerLastOptLevel=", "O<nnn>\tLast Opt level",
805
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerLastOptLevel, 0, "F%d", NOT_IN_SUBSET},
806
{"HWProfilerNumDowngradesToTurnRION=", "R<nnn>\t",
807
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_numDowngradesToTurnRION, 0, "F%d", NOT_IN_SUBSET },
808
{"HWProfilerNumOutstandingBuffers=", "O<nnn>\tnumber of outstanding hardware profiling buffers "
809
"allowed in the system. Specify 0 to disable this optimization",
810
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerNumOutstandingBuffers, 0, "F%d", NOT_IN_SUBSET},
811
{"HWProfilerPRISamplingRate=", "O<nnn>\tP RI Scaling Factor",
812
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerPRISamplingRate, 0, "F%d", NOT_IN_SUBSET},
813
{"HWProfilerQSZMaxThresholdToRIDowngrade=", "R<nnn>\t",
814
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_qszMaxThresholdToRIDowngrade, 0, "F%d", NOT_IN_SUBSET },
815
{"HWProfilerQSZMinThresholdToRIDowngrade=", "R<nnn>\t",
816
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_qszMinThresholdToRIDowngrade, 0, "F%d", NOT_IN_SUBSET },
817
{"HWProfilerQSZToTurnRION=", "R<nnn>\t",
818
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_qszThresholdToTurnRION, 0, "F%d", NOT_IN_SUBSET },
819
{"HWProfilerRecompilationDecisionWindow=", "R<nnn>\tNumber of decisions to wait for before looking at stats decision outcome",
820
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwProfilerRecompDecisionWindow, 0, "F%d", NOT_IN_SUBSET },
821
{"HWProfilerRecompilationFrequencyThreshold=", "R<nnn>\tLess than 1 in N decisions to recompile, turns RI off",
822
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwProfilerRecompFrequencyThreshold, 0, "F%d", NOT_IN_SUBSET },
823
{"HWProfilerRecompilationInterval=", "O<nnn>\tRecompilation Interval",
824
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerRecompilationInterval, 0, "F%d", NOT_IN_SUBSET},
825
{"HWProfilerReducedWarmOptLevelThreshold=", "O<nnn>\tReduced Warm Opt Level Threshold",
826
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerReducedWarmOptLevelThreshold, 0, "F%d", NOT_IN_SUBSET},
827
{"HWProfilerRIBufferPoolSize=", "O<nnn>\tRI Buffer Pool Size",
828
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerRIBufferPoolSize, 0, "F%d", NOT_IN_SUBSET},
829
{"HWProfilerRIBufferProcessingFrequency=", "O<nnn>\tRI Buffer Processing Frequency",
830
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwProfilerRIBufferProcessingFrequency, 0, "F%d", NOT_IN_SUBSET},
831
{"HWProfilerRIBufferThreshold=", "O<nnn>\tRI Buffer Threshold",
832
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerRIBufferThreshold, 0, "F%d", NOT_IN_SUBSET},
833
{"HWProfilerScorchingOptLevelThreshold=", "O<nnn>\tScorching Opt Level Threshold",
834
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerScorchingOptLevelThreshold, 0, "F%d", NOT_IN_SUBSET},
835
{"HWProfilerWarmOptLevelThreshold=", "O<nnn>\tWarm Opt Level Threshold",
836
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerWarmOptLevelThreshold, 0, "F%d", NOT_IN_SUBSET},
837
{"HWProfilerZRIBufferSize=", "O<nnn>\tZ RI Buffer Size",
838
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerZRIBufferSize, 0, "F%d", NOT_IN_SUBSET},
839
{"HWProfilerZRIMode=", "O<nnn>\tZ RI Mode",
840
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerZRIMode, 0, "F%d", NOT_IN_SUBSET},
841
{"HWProfilerZRIRGS=", "O<nnn>\tZ RI Reporting Group Size",
842
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerZRIRGS, 0, "F%d", NOT_IN_SUBSET},
843
{"HWProfilerZRISF=", "O<nnn>\tZ RI Scaling Factor",
844
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_hwprofilerZRISF, 0, "F%d", NOT_IN_SUBSET},
845
{"inlinefile=", "D<filename>\tinline filter defined in filename. "
846
"Use inlinefile=filename", TR::Options::inlinefileOption, 0, 0, "F%s"},
847
{"interpreterSamplingDivisor=", "R<nnn>\tThe divisor used to decrease the invocation count when an interpreted method is sampled",
848
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_interpreterSamplingDivisor, 0, "F%d", NOT_IN_SUBSET},
849
{"interpreterSamplingThreshold=", "R<nnn>\tThe maximum invocation count at which a sampling hit will result in the count being divided by the value of interpreterSamplingDivisor",
850
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_interpreterSamplingThreshold, 0, "F%d", NOT_IN_SUBSET},
851
{"interpreterSamplingThresholdInJSR292=", "R<nnn>\tThe maximum invocation count at which a sampling hit will result in the count being divided by the value of interpreterSamplingDivisor on a MethodHandle-oriented workload",
852
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_interpreterSamplingThresholdInJSR292, 0, "F%d", NOT_IN_SUBSET},
853
{"interpreterSamplingThresholdInStartupMode=", "R<nnn>\tThe maximum invocation count at which a sampling hit will result in the count being divided by the value of interpreterSamplingDivisor",
854
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_interpreterSamplingThresholdInStartupMode, 0, "F%d", NOT_IN_SUBSET},
855
{"invocationThresholdToTriggerLowPriComp=", "M<nnn>\tNumber of times a loopy method must be invoked to be eligible for LPQ",
856
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_invocationThresholdToTriggerLowPriComp, 0, "F%d", NOT_IN_SUBSET },
857
{"iprofilerBufferInterarrivalTimeToExitDeepIdle=", "M<nnn>\tIn ms. If 4 IP buffers arrive back-to-back more frequently than this value, JIT exits DEEP_IDLE",
858
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_iProfilerBufferInterarrivalTimeToExitDeepIdle, 0, "F%d", NOT_IN_SUBSET },
859
{"iprofilerBufferMaxPercentageToDiscard=", "O<nnn>\tpercentage of interpreter profiling buffers "
860
"that JIT is allowed to discard instead of processing",
861
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_iprofilerBufferMaxPercentageToDiscard, 0, "F%d", NOT_IN_SUBSET},
862
{"iprofilerBufferSize=", "I<nnn>\t set the size of each iprofiler buffer",
863
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_iprofilerBufferSize, 0, "F%d", NOT_IN_SUBSET},
864
{"iprofilerFailHistorySize=", "I<nnn>\tNumber of entries for the failure history buffer maintained by Iprofiler",
865
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_iprofilerFailHistorySize, 0, "F%d", NOT_IN_SUBSET},
866
{"iprofilerFailRateThreshold=", "I<nnn>\tReactivate Iprofiler if fail rate exceeds this threshold. 1-100",
867
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_iprofilerFailRateThreshold, 0, "F%d", NOT_IN_SUBSET},
868
{"iprofilerIntToTotalSampleRatio=", "O<nnn>\tRatio of Interpreter samples to Total samples",
869
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_iprofilerIntToTotalSampleRatio, 0, "F%d", NOT_IN_SUBSET},
870
{"iprofilerMaxCount=", "O<nnn>\tmax invocation count for IProfiler to be active",
871
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_maxIprofilingCount, 0, "F%d", NOT_IN_SUBSET},
872
{"iprofilerMaxCountInStartupMode=", "O<nnn>\tmax invocation count for IProfiler to be active in STARTUP phase",
873
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_maxIprofilingCountInStartupMode, 0, "F%d", NOT_IN_SUBSET},
874
{"iprofilerMemoryConsumptionLimit=", "O<nnn>\tlimit on memory consumption for interpreter profiling data",
875
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_iProfilerMemoryConsumptionLimit, 0, "P%d", NOT_IN_SUBSET},
876
{"iprofilerNumOutstandingBuffers=", "O<nnn>\tnumber of outstanding interpreter profiling buffers "
877
"allowed in the system. Specify 0 to disable this optimization",
878
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_iprofilerNumOutstandingBuffers, 0, "F%d", NOT_IN_SUBSET},
879
{"iprofilerOffDivisionFactor=", "O<nnn>\tCounts Division factor when IProfiler is Off",
880
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_IprofilerOffDivisionFactor, 0, "F%d", NOT_IN_SUBSET},
881
{"iprofilerOffSubtractionFactor=", "O<nnn>\tCounts Subtraction factor when IProfiler is Off",
882
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_IprofilerOffSubtractionFactor, 0, "F%d", NOT_IN_SUBSET},
883
{"iprofilerSamplesBeforeTurningOff=", "O<nnn>\tnumber of interpreter profiling samples "
884
"needs to be taken after the profiling starts going off to completely turn it off. "
885
"Specify a very large value to disable this optimization",
886
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_iprofilerSamplesBeforeTurningOff, 0, "P%d", NOT_IN_SUBSET},
887
{"itFileNamePrefix=", "L<filename>\tprefix for itrace filename",
888
TR::Options::setStringForPrivateBase, offsetof(TR_JitPrivateConfig,itraceFileNamePrefix), 0, "P%s"},
889
{"jProfilingEnablementSampleThreshold=", "M<nnn>\tNumber of global samples to allow generation of JProfiling bodies",
890
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_jProfilingEnablementSampleThreshold, 0, "F%d", NOT_IN_SUBSET },
891
{"kcaoffsets", "I\tGenerate a header file with offset data for use with KCA", TR::Options::kcaOffsets, 0, 0, "F" },
892
{"largeTranslationTime=", "D<nnn>\tprint IL trees for methods that take more than this value (usec)"
893
"to compile. Need to have a log file defined on command line",
894
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_largeTranslationTime, 0, "F%d", NOT_IN_SUBSET},
895
{"limit=", "D<xxx>\tonly compile methods beginning with xxx", TR::Options::limitOption, 0, 0, "P%s"},
896
{"limitfile=", "D<filename>\tfilter method compilation as defined in filename. "
897
"Use limitfile=(filename,firstLine,lastLine) to limit lines considered from firstLine to lastLine",
898
TR::Options::limitfileOption, 0, 0, "F%s"},
899
{"loadExclude=", "D<xxx>\tdo not relocate AOT methods beginning with xxx", TR::Options::loadLimitOption, 1, 0, "P%s"},
900
{"loadLimit=", "D<xxx>\tonly relocate AOT methods beginning with xxx", TR::Options::loadLimitOption, 0, 0, "P%s"},
901
{"loadLimitFile=", "D<filename>\tfilter AOT method relocation as defined in filename. "
902
"Use loadLimitfile=(filename,firstLine,lastLine) to limit lines considered from firstLine to lastLine",
903
TR::Options::loadLimitfileOption, 0, 0, "P%s"},
904
{"localCSEFrequencyThreshold=", "O<nnn>\tBlocks with frequency lower than the threshold will not be considered by localCSE",
905
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_localCSEFrequencyThreshold, 0, "F%d", NOT_IN_SUBSET },
906
{"loopyMethodDivisionFactor=", "O<nnn>\tCounts Division factor for Loopy methods",
907
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_LoopyMethodDivisionFactor, 0, "F%d", NOT_IN_SUBSET},
908
{"loopyMethodSubtractionFactor=", "O<nnn>\tCounts Subtraction factor for Loopy methods",
909
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_LoopyMethodSubtractionFactor, 0, "F%d", NOT_IN_SUBSET},
910
{"lowerBoundNumProcForScaling=", "M<nnn>\tLower than this numProc we'll use the default scorchingSampleThreshold",
911
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_lowerBoundNumProcForScaling, 0, "F%d", NOT_IN_SUBSET},
912
{"lowVirtualMemoryMBThreshold=","M<nnn>\tThreshold when we declare we are running low on virtual memory. Use 0 to disable the feature",
913
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_lowVirtualMemoryMBThreshold, 0, "F%d", NOT_IN_SUBSET},
914
{"maxCheckcastProfiledClassTests=", "R<nnn>\tnumber inlined profiled classes for profiledclass test in checkcast/instanceof",
915
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_maxCheckcastProfiledClassTests, 0, "F%d", NOT_IN_SUBSET},
916
{"maxOnsiteCacheSlotForInstanceOf=", "R<nnn>\tnumber of onsite cache slots for instanceOf",
917
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_maxOnsiteCacheSlotForInstanceOf, 0, "F%d", NOT_IN_SUBSET},
918
{"minSamplingPeriod=", "R<nnn>\tminimum number of milliseconds between samples for hotness",
919
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_minSamplingPeriod, 0, "P%d", NOT_IN_SUBSET},
920
{"minSuperclassArraySize=", "I<nnn>\t set the size of the minimum superclass array size",
921
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_minimumSuperclassArraySize, 0, "F%d", NOT_IN_SUBSET},
922
{"noregmap", 0, RESET_JITCONFIG_RUNTIME_FLAG(J9JIT_CG_REGISTER_MAPS) },
923
{"numCodeCachesOnStartup=", "R<nnn>\tnumber of code caches to create at startup",
924
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_numCodeCachesToCreateAtStartup, 0, "F%d", NOT_IN_SUBSET},
925
{"numDLTBufferMatchesToEagerlyIssueCompReq=", "R<nnn>\t",
926
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_numDLTBufferMatchesToEagerlyIssueCompReq, 0, "F%d", NOT_IN_SUBSET},
927
{"numInterpCompReqToExitIdleMode=", "M<nnn>\tNumber of first time comp. req. that takes the JIT out of idle mode",
928
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_numFirstTimeCompilationsToExitIdleMode, 0, "F%d", NOT_IN_SUBSET },
929
#if defined(J9VM_OPT_JITSERVER)
930
{"oldAge=", " \tDefines what an old JITServer cache entry means",
931
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_oldAge, 0, "F%d"},
932
{"oldAgeUnderLowMemory=", " \tDefines what an old JITServer cache entry means when memory is low",
933
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_oldAgeUnderLowMemory, 0, "F%d" },
934
#endif /* defined(J9VM_OPT_JITSERVER) */
935
{"profileAllTheTime=", "R<nnn>\tInterpreter profiling will be on all the time",
936
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_profileAllTheTime, 0, "F%d", NOT_IN_SUBSET},
937
{"queuedInvReqThresholdToDowngradeOptLevel=", "M<nnn>\tDowngrade opt level if too many inv req",
938
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_numQueuedInvReqToDowngradeOptLevel , 0, "F%d", NOT_IN_SUBSET},
939
{"queueSizeThresholdToDowngradeDuringCLP=", "M<nnn>\tCompilation queue size threshold (interpreted methods) when opt level is downgraded during class load phase",
940
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_qsziThresholdToDowngradeDuringCLP, 0, "F%d", NOT_IN_SUBSET },
941
{"queueSizeThresholdToDowngradeOptLevel=", "M<nnn>\tCompilation queue size threshold when opt level is downgraded",
942
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_qszThresholdToDowngradeOptLevel , 0, "F%d", NOT_IN_SUBSET},
943
{"queueSizeThresholdToDowngradeOptLevelDuringStartup=", "M<nnn>\tCompilation queue size threshold when opt level is downgraded during startup phase",
944
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_qszThresholdToDowngradeOptLevelDuringStartup , 0, "F%d", NOT_IN_SUBSET },
945
#if defined(J9VM_OPT_JITSERVER)
946
{"reconnectWaitTimeMs=", " \tInitial wait time in milliseconds until attempting to reconnect to JITServer",
947
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_reconnectWaitTimeMs, 0, "F%d", NOT_IN_SUBSET},
948
#endif /* defined(J9VM_OPT_JITSERVER) */
949
{"regmap", 0, SET_JITCONFIG_RUNTIME_FLAG(J9JIT_CG_REGISTER_MAPS) },
950
{"relaxedCompilationLimitsSampleThreshold=", "R<nnn>\tGlobal samples below this threshold means we can use higher compilation limits",
951
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_relaxedCompilationLimitsSampleThreshold, 0, "F%d", NOT_IN_SUBSET },
952
{"resetCountThreshold=", "R<nnn>\tThe number of global samples which if exceed during a method's sampling interval will cause the method's sampling counter to be incremented by the number of samples in a sampling interval",
953
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_resetCountThreshold, 0, "F%d", NOT_IN_SUBSET},
954
{"rtlog=", "L<filename>\twrite verbose run-time output to filename",
955
TR::Options::setStringForPrivateBase, offsetof(TR_JitPrivateConfig,rtLogFileName), 0, "P%s"},
956
{"rtResolve", "D\ttreat all data references as unresolved", SET_JITCONFIG_RUNTIME_FLAG(J9JIT_RUNTIME_RESOLVE) },
957
{"safeReservePhysicalMemoryValue=", "C<nnn>\tsafe buffer value before we risk running out of physical memory, in KB",
958
TR::Options::setStaticNumericKBAdjusted, (intptr_t)&TR::Options::_safeReservePhysicalMemoryValue, 0, "F%d (bytes)"},
959
{"sampleDontSwitchToProfilingThreshold=", "R<nnn>\tThe maximum number of global samples taken during a sample interval for which the method is denied swithing to profiling",
960
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_sampleDontSwitchToProfilingThreshold, 0, "F%d", NOT_IN_SUBSET},
961
{"sampleThresholdVariationAllowance=", "R<nnn>\tThe percentage that we add or subtract from"
962
" the original threshold to adjust for method code size."
963
" Must be 0--100. Make it 0 to disable this optimization.",
964
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_sampleThresholdVariationAllowance, 0, "P%d", NOT_IN_SUBSET},
965
{"samplingFrequencyInDeepIdleMode=", "R<nnn>\tnumber of milliseconds between samples for hotness - in deep idle mode",
966
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_samplingFrequencyInDeepIdleMode, 0, "F%d", NOT_IN_SUBSET},
967
{"samplingFrequencyInIdleMode=", "R<nnn>\tnumber of milliseconds between samples for hotness - in idle mode",
968
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_samplingFrequencyInIdleMode, 0, "F%d", NOT_IN_SUBSET},
969
{"samplingHeartbeatInterval=", "R<nnn>\tnumber of 100ms periods before sampling heartbeat",
970
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_sampleHeartbeatInterval, 0, "F%d", NOT_IN_SUBSET},
971
{"samplingThreadExpirationTime=", "R<nnn>\tnumber of seconds after which point we will stop the sampling thread",
972
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_samplingThreadExpirationTime, 0, "F%d", NOT_IN_SUBSET},
973
{"scorchingSampleThreshold=", "R<nnn>\tThe maximum number of global samples taken during a sample interval for which the method will be recompiled as scorching",
974
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_scorchingSampleThreshold, 0, "F%d", NOT_IN_SUBSET},
975
#if defined(J9VM_OPT_JITSERVER)
976
{"scratchSpaceFactorWhenJITServerWorkload=","M<nnn>\tMultiplier for scratch space limit at JITServer",
977
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_scratchSpaceFactorWhenJITServerWorkload, 0, "F%d", NOT_IN_SUBSET},
978
#endif /* defined(J9VM_OPT_JITSERVER) */
979
{"scratchSpaceFactorWhenJSR292Workload=","M<nnn>\tMultiplier for scratch space limit when MethodHandles are in use",
980
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_scratchSpaceFactorWhenJSR292Workload, 0, "F%d", NOT_IN_SUBSET},
981
{"scratchSpaceLimitKBForHotCompilations=","M<nnn>\tLimit for memory used by JIT when compiling at hot and above (in KB)",
982
TR::Options::setStaticNumericKBAdjusted, (intptr_t)&TR::Options::_scratchSpaceLimitForHotCompilations, 0, "F%d (bytes)", NOT_IN_SUBSET},
983
{"scratchSpaceLimitKBWhenLowVirtualMemory=","M<nnn>\tLimit for memory used by JIT when running on low virtual memory",
984
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_scratchSpaceLimitKBWhenLowVirtualMemory, 0, "F%d", NOT_IN_SUBSET},
985
{"secondaryClassLoadPhaseThreshold=", "O<nnn>\tWhen class load rate just dropped under the CLP threshold "
986
"we use this secondary threshold to determine class load phase",
987
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_secondaryClassLoadingPhaseThreshold, 0, "F%d", NOT_IN_SUBSET},
988
{"seriousCompFailureThreshold=", "M<nnn>\tnumber of srious compilation failures after which we write a trace point in the snap file",
989
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_seriousCompFailureThreshold, 0, "F%d", NOT_IN_SUBSET},
990
#if defined(J9VM_OPT_JITSERVER)
991
{"sharedROMClassCacheNumPartitions=", " \tnumber of JITServer ROMClass cache partitions (each has its own monitor)",
992
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_sharedROMClassCacheNumPartitions, 0, "F%d", NOT_IN_SUBSET},
993
#endif /* defined(J9VM_OPT_JITSERVER) */
994
{"singleCache", "C\tallow only one code cache and one data cache to be allocated", RESET_JITCONFIG_RUNTIME_FLAG(J9JIT_GROW_CACHES) },
995
{"smallMethodBytecodeSizeThreshold=", "O<nnn> \tThreshold for determining small methods "
996
"(measured in number of bytecodes)",
997
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_smallMethodBytecodeSizeThreshold, 0, "F%d", NOT_IN_SUBSET},
998
{"smallMethodBytecodeSizeThresholdForCold=", "O<nnn>\tThreshold for determining small methods at cold "
999
"(measured in number of bytecodes)",
1000
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_smallMethodBytecodeSizeThresholdForCold, 0, "F%d", NOT_IN_SUBSET},
1001
{"smallMethodBytecodeSizeThresholdForJITServerAOTCache=", "O<nnn>\tThreshold for determining small methods that should "
1002
"not be converted to AOT, but rather be jitted remotely",
1003
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_smallMethodBytecodeSizeThresholdForJITServerAOTCache, 0, "F%d", NOT_IN_SUBSET},
1004
{"stack=", "C<nnn>\tcompilation thread stack size in KB",
1005
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_stackSize, 0, "F%d", NOT_IN_SUBSET},
1006
#if defined(J9VM_OPT_JITSERVER)
1007
{"statisticsFrequency=", "R<nnn>\tnumber of milliseconds between statistics print",
1008
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_statisticsFrequency, 0, "F%d", NOT_IN_SUBSET},
1009
#endif /* defined(J9VM_OPT_JITSERVER) */
1010
{"testMode", "D\tequivalent to tossCode", SET_JITCONFIG_RUNTIME_FLAG(J9JIT_TOSS_CODE) },
1011
#if defined(J9VM_OPT_JITSERVER)
1012
{"timeBetweenPurges=", " \tDefines how often we are willing to scan for old entries to be purged",
1013
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_timeBetweenPurges, 0, "F%d"},
1014
#endif /* defined(J9VM_OPT_JITSERVER) */
1015
#if defined(TR_HOST_X86) || defined(TR_HOST_POWER) || defined(TR_HOST_ARM64)
1016
{"tlhPrefetchBoundaryLineCount=", "O<nnn>\tallocation prefetch boundary line for allocation prefetch",
1017
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_TLHPrefetchBoundaryLineCount, 0, "P%d", NOT_IN_SUBSET},
1018
{"tlhPrefetchLineCount=", "O<nnn>\tallocation prefetch line count for allocation prefetch",
1019
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_TLHPrefetchLineCount, 0, "P%d", NOT_IN_SUBSET},
1020
{"tlhPrefetchLineSize=", "O<nnn>\tallocation prefetch line size for allocation prefetch",
1021
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_TLHPrefetchLineSize, 0, "P%d", NOT_IN_SUBSET},
1022
{"tlhPrefetchSize=", "O<nnn>\tallocation prefetch size for allocation prefetch",
1023
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_TLHPrefetchSize, 0, "P%d", NOT_IN_SUBSET},
1024
{"tlhPrefetchStaggeredLineCount=", "O<nnn>\tallocation prefetch staggered line for allocation prefetch",
1025
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_TLHPrefetchStaggeredLineCount, 0, "P%d", NOT_IN_SUBSET},
1026
{"tlhPrefetchTLHEndLineCount=", "O<nnn>\tallocation prefetch line count for end of TLH check",
1027
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_TLHPrefetchTLHEndLineCount, 0, "P%d", NOT_IN_SUBSET},
1028
#endif
1029
{"tossCode", "D\tthrow code and data away after compiling", SET_JITCONFIG_RUNTIME_FLAG(J9JIT_TOSS_CODE) },
1030
{"tprof", "D\tgenerate time profiles with SWTRACE (requires -Xrunjprof12x:jita2n)",
1031
TR::Options::tprofOption, 0, 0, "F"},
1032
{"updateFreeMemoryMinPeriod=", "R<nnn>\tnumber of milliseconds after which point we will update the free physical memory available",
1033
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_updateFreeMemoryMinPeriod, 0, "F%d", NOT_IN_SUBSET},
1034
{"upperBoundNumProcForScaling=", "M<nnn>\tHigher than this numProc we'll use the conservativeScorchingSampleThreshold",
1035
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_upperBoundNumProcForScaling, 0, "F%d", NOT_IN_SUBSET},
1036
{ "userClassLoadPhaseThreshold=", "O<nnn>\tnumber of user classes loaded per sampling tick that "
1037
"needs to be attained to enter the class loading phase. "
1038
"Specify a very large value to disable this optimization",
1039
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_userClassLoadingPhaseThreshold, 0, "P%d", NOT_IN_SUBSET },
1040
{"verbose", "L\twrite compiled method names to vlog file or stdout in limitfile format",
1041
TR::Options::setVerboseBitsInJitPrivateConfig, offsetof(J9JITConfig, privateConfig), 5, "F=1"},
1042
{"verbose=", "L{regex}\tlist of verbose output to write to vlog or stdout",
1043
TR::Options::setVerboseBitsInJitPrivateConfig, offsetof(J9JITConfig, privateConfig), 0, "F"},
1044
{"version", "L\tdisplay the jit build version",
1045
TR::Options::versionOption, 0, 0, "F"},
1046
#if defined(J9VM_OPT_JITSERVER)
1047
{"veryHighActiveThreadThreshold=", " \tDefines what is a very high Threshold for active compilations",
1048
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_veryHighActiveThreadThreshold, 0, "F%d"},
1049
#endif /* defined(J9VM_OPT_JITSERVER) */
1050
{"veryHotSampleThreshold=", "R<nnn>\tThe maximum number of global samples taken during a sample interval for which the method will be recompiled at hot with normal priority",
1051
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_veryHotSampleThreshold, 0, "F%d", NOT_IN_SUBSET},
1052
{"vlog=", "L<filename>\twrite verbose output to filename",
1053
TR::Options::setString, offsetof(J9JITConfig,vLogFileName), 0, "F%s"},
1054
{"vmState=", "L<vmState>\tdecode a given vmState",
1055
TR::Options::vmStateOption, 0, 0, "F"},
1056
{"waitTimeToEnterDeepIdleMode=", "M<nnn>\tTime spent in idle mode (ms) after which we enter deep idle mode sampling",
1057
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_waitTimeToEnterDeepIdleMode, 0, "F%d", NOT_IN_SUBSET},
1058
{"waitTimeToEnterIdleMode=", "M<nnn>\tIdle time (ms) after which we enter idle mode sampling",
1059
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_waitTimeToEnterIdleMode, 0, "F%d", NOT_IN_SUBSET},
1060
{"waitTimeToExitStartupMode=", "M<nnn>\tTime (ms) spent outside startup needed to declare NON_STARTUP mode",
1061
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_waitTimeToExitStartupMode, 0, "F%d", NOT_IN_SUBSET},
1062
{"waitTimeToGCR=", "M<nnn>\tTime (ms) spent outside startup needed to start guarded counting recompilations",
1063
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_waitTimeToGCR, 0, "F%d", NOT_IN_SUBSET},
1064
{"waitTimeToStartIProfiler=", "M<nnn>\tTime (ms) spent outside startup needed to start IProfiler if it was off",
1065
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_waitTimeToStartIProfiler, 0, "F%d", NOT_IN_SUBSET},
1066
{"weightOfAOTLoad=", "M<nnn>\tWeight of an AOT load. 0 by default",
1067
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_weightOfAOTLoad, 0, "F%d", NOT_IN_SUBSET},
1068
{"weightOfJSR292=", "M<nnn>\tWeight of an JSR292 compilation. Number between 0 and 255",
1069
TR::Options::setStaticNumeric, (intptr_t)&TR::Options::_weightOfJSR292, 0, "F%d", NOT_IN_SUBSET },
1070
{0}
1071
};
1072
1073
1074
bool J9::Options::showOptionsInEffect()
1075
{
1076
if (this == TR::Options::getAOTCmdLineOptions() && self()->getOption(TR_NoLoadAOT) && self()->getOption(TR_NoStoreAOT))
1077
return false;
1078
else
1079
return (TR::Options::isAnyVerboseOptionSet(TR_VerboseOptions, TR_VerboseExtended));
1080
}
1081
1082
// z/OS tool FIXMAPC doesn't allow duplicated ASID statements.
1083
// For the case of -Xjit:verbose={mmap} and -Xaot:verbose={mmap} will generate two ASID statements.
1084
// Make sure only have one ASID statement
1085
bool J9::Options::showPID()
1086
{
1087
static bool showedAlready=false;
1088
1089
if (!showedAlready)
1090
{
1091
if (TR::Options::getVerboseOption(TR_VerboseMMap))
1092
{
1093
showedAlready = true;
1094
return true;
1095
}
1096
}
1097
return false;
1098
}
1099
1100
#if defined(J9VM_OPT_JITSERVER)
1101
static std::string readFileToString(char *fileName)
1102
{
1103
PORT_ACCESS_FROM_PORT(TR::Compiler->portLib);
1104
FILE *f = fopen(fileName, "rb");
1105
if (!f)
1106
{
1107
j9tty_printf(PORTLIB, "Fatal Error: Unable to open file (%s)\n", fileName);
1108
return "";
1109
}
1110
const uint32_t BUFFER_SIZE = 4096; // 4KB
1111
const uint32_t MAX_FILE_SIZE_IN_PAGES = 16; // 64KB
1112
char buf[BUFFER_SIZE];
1113
std::string fileStr("");
1114
int readSize = 0;
1115
int iter = 0;
1116
do {
1117
readSize = fread(buf, 1, BUFFER_SIZE, f);
1118
fileStr = fileStr.append(buf, readSize);
1119
++iter;
1120
} while ((readSize == BUFFER_SIZE) && (iter <= MAX_FILE_SIZE_IN_PAGES));
1121
fclose(f);
1122
1123
if (iter <= MAX_FILE_SIZE_IN_PAGES)
1124
{
1125
return fileStr;
1126
}
1127
else
1128
{
1129
j9tty_printf(
1130
PORTLIB,
1131
"Fatal Error: File (%s) is too large, max allowed size is %dKB\n",
1132
fileName,
1133
BUFFER_SIZE * MAX_FILE_SIZE_IN_PAGES / 1000);
1134
return "";
1135
}
1136
}
1137
1138
static bool JITServerParseCommonOptions(J9JavaVM *vm, TR::CompilationInfo *compInfo)
1139
{
1140
const char *xxJITServerPortOption = "-XX:JITServerPort=";
1141
const char *xxJITServerTimeoutOption = "-XX:JITServerTimeout=";
1142
const char *xxJITServerSSLKeyOption = "-XX:JITServerSSLKey=";
1143
const char *xxJITServerSSLCertOption = "-XX:JITServerSSLCert=";
1144
const char *xxJITServerSSLRootCertsOption = "-XX:JITServerSSLRootCerts=";
1145
const char *xxJITServerUseAOTCacheOption = "-XX:+JITServerUseAOTCache";
1146
const char *xxDisableJITServerUseAOTCacheOption = "-XX:-JITServerUseAOTCache";
1147
const char *xxRequireJITServerOption = "-XX:+RequireJITServer";
1148
const char *xxDisableRequireJITServerOption = "-XX:-RequireJITServer";
1149
const char *xxJITServerLogConnections = "-XX:+JITServerLogConnections";
1150
const char *xxDisableJITServerLogConnections = "-XX:-JITServerLogConnections";
1151
1152
int32_t xxJITServerPortArgIndex = FIND_ARG_IN_VMARGS(STARTSWITH_MATCH, xxJITServerPortOption, 0);
1153
int32_t xxJITServerTimeoutArgIndex = FIND_ARG_IN_VMARGS(STARTSWITH_MATCH, xxJITServerTimeoutOption, 0);
1154
int32_t xxJITServerSSLKeyArgIndex = FIND_ARG_IN_VMARGS(STARTSWITH_MATCH, xxJITServerSSLKeyOption, 0);
1155
int32_t xxJITServerSSLCertArgIndex = FIND_ARG_IN_VMARGS(STARTSWITH_MATCH, xxJITServerSSLCertOption, 0);
1156
int32_t xxJITServerSSLRootCertsArgIndex = FIND_ARG_IN_VMARGS(STARTSWITH_MATCH, xxJITServerSSLRootCertsOption, 0);
1157
int32_t xxJITServerUseAOTCacheArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxJITServerUseAOTCacheOption, 0);
1158
int32_t xxDisableJITServerUseAOTCacheArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxDisableJITServerUseAOTCacheOption, 0);
1159
int32_t xxRequireJITServerArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxRequireJITServerOption, 0);
1160
int32_t xxDisableRequireJITServerArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxDisableRequireJITServerOption, 0);
1161
int32_t xxJITServerLogConnectionsArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxJITServerLogConnections, 0);
1162
int32_t xxDisableJITServerLogConnectionsArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxDisableJITServerLogConnections, 0);
1163
1164
if (xxJITServerPortArgIndex >= 0)
1165
{
1166
uint32_t port=0;
1167
IDATA ret = GET_INTEGER_VALUE(xxJITServerPortArgIndex, xxJITServerPortOption, port);
1168
if (ret == OPTION_OK)
1169
compInfo->getPersistentInfo()->setJITServerPort(port);
1170
}
1171
1172
if (xxRequireJITServerArgIndex > xxDisableRequireJITServerArgIndex)
1173
{
1174
// If a debugging option to require JITServer connection is enabled, increase socket timeout,
1175
// to prevent false positives from streams failing due to timeout.
1176
// User-provided values still take priority.
1177
compInfo->getPersistentInfo()->setRequireJITServer(true);
1178
compInfo->getPersistentInfo()->setSocketTimeout(60000);
1179
}
1180
1181
if (xxJITServerTimeoutArgIndex >= 0)
1182
{
1183
uint32_t timeoutMs=0;
1184
IDATA ret = GET_INTEGER_VALUE(xxJITServerTimeoutArgIndex, xxJITServerTimeoutOption, timeoutMs);
1185
if (ret == OPTION_OK)
1186
compInfo->getPersistentInfo()->setSocketTimeout(timeoutMs);
1187
}
1188
1189
// key and cert have to be set as a pair at the server
1190
if ((xxJITServerSSLKeyArgIndex >= 0) && (xxJITServerSSLCertArgIndex >= 0))
1191
{
1192
char *keyFileName = NULL;
1193
char *certFileName = NULL;
1194
GET_OPTION_VALUE(xxJITServerSSLKeyArgIndex, '=', &keyFileName);
1195
GET_OPTION_VALUE(xxJITServerSSLCertArgIndex, '=', &certFileName);
1196
std::string key = readFileToString(keyFileName);
1197
std::string cert = readFileToString(certFileName);
1198
1199
if (!key.empty() && !cert.empty())
1200
{
1201
compInfo->addJITServerSslKey(key);
1202
compInfo->addJITServerSslCert(cert);
1203
}
1204
else
1205
{
1206
return false;
1207
}
1208
}
1209
1210
if (xxJITServerSSLRootCertsArgIndex >= 0)
1211
{
1212
char *fileName = NULL;
1213
GET_OPTION_VALUE(xxJITServerSSLRootCertsArgIndex, '=', &fileName);
1214
std::string cert = readFileToString(fileName);
1215
if (!cert.empty())
1216
compInfo->setJITServerSslRootCerts(cert);
1217
else
1218
return false;
1219
}
1220
1221
if (xxJITServerUseAOTCacheArgIndex > xxDisableJITServerUseAOTCacheArgIndex)
1222
compInfo->getPersistentInfo()->setJITServerUseAOTCache(true);
1223
else
1224
compInfo->getPersistentInfo()->setJITServerUseAOTCache(false);
1225
1226
if (xxJITServerLogConnectionsArgIndex > xxDisableJITServerLogConnectionsArgIndex)
1227
{
1228
TR::Options::setVerboseOption(TR_VerboseJITServerConns);
1229
}
1230
1231
return true;
1232
}
1233
#endif /* defined(J9VM_OPT_JITSERVER) */
1234
1235
void J9::Options::preProcessMmf(J9JavaVM *vm, J9JITConfig *jitConfig)
1236
{
1237
J9MemoryManagerFunctions * mmf = vm->memoryManagerFunctions;
1238
1239
#if defined(J9VM_GC_HEAP_CARD_TABLE)
1240
TR_J9VMBase * fe = TR_J9VMBase::get(jitConfig, 0);
1241
if (!fe->isAOT_DEPRECATED_DO_NOT_USE())
1242
{
1243
self()->setGcCardSize(mmf->j9gc_concurrent_getCardSize(vm));
1244
self()->setHeapBase(mmf->j9gc_concurrent_getHeapBase(vm));
1245
self()->setHeapTop(mmf->j9gc_concurrent_getHeapBase(vm) + mmf->j9gc_get_initial_heap_size(vm));
1246
}
1247
#endif
1248
1249
uintptr_t value;
1250
1251
value = mmf->j9gc_modron_getConfigurationValueForKey(vm, j9gc_modron_configuration_heapBaseForBarrierRange0_isVariable, &value) ? value : 0;
1252
self()->setIsVariableHeapBaseForBarrierRange0(value);
1253
1254
value = mmf->j9gc_modron_getConfigurationValueForKey(vm, j9gc_modron_configuration_heapSizeForBarrierRange0_isVariable, &value) ? value : 0;
1255
self()->setIsVariableHeapSizeForBarrierRange0(value);
1256
1257
value = mmf->j9gc_modron_getConfigurationValueForKey(vm, j9gc_modron_configuration_activeCardTableBase_isVariable, &value) ? value : 0;
1258
self()->setIsVariableActiveCardTableBase(value);
1259
1260
value = mmf->j9gc_modron_getConfigurationValueForKey(vm, j9gc_modron_configuration_heapAddressToCardAddressShift, &value) ? value : 0;
1261
self()->setHeapAddressToCardAddressShift(value);
1262
1263
// Pull the constant heap parameters from a VMThread (it doesn't matter which one).
1264
//
1265
J9VMThread *vmThread = jitConfig->javaVM->internalVMFunctions->currentVMThread(jitConfig->javaVM);
1266
1267
if (vmThread)
1268
{
1269
self()->setHeapBaseForBarrierRange0((uintptr_t)vmThread->heapBaseForBarrierRange0);
1270
self()->setHeapSizeForBarrierRange0((uintptr_t)vmThread->heapSizeForBarrierRange0);
1271
self()->setActiveCardTableBase((uintptr_t)vmThread->activeCardTableBase);
1272
}
1273
else
1274
{
1275
// The heap information could not be found at compile-time. Make sure this information
1276
// is loaded from the vmThread at runtime.
1277
//
1278
self()->setIsVariableHeapBaseForBarrierRange0(true);
1279
self()->setIsVariableHeapSizeForBarrierRange0(true);
1280
self()->setIsVariableActiveCardTableBase(true);
1281
}
1282
1283
if (J9_ARE_ANY_BITS_SET(vm->extendedRuntimeFlags2, J9_EXTENDED_RUNTIME2_ENABLE_PORTABLE_SHARED_CACHE)
1284
#if defined(J9VM_OPT_CRIU_SUPPORT)
1285
|| vm->internalVMFunctions->isCheckpointAllowed(vmThread)
1286
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
1287
)
1288
{
1289
// Disable any fixed-size heap optimizations under portable shared cache mode
1290
self()->setIsVariableHeapSizeForBarrierRange0(true);
1291
}
1292
1293
#if defined(TR_TARGET_64BIT) && defined(J9ZOS390)
1294
PORT_ACCESS_FROM_JAVAVM(vm);
1295
1296
OMROSDesc desc;
1297
j9sysinfo_get_os_description(&desc);
1298
1299
// Enable RMODE64 if and only if the z/OS version has proper kernel support
1300
if (j9sysinfo_os_has_feature(&desc, OMRPORT_ZOS_FEATURE_RMODE64))
1301
{
1302
self()->setOption(TR_EnableRMODE64);
1303
}
1304
#endif
1305
1306
// { RTSJ Support Begin
1307
1308
#if defined(J9VM_OPT_REAL_TIME_LOCKING_SUPPORT)
1309
self()->setOption(TR_DisableMonitorOpts);
1310
#endif
1311
1312
1313
value = mmf->j9gc_modron_getConfigurationValueForKey(vm, j9gc_modron_configuration_allocationType,&value) ?value:0;
1314
if (j9gc_modron_allocation_type_segregated == value)
1315
self()->setRealTimeGC(true);
1316
else
1317
self()->setRealTimeGC(false);
1318
// } RTSJ Support End
1319
}
1320
1321
void J9::Options::preProcessMode(J9JavaVM *vm, J9JITConfig *jitConfig)
1322
{
1323
// Determine the mode we want to be in
1324
if (vm->runtimeFlags & J9_RUNTIME_AGGRESSIVE)
1325
{
1326
self()->setOption(TR_AggressiveOpts);
1327
}
1328
1329
// The _aggressivenessLevel is a static and needs to be set only once
1330
if (_aggressivenessLevel == -1) // not yet set
1331
{
1332
// Start with a default level and override as needed
1333
_aggressivenessLevel = TR::Options::TR_AggresivenessLevel::DEFAULT;
1334
1335
// -Xquickstart/-Xtune:quickstart, -Xtune:virtualized and -Xtune:throughput are mutually exclusive
1336
// This is ensured by VM option processing
1337
if (J9_ARE_ANY_BITS_SET(jitConfig->runtimeFlags, J9JIT_QUICKSTART))
1338
{
1339
_aggressivenessLevel = TR::Options::TR_AggresivenessLevel::QUICKSTART;
1340
}
1341
else if (J9_ARE_ANY_BITS_SET(vm->extendedRuntimeFlags2, J9_EXTENDED_RUNTIME2_TUNE_THROUGHPUT))
1342
{
1343
_aggressivenessLevel = TR::Options::TR_AggresivenessLevel::AGGRESSIVE_THROUGHPUT;
1344
}
1345
else if (J9_ARE_ANY_BITS_SET(vm->runtimeFlags, J9_RUNTIME_TUNE_VIRTUALIZED))
1346
{
1347
_aggressivenessLevel = TR::Options::TR_AggresivenessLevel::AGGRESSIVE_AOT;
1348
_scratchSpaceFactorWhenJSR292Workload = 1;
1349
}
1350
else
1351
{
1352
// The aggressivenessLevel can be set directly with -XaggressivenessLevel
1353
// This option is a second hand citizen option; if other options contradict it, this option is
1354
// ignored even if it appears later
1355
char *aggressiveOption = "-XaggressivenessLevel";
1356
int32_t argIndex = FIND_ARG_IN_VMARGS(EXACT_MEMORY_MATCH, aggressiveOption, 0);
1357
if (argIndex >= 0)
1358
{
1359
UDATA aggressivenessValue = 0;
1360
IDATA ret = GET_INTEGER_VALUE(argIndex, aggressiveOption, aggressivenessValue);
1361
if (ret == OPTION_OK && aggressivenessValue >= 0)
1362
{
1363
_aggressivenessLevel = aggressivenessValue;
1364
}
1365
}
1366
}
1367
}
1368
}
1369
1370
void J9::Options::preProcessJniAccelerator(J9JavaVM *vm)
1371
{
1372
static bool doneWithJniAcc = false;
1373
char *jniAccOption = "-XjniAcc:";
1374
if (!doneWithJniAcc)
1375
{
1376
int32_t argIndex = FIND_ARG_IN_VMARGS(STARTSWITH_MATCH, jniAccOption, 0);
1377
if (argIndex >= 0)
1378
{
1379
char *optValue;
1380
doneWithJniAcc = true;
1381
GET_OPTION_VALUE(argIndex, ':', &optValue);
1382
if (*optValue == '{')
1383
{
1384
if (!_debug)
1385
TR::Options::createDebug();
1386
if (_debug)
1387
{
1388
TR::SimpleRegex *mRegex;
1389
mRegex = TR::SimpleRegex::create(optValue);
1390
if (!mRegex || *optValue != 0)
1391
{
1392
TR_VerboseLog::writeLine(TR_Vlog_FAILURE, "Bad regular expression at --> '%s'", optValue);
1393
}
1394
else
1395
{
1396
TR::Options::setJniAccelerator(mRegex);
1397
}
1398
}
1399
}
1400
}
1401
}
1402
}
1403
1404
void J9::Options::preProcessCodeCacheIncreaseTotalSize(J9JavaVM *vm, J9JITConfig *jitConfig)
1405
{
1406
PORT_ACCESS_FROM_JAVAVM(vm);
1407
OMRPORT_ACCESS_FROM_J9PORT(PORTLIB);
1408
1409
// Check for option to increase code cache total size
1410
static bool codecachetotalAlreadyParsed = false;
1411
if (!codecachetotalAlreadyParsed) // avoid processing twice for AOT and JIT and produce duplicate messages
1412
{
1413
codecachetotalAlreadyParsed = true;
1414
char *xccOption = "-Xcodecachetotal";
1415
char *xxccOption = "-XX:codecachetotal=";
1416
int32_t codeCacheTotalArgIndex = FIND_ARG_IN_VMARGS(EXACT_MEMORY_MATCH, xccOption, 0);
1417
int32_t XXcodeCacheTotalArgIndex = FIND_ARG_IN_VMARGS(EXACT_MEMORY_MATCH, xxccOption, 0);
1418
int32_t argIndex = 0;
1419
// Check if option is at all specified
1420
if (codeCacheTotalArgIndex >= 0 || XXcodeCacheTotalArgIndex >= 0)
1421
{
1422
char *ccTotalOption;
1423
if (XXcodeCacheTotalArgIndex > codeCacheTotalArgIndex)
1424
{
1425
argIndex = XXcodeCacheTotalArgIndex;
1426
ccTotalOption = xxccOption;
1427
}
1428
else
1429
{
1430
argIndex = codeCacheTotalArgIndex;
1431
ccTotalOption = xccOption;
1432
}
1433
UDATA ccTotalSize;
1434
IDATA returnCode = GET_MEMORY_VALUE(argIndex, ccTotalOption, ccTotalSize);
1435
if (OPTION_OK == returnCode)
1436
{
1437
ccTotalSize >>= 10; // convert to KB
1438
1439
// Impose a minimum value of 2 MB
1440
if (ccTotalSize < 2048)
1441
ccTotalSize = 2048;
1442
1443
// Restriction: total size must be a multiple of the size of one code cache
1444
UDATA fragmentSize = ccTotalSize % jitConfig->codeCacheKB;
1445
if (fragmentSize > 0) // TODO: do we want a message here?
1446
ccTotalSize += jitConfig->codeCacheKB - fragmentSize; // round-up
1447
1448
// Proportionally increase the data cache as well
1449
// Use 'double' to avoid truncation/overflow
1450
UDATA dcTotalSize = (double)ccTotalSize / (double)(jitConfig->codeCacheTotalKB) *
1451
(double)(jitConfig->dataCacheTotalKB);
1452
1453
// Round up to a multiple of the data cache size
1454
fragmentSize = dcTotalSize % jitConfig->dataCacheKB;
1455
if (fragmentSize > 0)
1456
dcTotalSize += jitConfig->dataCacheKB - fragmentSize;
1457
// Now write the values in jitConfig
1458
jitConfig->codeCacheTotalKB = ccTotalSize;
1459
// Make sure that the new value for dataCacheTotal doesn't shrink the default
1460
if (dcTotalSize > jitConfig->dataCacheTotalKB)
1461
jitConfig->dataCacheTotalKB = dcTotalSize;
1462
}
1463
else // Error with the option
1464
{
1465
// TODO: do we want a message here?
1466
j9nls_printf(PORTLIB, J9NLS_WARNING, J9NLS_JIT_OPTIONS_INCORRECT_MEMORY_SIZE, ccTotalOption);
1467
}
1468
}
1469
}
1470
}
1471
1472
void J9::Options::preProcessCodeCachePrintCodeCache(J9JavaVM *vm)
1473
{
1474
// -XX:+PrintCodeCache will be parsed twice into both AOT and JIT options here.
1475
const char *xxPrintCodeCacheOption = "-XX:+PrintCodeCache";
1476
const char *xxDisablePrintCodeCacheOption = "-XX:-PrintCodeCache";
1477
int32_t xxPrintCodeCacheArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxPrintCodeCacheOption, 0);
1478
int32_t xxDisablePrintCodeCacheArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxDisablePrintCodeCacheOption, 0);
1479
1480
if (xxPrintCodeCacheArgIndex > xxDisablePrintCodeCacheArgIndex)
1481
{
1482
self()->setOption(TR_PrintCodeCacheUsage);
1483
}
1484
}
1485
1486
bool J9::Options::preProcessCodeCacheXlpCodeCache(J9JavaVM *vm, J9JITConfig *jitConfig)
1487
{
1488
PORT_ACCESS_FROM_JAVAVM(vm);
1489
OMRPORT_ACCESS_FROM_J9PORT(PORTLIB);
1490
1491
// Enable on X and Z, also on P.
1492
// PPC supports -Xlp:codecache option.. since it's set via environment variables. JVM should always request 4k pages.
1493
// fePreProcess is called twice - for AOT and JIT options parsing, which is redundant in terms of
1494
// processing the -Xlp:codecache options.
1495
// We should parse the -Xlp:codecache options only once though to avoid duplicate NLS messages.
1496
static bool parsedXlpCodeCacheOptions = false;
1497
1498
if (!parsedXlpCodeCacheOptions)
1499
{
1500
parsedXlpCodeCacheOptions = true;
1501
1502
UDATA requestedLargeCodePageSize = 0;
1503
UDATA requestedLargeCodePageFlags = J9PORT_VMEM_PAGE_FLAG_NOT_USED;
1504
UDATA largePageSize = 0;
1505
UDATA largePageFlags = 0;
1506
int32_t xlpCodeCacheIndex = FIND_ARG_IN_VMARGS(STARTSWITH_MATCH, "-Xlp:codecache:", NULL);
1507
int32_t xlpIndex = FIND_ARG_IN_VMARGS(EXACT_MEMORY_MATCH, "-Xlp", NULL);
1508
1509
// Parse -Xlp:codecache:pagesize=<size> as the right most option
1510
if (xlpCodeCacheIndex > xlpIndex)
1511
{
1512
TR_XlpCodeCacheOptions parsingState = XLPCC_PARSING_FIRST_OPTION;
1513
UDATA optionNumber = 1;
1514
bool extraCommaWarning = false;
1515
char *previousOption = NULL;
1516
char *errorString = NULL;
1517
1518
UDATA pageSizeHowMany = 0;
1519
UDATA pageSizeOptionNumber = 0;
1520
UDATA pageableHowMany = 0;
1521
UDATA pageableOptionNumber = 0;
1522
UDATA nonPageableHowMany = 0;
1523
UDATA nonPageableOptionNumber = 0;
1524
1525
char *optionsString = NULL;
1526
1527
// Get Pointer to entire "-Xlp:codecache:" options string
1528
GET_OPTION_OPTION(xlpCodeCacheIndex, ':', ':', &optionsString);
1529
1530
// optionsString can not be NULL here, though it may point to null ('\0') character
1531
char *scanLimit = optionsString + strlen(optionsString);
1532
1533
// Parse -Xlp:codecache:pagesize=<size> option.
1534
// The proper formed -Xlp:codecache: options include
1535
// For X and zLinux platforms:
1536
// -Xlp:codecache:pagesize=<size> or
1537
// -Xlp:codecache:pagesize=<size>,pageable or
1538
// -Xlp:codecache:pagesize=<size>,nonpageable
1539
// For zOS platforms
1540
// -Xlp:codecache:pagesize=<size>,pageable or
1541
// -Xlp:codecache:pagesize=<size>,nonpageable
1542
while (optionsString < scanLimit)
1543
{
1544
if (try_scan(&optionsString, ","))
1545
{
1546
// Comma separator is discovered
1547
switch (parsingState)
1548
{
1549
case XLPCC_PARSING_FIRST_OPTION:
1550
// leading comma - ignored but warning required
1551
extraCommaWarning = true;
1552
parsingState = XLPCC_PARSING_OPTION;
1553
break;
1554
case XLPCC_PARSING_OPTION:
1555
// more then one comma - ignored but warning required
1556
extraCommaWarning = true;
1557
break;
1558
case XLPCC_PARSING_COMMA:
1559
// expecting for comma here, next should be an option
1560
parsingState = XLPCC_PARSING_OPTION;
1561
// next option number
1562
optionNumber += 1;
1563
break;
1564
case XLPCC_PARSING_ERROR:
1565
default:
1566
return false;
1567
}
1568
}
1569
else
1570
{
1571
// Comma separator has not been found. so
1572
switch (parsingState)
1573
{
1574
case XLPCC_PARSING_FIRST_OPTION:
1575
// still looking for parsing of first option - nothing to do
1576
parsingState = XLPCC_PARSING_OPTION;
1577
break;
1578
case XLPCC_PARSING_OPTION:
1579
// Can not recognize an option case
1580
errorString = optionsString;
1581
parsingState = XLPCC_PARSING_ERROR;
1582
break;
1583
case XLPCC_PARSING_COMMA:
1584
// can not find comma after option - so this is something unrecognizable at the end of known option
1585
errorString = previousOption;
1586
parsingState = XLPCC_PARSING_ERROR;
1587
break;
1588
case XLPCC_PARSING_ERROR:
1589
default:
1590
// must be unreachable states
1591
return false;
1592
}
1593
}
1594
1595
if (XLPCC_PARSING_ERROR == parsingState)
1596
{
1597
char *xlpOptionErrorString = errorString;
1598
int32_t xlpOptionErrorStringSize = 0;
1599
1600
// try to find comma to isolate unrecognized option
1601
char *commaLocation = strchr(errorString,',');
1602
1603
if (NULL != commaLocation)
1604
{
1605
// Comma found
1606
xlpOptionErrorStringSize = (size_t)(commaLocation - errorString);
1607
}
1608
else
1609
{
1610
// comma not found - print to end of string
1611
xlpOptionErrorStringSize = strlen(errorString);
1612
}
1613
j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_JIT_OPTIONS_XLP_UNRECOGNIZED_OPTION, xlpOptionErrorStringSize, xlpOptionErrorString);
1614
return false;
1615
}
1616
1617
previousOption = optionsString;
1618
1619
if (try_scan(&optionsString, "pagesize="))
1620
{
1621
// Try to get memory value.
1622
// Given substring, we can't use GET_MEMORY_VALUE.
1623
// Scan for UDATA and M/m,G/g,K/k manually.
1624
UDATA scanResult = scan_udata(&optionsString, &requestedLargeCodePageSize);
1625
1626
// First scan for the integer string.
1627
if (0 != scanResult)
1628
{
1629
if (1 == scanResult)
1630
j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_JIT_OPTIONS_MUST_BE_NUMBER, "pagesize=");
1631
else
1632
j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_JIT_OPTIONS_VALUE_OVERFLOWED, "pagesize=");
1633
j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_JIT_OPTIONS_INCORRECT_MEMORY_SIZE, "-Xlp:codecache:pagesize=<size>");
1634
return false;
1635
}
1636
1637
// Check for size qualifiers (G/M/K)
1638
UDATA qualifierShiftAmount = 0;
1639
if(try_scan(&optionsString, "G") || try_scan(&optionsString, "g"))
1640
qualifierShiftAmount = 30;
1641
else if(try_scan(&optionsString, "M") || try_scan(&optionsString, "m"))
1642
qualifierShiftAmount = 20;
1643
else if(try_scan(&optionsString, "K") || try_scan(&optionsString, "k"))
1644
qualifierShiftAmount = 10;
1645
1646
if (0 != qualifierShiftAmount)
1647
{
1648
// Check for overflow
1649
if (requestedLargeCodePageSize <= (((UDATA)-1) >> qualifierShiftAmount))
1650
{
1651
requestedLargeCodePageSize <<= qualifierShiftAmount;
1652
}
1653
else
1654
{
1655
j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_JIT_OPTIONS_VALUE_OVERFLOWED, "pagesize=");
1656
j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_JIT_OPTIONS_INCORRECT_MEMORY_SIZE, "-Xlp:codecache:pagesize=<size>");
1657
return false;
1658
}
1659
}
1660
1661
pageSizeHowMany += 1;
1662
pageSizeOptionNumber = optionNumber;
1663
1664
parsingState = XLPCC_PARSING_COMMA;
1665
}
1666
else if (try_scan(&optionsString, "pageable"))
1667
{
1668
pageableHowMany += 1;
1669
pageableOptionNumber = optionNumber;
1670
1671
parsingState = XLPCC_PARSING_COMMA;
1672
}
1673
else if (try_scan(&optionsString, "nonpageable"))
1674
{
1675
nonPageableHowMany += 1;
1676
nonPageableOptionNumber = optionNumber;
1677
1678
parsingState = XLPCC_PARSING_COMMA;
1679
}
1680
}
1681
1682
// post-parse check for trailing comma(s)
1683
switch (parsingState)
1684
{
1685
// if loop ended in one of these two states extra comma warning required
1686
case XLPCC_PARSING_FIRST_OPTION:
1687
case XLPCC_PARSING_OPTION:
1688
// trailing comma(s) or comma(s) alone
1689
extraCommaWarning = true;
1690
break;
1691
case XLPCC_PARSING_COMMA:
1692
// loop ended at comma search state - do nothing
1693
break;
1694
case XLPCC_PARSING_ERROR:
1695
default:
1696
// must be unreachable states
1697
return false;
1698
}
1699
1700
// Verify "pagesize=<size>" option.
1701
// This option must be specified for all platforms.
1702
if (0 == pageSizeHowMany)
1703
{
1704
j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_JIT_OPTIONS_XLP_INCOMPLETE_OPTION, "-Xlp:codecache:", "pagesize=");
1705
return false;
1706
}
1707
1708
#if defined(J9ZOS390)
1709
// [non]pageable option must be specified for Z platforms
1710
if ((0 == pageableHowMany) && (0 == nonPageableHowMany))
1711
{
1712
// [non]pageable not found
1713
char *xlpOptionErrorString = "-Xlp:codecache:";
1714
char *xlpMissingOptionString = "[non]pageable";
1715
1716
j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_JIT_OPTIONS_XLP_INCOMPLETE_OPTION, xlpOptionErrorString, xlpMissingOptionString);
1717
return false;
1718
}
1719
1720
// Check for the right most option is most right
1721
if (pageableOptionNumber > nonPageableOptionNumber)
1722
requestedLargeCodePageFlags = J9PORT_VMEM_PAGE_FLAG_PAGEABLE;
1723
else
1724
requestedLargeCodePageFlags = J9PORT_VMEM_PAGE_FLAG_FIXED;
1725
1726
#endif // defined(J9ZOS390)
1727
1728
// print extra comma ignored warning
1729
if (extraCommaWarning)
1730
j9nls_printf(PORTLIB, J9NLS_INFO, J9NLS_JIT_OPTIONS_XLP_EXTRA_COMMA);
1731
}
1732
// Parse Size -Xlp<size>
1733
else if (xlpIndex >= 0)
1734
{
1735
// GET_MEMORY_VALUE macro casts it's second parameter to (char**)&, so a pointer to the option string is passed rather than the string literal.
1736
char *lpOption = "-Xlp";
1737
GET_MEMORY_VALUE(xlpIndex, lpOption, requestedLargeCodePageSize);
1738
}
1739
1740
if (requestedLargeCodePageSize != 0)
1741
{
1742
// Check to see if requested size is valid
1743
BOOLEAN isRequestedSizeSupported = FALSE;
1744
largePageSize = requestedLargeCodePageSize;
1745
largePageFlags = requestedLargeCodePageFlags;
1746
1747
1748
// j9vmem_find_valid_page_size happened to be changed to always return 0
1749
// However formally the function type still be IDATA so assert if it returns anything else
1750
j9vmem_find_valid_page_size(J9PORT_VMEM_MEMORY_MODE_EXECUTE, &largePageSize, &largePageFlags, &isRequestedSizeSupported);
1751
1752
if (!isRequestedSizeSupported)
1753
{
1754
// Generate warning message for user that requested page sizes / type is not supported.
1755
char *oldQualifier, *newQualifier;
1756
char *oldPageType = NULL;
1757
char *newPageType = NULL;
1758
UDATA oldSize = requestedLargeCodePageSize;
1759
UDATA newSize = largePageSize;
1760
1761
// Convert size to K,M,G qualifiers.
1762
qualifiedSize(&oldSize, &oldQualifier);
1763
qualifiedSize(&newSize, &newQualifier);
1764
1765
if (0 == (J9PORT_VMEM_PAGE_FLAG_NOT_USED & requestedLargeCodePageFlags))
1766
oldPageType = getLargePageTypeString(requestedLargeCodePageFlags);
1767
1768
if (0 == (J9PORT_VMEM_PAGE_FLAG_NOT_USED & largePageFlags))
1769
newPageType = getLargePageTypeString(largePageFlags);
1770
1771
if (NULL == oldPageType)
1772
{
1773
if (NULL == newPageType)
1774
j9nls_printf(PORTLIB, J9NLS_INFO, J9NLS_JIT_OPTIONS_LARGE_PAGE_SIZE_NOT_SUPPORTED, oldSize, oldQualifier, newSize, newQualifier);
1775
else
1776
j9nls_printf(PORTLIB, J9NLS_INFO, J9NLS_JIT_OPTIONS_LARGE_PAGE_SIZE_NOT_SUPPORTED_WITH_NEW_PAGETYPE, oldSize, oldQualifier, newSize, newQualifier, newPageType);
1777
}
1778
else
1779
{
1780
if (NULL == newPageType)
1781
j9nls_printf(PORTLIB, J9NLS_INFO, J9NLS_JIT_OPTIONS_LARGE_PAGE_SIZE_NOT_SUPPORTED_WITH_REQUESTED_PAGETYPE, oldSize, oldQualifier, oldPageType, newSize, newQualifier);
1782
else
1783
j9nls_printf(PORTLIB, J9NLS_INFO, J9NLS_JIT_OPTIONS_LARGE_PAGE_SIZE_NOT_SUPPORTED_WITH_PAGETYPE, oldSize, oldQualifier, oldPageType, newSize, newQualifier, newPageType);
1784
}
1785
}
1786
}
1787
// When no -Xlp arguments are passed, we should use preferred page sizes
1788
else
1789
{
1790
UDATA *pageSizes = j9vmem_supported_page_sizes();
1791
UDATA *pageFlags = j9vmem_supported_page_flags();
1792
largePageSize = pageSizes[0]; // Default page size is always the first element
1793
largePageFlags = pageFlags[0];
1794
1795
UDATA preferredPageSize = 0;
1796
UDATA hugePreferredPageSize = 0;
1797
#if defined(TR_TARGET_POWER)
1798
preferredPageSize = 65536;
1799
#elif (defined(LINUX) && defined(TR_TARGET_X86))
1800
preferredPageSize = 2097152;
1801
hugePreferredPageSize = 0x40000000;
1802
#elif (defined(TR_TARGET_S390))
1803
preferredPageSize = 1048576;
1804
#endif
1805
if (0 != preferredPageSize)
1806
{
1807
for (UDATA pageIndex = 0; 0 != pageSizes[pageIndex]; ++pageIndex)
1808
{
1809
if ( (preferredPageSize == pageSizes[pageIndex] || hugePreferredPageSize == pageSizes[pageIndex])
1810
#if defined(J9ZOS390)
1811
/* zOS doesn't support non-pageable large pages for JIT code cache. */
1812
&& (0 != (J9PORT_VMEM_PAGE_FLAG_PAGEABLE & pageFlags[pageIndex]))
1813
#endif
1814
)
1815
{
1816
largePageSize = pageSizes[pageIndex];
1817
largePageFlags = pageFlags[pageIndex];
1818
}
1819
}
1820
}
1821
}
1822
1823
if (largePageSize > (0) && isNonNegativePowerOf2((int32_t)largePageSize))
1824
{
1825
jitConfig->largeCodePageSize = (int32_t)largePageSize;
1826
jitConfig->largeCodePageFlags = (int32_t)largePageFlags;
1827
}
1828
}
1829
1830
return true;
1831
}
1832
1833
bool J9::Options::preProcessCodeCache(J9JavaVM *vm, J9JITConfig *jitConfig)
1834
{
1835
PORT_ACCESS_FROM_JAVAVM(vm);
1836
OMRPORT_ACCESS_FROM_J9PORT(PORTLIB);
1837
1838
char *ccOption = "-Xcodecache";
1839
int32_t argIndex = FIND_ARG_IN_VMARGS(EXACT_MEMORY_MATCH, ccOption, 0);
1840
if (argIndex >= 0)
1841
{
1842
UDATA ccSize;
1843
GET_MEMORY_VALUE(argIndex, ccOption, ccSize);
1844
ccSize >>= 10;
1845
jitConfig->codeCacheKB = ccSize;
1846
}
1847
1848
self()->preProcessCodeCacheIncreaseTotalSize(vm, jitConfig);
1849
1850
self()->preProcessCodeCachePrintCodeCache(vm);
1851
1852
if (!self()->preProcessCodeCacheXlpCodeCache(vm, jitConfig))
1853
{
1854
return false;
1855
}
1856
1857
return true;
1858
}
1859
1860
void J9::Options::preProcessSamplingExpirationTime(J9JavaVM *vm)
1861
{
1862
char *samplingOption = "-XsamplingExpirationTime";
1863
int32_t argIndex = FIND_ARG_IN_VMARGS(EXACT_MEMORY_MATCH, samplingOption, 0);
1864
if (argIndex >= 0)
1865
{
1866
UDATA expirationTime;
1867
IDATA ret = GET_INTEGER_VALUE(argIndex, samplingOption, expirationTime);
1868
if (ret == OPTION_OK)
1869
_samplingThreadExpirationTime = expirationTime;
1870
}
1871
}
1872
1873
void J9::Options::preProcessCompilationThreads(J9JavaVM *vm, J9JITConfig *jitConfig)
1874
{
1875
TR::CompilationInfo *compInfo = getCompilationInfo(jitConfig);
1876
char *compThreadsOption = "-XcompilationThreads";
1877
int32_t argIndex = FIND_ARG_IN_VMARGS(EXACT_MEMORY_MATCH, compThreadsOption, 0);
1878
if (argIndex >= 0)
1879
{
1880
UDATA numCompThreads;
1881
IDATA ret = GET_INTEGER_VALUE(argIndex, compThreadsOption, numCompThreads);
1882
1883
if (ret == OPTION_OK && numCompThreads > 0)
1884
{
1885
_numUsableCompilationThreads = numCompThreads;
1886
compInfo->updateNumUsableCompThreads(_numUsableCompilationThreads);
1887
}
1888
}
1889
}
1890
1891
void J9::Options::preProcessTLHPrefetch(J9JavaVM *vm)
1892
{
1893
#if defined(TR_HOST_X86) || defined(TR_HOST_POWER) || defined(TR_HOST_S390) || defined(TR_HOST_ARM64)
1894
bool preferTLHPrefetch;
1895
#if defined(TR_HOST_POWER)
1896
preferTLHPrefetch = TR::Compiler->target.cpu.isAtLeast(OMR_PROCESSOR_PPC_P6) && TR::Compiler->target.cpu.isAtMost(OMR_PROCESSOR_PPC_P7);
1897
#elif defined(TR_HOST_S390)
1898
preferTLHPrefetch = true;
1899
#elif defined(TR_HOST_ARM64)
1900
preferTLHPrefetch = true;
1901
#else // TR_HOST_X86
1902
preferTLHPrefetch = true;
1903
// Disable TM on x86 because we cannot tell whether a Haswell chip supports TM or not, plus it's killing the performance on dayTrader3
1904
self()->setOption(TR_DisableTM);
1905
#endif
1906
1907
IDATA notlhPrefetch = FIND_ARG_IN_VMARGS(EXACT_MATCH, "-XnotlhPrefetch", 0);
1908
IDATA tlhPrefetch = FIND_ARG_IN_VMARGS(EXACT_MATCH, "-XtlhPrefetch", 0);
1909
if (preferTLHPrefetch)
1910
{
1911
if (notlhPrefetch <= tlhPrefetch)
1912
{
1913
self()->setOption(TR_TLHPrefetch);
1914
}
1915
}
1916
else
1917
{
1918
if (notlhPrefetch < tlhPrefetch)
1919
{
1920
self()->setOption(TR_TLHPrefetch);
1921
}
1922
}
1923
#endif // defined(TR_HOST_X86) || defined(TR_HOST_POWER) || defined(TR_HOST_S390)
1924
}
1925
1926
void J9::Options::preProcessHwProfiler(J9JavaVM *vm)
1927
{
1928
// If the user didn't specifically ask for RI, let's enable it on some well defined platforms
1929
if (TR::Options::_hwProfilerEnabled == TR_maybe)
1930
{
1931
#if defined (TR_HOST_S390)
1932
if (vm->runtimeFlags & J9_RUNTIME_TUNE_VIRTUALIZED)
1933
{
1934
TR::Options::_hwProfilerEnabled = TR_yes;
1935
}
1936
else
1937
{
1938
TR::Options::_hwProfilerEnabled = TR_no;
1939
}
1940
#else
1941
TR::Options::_hwProfilerEnabled = TR_no;
1942
#endif
1943
}
1944
1945
// If RI is to be enabled, set other defaults as well
1946
if (TR::Options::_hwProfilerEnabled == TR_yes)
1947
{
1948
// Enable RI Based Recompilation by default
1949
self()->setOption(TR_EnableHardwareProfileRecompilation);
1950
1951
// Disable the RI Reduced Warm Heuristic
1952
self()->setOption(TR_DisableHardwareProfilerReducedWarm);
1953
1954
#if (defined(TR_HOST_POWER) && defined(TR_HOST_64BIT))
1955
#if defined(LINUX)
1956
// On Linux on Power downgrade compilations only when the compilation queue grows large
1957
self()->setOption(TR_UseRIOnlyForLargeQSZ);
1958
#endif
1959
self()->setOption(TR_DisableHardwareProfilerDuringStartup);
1960
#elif defined (TR_HOST_S390)
1961
self()->setOption(TR_DisableDynamicRIBufferProcessing);
1962
#endif
1963
}
1964
}
1965
1966
void J9::Options::preProcessDeterministicMode(J9JavaVM *vm)
1967
{
1968
// Process the deterministic mode
1969
if (TR::Options::_deterministicMode == -1) // not yet set
1970
{
1971
char *deterministicOption = "-XX:deterministic=";
1972
const UDATA MAX_DETERMINISTIC_MODE = 9; // only levels 0-9 are allowed
1973
int32_t argIndex = FIND_ARG_IN_VMARGS(EXACT_MEMORY_MATCH, deterministicOption, 0);
1974
if (argIndex >= 0)
1975
{
1976
UDATA deterministicMode;
1977
IDATA ret = GET_INTEGER_VALUE(argIndex, deterministicOption, deterministicMode);
1978
if (ret == OPTION_OK && deterministicMode <= MAX_DETERMINISTIC_MODE)
1979
{
1980
TR::Options::_deterministicMode = deterministicMode;
1981
}
1982
}
1983
}
1984
}
1985
1986
bool J9::Options::preProcessJitServer(J9JavaVM *vm, J9JITConfig *jitConfig)
1987
{
1988
#if defined(J9VM_OPT_JITSERVER)
1989
PORT_ACCESS_FROM_JAVAVM(vm);
1990
OMRPORT_ACCESS_FROM_J9PORT(PORTLIB);
1991
1992
static bool JITServerAlreadyParsed = false;
1993
TR::CompilationInfo *compInfo = getCompilationInfo(jitConfig);
1994
if (!JITServerAlreadyParsed) // Avoid processing twice for AOT and JIT and produce duplicate messages
1995
{
1996
JITServerAlreadyParsed = true;
1997
bool disabledShareROMClasses = false;
1998
if (vm->internalVMFunctions->isJITServerEnabled(vm))
1999
{
2000
J9::PersistentInfo::_remoteCompilationMode = JITServer::SERVER;
2001
// Increase the default timeout value for JITServer.
2002
// It can be overridden with -XX:JITServerTimeout= option in JITServerParseCommonOptions().
2003
compInfo->getPersistentInfo()->setSocketTimeout(DEFAULT_JITSERVER_TIMEOUT);
2004
2005
// Check if cached ROM classes should be shared between clients
2006
const char *xxJITServerShareROMClassesOption = "-XX:+JITServerShareROMClasses";
2007
const char *xxDisableJITServerShareROMClassesOption = "-XX:-JITServerShareROMClasses";
2008
2009
int32_t xxJITServerShareROMClassesArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxJITServerShareROMClassesOption, 0);
2010
int32_t xxDisableJITServerShareROMClassesArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxDisableJITServerShareROMClassesOption, 0);
2011
if (xxJITServerShareROMClassesArgIndex > xxDisableJITServerShareROMClassesArgIndex)
2012
{
2013
_shareROMClasses = true;
2014
}
2015
else if (xxDisableJITServerShareROMClassesArgIndex > xxJITServerShareROMClassesArgIndex)
2016
{
2017
disabledShareROMClasses = true;
2018
}
2019
}
2020
else
2021
{
2022
// Check option -XX:+UseJITServer
2023
// -XX:-UseJITServer disables JITServer at the client
2024
const char *xxUseJITServerOption = "-XX:+UseJITServer";
2025
const char *xxDisableUseJITServerOption = "-XX:-UseJITServer";
2026
2027
int32_t xxUseJITServerArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxUseJITServerOption, 0);
2028
int32_t xxDisableUseJITServerArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxDisableUseJITServerOption, 0);
2029
2030
// Check if option is at all specified
2031
if (xxUseJITServerArgIndex > xxDisableUseJITServerArgIndex)
2032
{
2033
J9::PersistentInfo::_remoteCompilationMode = JITServer::CLIENT;
2034
compInfo->getPersistentInfo()->setSocketTimeout(DEFAULT_JITCLIENT_TIMEOUT);
2035
2036
// Check if the technology preview message should be displayed.
2037
const char *xxJITServerTechPreviewMessageOption = "-XX:+JITServerTechPreviewMessage";
2038
const char *xxDisableJITServerTechPreviewMessageOption = "-XX:-JITServerTechPreviewMessage";
2039
2040
int32_t xxJITServerTechPreviewMessageArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxJITServerTechPreviewMessageOption, 0);
2041
int32_t xxDisableJITServerTechPreviewMessageArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxDisableJITServerTechPreviewMessageOption, 0);
2042
2043
// Only display tech preview message for Z
2044
if (xxJITServerTechPreviewMessageArgIndex > xxDisableJITServerTechPreviewMessageArgIndex ||
2045
TR::Compiler->target.cpu.isZ() && xxJITServerTechPreviewMessageArgIndex == xxDisableJITServerTechPreviewMessageArgIndex)
2046
{
2047
j9tty_printf(PORTLIB, "JITServer is currently a technology preview. Its use is not yet supported\n");
2048
}
2049
2050
const char *xxJITServerAddressOption = "-XX:JITServerAddress=";
2051
int32_t xxJITServerAddressArgIndex = FIND_ARG_IN_VMARGS(STARTSWITH_MATCH, xxJITServerAddressOption, 0);
2052
2053
if (xxJITServerAddressArgIndex >= 0)
2054
{
2055
char *address = NULL;
2056
GET_OPTION_VALUE(xxJITServerAddressArgIndex, '=', &address);
2057
compInfo->getPersistentInfo()->setJITServerAddress(address);
2058
}
2059
2060
const char *xxJITServerLocalSyncCompilesOption = "-XX:+JITServerLocalSyncCompiles";
2061
const char *xxDisableJITServerLocalSyncCompilesOption = "-XX:-JITServerLocalSyncCompiles";
2062
2063
int32_t xxJITServerLocalSyncCompilesArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxJITServerLocalSyncCompilesOption, 0);
2064
int32_t xxDisableJITServerLocalSyncCompilesArgIndex = FIND_ARG_IN_VMARGS(EXACT_MATCH, xxDisableJITServerLocalSyncCompilesOption, 0);
2065
2066
if (xxJITServerLocalSyncCompilesArgIndex > xxDisableJITServerLocalSyncCompilesArgIndex)
2067
{
2068
compInfo->getPersistentInfo()->setLocalSyncCompiles(true);
2069
}
2070
2071
const char *xxJITServerAOTCacheNameOption = "-XX:JITServerAOTCacheName=";
2072
int32_t xxJITServerAOTCacheNameArgIndex = FIND_ARG_IN_VMARGS(STARTSWITH_MATCH, xxJITServerAOTCacheNameOption, 0);
2073
2074
if (xxJITServerAOTCacheNameArgIndex >= 0)
2075
{
2076
char *name = NULL;
2077
GET_OPTION_VALUE(xxJITServerAOTCacheNameArgIndex, '=', &name);
2078
compInfo->getPersistentInfo()->setJITServerAOTCacheName(name);
2079
}
2080
}
2081
}
2082
if (!JITServerParseCommonOptions(vm, compInfo))
2083
{
2084
// Could not parse JITServer options successfully
2085
return false;
2086
}
2087
2088
if (compInfo->getPersistentInfo()->getRemoteCompilationMode() == JITServer::CLIENT ||
2089
compInfo->getPersistentInfo()->getRemoteCompilationMode() == JITServer::SERVER)
2090
{
2091
// Generate a random identifier for this JITServer instance.
2092
// Collisions are possible, but very unlikely.
2093
// Using more bits for the client UID can reduce the probability of a collision further.
2094
std::random_device rd;
2095
std::mt19937_64 rng(rd());
2096
std::uniform_int_distribution<uint64_t> dist;
2097
// Generated uid must not be 0
2098
uint64_t uid = dist(rng);
2099
while (0 == uid)
2100
uid = dist(rng);
2101
2102
if (compInfo->getPersistentInfo()->getRemoteCompilationMode() == JITServer::CLIENT)
2103
{
2104
compInfo->getPersistentInfo()->setClientUID(uid);
2105
compInfo->getPersistentInfo()->setServerUID(0);
2106
jitConfig->clientUID = uid;
2107
jitConfig->serverUID = 0;
2108
2109
// _safeReservePhysicalMemoryValue is set as 0 for the JITClient because compilations
2110
// are done remotely. The user can still override it with a command line option
2111
J9::Options::_safeReservePhysicalMemoryValue = 0;
2112
}
2113
else
2114
{
2115
compInfo->getPersistentInfo()->setClientUID(0);
2116
compInfo->getPersistentInfo()->setServerUID(uid);
2117
jitConfig->clientUID = 0;
2118
jitConfig->serverUID = uid;
2119
}
2120
2121
}
2122
else
2123
{
2124
// clientUID/serverUID == 0 when running a regular JVM
2125
compInfo->getPersistentInfo()->setClientUID(0);
2126
compInfo->getPersistentInfo()->setServerUID(0);
2127
jitConfig->clientUID = 0;
2128
jitConfig->serverUID = 0;
2129
}
2130
2131
if ((compInfo->getPersistentInfo()->getRemoteCompilationMode() == JITServer::SERVER) &&
2132
compInfo->getPersistentInfo()->getJITServerUseAOTCache() && !disabledShareROMClasses)
2133
{
2134
// Enable ROMClass sharing at the server by default (unless explicitly disabled) if using AOT cache
2135
_shareROMClasses = true;
2136
}
2137
if ((compInfo->getPersistentInfo()->getRemoteCompilationMode() == JITServer::CLIENT) &&
2138
compInfo->getPersistentInfo()->getJITServerUseAOTCache())
2139
{
2140
// With JITServer AOT cache, the client generates a lot of AOT compilations
2141
// that have GCR IL trees in them. Due to the negative affect of GCR counting
2142
// we want to limit the amount of time counting takes place.
2143
TR::Options::_GCRQueuedThresholdForCounting = 200;
2144
}
2145
}
2146
#endif /* defined(J9VM_OPT_JITSERVER) */
2147
return true;
2148
}
2149
2150
bool
2151
J9::Options::fePreProcess(void * base)
2152
{
2153
J9JITConfig * jitConfig = (J9JITConfig*)base;
2154
J9JavaVM * vm = jitConfig->javaVM;
2155
2156
PORT_ACCESS_FROM_JAVAVM(vm);
2157
OMRPORT_ACCESS_FROM_J9PORT(PORTLIB);
2158
2159
#if defined(DEBUG) || defined(PROD_WITH_ASSUMES)
2160
bool forceSuffixLogs = false;
2161
#else
2162
bool forceSuffixLogs = true;
2163
#endif
2164
2165
2166
/* Using traps on z/OS for NullPointerException and ArrayIndexOutOfBound checks instead of the
2167
* old way of using explicit compare and branching off to a helper is causing several issues on z/OS:
2168
*
2169
* 1. When a trap fires because an exception needs to be thrown, the OS signal has to go through z/OS RTM
2170
* (Recovery Termination Management) and in doing so it gets serialized and has to acquire this CML lock.
2171
* When many concurrent exceptions are thrown, this lock gets contention.
2172
*
2173
* 2. on z/OS Management Facility, disabling traps gave performance boost because of fewer exceptions from the JCL.
2174
* The path length on z/OS for a trap is longer than on other operating systems so the trade-off and
2175
* penalty for using traps on z/OS is significantly worse than other platforms. This gives the potential
2176
* for significant performance loss caused by traps.
2177
*
2178
* 3. Depending on sysadmin settings, every time a trap fires, the system may get a "system dump"
2179
* message which shows a 0C7 abend and with lots of exceptions being thrown this clutters up the syslog.
2180
*
2181
* 4. Certain products can get in the way of the JIT signal handler so the JIT doesn't
2182
* receive the 0C7 signal causing the product process to get killed
2183
*
2184
* Therefore, the recommendation is to disable traps on z/OS by default.
2185
* Users can choose to enable traps using the "enableTraps" option.
2186
*/
2187
#if defined(J9ZOS390)
2188
self()->setOption(TR_DisableTraps);
2189
#endif
2190
2191
if (forceSuffixLogs)
2192
self()->setOption(TR_EnablePIDExtension);
2193
2194
if (jitConfig->runtimeFlags & J9JIT_CG_REGISTER_MAPS)
2195
self()->setOption(TR_RegisterMaps);
2196
2197
jitConfig->tLogFile = -1;
2198
jitConfig->tLogFileTemp = -1;
2199
2200
TR::CompilationInfo * compInfo = getCompilationInfo(jitConfig);
2201
uint32_t numProc = compInfo->getNumTargetCPUs();
2202
TR::Compiler->host.setNumberOfProcessors(numProc);
2203
TR::Compiler->target.setNumberOfProcessors(numProc);
2204
TR::Compiler->relocatableTarget.setNumberOfProcessors(numProc);
2205
2206
self()->preProcessMmf(vm, jitConfig);
2207
2208
if (FIND_ARG_IN_VMARGS(EXACT_MATCH, "-Xnoclassgc", 0) >= 0)
2209
self()->setOption(TR_NoClassGC);
2210
2211
self()->preProcessMode(vm, jitConfig);
2212
2213
self()->preProcessJniAccelerator(vm);
2214
2215
if (!self()->preProcessCodeCache(vm, jitConfig))
2216
{
2217
return false;
2218
}
2219
2220
self()->preProcessSamplingExpirationTime(vm);
2221
2222
self()->preProcessCompilationThreads(vm, jitConfig);
2223
2224
self()->preProcessTLHPrefetch(vm);
2225
2226
#if defined(TR_HOST_X86) || defined(TR_TARGET_POWER) || defined (TR_HOST_S390)
2227
self()->setOption(TR_ReservingLocks);
2228
#endif
2229
2230
self()->preProcessHwProfiler(vm);
2231
2232
#if defined (TR_HOST_S390)
2233
// On z Systems inlining very large compiled bodies proved to be worth a significant amount in terms of throughput
2234
// on benchmarks that we track. As such the throughput-compile-time tradeoff was significant enough to warrant the
2235
// inlining of very large compiled bodies on z Systems by default.
2236
if (vm->runtimeFlags & J9_RUNTIME_TUNE_VIRTUALIZED)
2237
{
2238
// Disable inlining of very large compiled methods only under -Xtune:virtualized
2239
self()->setOption(TR_InlineVeryLargeCompiledMethods, false);
2240
}
2241
else
2242
{
2243
self()->setOption(TR_InlineVeryLargeCompiledMethods);
2244
}
2245
#endif
2246
2247
// On big machines we can afford to spend more time compiling
2248
// (but not on zOS where customers care about CPU or on Xquickstart
2249
// which should be skimpy on compilation resources).
2250
// TR_SuspendEarly is set on zOS because test results indicate that
2251
// it does not benefit much by spending more time compiling.
2252
#if !defined(J9ZOS390)
2253
if (!self()->isQuickstartDetected())
2254
{
2255
// Power uses a larger SMT than X or Z
2256
uint32_t largeNumberOfCPUs = TR::Compiler->target.cpu.isPower() ? 64 : 32;
2257
if (compInfo->getNumTargetCPUs() >= largeNumberOfCPUs)
2258
{
2259
self()->setOption(TR_ConcurrentLPQ);
2260
self()->setOption(TR_EarlyLPQ);
2261
TR::Options::_expensiveCompWeight = 99; // default 20
2262
TR::Options::_invocationThresholdToTriggerLowPriComp = 50; // default is 250
2263
TR::Options::_numIProfiledCallsToTriggerLowPriComp = 100; // default is 250
2264
TR::Options::_numDLTBufferMatchesToEagerlyIssueCompReq = 1;
2265
}
2266
}
2267
#else
2268
self()->setOption(TR_SuspendEarly);
2269
#endif
2270
2271
// samplingJProfiling is disabled globally. It will be enabled on a method by
2272
// method basis based on selected heuristic
2273
self()->setDisabled(OMR::samplingJProfiling, true);
2274
2275
#if defined (TR_HOST_S390)
2276
// Disable lock reservation due to a functional problem causing a deadlock situation in an ODM workload in Java 8
2277
// SR5. In addition several performance issues on SPARK workloads have been reported which seem to concurrently
2278
// access StringBuffer objects from multiple threads.
2279
self()->setOption(TR_DisableLockResevation);
2280
// Setting number of onsite cache slots for instanceOf node to 4 on IBM Z
2281
self()->setMaxOnsiteCacheSlotForInstanceOf(4);
2282
#endif
2283
// Set a value for _safeReservePhysicalMemoryValue that is proportional
2284
// to the amount of free physical memory at boot time
2285
// The user can still override it with a command line option
2286
bool incomplete = false;
2287
uint64_t phMemAvail = compInfo->computeAndCacheFreePhysicalMemory(incomplete);
2288
if (phMemAvail != OMRPORT_MEMINFO_NOT_AVAILABLE && !incomplete)
2289
{
2290
const uint64_t reserveLimit = 32 * 1024 * 1024;
2291
uint64_t proposed = phMemAvail >> 6; // 64 times less
2292
if (proposed > reserveLimit)
2293
proposed = reserveLimit;
2294
J9::Options::_safeReservePhysicalMemoryValue = (int32_t)proposed;
2295
}
2296
2297
// enable TR_SelfTuningScratchMemoryUsageBeforeCompile if there is no swap memory
2298
J9MemoryInfo memInfo;
2299
if ((omrsysinfo_get_memory_info(&memInfo) == 0) && (0 == memInfo.totalSwap))
2300
{
2301
self()->setOption(TR_EnableSelfTuningScratchMemoryUsageBeforeCompile);
2302
}
2303
2304
self()->preProcessDeterministicMode(vm);
2305
2306
if (!TR::Compiler->target.cpu.isZ())
2307
self()->setOption(TR_DisableAOTBytesCompression);
2308
2309
if (!self()->preProcessJitServer(vm, jitConfig))
2310
{
2311
return false;
2312
}
2313
2314
#if (defined(TR_HOST_X86) || defined(TR_HOST_S390) || defined(TR_HOST_POWER)) && defined(TR_TARGET_64BIT)
2315
self()->setOption(TR_EnableSymbolValidationManager);
2316
#endif
2317
2318
return true;
2319
}
2320
2321
void
2322
J9::Options::openLogFiles(J9JITConfig *jitConfig)
2323
{
2324
char *vLogFileName = ((TR_JitPrivateConfig*)jitConfig->privateConfig)->vLogFileName;
2325
if (vLogFileName)
2326
((TR_JitPrivateConfig*)jitConfig->privateConfig)->vLogFile = fileOpen(self(), jitConfig, vLogFileName, "wb", true);
2327
2328
char *rtLogFileName = ((TR_JitPrivateConfig*)jitConfig->privateConfig)->rtLogFileName;
2329
if (rtLogFileName)
2330
((TR_JitPrivateConfig*)jitConfig->privateConfig)->rtLogFile = fileOpen(self(), jitConfig, rtLogFileName, "wb", true);
2331
}
2332
2333
#if defined(J9VM_OPT_JITSERVER)
2334
void
2335
J9::Options::setupJITServerOptions()
2336
{
2337
TR::CompilationInfo * compInfo = getCompilationInfo(jitConfig);
2338
2339
if (compInfo->getPersistentInfo()->getRemoteCompilationMode() == JITServer::SERVER ||
2340
compInfo->getPersistentInfo()->getRemoteCompilationMode() == JITServer::CLIENT)
2341
{
2342
self()->setOption(TR_DisableSamplingJProfiling);
2343
self()->setOption(TR_DisableProfiling); // JITServer limitation, JIT profiling data is not available to remote compiles yet
2344
self()->setOption(TR_DisableEDO); // JITServer limitation, EDO counters are not relocatable yet
2345
self()->setOption(TR_DisableMethodIsCold); // Shady heuristic; better to disable to reduce client/server traffic
2346
self()->setOption(TR_DisableJProfilerThread);
2347
self()->setOption(TR_EnableJProfiling, false);
2348
2349
if (compInfo->getPersistentInfo()->getRemoteCompilationMode() == JITServer::SERVER)
2350
{
2351
// The server can compile with VM access in hand because GC is not a factor here
2352
// For the same reason we don't have to use TR_EnableYieldVMAccess
2353
self()->setOption(TR_DisableNoVMAccess);
2354
2355
// IProfiler thread is not needed at JITServer because
2356
// no IProfiler info is collected at the server itself
2357
self()->setOption(TR_DisableIProfilerThread);
2358
J9::Compilation::setOutOfProcessCompilation();
2359
}
2360
2361
// In the JITServer world, expensive compilations are performed remotely so there is no risk of blowing the footprint limit on the JVM
2362
// Setting _expensiveCompWeight to a large value so that JSR292/hot/scorching compilation are allowed to be executed concurrently
2363
TR::Options::_expensiveCompWeight = TR::CompilationInfo::MAX_WEIGHT;
2364
}
2365
2366
if (TR::Options::getVerboseOption(TR_VerboseJITServer))
2367
{
2368
TR::PersistentInfo *persistentInfo = compInfo->getPersistentInfo();
2369
if (persistentInfo->getRemoteCompilationMode() == JITServer::SERVER)
2370
{
2371
JITServer::CommunicationStream::printJITServerVersion();
2372
TR_VerboseLog::writeLineLocked(TR_Vlog_JITServer, "JITServer Server Mode. Port: %d. Connection Timeout %ums",
2373
persistentInfo->getJITServerPort(), persistentInfo->getSocketTimeout());
2374
}
2375
else if (persistentInfo->getRemoteCompilationMode() == JITServer::CLIENT)
2376
{
2377
JITServer::CommunicationStream::printJITServerVersion();
2378
TR_VerboseLog::writeLineLocked(TR_Vlog_JITServer, "JITServer Client Mode. Server address: %s port: %d. Connection Timeout %ums",
2379
persistentInfo->getJITServerAddress().c_str(), persistentInfo->getJITServerPort(),
2380
persistentInfo->getSocketTimeout());
2381
TR_VerboseLog::writeLineLocked(TR_Vlog_JITServer, "Identifier for current client JVM: %llu\n",
2382
(unsigned long long) compInfo->getPersistentInfo()->getClientUID());
2383
}
2384
}
2385
}
2386
#endif /* defined(J9VM_OPT_JITSERVER) */
2387
2388
bool
2389
J9::Options::fePostProcessJIT(void * base)
2390
{
2391
// vmPostProcess is called indirectly from the JIT_INITIALIZED phase
2392
// vmLatePostProcess is called indirectly from the aboutToBootstrap hook
2393
//
2394
J9JITConfig * jitConfig = (J9JITConfig*)base;
2395
J9JavaVM * javaVM = jitConfig->javaVM;
2396
PORT_ACCESS_FROM_JAVAVM(javaVM);
2397
2398
TR::CompilationInfo * compInfo = getCompilationInfo(jitConfig);
2399
// If user has not specified a value for compilation threads, do it now.
2400
// This code does not have to stay in the fePostProcessAOT because in an AOT only
2401
// scenario we don't need more than one compilation thread to load code.
2402
//
2403
if (_numUsableCompilationThreads <= 0)
2404
{
2405
_useCPUsToDetermineMaxNumberOfCompThreadsToActivate = true;
2406
if (TR::Compiler->target.isLinux())
2407
{
2408
// For linux we may want to create more threads to overcome thread
2409
// starvation due to lack of priorities
2410
//
2411
if (!TR::Options::getCmdLineOptions()->getOption(TR_DisableRampupImprovements) &&
2412
!TR::Options::getAOTCmdLineOptions()->getOption(TR_DisableRampupImprovements))
2413
{
2414
compInfo->updateNumUsableCompThreads(_numUsableCompilationThreads);
2415
}
2416
}
2417
if (_numUsableCompilationThreads <= 0)
2418
{
2419
// Determine the number of compilation threads based on number of online processors
2420
// Do not create more than numProc-1 compilation threads, but at least one
2421
//
2422
uint32_t numOnlineCPUs = j9sysinfo_get_number_CPUs_by_type(J9PORT_CPU_ONLINE);
2423
compInfo->updateNumUsableCompThreads(_numUsableCompilationThreads);
2424
_numUsableCompilationThreads = numOnlineCPUs > 1 ? std::min((numOnlineCPUs - 1), static_cast<uint32_t>(_numUsableCompilationThreads)) : 1;
2425
}
2426
}
2427
2428
// patch Lock OR if mfence is not being used
2429
//
2430
if (!self()->getOption(TR_X86UseMFENCE) && (jitConfig->runtimeFlags & J9JIT_PATCHING_FENCE_TYPE))
2431
jitConfig->runtimeFlags ^= J9JIT_PATCHING_FENCE_TYPE; // clear the bit
2432
2433
// Main options
2434
//
2435
// Before we do anything, hack the flag field into place
2436
uint32_t flags = *(uint32_t *)(&jitConfig->runtimeFlags);
2437
jitConfig->runtimeFlags |= flags;
2438
2439
if (jitConfig->runtimeFlags & J9JIT_TOSS_CODE)
2440
self()->setOption(TR_DisableAsyncCompilation, true);
2441
2442
if (jitConfig->runtimeFlags & J9JIT_RUNTIME_RESOLVE)
2443
jitConfig->gcOnResolveThreshold = 0;
2444
2445
if (_samplingFrequency > MAX_SAMPLING_FREQUENCY/10000) // Cap the user specified sampling frequency to "max"/10000
2446
_samplingFrequency = MAX_SAMPLING_FREQUENCY/10000; // Too large a value can make samplingPeriod
2447
// negative when we multiply by loadFactor
2448
jitConfig->samplingFrequency = _samplingFrequency;
2449
2450
// grab vLogFileName from jitConfig and put into jitPrivateConfig, where it will be found henceforth
2451
TR_JitPrivateConfig *privateConfig = (TR_JitPrivateConfig*)jitConfig->privateConfig;
2452
privateConfig->vLogFileName = jitConfig->vLogFileName;
2453
self()->openLogFiles(jitConfig);
2454
2455
// Copy verbose flags from jitConfig into TR::Options static fields
2456
//
2457
TR::Options::setVerboseOptions(privateConfig->verboseFlags);
2458
2459
if (TR::Options::getVerboseOption(TR_VerboseFilters))
2460
{
2461
if (TR::Options::getDebug() && TR::Options::getDebug()->getCompilationFilters())
2462
{
2463
TR_VerboseLog::writeLine(TR_Vlog_INFO,"JIT limit filters:");
2464
TR::Options::getDebug()->printFilters();
2465
}
2466
}
2467
2468
#if defined(J9VM_OPT_JITSERVER)
2469
self()->setupJITServerOptions();
2470
#endif /* defined(J9VM_OPT_JITSERVER) */
2471
2472
return true;
2473
}
2474
2475
bool
2476
J9::Options::fePostProcessAOT(void * base)
2477
{
2478
J9JITConfig * jitConfig = (J9JITConfig*)base;
2479
J9JavaVM * javaVM = jitConfig->javaVM;
2480
PORT_ACCESS_FROM_JAVAVM(javaVM);
2481
2482
self()->openLogFiles(jitConfig);
2483
2484
if (TR::Options::getVerboseOption(TR_VerboseFilters))
2485
{
2486
if (TR::Options::getDebug() && TR::Options::getDebug()->getCompilationFilters())
2487
{
2488
TR_VerboseLog::writeLine(TR_Vlog_INFO,"AOT limit filters:");
2489
TR::Options::getDebug()->printFilters();
2490
}
2491
}
2492
2493
#if defined(J9VM_OPT_JITSERVER)
2494
self()->setupJITServerOptions();
2495
#endif /* defined(J9VM_OPT_JITSERVER) */
2496
2497
return true;
2498
}
2499
2500
bool J9::Options::feLatePostProcess(void * base, TR::OptionSet * optionSet)
2501
{
2502
// vmPostProcess is called indirectly from the JIT_INITIALIZED phase
2503
// vmLatePostProcess is called indirectly from the aboutToBootstrap hook
2504
//
2505
bool doAOT = true;
2506
if (optionSet)
2507
{
2508
// nothing option set specific to do
2509
return true;
2510
}
2511
2512
J9JITConfig * jitConfig = (J9JITConfig*)base;
2513
J9JavaVM * javaVM = jitConfig->javaVM;
2514
J9HookInterface * * vmHooks = javaVM->internalVMFunctions->getVMHookInterface(javaVM);
2515
2516
TR_J9VMBase * vm = TR_J9VMBase::get(jitConfig, 0);
2517
TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig);
2518
2519
// runtimeFlags are properly setup only in fePostProcessJit,
2520
// so for AOT we can properly set dependent options only here
2521
if (jitConfig->runtimeFlags & J9JIT_TOSS_CODE)
2522
self()->setOption(TR_DisableAsyncCompilation, true);
2523
2524
PORT_ACCESS_FROM_JAVAVM(jitConfig->javaVM);
2525
if (vm->isAOT_DEPRECATED_DO_NOT_USE() || (jitConfig->runtimeFlags & J9JIT_TOSS_CODE))
2526
return true;
2527
2528
#if defined(J9VM_INTERP_ATOMIC_FREE_JNI) && !defined(TR_HOST_S390) && !defined(TR_HOST_POWER) && !defined(TR_HOST_X86) && !defined(TR_HOST_ARM64)
2529
// Atomic-free JNI dispatch needs codegen support, currently only prototyped on a few platforms
2530
setOption(TR_DisableDirectToJNI);
2531
#endif
2532
2533
#if defined(J9VM_ZOS_3164_INTEROPERABILITY)
2534
// 31-64 Interop currently lacks codegen DirectToJNI support to invoke cross AMODE calls.
2535
// This is a temporarily measure to ensure functional correctness. At the least, we can
2536
// enable DirectToJNI for resolved JNI calls to 64-bit targets.
2537
if (J9_ARE_ALL_BITS_SET(javaVM->extendedRuntimeFlags2, J9_EXTENDED_RUNTIME2_3164_INTEROPERABILITY)) {
2538
setOption(TR_DisableDirectToJNI);
2539
}
2540
#endif
2541
2542
// Determine whether or not to call the hooked helpers
2543
//
2544
if (
2545
#if defined(J9VM_JIT_FULL_SPEED_DEBUG)
2546
(javaVM->requiredDebugAttributes & J9VM_DEBUG_ATTRIBUTE_CAN_ACCESS_LOCALS) ||
2547
#endif
2548
#if defined (J9VM_INTERP_HOT_CODE_REPLACEMENT)
2549
(*vmHooks)->J9HookDisable(vmHooks, J9HOOK_VM_POP_FRAMES_INTERRUPT) ||
2550
#endif
2551
(*vmHooks)->J9HookDisable(vmHooks, J9HOOK_VM_BREAKPOINT) ||
2552
(*vmHooks)->J9HookDisable(vmHooks, J9HOOK_VM_FRAME_POPPED) ||
2553
(*vmHooks)->J9HookDisable(vmHooks, J9HOOK_VM_FRAME_POP) ||
2554
(*vmHooks)->J9HookDisable(vmHooks, J9HOOK_VM_GET_FIELD) ||
2555
(*vmHooks)->J9HookDisable(vmHooks, J9HOOK_VM_PUT_FIELD) ||
2556
(*vmHooks)->J9HookDisable(vmHooks, J9HOOK_VM_GET_STATIC_FIELD) ||
2557
(*vmHooks)->J9HookDisable(vmHooks, J9HOOK_VM_PUT_STATIC_FIELD) ||
2558
(*vmHooks)->J9HookDisable(vmHooks, J9HOOK_VM_SINGLE_STEP))
2559
{
2560
static bool TR_DisableFullSpeedDebug = (feGetEnv("TR_DisableFullSpeedDebug") != NULL);
2561
static bool TR_DisableFullSpeedDebugAOT = (feGetEnv("TR_DisableFullSpeedDebugAOT") != NULL);
2562
#if defined(J9VM_JIT_FULL_SPEED_DEBUG)
2563
if (TR_DisableFullSpeedDebug)
2564
{
2565
return false;
2566
}
2567
else if (TR_DisableFullSpeedDebugAOT)
2568
{
2569
doAOT = false;
2570
}
2571
2572
self()->setOption(TR_FullSpeedDebug);
2573
self()->setOption(TR_DisableDirectToJNI);
2574
//setOption(TR_DisableNoVMAccess);
2575
//setOption(TR_DisableAsyncCompilation);
2576
//setOption(TR_DisableInterpreterProfiling, true);
2577
2578
initializeFSD(javaVM);
2579
#else
2580
return false;
2581
#endif
2582
}
2583
2584
bool exceptionEventHooked = false;
2585
if ((*vmHooks)->J9HookDisable(vmHooks, J9HOOK_VM_EXCEPTION_CATCH))
2586
{
2587
jitConfig->jitExceptionCaught = jitExceptionCaught;
2588
exceptionEventHooked = true;
2589
}
2590
if ((*vmHooks)->J9HookDisable(vmHooks, J9HOOK_VM_EXCEPTION_THROW))
2591
{
2592
exceptionEventHooked = true;
2593
}
2594
if (exceptionEventHooked)
2595
{
2596
self()->setOption(TR_DisableThrowToGoto);
2597
self()->setReportByteCodeInfoAtCatchBlock();
2598
}
2599
2600
// Determine whether or not to generate method enter and exit hooks
2601
//
2602
if ((*vmHooks)->J9HookDisable(vmHooks, J9HOOK_VM_METHOD_ENTER))
2603
{
2604
self()->setOption(TR_ReportMethodEnter);
2605
#if !defined(TR_HOST_S390) && !defined(TR_HOST_POWER) && !defined(TR_HOST_X86)
2606
doAOT = false;
2607
#endif
2608
}
2609
if ((*vmHooks)->J9HookDisable(vmHooks, J9HOOK_VM_METHOD_RETURN))
2610
{
2611
self()->setOption(TR_ReportMethodExit);
2612
#if !defined(TR_HOST_S390) && !defined(TR_HOST_POWER) && !defined(TR_HOST_X86)
2613
doAOT = false;
2614
#endif
2615
}
2616
2617
// Determine whether or not to disable allocation inlining
2618
//
2619
J9MemoryManagerFunctions * mmf = javaVM->memoryManagerFunctions;
2620
2621
if (!mmf->j9gc_jit_isInlineAllocationSupported(javaVM))
2622
{
2623
self()->setOption(TR_DisableAllocationInlining);
2624
doAOT = false;
2625
}
2626
2627
#if 0
2628
// Determine whether or not to disable inlining
2629
//
2630
if ((TR::Options::getCmdLineOptions()->getOption(TR_ReportMethodEnter) ||
2631
TR::Options::getCmdLineOptions()->getOption(TR_ReportMethodExit)))
2632
{
2633
self()->setDisabled(inlining, true);
2634
printf("disabling inlining due to trace setting\n");
2635
doAOT = false;
2636
}
2637
#endif
2638
2639
#if defined(J9VM_OPT_JITSERVER)
2640
// Change the values of the two thresholds if the user didn't
2641
// input values to the options.
2642
if (_veryHighActiveThreadThreshold == -1)
2643
_veryHighActiveThreadThreshold = getNumUsableCompilationThreads() * 0.9;
2644
2645
if (_highActiveThreadThreshold == -1)
2646
_highActiveThreadThreshold = getNumUsableCompilationThreads() * 0.8;
2647
2648
// Check if the user inputted the correct values.
2649
// If the thresholds are bigger than the usableCompilationThreads, Then set them to be equal to the number of compilation threads.
2650
if (_veryHighActiveThreadThreshold > getNumUsableCompilationThreads())
2651
_veryHighActiveThreadThreshold = getNumUsableCompilationThreads();
2652
if (_highActiveThreadThreshold > getNumUsableCompilationThreads())
2653
_highActiveThreadThreshold = getNumUsableCompilationThreads();
2654
if (_highActiveThreadThreshold > _veryHighActiveThreadThreshold)
2655
_highActiveThreadThreshold = _veryHighActiveThreadThreshold;
2656
2657
#endif /* defined(J9VM_OPT_JITSERVER) */
2658
2659
// Determine whether or not to inline monitor enter/exit
2660
//
2661
if (self()->getOption(TR_DisableLiveMonitorMetadata))
2662
{
2663
self()->setOption(TR_DisableInlineMonEnt);
2664
self()->setOption(TR_DisableInlineMonExit);
2665
doAOT = false;
2666
}
2667
2668
// If the VM -Xrs or -Xrs:sync option has been specified the user is requesting
2669
// that we remove signals. Set the noResumableTrapHandler option to note this
2670
// request.
2671
// Also disable the packed decimal part of DAA because some PD instructions
2672
// trigger hardware exceptions. A new option has been added to disable traps
2673
// Which allows the disabling of DAA and traps to be decoupled from the handler
2674
// Multiple variants of -Xrs option are available now:
2675
// -Xrs Ignore all signals (J9_SIG_XRS_SYNC, J9_SIG_XRS_ASYNC)
2676
// -Xrs:sync Ignore synchronous signals (J9_SIG_XRS_SYNC)
2677
// -Xrs:async Ignore asynchronous signals (J9_SIG_XRS_ASYNC)
2678
if (J9_ARE_ALL_BITS_SET(javaVM->sigFlags, J9_SIG_XRS_SYNC))
2679
{
2680
self()->setOption(TR_NoResumableTrapHandler);
2681
self()->setOption(TR_DisablePackedDecimalIntrinsics);
2682
self()->setOption(TR_DisableTraps);
2683
2684
// Call initialize again to reset the flag as it will have been set on
2685
// in an earlier call
2686
vm->initializeHasResumableTrapHandler();
2687
}
2688
2689
// The trap handler currently is working (jitt fails) on Ottawa's IA32 Hardhat machine.
2690
// The platform isn't shipping so the priority of fixing the problem is currently low.
2691
//
2692
#if defined(HARDHAT) && defined(TR_TARGET_X86)
2693
self()->setOption(TR_NoResumableTrapHandler);
2694
#endif
2695
2696
// Determine whether or not to inline meta data maps have to represent every inline transition point
2697
//
2698
// The J9VM_DEBUG_ATTRIBUTE_MAINTAIN_FULL_INLINE_MAP is currently undefined in the Real Time builds. Once
2699
// the real time VM line has been merged back into the dev line then these 3 preprocessor statements can
2700
// be removed
2701
//
2702
#ifndef J9VM_DEBUG_ATTRIBUTE_MAINTAIN_FULL_INLINE_MAP
2703
#define J9VM_DEBUG_ATTRIBUTE_MAINTAIN_FULL_INLINE_MAP 0
2704
#endif
2705
if (javaVM->requiredDebugAttributes & J9VM_DEBUG_ATTRIBUTE_MAINTAIN_FULL_INLINE_MAP)
2706
{
2707
self()->setOption(TR_GenerateCompleteInlineRanges);
2708
doAOT = false;
2709
}
2710
2711
// If class redefinition is the only debug capability - FSD off, HCR on
2712
// If other capabilities are specified, such as break points - FSD on, HCR off
2713
static char *disableHCR = feGetEnv("TR_DisableHCR");
2714
if ((javaVM->requiredDebugAttributes & J9VM_DEBUG_ATTRIBUTE_CAN_REDEFINE_CLASSES) && !self()->getOption(TR_FullSpeedDebug))
2715
if (!self()->getOption(TR_EnableHCR) && !disableHCR)
2716
{
2717
self()->setOption(TR_EnableHCR);
2718
}
2719
2720
// Check NextGenHCR is supported by the VM
2721
if (!(javaVM->extendedRuntimeFlags & J9_EXTENDED_RUNTIME_OSR_SAFE_POINT) ||
2722
(*vmHooks)->J9HookDisable(vmHooks, J9HOOK_VM_OBJECT_ALLOCATE_INSTRUMENTABLE) || disableHCR)
2723
{
2724
self()->setOption(TR_DisableNextGenHCR);
2725
}
2726
2727
#if !defined(TR_HOST_X86) && !defined(TR_HOST_S390) && !defined(TR_HOST_POWER) && !defined(TR_HOST_ARM64)
2728
//The bit is set when -XX:+JITInlineWatches is specified
2729
if (J9_ARE_ANY_BITS_SET(javaVM->extendedRuntimeFlags, J9_EXTENDED_RUNTIME_JIT_INLINE_WATCHES))
2730
TR_ASSERT_FATAL(false, "this platform doesn't support JIT inline field watch");
2731
#endif
2732
2733
// GCR and JProfiling are disabled under FSD for a number of reasons
2734
// First, there is confusion between the VM and the JIT as to whether a call to jitRetranslateCallerWithPreparation is a decompilation point.
2735
// Having the JIT agree with the VM could not be done by simply marking the symbol canGCandReturn, as this would affect other parts of the JIT
2736
// Second, in a sync method this call will occur before the temporary sync object has been stored to its temp
2737
// This results in the sync object not being available when the VM calls the buffer filling code
2738
//
2739
if (self()->getOption(TR_FullSpeedDebug))
2740
{
2741
self()->setReportByteCodeInfoAtCatchBlock();
2742
self()->setOption(TR_DisableGuardedCountingRecompilations);
2743
self()->setOption(TR_EnableJProfiling, false);
2744
//might move around asyn checks and clone the OSRBlock which are not safe under the current OSR infrastructure
2745
self()->setOption(TR_DisableProfiling);
2746
//the VM side doesn't support fsd for this event yet
2747
self()->setOption(TR_DisableNewInstanceImplOpt);
2748
//the following 2 opts might insert async checks at new bytecode index where the OSR infrastructures doesn't exist
2749
self()->setDisabled(OMR::redundantGotoElimination, true);
2750
self()->setDisabled(OMR::loopReplicator, true);
2751
}
2752
2753
#if defined(J9VM_OPT_SHARED_CLASSES)
2754
if (TR::Options::sharedClassCache())
2755
{
2756
if (!doAOT)
2757
{
2758
if (this == TR::Options::getAOTCmdLineOptions())
2759
{
2760
TR::Options::getAOTCmdLineOptions()->setOption(TR_NoLoadAOT);
2761
TR::Options::getAOTCmdLineOptions()->setOption(TR_NoStoreAOT);
2762
TR::Options::setSharedClassCache(false);
2763
if (javaVM->sharedClassConfig->verboseFlags & J9SHR_VERBOSEFLAG_ENABLE_VERBOSE)
2764
j9nls_printf( PORTLIB, J9NLS_WARNING, J9NLS_RELOCATABLE_CODE_NOT_AVAILABLE_WITH_FSD_JVMPI);
2765
}
2766
}
2767
else // do AOT
2768
{
2769
if (!self()->getOption(TR_DisablePersistIProfile))
2770
{
2771
// Turn off Iprofiler for the warm runs, but not if we cache only bootstrap classes
2772
// This is because we may be missing IProfiler information for non-bootstrap classes
2773
// that could not be stored in SCC
2774
if (J9_ARE_ALL_BITS_SET(javaVM->sharedClassConfig->runtimeFlags, J9SHR_RUNTIMEFLAG_ENABLE_CACHE_NON_BOOT_CLASSES))
2775
{
2776
TR::CompilationInfo * compInfo = getCompilationInfo(jitConfig);
2777
static char * dnipdsp = feGetEnv("TR_DisableNoIProfilerDuringStartupPhase");
2778
if (compInfo->isWarmSCC() == TR_yes && !dnipdsp)
2779
{
2780
self()->setOption(TR_NoIProfilerDuringStartupPhase);
2781
}
2782
}
2783
}
2784
}
2785
}
2786
#endif
2787
2788
// Divide by 0 checks
2789
if (TR::Options::_LoopyMethodDivisionFactor == 0)
2790
TR::Options::_LoopyMethodDivisionFactor = 16; // Reset it back to the default value
2791
if (TR::Options::_IprofilerOffDivisionFactor == 0)
2792
TR::Options::_IprofilerOffDivisionFactor = 16; // Reset it back to the default value
2793
2794
// Some options consistency fixes for 2 options objects
2795
//
2796
if ((TR::Options::getAOTCmdLineOptions()->getFixedOptLevel() != -1) && (TR::Options::getJITCmdLineOptions()->getFixedOptLevel() == -1))
2797
TR::Options::getJITCmdLineOptions()->setFixedOptLevel(TR::Options::getAOTCmdLineOptions()->getFixedOptLevel());
2798
if ((TR::Options::getJITCmdLineOptions()->getFixedOptLevel() != -1) && (TR::Options::getAOTCmdLineOptions()->getFixedOptLevel() == -1))
2799
TR::Options::getAOTCmdLineOptions()->setFixedOptLevel(TR::Options::getJITCmdLineOptions()->getFixedOptLevel());
2800
2801
if (compInfo->getPersistentInfo()->isRuntimeInstrumentationRecompilationEnabled())
2802
{
2803
if (!TR::Options::getCmdLineOptions()->getOption(TR_EnableJitSamplingUpgradesDuringHWProfiling))
2804
{
2805
TR::Options::getCmdLineOptions()->setOption(TR_DisableUpgrades);
2806
}
2807
2808
// Under RI based recompilation, disable GCR recompilation
2809
TR::Options::getCmdLineOptions()->setOption(TR_DisableGuardedCountingRecompilations);
2810
TR::Options::getAOTCmdLineOptions()->setOption(TR_DisableGuardedCountingRecompilations);
2811
2812
// If someone enabled the mechanism to turn off RI during steady state,
2813
// we must disable the mechanism that toggle RI on/off dynamically
2814
if (self()->getOption(TR_InhibitRIBufferProcessingDuringDeepSteady))
2815
self()->setOption(TR_DisableDynamicRIBufferProcessing);
2816
}
2817
2818
// If the user or JIT heuristics (Xquickstart) want us to restrict the inlining during startup
2819
// now it's time to set the flag that enables the feature
2820
if (self()->getOption(TR_RestrictInlinerDuringStartup))
2821
{
2822
compInfo->getPersistentInfo()->setInlinerTemporarilyRestricted(true);
2823
}
2824
2825
// If we don't want to collect any type of information from samplingJProfiling
2826
// the disable the opt completely
2827
if (!TR::Options::getCmdLineOptions()->isAnySamplingJProfilingOptionSet())
2828
self()->setOption(TR_DisableSamplingJProfiling);
2829
2830
#if defined(J9VM_JIT_DYNAMIC_LOOP_TRANSFER)
2831
if (!compInfo->getDLT_HT() && TR::Options::_numDLTBufferMatchesToEagerlyIssueCompReq > 1)
2832
compInfo->setDLT_HT(new (PERSISTENT_NEW) DLTTracking(compInfo->getPersistentInfo()));
2833
#endif
2834
// The exploitation of idle time is done by a tracking mechanism done
2835
// on the IProfiler thread. If this thread does not exist, then we
2836
// must turn this feature off to avoid allocating a useless hashtable
2837
TR_IProfiler *iProfiler = vm->getIProfiler();
2838
if (!iProfiler || !iProfiler->getIProfilerThread())
2839
self()->setOption(TR_UseIdleTime, false);
2840
2841
// If NoResumableTrapHandler is set, disable packed decimal intrinsics inlining because
2842
// PD instructions exceptions can't be handled without the handler.
2843
// Add a new option to disable traps explicitly so DAA and trap instructions can be disabled separately
2844
// but are both covered by the NoResumableTrapHandler option
2845
if (self()->getOption(TR_NoResumableTrapHandler))
2846
{
2847
self()->setOption(TR_DisablePackedDecimalIntrinsics);
2848
self()->setOption(TR_DisableTraps);
2849
}
2850
2851
// Take care of the main option TR_DisableIntrinsics and the two sub-options
2852
if (self()->getOption(TR_DisableIntrinsics))
2853
{
2854
self()->setOption(TR_DisableMarshallingIntrinsics);
2855
self()->setOption(TR_DisablePackedDecimalIntrinsics);
2856
}
2857
else if (self()->getOption(TR_DisableMarshallingIntrinsics) &&
2858
self()->getOption(TR_DisablePackedDecimalIntrinsics))
2859
{
2860
self()->setOption(TR_DisableIntrinsics);
2861
}
2862
2863
/* Temporary (until SVM is the default)
2864
*
2865
* If the SVM is not enabled, use the old _coldUpgradeSampleThreshold
2866
* for AGGRESSIVE_AOT
2867
*/
2868
if (!self()->getOption(TR_EnableSymbolValidationManager)
2869
&& TR::Options::_aggressivenessLevel == TR::Options::AGGRESSIVE_AOT)
2870
{
2871
TR::Options::_coldUpgradeSampleThreshold = 10;
2872
}
2873
2874
#if defined(TR_HOST_ARM64)
2875
// ArraySet support is not available in AArch64 yet.
2876
// OpenJ9 issue #6443 tracks the work to enable.
2877
//
2878
self()->setOption(TR_DisableArraySetOpts);
2879
2880
// EDO catch block profiling support is not available in AArch64 yet.
2881
// OpenJ9 issue #6538 tracks the work to enable.
2882
//
2883
self()->setOption(TR_DisableEDO);
2884
#endif
2885
2886
return true;
2887
}
2888
2889
2890
void
2891
J9::Options::printPID()
2892
{
2893
((TR_J9VMBase *)_fe)->printPID();
2894
}
2895
2896
#if defined(J9VM_OPT_JITSERVER)
2897
void getTRPID(char *buf, size_t size);
2898
2899
static void
2900
appendRegex(TR::SimpleRegex *&regexPtr, uint8_t *&curPos)
2901
{
2902
if (!regexPtr)
2903
return;
2904
size_t len = regexPtr->regexStrLen();
2905
memcpy(curPos, regexPtr->regexStr(), len);
2906
TR_ASSERT(curPos[len - 1], "not expecting null terminator");
2907
// Replace the regex pointer with self-referring-pointer which is the offset of regex data
2908
// with respect to the regex pointer
2909
regexPtr = (TR::SimpleRegex*) ((uint8_t*)curPos - (uint8_t *)&regexPtr);
2910
curPos[len] = '\0';
2911
curPos += len + 1;
2912
}
2913
2914
static void
2915
unpackRegex(TR::SimpleRegex *&regexPtr)
2916
{
2917
if (!regexPtr)
2918
return;
2919
char *str = (char*)((uintptr_t)&regexPtr + (uintptr_t)regexPtr);
2920
regexPtr = TR::SimpleRegex::create(str);
2921
}
2922
2923
static void
2924
addRegexStringSize(TR::SimpleRegex *regexPtr, size_t &len)
2925
{
2926
if (regexPtr)
2927
len += regexPtr->regexStrLen() + 1;
2928
}
2929
2930
static uint8_t *
2931
appendContent(char * &charPtr, uint8_t * curPos, size_t length)
2932
{
2933
if (charPtr == NULL)
2934
return curPos;
2935
// Copy charPtr's content to the location pointed by curPos
2936
memcpy(curPos, charPtr, length);
2937
// Compute the offset from the address of charPtr to curPos and store it to charPtr
2938
charPtr = (char *)(curPos - (uint8_t *)&(charPtr));
2939
// Update current position
2940
return curPos += length;
2941
}
2942
2943
// Pack a TR::Options object into a std::string to be transfered to the server
2944
std::string
2945
J9::Options::packOptions(const TR::Options *origOptions)
2946
{
2947
size_t logFileNameLength = 0;
2948
size_t suffixLogsFormatLength = 0;
2949
size_t blockShufflingSequenceLength = 0;
2950
size_t induceOSRLength = 0;
2951
2952
char buf[JITSERVER_LOG_FILENAME_MAX_SIZE];
2953
char *origLogFileName = NULL;
2954
if (origOptions->_logFileName)
2955
{
2956
origLogFileName = origOptions->_logFileName;
2957
char pidBuf[20];
2958
memset(pidBuf, 0, sizeof(pidBuf));
2959
getTRPID(pidBuf, sizeof(pidBuf));
2960
logFileNameLength = strlen(origOptions->_logFileName) + strlen(".") + strlen(pidBuf) + strlen(".server") + 1;
2961
// If logFileNameLength is greater than JITSERVER_LOG_FILENAME_MAX_SIZE, PID might not be appended to the log file name
2962
// and the log file name could be truncated as well.
2963
if (logFileNameLength > JITSERVER_LOG_FILENAME_MAX_SIZE)
2964
logFileNameLength = JITSERVER_LOG_FILENAME_MAX_SIZE;
2965
snprintf(buf, logFileNameLength, "%s.%s.server", origOptions->_logFileName, pidBuf);
2966
}
2967
if (origOptions->_suffixLogsFormat)
2968
suffixLogsFormatLength = strlen(origOptions->_suffixLogsFormat) + 1;
2969
if (origOptions->_blockShufflingSequence)
2970
blockShufflingSequenceLength = strlen(origOptions->_blockShufflingSequence) + 1;
2971
if (origOptions->_induceOSR)
2972
induceOSRLength = strlen(origOptions->_induceOSR) + 1;
2973
2974
// sizeof(bool) is reserved to pack J9JIT_RUNTIME_RESOLVE
2975
size_t totalSize = sizeof(TR::Options) + logFileNameLength + suffixLogsFormatLength + blockShufflingSequenceLength + induceOSRLength + sizeof(bool);
2976
2977
addRegexStringSize(origOptions->_disabledOptTransformations, totalSize);
2978
addRegexStringSize(origOptions->_disabledInlineSites, totalSize);
2979
addRegexStringSize(origOptions->_disabledOpts, totalSize);
2980
addRegexStringSize(origOptions->_optsToTrace, totalSize);
2981
addRegexStringSize(origOptions->_dontInline, totalSize);
2982
addRegexStringSize(origOptions->_onlyInline, totalSize);
2983
addRegexStringSize(origOptions->_tryToInline, totalSize);
2984
addRegexStringSize(origOptions->_slipTrap, totalSize);
2985
addRegexStringSize(origOptions->_lockReserveClass, totalSize);
2986
addRegexStringSize(origOptions->_breakOnOpts, totalSize);
2987
addRegexStringSize(origOptions->_breakOnCreate, totalSize);
2988
addRegexStringSize(origOptions->_debugOnCreate, totalSize);
2989
addRegexStringSize(origOptions->_breakOnThrow, totalSize);
2990
addRegexStringSize(origOptions->_breakOnPrint, totalSize);
2991
addRegexStringSize(origOptions->_enabledStaticCounterNames, totalSize);
2992
addRegexStringSize(origOptions->_enabledDynamicCounterNames, totalSize);
2993
addRegexStringSize(origOptions->_counterHistogramNames, totalSize);
2994
addRegexStringSize(origOptions->_verboseOptTransformationsRegex, totalSize);
2995
addRegexStringSize(origOptions->_packedTest, totalSize);
2996
addRegexStringSize(origOptions->_memUsage, totalSize);
2997
addRegexStringSize(origOptions->_classesWithFolableFinalFields, totalSize);
2998
addRegexStringSize(origOptions->_disabledIdiomPatterns, totalSize);
2999
3000
std::string optionsStr(totalSize, '\0');
3001
TR::Options * options = (TR::Options *)optionsStr.data();
3002
memcpy(options, origOptions, sizeof(TR::Options));
3003
3004
if (origOptions->_logFileName)
3005
options->_logFileName = buf;
3006
3007
uint8_t *curPos = ((uint8_t *)options) + sizeof(TR::Options);
3008
3009
options->_optionSets = NULL;
3010
options->_startOptions = NULL;
3011
options->_envOptions = NULL;
3012
options->_logFile = NULL;
3013
options->_optFileName = NULL;
3014
options->_customStrategy = NULL;
3015
options->_customStrategySize = 0;
3016
options->_countString = NULL;
3017
appendRegex(options->_disabledOptTransformations, curPos);
3018
appendRegex(options->_disabledInlineSites, curPos);
3019
appendRegex(options->_disabledOpts, curPos);
3020
appendRegex(options->_optsToTrace, curPos);
3021
appendRegex(options->_dontInline, curPos);
3022
appendRegex(options->_onlyInline, curPos);
3023
appendRegex(options->_tryToInline, curPos);
3024
appendRegex(options->_slipTrap, curPos);
3025
appendRegex(options->_lockReserveClass, curPos);
3026
appendRegex(options->_breakOnOpts, curPos);
3027
appendRegex(options->_breakOnCreate, curPos);
3028
appendRegex(options->_debugOnCreate, curPos);
3029
appendRegex(options->_breakOnThrow, curPos);
3030
appendRegex(options->_breakOnPrint, curPos);
3031
appendRegex(options->_enabledStaticCounterNames, curPos);
3032
appendRegex(options->_enabledDynamicCounterNames, curPos);
3033
appendRegex(options->_counterHistogramNames, curPos);
3034
appendRegex(options->_verboseOptTransformationsRegex, curPos);
3035
appendRegex(options->_packedTest, curPos);
3036
appendRegex(options->_memUsage, curPos);
3037
appendRegex(options->_classesWithFolableFinalFields, curPos);
3038
appendRegex(options->_disabledIdiomPatterns, curPos);
3039
options->_osVersionString = NULL;
3040
options->_logListForOtherCompThreads = NULL;
3041
options->_objectFileName = NULL;
3042
3043
// Append the data pointed by a pointer to the content and patch the pointer
3044
// as a self-referring-pointer, or a relative pointer, which is
3045
// the offset of the data with respect to the pointer.
3046
curPos = appendContent(options->_logFileName, curPos, logFileNameLength);
3047
curPos = appendContent(options->_suffixLogsFormat, curPos, suffixLogsFormatLength);
3048
curPos = appendContent(options->_blockShufflingSequence, curPos, blockShufflingSequenceLength);
3049
curPos = appendContent(options->_induceOSR, curPos, induceOSRLength);
3050
3051
// Send rtResolve option to the server:
3052
// Temporary solution until we can send jitConfig->runtimeFlags to the server
3053
// or make rtResolve part of TR::Options instead of runtime flags
3054
auto *jitConfig = (J9JITConfig *) _feBase;
3055
bool rtResolve = jitConfig->runtimeFlags & J9JIT_RUNTIME_RESOLVE;
3056
char *rtResolveStr = (char *) &rtResolve;
3057
curPos = appendContent(rtResolveStr, curPos, sizeof(bool));
3058
3059
return optionsStr;
3060
}
3061
3062
TR::Options *
3063
J9::Options::unpackOptions(char *clientOptions, size_t clientOptionsSize, TR::CompilationInfoPerThreadBase* compInfoPT, TR_J9VMBase *fe, TR_Memory *trMemory)
3064
{
3065
TR::Options *options = (TR::Options *)trMemory->allocateHeapMemory(clientOptionsSize);
3066
memcpy(options, clientOptions, clientOptionsSize);
3067
3068
// Convert relative pointers to absolute pointers
3069
// pointer = address of field + offset
3070
if (options->_logFileName)
3071
options->_logFileName = (char *)((uint8_t *)&(options->_logFileName) + (ptrdiff_t)options->_logFileName);
3072
if (options->_suffixLogsFormat)
3073
options->_suffixLogsFormat = (char *)((uint8_t *)&(options->_suffixLogsFormat) + (ptrdiff_t)options->_suffixLogsFormat);
3074
if (options->_blockShufflingSequence)
3075
options->_blockShufflingSequence = (char *)((uint8_t *)&(options->_blockShufflingSequence) + (ptrdiff_t)options->_blockShufflingSequence);
3076
if (options->_induceOSR)
3077
options->_induceOSR = (char *)((uint8_t *)&(options->_induceOSR) + (ptrdiff_t)options->_induceOSR);
3078
3079
// Receive rtResolve: J9JIT_RUNTIME_RESOLVE
3080
// NOTE: This relies on rtResolve being the last option in clientOptions
3081
// the J9JIT_RUNTIME_RESOLVE flag from JITClient
3082
// On JITServer, we store this value for each client in ClientSessionData
3083
bool rtResolve = (bool) *((uint8_t *) options + clientOptionsSize - sizeof(bool));
3084
compInfoPT->getClientData()->setRtResolve(rtResolve);
3085
unpackRegex(options->_disabledOptTransformations);
3086
unpackRegex(options->_disabledInlineSites);
3087
unpackRegex(options->_disabledOpts);
3088
unpackRegex(options->_optsToTrace);
3089
unpackRegex(options->_dontInline);
3090
unpackRegex(options->_onlyInline);
3091
unpackRegex(options->_tryToInline);
3092
unpackRegex(options->_slipTrap);
3093
unpackRegex(options->_lockReserveClass);
3094
unpackRegex(options->_breakOnOpts);
3095
unpackRegex(options->_breakOnCreate);
3096
unpackRegex(options->_debugOnCreate);
3097
unpackRegex(options->_breakOnThrow);
3098
unpackRegex(options->_breakOnPrint);
3099
unpackRegex(options->_enabledStaticCounterNames);
3100
unpackRegex(options->_enabledDynamicCounterNames);
3101
unpackRegex(options->_counterHistogramNames);
3102
unpackRegex(options->_verboseOptTransformationsRegex);
3103
unpackRegex(options->_packedTest);
3104
unpackRegex(options->_memUsage);
3105
unpackRegex(options->_classesWithFolableFinalFields);
3106
unpackRegex(options->_disabledIdiomPatterns);
3107
3108
return options;
3109
}
3110
3111
// Pack the log file generated at the server to be sent to the client
3112
std::string
3113
J9::Options::packLogFile(TR::FILE *fp)
3114
{
3115
if (fp == NULL)
3116
return "";
3117
const size_t BUFFER_SIZE = 4096; // 4KB
3118
char buf[BUFFER_SIZE + 1];
3119
std::string logFileStr("");
3120
int readSize = 0;
3121
::rewind(fp->_stream);
3122
do {
3123
readSize = ::fread(buf, 1, BUFFER_SIZE, fp->_stream);
3124
buf[readSize] = '\0';
3125
logFileStr.append(buf);
3126
} while (readSize == BUFFER_SIZE);
3127
3128
logFileStr.append("</jitlog>\n");
3129
return logFileStr;
3130
}
3131
3132
// Create a log file at the client based on the log file string sent from the server
3133
int
3134
J9::Options::writeLogFileFromServer(const std::string& logFileContent)
3135
{
3136
if (logFileContent.empty() || !_logFileName)
3137
return 0;
3138
3139
char buf[JITSERVER_LOG_FILENAME_MAX_SIZE];
3140
_fe->acquireLogMonitor();
3141
snprintf(buf, sizeof(buf), "%s.%d.REMOTE", _logFileName, ++_compilationSequenceNumber);
3142
int sequenceNumber = _compilationSequenceNumber;
3143
_fe->releaseLogMonitor();
3144
3145
int32_t len = strlen(buf);
3146
// maximum length for suffix (dot + 8-digit date + dot + 6-digit time + dot + 5-digit pid + null terminator)
3147
int32_t MAX_SUFFIX_LENGTH = 23;
3148
if (len + MAX_SUFFIX_LENGTH > JITSERVER_LOG_FILENAME_MAX_SIZE)
3149
{
3150
if (TR::Options::getVerboseOption(TR_VerboseJITServer))
3151
{
3152
TR_VerboseLog::writeLineLocked(TR_Vlog_JITServer, "Trace log not generated due to filename being too long");
3153
}
3154
return 0; // may overflow the buffer
3155
}
3156
char tmp[JITSERVER_LOG_FILENAME_MAX_SIZE];
3157
char * filename = _fe->getFormattedName(tmp, JITSERVER_LOG_FILENAME_MAX_SIZE, buf, _suffixLogsFormat, true);
3158
3159
TR::FILE *logFile = trfopen(filename, "wb", false);
3160
::fputs(logFileContent.c_str(), logFile->_stream);
3161
trfflush(logFile);
3162
trfclose(logFile);
3163
3164
return sequenceNumber;
3165
}
3166
3167
TR_Debug *createDebugObject(TR::Compilation *);
3168
3169
// JITServer: Create a log file for each client compilation request
3170
// Side effect: set _logFile
3171
// At the client: Triggered when a remote compilation is followed by a local compilation.
3172
// suffixNumber is the compilationSequenceNumber used for the remote compilation.
3173
// At the server: suffixNumber is set as 0.
3174
void
3175
J9::Options::setLogFileForClientOptions(int suffixNumber)
3176
{
3177
if (_logFileName)
3178
{
3179
_fe->acquireLogMonitor();
3180
if (suffixNumber)
3181
{
3182
self()->setOption(TR_EnablePIDExtension, true);
3183
self()->openLogFile(suffixNumber);
3184
}
3185
else
3186
{
3187
_compilationSequenceNumber++;
3188
self()->setOption(TR_EnablePIDExtension, false);
3189
self()->openLogFile(_compilationSequenceNumber);
3190
}
3191
3192
if (_logFile)
3193
{
3194
J9JITConfig *jitConfig = (J9JITConfig*)_feBase;
3195
if (!jitConfig->tracingHook)
3196
{
3197
jitConfig->tracingHook = (void*) (TR_CreateDebug_t)createDebugObject;
3198
suppressLogFileBecauseDebugObjectNotCreated(false);
3199
_hasLogFile = true;
3200
}
3201
}
3202
_fe->releaseLogMonitor();
3203
}
3204
}
3205
3206
void
3207
J9::Options::closeLogFileForClientOptions()
3208
{
3209
if (_logFile)
3210
{
3211
TR::Options::closeLogFile(_fe, _logFile);
3212
_logFile = NULL;
3213
}
3214
}
3215
#endif /* defined(J9VM_OPT_JITSERVER) */
3216
3217