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 5922 2006-11-05 21:43:09Z twisti $
42 #include "mm/memory.h"
43 #include "native/jni.h"
44 #include "vm/options.h"
47 /* command line option ********************************************************/
49 s4 opt_index = 0; /* index of processed arguments */
50 char *opt_arg; /* this one exports the option argument */
52 bool opt_foo = false; /* option for development */
56 #if defined(ENABLE_JIT)
57 bool opt_jit = true; /* JIT mode execution (default) */
58 bool opt_intrp = false; /* interpreter mode execution */
60 bool opt_jit = false; /* JIT mode execution */
61 bool opt_intrp = true; /* interpreter mode execution (default) */
66 s4 opt_heapmaxsize = 0; /* maximum heap size */
67 s4 opt_heapstartsize = 0; /* initial heap size */
68 s4 opt_stacksize = 0; /* thread stack size */
70 bool opt_verbose = false;
71 bool opt_debugcolor = false; /* use ANSI terminal sequences */
72 bool compileall = false;
74 bool loadverbose = false;
75 bool linkverbose = false;
76 bool initverbose = false;
78 bool opt_verboseclass = false;
79 bool opt_verbosegc = false;
80 bool opt_verbosejni = false;
81 bool opt_verbosecall = false; /* trace all method invocation */
82 bool opt_verboseexception = false;
84 bool showmethods = false;
85 bool showconstantpool = false;
88 char *opt_method = NULL;
89 char *opt_signature = NULL;
91 bool compileverbose = false; /* trace compiler actions */
92 bool showstack = false;
94 bool opt_showdisassemble = false; /* generate disassembler listing */
95 bool opt_shownops = false;
96 bool opt_showddatasegment = false; /* generate data segment listing */
97 bool opt_showintermediate = false; /* generate intermediate code listing */
98 bool opt_showexceptionstubs = false;
99 bool opt_shownativestub = false;
101 bool useinlining = false; /* use method inlining */
102 bool inlinevirtuals = false; /* inline unique virtual methods */
103 bool inlineexceptions = false; /* inline methods, that contain excptions */
104 bool inlineparamopt = false; /* optimize parameter passing to inlined methods */
105 bool inlineoutsiders = false; /* inline methods, that are not member of the invoker's class */
107 bool checkbounds = true; /* check array bounds */
108 bool checknull = true; /* check null pointers */
109 bool opt_noieee = false; /* don't implement ieee compliant floats */
110 bool checksync = true; /* do synchronization */
111 #if defined(ENABLE_LOOP)
112 bool opt_loops = false; /* optimize array accesses in loops */
115 bool makeinitializations = true;
117 #if defined(ENABLE_STATISTICS)
118 bool opt_stat = false;
119 bool opt_getloadingtime = false; /* to measure the runtime */
120 bool opt_getcompilingtime = false; /* compute compile time */
122 #if defined(ENABLE_VERIFIER)
123 bool opt_verify = true; /* true if classfiles should be verified */
125 bool opt_eager = false;
127 #if defined(ENABLE_PROFILING)
128 bool opt_prof = false;
129 bool opt_prof_bb = false;
133 /* optimization options *******************************************************/
135 #if defined(ENABLE_IFCONV)
136 bool opt_ifconv = false;
139 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
140 bool opt_lsra = false;
144 /* interpreter options ********************************************************/
146 #if defined(ENABLE_INTRP)
147 bool opt_no_dynamic = false; /* suppress dynamic superinstructions */
148 bool opt_no_replication = false; /* don't use replication in intrp */
149 bool opt_no_quicksuper = false; /* instructions for quickening cannot be
150 part of dynamic superinstructions */
152 s4 opt_static_supers = 0x7fffffff;
153 bool vm_debug = false; /* XXX this should be called `opt_trace' */
157 /* options_get *****************************************************************
161 *******************************************************************************/
163 s4 options_get(opt_struct *opts, JavaVMInitArgs *vm_args)
168 if (opt_index >= vm_args->nOptions)
171 /* get the current option */
173 option = vm_args->options[opt_index].optionString;
175 if ((option == NULL) || (option[0] != '-'))
178 for (i = 0; opts[i].name; i++) {
180 /* boolean option found */
182 if (strcmp(option + 1, opts[i].name) == 0) {
184 return opts[i].value;
188 /* parameter option found */
190 /* with a space between */
192 if (strcmp(option + 1, opts[i].name) == 0) {
195 if (opt_index < vm_args->nOptions) {
196 opt_arg = strdup(vm_args->options[opt_index].optionString);
198 return opts[i].value;
204 /* parameter and option have no space between */
206 /* FIXME: this assumption is plain wrong, hits you if there is a
207 * parameter with no argument starting with same letter as param with argument
208 * but named after that one, ouch! */
210 size_t l = strlen(opts[i].name);
212 if (strlen(option + 1) > l) {
213 if (memcmp(option + 1, opts[i].name, l) == 0) {
215 opt_arg = strdup(option + 1 + l);
216 return opts[i].value;
228 * These are local overrides for various environment variables in Emacs.
229 * Please do not remove this and leave it at the end of the file, where
230 * Emacs will automagically detect them.
231 * ---------------------------------------------------------------------
234 * indent-tabs-mode: t