Path: blob/master/runtime/gc_modron_startup/mmparseXgc.cpp
5986 views
1/*******************************************************************************2* Copyright (c) 1991, 2021 IBM Corp. and others3*4* This program and the accompanying materials are made available under5* the terms of the Eclipse Public License 2.0 which accompanies this6* 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 and8* is available at https://www.apache.org/licenses/LICENSE-2.0.9*10* This Source Code may also be made available under the following11* Secondary Licenses when the conditions for such availability set12* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU13* General Public License, version 2 with the GNU Classpath14* Exception [1] and GNU General Public License, version 2 with the15* OpenJDK Assembly Exception [2].16*17* [1] https://www.gnu.org/software/classpath/license.html18* [2] http://openjdk.java.net/legal/assembly-exception.html19*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-exception21*******************************************************************************/2223/**24* @file25* @ingroup GC_Modron_Startup26*/2728static const char *versionString = "Modron $Name: not supported by cvs2svn $";2930#include "j9.h"31#include "j9cfg.h"32#include "j9protos.h"33#include "j9consts.h"34#include "jni.h"35#include "jvminit.h"36#include "j9port.h"37#include "modronnls.h"38#include "gcutils.h"3940#include "mmparse.h"4142#include "GCExtensions.hpp"43#include "Math.hpp"4445/**46* Consume arguments found in the -Xgc: (gc_colon) argument list.47* @params scan_start address of the pointer to the string to parse48* @return 0 if there was an error parsing49* @return 1 if parsing was successful50* @return 2 if the option was not handled51*/52static UDATA53j9gc_initialize_parse_gc_colon(J9JavaVM *javaVM, char **scan_start)54{55MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(javaVM);56PORT_ACCESS_FROM_JAVAVM(javaVM);5758#if defined(J9VM_GC_THREAD_LOCAL_HEAP)59if(try_scan(scan_start, "tlhInitialSize=")) {60if(!scan_udata_helper(javaVM, scan_start, &extensions->tlhInitialSize, "tlhInitialSize=")) {61goto _error;62}63goto _exit;64}65if(try_scan(scan_start, "tlhMinimumSize=")) {66if(!scan_udata_helper(javaVM, scan_start, &extensions->tlhMinimumSize, "tlhMinimumSize=")) {67goto _error;68}69goto _exit;70}71if(try_scan(scan_start, "tlhMaximumSize=")) {72if(!scan_udata_helper(javaVM, scan_start, &extensions->tlhMaximumSize, "tlhMaximumSize=")) {73goto _error;74}75goto _exit;76}77if(try_scan(scan_start, "tlhIncrementSize=")) {78if(!scan_udata_helper(javaVM, scan_start, &extensions->tlhIncrementSize, "tlhIncrementSize=")) {79goto _error;80}81goto _exit;82}83if(try_scan(scan_start, "tlhSurvivorDiscardThreshold=")) {84if(!scan_udata_helper(javaVM, scan_start, &extensions->tlhSurvivorDiscardThreshold, "tlhSurvivorDiscardThreshold=")) {85goto _error;86}87goto _exit;88}89if(try_scan(scan_start, "tlhTenureDiscardThreshold=")) {90if(!scan_udata_helper(javaVM, scan_start, &extensions->tlhTenureDiscardThreshold, "tlhTenureDiscardThreshold=")) {91goto _error;92}93goto _exit;94}9596#endif /* defined(J9VM_GC_THREAD_LOCAL_HEAP) */97#if defined(J9VM_GC_SEGREGATED_HEAP)98if(try_scan(scan_start, "allocationCacheMinimumSize=")) {99if(!scan_udata_helper(javaVM, scan_start, &extensions->allocationCacheMinimumSize, "allocationCacheMinimumSize=")) {100goto _error;101}102goto _exit;103}104if(try_scan(scan_start, "allocationCacheMaximumSize=")) {105if(!scan_udata_helper(javaVM, scan_start, &extensions->allocationCacheMaximumSize, "allocationCacheMaximumSize=")) {106goto _error;107}108goto _exit;109}110if(try_scan(scan_start, "allocationCacheInitialSize=")) {111if(!scan_udata_helper(javaVM, scan_start, &extensions->allocationCacheInitialSize, "allocationCacheInitialSize=")) {112goto _error;113}114goto _exit;115}116if(try_scan(scan_start, "allocationCacheIncrementSize=")) {117if(!scan_udata_helper(javaVM, scan_start, &extensions->allocationCacheIncrementSize, "allocationCacheMaximumSize=")) {118goto _error;119}120goto _exit;121}122#endif /* defined(J9VM_GC_SEGREGATED_HEAP) */123124125#if defined(J9VM_GC_REALTIME)126if (try_scan(scan_start, "synchronousGCOnOOM")) {127extensions->synchronousGCOnOOM = true;128goto _exit;129}130131if (try_scan(scan_start, "noSynchronousGCOnOOM")) {132extensions->synchronousGCOnOOM = false;133goto _exit;134}135if (try_scan(scan_start, "targetUtilization=")) {136if(!scan_udata_helper(javaVM, scan_start, &(extensions->targetUtilizationPercentage), "targetUtilization=")) {137goto _error;138}139if ((extensions->targetUtilizationPercentage < 1) || (99 < extensions->targetUtilizationPercentage)) {140j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "targetUtilization=", (UDATA)1, (UDATA)99);141goto _error;142}143goto _exit;144}145if (try_scan(scan_start, "threads=")) {146if(!scan_udata_helper(javaVM, scan_start, &(extensions->gcThreadCount), "threads=")) {147goto _error;148}149150if(0 == extensions->gcThreadCount) {151j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_VALUE_MUST_BE_ABOVE, "threads=", (UDATA)0);152goto _error;153}154155extensions->gcThreadCountForced = true;156goto _exit;157}158if(try_scan(scan_start, "noClassGC")) {159/* Metronome currently does not unload classes */160/* We do not care if this option is set or not, but if it is, it is just silently parsed */161goto _exit;162}163164if (try_scan(scan_start, "overrideHiresTimerCheck")) {165extensions->overrideHiresTimerCheck = true;166goto _exit;167}168169#endif /* J9VM_GC_REALTIME */170171#if defined(J9VM_GC_REALTIME)|| defined(J9VM_GC_VLHGC)172if (try_scan(scan_start, "targetPausetime=")) {173/* the unit of target pause time option is in milliseconds */174UDATA beatMilli = 0;175if(!scan_udata_helper(javaVM, scan_start, &beatMilli, "targetPausetime=")) {176goto _error;177}178if(0 == beatMilli) {179j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_VALUE_MUST_BE_ABOVE, "targetPausetime=", (UDATA)0);180goto _error;181}182183#if defined(J9VM_GC_REALTIME)184/* convert the unit to microseconds and store in extensions */185extensions->beatMicro = beatMilli * 1000;186#endif /* J9VM_GC_REALTIME */187188#if defined(J9VM_GC_VLHGC)189/* Save soft pause target for balanced */190extensions->tarokTargetMaxPauseTime = beatMilli;191#endif /* J9VM_GC_VLHGC */192193goto _exit;194}195#endif /* J9VM_GC_REALTIME || J9VM_GC_VLHGC */196197//todo temporary option to allow LOA to be enabled for testing with non-default gc policies198//Remove once LOA code stable199#if defined(J9VM_GC_LARGE_OBJECT_AREA)200201if(try_scan(scan_start, "largeObjectMinimumSize=")) {202UDATA value;203if(!scan_udata_helper(javaVM, scan_start, &value, "largeObjectMinimumSize=")) {204goto _error;205}206207extensions->largeObjectMinimumSize = MM_Math::roundToCeiling(extensions->heapAlignment, value);208209goto _exit;210}211212if(try_scan(scan_start, "debugLOAFreelist")) {213extensions->debugLOAFreelist = true;214goto _exit;215}216217if(try_scan(scan_start, "debugLOAAllocate")) {218extensions->debugLOAAllocate = true;219goto _exit;220}221222#endif /* J9VM_GC_LARGE_OBJECT_AREA) */223224225if(try_scan(scan_start, "threadCount=")) {226if(!scan_udata_helper(javaVM, scan_start, &extensions->gcThreadCount, "threadCount=")) {227goto _error;228}229230if(0 == extensions->gcThreadCount) {231j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_VALUE_MUST_BE_ABOVE, "threadCount=", (UDATA)0);232goto _error;233}234235extensions->gcThreadCountForced = true;236goto _exit;237}238239if (try_scan(scan_start, "snapshotAtTheBeginningBarrier")) {240extensions->configurationOptions._forceOptionWriteBarrierSATB = true;241goto _exit;242}243244#if defined(J9VM_GC_MODRON_SCAVENGER)245246if(try_scan(scan_start, "tenureBytesDeviationBoost=")) {247UDATA value;248if(!scan_udata_helper(javaVM, scan_start, &value, "tenureBytesDeviationBoost=")) {249goto _error;250}251252extensions->tenureBytesDeviationBoost = value / (float)10.0;253goto _exit;254}255256if(try_scan(scan_start, "scavenge")) {257extensions->configurationOptions._forceOptionScavenge = true;258extensions->scavengerEnabled = true;259goto _exit;260}261262if(try_scan(scan_start, "noScavenge")) {263extensions->configurationOptions._forceOptionScavenge = true;264extensions->scavengerEnabled = false;265goto _exit;266}267268if(try_scan(scan_start, "concurrentKickoffTenuringHeadroom=")) {269UDATA value = 0;270if(!scan_udata_helper(javaVM, scan_start, &value, "concurrentKickoffTenuringHeadroom=")) {271goto _error;272}273if(value > 100) {274j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "concurrentKickoffTenuringHeadroom=", (UDATA)0, (UDATA)100);275goto _error;276}277extensions->concurrentKickoffTenuringHeadroom = ((float)value) / 100.0f;278goto _exit;279}280281282#if defined(OMR_GC_CONCURRENT_SCAVENGER)283/* Parsing of concurrentScavengeBackground/Slack must happen before concurrentScavenge, since the later option is a substring of the former(s).284* However, there is no effective limitation on relative order of these options in a command line. */285if(try_scan(scan_start, "concurrentScavengeSlack=")) {286if(!scan_udata_helper(javaVM, scan_start, &extensions->concurrentScavengerSlack, "concurrentScavengeSlack=")) {287goto _error;288}289goto _exit;290}291292if(try_scan(scan_start, "concurrentScavengeAllocDeviationBoost=")) {293UDATA value;294if(!scan_udata_helper(javaVM, scan_start, &value, "concurrentScavengeAllocDeviationBoost=")) {295goto _error;296}297298extensions->concurrentScavengerAllocDeviationBoost = value / (float)10.0;299goto _exit;300}301302if(try_scan(scan_start, "concurrentScavengeBackground=")) {303if(!scan_udata_helper(javaVM, scan_start, &extensions->concurrentScavengerBackgroundThreads, "concurrentScavengeBackground=")) {304goto _error;305}306extensions->concurrentScavengerBackgroundThreadsForced = true;307goto _exit;308}309/* Must be parsed after concurrentScavengeBackground/Slack. */310if(try_scan(scan_start, "concurrentScavenge")) {311extensions->concurrentScavengerForced = true;312goto _exit;313}314315if(try_scan(scan_start, "noConcurrentScavenge")) {316extensions->concurrentScavengerForced = false;317goto _exit;318}319#endif /* OMR_GC_CONCURRENT_SCAVENGER */320321if(try_scan(scan_start, "failedTenureThreshold=")) {322if(!scan_udata_helper(javaVM, scan_start, &extensions->scavengerFailedTenureThreshold, "failedTenureThreshold=")) {323goto _error;324}325goto _exit;326}327328if(try_scan(scan_start, "maxScavengeBeforeGlobal=")) {329if(!scan_udata_helper(javaVM, scan_start, &extensions->maxScavengeBeforeGlobal, "maxScavengeBeforeGlobal=")) {330goto _error;331}332goto _exit;333}334335if(try_scan(scan_start, "scvCollectorExpandRatio=")) {336UDATA value;337if(!scan_udata_helper(javaVM, scan_start, &value, "scvCollectorExpandRatio=")) {338goto _error;339}340if((0 == value) || (100 < value)) {341j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "scvCollectorExpandRatio=", (UDATA)1, (UDATA)100);342}343344extensions->scavengerCollectorExpandRatio = value / (double)100.0;345goto _exit;346}347348if(try_scan(scan_start, "scvMaximumCollectorExpandSize=")) {349UDATA value;350if(!scan_udata_helper(javaVM, scan_start, &value, "scvMaximumCollectorExpandSize=")) {351goto _error;352}353354extensions->scavengerMaximumCollectorExpandSize = MM_Math::roundToCeiling(extensions->heapAlignment, value);355goto _exit;356}357358if (try_scan(scan_start, "scvTenureStrategy=")) {359/* Reset all tenure strategies because we will be setting them explicitly now. */360extensions->scvTenureStrategyFixed = false;361extensions->scvTenureStrategyAdaptive = false;362extensions->scvTenureStrategyLookback = false;363extensions->scvTenureStrategyHistory = false;364365/* Scan all desired tenure strategies. */366do {367if (try_scan(scan_start, "fixed")) {368extensions->scvTenureStrategyFixed = true;369} else if (try_scan(scan_start, "adaptive")) {370extensions->scvTenureStrategyAdaptive = true;371} else if (try_scan(scan_start, "lookback")) {372extensions->scvTenureStrategyLookback = true;373} else if (try_scan(scan_start, "history")) {374extensions->scvTenureStrategyHistory = true;375} else {376/* TODO: Add NLS error message once message promotes through VM silo. */377goto _error;378}379} while (try_scan(scan_start, "+"));380goto _exit;381}382383if(try_scan(scan_start, "scvTenureSurvivalThreshold=")) {384UDATA value;385if(!scan_udata_helper(javaVM, scan_start, &value, "scvTenureSurvivalThreshold=")) {386goto _error;387}388if(value > 100) {389j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "scvTenureSurvivalThreshold=", (UDATA)0, (UDATA)100);390goto _error;391}392extensions->scvTenureStrategySurvivalThreshold = ((double)value) / 100.0;393goto _exit;394}395396#if defined(J9VM_GC_ADAPTIVE_TENURING)397if(try_scan(scan_start, "adaptiveTenure")) {398extensions->scvTenureStrategyAdaptive = true;399goto _exit;400}401402if(try_scan(scan_start, "noAdaptiveTenure")) {403extensions->scvTenureStrategyFixed = true;404extensions->scvTenureStrategyAdaptive = false;405extensions->scvTenureStrategyLookback = false;406extensions->scvTenureStrategyHistory = false;407goto _exit;408}409410if(try_scan(scan_start, "tenureAge=")) {411UDATA tenureAge = 0;412if(!scan_udata_helper(javaVM, scan_start, &tenureAge, "tenureAge=")) {413goto _error;414}415if((tenureAge > OBJECT_HEADER_AGE_MAX) || (tenureAge < OBJECT_HEADER_AGE_MIN)) {416j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "tenureAge=", (UDATA)OBJECT_HEADER_AGE_MIN, (UDATA)OBJECT_HEADER_AGE_MAX);417goto _error;418}419extensions->scvTenureAdaptiveTenureAge = tenureAge;420extensions->scvTenureFixedTenureAge = tenureAge;421goto _exit;422}423424if(try_scan(scan_start, "scvNoAdaptiveTenure")) {425extensions->scvTenureStrategyFixed = true;426extensions->scvTenureStrategyAdaptive = false;427extensions->scvTenureStrategyLookback = false;428extensions->scvTenureStrategyHistory = false;429goto _exit;430}431432if(try_scan(scan_start, "scvTenureAge=")) {433UDATA tenureAge = 0;434if(!scan_udata_helper(javaVM, scan_start, &tenureAge, "scvTenureAge=")) {435goto _error;436}437if((tenureAge > OBJECT_HEADER_AGE_MAX) || (tenureAge < OBJECT_HEADER_AGE_MIN)) {438j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "scvTenureAge=", (UDATA)OBJECT_HEADER_AGE_MIN, (UDATA)OBJECT_HEADER_AGE_MAX);439goto _error;440}441extensions->scvTenureAdaptiveTenureAge = tenureAge;442extensions->scvTenureFixedTenureAge = tenureAge;443goto _exit;444}445446if(try_scan(scan_start, "scvAdaptiveTenureAge=")) {447UDATA adaptiveTenureAge = 0;448if(!scan_udata_helper(javaVM, scan_start, &adaptiveTenureAge, "scvAdaptiveTenureAge=")) {449goto _error;450}451if((adaptiveTenureAge > OBJECT_HEADER_AGE_MAX) || (adaptiveTenureAge < OBJECT_HEADER_AGE_MIN)) {452j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "scvAdaptiveTenureAge=", (UDATA)OBJECT_HEADER_AGE_MIN, (UDATA)OBJECT_HEADER_AGE_MAX);453goto _error;454}455extensions->scvTenureAdaptiveTenureAge = adaptiveTenureAge;456goto _exit;457}458459if(try_scan(scan_start, "scvFixedTenureAge=")) {460UDATA fixedTenureAge = 0;461if(!scan_udata_helper(javaVM, scan_start, &fixedTenureAge, "scvFixedTenureAge=")) {462goto _error;463}464if((fixedTenureAge > OBJECT_HEADER_AGE_MAX) || (fixedTenureAge < OBJECT_HEADER_AGE_MIN)) {465j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "scvFixedTenureAge=", (UDATA)OBJECT_HEADER_AGE_MIN, (UDATA)OBJECT_HEADER_AGE_MAX);466goto _error;467}468extensions->scvTenureFixedTenureAge = fixedTenureAge;469goto _exit;470}471472if(try_scan(scan_start, "scvth=")) {473if(!scan_udata_helper(javaVM, scan_start, &extensions->scvTenureRatioHigh, "scvth=")) {474goto _error;475}476if(extensions->scvTenureRatioHigh > 100) {477j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "scvth=", (UDATA)0, (UDATA)100);478goto _error;479}480goto _exit;481}482if(try_scan(scan_start, "scvtl=")) {483if(!scan_udata_helper(javaVM, scan_start, &extensions->scvTenureRatioLow, "scvtl=")) {484goto _error;485}486if(extensions->scvTenureRatioLow > 100) {487j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "scvtl=", (UDATA)0, (UDATA)100);488goto _error;489}490goto _exit;491}492#endif /* J9VM_GC_ADAPTIVE_TENURING */493494#if defined(J9VM_GC_TILTED_NEW_SPACE)495/* NOTE: the tilt ratio is specified as the percentage used by new space. This is consistent496* with what's printed in -verbose:gc and is intuitive. However we store these ratios internally497* as the percentage of survivor space. So a specified value of 30 is stored as 70.498*/499if(try_scan(scan_start, "scvTiltRatioMax=")) {500UDATA value;501if(!scan_udata_helper(javaVM, scan_start, &value, "scvTiltRatioMax=")) {502goto _error;503}504if((50 > value) || (90 < value)) {505j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "scvTiltRatioMax=", (UDATA)50, (UDATA)90);506}507508extensions->survivorSpaceMinimumSizeRatio = (100 - value) / (double)100.0;509goto _exit;510}511if(try_scan(scan_start, "scvTiltRatioMin=")) {512UDATA value;513if(!scan_udata_helper(javaVM, scan_start, &value, "scvTiltRatioMin=")) {514goto _error;515}516if((50 > value) || (90 < value)) {517j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "scvTiltRatioMin=", (UDATA)50, (UDATA)90);518}519520extensions->survivorSpaceMaximumSizeRatio = (100 - value) / (double)100.0;521goto _exit;522}523if(try_scan(scan_start, "scvTiltIncreaseMax=")) {524UDATA value;525if(!scan_udata_helper(javaVM, scan_start, &value, "scvTiltIncreaseMax=")) {526goto _error;527}528if(0 == value) {529j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_VALUE_MUST_BE_ABOVE, "scvTiltIncreaseMax=", (UDATA)0);530goto _error;531}532533extensions->tiltedScavengeMaximumIncrease = value / (double)100.0;534goto _exit;535}536if(try_scan(scan_start, "scvDebugTiltedNursery")) {537extensions->debugTiltedScavenge = true;538goto _exit;539}540if(try_scan(scan_start, "scvTiltedNursery")) {541extensions->tiltedScavenge = true;542goto _exit;543}544if(try_scan(scan_start, "scvNoTiltedNursery")) {545extensions->tiltedScavenge = false;546goto _exit;547}548#endif /* J9VM_GC_TILTED_NEW_SPACE */549550551if(try_scan(scan_start, "noHeapExpansionAfterExpansionGCCount=")) {552UDATA value;553if(!scan_udata_helper(javaVM, scan_start, &value, "noHeapExpansionAfterExpansionGCCount=")) {554goto _error;555}556extensions->heapExpansionStabilizationCount = value;557goto _exit;558}559560if(try_scan(scan_start, "noHeapContractionAfterExpansionGCCount=")) {561UDATA value;562if(!scan_udata_helper(javaVM, scan_start, &value, "noHeapContractionAfterExpansionGCCount=")) {563goto _error;564}565extensions->heapContractionStabilizationCount = value;566goto _exit;567}568569if(try_scan(scan_start, "ignoreHeapStatsAfterHeapExpansion")) {570/* this is the same as setting these options to 3 -- the size of the heap stats */571extensions->heapExpansionStabilizationCount = 3;572extensions->heapContractionStabilizationCount = 3;573goto _exit;574}575576#if defined(J9VM_GC_DYNAMIC_NEW_SPACE_SIZING)577if(try_scan(scan_start, "dynamicNewSpaceSizing")) {578extensions->dynamicNewSpaceSizing = true;579goto _exit;580}581582if(try_scan(scan_start, "noDynamicNewSpaceSizing")) {583extensions->dynamicNewSpaceSizing = false;584goto _exit;585}586587if(try_scan(scan_start, "debugDynamicNewSpaceSizing")) {588extensions->debugDynamicNewSpaceSizing = true;589goto _exit;590}591592/* VMDESIGN 1690: (default) hint to try to avoid moving objects during dynamic new space resizing */593if(try_scan(scan_start, "dnssAvoidMovingObjects")) {594extensions->dnssAvoidMovingObjects = true;595goto _exit;596}597598/* VMDESIGN 1690: use pre-Java 6 new space resizing policy */599if(try_scan(scan_start, "dnssNoAvoidMovingObjects")) {600extensions->dnssAvoidMovingObjects = false;601goto _exit;602}603604if(try_scan(scan_start, "dnssMaximumContraction=")) {605UDATA value;606if(!scan_udata_helper(javaVM, scan_start, &value, "dnssMaximumContraction=")) {607goto _error;608}609if(value > 100) {610j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "dnssMaximumContraction=", (UDATA)0, (UDATA)100);611goto _error;612}613extensions->dnssMaximumContraction = ((double)value) / ((double)100);614goto _exit;615}616617if(try_scan(scan_start, "dnssMaximumExpansion=")) {618UDATA value;619if(!scan_udata_helper(javaVM, scan_start, &value, "dnssMaximumExpansion=")) {620goto _error;621}622if(value > 100) {623j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "dnssMaximumExpansion=", (UDATA)0, (UDATA)100);624goto _error;625}626extensions->dnssMaximumExpansion = ((double)value) / ((double)100);627goto _exit;628}629630if(try_scan(scan_start, "dnssMinimumContraction=")) {631UDATA value;632if(!scan_udata_helper(javaVM, scan_start, &value, "dnssMinimumContraction=")) {633goto _error;634}635if(value > 100) {636j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "dnssMinimumContraction=", (UDATA)0, (UDATA)100);637goto _error;638}639extensions->dnssMinimumContraction = ((double)value) / ((double)100);640goto _exit;641}642643if(try_scan(scan_start, "loaFreeHistorySize=")) {644UDATA value;645if(!scan_udata_helper(javaVM, scan_start, &value, "loaFreeHistorySize=")) {646goto _error;647}648if(value > 100) {649j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "loaFreeHistorySize=", (UDATA)0, (UDATA)100);650goto _error;651}652extensions->loaFreeHistorySize = ((int)value);653goto _exit;654}655656if(try_scan(scan_start, "dnssMinimumExpansion=")) {657UDATA value;658if(!scan_udata_helper(javaVM, scan_start, &value, "dnssMinimumExpansion=")) {659goto _error;660}661if(value > 100) {662j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "dnssMinimumExpansion=", (UDATA)0, (UDATA)100);663goto _error;664}665extensions->dnssMinimumExpansion = ((double)value) / ((double)100);666goto _exit;667}668669if(try_scan(scan_start, "dnssExpectedTimeRatioMinimum=")) {670UDATA value;671if(!scan_udata_helper(javaVM, scan_start, &value, "dnssExpectedTimeRatioMinimum=")) {672goto _error;673}674if(value > 100) {675j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "dnssExpectedTimeRatioMinimum=", (UDATA)0, (UDATA)100);676goto _error;677}678extensions->dnssExpectedRatioMinimum._wasSpecified = true;679extensions->dnssExpectedRatioMinimum._valueSpecified = ((double)value) / ((double)100);680goto _exit;681}682683if(try_scan(scan_start, "dnssExpectedTimeRatioMaximum=")) {684UDATA value;685if(!scan_udata_helper(javaVM, scan_start, &value, "dnssExpectedTimeRatioMaximum=")) {686goto _error;687}688if(value > 100) {689j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "dnssExpectedTimeRatioMaximum=", (UDATA)0, (UDATA)100);690goto _error;691}692extensions->dnssExpectedRatioMaximum._wasSpecified = true;693extensions->dnssExpectedRatioMaximum._valueSpecified = ((double)value) / ((double)100);694goto _exit;695}696697if(try_scan(scan_start, "dnssWeightedTimeRatioFactorIncreaseSmall=")) {698UDATA value;699if(!scan_udata_helper(javaVM, scan_start, &value, "dnssWeightedTimeRatioFactorIncreaseSmall=")) {700goto _error;701}702if(value > 100) {703j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "dnssWeightedTimeRatioFactorIncreaseSmall=", (UDATA)0, (UDATA)100);704goto _error;705}706extensions->dnssWeightedTimeRatioFactorIncreaseSmall = ((double)value) / ((double)100);707goto _exit;708}709710if(try_scan(scan_start, "dnssWeightedTimeRatioFactorIncreaseMedium=")) {711UDATA value;712if(!scan_udata_helper(javaVM, scan_start, &value, "dnssWeightedTimeRatioFactorIncreaseMedium=")) {713goto _error;714}715if(value > 100) {716j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "dnssWeightedTimeRatioFactorIncreaseMedium=", (UDATA)0, (UDATA)100);717goto _error;718}719extensions->dnssWeightedTimeRatioFactorIncreaseMedium = ((double)value) / ((double)100);720goto _exit;721}722723if(try_scan(scan_start, "dnssWeightedTimeRatioFactorIncreaseLarge=")) {724UDATA value;725if(!scan_udata_helper(javaVM, scan_start, &value, "dnssWeightedTimeRatioFactorIncreaseLarge=")) {726goto _error;727}728if(value > 100) {729j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "dnssWeightedTimeRatioFactorIncreaseLarge=", (UDATA)0, (UDATA)100);730goto _error;731}732extensions->dnssWeightedTimeRatioFactorIncreaseLarge = ((double)value) / ((double)100);733goto _exit;734}735736if(try_scan(scan_start, "dnssWeightedTimeRatioFactorDecrease=")) {737UDATA value;738if(!scan_udata_helper(javaVM, scan_start, &value, "dnssWeightedTimeRatioFactorDecrease=")) {739goto _error;740}741if(value > 100) {742j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "dnssWeightedTimeRatioFactorDecrease=", (UDATA)0, (UDATA)100);743goto _error;744}745extensions->dnssWeightedTimeRatioFactorDecrease = ((double)value) / ((double)100);746goto _exit;747}748749#endif /* J9VM_GC_DYNAMIC_NEW_SPACE_SIZING */750#endif /* J9VM_GC_MODRON_SCAVENGER */751752if(try_scan(scan_start, "globalMaximumContraction=")) {753UDATA value;754if(!scan_udata_helper(javaVM, scan_start, &value, "globalMaximumContraction=")) {755goto _error;756}757if(value > 100) {758j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "globalMaximumContraction=", (UDATA)0, (UDATA)100);759goto _error;760}761extensions->globalMaximumContraction = ((double)value) / ((double)100);762goto _exit;763}764765if(try_scan(scan_start, "globalMinimumContraction=")) {766UDATA value;767if(!scan_udata_helper(javaVM, scan_start, &value, "globalMinimumContraction=")) {768goto _error;769}770if(value > 100) {771j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "globalMinimumContraction=", (UDATA)0, (UDATA)100);772goto _error;773}774extensions->globalMinimumContraction = ((double)value) / ((double)100);775goto _exit;776}777778/* Alternate option to set globalMaximumContraction */779if(try_scan(scan_start, "maxContractPercent=")) {780UDATA value;781if(!scan_udata_helper(javaVM, scan_start, &value, "maxContractPercent=")) {782goto _error;783}784if(value > 100) {785j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "maxContractPercent=", (UDATA)0, (UDATA)100);786goto _error;787}788extensions->globalMaximumContraction = ((double)value) / ((double)100);789goto _exit;790}791792/* Alternate option to set globalMinimumContraction */793if(try_scan(scan_start, "minContractPercent=")) {794UDATA value;795if(!scan_udata_helper(javaVM, scan_start, &value, "minContractPercent=")) {796goto _error;797}798if(value > 100) {799j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "minContractPercent=", (UDATA)0, (UDATA)100);800goto _error;801}802extensions->globalMinimumContraction = ((double)value) / ((double)100);803goto _exit;804}805806if(try_scan(scan_start, "excessiveGCdebug")) {807j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTION_DEPRECATED, "-Xgc:excessiveGCdebug=", "-Xtgc:excessivegc");808goto _error;809}810811if(try_scan(scan_start, "excessiveGCratio=")) {812UDATA value;813if(!scan_udata_helper(javaVM, scan_start, &value, "excessiveGCratio=")) {814goto _error;815}816if((value > 100) || (value < 10)) {817j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "excessiveGCratio=", (UDATA)10, (UDATA)100);818goto _error;819}820extensions->excessiveGCratio = value;821goto _exit;822}823824if(try_scan(scan_start, "excessiveGCFreeSizeRatio=")) {825UDATA value;826if(!scan_udata_helper(javaVM, scan_start, &value, "excessiveGCFreeSizeRatio=")) {827goto _error;828}829if(value > 100) {830j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "excessiveGCFreeSizeRatio=", (UDATA)0, (UDATA)100);831goto _error;832}833extensions->excessiveGCFreeSizeRatio = ((float)value) / 100.0f;834goto _exit;835}836837if(try_scan(scan_start, "excessiveGCnewRatioWeight=")) {838UDATA value;839if(!scan_udata_helper(javaVM, scan_start, &value, "excessiveGCnewRatioWeight=")) {840goto _error;841}842if((value < 1) || (value > 90)) {843j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "excessiveGCnewRatioWeight=", (UDATA)1, (UDATA)90);844goto _error;845}846extensions->excessiveGCnewRatioWeight =((float)value) / 100.0f;847goto _exit;848}849850#if defined(J9VM_GC_MODRON_COMPACTION)851if(try_scan(scan_start, "stdGlobalCompactToSatisfyAllocate")) {852extensions->compactToSatisfyAllocate = true;853goto _exit;854}855856/* Incremental compaction is no longer supported.857* Options are supported but deprecated.858*/859if(try_scan(scan_start, "icompact=")) {860UDATA incrementalCompactSteps;861if(!scan_udata_helper(javaVM, scan_start, &incrementalCompactSteps, "icompact=")) {862goto _error;863}864goto _exit;865}866#endif /* J9VM_GC_MODRON_COMPACTION */867868#if defined (OMR_GC_MODRON_CONCURRENT_MARK)869if(try_scan(scan_start, "concurrentMark")) {870extensions->configurationOptions._forceOptionConcurrentMark = true;871extensions->concurrentMark = true;872goto _exit;873}874875if(try_scan(scan_start, "noConcurrentMarkKO")) {876extensions->concurrentKickoffEnabled = false;877goto _exit;878}879880if(try_scan(scan_start, "concurrentSlack=")) {881882/* if concurrentSlack=macrofrag is set, we will count estimateFragmentation when deciding concurrentgc kickoff , concurrentSlackFragmentationAdjustmentWeight is set as 1.0 as default */883if (try_scan(scan_start, "macrofrag")) {884extensions->estimateFragmentation = (GLOBALGC_ESTIMATE_FRAGMENTATION | LOCALGC_ESTIMATE_FRAGMENTATION);885extensions->processLargeAllocateStats = true;886extensions->concurrentSlackFragmentationAdjustmentWeight = 1.0;887goto _exit;888} else {889UDATA value;890if(!scan_udata_helper(javaVM, scan_start, &value, "concurrentSlack=")) {891goto _error;892}893extensions->concurrentSlack = value;894goto _exit;895}896}897898if (try_scan(scan_start, "concurrentSlackFragmentationAdjustmentWeight=")) {899UDATA value;900if(!scan_udata_helper(javaVM, scan_start, &value, "concurrentSlackFragmentationAdjustmentWeight=")) {901goto _error;902}903if(value > 500) {904j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "concurrentSlackFragmentationAdjustmentWeight==", (UDATA)0, (UDATA)500);905goto _error;906}907extensions->concurrentSlackFragmentationAdjustmentWeight = ((double)value) / 100.0;908goto _exit;909}910911if(try_scan(scan_start, "noConcurrentMark")) {912extensions->configurationOptions._forceOptionConcurrentMark = true;913extensions->concurrentMark = false;914goto _exit;915}916917if(try_scan(scan_start, "optimizeConcurrentWB")) {918extensions->optimizeConcurrentWB = true;919goto _exit;920}921922if(try_scan(scan_start, "noOptimizeConcurrentWB")) {923extensions->optimizeConcurrentWB = false;924goto _exit;925}926927if(try_scan(scan_start, "debugConcurrentMark")) {928extensions->debugConcurrentMark = true;929goto _exit;930}931932if(try_scan(scan_start, "cardCleaningPasses=")) {933UDATA value;934if(!scan_udata_helper(javaVM, scan_start, &value, "cardCleaningPasses=")) {935goto _error;936}937if(value > 2) {938j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "cardCleaningPasses=", (UDATA)0, (UDATA)2);939goto _error;940}941extensions->cardCleaningPasses = value;942goto _exit;943}944945if(try_scan(scan_start, "cardCleanPass2Boost=")) {946if(!scan_udata_helper(javaVM, scan_start, &extensions->cardCleanPass2Boost, "cardCleanPass2Boost=")) {947goto _error;948}949goto _exit;950}951#endif /* OMR_GC_MODRON_CONCURRENT_MARK */952953if(try_scan(scan_start, "version")) {954j9tty_printf(PORTLIB, "GC Version: %s\n", versionString);955goto _exit;956}957958#if defined(J9VM_GC_BATCH_CLEAR_TLH)959if(try_scan(scan_start, "batchClearTLH")) {960extensions->batchClearTLH = 1;961goto _exit;962}963#endif /* J9VM_GC_BATCH_CLEAR_TLH */964965#if defined(J9VM_GC_SUBPOOLS_ALIAS)966/*967* Temporary: Accept but silently ignore any subpool option968* subpool gc policy is not supported any more just it is an alias for optthruput969*/970if(try_scan(scan_start, "subPoolsDebug")) {971goto _exit;972}973974if(try_scan(scan_start, "disableSubPoolLargeHeap")) {975goto _exit;976}977978if(try_scan(scan_start, "microFragmentationDetectionThreshold=")) {979UDATA value;980if(!scan_udata_helper(javaVM, scan_start, &value, "microFragmentationDetectionThreshold=")) {981goto _error;982}983goto _exit;984}985986if(try_scan(scan_start, "microFragmentationDetection")) {987goto _exit;988}989#endif /* defined(J9VM_GC_SUBPOOLS_ALIAS) */990991#if defined(J9VM_GC_CONCURRENT_SWEEP)992if(try_scan(scan_start, "concurrentSweep")) {993extensions->configurationOptions._forceOptionConcurrentSweep = true;994extensions->concurrentSweep = true;995goto _exit;996}997998if(try_scan(scan_start, "noConcurrentSweep")) {999extensions->configurationOptions._forceOptionConcurrentSweep = true;1000extensions->concurrentSweep = false;1001goto _exit;1002}1003#endif /* J9VM_GC_CONCURRENT_SWEEP */10041005/* Additional -Xgc:fvtest options */1006if(try_scan(scan_start, "fvtest=")) {1007#if defined(J9VM_GC_MODRON_SCAVENGER) || defined(J9VM_GC_VLHGC)1008#if defined(J9VM_GC_MODRON_SCAVENGER)1009/* This option forces the scavenger to backout every other collect */1010if (try_scan(scan_start, "forceScavengerBackout")) {1011extensions->fvtest_forceScavengerBackout = true;1012goto _exit;1013}10141015/* This option forces the scavenger to poison evacuate space after every collection */1016if (try_scan(scan_start, "forcePoisonEvacuate")) {1017extensions->fvtest_forcePoisonEvacuate = true;1018goto _exit;1019}10201021/* This forces the nursery space to resize - 3 expands followed by 3 contracts */1022if (try_scan(scan_start, "forceNurseryResize")) {1023extensions->fvtest_forceNurseryResize = true;1024goto _exit;1025}10261027/* This forces the tenure space to resize - 5 expands followed by 5 contracts */1028if (try_scan(scan_start, "forceTenureResize")) {1029extensions->fvtest_forceOldResize = true;1030goto _exit;1031}1032#endif /* J9VM_GC_MODRON_SCAVENGER */10331034/* This takes a UDATA that restricts the number of scan caches - used to force scan cache overflow */1035if (try_scan(scan_start, "scanCacheCount")) {1036/* Read in restricted scan cache size */1037if(!scan_udata_helper(javaVM, scan_start, &extensions->fvtest_scanCacheCount, "scanCacheCount")) {1038goto _error;1039}1040goto _exit;1041}1042#endif /* J9VM_GC_MODRON_SCAVENGER || J9VM_GC_VLHGC */10431044if (try_scan(scan_start, "alwaysApplyOverflowRounding")) {1045/* see CMVC 12157 -- this option allows us to test overflow1046* rounding which is otherwise only applied if the heap is1047* allocated very high in the address space1048*/1049extensions->fvtest_alwaysApplyOverflowRounding = true;1050goto _exit;1051}10521053#if defined(J9VM_GC_DYNAMIC_CLASS_UNLOADING)1054if (try_scan(scan_start, "forceFinalizeClassLoaders")) {1055/* CMVC 122432 - forces all class loaders to be cleaned up via a FinalizerFreeClassLoaderJob1056* during the finalization phase. Can be useful for testing that facility or to ensure that1057* there are no timing assumptions regarding class unloading in the rest of the VM1058*/1059extensions->fvtest_forceFinalizeClassLoaders = true;1060goto _exit;1061}1062#endif /* J9VM_GC_DYNAMIC_CLASS_UNLOADING */10631064/* Force an excessive GC to throw OOM after this many global GCs */1065if (try_scan(scan_start, "forceExcessiveAllocFailureAfter=")) {1066if(!scan_udata_helper(javaVM, scan_start, &(extensions->fvtest_forceExcessiveAllocFailureAfter), "forceExcessiveAllocFailureAfter=")) {1067goto _error;1068}1069goto _exit;1070}10711072/* VM Design 1869: force the heap to be allocated between these values */1073if (try_scan(scan_start, "verifyHeapAbove=")) {1074if(!scan_udata_memory_size_helper(javaVM, scan_start, (UDATA *)&(extensions->fvtest_verifyHeapAbove), "verifyHeapAbove=")) {1075goto _error;1076}1077goto _exit;1078}1079if (try_scan(scan_start, "verifyHeapBelow=")) {1080if(!scan_udata_memory_size_helper(javaVM, scan_start, (UDATA *)&(extensions->fvtest_verifyHeapBelow), "verifyHeapBelow=")) {1081goto _error;1082}1083goto _exit;1084}1085#if defined(J9VM_GC_VLHGC)1086if (try_scan(scan_start, "tarokVerifyMarkMapClosure")) {1087extensions->fvtest_tarokVerifyMarkMapClosure = true;1088goto _exit;1089}1090#endif /* defined(J9VM_GC_VLHGC) */10911092if( try_scan(scan_start, "disableInlineAllocation")) {1093extensions->fvtest_disableInlineAllocation = true;1094goto _exit;1095}10961097/* test option not recognised */1098j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTION_FVTEST_UNKNOWN_TYPE, *scan_start);1099goto _error;1100}1101#if defined(J9VM_GC_VLHGC)1102#if defined(OMR_GC_VLHGC_CONCURRENT_COPY_FORWARD)1103if (try_scan(scan_start, "concurrentCopyForward")) {1104extensions->_isConcurrentCopyForward = true;1105goto _exit;1106}1107if (try_scan(scan_start, "noConcurrentCopyForward")) {1108extensions->_isConcurrentCopyForward = false;1109goto _exit;1110}1111#endif /* defined(OMR_GC_VLHGC_CONCURRENT_COPY_FORWARD) */1112#endif /* defined(J9VM_GC_VLHGC) */11131114#if defined(J9VM_GC_MODRON_SCAVENGER) || defined(J9VM_GC_VLHGC)1115/* If dynamicBreadthFirstScanOrdering is enabled, set scavengerScanOrdering and other required options */1116if(try_scan(scan_start, "dynamicBreadthFirstScanOrdering")) {1117extensions->scavengerScanOrdering = MM_GCExtensions::OMR_GC_SCAVENGER_SCANORDERING_DYNAMIC_BREADTH_FIRST;1118/* Below options are required options for dynamicBreadthFirstScanOrdering */1119extensions->scavengerAlignHotFields = false;1120goto _exit;1121}1122#endif /* defined(J9VM_GC_MODRON_SCAVENGER) || defined (J9VM_GC_VLHGC) */11231124#if defined(J9VM_GC_MODRON_SCAVENGER)1125if (try_scan(scan_start, "scanCacheSize=")) {1126/* Read in restricted scan cache size */1127if(!scan_udata_helper(javaVM, scan_start, &extensions->scavengerScanCacheMaximumSize, "scanCacheSize=")) {1128goto _error;1129}1130if(0 == extensions->scavengerScanCacheMaximumSize) {1131j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_VALUE_MUST_BE_ABOVE, "scanCacheSize=", (UDATA)0);1132goto _error;1133}1134goto _exit;1135}11361137if(try_scan(scan_start, "hierarchicalScanOrdering")) {1138extensions->scavengerScanOrdering = MM_GCExtensions::OMR_GC_SCAVENGER_SCANORDERING_HIERARCHICAL;1139goto _exit;1140}11411142if(try_scan(scan_start, "breadthFirstScanOrdering")) {1143extensions->scavengerScanOrdering = MM_GCExtensions::OMR_GC_SCAVENGER_SCANORDERING_BREADTH_FIRST;1144goto _exit;1145}1146#endif /* J9VM_GC_MODRON_SCAVENGER */11471148if(try_scan(scan_start, "alwaysCallWriteBarrier")) {1149extensions->alwaysCallWriteBarrier = true;1150goto _exit;1151}11521153if(try_scan(scan_start, "alwaysCallReadBarrier")) {1154extensions->alwaysCallReadBarrier = true;1155goto _exit;1156}11571158if(try_scan(scan_start, "sweepchunksize=")) {1159if(!scan_udata_helper(javaVM, scan_start, &extensions->parSweepChunkSize, "sweepchunksize=")) {1160goto _error;1161}1162if(0 == extensions->parSweepChunkSize) {1163j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_VALUE_MUST_BE_ABOVE, "sweepchunksize=", (UDATA)0);1164goto _error;1165}1166extensions->parSweepChunkSize *= 1024; /* the value is specified in kB on the command-line */11671168goto _exit;1169}11701171if(try_scan(scan_start, "verbosegcCycleTime=")) {1172if(!scan_udata_helper(javaVM, scan_start, &extensions->verbosegcCycleTime, "verbosegcCycleTime=")) {1173goto _error;1174}1175if(0 == extensions->verbosegcCycleTime) {1176j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_VALUE_MUST_BE_ABOVE, "verbosegcCycleTime=", (UDATA)0);1177goto _error;1178}11791180goto _exit;1181}11821183if (try_scan(scan_start, "verboseExtensions")) {1184extensions->verboseExtensions = true;1185goto _exit;1186}11871188if (try_scan(scan_start, "bufferedLogging")) {1189extensions->bufferedLogging = true;1190goto _exit;1191}11921193#if defined(J9VM_GC_VLHGC) || defined(J9VM_GC_GENERATIONAL)1194/* currently only used by VLHGC -- consider promoting if required for other policies */1195if (try_scan(scan_start, "numa")) {1196extensions->_numaManager.shouldEnablePhysicalNUMA(true);1197extensions->numaForced = true;1198goto _exit;1199}12001201if (try_scan(scan_start, "noNuma")) {1202extensions->_numaManager.shouldEnablePhysicalNUMA(false);1203extensions->numaForced = true;1204goto _exit;1205}1206#endif /* defined(J9VM_GC_VLHGC) || defined(J9VM_GC_GENERATIONAL) */12071208if (try_scan(scan_start, "hybridMemoryPool")) {1209extensions->enableHybridMemoryPool = true;1210goto _exit;1211}12121213/* Couldn't find a match for arguments */1214return 2;12151216_error:1217return 0;12181219_exit:1220return 1;1221}12221223/**1224* Parse the command line looking for -Xgc options.1225* @params optArg string to be parsed1226*/1227jint1228gcParseXgcArguments(J9JavaVM *vm, char *optArg)1229{1230char *scan_start = optArg;1231char *scan_limit = optArg + strlen(optArg);1232char *error_scan;1233MM_GCExtensions *extensions;1234PORT_ACCESS_FROM_JAVAVM(vm);12351236jint returnValue = JNI_OK;12371238extensions = MM_GCExtensions::getExtensions(vm);12391240while (scan_start < scan_limit) {1241UDATA scanResult;12421243/* ignore separators */1244try_scan(&scan_start, ",");12451246error_scan = scan_start;12471248/* TODO: inline when merged? */1249scanResult = j9gc_initialize_parse_gc_colon(vm, &scan_start);1250if (0 == scanResult) {1251returnValue = JNI_EINVAL;1252break;1253} else if (1 == scanResult) {1254continue;1255}1256/* if scanResult is 2, we will continue through */12571258#if defined(J9VM_GC_JNI_ARRAY_CACHE)1259if (try_scan(&scan_start, "jniArrayCacheMax=")) {1260if(try_scan(&scan_start, "unlimited")) {1261vm->jniArrayCacheMaxSize=((UDATA)-1);1262} else {1263if(!scan_udata_helper(vm, &scan_start, &vm->jniArrayCacheMaxSize, "jniArrayCacheMax=")) {1264returnValue = JNI_EINVAL;1265break;1266}1267}1268continue;1269}1270#endif /* J9VM_GC_JNI_ARRAY_CACHE */12711272#if defined(J9VM_GC_FINALIZATION)1273if (try_scan(&scan_start, "finInterval=")) {1274if (try_scan(&scan_start, "nodelay")) {1275extensions->finalizeCycleInterval = -1;1276} else {1277if(!scan_udata_helper(vm, &scan_start, (UDATA *)&extensions->finalizeCycleInterval, "finInterval=")) {1278returnValue = JNI_EINVAL;1279break;1280}1281}12821283if (extensions->finalizeCycleInterval == 0) {1284extensions->finalizeCycleInterval = -2;1285}1286continue;1287}1288if (try_scan(&scan_start, "finalizeMainPriority=")) {1289if(!scan_udata_helper(vm, &scan_start, &extensions->finalizeMainPriority, "finalizeMainPriority=")) {1290returnValue = JNI_EINVAL;1291break;1292}1293if((extensions->finalizeMainPriority < J9THREAD_PRIORITY_USER_MIN) || (extensions->finalizeMainPriority > J9THREAD_PRIORITY_USER_MAX)) {1294j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "-Xgc:finalizeMainPriority", (UDATA)J9THREAD_PRIORITY_USER_MIN, (UDATA)J9THREAD_PRIORITY_USER_MAX);1295returnValue = JNI_EINVAL;1296break;1297}1298continue;1299}1300if (try_scan(&scan_start, "finalizeWorkerPriority=")) {1301if(!scan_udata_helper(vm, &scan_start, &extensions->finalizeWorkerPriority, "finalizeWorkerPriority=")) {1302returnValue = JNI_EINVAL;1303break;1304}1305if((extensions->finalizeWorkerPriority < J9THREAD_PRIORITY_USER_MIN) || (extensions->finalizeWorkerPriority > J9THREAD_PRIORITY_USER_MAX)) {1306j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_INTEGER_OUT_OF_RANGE, "-Xgc:finalizeWorkerPriority", (UDATA)J9THREAD_PRIORITY_USER_MIN, (UDATA)J9THREAD_PRIORITY_USER_MAX);1307returnValue = JNI_EINVAL;1308break;1309}1310continue;1311}1312#endif /* J9VM_GC_FINALIZATION */13131314#if defined(J9MODRON_USE_CUSTOM_SPINLOCKS)1315if (try_scan(&scan_start, "spinCount1=")) {1316if(!scan_udata_helper(vm, &scan_start, &extensions->lnrlOptions.spinCount1, "spinCount1=")) {1317returnValue = JNI_EINVAL;1318break;1319}1320continue;1321}1322if (try_scan(&scan_start, "spinCount2=")) {1323if(!scan_udata_helper(vm, &scan_start, &extensions->lnrlOptions.spinCount2, "spinCount2=")) {1324returnValue = JNI_EINVAL;1325break;1326}1327continue;1328}1329if (try_scan(&scan_start, "spinCount3=")) {1330if(!scan_udata_helper(vm, &scan_start, &extensions->lnrlOptions.spinCount3, "spinCount3=")) {1331returnValue = JNI_EINVAL;1332break;1333}1334continue;1335}1336#endif /* J9MODRON_USE_CUSTOM_SPINLOCKS */13371338#if defined(J9VM_GC_DYNAMIC_CLASS_UNLOADING)1339if (try_scan(&scan_start, "deadClassLoaderCache=")) {1340if(!scan_udata_memory_size_helper(vm, &scan_start, &extensions->deadClassLoaderCacheSize, "deadClassLoaderCache=")) {1341returnValue = JNI_EINVAL;1342break;1343}1344continue;1345}13461347if (try_scan(&scan_start, "classUnloadingThreshold=")) {1348if ( !scan_udata_helper(vm, &scan_start, &extensions->dynamicClassUnloadingThreshold, "classUnloadingThreshold=")) {1349returnValue = JNI_EINVAL;1350break;1351}1352extensions->dynamicClassUnloadingThresholdForced = true;1353continue;1354}13551356if (try_scan(&scan_start,"classUnloadingKickoffThreshold=")) {1357if ( !scan_udata_helper(vm, &scan_start, &extensions->dynamicClassUnloadingKickoffThreshold, "classUnloadingKickoffThreshold=")) {1358returnValue = JNI_EINVAL;1359break;1360}1361extensions->dynamicClassUnloadingKickoffThresholdForced = true;1362continue;1363}13641365if (try_scan(&scan_start, "classUnloadingAnonymousClassWeight=")) {1366UDATA divisor = 0;1367if(!scan_udata_helper(vm, &scan_start, &divisor, "classUnloadingAnonymousClassWeight=")) {1368returnValue = JNI_EINVAL;1369break;1370}13711372if (0 == divisor) {1373j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_VALUE_MUST_BE_ABOVE, "classUnloadingAnonymousClassWeight=", (UDATA)0);1374returnValue = JNI_EINVAL;1375break;1376} else {1377extensions->classUnloadingAnonymousClassWeight = (1.0 / (double)divisor);1378}1379continue;1380}1381#endif /* J9VM_GC_DYNAMIC_CLASS_UNLOADING */138213831384if (try_scan(&scan_start, "allocationSamplingGranularity=")) {1385if ( !scan_udata_memory_size_helper(vm, &scan_start, &extensions->oolObjectSamplingBytesGranularity, "allocationSamplingGranularity=")) {1386returnValue = JNI_EINVAL;1387break;1388}1389extensions->doOutOfLineAllocationTrace = true;1390continue;1391}13921393if (try_scan(&scan_start, "allocationSamplingEnable")) {1394extensions->doOutOfLineAllocationTrace = true;1395continue;1396}13971398if (try_scan(&scan_start, "allocationSamplingDisable")) {1399extensions->doOutOfLineAllocationTrace = false;1400continue;1401}14021403/* see if we are forcing shifting to a specific value */1404if (try_scan(&scan_start, "preferredHeapBase=")) {1405UDATA preferredHeapBase = 0;1406if(!scan_hex_helper(vm, &scan_start, &preferredHeapBase, "preferredHeapBase=")) {1407returnValue = JNI_EINVAL;1408break;1409}14101411#if defined(J9ZOS390)1412j9nls_printf(PORTLIB, J9NLS_WARNING, J9NLS_GC_OPTIONS_PREFERREDHEAPBASE_NOT_SUPPORTED_ON_ZOS_WARN);1413#else1414extensions->preferredHeapBase = preferredHeapBase;1415#endif /* defined(J9ZOS390) */1416continue;1417}14181419/* see if they are requesting an initial suballocator heap size */1420if (try_scan(&scan_start, "suballocatorInitialSize=")) {1421if(!scan_udata_memory_size_helper(vm, &scan_start, &extensions->suballocatorInitialSize, "suballocatorInitialSize=")) {1422returnValue = JNI_EINVAL;1423break;1424}1425if(0 == extensions->suballocatorInitialSize) {1426j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_VALUE_MUST_BE_ABOVE, "-Xgc:suballocatorInitialSize=", (UDATA)0);1427returnValue = JNI_EINVAL;1428break;1429}1430continue;1431}14321433/* see if they are requesting a commit suballocator heap size */1434if (try_scan(&scan_start, "suballocatorCommitSize=")) {1435if(!scan_udata_memory_size_helper(vm, &scan_start, &extensions->suballocatorCommitSize, "suballocatorCommitSize=")) {1436returnValue = JNI_EINVAL;1437break;1438}1439if(0 == extensions->suballocatorCommitSize) {1440j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTIONS_VALUE_MUST_BE_ABOVE, "-Xgc:suballocatorCommitSize=", (UDATA)0);1441returnValue = JNI_EINVAL;1442break;1443}1444continue;1445}14461447/* for testing and service reasons, split heaps is currently restricted to Win32 only */1448#if defined(J9VM_GC_GENERATIONAL) && (defined(WIN32) && !defined(WIN64))1449/* see if we are supposed to enable split heaps */1450if (try_scan(&scan_start, "splitheap")) {1451extensions->enableSplitHeap = true;1452/* If -Xgc:splitheap is specified, -Xgcpolicy:gencon is implicitly specified */1453extensions->configurationOptions._gcPolicy = gc_policy_gencon;1454continue;1455}1456#endif /* defined(J9VM_GC_GENERATIONAL) && (defined(WIN32) && !defined(WIN64)) */14571458/* Check for a user-specified region size for the fixed-sized table regions */1459if (try_scan(&scan_start, "regionSize=")) {1460if(!scan_udata_memory_size_helper(vm, &scan_start, &extensions->regionSize, "regionSize=")) {1461returnValue = JNI_EINVAL;1462break;1463}1464continue;1465}14661467#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)1468if (try_scan(&scan_start, "enableArrayletDoubleMapping")) {1469extensions->isArrayletDoubleMapRequested = true;1470continue;1471}1472if (try_scan(&scan_start, "disableArrayletDoubleMapping")) {1473extensions->isArrayletDoubleMapRequested = false;1474continue;1475}1476#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */14771478#if defined (J9VM_GC_VLHGC)1479if (try_scan(&scan_start, "fvtest_tarokForceNUMANode=")) {1480if(!scan_udata_helper(vm, &scan_start, &extensions->fvtest_tarokForceNUMANode, "fvtest_tarokForceNUMANode=")) {1481returnValue = JNI_EINVAL;1482break;1483}1484continue;1485}1486if (try_scan(&scan_start, "fvtest_tarokFirstContext=")) {1487if(!scan_udata_helper(vm, &scan_start, &extensions->fvtest_tarokFirstContext, "fvtest_tarokFirstContext=")) {1488returnValue = JNI_EINVAL;1489break;1490}1491continue;1492}1493#endif /* defined (J9VM_GC_VLHGC) */14941495if (try_scan(&scan_start, "verboseFormat=")) {1496if (try_scan(&scan_start, "default")) {1497extensions->verboseNewFormat = true;1498continue;1499}1500if (try_scan(&scan_start, "deprecated")) {1501extensions->verboseNewFormat = false;1502continue;1503}1504/* verbose format not recognised J9NLS_GC_OPTION_UNKNOWN*/1505/* j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTION_VERBOSEFORMAT_UNKNOWN_FORMAT, *scan_start); */1506j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTION_UNKNOWN, error_scan);1507returnValue = JNI_EINVAL;1508break;1509}15101511/* Couldn't find a match for arguments */1512j9nls_printf(PORTLIB, J9NLS_ERROR, J9NLS_GC_OPTION_UNKNOWN, error_scan);1513returnValue = JNI_EINVAL;1514break;15151516}/* end loop */15171518return returnValue;1519}152015211522