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