CACAO
options.cpp
Go to the documentation of this file.
1 /* src/vm/options.cpp - contains global options
2 
3  Copyright (C) 1996-2013
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/dumpmemory.hpp"
34 
35 #include "vm/options.hpp"
36 #include "vm/os.hpp"
37 #include "vm/vm.hpp"
38 
39 #include "toolbox/Debug.hpp"
40 #include "toolbox/logging.hpp"
41 #include "toolbox/Option.hpp"
42 
43 
44 /* command line option ********************************************************/
45 
46 s4 opt_index = 0; /* index of processed arguments */
47 char *opt_arg; /* this one exports the option argument */
48 
49 bool opt_foo = false; /* option for development */
50 
51 bool opt_jar = false;
52 
53 #if defined(ENABLE_JIT)
54 bool opt_jit = true; /* JIT mode execution (default) */
55 bool opt_intrp = false; /* interpreter mode execution */
56 #else
57 bool opt_jit = false; /* JIT mode execution */
58 bool opt_intrp = true; /* interpreter mode execution (default) */
59 #endif
60 
61 bool opt_run = true;
62 
63 s4 opt_heapmaxsize = 0; /* maximum heap size */
64 s4 opt_heapstartsize = 0; /* initial heap size */
65 s4 opt_stacksize = 0; /* thread stack size */
66 
67 bool opt_verbose = false;
68 bool opt_debugcolor = false; /* use ANSI terminal sequences */
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 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 checksync = true; /* do synchronization */
91 #if defined(ENABLE_LOOP)
92 bool opt_loops = false; /* optimize array accesses in loops */
93 #endif
94 
95 bool makeinitializations = true;
96 
97 #if defined(ENABLE_STATISTICS)
98 bool opt_stat = false;
99 bool opt_getloadingtime = false; /* to measure the runtime */
100 bool opt_getcompilingtime = false; /* compute compile time */
101 #endif
102 #if defined(ENABLE_VERIFIER)
103 bool opt_verify = true; /* true if classfiles should be verified */
104 #endif
105 
106 #if defined(ENABLE_PROFILING)
107 bool opt_prof = false;
108 bool opt_prof_bb = false;
109 #endif
110 
111 #if defined(ENABLE_OPAGENT)
112 bool opt_opagent = false;
113 #endif
114 
115 /* optimization options *******************************************************/
116 
117 #if defined(ENABLE_IFCONV)
118 bool opt_ifconv = false;
119 #endif
120 
121 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
122 bool opt_lsra = false;
123 #endif
124 #if defined(ENABLE_SSA)
125 bool opt_ssa_dce = false; /* enable dead code elemination */
126 bool opt_ssa_cp = false; /* enable copy propagation */
127 #endif
128 
129 
130 /* interpreter options ********************************************************/
131 
132 #if defined(ENABLE_INTRP)
133 bool opt_no_dynamic = false; /* suppress dynamic superinstructions */
134 bool opt_no_replication = false; /* don't use replication in intrp */
135 bool opt_no_quicksuper = false; /* instructions for quickening cannot be
136  part of dynamic superinstructions */
137 
138 s4 opt_static_supers = 0x7fffffff;
139 bool vm_debug = false; /* XXX this should be called `opt_trace' */
140 #endif
141 
142 #if defined(ENABLE_DEBUG_FILTER)
145 const char *opt_filter_show_method = 0;
146 #endif
147 
148 
149 /* -XX options ****************************************************************/
150 
151 /* NOTE: For better readability keep these alpha-sorted. */
152 
153 /* Options which must always be available (production options in
154  HotSpot). */
155 
158 int opt_PermSize = 0;
160 
161 /* Debugging options which can be turned off. */
162 
166 char* opt_CompileMethod = NULL;
167 char* opt_CompileSignature = NULL;
176 #if defined(ENABLE_DISASSEMBLER)
177 int opt_DisassembleStubs = 0;
178 #endif
179 #if defined(ENABLE_OPAGENT)
180 int opt_EnableOpagent = 0;
181 #endif
182 #if defined(ENABLE_GC_CACAO)
183 int opt_GCDebugRootSet = 0;
184 int opt_GCStress = 0;
185 #endif
186 #if defined(ENABLE_INLINING)
187 int opt_Inline = 0;
188 #if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
189 int opt_InlineAll = 0;
190 int opt_InlineCount = INT_MAX;
191 int opt_InlineMaxSize = INT_MAX;
192 int opt_InlineMinSize = 0;
193 char* opt_InlineMethod = NULL;
194 Utf8String opt_InlineMethodUtf;
195 #endif
196 #endif
203 #if defined(ENABLE_REPLACEMENT)
204 int opt_TestReplacement = 0;
205 #endif
209 int opt_TraceHPI = 0;
210 #if defined(ENABLE_INLINING) && !defined(NDEBUG)
211 int opt_TraceInlining = 0;
212 #endif
214 bool opt_TraceJMMCalls = false;
218 #if defined(ENABLE_RT_TIMING)
219 FILE *opt_RtTimingLogfile = NULL;
220 bool opt_RtTimingCSV = false;
221 #endif
222 #if defined(ENABLE_STATISTICS)
223 FILE *opt_StatisticsLogfile = NULL;
224 bool opt_StatisticsCSV = false;
225 #endif
226 #if defined(ENABLE_JVMTI)
227 int opt_TraceJVMTICalls = 0;
228 #endif
230 #if defined(ENABLE_REPLACEMENT)
231 int opt_TraceReplacement = 0;
232 #endif
235 
236 
237 enum {
240 };
241 
242 enum {
243  /* Options which must always be available (production options in
244  HotSpot). */
245 
250 
251  /* Debugging options which can be turned off. */
252 
302 };
303 
304 
306  /* Options which must always be available (production options in
307  HotSpot). */
308 
309  { "MaxDirectMemorySize", OPT_MaxDirectMemorySize, OPT_TYPE_VALUE, "Maximum total size of NIO direct-buffer allocations" },
310  { "MaxPermSize", OPT_MaxPermSize, OPT_TYPE_VALUE, "not implemented" },
311  { "PermSize", OPT_PermSize, OPT_TYPE_VALUE, "not implemented" },
312  { "ThreadStackSize", OPT_ThreadStackSize, OPT_TYPE_VALUE, "TODO" },
313 
314  /* Debugging options which can be turned off. */
315 
316  { "AlwaysEmitLongBranches", OPT_AlwaysEmitLongBranches, OPT_TYPE_BOOLEAN, "Always emit long-branches." },
317  { "AlwaysMmapFirstPage", OPT_AlwaysMmapFirstPage, OPT_TYPE_BOOLEAN, "Always mmap memory page at address 0x0." },
318  { "CompileAll", OPT_CompileAll, OPT_TYPE_BOOLEAN, "compile all methods, no execution" },
319  { "CompileMethod", OPT_CompileMethod, OPT_TYPE_VALUE, "compile only a specific method" },
320  { "CompileSignature", OPT_CompileSignature, OPT_TYPE_VALUE, "specify signature for a specific method" },
321  { "DebugLocalReferences", OPT_DebugLocalReferences, OPT_TYPE_BOOLEAN, "print debug information for local reference tables" },
322  { "DebugLocks", OPT_DebugLocks, OPT_TYPE_BOOLEAN, "print debug information for locks" },
323  { "DebugPackage", OPT_DebugPackage, OPT_TYPE_BOOLEAN, "debug Java boot-packages" },
324  { "DebugPatcher", OPT_DebugPatcher, OPT_TYPE_BOOLEAN, "debug JIT code patching" },
325  { "DebugStackFrameInfo", OPT_DebugStackFrameInfo, OPT_TYPE_BOOLEAN, "TODO" },
326  { "DebugStackTrace", OPT_DebugStackTrace, OPT_TYPE_BOOLEAN, "debug stacktrace creation" },
327  { "DebugThreads", OPT_DebugThreads, OPT_TYPE_BOOLEAN, "print debug information for threads" },
328  { "ColorOutput", OPT_ColorOutput, OPT_TYPE_VALUE, "enable color output (yes, no, auto) [default=auto]" },
329 #if defined(ENABLE_DISASSEMBLER)
330  { "DisassembleStubs", OPT_DisassembleStubs, OPT_TYPE_BOOLEAN, "disassemble builtin and native stubs when generated" },
331 #endif
332 #if defined(ENABLE_OPAGENT)
333  { "EnableOpagent", OPT_EnableOpagent, OPT_TYPE_BOOLEAN, "enable providing JIT output to Oprofile" },
334 #endif
335 #if defined(ENABLE_GC_CACAO)
336  { "GCDebugRootSet", OPT_GCDebugRootSet, OPT_TYPE_BOOLEAN, "GC: print root-set at collection" },
337  { "GCStress", OPT_GCStress, OPT_TYPE_BOOLEAN, "GC: forced collection at every allocation" },
338 #endif
339 #if defined(ENABLE_INLINING)
340  { "Inline", OPT_Inline, OPT_TYPE_BOOLEAN, "enable method inlining" },
341 #if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
342  { "InlineAll", OPT_InlineAll, OPT_TYPE_BOOLEAN, "use inlining in all compilations" },
343  { "InlineCount", OPT_InlineCount, OPT_TYPE_VALUE, "stop inlining after the given number of roots" },
344  { "InlineMaxSize", OPT_InlineMaxSize, OPT_TYPE_VALUE, "maximum size for inlined result" },
345  { "InlineMinSize", OPT_InlineMinSize, OPT_TYPE_VALUE, "minimum size for inlined result" },
346  { "InlineMethod", OPT_InlineMethod, OPT_TYPE_VALUE, "inline only specified method" },
347 #endif
348 #endif
349  { "PrintConfig", OPT_PrintConfig, OPT_TYPE_BOOLEAN, "print VM configuration" },
350  { "PrintWarnings", OPT_PrintWarnings, OPT_TYPE_BOOLEAN, "print warnings about suspicious behavior"},
351  { "ProfileGCMemoryUsage", OPT_ProfileGCMemoryUsage, OPT_TYPE_VALUE, "profiles GC memory usage in the given interval, <value> is in seconds (default: 5)" },
352  { "ProfileMemoryUsage", OPT_ProfileMemoryUsage, OPT_TYPE_VALUE, "TODO" },
353  { "ProfileMemoryUsageGNUPlot", OPT_ProfileMemoryUsageGNUPlot, OPT_TYPE_VALUE, "TODO" },
354  { "RegallocSpillAll", OPT_RegallocSpillAll, OPT_TYPE_BOOLEAN, "spill all variables to the stack" },
355 #if defined(ENABLE_REPLACEMENT)
356  { "TestReplacement", OPT_TestReplacement, OPT_TYPE_BOOLEAN, "activate all replacement points during code generation" },
357 #endif
358  { "TraceBuiltinCalls", OPT_TraceBuiltinCalls, OPT_TYPE_BOOLEAN, "trace calls to VM builtin functions" },
359  { "TraceCompilerCalls", OPT_TraceCompilerCalls, OPT_TYPE_BOOLEAN, "trace JIT compiler calls" },
360  { "TraceExceptions", OPT_TraceExceptions, OPT_TYPE_BOOLEAN, "trace Exception throwing" },
361  { "TraceHPI", OPT_TraceHPI, OPT_TYPE_BOOLEAN, "Trace Host Porting Interface (HPI)" },
362 #if defined(ENABLE_INLINING) && !defined(NDEBUG)
363  { "TraceInlining", OPT_TraceInlining, OPT_TYPE_VALUE, "trace method inlining with the given verbosity level (default: 1)" },
364 #endif
365  { "TraceJavaCalls", OPT_TraceJavaCalls, OPT_TYPE_BOOLEAN, "trace Java method calls" },
366  { "TraceJMMCalls", OPT_TraceJMMCalls, OPT_TYPE_BOOLEAN, "trace JMM method calls" },
367  { "TraceJNICalls", OPT_TraceJNICalls, OPT_TYPE_BOOLEAN, "trace JNI method calls" },
368  { "TraceJVMCalls", OPT_TraceJVMCalls, OPT_TYPE_BOOLEAN, "trace JVM method calls but omit very frequent ones" },
369  { "TraceJVMCallsVerbose", OPT_TraceJVMCallsVerbose, OPT_TYPE_BOOLEAN, "trace all JVM method calls" },
370 #if defined(ENABLE_JVMTI)
371  { "TraceJVMTICalls", OPT_TraceJVMTICalls, OPT_TYPE_BOOLEAN, "trace JVMTI method calls" },
372 #endif
373  { "TraceLinkClass", OPT_TraceLinkClass, OPT_TYPE_BOOLEAN, "trace class linking" },
374 #if defined(ENABLE_REPLACEMENT)
375  { "TraceReplacement", OPT_TraceReplacement, OPT_TYPE_VALUE, "trace on-stack replacement with the given verbosity level (default: 1)" },
376 #endif
377  { "TraceSubsystemInitialization", OPT_TraceSubsystemInitialization, OPT_TYPE_BOOLEAN, "trace initialization of subsystems" },
378  { "TraceTraps", OPT_TraceTraps, OPT_TYPE_BOOLEAN, "trace traps generated by JIT code" },
379 #if defined(ENABLE_RT_TIMING)
380  { "RtTimingLogfile", OPT_RtTimingLogfile, OPT_TYPE_VALUE, "rt-timing logfile (default: rt-timing.log, use - for stdout)" },
381  { "RtTimingCSV", OPT_RtTimingCSV, OPT_TYPE_BOOLEAN, "enable csv output for rt-timing" },
382 #endif
383 #if defined(ENABLE_STATISTICS)
384  { "StatisticsLogfile", OPT_StatisticsLogfile, OPT_TYPE_VALUE, "statistics logfile (default: statistics.log, use - for stdout)" },
385  { "StatisticsCSV", OPT_StatisticsCSV, OPT_TYPE_BOOLEAN, "enable csv output for statistics" },
386 #endif
387 
388  /* end marker */
389 
390  { NULL, -1, -1, NULL }
391 };
392 
393 
394 /* options_get *****************************************************************
395 
396  DOCUMENT ME!!!
397 
398 *******************************************************************************/
399 
400 int options_get(opt_struct *opts, JavaVMInitArgs *vm_args)
401 {
402  char *option;
403  int i;
404 
405  if (opt_index >= vm_args->nOptions)
406  return OPT_DONE;
407 
408  /* get the current option */
409 
410  option = vm_args->options[opt_index].optionString;
411 
412  if ((option == NULL) || (option[0] != '-'))
413  return OPT_DONE;
414 
415  for (i = 0; opts[i].name; i++) {
416  if (!opts[i].arg) {
417  /* boolean option found */
418 
419  if (strcmp(option + 1, opts[i].name) == 0) {
420  opt_index++;
421  return opts[i].value;
422  }
423 
424  } else {
425  /* parameter option found */
426 
427  /* with a space between */
428 
429  if (strcmp(option + 1, opts[i].name) == 0) {
430  opt_index++;
431 
432  if (opt_index < vm_args->nOptions) {
433  opt_arg = os::strdup(vm_args->options[opt_index].optionString);
434  opt_index++;
435  return opts[i].value;
436  }
437 
438  return OPT_ERROR;
439 
440  } else {
441  /* parameter and option have no space between */
442 
443  /* FIXME: this assumption is plain wrong, hits you if there is a
444  * parameter with no argument starting with same letter as param with argument
445  * but named after that one, ouch! */
446 
447  size_t l = os::strlen(opts[i].name);
448 
449  if (os::strlen(option + 1) > l) {
450  if (memcmp(option + 1, opts[i].name, l) == 0) {
451  opt_index++;
452  opt_arg = os::strdup(option + 1 + l);
453  return opts[i].value;
454  }
455  }
456  }
457  }
458  }
459 
460  return OPT_ERROR;
461 }
462 
463 
464 /* options_xxusage *************************************************************
465 
466  Print usage message for debugging options.
467 
468 *******************************************************************************/
469 
470 static void options_xxusage(void)
471 {
472  option_t *opt;
473  int length;
474  int i;
475  const char *c;
476 
477  /* Prevent compiler warning. */
478 
479  length = 0;
480 
481  for (opt = options_XX; opt->name != NULL; opt++) {
482  printf(" -XX:");
483 
484  switch (opt->type) {
485  case OPT_TYPE_BOOLEAN:
486  printf("+%s", opt->name);
487  length = os::strlen(" -XX:+") + os::strlen(opt->name);
488  break;
489 
490  case OPT_TYPE_VALUE:
491  printf("%s=<value>", opt->name);
492  length = os::strlen(" -XX:") + os::strlen(opt->name) +
493  os::strlen("=<value>");
494  break;
495 
496  default:
497  vm_abort("options_xxusage: unkown option type %d", opt->type);
498  }
499 
500  /* Check if the help fits into one 80-column line.
501  Documentation starts at column 29. */
502 
503  if (length < (29 - 1)) {
504  /* Print missing spaces up to column 29. */
505 
506  for (i = length; i < 29; i++)
507  printf(" ");
508  }
509  else {
510  printf("\n");
511  printf(" "); /* 29 spaces */
512  }
513 
514  /* Check documentation length. */
515 
516  length = os::strlen(opt->doc);
517 
518  if (length < (80 - 29)) {
519  printf("%s", opt->doc);
520  }
521  else {
522  for (c = opt->doc, i = 29; *c != 0; c++, i++) {
523  /* If we are at the end of the line, break it. */
524 
525  if (i == 80) {
526  printf("\n");
527  printf(" "); /* 29 spaces */
528  i = 29;
529  }
530 
531  printf("%c", *c);
532  }
533  }
534 
535  printf("\n");
536  }
537 
539 
540  /* exit with error code */
541 
542  exit(1);
543 }
544 
545 
546 /* options_xx ******************************************************************
547 
548  Handle -XX: options.
549 
550 *******************************************************************************/
551 
552 void options_xx(JavaVMInitArgs *vm_args)
553 {
554  const char *name;
555  const char *start;
556  const char *end;
557  int length;
558  int enable;
559  char *value;
560  option_t *opt;
561  const char *filename;
562  FILE *file;
563  int i;
564 
565  /* Iterate over all passed options. */
566 
567  for (i = 0; i < vm_args->nOptions; i++) {
568  /* Get the current option. */
569 
570  name = vm_args->options[i].optionString;
571 
572  /* Check for help (-XX). */
573 
574  if (strcmp(name, "-XX") == 0)
575  options_xxusage();
576 
577  /* Check if the option start with -XX. */
578 
579  start = strstr(name, "-XX:");
580 
581  if ((start == NULL) || (start != name))
582  continue;
583 
584  /* Check if the option is a boolean option. */
585 
586  if (name[4] == '+') {
587  start = name + 4 + 1;
588  enable = 1;
589  }
590  else if (name[4] == '-') {
591  start = name + 4 + 1;
592  enable = 0;
593  }
594  else {
595  start = name + 4;
596  enable = -1;
597  }
598 
599  /* Search for a '=' in the option name and get the option name
600  length and the value of the option. */
601 
602  end = strchr(start, '=');
603 
604  if (end == NULL) {
605  length = os::strlen(start);
606  value = NULL;
607  }
608  else {
609  length = end - start;
610  value = (char*) (end + 1);
611  }
612 
613  /* Search the option in the option array. */
614 
615  for (opt = options_XX; opt->name != NULL; opt++) {
616  if (strncmp(opt->name, start, length) == 0) {
617  /* Check if the options passed fits to the type. */
618 
619  switch (opt->type) {
620  case OPT_TYPE_BOOLEAN:
621  if ((enable == -1) || (value != NULL))
622  options_xxusage();
623  break;
624  case OPT_TYPE_VALUE:
625  if ((enable != -1) || (value == NULL))
626  options_xxusage();
627  break;
628  default:
629  vm_abort("options_xx: unknown option type %d for option %s",
630  opt->type, opt->name);
631  }
632 
633  break;
634  }
635  }
636 
637  /* Process the option. */
638 
639  switch (opt->value) {
640 
641  /* Options which must always be available (production options
642  in HotSpot). */
643 
646  break;
647 
648  case OPT_MaxPermSize:
649  /* Currently ignored. */
650  break;
651 
652  case OPT_PermSize:
653  /* Currently ignored. */
654  break;
655 
656  case OPT_ThreadStackSize:
657  /* currently ignored */
658  break;
659 
660  /* Debugging options which can be turned off. */
661 
664  break;
665 
667  opt_AlwaysMmapFirstPage = enable;
668  break;
669 
670  case OPT_CompileAll:
671  opt_CompileAll = enable;
672  opt_run = false;
673  makeinitializations = false;
674  break;
675 
676  case OPT_CompileMethod:
677  opt_CompileMethod = value;
678  opt_run = false;
679  makeinitializations = false;
680  break;
681 
683  opt_CompileSignature = value;
684  break;
685 
687  opt_DebugLocalReferences = enable;
688  break;
689 
690  case OPT_DebugLocks:
691  opt_DebugLocks = enable;
692  break;
693 
694  case OPT_DebugPackage:
695  opt_DebugPackage = enable;
696  break;
697 
698  case OPT_DebugPatcher:
699  opt_DebugPatcher = enable;
700  break;
701 
703  opt_DebugStackFrameInfo = enable;
704  break;
705 
706  case OPT_DebugStackTrace:
707  opt_DebugStackTrace = enable;
708  break;
709 
710  case OPT_DebugThreads:
711  opt_DebugThreads = enable;
712  break;
713 
714  case OPT_ColorOutput:
715  if (value != NULL) {
716  if (strcmp("auto",value) == 0)
718  if (strcmp("no",value) == 0)
720  if (strcmp("yes",value) == 0)
722  }
723  break;
724 
725 #if defined(ENABLE_DISASSEMBLER)
727  opt_DisassembleStubs = enable;
728  break;
729 #endif
730 
731 #if defined(ENABLE_OPAGENT)
732  case OPT_EnableOpagent:
733  opt_EnableOpagent = enable;
734  break;
735 #endif
736 
737 #if defined(ENABLE_GC_CACAO)
738  case OPT_GCDebugRootSet:
739  opt_GCDebugRootSet = enable;
740  break;
741 
742  case OPT_GCStress:
743  opt_GCStress = enable;
744  break;
745 #endif
746 
747 #if defined(ENABLE_INLINING)
748  case OPT_Inline:
749  opt_Inline = enable;
750  break;
751 #if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
752  case OPT_InlineAll:
753  opt_InlineAll = enable;
754  break;
755 
756  case OPT_InlineCount:
757  if (value != NULL)
758  opt_InlineCount = os::atoi(value);
759  break;
760 
761  case OPT_InlineMaxSize:
762  if (value != NULL)
763  opt_InlineMaxSize = os::atoi(value);
764  break;
765 
766  case OPT_InlineMinSize:
767  if (value != NULL)
768  opt_InlineMinSize = os::atoi(value);
769  break;
770  case OPT_InlineMethod:
771  // we can not yet set opt_InlineMethodUtf because
772  // the utf8 subsystem is not yet initialized!
773  //opt_InlineMethodUtf = Utf8String::from_utf8(opt_InlineMethod);
774  opt_InlineMethod = value;
775  break;
776 #endif
777 #endif
778 
779  case OPT_PrintConfig:
780  opt_PrintConfig = enable;
781  break;
782 
783  case OPT_PrintWarnings:
784  opt_PrintWarnings = enable;
785  break;
786 
788  if (value == NULL)
790  else
792  break;
793 
795  if (value == NULL)
797  else
799 
800 # if defined(ENABLE_STATISTICS)
801  /* we also need statistics */
802 
803  opt_stat = true;
804 # endif
805  break;
806 
808  if (value == NULL)
809  filename = "profile.dat";
810  else
811  filename = value;
812 
813  file = fopen(filename, "w");
814 
815  if (file == NULL)
816  /* FIXME Use below method instead! */
817  //os::abort_errno("options_xx: fopen failed");
818  vm_abort("options_xx: fopen failed");
819 
821  break;
822 
824  opt_RegallocSpillAll = enable;
825  break;
826 
827 #if defined(ENABLE_REPLACEMENT)
828  case OPT_TestReplacement:
829  opt_TestReplacement = enable;
830  break;
831 #endif
832 
834  opt_TraceBuiltinCalls = enable;
835  break;
836 
838  opt_TraceCompilerCalls = enable;
839  break;
840 
841  case OPT_TraceExceptions:
842  opt_TraceExceptions = enable;
843  break;
844 
845  case OPT_TraceHPI:
846  opt_TraceHPI = enable;
847  break;
848 
849 #if defined(ENABLE_INLINING) && !defined(NDEBUG)
850  case OPT_TraceInlining:
851  if (value == NULL)
852  opt_TraceInlining = 1;
853  else
854  opt_TraceInlining = os::atoi(value);
855  break;
856 #endif
857 
858  case OPT_TraceJavaCalls:
859  opt_verbosecall = enable;
860  opt_TraceJavaCalls = enable;
861  break;
862 
863  case OPT_TraceJMMCalls:
864  opt_TraceJMMCalls = enable;
865  break;
866 
867  case OPT_TraceJNICalls:
868  opt_TraceJNICalls = enable;
869  break;
870 
871  case OPT_TraceJVMCalls:
872  opt_TraceJVMCalls = enable;
873  break;
874 
876  opt_TraceJVMCallsVerbose = enable;
877  break;
878 
879 #if defined(ENABLE_JVMTI)
880  case OPT_TraceJVMTICalls:
881  opt_TraceJVMTICalls = enable;
882  break;
883 #endif
884 
885  case OPT_TraceLinkClass:
886  opt_TraceLinkClass = enable;
887  break;
888 
889 #if defined(ENABLE_REPLACEMENT)
891  if (value == NULL)
892  opt_TraceReplacement = 1;
893  else
894  opt_TraceReplacement = os::atoi(value);
895  break;
896 #endif
897 
900  break;
901 
902  case OPT_TraceTraps:
903  opt_TraceTraps = enable;
904  break;
905 
906 #if defined(ENABLE_RT_TIMING)
907  case OPT_RtTimingLogfile:
908  if (value == NULL)
909  break;
910  else
911  filename = value;
912 
913  if ( (strnlen(filename, 2) == 1) && (filename[0] == '-') ) {
914  file = stdout;
915  } else {
916  file = fopen(filename, "w");
917 
918  if (file == NULL)
919  os::abort_errno("options_xx: fopen failed");
920  }
921 
922  opt_RtTimingLogfile = file;
923  break;
924  case OPT_RtTimingCSV:
925  opt_RtTimingCSV = enable;
926  break;
927 #endif
928 
929 #if defined(ENABLE_STATISTICS)
931  if (value == NULL)
932  break;
933  else
934  filename = value;
935 
936  if ( (strnlen(filename, 2) == 1) && (filename[0] == '-') ) {
937  file = stdout;
938  } else {
939  file = fopen(filename, "w");
940 
941  if (file == NULL)
942  os::abort_errno("options_xx: fopen failed");
943  }
944 
945  opt_StatisticsLogfile = file;
946  break;
947  case OPT_StatisticsCSV:
948  opt_StatisticsCSV = enable;
949  break;
950 #endif
951 
952  default: {
953 
954  size_t name_len = strlen(name);
955  size_t value_len = 0;
956  if (value) {
957  size_t tmp_name_len = (value - name) / sizeof(char);
958  value_len = name_len - tmp_name_len;
959  name_len = tmp_name_len - 1;
960  assert(name[name_len] == '=');
961  }
962  else {
963  assert(name[name_len] == '\0');
964  }
965 
967  name, name_len, value, value_len)) {
968  fprintf(stderr, "Unknown -XX option: %s\n", name);
969  }
970  break;
971  }
972  }
973  }
974 }
975 
976 
977 /*
978  * These are local overrides for various environment variables in Emacs.
979  * Please do not remove this and leave it at the end of the file, where
980  * Emacs will automagically detect them.
981  * ---------------------------------------------------------------------
982  * Local variables:
983  * mode: c++
984  * indent-tabs-mode: t
985  * c-basic-offset: 4
986  * tab-width: 4
987  * End:
988  * vim:noexpandtab:sw=4:ts=4:
989  */
bool opt_foo
Definition: options.cpp:49
static void options_xxusage(void)
Definition: options.cpp:470
char * opt_arg
Definition: options.cpp:47
bool opt_showdisassemble
Definition: options.cpp:85
bool opt_AlwaysMmapFirstPage
Definition: options.cpp:164
static void print_usage(OptionPrefix &root, FILE *fp=stdout)
Definition: Option.cpp:52
int opt_DebugStackTrace
Definition: options.cpp:174
int opt_ProfileGCMemoryUsage
Definition: options.cpp:199
static void abort_errno(const char *text,...)
Equal to abort_errnum, but uses errno to get the error number.
Definition: os.cpp:165
int opt_ProfileMemoryUsage
Definition: options.cpp:200
int opt_TraceJavaCalls
Definition: options.cpp:213
const char * name
Definition: options.hpp:60
bool opt_intrp
Definition: options.cpp:55
int opt_TraceJVMCallsVerbose
Definition: options.cpp:217
bool initverbose
Definition: options.cpp:71
s4 opt_heapstartsize
Definition: options.cpp:64
int64_t opt_MaxDirectMemorySize
Definition: options.cpp:156
char * opt_CompileSignature
Definition: options.cpp:167
int opt_PermSize
Definition: options.cpp:158
bool opt_TraceJMMCalls
Definition: options.cpp:214
JNIEnv jclass jobject const char * name
Definition: jvmti.h:312
bool opt_verbosecall
Definition: options.cpp:76
char * opt_CompileMethod
Definition: options.cpp:166
int value
Definition: options.hpp:61
int opt_DebugPackage
Definition: options.cpp:170
int opt_DebugThreads
Definition: options.cpp:175
const char * opt_filter_show_method
Definition: options.cpp:145
s4 opt_heapmaxsize
Definition: options.cpp:63
bool opt_ifconv
Definition: options.cpp:118
const char * opt_filter_verbosecall_exclude
Definition: options.cpp:144
static size_t strlen(const char *s)
Definition: os.hpp:672
opt_struct opts[]
Definition: vm.cpp:243
const char * doc
Definition: options.hpp:63
void vm_abort(const char *text,...)
Definition: vm.cpp:2586
bool opt_debugcolor
Definition: options.cpp:68
static int atoi(const char *nptr)
Definition: os.hpp:223
int opt_TraceBuiltinCalls
Definition: options.cpp:206
#define OPT_DONE
Definition: options.hpp:43
int opt_TraceCompilerCalls
Definition: options.cpp:207
JNIEnv void * arg
Definition: jvmti.h:405
void options_xx(JavaVMInitArgs *vm_args)
Definition: options.cpp:552
bool opt_showddatasegment
Definition: options.cpp:86
bool opt_verbosejni
Definition: options.cpp:75
bool compileverbose
Definition: options.cpp:82
bool checkbounds
Definition: options.cpp:89
static void set_force_color(int)
force color (0 = disabled, 1 = yes, 0 = no)
Definition: OStream.cpp:76
option_t options_XX[]
Definition: options.cpp:305
int opt_DebugLocalReferences
Definition: options.cpp:168
bool checksync
Definition: options.cpp:90
int opt_TraceExceptions
Definition: options.cpp:208
int opt_TraceTraps
Definition: options.cpp:234
FILE * opt_ProfileMemoryUsageGNUPlot
Definition: options.cpp:201
bool showmethods
Definition: options.cpp:78
MIIterator i
bool opt_verbosegc
Definition: options.cpp:74
int32_t s4
Definition: types.hpp:45
int value
Definition: options.hpp:53
s4 opt_index
Definition: options.cpp:46
int opt_DebugPatcher
Definition: options.cpp:171
int opt_PrintConfig
Definition: options.cpp:197
int type
Definition: options.hpp:62
int opt_TraceLinkClass
Definition: options.cpp:229
bool opt_verify
Definition: options.cpp:103
int options_get(opt_struct *opts, JavaVMInitArgs *vm_args)
Definition: options.cpp:400
int opt_TraceJNICalls
Definition: options.cpp:215
This file contains the command line option parsing library.
bool opt_verboseclass
Definition: options.cpp:73
bool opt_jar
Definition: options.cpp:51
s4 opt_stacksize
Definition: options.cpp:65
int opt_TraceJVMCalls
Definition: options.cpp:216
bool opt_showintermediate
Definition: options.cpp:87
int opt_PrintWarnings
Definition: options.cpp:198
int opt_TraceHPI
Definition: options.cpp:209
bool opt_jit
Definition: options.cpp:54
bool makeinitializations
Definition: options.cpp:95
int opt_TraceSubsystemInitialization
Definition: options.cpp:233
#define OPT_ERROR
Definition: options.hpp:44
OptionPrefix & xx_root()
Definition: Option.cpp:39
bool showutf
Definition: options.cpp:80
int opt_CompileAll
Definition: options.cpp:165
int opt_DebugProperties
Definition: options.cpp:172
bool opt_run
Definition: options.cpp:61
int opt_DebugLocks
Definition: options.cpp:169
int opt_MaxPermSize
Definition: options.cpp:157
bool showconstantpool
Definition: options.cpp:79
bool loadverbose
Definition: options.cpp:70
bool showstack
Definition: options.cpp:83
const char * name
Definition: options.hpp:51
int opt_ThreadStackSize
Definition: options.cpp:159
const char * opt_filter_verbosecall_include
Definition: options.cpp:143
int opt_RegallocSpillAll
Definition: options.cpp:202
const char const void jint length
Definition: jvmti.h:352
bool opt_AlwaysEmitLongBranches
Definition: options.cpp:163
#define printf(...)
Definition: ssa2.cpp:40
int opt_DebugStackFrameInfo
Definition: options.cpp:173
static bool parse_option(OptionPrefix &root, const char *name, size_t name_len, const char *value, size_t value_len)
Definition: Option.cpp:104
bool opt_verbose
Definition: options.cpp:67
static char * strdup(const char *s)
Definition: os.hpp:654