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 4550 2006-03-01 17:00:33Z 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 */
54 #if defined(ENABLE_JIT)
55 bool opt_jit = true; /* JIT mode execution (default) */
56 bool opt_intrp = false; /* interpreter mode execution */
58 bool opt_jit = false; /* JIT mode execution */
59 bool opt_intrp = true; /* interpreter mode execution (default) */
64 s4 opt_stacksize = 0; /* thread stack size */
66 bool opt_verbose = false;
67 bool compileall = false;
69 bool loadverbose = false;
70 bool linkverbose = false;
71 bool initverbose = false;
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 bool opt_verboseexception = false;
79 bool opt_liberalutf = false; /* Don't check overlong UTF-8 sequences */
81 bool showmethods = false;
82 bool showconstantpool = false;
85 char *opt_method = NULL;
86 char *opt_signature = NULL;
88 bool compileverbose = false; /* trace compiler actions */
89 bool showstack = false;
90 bool opt_showdisassemble = false; /* generate disassembler listing */
91 bool opt_showddatasegment = false; /* generate data segment listing */
92 bool opt_showintermediate = false; /* generate intermediate code listing */
93 bool opt_showexceptionstubs = false;
94 bool opt_shownativestub = false;
96 bool useinlining = false; /* use method inlining */
97 bool inlinevirtuals = false; /* inline unique virtual methods */
98 bool inlineexceptions = false; /* inline methods, that contain excptions */
99 bool inlineparamopt = false; /* optimize parameter passing to inlined methods */
100 bool inlineoutsiders = false; /* inline methods, that are not member of the invoker's class */
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 bool opt_loops = false; /* optimize array accesses in loops */
108 bool makeinitializations = true;
110 bool getloadingtime = false; /* to measure the runtime */
111 bool getcompilingtime = false; /* compute compile time */
113 bool opt_stat = false;
114 bool opt_verify = true; /* true if classfiles should be verified */
115 bool opt_eager = false;
117 bool opt_prof = false;
118 bool opt_prof_bb = false;
121 /* optimization options *******************************************************/
123 #if defined(ENABLE_IFCONV)
124 bool opt_ifconv = false;
127 #if defined(ENABLE_LSRA)
128 bool opt_lsra = false;
132 /* interpreter options ********************************************************/
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 */
140 s4 opt_static_supers = 0x7fffffff;
141 bool vm_debug = false; /* XXX this should be called `opt_trace' */
145 /* options_get *****************************************************************
149 *******************************************************************************/
151 s4 options_get(opt_struct *opts, JavaVMInitArgs *vm_args)
156 if (opt_index >= vm_args->nOptions)
159 /* get the current option */
161 option = vm_args->options[opt_index].optionString;
163 if ((option == NULL) || (option[0] != '-'))
166 for (i = 0; opts[i].name; i++) {
168 /* boolean option found */
170 if (strcmp(option + 1, opts[i].name) == 0) {
172 return opts[i].value;
176 /* parameter option found */
178 /* with a space between */
180 if (strcmp(option + 1, opts[i].name) == 0) {
183 if (opt_index < vm_args->nOptions) {
184 opt_arg = strdup(vm_args->options[opt_index].optionString);
186 return opts[i].value;
192 /* parameter and option have no space between */
194 size_t l = strlen(opts[i].name);
196 if (strlen(option + 1) > l) {
197 if (memcmp(option + 1, opts[i].name, l) == 0) {
199 opt_arg = strdup(option + 1 + l);
200 return opts[i].value;
211 /* options_prepare *************************************************************
213 Prepare the JavaVMInitArgs.
215 *******************************************************************************/
217 JavaVMInitArgs *options_prepare(int argc, char **argv)
219 JavaVMInitArgs *vm_args;
222 vm_args = NEW(JavaVMInitArgs);
224 vm_args->version = JNI_VERSION_1_2;
225 vm_args->nOptions = argc - 1;
226 vm_args->options = MNEW(JavaVMOption, argc);
227 vm_args->ignoreUnrecognized = JNI_FALSE;
229 for (i = 1; i < argc; i++)
230 vm_args->options[i - 1].optionString = argv[i];
237 * These are local overrides for various environment variables in Emacs.
238 * Please do not remove this and leave it at the end of the file, where
239 * Emacs will automagically detect them.
240 * ---------------------------------------------------------------------
243 * indent-tabs-mode: t