@@ -76,6 +76,7 @@ static VMErrorCode processMaxCodeSpaceSizeOption(const char *argument, VMParamet
7676static VMErrorCode processEdenSizeOption (const char * argument , VMParameters * params );
7777static VMErrorCode processWorkerOption (const char * argument , VMParameters * params );
7878static VMErrorCode processMinPermSpaceSizeOption (const char * argument , VMParameters * params );
79+ static VMErrorCode processMaxSlotsForNewSpaceAlloc (const char * argument , VMParameters * params );
7980static VMErrorCode processStackPageSizeOption (const char * argument , VMParameters * params );
8081static VMErrorCode processWorkingDirectory (const char * argument , VMParameters * params );
8182static VMErrorCode processAvoidSearchingSegmentsWithPinnedObjects (const char * argument , VMParameters * params );
@@ -98,6 +99,7 @@ static const VMParameterSpec vm_parameters_spec[] =
9899 {.name = "codeSize" , .hasArgument = true, .function = processMaxCodeSpaceSizeOption },
99100 {.name = "edenSize" , .hasArgument = true, .function = processEdenSizeOption },
100101 {.name = "minPermSpaceSize" , .hasArgument = true, .function = processMinPermSpaceSizeOption },
102+ {.name = "maxSlotsForNewSpaceAlloc" , .hasArgument = true, .function = processMaxSlotsForNewSpaceAlloc },
101103
102104 {.name = "workingDirectory" , .hasArgument = true, .function = processWorkingDirectory },
103105
@@ -441,6 +443,7 @@ vm_printUsageTo(FILE *out)
441443" It is possible to use k(kB), M(MB) and G(GB).\n"
442444" --edenSize=<size>[mk] Sets the size of eden (default: 15M)\n"
443445" It is possible to use k(kB), M(MB) and G(GB).\n"
446+ " --maxSlotsForNewSpaceAlloc=<words> The max numbers of slots to allow allocating in a single young indexable object"
444447" --minPermSpaceSize=<size>[mk] Sets the min size of the permanent space (default: 0k)\n"
445448" It is possible to use k(kB), M(MB) and G(GB).\n"
446449" --stackPageSize=<size>[mk] Sets the size of each stack page (default: 8k)\n"
@@ -566,6 +569,23 @@ processMinPermSpaceSizeOption(const char* originalArgument, VMParameters * param
566569 return VM_SUCCESS ;
567570}
568571
572+ static VMErrorCode
573+ processMaxSlotsForNewSpaceAlloc (const char * originalArgument , VMParameters * params )
574+ {
575+ long long intValue = strtoll (originalArgument , NULL , 10 );
576+
577+ if (intValue < 0 )
578+ {
579+ logError ("Invalid option for max slots for new space allocation: %s\n" , originalArgument );
580+ vm_printUsageTo (stderr );
581+ return VM_ERROR_INVALID_PARAMETER_VALUE ;
582+ }
583+
584+ params -> maxSlotsForNewSpaceAlloc = intValue ;
585+
586+ return VM_SUCCESS ;
587+ }
588+
569589static VMErrorCode
570590processWorkingDirectory (const char * originalArgument , VMParameters * params )
571591{
@@ -590,6 +610,14 @@ processEdenSizeOption(const char* originalArgument, VMParameters * params)
590610 return VM_ERROR_INVALID_PARAMETER_VALUE ;
591611 }
592612
613+ //The max value for the edenSize is 1GB check #nextCorpseOffset: for restriction details.
614+ if (intValue > 1024 * 1024 * 1024 )
615+ {
616+ logError ("The max value for eden is 1G: %s\n" , originalArgument );
617+ vm_printUsageTo (stderr );
618+ return VM_ERROR_INVALID_PARAMETER_VALUE ;
619+ }
620+
593621 params -> edenSize = intValue ;
594622
595623 return VM_SUCCESS ;
@@ -770,6 +798,7 @@ vm_parameters_init(VMParameters *parameters){
770798 parameters -> maxStackFramesToPrint = 0 ;
771799 parameters -> maxCodeSize = 0 ;
772800 parameters -> maxOldSpaceSize = 0 ;
801+ parameters -> maxSlotsForNewSpaceAlloc = 0 ;
773802 parameters -> edenSize = 0 ;
774803 parameters -> minPermSpaceSize = 0 ;
775804 parameters -> stackPageSize = 0 ;
0 commit comments