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