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