433 };
434
435 class DoubleFlagSetting {
436 double val;
437 double* flag;
438 public:
439 DoubleFlagSetting(double& fl, double newValue) { flag = &fl; val = fl; fl = newValue; }
440 ~DoubleFlagSetting() { *flag = val; }
441 };
442
443 class SizeTFlagSetting {
444 size_t val;
445 size_t* flag;
446 public:
447 SizeTFlagSetting(size_t& fl, size_t newValue) { flag = &fl; val = fl; fl = newValue; }
448 ~SizeTFlagSetting() { *flag = val; }
449 };
450
451
452 class CommandLineFlags {
453 static bool _finished_initializing;
454 public:
455 static Flag::Error boolAt(const char* name, size_t len, bool* value, bool allow_locked = false, bool return_flag = false);
456 static Flag::Error boolAt(const char* name, bool* value, bool allow_locked = false, bool return_flag = false) { return boolAt(name, strlen(name), value, allow_locked, return_flag); }
457 static Flag::Error boolAtPut(const char* name, size_t len, bool* value, Flag::Flags origin);
458 static Flag::Error boolAtPut(const char* name, bool* value, Flag::Flags origin) { return boolAtPut(name, strlen(name), value, origin); }
459
460 static Flag::Error intAt(const char* name, size_t len, int* value, bool allow_locked = false, bool return_flag = false);
461 static Flag::Error intAt(const char* name, int* value, bool allow_locked = false, bool return_flag = false) { return intAt(name, strlen(name), value, allow_locked, return_flag); }
462 static Flag::Error intAtPut(const char* name, size_t len, int* value, Flag::Flags origin);
463 static Flag::Error intAtPut(const char* name, int* value, Flag::Flags origin) { return intAtPut(name, strlen(name), value, origin); }
464
465 static Flag::Error uintAt(const char* name, size_t len, uint* value, bool allow_locked = false, bool return_flag = false);
466 static Flag::Error uintAt(const char* name, uint* value, bool allow_locked = false, bool return_flag = false) { return uintAt(name, strlen(name), value, allow_locked, return_flag); }
467 static Flag::Error uintAtPut(const char* name, size_t len, uint* value, Flag::Flags origin);
468 static Flag::Error uintAtPut(const char* name, uint* value, Flag::Flags origin) { return uintAtPut(name, strlen(name), value, origin); }
469
470 static Flag::Error intxAt(const char* name, size_t len, intx* value, bool allow_locked = false, bool return_flag = false);
471 static Flag::Error intxAt(const char* name, intx* value, bool allow_locked = false, bool return_flag = false) { return intxAt(name, strlen(name), value, allow_locked, return_flag); }
472 static Flag::Error intxAtPut(const char* name, size_t len, intx* value, Flag::Flags origin);
473 static Flag::Error intxAtPut(const char* name, intx* value, Flag::Flags origin) { return intxAtPut(name, strlen(name), value, origin); }
489
490 static Flag::Error doubleAt(const char* name, size_t len, double* value, bool allow_locked = false, bool return_flag = false);
491 static Flag::Error doubleAt(const char* name, double* value, bool allow_locked = false, bool return_flag = false) { return doubleAt(name, strlen(name), value, allow_locked, return_flag); }
492 static Flag::Error doubleAtPut(const char* name, size_t len, double* value, Flag::Flags origin);
493 static Flag::Error doubleAtPut(const char* name, double* value, Flag::Flags origin) { return doubleAtPut(name, strlen(name), value, origin); }
494
495 static Flag::Error ccstrAt(const char* name, size_t len, ccstr* value, bool allow_locked = false, bool return_flag = false);
496 static Flag::Error ccstrAt(const char* name, ccstr* value, bool allow_locked = false, bool return_flag = false) { return ccstrAt(name, strlen(name), value, allow_locked, return_flag); }
497 // Contract: Flag will make private copy of the incoming value.
498 // Outgoing value is always malloc-ed, and caller MUST call free.
499 static Flag::Error ccstrAtPut(const char* name, size_t len, ccstr* value, Flag::Flags origin);
500 static Flag::Error ccstrAtPut(const char* name, ccstr* value, Flag::Flags origin) { return ccstrAtPut(name, strlen(name), value, origin); }
501
502 // Returns false if name is not a command line flag.
503 static bool wasSetOnCmdline(const char* name, bool* value);
504 static void printSetFlags(outputStream* out);
505
506 // printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges
507 static void printFlags(outputStream* out, bool withComments, bool printRanges = false);
508
509 // Returns true if all flags have their final values set (ready for ranges and constraint check)
510 static bool finishedInitializing() { return _finished_initializing; }
511
512 // Check the final values of all flags for ranges and constraints
513 static bool check_all_ranges_and_constraints();
514
515 static void verify() PRODUCT_RETURN;
516 };
517
518 // use this for flags that are true by default in the debug version but
519 // false in the optimized version, and vice versa
520 #ifdef ASSERT
521 #define trueInDebug true
522 #define falseInDebug false
523 #else
524 #define trueInDebug false
525 #define falseInDebug true
526 #endif
527
528 // use this for flags that are true per default in the product build
529 // but false in development builds, and vice versa
530 #ifdef PRODUCT
531 #define trueInProduct true
532 #define falseInProduct false
533 #else
534 #define trueInProduct false
623 "lp64_product means flag is always constant in 32 bit VM") \
624 \
625 notproduct(bool, CheckCompressedOops, true, \
626 "Generate checks in encoding/decoding code in debug VM") \
627 \
628 product_pd(size_t, HeapBaseMinAddress, \
629 "OS specific low limit for heap base address") \
630 \
631 product(uintx, HeapSearchSteps, 3 PPC64_ONLY(+17), \
632 "Heap allocation steps through preferred address regions to find" \
633 " where it can allocate the heap. Number of steps to take per " \
634 "region.") \
635 range(1, max_uintx) \
636 \
637 diagnostic(bool, PrintCompressedOopsMode, false, \
638 "Print compressed oops base address and encoding mode") \
639 \
640 lp64_product(intx, ObjectAlignmentInBytes, 8, \
641 "Default object alignment in bytes, 8 is minimum") \
642 range(8, 256) \
643 constraint(ObjectAlignmentInBytesConstraintFunc) \
644 \
645 product(bool, AssumeMP, false, \
646 "Instruct the VM to assume multiple processors are available") \
647 \
648 /* UseMembar is theoretically a temp flag used for memory barrier */ \
649 /* removal testing. It was supposed to be removed before FCS but has */ \
650 /* been re-added (see 6401008) */ \
651 product_pd(bool, UseMembar, \
652 "(Unstable) Issues membars on thread state transitions") \
653 \
654 develop(bool, CleanChunkPoolAsync, falseInEmbedded, \
655 "Clean the chunk pool asynchronously") \
656 \
657 experimental(bool, AlwaysSafeConstructors, false, \
658 "Force safe construction, as if all fields are final.") \
659 \
660 /* Temporary: See 6948537 */ \
661 experimental(bool, UseMemSetInBOT, true, \
662 "(Unstable) uses memset in BOT updates in GC code") \
663 \
1379 \
1380 product(intx, FieldsAllocationStyle, 1, \
1381 "0 - type based with oops first, " \
1382 "1 - with oops last, " \
1383 "2 - oops in super and sub classes are together") \
1384 range(0, 2) \
1385 \
1386 product(bool, CompactFields, true, \
1387 "Allocate nonstatic fields in gaps between previous fields") \
1388 \
1389 notproduct(bool, PrintFieldLayout, false, \
1390 "Print field layout for each class") \
1391 \
1392 /* Need to limit the extent of the padding to reasonable size. */\
1393 /* 8K is well beyond the reasonable HW cache line size, even with */\
1394 /* aggressive prefetching, while still leaving the room for segregating */\
1395 /* among the distinct pages. */\
1396 product(intx, ContendedPaddingWidth, 128, \
1397 "How many bytes to pad the fields/classes marked @Contended with")\
1398 range(0, 8192) \
1399 constraint(ContendedPaddingWidthConstraintFunc) \
1400 \
1401 product(bool, EnableContended, true, \
1402 "Enable @Contended annotation support") \
1403 \
1404 product(bool, RestrictContended, true, \
1405 "Restrict @Contended to trusted classes") \
1406 \
1407 product(bool, UseBiasedLocking, true, \
1408 "Enable biased locking in JVM") \
1409 \
1410 product(intx, BiasedLockingStartupDelay, 4000, \
1411 "Number of milliseconds to wait before enabling biased locking") \
1412 \
1413 diagnostic(bool, PrintBiasedLockingStatistics, false, \
1414 "Print statistics of biased locking in JVM") \
1415 \
1416 product(intx, BiasedLockingBulkRebiasThreshold, 20, \
1417 "Threshold of number of revocations per type to try to " \
1418 "rebias all objects in the heap of that type") \
1419 \
1580 "Size of heap (bytes) per GC thread used in calculating the " \
1581 "number of GC threads") \
1582 range((uintx)os::vm_page_size(), max_uintx) \
1583 \
1584 product(bool, TraceDynamicGCThreads, false, \
1585 "Trace the dynamic GC thread usage") \
1586 \
1587 develop(bool, ParallelOldGCSplitALot, false, \
1588 "Provoke splitting (copying data from a young gen space to " \
1589 "multiple destination spaces)") \
1590 \
1591 develop(uintx, ParallelOldGCSplitInterval, 3, \
1592 "How often to provoke splitting a young gen space") \
1593 range(0, max_uintx) \
1594 \
1595 product(uint, ConcGCThreads, 0, \
1596 "Number of threads concurrent gc will use") \
1597 \
1598 product(size_t, YoungPLABSize, 4096, \
1599 "Size of young gen promotion LAB's (in HeapWords)") \
1600 \
1601 product(size_t, OldPLABSize, 1024, \
1602 "Size of old gen promotion LAB's (in HeapWords), or Number \
1603 of blocks to attempt to claim when refilling CMS LAB's") \
1604 \
1605 product(uintx, GCTaskTimeStampEntries, 200, \
1606 "Number of time stamp entries per gc worker thread") \
1607 range(1, max_uintx) \
1608 \
1609 product(bool, AlwaysTenure, false, \
1610 "Always tenure objects in eden (ParallelGC only)") \
1611 \
1612 product(bool, NeverTenure, false, \
1613 "Never tenure objects in eden, may tenure on overflow " \
1614 "(ParallelGC only)") \
1615 \
1616 product(bool, ScavengeBeforeFullGC, true, \
1617 "Scavenge youngest generation before each full GC.") \
1618 \
1619 develop(bool, ScavengeWithObjectsInToSpace, false, \
1718 "Percentage (0-100) used to weight the current sample when " \
1719 "computing exponentially decaying average for resizing " \
1720 "OldPLABSize") \
1721 range(0, 100) \
1722 \
1723 product(bool, ResizeOldPLAB, true, \
1724 "Dynamically resize (old gen) promotion LAB's") \
1725 \
1726 product(bool, PrintOldPLAB, false, \
1727 "Print (old gen) promotion LAB's sizing decisions") \
1728 \
1729 product(size_t, CMSOldPLABMax, 1024, \
1730 "Maximum size of CMS gen promotion LAB caches per worker " \
1731 "per block size") \
1732 range(1, max_uintx) \
1733 \
1734 product(size_t, CMSOldPLABMin, 16, \
1735 "Minimum size of CMS gen promotion LAB caches per worker " \
1736 "per block size") \
1737 range(1, max_uintx) \
1738 constraint(CMSOldPLABMinConstraintFunc) \
1739 \
1740 product(uintx, CMSOldPLABNumRefills, 4, \
1741 "Nominal number of refills of CMS gen promotion LAB cache " \
1742 "per worker per block size") \
1743 range(1, max_uintx) \
1744 \
1745 product(bool, CMSOldPLABResizeQuicker, false, \
1746 "React on-the-fly during a scavenge to a sudden " \
1747 "change in block demand rate") \
1748 \
1749 product(uintx, CMSOldPLABToleranceFactor, 4, \
1750 "The tolerance of the phase-change detector for on-the-fly " \
1751 "PLAB resizing during a scavenge") \
1752 range(1, max_uintx) \
1753 \
1754 product(uintx, CMSOldPLABReactivityFactor, 2, \
1755 "The gain in the feedback loop for on-the-fly PLAB resizing " \
1756 "during a scavenge") \
1757 \
1758 product(bool, AlwaysPreTouch, false, \
1914 \
1915 product(bool, CMSPrintEdenSurvivorChunks, false, \
1916 "Print the eden and the survivor chunks used for the parallel " \
1917 "initial mark or remark of the eden/survivor spaces") \
1918 \
1919 product(bool, CMSConcurrentMTEnabled, true, \
1920 "Whether multi-threaded concurrent work enabled " \
1921 "(effective only if ParNewGC)") \
1922 \
1923 product(bool, CMSPrecleaningEnabled, true, \
1924 "Whether concurrent precleaning enabled") \
1925 \
1926 product(uintx, CMSPrecleanIter, 3, \
1927 "Maximum number of precleaning iteration passes") \
1928 range(0, 9) \
1929 \
1930 product(uintx, CMSPrecleanDenominator, 3, \
1931 "CMSPrecleanNumerator:CMSPrecleanDenominator yields convergence " \
1932 "ratio") \
1933 range(1, max_uintx) \
1934 constraint(CMSPrecleanDenominatorConstraintFunc) \
1935 \
1936 product(uintx, CMSPrecleanNumerator, 2, \
1937 "CMSPrecleanNumerator:CMSPrecleanDenominator yields convergence " \
1938 "ratio") \
1939 range(0, max_uintx-1) \
1940 constraint(CMSPrecleanNumeratorConstraintFunc) \
1941 \
1942 product(bool, CMSPrecleanRefLists1, true, \
1943 "Preclean ref lists during (initial) preclean phase") \
1944 \
1945 product(bool, CMSPrecleanRefLists2, false, \
1946 "Preclean ref lists during abortable preclean phase") \
1947 \
1948 product(bool, CMSPrecleanSurvivors1, false, \
1949 "Preclean survivors during (initial) preclean phase") \
1950 \
1951 product(bool, CMSPrecleanSurvivors2, true, \
1952 "Preclean survivors during abortable preclean phase") \
1953 \
1954 product(uintx, CMSPrecleanThreshold, 1000, \
1955 "Do not iterate again if number of dirty cards is less than this")\
1956 range(100, max_uintx) \
1957 \
1958 product(bool, CMSCleanOnEnter, true, \
1959 "Clean-on-enter optimization for reducing number of dirty cards") \
1960 \
3344 product_pd(size_t, NewSizeThreadIncrease, \
3345 "Additional size added to desired new generation size per " \
3346 "non-daemon thread (in bytes)") \
3347 \
3348 product_pd(size_t, MetaspaceSize, \
3349 "Initial size of Metaspaces (in bytes)") \
3350 \
3351 product(size_t, MaxMetaspaceSize, max_uintx, \
3352 "Maximum size of Metaspaces (in bytes)") \
3353 \
3354 product(size_t, CompressedClassSpaceSize, 1*G, \
3355 "Maximum size of class area in Metaspace when compressed " \
3356 "class pointers are used") \
3357 range(1*M, 3*G) \
3358 \
3359 manageable(uintx, MinHeapFreeRatio, 40, \
3360 "The minimum percentage of heap free after GC to avoid expansion."\
3361 " For most GCs this applies to the old generation. In G1 and" \
3362 " ParallelGC it applies to the whole heap.") \
3363 range(0, 100) \
3364 constraint(MinHeapFreeRatioConstraintFunc) \
3365 \
3366 manageable(uintx, MaxHeapFreeRatio, 70, \
3367 "The maximum percentage of heap free after GC to avoid shrinking."\
3368 " For most GCs this applies to the old generation. In G1 and" \
3369 " ParallelGC it applies to the whole heap.") \
3370 range(0, 100) \
3371 constraint(MaxHeapFreeRatioConstraintFunc) \
3372 \
3373 product(intx, SoftRefLRUPolicyMSPerMB, 1000, \
3374 "Number of milliseconds per MB of free space in the heap") \
3375 \
3376 product(size_t, MinHeapDeltaBytes, ScaleForWordSize(128*K), \
3377 "The minimum change in heap space due to GC (in bytes)") \
3378 \
3379 product(size_t, MinMetaspaceExpansion, ScaleForWordSize(256*K), \
3380 "The minimum expansion of Metaspace (in bytes)") \
3381 \
3382 product(uintx, MaxMetaspaceFreeRatio, 70, \
3383 "The maximum percentage of Metaspace free after GC to avoid " \
3384 "shrinking") \
3385 range(0, 100) \
3386 constraint(MaxMetaspaceFreeRatioConstraintFunc) \
3387 \
3388 product(uintx, MinMetaspaceFreeRatio, 40, \
3389 "The minimum percentage of Metaspace free after GC to avoid " \
3390 "expansion") \
3391 range(0, 99) \
3392 constraint(MinMetaspaceFreeRatioConstraintFunc) \
3393 \
3394 product(size_t, MaxMetaspaceExpansion, ScaleForWordSize(4*M), \
3395 "The maximum expansion of Metaspace without full GC (in bytes)") \
3396 \
3397 product(uintx, QueuedAllocationWarningCount, 0, \
3398 "Number of times an allocation that queues behind a GC " \
3399 "will retry before printing a warning") \
3400 \
3401 diagnostic(uintx, VerifyGCStartAt, 0, \
3402 "GC invoke count where +VerifyBefore/AfterGC kicks in") \
3403 \
3404 diagnostic(intx, VerifyGCLevel, 0, \
3405 "Generation level at which to start +VerifyBefore/AfterGC") \
3406 \
3407 product(uintx, MaxTenuringThreshold, 15, \
3408 "Maximum value for tenuring threshold") \
3409 range(0, markOopDesc::max_age + 1) \
3410 constraint(MaxTenuringThresholdConstraintFunc) \
3411 \
3412 product(uintx, InitialTenuringThreshold, 7, \
3413 "Initial value for tenuring threshold") \
3414 range(0, markOopDesc::max_age + 1) \
3415 constraint(InitialTenuringThresholdConstraintFunc) \
3416 \
3417 product(uintx, TargetSurvivorRatio, 50, \
3418 "Desired percentage of survivor space used after scavenge") \
3419 range(0, 100) \
3420 \
3421 product(uintx, MarkSweepDeadRatio, 5, \
3422 "Percentage (0-100) of the old gen allowed as dead wood. " \
3423 "Serial mark sweep treats this as both the minimum and maximum " \
3424 "value. " \
3425 "CMS uses this value only if it falls back to mark sweep. " \
3426 "Par compact uses a variable scale based on the density of the " \
3427 "generation and treats this as the maximum value when the heap " \
3428 "is either completely full or completely empty. Par compact " \
3429 "also has a smaller default value; see arguments.cpp.") \
3430 range(0, 100) \
3431 \
3432 product(uintx, MarkSweepAlwaysCompactCount, 4, \
3433 "How often should we fully compact the heap (ignoring the dead " \
3434 "space parameters)") \
3435 range(1, max_uintx) \
4073 "to be considered for deduplication") \
4074 range(1, markOopDesc::max_age) \
4075 \
4076 diagnostic(bool, StringDeduplicationResizeALot, false, \
4077 "Force table resize every time the table is scanned") \
4078 \
4079 diagnostic(bool, StringDeduplicationRehashALot, false, \
4080 "Force table rehash every time the table is scanned") \
4081 \
4082 develop(bool, TraceDefaultMethods, false, \
4083 "Trace the default method processing steps") \
4084 \
4085 diagnostic(bool, WhiteBoxAPI, false, \
4086 "Enable internal testing APIs") \
4087 \
4088 product(bool, PrintGCCause, true, \
4089 "Include GC cause in GC logging") \
4090 \
4091 experimental(intx, SurvivorAlignmentInBytes, 0, \
4092 "Default survivor space alignment in bytes") \
4093 constraint(SurvivorAlignmentInBytesConstraintFunc) \
4094 \
4095 product(bool , AllowNonVirtualCalls, false, \
4096 "Obey the ACC_SUPER flag and allow invokenonvirtual calls") \
4097 \
4098 product(ccstr, DumpLoadedClassList, NULL, \
4099 "Dump the names all loaded classes, that could be stored into " \
4100 "the CDS archive, in the specified file") \
4101 \
4102 product(ccstr, SharedClassListFile, NULL, \
4103 "Override the default CDS class list") \
4104 \
4105 diagnostic(ccstr, SharedArchiveFile, NULL, \
4106 "Override the default location of the CDS archive file") \
4107 \
4108 product(ccstr, ExtraSharedClassListFile, NULL, \
4109 "Extra classlist for building the CDS archive file") \
4110 \
4111 experimental(size_t, ArrayAllocatorMallocLimit, \
4112 SOLARIS_ONLY(64*K) NOT_SOLARIS((size_t)-1), \
4113 "Allocation less than this value will be allocated " \
4173 #define MATERIALIZE_MANAGEABLE_FLAG(type, name, value, doc) type name = value;
4174 #define MATERIALIZE_PRODUCT_RW_FLAG(type, name, value, doc) type name = value;
4175 #ifdef PRODUCT
4176 #define MATERIALIZE_DEVELOPER_FLAG(type, name, value, doc) type CONST_##name = value;
4177 #define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, doc) type CONST_##name = pd_##name;
4178 #define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, doc) type CONST_##name = value;
4179 #else
4180 #define MATERIALIZE_DEVELOPER_FLAG(type, name, value, doc) type name = value;
4181 #define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, doc) type name = pd_##name;
4182 #define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, doc) type name = value;
4183 #endif // PRODUCT
4184 #ifdef _LP64
4185 #define MATERIALIZE_LP64_PRODUCT_FLAG(type, name, value, doc) type name = value;
4186 #else
4187 #define MATERIALIZE_LP64_PRODUCT_FLAG(type, name, value, doc) /* flag is constant */
4188 #endif // _LP64
4189
4190 // Only materialize src code for range checking when required, ignore otherwise
4191 #define IGNORE_RANGE(a, b)
4192 // Only materialize src code for contraint checking when required, ignore otherwise
4193 #define IGNORE_CONSTRAINT(func)
4194
4195 RUNTIME_FLAGS(DECLARE_DEVELOPER_FLAG, \
4196 DECLARE_PD_DEVELOPER_FLAG, \
4197 DECLARE_PRODUCT_FLAG, \
4198 DECLARE_PD_PRODUCT_FLAG, \
4199 DECLARE_DIAGNOSTIC_FLAG, \
4200 DECLARE_EXPERIMENTAL_FLAG, \
4201 DECLARE_NOTPRODUCT_FLAG, \
4202 DECLARE_MANAGEABLE_FLAG, \
4203 DECLARE_PRODUCT_RW_FLAG, \
4204 DECLARE_LP64_PRODUCT_FLAG, \
4205 IGNORE_RANGE, \
4206 IGNORE_CONSTRAINT)
4207
4208 RUNTIME_OS_FLAGS(DECLARE_DEVELOPER_FLAG, \
4209 DECLARE_PD_DEVELOPER_FLAG, \
4210 DECLARE_PRODUCT_FLAG, \
4211 DECLARE_PD_PRODUCT_FLAG, \
4212 DECLARE_DIAGNOSTIC_FLAG, \
4213 DECLARE_NOTPRODUCT_FLAG, \
|
433 };
434
435 class DoubleFlagSetting {
436 double val;
437 double* flag;
438 public:
439 DoubleFlagSetting(double& fl, double newValue) { flag = &fl; val = fl; fl = newValue; }
440 ~DoubleFlagSetting() { *flag = val; }
441 };
442
443 class SizeTFlagSetting {
444 size_t val;
445 size_t* flag;
446 public:
447 SizeTFlagSetting(size_t& fl, size_t newValue) { flag = &fl; val = fl; fl = newValue; }
448 ~SizeTFlagSetting() { *flag = val; }
449 };
450
451
452 class CommandLineFlags {
453 public:
454 static Flag::Error boolAt(const char* name, size_t len, bool* value, bool allow_locked = false, bool return_flag = false);
455 static Flag::Error boolAt(const char* name, bool* value, bool allow_locked = false, bool return_flag = false) { return boolAt(name, strlen(name), value, allow_locked, return_flag); }
456 static Flag::Error boolAtPut(const char* name, size_t len, bool* value, Flag::Flags origin);
457 static Flag::Error boolAtPut(const char* name, bool* value, Flag::Flags origin) { return boolAtPut(name, strlen(name), value, origin); }
458
459 static Flag::Error intAt(const char* name, size_t len, int* value, bool allow_locked = false, bool return_flag = false);
460 static Flag::Error intAt(const char* name, int* value, bool allow_locked = false, bool return_flag = false) { return intAt(name, strlen(name), value, allow_locked, return_flag); }
461 static Flag::Error intAtPut(const char* name, size_t len, int* value, Flag::Flags origin);
462 static Flag::Error intAtPut(const char* name, int* value, Flag::Flags origin) { return intAtPut(name, strlen(name), value, origin); }
463
464 static Flag::Error uintAt(const char* name, size_t len, uint* value, bool allow_locked = false, bool return_flag = false);
465 static Flag::Error uintAt(const char* name, uint* value, bool allow_locked = false, bool return_flag = false) { return uintAt(name, strlen(name), value, allow_locked, return_flag); }
466 static Flag::Error uintAtPut(const char* name, size_t len, uint* value, Flag::Flags origin);
467 static Flag::Error uintAtPut(const char* name, uint* value, Flag::Flags origin) { return uintAtPut(name, strlen(name), value, origin); }
468
469 static Flag::Error intxAt(const char* name, size_t len, intx* value, bool allow_locked = false, bool return_flag = false);
470 static Flag::Error intxAt(const char* name, intx* value, bool allow_locked = false, bool return_flag = false) { return intxAt(name, strlen(name), value, allow_locked, return_flag); }
471 static Flag::Error intxAtPut(const char* name, size_t len, intx* value, Flag::Flags origin);
472 static Flag::Error intxAtPut(const char* name, intx* value, Flag::Flags origin) { return intxAtPut(name, strlen(name), value, origin); }
488
489 static Flag::Error doubleAt(const char* name, size_t len, double* value, bool allow_locked = false, bool return_flag = false);
490 static Flag::Error doubleAt(const char* name, double* value, bool allow_locked = false, bool return_flag = false) { return doubleAt(name, strlen(name), value, allow_locked, return_flag); }
491 static Flag::Error doubleAtPut(const char* name, size_t len, double* value, Flag::Flags origin);
492 static Flag::Error doubleAtPut(const char* name, double* value, Flag::Flags origin) { return doubleAtPut(name, strlen(name), value, origin); }
493
494 static Flag::Error ccstrAt(const char* name, size_t len, ccstr* value, bool allow_locked = false, bool return_flag = false);
495 static Flag::Error ccstrAt(const char* name, ccstr* value, bool allow_locked = false, bool return_flag = false) { return ccstrAt(name, strlen(name), value, allow_locked, return_flag); }
496 // Contract: Flag will make private copy of the incoming value.
497 // Outgoing value is always malloc-ed, and caller MUST call free.
498 static Flag::Error ccstrAtPut(const char* name, size_t len, ccstr* value, Flag::Flags origin);
499 static Flag::Error ccstrAtPut(const char* name, ccstr* value, Flag::Flags origin) { return ccstrAtPut(name, strlen(name), value, origin); }
500
501 // Returns false if name is not a command line flag.
502 static bool wasSetOnCmdline(const char* name, bool* value);
503 static void printSetFlags(outputStream* out);
504
505 // printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges
506 static void printFlags(outputStream* out, bool withComments, bool printRanges = false);
507
508 static void verify() PRODUCT_RETURN;
509 };
510
511 // use this for flags that are true by default in the debug version but
512 // false in the optimized version, and vice versa
513 #ifdef ASSERT
514 #define trueInDebug true
515 #define falseInDebug false
516 #else
517 #define trueInDebug false
518 #define falseInDebug true
519 #endif
520
521 // use this for flags that are true per default in the product build
522 // but false in development builds, and vice versa
523 #ifdef PRODUCT
524 #define trueInProduct true
525 #define falseInProduct false
526 #else
527 #define trueInProduct false
616 "lp64_product means flag is always constant in 32 bit VM") \
617 \
618 notproduct(bool, CheckCompressedOops, true, \
619 "Generate checks in encoding/decoding code in debug VM") \
620 \
621 product_pd(size_t, HeapBaseMinAddress, \
622 "OS specific low limit for heap base address") \
623 \
624 product(uintx, HeapSearchSteps, 3 PPC64_ONLY(+17), \
625 "Heap allocation steps through preferred address regions to find" \
626 " where it can allocate the heap. Number of steps to take per " \
627 "region.") \
628 range(1, max_uintx) \
629 \
630 diagnostic(bool, PrintCompressedOopsMode, false, \
631 "Print compressed oops base address and encoding mode") \
632 \
633 lp64_product(intx, ObjectAlignmentInBytes, 8, \
634 "Default object alignment in bytes, 8 is minimum") \
635 range(8, 256) \
636 constraint(ObjectAlignmentInBytesConstraintFunc,AtParse) \
637 \
638 product(bool, AssumeMP, false, \
639 "Instruct the VM to assume multiple processors are available") \
640 \
641 /* UseMembar is theoretically a temp flag used for memory barrier */ \
642 /* removal testing. It was supposed to be removed before FCS but has */ \
643 /* been re-added (see 6401008) */ \
644 product_pd(bool, UseMembar, \
645 "(Unstable) Issues membars on thread state transitions") \
646 \
647 develop(bool, CleanChunkPoolAsync, falseInEmbedded, \
648 "Clean the chunk pool asynchronously") \
649 \
650 experimental(bool, AlwaysSafeConstructors, false, \
651 "Force safe construction, as if all fields are final.") \
652 \
653 /* Temporary: See 6948537 */ \
654 experimental(bool, UseMemSetInBOT, true, \
655 "(Unstable) uses memset in BOT updates in GC code") \
656 \
1372 \
1373 product(intx, FieldsAllocationStyle, 1, \
1374 "0 - type based with oops first, " \
1375 "1 - with oops last, " \
1376 "2 - oops in super and sub classes are together") \
1377 range(0, 2) \
1378 \
1379 product(bool, CompactFields, true, \
1380 "Allocate nonstatic fields in gaps between previous fields") \
1381 \
1382 notproduct(bool, PrintFieldLayout, false, \
1383 "Print field layout for each class") \
1384 \
1385 /* Need to limit the extent of the padding to reasonable size. */\
1386 /* 8K is well beyond the reasonable HW cache line size, even with */\
1387 /* aggressive prefetching, while still leaving the room for segregating */\
1388 /* among the distinct pages. */\
1389 product(intx, ContendedPaddingWidth, 128, \
1390 "How many bytes to pad the fields/classes marked @Contended with")\
1391 range(0, 8192) \
1392 constraint(ContendedPaddingWidthConstraintFunc,AtParse) \
1393 \
1394 product(bool, EnableContended, true, \
1395 "Enable @Contended annotation support") \
1396 \
1397 product(bool, RestrictContended, true, \
1398 "Restrict @Contended to trusted classes") \
1399 \
1400 product(bool, UseBiasedLocking, true, \
1401 "Enable biased locking in JVM") \
1402 \
1403 product(intx, BiasedLockingStartupDelay, 4000, \
1404 "Number of milliseconds to wait before enabling biased locking") \
1405 \
1406 diagnostic(bool, PrintBiasedLockingStatistics, false, \
1407 "Print statistics of biased locking in JVM") \
1408 \
1409 product(intx, BiasedLockingBulkRebiasThreshold, 20, \
1410 "Threshold of number of revocations per type to try to " \
1411 "rebias all objects in the heap of that type") \
1412 \
1573 "Size of heap (bytes) per GC thread used in calculating the " \
1574 "number of GC threads") \
1575 range((uintx)os::vm_page_size(), max_uintx) \
1576 \
1577 product(bool, TraceDynamicGCThreads, false, \
1578 "Trace the dynamic GC thread usage") \
1579 \
1580 develop(bool, ParallelOldGCSplitALot, false, \
1581 "Provoke splitting (copying data from a young gen space to " \
1582 "multiple destination spaces)") \
1583 \
1584 develop(uintx, ParallelOldGCSplitInterval, 3, \
1585 "How often to provoke splitting a young gen space") \
1586 range(0, max_uintx) \
1587 \
1588 product(uint, ConcGCThreads, 0, \
1589 "Number of threads concurrent gc will use") \
1590 \
1591 product(size_t, YoungPLABSize, 4096, \
1592 "Size of young gen promotion LAB's (in HeapWords)") \
1593 constraint(YoungPLABSizeConstraintFunc,AfterMemoryInit) \
1594 \
1595 product(size_t, OldPLABSize, 1024, \
1596 "Size of old gen promotion LAB's (in HeapWords), or Number \
1597 of blocks to attempt to claim when refilling CMS LAB's") \
1598 \
1599 product(uintx, GCTaskTimeStampEntries, 200, \
1600 "Number of time stamp entries per gc worker thread") \
1601 range(1, max_uintx) \
1602 \
1603 product(bool, AlwaysTenure, false, \
1604 "Always tenure objects in eden (ParallelGC only)") \
1605 \
1606 product(bool, NeverTenure, false, \
1607 "Never tenure objects in eden, may tenure on overflow " \
1608 "(ParallelGC only)") \
1609 \
1610 product(bool, ScavengeBeforeFullGC, true, \
1611 "Scavenge youngest generation before each full GC.") \
1612 \
1613 develop(bool, ScavengeWithObjectsInToSpace, false, \
1712 "Percentage (0-100) used to weight the current sample when " \
1713 "computing exponentially decaying average for resizing " \
1714 "OldPLABSize") \
1715 range(0, 100) \
1716 \
1717 product(bool, ResizeOldPLAB, true, \
1718 "Dynamically resize (old gen) promotion LAB's") \
1719 \
1720 product(bool, PrintOldPLAB, false, \
1721 "Print (old gen) promotion LAB's sizing decisions") \
1722 \
1723 product(size_t, CMSOldPLABMax, 1024, \
1724 "Maximum size of CMS gen promotion LAB caches per worker " \
1725 "per block size") \
1726 range(1, max_uintx) \
1727 \
1728 product(size_t, CMSOldPLABMin, 16, \
1729 "Minimum size of CMS gen promotion LAB caches per worker " \
1730 "per block size") \
1731 range(1, max_uintx) \
1732 constraint(CMSOldPLABMinConstraintFunc,AfterErgo) \
1733 \
1734 product(uintx, CMSOldPLABNumRefills, 4, \
1735 "Nominal number of refills of CMS gen promotion LAB cache " \
1736 "per worker per block size") \
1737 range(1, max_uintx) \
1738 \
1739 product(bool, CMSOldPLABResizeQuicker, false, \
1740 "React on-the-fly during a scavenge to a sudden " \
1741 "change in block demand rate") \
1742 \
1743 product(uintx, CMSOldPLABToleranceFactor, 4, \
1744 "The tolerance of the phase-change detector for on-the-fly " \
1745 "PLAB resizing during a scavenge") \
1746 range(1, max_uintx) \
1747 \
1748 product(uintx, CMSOldPLABReactivityFactor, 2, \
1749 "The gain in the feedback loop for on-the-fly PLAB resizing " \
1750 "during a scavenge") \
1751 \
1752 product(bool, AlwaysPreTouch, false, \
1908 \
1909 product(bool, CMSPrintEdenSurvivorChunks, false, \
1910 "Print the eden and the survivor chunks used for the parallel " \
1911 "initial mark or remark of the eden/survivor spaces") \
1912 \
1913 product(bool, CMSConcurrentMTEnabled, true, \
1914 "Whether multi-threaded concurrent work enabled " \
1915 "(effective only if ParNewGC)") \
1916 \
1917 product(bool, CMSPrecleaningEnabled, true, \
1918 "Whether concurrent precleaning enabled") \
1919 \
1920 product(uintx, CMSPrecleanIter, 3, \
1921 "Maximum number of precleaning iteration passes") \
1922 range(0, 9) \
1923 \
1924 product(uintx, CMSPrecleanDenominator, 3, \
1925 "CMSPrecleanNumerator:CMSPrecleanDenominator yields convergence " \
1926 "ratio") \
1927 range(1, max_uintx) \
1928 constraint(CMSPrecleanDenominatorConstraintFunc,AfterErgo) \
1929 \
1930 product(uintx, CMSPrecleanNumerator, 2, \
1931 "CMSPrecleanNumerator:CMSPrecleanDenominator yields convergence " \
1932 "ratio") \
1933 range(0, max_uintx-1) \
1934 constraint(CMSPrecleanNumeratorConstraintFunc,AfterErgo) \
1935 \
1936 product(bool, CMSPrecleanRefLists1, true, \
1937 "Preclean ref lists during (initial) preclean phase") \
1938 \
1939 product(bool, CMSPrecleanRefLists2, false, \
1940 "Preclean ref lists during abortable preclean phase") \
1941 \
1942 product(bool, CMSPrecleanSurvivors1, false, \
1943 "Preclean survivors during (initial) preclean phase") \
1944 \
1945 product(bool, CMSPrecleanSurvivors2, true, \
1946 "Preclean survivors during abortable preclean phase") \
1947 \
1948 product(uintx, CMSPrecleanThreshold, 1000, \
1949 "Do not iterate again if number of dirty cards is less than this")\
1950 range(100, max_uintx) \
1951 \
1952 product(bool, CMSCleanOnEnter, true, \
1953 "Clean-on-enter optimization for reducing number of dirty cards") \
1954 \
3338 product_pd(size_t, NewSizeThreadIncrease, \
3339 "Additional size added to desired new generation size per " \
3340 "non-daemon thread (in bytes)") \
3341 \
3342 product_pd(size_t, MetaspaceSize, \
3343 "Initial size of Metaspaces (in bytes)") \
3344 \
3345 product(size_t, MaxMetaspaceSize, max_uintx, \
3346 "Maximum size of Metaspaces (in bytes)") \
3347 \
3348 product(size_t, CompressedClassSpaceSize, 1*G, \
3349 "Maximum size of class area in Metaspace when compressed " \
3350 "class pointers are used") \
3351 range(1*M, 3*G) \
3352 \
3353 manageable(uintx, MinHeapFreeRatio, 40, \
3354 "The minimum percentage of heap free after GC to avoid expansion."\
3355 " For most GCs this applies to the old generation. In G1 and" \
3356 " ParallelGC it applies to the whole heap.") \
3357 range(0, 100) \
3358 constraint(MinHeapFreeRatioConstraintFunc,AfterErgo) \
3359 \
3360 manageable(uintx, MaxHeapFreeRatio, 70, \
3361 "The maximum percentage of heap free after GC to avoid shrinking."\
3362 " For most GCs this applies to the old generation. In G1 and" \
3363 " ParallelGC it applies to the whole heap.") \
3364 range(0, 100) \
3365 constraint(MaxHeapFreeRatioConstraintFunc,AfterErgo) \
3366 \
3367 product(intx, SoftRefLRUPolicyMSPerMB, 1000, \
3368 "Number of milliseconds per MB of free space in the heap") \
3369 \
3370 product(size_t, MinHeapDeltaBytes, ScaleForWordSize(128*K), \
3371 "The minimum change in heap space due to GC (in bytes)") \
3372 \
3373 product(size_t, MinMetaspaceExpansion, ScaleForWordSize(256*K), \
3374 "The minimum expansion of Metaspace (in bytes)") \
3375 \
3376 product(uintx, MaxMetaspaceFreeRatio, 70, \
3377 "The maximum percentage of Metaspace free after GC to avoid " \
3378 "shrinking") \
3379 range(0, 100) \
3380 constraint(MaxMetaspaceFreeRatioConstraintFunc,AfterErgo) \
3381 \
3382 product(uintx, MinMetaspaceFreeRatio, 40, \
3383 "The minimum percentage of Metaspace free after GC to avoid " \
3384 "expansion") \
3385 range(0, 99) \
3386 constraint(MinMetaspaceFreeRatioConstraintFunc,AfterErgo) \
3387 \
3388 product(size_t, MaxMetaspaceExpansion, ScaleForWordSize(4*M), \
3389 "The maximum expansion of Metaspace without full GC (in bytes)") \
3390 \
3391 product(uintx, QueuedAllocationWarningCount, 0, \
3392 "Number of times an allocation that queues behind a GC " \
3393 "will retry before printing a warning") \
3394 \
3395 diagnostic(uintx, VerifyGCStartAt, 0, \
3396 "GC invoke count where +VerifyBefore/AfterGC kicks in") \
3397 \
3398 diagnostic(intx, VerifyGCLevel, 0, \
3399 "Generation level at which to start +VerifyBefore/AfterGC") \
3400 \
3401 product(uintx, MaxTenuringThreshold, 15, \
3402 "Maximum value for tenuring threshold") \
3403 range(0, markOopDesc::max_age + 1) \
3404 constraint(MaxTenuringThresholdConstraintFunc,AfterErgo) \
3405 \
3406 product(uintx, InitialTenuringThreshold, 7, \
3407 "Initial value for tenuring threshold") \
3408 range(0, markOopDesc::max_age + 1) \
3409 constraint(InitialTenuringThresholdConstraintFunc,AfterErgo) \
3410 \
3411 product(uintx, TargetSurvivorRatio, 50, \
3412 "Desired percentage of survivor space used after scavenge") \
3413 range(0, 100) \
3414 \
3415 product(uintx, MarkSweepDeadRatio, 5, \
3416 "Percentage (0-100) of the old gen allowed as dead wood. " \
3417 "Serial mark sweep treats this as both the minimum and maximum " \
3418 "value. " \
3419 "CMS uses this value only if it falls back to mark sweep. " \
3420 "Par compact uses a variable scale based on the density of the " \
3421 "generation and treats this as the maximum value when the heap " \
3422 "is either completely full or completely empty. Par compact " \
3423 "also has a smaller default value; see arguments.cpp.") \
3424 range(0, 100) \
3425 \
3426 product(uintx, MarkSweepAlwaysCompactCount, 4, \
3427 "How often should we fully compact the heap (ignoring the dead " \
3428 "space parameters)") \
3429 range(1, max_uintx) \
4067 "to be considered for deduplication") \
4068 range(1, markOopDesc::max_age) \
4069 \
4070 diagnostic(bool, StringDeduplicationResizeALot, false, \
4071 "Force table resize every time the table is scanned") \
4072 \
4073 diagnostic(bool, StringDeduplicationRehashALot, false, \
4074 "Force table rehash every time the table is scanned") \
4075 \
4076 develop(bool, TraceDefaultMethods, false, \
4077 "Trace the default method processing steps") \
4078 \
4079 diagnostic(bool, WhiteBoxAPI, false, \
4080 "Enable internal testing APIs") \
4081 \
4082 product(bool, PrintGCCause, true, \
4083 "Include GC cause in GC logging") \
4084 \
4085 experimental(intx, SurvivorAlignmentInBytes, 0, \
4086 "Default survivor space alignment in bytes") \
4087 constraint(SurvivorAlignmentInBytesConstraintFunc,AfterErgo) \
4088 \
4089 product(bool , AllowNonVirtualCalls, false, \
4090 "Obey the ACC_SUPER flag and allow invokenonvirtual calls") \
4091 \
4092 product(ccstr, DumpLoadedClassList, NULL, \
4093 "Dump the names all loaded classes, that could be stored into " \
4094 "the CDS archive, in the specified file") \
4095 \
4096 product(ccstr, SharedClassListFile, NULL, \
4097 "Override the default CDS class list") \
4098 \
4099 diagnostic(ccstr, SharedArchiveFile, NULL, \
4100 "Override the default location of the CDS archive file") \
4101 \
4102 product(ccstr, ExtraSharedClassListFile, NULL, \
4103 "Extra classlist for building the CDS archive file") \
4104 \
4105 experimental(size_t, ArrayAllocatorMallocLimit, \
4106 SOLARIS_ONLY(64*K) NOT_SOLARIS((size_t)-1), \
4107 "Allocation less than this value will be allocated " \
4167 #define MATERIALIZE_MANAGEABLE_FLAG(type, name, value, doc) type name = value;
4168 #define MATERIALIZE_PRODUCT_RW_FLAG(type, name, value, doc) type name = value;
4169 #ifdef PRODUCT
4170 #define MATERIALIZE_DEVELOPER_FLAG(type, name, value, doc) type CONST_##name = value;
4171 #define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, doc) type CONST_##name = pd_##name;
4172 #define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, doc) type CONST_##name = value;
4173 #else
4174 #define MATERIALIZE_DEVELOPER_FLAG(type, name, value, doc) type name = value;
4175 #define MATERIALIZE_PD_DEVELOPER_FLAG(type, name, doc) type name = pd_##name;
4176 #define MATERIALIZE_NOTPRODUCT_FLAG(type, name, value, doc) type name = value;
4177 #endif // PRODUCT
4178 #ifdef _LP64
4179 #define MATERIALIZE_LP64_PRODUCT_FLAG(type, name, value, doc) type name = value;
4180 #else
4181 #define MATERIALIZE_LP64_PRODUCT_FLAG(type, name, value, doc) /* flag is constant */
4182 #endif // _LP64
4183
4184 // Only materialize src code for range checking when required, ignore otherwise
4185 #define IGNORE_RANGE(a, b)
4186 // Only materialize src code for contraint checking when required, ignore otherwise
4187 #define IGNORE_CONSTRAINT(func,type)
4188
4189 RUNTIME_FLAGS(DECLARE_DEVELOPER_FLAG, \
4190 DECLARE_PD_DEVELOPER_FLAG, \
4191 DECLARE_PRODUCT_FLAG, \
4192 DECLARE_PD_PRODUCT_FLAG, \
4193 DECLARE_DIAGNOSTIC_FLAG, \
4194 DECLARE_EXPERIMENTAL_FLAG, \
4195 DECLARE_NOTPRODUCT_FLAG, \
4196 DECLARE_MANAGEABLE_FLAG, \
4197 DECLARE_PRODUCT_RW_FLAG, \
4198 DECLARE_LP64_PRODUCT_FLAG, \
4199 IGNORE_RANGE, \
4200 IGNORE_CONSTRAINT)
4201
4202 RUNTIME_OS_FLAGS(DECLARE_DEVELOPER_FLAG, \
4203 DECLARE_PD_DEVELOPER_FLAG, \
4204 DECLARE_PRODUCT_FLAG, \
4205 DECLARE_PD_PRODUCT_FLAG, \
4206 DECLARE_DIAGNOSTIC_FLAG, \
4207 DECLARE_NOTPRODUCT_FLAG, \
|