b74d3d6fca01735dc1b5186d9b6b5bf7a5123084
[cacao.git] / src / vmcore / options.c
1 /* src/vmcore/options.c - contains global options
2
3    Copyright (C) 1996-2005, 2006, 2007, 2008
4    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5
6    This file is part of CACAO.
7
8    This program is free software; you can redistribute it and/or
9    modify it under the terms of the GNU General Public License as
10    published by the Free Software Foundation; either version 2, or (at
11    your option) any later version.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23 */
24
25
26 #include "config.h"
27
28 #include <limits.h>
29 #include <stdint.h>
30 #include <stdio.h>
31 #include <stdlib.h>
32
33 #include "mm/memory.h"
34
35 #include "native/jni.h"
36
37 #include "vm/vm.h"
38
39 #include "vmcore/options.h"
40 #include "vmcore/system.h"
41
42
43 /* command line option ********************************************************/
44
45 s4    opt_index = 0;            /* index of processed arguments               */
46 char *opt_arg;                  /* this one exports the option argument       */
47
48 bool opt_foo = false;           /* option for development                     */
49
50 bool opt_jar = false;
51
52 #if defined(ENABLE_JIT)
53 bool opt_jit = true;            /* JIT mode execution (default)               */
54 bool opt_intrp = false;         /* interpreter mode execution                 */
55 #else
56 bool opt_jit = false;           /* JIT mode execution                         */
57 bool opt_intrp = true;          /* interpreter mode execution (default)       */
58 #endif
59
60 bool opt_run = true;
61
62 s4   opt_heapmaxsize   = 0;     /* maximum heap size                          */
63 s4   opt_heapstartsize = 0;     /* initial heap size                          */
64 s4   opt_stacksize     = 0;     /* thread stack size                          */
65
66 bool opt_verbose = false;
67 bool opt_debugcolor = false;    /* use ANSI terminal sequences                */
68 bool compileall = false;
69
70 bool loadverbose = false;
71 bool initverbose = false;
72
73 bool opt_verboseclass     = false;
74 bool opt_verbosegc        = false;
75 bool opt_verbosejni       = false;
76 bool opt_verbosecall      = false;      /* trace all method invocation        */
77
78 bool showmethods = false;
79 bool showconstantpool = false;
80 bool showutf = false;
81
82 char *opt_method = NULL;
83 char *opt_signature = NULL;
84
85 bool compileverbose =  false;           /* trace compiler actions             */
86 bool showstack = false;
87
88 bool opt_showdisassemble    = false;    /* generate disassembler listing      */
89 bool opt_shownops           = false;
90 bool opt_showddatasegment   = false;    /* generate data segment listing      */
91 bool opt_showintermediate   = false;    /* generate intermediate code listing */
92
93 bool checkbounds = true;       /* check array bounds                         */
94 bool opt_noieee = false;       /* don't implement ieee compliant floats      */
95 bool checksync = true;         /* do synchronization                         */
96 #if defined(ENABLE_LOOP)
97 bool opt_loops = false;        /* optimize array accesses in loops           */
98 #endif
99
100 bool makeinitializations = true;
101
102 #if defined(ENABLE_STATISTICS)
103 bool opt_stat    = false;
104 bool opt_getloadingtime = false;   /* to measure the runtime                 */
105 bool opt_getcompilingtime = false; /* compute compile time                   */
106 #endif
107 #if defined(ENABLE_VERIFIER)
108 bool opt_verify  = true;       /* true if classfiles should be verified      */
109 #endif
110
111 #if defined(ENABLE_PROFILING)
112 bool opt_prof    = false;
113 bool opt_prof_bb = false;
114 #endif
115
116
117 /* optimization options *******************************************************/
118
119 #if defined(ENABLE_IFCONV)
120 bool opt_ifconv = false;
121 #endif
122
123 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
124 bool opt_lsra = false;
125 #endif
126 #if defined(ENABLE_SSA)
127 bool opt_ssa_dce = false;          /* enable dead code elemination */
128 bool opt_ssa_cp = false;           /* enable copy propagation      */
129 #endif
130
131
132 /* interpreter options ********************************************************/
133
134 #if defined(ENABLE_INTRP)
135 bool opt_no_dynamic = false;            /* suppress dynamic superinstructions */
136 bool opt_no_replication = false;        /* don't use replication in intrp     */
137 bool opt_no_quicksuper = false;         /* instructions for quickening cannot be
138                                                                                    part of dynamic superinstructions */
139
140 s4   opt_static_supers = 0x7fffffff;
141 bool vm_debug = false;          /* XXX this should be called `opt_trace'      */
142 #endif
143
144 #if defined(ENABLE_DEBUG_FILTER)
145 const char *opt_filter_verbosecall_include = 0;
146 const char *opt_filter_verbosecall_exclude = 0;
147 const char *opt_filter_show_method = 0;
148 #endif
149
150
151 /* -XX options ****************************************************************/
152
153 /* NOTE: For better readability keep these alpha-sorted. */
154
155 /* Options which must always be available (production options in
156    HotSpot). */
157
158 int64_t  opt_MaxDirectMemorySize          = -1;
159 int      opt_MaxPermSize                  = 0;
160 int      opt_PermSize                     = 0;
161 int      opt_ThreadStackSize              = 0;
162
163 /* Debugging options which can be turned off. */
164
165 int      opt_DebugExceptions              = 0;
166 int      opt_DebugFinalizer               = 0;
167 int      opt_DebugLocalReferences         = 0;
168 int      opt_DebugLocks                   = 0;
169 int      opt_DebugPackage                 = 0;
170 int      opt_DebugPatcher                 = 0;
171 int      opt_DebugProperties              = 0;
172 int      opt_DebugStackFrameInfo          = 0;
173 int      opt_DebugStackTrace              = 0;
174 int      opt_DebugThreads                 = 0;
175 #if defined(ENABLE_DISASSEMBLER)
176 int      opt_DisassembleStubs             = 0;
177 #endif
178 #if defined(ENABLE_GC_CACAO)
179 int      opt_GCDebugRootSet               = 0;
180 int      opt_GCStress                     = 0;
181 #endif
182 #if defined(ENABLE_INLINING)
183 int      opt_Inline                       = 0;
184 #if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
185 int      opt_InlineAll                    = 0;
186 int      opt_InlineCount                  = INT_MAX;
187 int      opt_InlineMaxSize                = INT_MAX;
188 int      opt_InlineMinSize                = 0;
189 #endif
190 #endif
191 int      opt_PrintConfig                  = 0;
192 int      opt_ProfileGCMemoryUsage         = 0;
193 int      opt_ProfileMemoryUsage           = 0;
194 FILE    *opt_ProfileMemoryUsageGNUPlot    = NULL;
195 #if defined(ENABLE_REPLACEMENT)
196 int      opt_TestReplacement              = 0;
197 #endif
198 int      opt_TraceCompilerCalls           = 0;
199 int      opt_TraceExceptions              = 0;
200 #if defined(ENABLE_INLINING) && !defined(NDEBUG)
201 int      opt_TraceInlining                = 0;
202 #endif
203 int      opt_TraceJavaCalls               = 0;
204 int      opt_TraceJNICalls                = 0;
205 int      opt_TraceJVMCalls                = 0;
206 int      opt_TraceJVMCallsVerbose         = 0;
207 int      opt_TraceLinkClass               = 0;
208 #if defined(ENABLE_REPLACEMENT)
209 int      opt_TraceReplacement             = 0;
210 #endif
211 int      opt_TraceSubsystemInitialization = 0;
212 int      opt_TraceTraps                   = 0;
213
214
215 enum {
216         OPT_TYPE_BOOLEAN,
217         OPT_TYPE_VALUE
218 };
219
220 enum {
221         /* Options which must always be available (production options in
222            HotSpot). */
223
224         OPT_MaxDirectMemorySize,
225         OPT_MaxPermSize,
226         OPT_PermSize,
227         OPT_ThreadStackSize,
228
229         /* Debugging options which can be turned off. */
230
231         OPT_DebugExceptions,
232         OPT_DebugFinalizer,
233         OPT_DebugLocalReferences,
234         OPT_DebugLocks,
235         OPT_DebugPackage,
236         OPT_DebugPatcher,
237         OPT_DebugProperties,
238         OPT_DebugStackFrameInfo,
239         OPT_DebugStackTrace,
240         OPT_DebugThreads,
241         OPT_DisassembleStubs,
242         OPT_GCDebugRootSet,
243         OPT_GCStress,
244         OPT_Inline,
245         OPT_InlineAll,
246         OPT_InlineCount,
247         OPT_InlineMaxSize,
248         OPT_InlineMinSize,
249         OPT_PrintConfig,
250         OPT_ProfileGCMemoryUsage,
251         OPT_ProfileMemoryUsage,
252         OPT_ProfileMemoryUsageGNUPlot,
253         OPT_TestReplacement,
254         OPT_TraceCompilerCalls,
255         OPT_TraceExceptions,
256         OPT_TraceInlining,
257         OPT_TraceJavaCalls,
258         OPT_TraceJNICalls,
259         OPT_TraceJVMCalls,
260         OPT_TraceJVMCallsVerbose,
261         OPT_TraceLinkClass,
262         OPT_TraceReplacement,
263         OPT_TraceSubsystemInitialization,
264         OPT_TraceTraps,
265         OPT_Vmlog,
266         OPT_VmlogStrings,
267         OPT_VmlogIgnore
268 };
269
270
271 option_t options_XX[] = {
272         /* Options which must always be available (production options in
273            HotSpot). */
274
275         { "MaxDirectMemorySize",          OPT_MaxDirectMemorySize,          OPT_TYPE_VALUE,   "Maximum total size of NIO direct-buffer allocations" },
276         { "MaxPermSize",                  OPT_MaxPermSize,                  OPT_TYPE_VALUE,   "not implemented" },
277         { "PermSize",                     OPT_PermSize,                     OPT_TYPE_VALUE,   "not implemented" },
278         { "ThreadStackSize",              OPT_ThreadStackSize,              OPT_TYPE_VALUE,   "TODO" },
279
280         /* Debugging options which can be turned off. */
281
282         { "DebugExceptions",              OPT_DebugExceptions,              OPT_TYPE_BOOLEAN, "debug exceptions" },
283         { "DebugFinalizer",               OPT_DebugFinalizer,               OPT_TYPE_BOOLEAN, "debug finalizer thread" },
284         { "DebugLocalReferences",         OPT_DebugLocalReferences,         OPT_TYPE_BOOLEAN, "print debug information for local reference tables" },
285         { "DebugLocks",                   OPT_DebugLocks,                   OPT_TYPE_BOOLEAN, "print debug information for locks" },
286         { "DebugPackage",                 OPT_DebugPackage,                 OPT_TYPE_BOOLEAN, "debug Java boot-packages" },
287         { "DebugPatcher",                 OPT_DebugPatcher,                 OPT_TYPE_BOOLEAN, "debug JIT code patching" },
288         { "DebugProperties",              OPT_DebugProperties,              OPT_TYPE_BOOLEAN, "print debug information for properties" },
289         { "DebugStackFrameInfo",          OPT_DebugStackFrameInfo,          OPT_TYPE_BOOLEAN, "TODO" },
290         { "DebugStackTrace",              OPT_DebugStackTrace,              OPT_TYPE_BOOLEAN, "debug stacktrace creation" },
291         { "DebugThreads",                 OPT_DebugThreads,                 OPT_TYPE_BOOLEAN, "print debug information for threads" },
292 #if defined(ENABLE_DISASSEMBLER)
293         { "DisassembleStubs",             OPT_DisassembleStubs,             OPT_TYPE_BOOLEAN, "disassemble builtin and native stubs when generated" },
294 #endif
295 #if defined(ENABLE_GC_CACAO)
296         { "GCDebugRootSet",               OPT_GCDebugRootSet,               OPT_TYPE_BOOLEAN, "GC: print root-set at collection" },
297         { "GCStress",                     OPT_GCStress,                     OPT_TYPE_BOOLEAN, "GC: forced collection at every allocation" },
298 #endif
299 #if defined(ENABLE_INLINING)
300         { "Inline",                       OPT_Inline,                       OPT_TYPE_BOOLEAN, "enable method inlining" },
301 #if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
302         { "InlineAll",                    OPT_InlineAll,                    OPT_TYPE_BOOLEAN, "use inlining in all compilations" },
303         { "InlineCount",                  OPT_InlineCount,                  OPT_TYPE_VALUE,   "stop inlining after the given number of roots" },
304         { "InlineMaxSize",                OPT_InlineMaxSize,                OPT_TYPE_VALUE,   "maximum size for inlined result" },
305         { "InlineMinSize",                OPT_InlineMinSize,                OPT_TYPE_VALUE,   "minimum size for inlined result" },
306 #endif
307 #endif
308         { "PrintConfig",                  OPT_PrintConfig,                  OPT_TYPE_BOOLEAN, "print VM configuration" },
309         { "ProfileGCMemoryUsage",         OPT_ProfileGCMemoryUsage,         OPT_TYPE_VALUE,   "profiles GC memory usage in the given interval, <value> is in seconds (default: 5)" },
310         { "ProfileMemoryUsage",           OPT_ProfileMemoryUsage,           OPT_TYPE_VALUE,   "TODO" },
311         { "ProfileMemoryUsageGNUPlot",    OPT_ProfileMemoryUsageGNUPlot,    OPT_TYPE_VALUE,   "TODO" },
312 #if defined(ENABLE_REPLACEMENT)
313         { "TestReplacement",              OPT_TestReplacement,              OPT_TYPE_BOOLEAN, "activate all replacement points during code generation" },
314 #endif
315         { "TraceCompilerCalls",           OPT_TraceCompilerCalls,           OPT_TYPE_BOOLEAN, "trace JIT compiler calls" },
316         { "TraceExceptions",              OPT_TraceExceptions,              OPT_TYPE_BOOLEAN, "trace Exception throwing" },
317 #if defined(ENABLE_INLINING) && !defined(NDEBUG)
318         { "TraceInlining",                OPT_TraceInlining,                OPT_TYPE_VALUE,   "trace method inlining with the given verbosity level (default: 1)" },
319 #endif
320 #if !defined(ENABLE_VMLOG)
321         { "TraceJavaCalls",               OPT_TraceJavaCalls,               OPT_TYPE_BOOLEAN, "trace Java method calls" },
322 #endif
323         { "TraceJNICalls",                OPT_TraceJNICalls,                OPT_TYPE_BOOLEAN, "trace JNI method calls" },
324         { "TraceJVMCalls",                OPT_TraceJVMCalls,                OPT_TYPE_BOOLEAN, "trace JVM method calls but omit very frequent ones" },
325         { "TraceJVMCallsVerbose",         OPT_TraceJVMCallsVerbose,         OPT_TYPE_BOOLEAN, "trace all JVM method calls" },
326         { "TraceLinkClass",               OPT_TraceLinkClass,               OPT_TYPE_BOOLEAN, "trace class linking" },
327 #if defined(ENABLE_REPLACEMENT)
328         { "TraceReplacement",             OPT_TraceReplacement,             OPT_TYPE_VALUE,   "trace on-stack replacement with the given verbosity level (default: 1)" },
329 #endif
330         { "TraceSubsystemInitialization", OPT_TraceSubsystemInitialization, OPT_TYPE_BOOLEAN, "trace initialization of subsystems" },
331         { "TraceTraps",                   OPT_TraceTraps,                   OPT_TYPE_BOOLEAN, "trace traps generated by JIT code" },
332 #if defined(ENABLE_VMLOG)
333         { "Vmlog",                        OPT_Vmlog,                        OPT_TYPE_VALUE,   "prefix for vmlog trace files (enables vmlog)" },
334         { "VmlogStrings",                 OPT_VmlogStrings,                 OPT_TYPE_VALUE,   "prefix of vmlog string file to load" },
335         { "VmlogIgnore",                  OPT_VmlogIgnore,                  OPT_TYPE_VALUE,   "prefix of vmlog ignore file to load" },
336 #endif
337
338         /* end marker */
339
340         { NULL,                           -1,                               -1,               NULL }
341 };
342
343
344 /* options_get *****************************************************************
345
346    DOCUMENT ME!!!
347
348 *******************************************************************************/
349
350 int options_get(opt_struct *opts, JavaVMInitArgs *vm_args)
351 {
352         char *option;
353         int   i;
354
355         if (opt_index >= vm_args->nOptions)
356                 return OPT_DONE;
357
358         /* get the current option */
359
360         option = vm_args->options[opt_index].optionString;
361
362         if ((option == NULL) || (option[0] != '-'))
363                 return OPT_DONE;
364
365         for (i = 0; opts[i].name; i++) {
366                 if (!opts[i].arg) {
367                         /* boolean option found */
368
369                         if (strcmp(option + 1, opts[i].name) == 0) {
370                                 opt_index++;
371                                 return opts[i].value;
372                         }
373
374                 } else {
375                         /* parameter option found */
376
377                         /* with a space between */
378
379                         if (strcmp(option + 1, opts[i].name) == 0) {
380                                 opt_index++;
381
382                                 if (opt_index < vm_args->nOptions) {
383                                         opt_arg = system_strdup(vm_args->options[opt_index].optionString);
384                                         opt_index++;
385                                         return opts[i].value;
386                                 }
387
388                                 return OPT_ERROR;
389
390                         } else {
391                                 /* parameter and option have no space between */
392
393                                 /* FIXME: this assumption is plain wrong, hits you if there is a
394                                  * parameter with no argument starting with same letter as param with argument
395                                  * but named after that one, ouch! */
396
397                                 size_t l = system_strlen(opts[i].name);
398
399                                 if (system_strlen(option + 1) > l) {
400                                         if (memcmp(option + 1, opts[i].name, l) == 0) {
401                                                 opt_index++;
402                                                 opt_arg = system_strdup(option + 1 + l);
403                                                 return opts[i].value;
404                                         }
405                                 }
406                         }
407                 }
408         }
409
410         return OPT_ERROR;
411 }
412
413
414 /* options_xxusage *************************************************************
415
416    Print usage message for debugging options.
417
418 *******************************************************************************/
419
420 static void options_xxusage(void)
421 {
422         option_t *opt;
423         int       length;
424         int       i;
425         char     *c;
426
427         /* Prevent compiler warning. */
428
429         length = 0;
430
431         for (opt = options_XX; opt->name != NULL; opt++) {
432                 printf("    -XX:");
433
434                 switch (opt->type) {
435                 case OPT_TYPE_BOOLEAN:
436                         printf("+%s", opt->name);
437                         length = system_strlen("    -XX:+") + system_strlen(opt->name);
438                         break;
439
440                 case OPT_TYPE_VALUE:
441                         printf("%s=<value>", opt->name);
442                         length = system_strlen("    -XX:") + system_strlen(opt->name) +
443                                 system_strlen("=<value>");
444                         break;
445
446                 default:
447                         vm_abort("options_xxusage: unkown option type %d", opt->type);
448                 }
449
450                 /* Check if the help fits into one 80-column line.
451                    Documentation starts at column 29. */
452
453                 if (length < (29 - 1)) {
454                         /* Print missing spaces up to column 29. */
455
456                         for (i = length; i < 29; i++)
457                                 printf(" ");
458                 }
459                 else {
460                         printf("\n");
461                         printf("                             "); /* 29 spaces */
462                 }
463
464                 /* Check documentation length. */
465
466                 length = system_strlen(opt->doc);
467
468                 if (length < (80 - 29)) {
469                         printf("%s", opt->doc);
470                 }
471                 else {
472                         for (c = opt->doc, i = 29; *c != 0; c++, i++) {
473                                 /* If we are at the end of the line, break it. */
474
475                                 if (i == 80) {
476                                         printf("\n");
477                                         printf("                             "); /* 29 spaces */
478                                         i = 29;
479                                 }
480
481                                 printf("%c", *c);
482                         }
483                 }
484
485                 printf("\n");
486         }
487
488         /* exit with error code */
489
490         exit(1);
491 }
492
493
494 /* options_xx ******************************************************************
495
496    Handle -XX: options.
497
498 *******************************************************************************/
499
500 void options_xx(JavaVMInitArgs *vm_args)
501 {
502         const char *name;
503         const char *start;
504         char       *end;
505         int         length;
506         int         enable;
507         char       *value;
508         option_t   *opt;
509         char       *filename;
510         FILE       *file;
511         int         i;
512
513         /* Iterate over all passed options. */
514
515         for (i = 0; i < vm_args->nOptions; i++) {
516                 /* Get the current option. */
517
518                 name = vm_args->options[i].optionString;
519
520                 /* Check for help (-XX). */
521
522                 if (strcmp(name, "-XX") == 0)
523                         options_xxusage();
524
525                 /* Check if the option start with -XX. */
526
527                 start = strstr(name, "-XX:");
528
529                 if ((start == NULL) || (start != name))
530                         continue;
531
532                 /* Check if the option is a boolean option. */
533
534                 if (name[4] == '+') {
535                         start  = name + 4 + 1;
536                         enable = 1;
537                 }
538                 else if (name[4] == '-') {
539                         start  = name + 4 + 1;
540                         enable = 0;
541                 }
542                 else {
543                         start  = name + 4;
544                         enable = -1;
545                 }
546
547                 /* Search for a '=' in the option name and get the option name
548                    length and the value of the option. */
549
550                 end = strchr(start, '=');
551
552                 if (end == NULL) {
553                         length = system_strlen(start);
554                         value  = NULL;
555                 }
556                 else {
557                         length = end - start;
558                         value  = end + 1;
559                 }
560
561                 /* Search the option in the option array. */
562
563                 for (opt = options_XX; opt->name != NULL; opt++) {
564                         if (strncmp(opt->name, start, length) == 0) {
565                                 /* Check if the options passed fits to the type. */
566
567                                 switch (opt->type) {
568                                 case OPT_TYPE_BOOLEAN:
569                                         if ((enable == -1) || (value != NULL))
570                                                 options_xxusage();
571                                         break;
572                                 case OPT_TYPE_VALUE:
573                                         if ((enable != -1) || (value == NULL))
574                                                 options_xxusage();
575                                         break;
576                                 default:
577                                         vm_abort("options_xx: unknown option type %d for option %s",
578                                                          opt->type, opt->name);
579                                 }
580
581                                 break;
582                         }
583                 }
584
585                 /* Process the option. */
586
587                 switch (opt->value) {
588
589                 /* Options which must always be available (production options
590                    in HotSpot). */
591
592                 case OPT_MaxDirectMemorySize:
593                         opt_MaxDirectMemorySize = system_atoi(value);
594                         break;
595
596                 case OPT_MaxPermSize:
597                         /* Currently ignored. */
598                         break;
599
600                 case OPT_PermSize:
601                         /* Currently ignored. */
602                         break;
603
604                 case OPT_ThreadStackSize:
605                         /* currently ignored */
606                         break;
607
608                 /* Debugging options which can be turned off. */
609
610                 case OPT_DebugExceptions:
611                         opt_DebugExceptions = enable;
612                         break;
613
614                 case OPT_DebugFinalizer:
615                         opt_DebugFinalizer = enable;
616                         break;
617
618                 case OPT_DebugLocalReferences:
619                         opt_DebugLocalReferences = enable;
620                         break;
621
622                 case OPT_DebugLocks:
623                         opt_DebugLocks = enable;
624                         break;
625
626                 case OPT_DebugPackage:
627                         opt_DebugPackage = enable;
628                         break;
629
630                 case OPT_DebugPatcher:
631                         opt_DebugPatcher = enable;
632                         break;
633
634                 case OPT_DebugProperties:
635                         opt_DebugProperties = enable;
636                         break;
637
638                 case OPT_DebugStackFrameInfo:
639                         opt_DebugStackFrameInfo = enable;
640                         break;
641
642                 case OPT_DebugStackTrace:
643                         opt_DebugStackTrace = enable;
644                         break;
645
646                 case OPT_DebugThreads:
647                         opt_DebugThreads = enable;
648                         break;
649
650 #if defined(ENABLE_DISASSEMBLER)
651                 case OPT_DisassembleStubs:
652                         opt_DisassembleStubs = enable;
653                         break;
654 #endif
655
656 #if defined(ENABLE_GC_CACAO)
657                 case OPT_GCDebugRootSet:
658                         opt_GCDebugRootSet = enable;
659                         break;
660
661                 case OPT_GCStress:
662                         opt_GCStress = enable;
663                         break;
664 #endif
665
666 #if defined(ENABLE_INLINING)
667                 case OPT_Inline:
668                         opt_Inline = enable;
669                         break;
670 #if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
671                 case OPT_InlineAll:
672                         opt_InlineAll = enable;
673                         break;
674
675                 case OPT_InlineCount:
676                         if (value != NULL)
677                                 opt_InlineCount = system_atoi(value);
678                         break;
679
680                 case OPT_InlineMaxSize:
681                         if (value != NULL)
682                                 opt_InlineMaxSize = system_atoi(value);
683                         break;
684
685                 case OPT_InlineMinSize:
686                         if (value != NULL)
687                                 opt_InlineMinSize = system_atoi(value);
688                         break;
689 #endif
690 #endif
691
692                 case OPT_PrintConfig:
693                         opt_PrintConfig = enable;
694                         break;
695
696                 case OPT_ProfileGCMemoryUsage:
697                         if (value == NULL)
698                                 opt_ProfileGCMemoryUsage = 5;
699                         else
700                                 opt_ProfileGCMemoryUsage = system_atoi(value);
701                         break;
702
703                 case OPT_ProfileMemoryUsage:
704                         if (value == NULL)
705                                 opt_ProfileMemoryUsage = 5;
706                         else
707                                 opt_ProfileMemoryUsage = system_atoi(value);
708
709 # if defined(ENABLE_STATISTICS)
710                         /* we also need statistics */
711
712                         opt_stat = true;
713 # endif
714                         break;
715
716                 case OPT_ProfileMemoryUsageGNUPlot:
717                         if (value == NULL)
718                                 filename = "profile.dat";
719                         else
720                                 filename = value;
721
722                         file = fopen(filename, "w");
723
724                         if (file == NULL)
725                                 vm_abort_errno("options_xx: fopen failed");
726
727                         opt_ProfileMemoryUsageGNUPlot = file;
728                         break;
729
730 #if defined(ENABLE_REPLACEMENT)
731                 case OPT_TestReplacement:
732                         opt_TestReplacement = enable;
733                         break;
734 #endif
735
736                 case OPT_TraceCompilerCalls:
737                         opt_TraceCompilerCalls = enable;
738                         break;
739
740                 case OPT_TraceExceptions:
741                         opt_TraceExceptions = enable;
742                         break;
743
744 #if defined(ENABLE_INLINING) && !defined(NDEBUG)
745                 case OPT_TraceInlining:
746                         if (value == NULL)
747                                 opt_TraceInlining = 1;
748                         else
749                                 opt_TraceInlining = system_atoi(value);
750                         break;
751 #endif
752
753                 case OPT_TraceJavaCalls:
754                         opt_verbosecall = enable;
755                         opt_TraceJavaCalls = enable;
756                         break;
757
758                 case OPT_TraceJNICalls:
759                         opt_TraceJNICalls = enable;
760                         break;
761
762                 case OPT_TraceJVMCalls:
763                         opt_TraceJVMCalls = enable;
764                         break;
765
766                 case OPT_TraceJVMCallsVerbose:
767                         opt_TraceJVMCallsVerbose = enable;
768                         break;
769
770                 case OPT_TraceLinkClass:
771                         opt_TraceLinkClass = enable;
772                         break;
773
774 #if defined(ENABLE_REPLACEMENT)
775                 case OPT_TraceReplacement:
776                         if (value == NULL)
777                                 opt_TraceReplacement = 1;
778                         else
779                                 opt_TraceReplacement = system_atoi(value);
780                         break;
781 #endif
782
783                 case OPT_TraceSubsystemInitialization:
784                         opt_TraceSubsystemInitialization = enable;
785                         break;
786
787                 case OPT_TraceTraps:
788                         opt_TraceTraps = enable;
789                         break;
790
791 #if defined(ENABLE_VMLOG)
792                 case OPT_Vmlog:
793                         if (value == NULL)
794                                 vmlog_cacao_set_prefix("vmlog");
795                         else
796                                 vmlog_cacao_set_prefix(value);
797                         opt_verbosecall = 1;
798                         opt_TraceJavaCalls = 1;
799                         break;
800
801                 case OPT_VmlogStrings:
802                         if (value != NULL)
803                                 vmlog_cacao_set_stringprefix(value);
804                         break;
805
806                 case OPT_VmlogIgnore:
807                         if (value != NULL)
808                                 vmlog_cacao_set_ignoreprefix(value);
809                         break;
810 #endif
811
812                 default:
813                         printf("Unknown -XX option: %s\n", name);
814                         break;
815                 }
816         }
817 }
818
819
820 /*
821  * These are local overrides for various environment variables in Emacs.
822  * Please do not remove this and leave it at the end of the file, where
823  * Emacs will automagically detect them.
824  * ---------------------------------------------------------------------
825  * Local variables:
826  * mode: c
827  * indent-tabs-mode: t
828  * c-basic-offset: 4
829  * tab-width: 4
830  * End:
831  */