e9ae46fbcd763f25f93db60501fea452229bb28d
[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 int      opt_TraceHPI                     = 0;
201 #if defined(ENABLE_INLINING) && !defined(NDEBUG)
202 int      opt_TraceInlining                = 0;
203 #endif
204 int      opt_TraceJavaCalls               = 0;
205 int      opt_TraceJNICalls                = 0;
206 int      opt_TraceJVMCalls                = 0;
207 int      opt_TraceJVMCallsVerbose         = 0;
208 int      opt_TraceLinkClass               = 0;
209 #if defined(ENABLE_REPLACEMENT)
210 int      opt_TraceReplacement             = 0;
211 #endif
212 int      opt_TraceSubsystemInitialization = 0;
213 int      opt_TraceTraps                   = 0;
214
215
216 enum {
217         OPT_TYPE_BOOLEAN,
218         OPT_TYPE_VALUE
219 };
220
221 enum {
222         /* Options which must always be available (production options in
223            HotSpot). */
224
225         OPT_MaxDirectMemorySize,
226         OPT_MaxPermSize,
227         OPT_PermSize,
228         OPT_ThreadStackSize,
229
230         /* Debugging options which can be turned off. */
231
232         OPT_DebugExceptions,
233         OPT_DebugFinalizer,
234         OPT_DebugLocalReferences,
235         OPT_DebugLocks,
236         OPT_DebugPackage,
237         OPT_DebugPatcher,
238         OPT_DebugProperties,
239         OPT_DebugStackFrameInfo,
240         OPT_DebugStackTrace,
241         OPT_DebugThreads,
242         OPT_DisassembleStubs,
243         OPT_GCDebugRootSet,
244         OPT_GCStress,
245         OPT_Inline,
246         OPT_InlineAll,
247         OPT_InlineCount,
248         OPT_InlineMaxSize,
249         OPT_InlineMinSize,
250         OPT_PrintConfig,
251         OPT_ProfileGCMemoryUsage,
252         OPT_ProfileMemoryUsage,
253         OPT_ProfileMemoryUsageGNUPlot,
254         OPT_TestReplacement,
255         OPT_TraceCompilerCalls,
256         OPT_TraceExceptions,
257         OPT_TraceHPI,
258         OPT_TraceInlining,
259         OPT_TraceJavaCalls,
260         OPT_TraceJNICalls,
261         OPT_TraceJVMCalls,
262         OPT_TraceJVMCallsVerbose,
263         OPT_TraceLinkClass,
264         OPT_TraceReplacement,
265         OPT_TraceSubsystemInitialization,
266         OPT_TraceTraps,
267         OPT_Vmlog,
268         OPT_VmlogStrings,
269         OPT_VmlogIgnore
270 };
271
272
273 option_t options_XX[] = {
274         /* Options which must always be available (production options in
275            HotSpot). */
276
277         { "MaxDirectMemorySize",          OPT_MaxDirectMemorySize,          OPT_TYPE_VALUE,   "Maximum total size of NIO direct-buffer allocations" },
278         { "MaxPermSize",                  OPT_MaxPermSize,                  OPT_TYPE_VALUE,   "not implemented" },
279         { "PermSize",                     OPT_PermSize,                     OPT_TYPE_VALUE,   "not implemented" },
280         { "ThreadStackSize",              OPT_ThreadStackSize,              OPT_TYPE_VALUE,   "TODO" },
281
282         /* Debugging options which can be turned off. */
283
284         { "DebugExceptions",              OPT_DebugExceptions,              OPT_TYPE_BOOLEAN, "debug exceptions" },
285         { "DebugFinalizer",               OPT_DebugFinalizer,               OPT_TYPE_BOOLEAN, "debug finalizer thread" },
286         { "DebugLocalReferences",         OPT_DebugLocalReferences,         OPT_TYPE_BOOLEAN, "print debug information for local reference tables" },
287         { "DebugLocks",                   OPT_DebugLocks,                   OPT_TYPE_BOOLEAN, "print debug information for locks" },
288         { "DebugPackage",                 OPT_DebugPackage,                 OPT_TYPE_BOOLEAN, "debug Java boot-packages" },
289         { "DebugPatcher",                 OPT_DebugPatcher,                 OPT_TYPE_BOOLEAN, "debug JIT code patching" },
290         { "DebugProperties",              OPT_DebugProperties,              OPT_TYPE_BOOLEAN, "print debug information for properties" },
291         { "DebugStackFrameInfo",          OPT_DebugStackFrameInfo,          OPT_TYPE_BOOLEAN, "TODO" },
292         { "DebugStackTrace",              OPT_DebugStackTrace,              OPT_TYPE_BOOLEAN, "debug stacktrace creation" },
293         { "DebugThreads",                 OPT_DebugThreads,                 OPT_TYPE_BOOLEAN, "print debug information for threads" },
294 #if defined(ENABLE_DISASSEMBLER)
295         { "DisassembleStubs",             OPT_DisassembleStubs,             OPT_TYPE_BOOLEAN, "disassemble builtin and native stubs when generated" },
296 #endif
297 #if defined(ENABLE_GC_CACAO)
298         { "GCDebugRootSet",               OPT_GCDebugRootSet,               OPT_TYPE_BOOLEAN, "GC: print root-set at collection" },
299         { "GCStress",                     OPT_GCStress,                     OPT_TYPE_BOOLEAN, "GC: forced collection at every allocation" },
300 #endif
301 #if defined(ENABLE_INLINING)
302         { "Inline",                       OPT_Inline,                       OPT_TYPE_BOOLEAN, "enable method inlining" },
303 #if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
304         { "InlineAll",                    OPT_InlineAll,                    OPT_TYPE_BOOLEAN, "use inlining in all compilations" },
305         { "InlineCount",                  OPT_InlineCount,                  OPT_TYPE_VALUE,   "stop inlining after the given number of roots" },
306         { "InlineMaxSize",                OPT_InlineMaxSize,                OPT_TYPE_VALUE,   "maximum size for inlined result" },
307         { "InlineMinSize",                OPT_InlineMinSize,                OPT_TYPE_VALUE,   "minimum size for inlined result" },
308 #endif
309 #endif
310         { "PrintConfig",                  OPT_PrintConfig,                  OPT_TYPE_BOOLEAN, "print VM configuration" },
311         { "ProfileGCMemoryUsage",         OPT_ProfileGCMemoryUsage,         OPT_TYPE_VALUE,   "profiles GC memory usage in the given interval, <value> is in seconds (default: 5)" },
312         { "ProfileMemoryUsage",           OPT_ProfileMemoryUsage,           OPT_TYPE_VALUE,   "TODO" },
313         { "ProfileMemoryUsageGNUPlot",    OPT_ProfileMemoryUsageGNUPlot,    OPT_TYPE_VALUE,   "TODO" },
314 #if defined(ENABLE_REPLACEMENT)
315         { "TestReplacement",              OPT_TestReplacement,              OPT_TYPE_BOOLEAN, "activate all replacement points during code generation" },
316 #endif
317         { "TraceCompilerCalls",           OPT_TraceCompilerCalls,           OPT_TYPE_BOOLEAN, "trace JIT compiler calls" },
318         { "TraceExceptions",              OPT_TraceExceptions,              OPT_TYPE_BOOLEAN, "trace Exception throwing" },
319         { "TraceHPI",                     OPT_TraceHPI,                     OPT_TYPE_BOOLEAN, "Trace Host Porting Interface (HPI)" },
320 #if defined(ENABLE_INLINING) && !defined(NDEBUG)
321         { "TraceInlining",                OPT_TraceInlining,                OPT_TYPE_VALUE,   "trace method inlining with the given verbosity level (default: 1)" },
322 #endif
323 #if !defined(ENABLE_VMLOG)
324         { "TraceJavaCalls",               OPT_TraceJavaCalls,               OPT_TYPE_BOOLEAN, "trace Java method calls" },
325 #endif
326         { "TraceJNICalls",                OPT_TraceJNICalls,                OPT_TYPE_BOOLEAN, "trace JNI method calls" },
327         { "TraceJVMCalls",                OPT_TraceJVMCalls,                OPT_TYPE_BOOLEAN, "trace JVM method calls but omit very frequent ones" },
328         { "TraceJVMCallsVerbose",         OPT_TraceJVMCallsVerbose,         OPT_TYPE_BOOLEAN, "trace all JVM method calls" },
329         { "TraceLinkClass",               OPT_TraceLinkClass,               OPT_TYPE_BOOLEAN, "trace class linking" },
330 #if defined(ENABLE_REPLACEMENT)
331         { "TraceReplacement",             OPT_TraceReplacement,             OPT_TYPE_VALUE,   "trace on-stack replacement with the given verbosity level (default: 1)" },
332 #endif
333         { "TraceSubsystemInitialization", OPT_TraceSubsystemInitialization, OPT_TYPE_BOOLEAN, "trace initialization of subsystems" },
334         { "TraceTraps",                   OPT_TraceTraps,                   OPT_TYPE_BOOLEAN, "trace traps generated by JIT code" },
335 #if defined(ENABLE_VMLOG)
336         { "Vmlog",                        OPT_Vmlog,                        OPT_TYPE_VALUE,   "prefix for vmlog trace files (enables vmlog)" },
337         { "VmlogStrings",                 OPT_VmlogStrings,                 OPT_TYPE_VALUE,   "prefix of vmlog string file to load" },
338         { "VmlogIgnore",                  OPT_VmlogIgnore,                  OPT_TYPE_VALUE,   "prefix of vmlog ignore file to load" },
339 #endif
340
341         /* end marker */
342
343         { NULL,                           -1,                               -1,               NULL }
344 };
345
346
347 /* options_get *****************************************************************
348
349    DOCUMENT ME!!!
350
351 *******************************************************************************/
352
353 int options_get(opt_struct *opts, JavaVMInitArgs *vm_args)
354 {
355         char *option;
356         int   i;
357
358         if (opt_index >= vm_args->nOptions)
359                 return OPT_DONE;
360
361         /* get the current option */
362
363         option = vm_args->options[opt_index].optionString;
364
365         if ((option == NULL) || (option[0] != '-'))
366                 return OPT_DONE;
367
368         for (i = 0; opts[i].name; i++) {
369                 if (!opts[i].arg) {
370                         /* boolean option found */
371
372                         if (strcmp(option + 1, opts[i].name) == 0) {
373                                 opt_index++;
374                                 return opts[i].value;
375                         }
376
377                 } else {
378                         /* parameter option found */
379
380                         /* with a space between */
381
382                         if (strcmp(option + 1, opts[i].name) == 0) {
383                                 opt_index++;
384
385                                 if (opt_index < vm_args->nOptions) {
386                                         opt_arg = system_strdup(vm_args->options[opt_index].optionString);
387                                         opt_index++;
388                                         return opts[i].value;
389                                 }
390
391                                 return OPT_ERROR;
392
393                         } else {
394                                 /* parameter and option have no space between */
395
396                                 /* FIXME: this assumption is plain wrong, hits you if there is a
397                                  * parameter with no argument starting with same letter as param with argument
398                                  * but named after that one, ouch! */
399
400                                 size_t l = system_strlen(opts[i].name);
401
402                                 if (system_strlen(option + 1) > l) {
403                                         if (memcmp(option + 1, opts[i].name, l) == 0) {
404                                                 opt_index++;
405                                                 opt_arg = system_strdup(option + 1 + l);
406                                                 return opts[i].value;
407                                         }
408                                 }
409                         }
410                 }
411         }
412
413         return OPT_ERROR;
414 }
415
416
417 /* options_xxusage *************************************************************
418
419    Print usage message for debugging options.
420
421 *******************************************************************************/
422
423 static void options_xxusage(void)
424 {
425         option_t *opt;
426         int       length;
427         int       i;
428         char     *c;
429
430         /* Prevent compiler warning. */
431
432         length = 0;
433
434         for (opt = options_XX; opt->name != NULL; opt++) {
435                 printf("    -XX:");
436
437                 switch (opt->type) {
438                 case OPT_TYPE_BOOLEAN:
439                         printf("+%s", opt->name);
440                         length = system_strlen("    -XX:+") + system_strlen(opt->name);
441                         break;
442
443                 case OPT_TYPE_VALUE:
444                         printf("%s=<value>", opt->name);
445                         length = system_strlen("    -XX:") + system_strlen(opt->name) +
446                                 system_strlen("=<value>");
447                         break;
448
449                 default:
450                         vm_abort("options_xxusage: unkown option type %d", opt->type);
451                 }
452
453                 /* Check if the help fits into one 80-column line.
454                    Documentation starts at column 29. */
455
456                 if (length < (29 - 1)) {
457                         /* Print missing spaces up to column 29. */
458
459                         for (i = length; i < 29; i++)
460                                 printf(" ");
461                 }
462                 else {
463                         printf("\n");
464                         printf("                             "); /* 29 spaces */
465                 }
466
467                 /* Check documentation length. */
468
469                 length = system_strlen(opt->doc);
470
471                 if (length < (80 - 29)) {
472                         printf("%s", opt->doc);
473                 }
474                 else {
475                         for (c = opt->doc, i = 29; *c != 0; c++, i++) {
476                                 /* If we are at the end of the line, break it. */
477
478                                 if (i == 80) {
479                                         printf("\n");
480                                         printf("                             "); /* 29 spaces */
481                                         i = 29;
482                                 }
483
484                                 printf("%c", *c);
485                         }
486                 }
487
488                 printf("\n");
489         }
490
491         /* exit with error code */
492
493         exit(1);
494 }
495
496
497 /* options_xx ******************************************************************
498
499    Handle -XX: options.
500
501 *******************************************************************************/
502
503 void options_xx(JavaVMInitArgs *vm_args)
504 {
505         const char *name;
506         const char *start;
507         char       *end;
508         int         length;
509         int         enable;
510         char       *value;
511         option_t   *opt;
512         char       *filename;
513         FILE       *file;
514         int         i;
515
516         /* Iterate over all passed options. */
517
518         for (i = 0; i < vm_args->nOptions; i++) {
519                 /* Get the current option. */
520
521                 name = vm_args->options[i].optionString;
522
523                 /* Check for help (-XX). */
524
525                 if (strcmp(name, "-XX") == 0)
526                         options_xxusage();
527
528                 /* Check if the option start with -XX. */
529
530                 start = strstr(name, "-XX:");
531
532                 if ((start == NULL) || (start != name))
533                         continue;
534
535                 /* Check if the option is a boolean option. */
536
537                 if (name[4] == '+') {
538                         start  = name + 4 + 1;
539                         enable = 1;
540                 }
541                 else if (name[4] == '-') {
542                         start  = name + 4 + 1;
543                         enable = 0;
544                 }
545                 else {
546                         start  = name + 4;
547                         enable = -1;
548                 }
549
550                 /* Search for a '=' in the option name and get the option name
551                    length and the value of the option. */
552
553                 end = strchr(start, '=');
554
555                 if (end == NULL) {
556                         length = system_strlen(start);
557                         value  = NULL;
558                 }
559                 else {
560                         length = end - start;
561                         value  = end + 1;
562                 }
563
564                 /* Search the option in the option array. */
565
566                 for (opt = options_XX; opt->name != NULL; opt++) {
567                         if (strncmp(opt->name, start, length) == 0) {
568                                 /* Check if the options passed fits to the type. */
569
570                                 switch (opt->type) {
571                                 case OPT_TYPE_BOOLEAN:
572                                         if ((enable == -1) || (value != NULL))
573                                                 options_xxusage();
574                                         break;
575                                 case OPT_TYPE_VALUE:
576                                         if ((enable != -1) || (value == NULL))
577                                                 options_xxusage();
578                                         break;
579                                 default:
580                                         vm_abort("options_xx: unknown option type %d for option %s",
581                                                          opt->type, opt->name);
582                                 }
583
584                                 break;
585                         }
586                 }
587
588                 /* Process the option. */
589
590                 switch (opt->value) {
591
592                 /* Options which must always be available (production options
593                    in HotSpot). */
594
595                 case OPT_MaxDirectMemorySize:
596                         opt_MaxDirectMemorySize = system_atoi(value);
597                         break;
598
599                 case OPT_MaxPermSize:
600                         /* Currently ignored. */
601                         break;
602
603                 case OPT_PermSize:
604                         /* Currently ignored. */
605                         break;
606
607                 case OPT_ThreadStackSize:
608                         /* currently ignored */
609                         break;
610
611                 /* Debugging options which can be turned off. */
612
613                 case OPT_DebugExceptions:
614                         opt_DebugExceptions = enable;
615                         break;
616
617                 case OPT_DebugFinalizer:
618                         opt_DebugFinalizer = enable;
619                         break;
620
621                 case OPT_DebugLocalReferences:
622                         opt_DebugLocalReferences = enable;
623                         break;
624
625                 case OPT_DebugLocks:
626                         opt_DebugLocks = enable;
627                         break;
628
629                 case OPT_DebugPackage:
630                         opt_DebugPackage = enable;
631                         break;
632
633                 case OPT_DebugPatcher:
634                         opt_DebugPatcher = enable;
635                         break;
636
637                 case OPT_DebugProperties:
638                         opt_DebugProperties = enable;
639                         break;
640
641                 case OPT_DebugStackFrameInfo:
642                         opt_DebugStackFrameInfo = enable;
643                         break;
644
645                 case OPT_DebugStackTrace:
646                         opt_DebugStackTrace = enable;
647                         break;
648
649                 case OPT_DebugThreads:
650                         opt_DebugThreads = enable;
651                         break;
652
653 #if defined(ENABLE_DISASSEMBLER)
654                 case OPT_DisassembleStubs:
655                         opt_DisassembleStubs = enable;
656                         break;
657 #endif
658
659 #if defined(ENABLE_GC_CACAO)
660                 case OPT_GCDebugRootSet:
661                         opt_GCDebugRootSet = enable;
662                         break;
663
664                 case OPT_GCStress:
665                         opt_GCStress = enable;
666                         break;
667 #endif
668
669 #if defined(ENABLE_INLINING)
670                 case OPT_Inline:
671                         opt_Inline = enable;
672                         break;
673 #if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
674                 case OPT_InlineAll:
675                         opt_InlineAll = enable;
676                         break;
677
678                 case OPT_InlineCount:
679                         if (value != NULL)
680                                 opt_InlineCount = system_atoi(value);
681                         break;
682
683                 case OPT_InlineMaxSize:
684                         if (value != NULL)
685                                 opt_InlineMaxSize = system_atoi(value);
686                         break;
687
688                 case OPT_InlineMinSize:
689                         if (value != NULL)
690                                 opt_InlineMinSize = system_atoi(value);
691                         break;
692 #endif
693 #endif
694
695                 case OPT_PrintConfig:
696                         opt_PrintConfig = enable;
697                         break;
698
699                 case OPT_ProfileGCMemoryUsage:
700                         if (value == NULL)
701                                 opt_ProfileGCMemoryUsage = 5;
702                         else
703                                 opt_ProfileGCMemoryUsage = system_atoi(value);
704                         break;
705
706                 case OPT_ProfileMemoryUsage:
707                         if (value == NULL)
708                                 opt_ProfileMemoryUsage = 5;
709                         else
710                                 opt_ProfileMemoryUsage = system_atoi(value);
711
712 # if defined(ENABLE_STATISTICS)
713                         /* we also need statistics */
714
715                         opt_stat = true;
716 # endif
717                         break;
718
719                 case OPT_ProfileMemoryUsageGNUPlot:
720                         if (value == NULL)
721                                 filename = "profile.dat";
722                         else
723                                 filename = value;
724
725                         file = fopen(filename, "w");
726
727                         if (file == NULL)
728                                 vm_abort_errno("options_xx: fopen failed");
729
730                         opt_ProfileMemoryUsageGNUPlot = file;
731                         break;
732
733 #if defined(ENABLE_REPLACEMENT)
734                 case OPT_TestReplacement:
735                         opt_TestReplacement = enable;
736                         break;
737 #endif
738
739                 case OPT_TraceCompilerCalls:
740                         opt_TraceCompilerCalls = enable;
741                         break;
742
743                 case OPT_TraceExceptions:
744                         opt_TraceExceptions = enable;
745                         break;
746
747                 case OPT_TraceHPI:
748                         opt_TraceHPI = enable;
749                         break;
750
751 #if defined(ENABLE_INLINING) && !defined(NDEBUG)
752                 case OPT_TraceInlining:
753                         if (value == NULL)
754                                 opt_TraceInlining = 1;
755                         else
756                                 opt_TraceInlining = system_atoi(value);
757                         break;
758 #endif
759
760                 case OPT_TraceJavaCalls:
761                         opt_verbosecall = enable;
762                         opt_TraceJavaCalls = enable;
763                         break;
764
765                 case OPT_TraceJNICalls:
766                         opt_TraceJNICalls = enable;
767                         break;
768
769                 case OPT_TraceJVMCalls:
770                         opt_TraceJVMCalls = enable;
771                         break;
772
773                 case OPT_TraceJVMCallsVerbose:
774                         opt_TraceJVMCallsVerbose = enable;
775                         break;
776
777                 case OPT_TraceLinkClass:
778                         opt_TraceLinkClass = enable;
779                         break;
780
781 #if defined(ENABLE_REPLACEMENT)
782                 case OPT_TraceReplacement:
783                         if (value == NULL)
784                                 opt_TraceReplacement = 1;
785                         else
786                                 opt_TraceReplacement = system_atoi(value);
787                         break;
788 #endif
789
790                 case OPT_TraceSubsystemInitialization:
791                         opt_TraceSubsystemInitialization = enable;
792                         break;
793
794                 case OPT_TraceTraps:
795                         opt_TraceTraps = enable;
796                         break;
797
798 #if defined(ENABLE_VMLOG)
799                 case OPT_Vmlog:
800                         if (value == NULL)
801                                 vmlog_cacao_set_prefix("vmlog");
802                         else
803                                 vmlog_cacao_set_prefix(value);
804                         opt_verbosecall = 1;
805                         opt_TraceJavaCalls = 1;
806                         break;
807
808                 case OPT_VmlogStrings:
809                         if (value != NULL)
810                                 vmlog_cacao_set_stringprefix(value);
811                         break;
812
813                 case OPT_VmlogIgnore:
814                         if (value != NULL)
815                                 vmlog_cacao_set_ignoreprefix(value);
816                         break;
817 #endif
818
819                 default:
820                         printf("Unknown -XX option: %s\n", name);
821                         break;
822                 }
823         }
824 }
825
826
827 /*
828  * These are local overrides for various environment variables in Emacs.
829  * Please do not remove this and leave it at the end of the file, where
830  * Emacs will automagically detect them.
831  * ---------------------------------------------------------------------
832  * Local variables:
833  * mode: c
834  * indent-tabs-mode: t
835  * c-basic-offset: 4
836  * tab-width: 4
837  * End:
838  */