1 /* src/vm/options.c - contains global options
3 Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 Contact: cacao@cacaojvm.org
27 Authors: Christian Thalinger
31 $Id: options.c 7228 2007-01-19 01:13:48Z edwin $
43 #include "mm/memory.h"
44 #include "native/jni.h"
45 #include "vm/options.h"
48 /* command line option ********************************************************/
50 s4 opt_index = 0; /* index of processed arguments */
51 char *opt_arg; /* this one exports the option argument */
53 bool opt_foo = false; /* option for development */
57 #if defined(ENABLE_JIT)
58 bool opt_jit = true; /* JIT mode execution (default) */
59 bool opt_intrp = false; /* interpreter mode execution */
61 bool opt_jit = false; /* JIT mode execution */
62 bool opt_intrp = true; /* interpreter mode execution (default) */
67 s4 opt_heapmaxsize = 0; /* maximum heap size */
68 s4 opt_heapstartsize = 0; /* initial heap size */
69 s4 opt_stacksize = 0; /* thread stack size */
71 bool opt_verbose = false;
72 bool opt_debugcolor = false; /* use ANSI terminal sequences */
73 bool compileall = false;
75 bool loadverbose = false;
76 bool linkverbose = false;
77 bool initverbose = false;
79 bool opt_verboseclass = false;
80 bool opt_verbosegc = false;
81 bool opt_verbosejni = false;
82 bool opt_verbosecall = false; /* trace all method invocation */
83 bool opt_verboseexception = false;
85 bool showmethods = false;
86 bool showconstantpool = false;
89 char *opt_method = NULL;
90 char *opt_signature = NULL;
92 bool compileverbose = false; /* trace compiler actions */
93 bool showstack = false;
95 bool opt_showdisassemble = false; /* generate disassembler listing */
96 bool opt_shownops = false;
97 bool opt_showddatasegment = false; /* generate data segment listing */
98 bool opt_showintermediate = false; /* generate intermediate code listing */
99 bool opt_showexceptionstubs = false;
100 bool opt_shownativestub = false;
102 bool checkbounds = true; /* check array bounds */
103 bool checknull = true; /* check null pointers */
104 bool opt_noieee = false; /* don't implement ieee compliant floats */
105 bool checksync = true; /* do synchronization */
106 #if defined(ENABLE_LOOP)
107 bool opt_loops = false; /* optimize array accesses in loops */
110 bool makeinitializations = true;
112 #if defined(ENABLE_STATISTICS)
113 bool opt_stat = false;
114 bool opt_getloadingtime = false; /* to measure the runtime */
115 bool opt_getcompilingtime = false; /* compute compile time */
117 #if defined(ENABLE_VERIFIER)
118 bool opt_verify = true; /* true if classfiles should be verified */
120 bool opt_eager = false;
122 #if defined(ENABLE_PROFILING)
123 bool opt_prof = false;
124 bool opt_prof_bb = false;
128 /* inlining options ***********************************************************/
130 #if defined(ENABLE_INLINING)
131 bool opt_inlining = false;
132 #if defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG)
133 s4 opt_replace_verbose = 0;
134 s4 opt_inline_debug_min_size = 0;
135 s4 opt_inline_debug_max_size = INT_MAX;
136 s4 opt_inline_debug_end_counter = INT_MAX;
137 bool opt_inline_debug_all = false;
138 #endif /* defined(ENABLE_INLINING_DEBUG) || !defined(NDEBUG) */
140 bool opt_inline_debug_log = false;
141 #endif /* !defined(NDEBUG) */
142 #endif /* defined(ENABLE_INLINING) */
145 /* optimization options *******************************************************/
147 #if defined(ENABLE_IFCONV)
148 bool opt_ifconv = false;
151 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
152 bool opt_lsra = false;
156 /* interpreter options ********************************************************/
158 #if defined(ENABLE_INTRP)
159 bool opt_no_dynamic = false; /* suppress dynamic superinstructions */
160 bool opt_no_replication = false; /* don't use replication in intrp */
161 bool opt_no_quicksuper = false; /* instructions for quickening cannot be
162 part of dynamic superinstructions */
164 s4 opt_static_supers = 0x7fffffff;
165 bool vm_debug = false; /* XXX this should be called `opt_trace' */
169 /* options_get *****************************************************************
173 *******************************************************************************/
175 s4 options_get(opt_struct *opts, JavaVMInitArgs *vm_args)
180 if (opt_index >= vm_args->nOptions)
183 /* get the current option */
185 option = vm_args->options[opt_index].optionString;
187 if ((option == NULL) || (option[0] != '-'))
190 for (i = 0; opts[i].name; i++) {
192 /* boolean option found */
194 if (strcmp(option + 1, opts[i].name) == 0) {
196 return opts[i].value;
200 /* parameter option found */
202 /* with a space between */
204 if (strcmp(option + 1, opts[i].name) == 0) {
207 if (opt_index < vm_args->nOptions) {
208 opt_arg = strdup(vm_args->options[opt_index].optionString);
210 return opts[i].value;
216 /* parameter and option have no space between */
218 /* FIXME: this assumption is plain wrong, hits you if there is a
219 * parameter with no argument starting with same letter as param with argument
220 * but named after that one, ouch! */
222 size_t l = strlen(opts[i].name);
224 if (strlen(option + 1) > l) {
225 if (memcmp(option + 1, opts[i].name, l) == 0) {
227 opt_arg = strdup(option + 1 + l);
228 return opts[i].value;
240 * These are local overrides for various environment variables in Emacs.
241 * Please do not remove this and leave it at the end of the file, where
242 * Emacs will automagically detect them.
243 * ---------------------------------------------------------------------
246 * indent-tabs-mode: t