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 char* opt_ReplaceMethod = NULL;
205 char* opt_OptimizeMethod = NULL;
206 bool opt_DisableCountdownTraps = false;
207 #endif
211 int opt_TraceHPI = 0;
212 #if defined(ENABLE_INLINING) && !defined(NDEBUG)
213 int opt_TraceInlining = 0;
214 #endif
216 bool opt_TraceJMMCalls = false;
220 #if defined(ENABLE_RT_TIMING)
221 FILE *opt_RtTimingLogfile = NULL;
222 bool opt_RtTimingCSV = false;
223 #endif
224 #if defined(ENABLE_STATISTICS)
225 FILE *opt_StatisticsLogfile = NULL;
226 bool opt_StatisticsCSV = false;
227 #endif
228 #if defined(ENABLE_JVMTI)
229 int opt_TraceJVMTICalls = 0;
230 #endif
234 
235 
236 enum {
239 };
240 
241 enum {
242  /* Options which must always be available (production options in
243  HotSpot). */
244 
249 
250  /* Debugging options which can be turned off. */
251 
303 };
304 
305 
307  /* Options which must always be available (production options in
308  HotSpot). */
309 
310  { "MaxDirectMemorySize", OPT_MaxDirectMemorySize, OPT_TYPE_VALUE, "Maximum total size of NIO direct-buffer allocations" },
311  { "MaxPermSize", OPT_MaxPermSize, OPT_TYPE_VALUE, "not implemented" },
312  { "PermSize", OPT_PermSize, OPT_TYPE_VALUE, "not implemented" },
313  { "ThreadStackSize", OPT_ThreadStackSize, OPT_TYPE_VALUE, "TODO" },
314 
315  /* Debugging options which can be turned off. */
316 
317  { "AlwaysEmitLongBranches", OPT_AlwaysEmitLongBranches, OPT_TYPE_BOOLEAN, "Always emit long-branches." },
318  { "AlwaysMmapFirstPage", OPT_AlwaysMmapFirstPage, OPT_TYPE_BOOLEAN, "Always mmap memory page at address 0x0." },
319  { "CompileAll", OPT_CompileAll, OPT_TYPE_BOOLEAN, "compile all methods, no execution" },
320  { "CompileMethod", OPT_CompileMethod, OPT_TYPE_VALUE, "compile only a specific method" },
321  { "CompileSignature", OPT_CompileSignature, OPT_TYPE_VALUE, "specify signature for a specific method" },
322  { "DebugLocalReferences", OPT_DebugLocalReferences, OPT_TYPE_BOOLEAN, "print debug information for local reference tables" },
323  { "DebugLocks", OPT_DebugLocks, OPT_TYPE_BOOLEAN, "print debug information for locks" },
324  { "DebugPackage", OPT_DebugPackage, OPT_TYPE_BOOLEAN, "debug Java boot-packages" },
325  { "DebugPatcher", OPT_DebugPatcher, OPT_TYPE_BOOLEAN, "debug JIT code patching" },
326  { "DebugStackFrameInfo", OPT_DebugStackFrameInfo, OPT_TYPE_BOOLEAN, "TODO" },
327  { "DebugStackTrace", OPT_DebugStackTrace, OPT_TYPE_BOOLEAN, "debug stacktrace creation" },
328  { "DebugThreads", OPT_DebugThreads, OPT_TYPE_BOOLEAN, "print debug information for threads" },
329  { "ColorOutput", OPT_ColorOutput, OPT_TYPE_VALUE, "enable color output (yes, no, auto) [default=auto]" },
330 #if defined(ENABLE_DISASSEMBLER)
331  { "DisassembleStubs", OPT_DisassembleStubs, OPT_TYPE_BOOLEAN, "disassemble builtin and native stubs when generated" },
332 #endif
333 #if defined(ENABLE_OPAGENT)
334  { "EnableOpagent", OPT_EnableOpagent, OPT_TYPE_BOOLEAN, "enable providing JIT output to Oprofile" },
335 #endif
336 #if defined(ENABLE_GC_CACAO)
337  { "GCDebugRootSet", OPT_GCDebugRootSet, OPT_TYPE_BOOLEAN, "GC: print root-set at collection" },
338  { "GCStress", OPT_GCStress, OPT_TYPE_BOOLEAN, "GC: forced collection at every allocation" },
339 #endif
340 #if defined(ENABLE_INLINING)
341  { "Inline", OPT_Inline, OPT_TYPE_BOOLEAN, "enable method inlining" },
342 #if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
343  { "InlineAll", OPT_InlineAll, OPT_TYPE_BOOLEAN, "use inlining in all compilations" },
344  { "InlineCount", OPT_InlineCount, OPT_TYPE_VALUE, "stop inlining after the given number of roots" },
345  { "InlineMaxSize", OPT_InlineMaxSize, OPT_TYPE_VALUE, "maximum size for inlined result" },
346  { "InlineMinSize", OPT_InlineMinSize, OPT_TYPE_VALUE, "minimum size for inlined result" },
347  { "InlineMethod", OPT_InlineMethod, OPT_TYPE_VALUE, "inline only specified method" },
348 #endif
349 #endif
350  { "PrintConfig", OPT_PrintConfig, OPT_TYPE_BOOLEAN, "print VM configuration" },
351  { "PrintWarnings", OPT_PrintWarnings, OPT_TYPE_BOOLEAN, "print warnings about suspicious behavior"},
352  { "ProfileGCMemoryUsage", OPT_ProfileGCMemoryUsage, OPT_TYPE_VALUE, "profiles GC memory usage in the given interval, <value> is in seconds (default: 5)" },
353  { "ProfileMemoryUsage", OPT_ProfileMemoryUsage, OPT_TYPE_VALUE, "TODO" },
354  { "ProfileMemoryUsageGNUPlot", OPT_ProfileMemoryUsageGNUPlot, OPT_TYPE_VALUE, "TODO" },
355  { "RegallocSpillAll", OPT_RegallocSpillAll, OPT_TYPE_BOOLEAN, "spill all variables to the stack" },
356 #if defined(ENABLE_REPLACEMENT)
357  { "ReplaceMethod", OPT_ReplaceMethod, OPT_TYPE_VALUE, "perform on-stack replacement only for the specified method"},
358  { "OptimizeMethod", OPT_OptimizeMethod, OPT_TYPE_VALUE, ""},
359  { "TestReplacement", OPT_TestReplacement, OPT_TYPE_BOOLEAN, "activate all replacement points during code generation" },
360  { "DisableCountdownTraps", OPT_DisableCountdownTraps, OPT_TYPE_BOOLEAN, "" },
361 #endif
362  { "TraceBuiltinCalls", OPT_TraceBuiltinCalls, OPT_TYPE_BOOLEAN, "trace calls to VM builtin functions" },
363  { "TraceCompilerCalls", OPT_TraceCompilerCalls, OPT_TYPE_BOOLEAN, "trace JIT compiler calls" },
364  { "TraceExceptions", OPT_TraceExceptions, OPT_TYPE_BOOLEAN, "trace Exception throwing" },
365  { "TraceHPI", OPT_TraceHPI, OPT_TYPE_BOOLEAN, "Trace Host Porting Interface (HPI)" },
366 #if defined(ENABLE_INLINING) && !defined(NDEBUG)
367  { "TraceInlining", OPT_TraceInlining, OPT_TYPE_VALUE, "trace method inlining with the given verbosity level (default: 1)" },
368 #endif
369  { "TraceJavaCalls", OPT_TraceJavaCalls, OPT_TYPE_BOOLEAN, "trace Java method calls" },
370  { "TraceJMMCalls", OPT_TraceJMMCalls, OPT_TYPE_BOOLEAN, "trace JMM method calls" },
371  { "TraceJNICalls", OPT_TraceJNICalls, OPT_TYPE_BOOLEAN, "trace JNI method calls" },
372  { "TraceJVMCalls", OPT_TraceJVMCalls, OPT_TYPE_BOOLEAN, "trace JVM method calls but omit very frequent ones" },
373  { "TraceJVMCallsVerbose", OPT_TraceJVMCallsVerbose, OPT_TYPE_BOOLEAN, "trace all JVM method calls" },
374 #if defined(ENABLE_JVMTI)
375  { "TraceJVMTICalls", OPT_TraceJVMTICalls, OPT_TYPE_BOOLEAN, "trace JVMTI method calls" },
376 #endif
377  { "TraceLinkClass", OPT_TraceLinkClass, OPT_TYPE_BOOLEAN, "trace class linking" },
378  { "TraceSubsystemInitialization", OPT_TraceSubsystemInitialization, OPT_TYPE_BOOLEAN, "trace initialization of subsystems" },
379  { "TraceTraps", OPT_TraceTraps, OPT_TYPE_BOOLEAN, "trace traps generated by JIT code" },
380 #if defined(ENABLE_RT_TIMING)
381  { "RtTimingLogfile", OPT_RtTimingLogfile, OPT_TYPE_VALUE, "rt-timing logfile (default: rt-timing.log, use - for stdout)" },
382  { "RtTimingCSV", OPT_RtTimingCSV, OPT_TYPE_BOOLEAN, "enable csv output for rt-timing" },
383 #endif
384 #if defined(ENABLE_STATISTICS)
385  { "StatisticsLogfile", OPT_StatisticsLogfile, OPT_TYPE_VALUE, "statistics logfile (default: statistics.log, use - for stdout)" },
386  { "StatisticsCSV", OPT_StatisticsCSV, OPT_TYPE_BOOLEAN, "enable csv output for statistics" },
387 #endif
388 
389  /* end marker */
390 
391  { NULL, -1, -1, NULL }
392 };
393 
394 
395 /* options_get *****************************************************************
396 
397  DOCUMENT ME!!!
398 
399 *******************************************************************************/
400 
401 int options_get(opt_struct *opts, JavaVMInitArgs *vm_args)
402 {
403  char *option;
404  int i;
405 
406  if (opt_index >= vm_args->nOptions)
407  return OPT_DONE;
408 
409  /* get the current option */
410 
411  option = vm_args->options[opt_index].optionString;
412 
413  if ((option == NULL) || (option[0] != '-'))
414  return OPT_DONE;
415 
416  for (i = 0; opts[i].name; i++) {
417  if (!opts[i].arg) {
418  /* boolean option found */
419 
420  if (strcmp(option + 1, opts[i].name) == 0) {
421  opt_index++;
422  return opts[i].value;
423  }
424 
425  } else {
426  /* parameter option found */
427 
428  /* with a space between */
429 
430  if (strcmp(option + 1, opts[i].name) == 0) {
431  opt_index++;
432 
433  if (opt_index < vm_args->nOptions) {
434  opt_arg = os::strdup(vm_args->options[opt_index].optionString);
435  opt_index++;
436  return opts[i].value;
437  }
438 
439  return OPT_ERROR;
440 
441  } else {
442  /* parameter and option have no space between */
443 
444  /* FIXME: this assumption is plain wrong, hits you if there is a
445  * parameter with no argument starting with same letter as param with argument
446  * but named after that one, ouch! */
447 
448  size_t l = os::strlen(opts[i].name);
449 
450  if (os::strlen(option + 1) > l) {
451  if (memcmp(option + 1, opts[i].name, l) == 0) {
452  opt_index++;
453  opt_arg = os::strdup(option + 1 + l);
454  return opts[i].value;
455  }
456  }
457  }
458  }
459  }
460 
461  return OPT_ERROR;
462 }
463 
464 
465 /* options_xxusage *************************************************************
466 
467  Print usage message for debugging options.
468 
469 *******************************************************************************/
470 
471 static void options_xxusage(void)
472 {
473  option_t *opt;
474  int length;
475  int i;
476  const char *c;
477 
478  /* Prevent compiler warning. */
479 
480  length = 0;
481 
482  for (opt = options_XX; opt->name != NULL; opt++) {
483  printf(" -XX:");
484 
485  switch (opt->type) {
486  case OPT_TYPE_BOOLEAN:
487  printf("+%s", opt->name);
488  length = os::strlen(" -XX:+") + os::strlen(opt->name);
489  break;
490 
491  case OPT_TYPE_VALUE:
492  printf("%s=<value>", opt->name);
493  length = os::strlen(" -XX:") + os::strlen(opt->name) +
494  os::strlen("=<value>");
495  break;
496 
497  default:
498  vm_abort("options_xxusage: unkown option type %d", opt->type);
499  }
500 
501  /* Check if the help fits into one 80-column line.
502  Documentation starts at column 29. */
503 
504  if (length < (29 - 1)) {
505  /* Print missing spaces up to column 29. */
506 
507  for (i = length; i < 29; i++)
508  printf(" ");
509  }
510  else {
511  printf("\n");
512  printf(" "); /* 29 spaces */
513  }
514 
515  /* Check documentation length. */
516 
517  length = os::strlen(opt->doc);
518 
519  if (length < (80 - 29)) {
520  printf("%s", opt->doc);
521  }
522  else {
523  for (c = opt->doc, i = 29; *c != 0; c++, i++) {
524  /* If we are at the end of the line, break it. */
525 
526  if (i == 80) {
527  printf("\n");
528  printf(" "); /* 29 spaces */
529  i = 29;
530  }
531 
532  printf("%c", *c);
533  }
534  }
535 
536  printf("\n");
537  }
538 
540 
541  /* exit with error code */
542 
543  exit(1);
544 }
545 
546 
547 /* options_xx ******************************************************************
548 
549  Handle -XX: options.
550 
551 *******************************************************************************/
552 
553 void options_xx(JavaVMInitArgs *vm_args)
554 {
555  const char *name;
556  const char *start;
557  const char *end;
558  int length;
559  int enable;
560  char *value;
561  option_t *opt;
562  const char *filename;
563  FILE *file;
564  int i;
565 
566  /* Iterate over all passed options. */
567 
568  for (i = 0; i < vm_args->nOptions; i++) {
569  /* Get the current option. */
570 
571  name = vm_args->options[i].optionString;
572 
573  /* Check for help (-XX). */
574 
575  if (strcmp(name, "-XX") == 0)
576  options_xxusage();
577 
578  /* Check if the option start with -XX. */
579 
580  start = strstr(name, "-XX:");
581 
582  if ((start == NULL) || (start != name))
583  continue;
584 
585  /* Check if the option is a boolean option. */
586 
587  if (name[4] == '+') {
588  start = name + 4 + 1;
589  enable = 1;
590  }
591  else if (name[4] == '-') {
592  start = name + 4 + 1;
593  enable = 0;
594  }
595  else {
596  start = name + 4;
597  enable = -1;
598  }
599 
600  /* Search for a '=' in the option name and get the option name
601  length and the value of the option. */
602 
603  end = strchr(start, '=');
604 
605  if (end == NULL) {
606  length = os::strlen(start);
607  value = NULL;
608  }
609  else {
610  length = end - start;
611  value = (char*) (end + 1);
612  }
613 
614  /* Search the option in the option array. */
615 
616  for (opt = options_XX; opt->name != NULL; opt++) {
617  if (strncmp(opt->name, start, length) == 0) {
618  /* Check if the options passed fits to the type. */
619 
620  switch (opt->type) {
621  case OPT_TYPE_BOOLEAN:
622  if ((enable == -1) || (value != NULL))
623  options_xxusage();
624  break;
625  case OPT_TYPE_VALUE:
626  if ((enable != -1) || (value == NULL))
627  options_xxusage();
628  break;
629  default:
630  vm_abort("options_xx: unknown option type %d for option %s",
631  opt->type, opt->name);
632  }
633 
634  break;
635  }
636  }
637 
638  /* Process the option. */
639 
640  switch (opt->value) {
641 
642  /* Options which must always be available (production options
643  in HotSpot). */
644 
647  break;
648 
649  case OPT_MaxPermSize:
650  /* Currently ignored. */
651  break;
652 
653  case OPT_PermSize:
654  /* Currently ignored. */
655  break;
656 
657  case OPT_ThreadStackSize:
658  /* currently ignored */
659  break;
660 
661  /* Debugging options which can be turned off. */
662 
665  break;
666 
668  opt_AlwaysMmapFirstPage = enable;
669  break;
670 
671  case OPT_CompileAll:
672  opt_CompileAll = enable;
673  opt_run = false;
674  makeinitializations = false;
675  break;
676 
677  case OPT_CompileMethod:
678  opt_CompileMethod = value;
679  opt_run = false;
680  makeinitializations = false;
681  break;
682 
684  opt_CompileSignature = value;
685  break;
686 
688  opt_DebugLocalReferences = enable;
689  break;
690 
691  case OPT_DebugLocks:
692  opt_DebugLocks = enable;
693  break;
694 
695  case OPT_DebugPackage:
696  opt_DebugPackage = enable;
697  break;
698 
699  case OPT_DebugPatcher:
700  opt_DebugPatcher = enable;
701  break;
702 
704  opt_DebugStackFrameInfo = enable;
705  break;
706 
707  case OPT_DebugStackTrace:
708  opt_DebugStackTrace = enable;
709  break;
710 
711  case OPT_DebugThreads:
712  opt_DebugThreads = enable;
713  break;
714 
715  case OPT_ColorOutput:
716  if (value != NULL) {
717  if (strcmp("auto",value) == 0)
719  if (strcmp("no",value) == 0)
721  if (strcmp("yes",value) == 0)
723  }
724  break;
725 
726 #if defined(ENABLE_DISASSEMBLER)
728  opt_DisassembleStubs = enable;
729  break;
730 #endif
731 
732 #if defined(ENABLE_OPAGENT)
733  case OPT_EnableOpagent:
734  opt_EnableOpagent = enable;
735  break;
736 #endif
737 
738 #if defined(ENABLE_GC_CACAO)
739  case OPT_GCDebugRootSet:
740  opt_GCDebugRootSet = enable;
741  break;
742 
743  case OPT_GCStress:
744  opt_GCStress = enable;
745  break;
746 #endif
747 
748 #if defined(ENABLE_INLINING)
749  case OPT_Inline:
750  opt_Inline = enable;
751  break;
752 #if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
753  case OPT_InlineAll:
754  opt_InlineAll = enable;
755  break;
756 
757  case OPT_InlineCount:
758  if (value != NULL)
759  opt_InlineCount = os::atoi(value);
760  break;
761 
762  case OPT_InlineMaxSize:
763  if (value != NULL)
764  opt_InlineMaxSize = os::atoi(value);
765  break;
766 
767  case OPT_InlineMinSize:
768  if (value != NULL)
769  opt_InlineMinSize = os::atoi(value);
770  break;
771  case OPT_InlineMethod:
772  // we can not yet set opt_InlineMethodUtf because
773  // the utf8 subsystem is not yet initialized!
774  //opt_InlineMethodUtf = Utf8String::from_utf8(opt_InlineMethod);
775  opt_InlineMethod = value;
776  break;
777 #endif
778 #endif
779 
780  case OPT_PrintConfig:
781  opt_PrintConfig = enable;
782  break;
783 
784  case OPT_PrintWarnings:
785  opt_PrintWarnings = enable;
786  break;
787 
789  if (value == NULL)
791  else
793  break;
794 
796  if (value == NULL)
798  else
800 
801 # if defined(ENABLE_STATISTICS)
802  /* we also need statistics */
803 
804  opt_stat = true;
805 # endif
806  break;
807 
809  if (value == NULL)
810  filename = "profile.dat";
811  else
812  filename = value;
813 
814  file = fopen(filename, "w");
815 
816  if (file == NULL)
817  /* FIXME Use below method instead! */
818  //os::abort_errno("options_xx: fopen failed");
819  vm_abort("options_xx: fopen failed");
820 
822  break;
823 
825  opt_RegallocSpillAll = enable;
826  break;
827 
828 #if defined(ENABLE_REPLACEMENT)
829  case OPT_ReplaceMethod:
830  opt_ReplaceMethod = value;
831  break;
832 
833  case OPT_OptimizeMethod:
834  opt_OptimizeMethod = value;
835  break;
836 
838  opt_DisableCountdownTraps = true;
839  break;
840 #endif
841 
843  opt_TraceBuiltinCalls = enable;
844  break;
845 
847  opt_TraceCompilerCalls = enable;
848  break;
849 
850  case OPT_TraceExceptions:
851  opt_TraceExceptions = enable;
852  break;
853 
854  case OPT_TraceHPI:
855  opt_TraceHPI = enable;
856  break;
857 
858 #if defined(ENABLE_INLINING) && !defined(NDEBUG)
859  case OPT_TraceInlining:
860  if (value == NULL)
861  opt_TraceInlining = 1;
862  else
863  opt_TraceInlining = os::atoi(value);
864  break;
865 #endif
866 
867  case OPT_TraceJavaCalls:
868  opt_verbosecall = enable;
869  opt_TraceJavaCalls = enable;
870  break;
871 
872  case OPT_TraceJMMCalls:
873  opt_TraceJMMCalls = enable;
874  break;
875 
876  case OPT_TraceJNICalls:
877  opt_TraceJNICalls = enable;
878  break;
879 
880  case OPT_TraceJVMCalls:
881  opt_TraceJVMCalls = enable;
882  break;
883 
885  opt_TraceJVMCallsVerbose = enable;
886  break;
887 
888 #if defined(ENABLE_JVMTI)
889  case OPT_TraceJVMTICalls:
890  opt_TraceJVMTICalls = enable;
891  break;
892 #endif
893 
894  case OPT_TraceLinkClass:
895  opt_TraceLinkClass = enable;
896  break;
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:471
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:215
const char * name
Definition: options.hpp:60
bool opt_intrp
Definition: options.cpp:55
int opt_TraceJVMCallsVerbose
Definition: options.cpp:219
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:216
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:208
#define OPT_DONE
Definition: options.hpp:43
int opt_TraceCompilerCalls
Definition: options.cpp:209
JNIEnv void * arg
Definition: jvmti.h:405
void options_xx(JavaVMInitArgs *vm_args)
Definition: options.cpp:553
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:306
int opt_DebugLocalReferences
Definition: options.cpp:168
bool checksync
Definition: options.cpp:90
int opt_TraceExceptions
Definition: options.cpp:210
int opt_TraceTraps
Definition: options.cpp:233
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:231
bool opt_verify
Definition: options.cpp:103
int options_get(opt_struct *opts, JavaVMInitArgs *vm_args)
Definition: options.cpp:401
int opt_TraceJNICalls
Definition: options.cpp:217
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:218
bool opt_showintermediate
Definition: options.cpp:87
int opt_PrintWarnings
Definition: options.cpp:198
int opt_TraceHPI
Definition: options.cpp:211
bool opt_jit
Definition: options.cpp:54
bool makeinitializations
Definition: options.cpp:95
int opt_TraceSubsystemInitialization
Definition: options.cpp:232
#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