-
Notifications
You must be signed in to change notification settings - Fork 67
/
parameters.c
730 lines (610 loc) · 20 KB
/
parameters.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
#include "pharovm/pharo.h"
#include "pharovm/parameters/parameters.h"
#include "pharovm/debug.h"
#include "pharovm/pathUtilities.h"
#include <assert.h>
typedef VMErrorCode (*vm_parameter_process_function)(const char *argument, VMParameters* params);
typedef struct VMParameterSpec_
{
const char *name;
bool hasArgument;
vm_parameter_process_function function;
} VMParameterSpec;
/*
* Parse a text in the form [anInteger]k|K|m|M|g|G
* Return the number of bytes represented by the text.
* Return VM_ERROR_INVALID_PARAMETER_VALUE in case of error
* (the text is not prefixed by a number or it is negative number)
*
* E.g., 2M => 2 * 1024 * 1024
*/
long long parseByteSize(const char* text){
long long intValue = 0;
int multiplier = 1;
int argumentLength = 0;
char* argument = alloca(255);
strncpy(argument, text, 255);
argument[254] = 0;
if(strlen(argument) > 0){
argumentLength = strlen(argument);
char lastCharacter = argument[argumentLength - 1];
switch(lastCharacter){
case 'k':
case 'K':
multiplier = 1024;
argument[argumentLength - 1] = '\0';
break;
case 'm':
case 'M':
multiplier = 1024 * 1024;
argument[argumentLength - 1] = '\0';
break;
case 'g':
case 'G':
multiplier = 1024 * 1024 * 1024;
argument[argumentLength - 1] = '\0';
break;
default:
break;
}
}
errno = 0;
intValue = strtoll(argument, NULL, 10);
if(errno != 0 || intValue < 0)
{
return VM_ERROR_INVALID_PARAMETER_VALUE;
}
return intValue * multiplier;
}
void vm_printUsageTo(FILE *out);
static VMErrorCode processHelpOption(const char *argument, VMParameters * params);
static VMErrorCode processPrintVersionOption(const char *argument, VMParameters * params);
static VMErrorCode processLogLevelOption(const char *argument, VMParameters * params);
static VMErrorCode processMaxFramesToPrintOption(const char *argument, VMParameters * params);
static VMErrorCode processMaxOldSpaceSizeOption(const char *argument, VMParameters * params);
static VMErrorCode processMaxCodeSpaceSizeOption(const char *argument, VMParameters * params);
static VMErrorCode processEdenSizeOption(const char *argument, VMParameters * params);
static VMErrorCode processWorkerOption(const char *argument, VMParameters * params);
static VMErrorCode processMinPermSpaceSizeOption(const char *argument, VMParameters * params);
static const VMParameterSpec vm_parameters_spec[] =
{
{.name = "headless", .hasArgument = false, .function = NULL},
#ifdef PHARO_VM_IN_WORKER_THREAD
{.name = "worker", .hasArgument = false, .function = processWorkerOption},
#endif
{.name = "interactive", .hasArgument = false, .function = NULL}, // For pharo-ui scripts.
{.name = "vm-display-null", .hasArgument = false, .function = NULL}, // For Smalltalk CI.
{.name = "help", .hasArgument = false, .function = processHelpOption},
{.name = "h", .hasArgument = false, .function = processHelpOption},
{.name = "version", .hasArgument = false, .function = processPrintVersionOption},
{.name = "logLevel", .hasArgument = true, .function = processLogLevelOption},
{.name = "maxFramesToLog", .hasArgument = true, .function = processMaxFramesToPrintOption},
{.name = "maxOldSpaceSize", .hasArgument = true, .function = processMaxOldSpaceSizeOption},
{.name = "codeSize", .hasArgument = true, .function = processMaxCodeSpaceSizeOption},
{.name = "edenSize", .hasArgument = true, .function = processEdenSizeOption},
{.name = "minPermSpaceSize", .hasArgument = true, .function = processMinPermSpaceSizeOption},
#ifdef __APPLE__
// This parameter is passed by the XCode debugger.
{.name = "NSDocumentRevisionsDebugMode", .hasArgument = false, .function = NULL},
#endif
};
// TODO: Turn this array size computation into a macro.
static const size_t vm_parameters_spec_size = sizeof(vm_parameters_spec) / sizeof(vm_parameters_spec[0]);
/**
* Folder search suffixes for finding images.
*/
static const char * const vm_image_search_suffixes[] = {
DEFAULT_IMAGE_NAME,
#ifdef __APPLE__
"../Resources/" DEFAULT_IMAGE_NAME,
"../../../" DEFAULT_IMAGE_NAME,
#endif
};
static const size_t vm_image_search_suffixes_count = sizeof(vm_image_search_suffixes) / sizeof(vm_image_search_suffixes[0]);
static const VMParameterSpec*
findParameterWithName(const char *argumentName, size_t argumentNameSize)
{
for(size_t i = 0; i < vm_parameters_spec_size; ++i) {
const VMParameterSpec *paramSpec = &vm_parameters_spec[i];
if(strlen(paramSpec->name) == argumentNameSize &&
strncmp(paramSpec->name, argumentName, argumentNameSize) == 0) {
return paramSpec;
}
}
return NULL;
}
static int
findParameterArity(const char *parameter)
{
if(*parameter != '-') return 0;
// Ignore the preceding hyphens
++parameter;
if(*parameter == '-')
{
++parameter;
}
// Does the parameter have an equal (=)?
if(strchr(parameter, '=') != NULL) return 0;
// Find the parameter spec.
const VMParameterSpec* spec = findParameterWithName(parameter, strlen(parameter));
if(!spec) return 0;
return spec->hasArgument ? 1 : 0;
}
// FIXME: This should be provided by the client.
static int
isInConsole()
{
#ifdef _WIN32
return GetStdHandle(STD_INPUT_HANDLE) != NULL;
#else
return false;
#endif
}
VMErrorCode
vm_parameters_destroy(VMParameters *parameters)
{
if(!parameters) return VM_ERROR_NULL_POINTER;
free(parameters->imageFileName);
vm_parameter_vector_destroy(¶meters->vmParameters);
vm_parameter_vector_destroy(¶meters->imageParameters);
memset(parameters, 0, sizeof(VMParameters));
return VM_SUCCESS;
}
VMErrorCode
vm_find_startup_image(const char *vmExecutablePath, VMParameters *parameters)
{
char *imagePathBuffer = (char*)calloc(1, FILENAME_MAX+1);
char *vmPathBuffer = (char*)calloc(1, FILENAME_MAX+1);
char *searchPathBuffer = (char*)calloc(1, FILENAME_MAX+1);
if(!imagePathBuffer || !vmPathBuffer || !searchPathBuffer)
{
free(imagePathBuffer);
free(vmPathBuffer);
free(searchPathBuffer);
return VM_ERROR_OUT_OF_MEMORY;
}
// Find the VM absolute directory.
vm_path_make_absolute_into(searchPathBuffer, FILENAME_MAX+1, vmExecutablePath);
if(sqImageFileExists(searchPathBuffer))
{
vm_path_extract_dirname_into(vmPathBuffer, FILENAME_MAX+1, searchPathBuffer);
}
else
{
strncpy(vmPathBuffer, vmExecutablePath, FILENAME_MAX);
vmPathBuffer[FILENAME_MAX] = 0;
}
// Find the image in the different search directory suffixes.
for(size_t i = 0; i < vm_image_search_suffixes_count; ++i)
{
const char *searchSuffix = vm_image_search_suffixes[i];
vm_path_join_into(imagePathBuffer, FILENAME_MAX+1, vmPathBuffer, searchSuffix);
if(sqImageFileExists(imagePathBuffer))
{
parameters->imageFileName = imagePathBuffer;
parameters->isDefaultImage = true;
parameters->defaultImageFound = true;
free(vmPathBuffer);
free(searchPathBuffer);
return VM_SUCCESS;
}
}
// Find the image in the current work directory.
vm_path_get_current_working_dir_into(searchPathBuffer, FILENAME_MAX+1);
vm_path_join_into(imagePathBuffer, FILENAME_MAX+1, searchPathBuffer, DEFAULT_IMAGE_NAME);
free(vmPathBuffer);
free(searchPathBuffer);
if(sqImageFileExists(imagePathBuffer))
{
parameters->imageFileName = imagePathBuffer;
parameters->isDefaultImage = true;
parameters->defaultImageFound = true;
return VM_SUCCESS;
}
free(imagePathBuffer);
parameters->imageFileName = strdup(DEFAULT_IMAGE_NAME);
parameters->isDefaultImage = true;
parameters->defaultImageFound = false;
return VM_SUCCESS;
}
static int
findImageNameIndex(int argc, const char** argv)
{
//The first parameters is the executable name
for(int i=1; i < argc; i ++)
{
const char *argument = argv[i];
// Is this a mark for where the image parameters begins?
if(strcmp(argument, "--") == 0)
{
return i;
}
// Is this an option?
if(*argv[i] == '-') {
i += findParameterArity(argument);
continue;
}
// This must be the first non vmoption argument, so this must be the image.
return i;
}
// I could not find it.
return argc;
}
static VMErrorCode
fillUpImageName(int argc, const char** argv, VMParameters* parameters){
VMErrorCode error;
int imageNameIndex = findImageNameIndex(argc, argv);
// We get the image file name
if(imageNameIndex != argc && strcmp("--", argv[imageNameIndex]) != 0) {
parameters->imageFileName = strdup(argv[imageNameIndex]);
parameters->isDefaultImage = false;
parameters->isInteractiveSession = false;
}
return VM_SUCCESS;
}
static VMErrorCode
splitVMAndImageParameters(int argc, const char** argv, VMParameters* parameters)
{
VMErrorCode error;
int imageNameIndex = findImageNameIndex(argc, argv);
int numberOfVMParameters = imageNameIndex;
int numberOfImageParameters = argc - imageNameIndex - 1;
//If we still have an empty image file, we try the default
if(parameters->imageFileName == NULL){
error = vm_find_startup_image(argv[0], parameters);
if(error) return error;
// Is this an interactive environment?
parameters->isInteractiveSession = !isInConsole() && parameters->isDefaultImage;
}
if(numberOfImageParameters < 0)
numberOfImageParameters = 0;
// Copy image parameters.
error = vm_parameter_vector_insert_from(¶meters->imageParameters, numberOfImageParameters, &argv[imageNameIndex + 1]);
if(error)
{
vm_parameters_destroy(parameters);
return error;
}
// Copy the VM parameters.
error = vm_parameter_vector_insert_from(¶meters->vmParameters, numberOfVMParameters, argv);
if(error)
{
vm_parameters_destroy(parameters);
return error;
}
#if !ALWAYS_INTERACTIVE
// Add additional VM parameters.
const char *extraVMParameters = "--headless";
error = vm_parameter_vector_insert_from(¶meters->vmParameters, 1, &extraVMParameters);
if(error)
{
vm_parameters_destroy(parameters);
return error;
}
#endif
return VM_SUCCESS;
}
static void
logParameterVector(const char* vectorName, const VMParameterVector *vector)
{
logDebug("%s [count = %u]:", vectorName, vector->count);
for(size_t i = 0; i < vector->count; ++i)
{
logDebug(" %s", vector->parameters[i]);
}
}
static void
logParameters(const VMParameters* parameters)
{
logDebug("Image file name: %s", parameters->imageFileName);
logDebug("Is default Image: %s", parameters->isDefaultImage ? "yes" : "no");
logDebug("Is interactive session: %s", parameters->isInteractiveSession ? "yes" : "no");
logParameterVector("vmParameters", ¶meters->vmParameters);
logParameterVector("imageParameters", ¶meters->imageParameters);
}
VMErrorCode
vm_parameters_ensure_interactive_image_parameter(VMParameters* parameters)
{
VMErrorCode error;
const char* interactiveParameter = "--interactive";
if (parameters->isInteractiveSession)
{
if (!vm_parameter_vector_has_element(¶meters->imageParameters, "--interactive"))
{
error = vm_parameter_vector_insert_from(¶meters->imageParameters, 1, &interactiveParameter);
if (error)
return error;
}
}
#if ALWAYS_INTERACTIVE
const char* headlessParameter = "--headless";
/*
* If the macro ALWAYS_INTERACTIVE is set, we invert the logic of headless / interactive
* This is to mimic the old VM behavior
*/
if (!vm_parameter_vector_has_element(¶meters->vmParameters, "--headless") &&
!vm_parameter_vector_has_element(¶meters->imageParameters, "--interactive")){
error = vm_parameter_vector_insert_from(¶meters->imageParameters, 1, &interactiveParameter);
if (error)
return error;
}
/* Ensure we have headless parameter when in interactive mode (the image is expecting it)*/
if (!vm_parameter_vector_has_element(¶meters->vmParameters, "--headless") &&
vm_parameter_vector_has_element(¶meters->imageParameters, "--interactive")) {
error = vm_parameter_vector_insert_from(¶meters->vmParameters, 1, &headlessParameter);
if (error)
return error;
}
#endif
return VM_SUCCESS;
}
void
vm_printUsageTo(FILE *out)
{
fprintf(out,
"Usage: " VM_NAME " [<option>...] [<imageName> [<argument>...]]\n"
" " VM_NAME " [<option>...] -- [<argument>...]\n"
"\n"
"Common <option>s:\n"
" --help Print this help message, then exit\n"
#if ALWAYS_INTERACTIVE
" --headless Run in headless (no window) mode (default: false)\n"
#else
" --headless Run in headless (no window) mode (default: true)\n"
#endif
#ifdef PHARO_VM_IN_WORKER_THREAD
" --worker Run in worker thread (default: false)\n"
#endif
" --logLevel=<level> Sets the log level number (ERROR(1), WARN(2), INFO(3), DEBUG(4), TRACE(5))\n"
" --version Print version information, then exit\n"
" --maxFramesToLog=<cant> Sets the max numbers of Smalltalk frames to log\n"
" --maxOldSpaceSize=<bytes> Sets the max size of the old space. As the other\n"
" spaces are fixed (or calculated from this) with\n"
" this parameter is possible to set the total size.\n"
" It is possible to use k(kB), M(MB) and G(GB).\n"
" --codeSize=<size>[mk] Sets the max size of code zone.\n"
" It is possible to use k(kB), M(MB) and G(GB).\n"
" --edenSize=<size>[mk] Sets the size of eden\n"
" It is possible to use k(kB), M(MB) and G(GB).\n"
" --minPermSpaceSize=<size>[mk] Sets the size of eden\n"
" It is possible to use k(kB), M(MB) and G(GB).\n"
"\n"
"Notes:\n"
"\n"
" <imageName> defaults to `Pharo.image'.\n"
" <argument>s are ignored, but are processed by the Pharo image.\n"
" Precede <arguments> by `--' to use default image.\n");
}
static VMErrorCode
processLogLevelOption(const char* value, VMParameters * params)
{
int intValue = 0;
intValue = strtol(value, NULL, 10);
if(intValue == 0)
{
logError("Invalid option for logLevel: %s\n", value);
vm_printUsageTo(stderr);
return VM_ERROR_INVALID_PARAMETER_VALUE;
}
logLevel(intValue);
return VM_SUCCESS;
}
static VMErrorCode
processMaxFramesToPrintOption(const char* value, VMParameters * params)
{
int intValue = 0;
intValue = strtol(value, NULL, 10);
if(intValue < 0)
{
logError("Invalid option for maxFramesToLog: %s\n", value);
vm_printUsageTo(stderr);
return VM_ERROR_INVALID_PARAMETER_VALUE;
}
params->maxStackFramesToPrint = intValue;
return VM_SUCCESS;
}
static VMErrorCode
processMaxOldSpaceSizeOption(const char* originalArgument, VMParameters * params)
{
long long intValue = parseByteSize(originalArgument);
if(intValue < 0)
{
logError("Invalid option for maxOldSpaceSize: %s\n", originalArgument);
vm_printUsageTo(stderr);
return VM_ERROR_INVALID_PARAMETER_VALUE;
}
params->maxOldSpaceSize = intValue ;
return VM_SUCCESS;
}
static VMErrorCode
processMaxCodeSpaceSizeOption(const char* originalArgument, VMParameters * params)
{
long long intValue = parseByteSize(originalArgument);
if(intValue < 0)
{
logError("Invalid option for codeSize: %s\n", originalArgument);
vm_printUsageTo(stderr);
return VM_ERROR_INVALID_PARAMETER_VALUE;
}
params->maxCodeSize = intValue;
return VM_SUCCESS;
}
static VMErrorCode
processMinPermSpaceSizeOption(const char* originalArgument, VMParameters * params)
{
long long intValue = parseByteSize(originalArgument);
if(intValue < 0)
{
logError("Invalid option for min perm space size: %s\n", originalArgument);
vm_printUsageTo(stderr);
return VM_ERROR_INVALID_PARAMETER_VALUE;
}
params->minPermSpaceSize = intValue;
return VM_SUCCESS;
}
static VMErrorCode
processEdenSizeOption(const char* originalArgument, VMParameters * params)
{
long long intValue = parseByteSize(originalArgument);
if(intValue < 0)
{
logError("Invalid option for eden: %s\n", originalArgument);
vm_printUsageTo(stderr);
return VM_ERROR_INVALID_PARAMETER_VALUE;
}
params->edenSize = intValue;
return VM_SUCCESS;
}
static VMErrorCode
processWorkerOption(const char* argument, VMParameters * params)
{
params->isWorker = true;
return VM_SUCCESS;
}
static VMErrorCode
processHelpOption(const char* argument, VMParameters * params)
{
(void)argument;
vm_printUsageTo(stdout);
return VM_ERROR_EXIT_WITH_SUCCESS;
}
static VMErrorCode
processPrintVersionOption(const char* argument, VMParameters * params)
{
(void)argument;
printf("%s\n", getVMVersion());
printf("Built from: %s\n", getSourceVersion());
return VM_ERROR_EXIT_WITH_SUCCESS;
}
static VMErrorCode
processVMOptions(VMParameters* parameters)
{
VMParameterVector *vector = ¶meters->vmParameters;
for(size_t i = 1; i < vector->count; ++i)
{
const char *param = vector->parameters[i];
if(!param)
{
break;
}
// We only care about specific parameters here.
if(*param != '-')
{
continue;
}
#ifdef __APPLE__
// Ignore the process serial number special argument passed to OS X applications.
if(strncmp(param, "-psn_", 5) == 0)
{
continue;
}
#endif
// Ignore the leading dashes (--)
const char *argumentName = param + 1;
if(*argumentName == '-')
{
++argumentName;
}
// Find the argument value.
const char *argumentValue = strchr(argumentName, '=');
size_t argumentNameSize = strlen(argumentName);
if(argumentValue != NULL)
{
argumentNameSize = argumentValue - argumentName;
++argumentValue;
}
// Find a matching parameter
const VMParameterSpec *paramSpec = findParameterWithName(argumentName, argumentNameSize);
if(!paramSpec)
{
logError("Invalid or unknown VM parameter %s\n", param);
vm_printUsageTo(stderr);
return VM_ERROR_INVALID_PARAMETER;
}
// If the parameter has a required argument, it may be passed as the next parameter in the vector.
if(paramSpec->hasArgument)
{
// Try to fetch the argument from additional means
if(argumentValue == NULL)
{
if(i + 1 < vector->count)
{
argumentValue = vector->parameters[++i];
}
}
// Make sure the argument value is present.
if(argumentValue == NULL)
{
logError("VM parameter %s requires a value\n", param);
vm_printUsageTo(stderr);
return VM_ERROR_INVALID_PARAMETER_VALUE;
}
}
// Invoke the VM parameter processing function.
if(paramSpec->function)
{
VMErrorCode error = paramSpec->function(argumentValue, parameters);
if(error) return error;
}
}
return VM_SUCCESS;
}
EXPORT(VMErrorCode)
vm_parameters_parse(int argc, const char** argv, VMParameters* parameters)
{
char* fullPath;
#ifdef __APPLE__
//If it is OSX I read parameters from the PList
fillParametersFromPList(parameters);
#endif
//We read the arguments from the command line, and override whatever is set before
VMErrorCode error = fillUpImageName(argc, argv, parameters);
if(error) return error;
// Split the argument vector in two separate vectors (If there is no Image, it gives a default one).
error = splitVMAndImageParameters(argc, argv, parameters);
if(error) return error;
// I get the VM location from the argv[0]
char *fullPathBuffer = (char*)calloc(1, FILENAME_MAX);
if(!fullPathBuffer)
{
vm_parameters_destroy(parameters);
return VM_ERROR_OUT_OF_MEMORY;
}
#if _WIN32
WCHAR pathString[MAX_PATH];
char encodedPath[MAX_PATH];
GetModuleFileNameW(NULL, pathString, MAX_PATH);
WideCharToMultiByte(CP_UTF8, 0, pathString, -1, encodedPath, FILENAME_MAX, NULL, 0);
fullPath = getFullPath(encodedPath, fullPathBuffer, FILENAME_MAX);
#else
fullPath = getFullPath(argv[0], fullPathBuffer, FILENAME_MAX);
#endif
setVMPath(fullPath);
free(fullPathBuffer);
error = processVMOptions(parameters);
if(error)
{
vm_parameters_destroy(parameters);
return error;
}
logParameters(parameters);
return VM_SUCCESS;
}
EXPORT(VMErrorCode)
vm_parameters_init(VMParameters *parameters){
parameters->vmParameters.count = 0;
parameters->vmParameters.parameters = NULL;
parameters->imageParameters.count = 0;
parameters->imageParameters.parameters = NULL;
parameters->maxStackFramesToPrint = 0;
parameters->maxCodeSize = 0;
parameters->maxOldSpaceSize = 0;
parameters->edenSize = 0;
parameters->minPermSpaceSize = 0;
parameters->imageFileName = NULL;
parameters->isDefaultImage = false;
parameters->defaultImageFound = false;
parameters->isInteractiveSession = false;
parameters->isWorker = false;
return VM_SUCCESS;
}