-/* main.c - contains main() and variables for the global options
+/* cacao/cacao.c - contains main() of cacao
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Institut f. Computersprachen, TU Wien
- R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
- S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
- J. Wenninger
+ Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+ R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
+ C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
+ Institut f. Computersprachen - TU Wien
This file is part of CACAO.
- Calling the class loader
- Running the main method
- $Id: cacao.c 1590 2004-11-25 13:24:49Z christian $
+ $Id: cacao.c 1735 2004-12-07 14:33:27Z twisti $
*/
#include <stdlib.h>
#include <string.h>
-#include "exceptions.h"
-#include "main.h"
-#include "options.h"
-#include "global.h"
-#include "tables.h"
-#include "loader.h"
-#include "jit/jit.h"
-#include "asmpart.h"
-#include "builtin.h"
-#include "native.h"
-#include "statistics.h"
+
+#include "cacao/cacao.h"
#include "mm/boehm.h"
-#include "threads/thread.h"
+#include "mm/memory.h"
+#include "native/native.h"
#include "toolbox/logging.h"
-#include "toolbox/memory.h"
-#include "jit/parseRTstats.h"
-#include "nat/java_io_File.h" /* required by java_lang_Runtime.h */
-#include "nat/java_util_Properties.h" /* required by java_lang_Runtime.h */
-#include "nat/java_lang_Runtime.h"
-#include "nat/java_lang_Throwable.h"
+#include "vm/exceptions.h"
+#include "vm/global.h"
+#include "vm/loader.h"
+#include "vm/options.h"
+#include "vm/statistics.h"
+#include "vm/tables.h"
+#include "vm/jit/asmpart.h"
+#include "vm/jit/jit.h"
#ifdef TYPEINFO_DEBUG_TEST
#include "typeinfo.h"
#define OPT_ALL 20
#define OPT_OLOOP 24
#define OPT_INLINING 25
+#ifdef STATIC_ANALYSIS
#define OPT_RT 26
#define OPT_XTA 27
#define OPT_VTA 28
+#endif
#define OPT_VERBOSETC 29
#define OPT_NOVERIFY 30
#define OPT_LIBERALUTF 31
#define OPT_VERBOSEEXCEPTION 32
#define OPT_EAGER 33
+#ifdef LSRA
#define OPT_LSRA 34
-
+#endif
opt_struct opts[] = {
{"classpath", true, OPT_CLASSPATH},
{"all", false, OPT_ALL},
{"oloop", false, OPT_OLOOP},
{"i", true, OPT_INLINING},
+#ifdef STATIC_ANALYSIS
{"rt", false, OPT_RT},
{"xta", false, OPT_XTA},
{"vta", false, OPT_VTA},
+#endif
+#ifdef LSRA
{"lsra", false, OPT_LSRA},
+#endif
{NULL, false, 0}
};
printf(" e ............. inline methods with exceptions\n");
printf(" p ............. optimize argument renaming\n");
printf(" o ............. inline methods of foreign classes\n");
+#ifdef STATIC_ANALYSIS
printf(" -rt .................. use rapid type analysis\n");
printf(" -xta ................. use x type analysis\n");
printf(" -vta ................. use variable type analysis\n");
+#endif
+#ifdef LSRA
printf(" -lsra ................ use linear scan register allocation\n");
+#endif
/* exit with error code */
u4 heapmaxsize = 64 * 1024 * 1024;
u4 heapstartsize = 200 * 1024;
char *cp;
+ s4 cplen;
bool startit = true;
char *specificmethodname = NULL;
char *specificsignature = NULL;
}
break;
+#ifdef STATIC_ANALYSIS
case OPT_RT:
opt_rt = true;
break;
case OPT_VTA:
/***opt_vta = true; not yet **/
break;
+#endif
+#ifdef LSRA
case OPT_LSRA:
#if defined(__I386__) || defined(__ALPHA__)
opt_lsra = true;
opt_lsra = false;
#endif
break;
+#endif
default:
usage();
if (opt_ind >= argc)
usage();
-#if 0
- {
- char *gnucp = "/home/twisti/src/cacao/cacaodev/classpath/lib/:";
- cp = classpath;
- classpath = MNEW(char, strlen(cp) + strlen(classpath) + 1);
- strcpy(classpath, gnucp);
- strcat(classpath, cp);
+ /* insert the rt.jar in front of all other classpath entries */
- MFREE(cp, char, strlen(cp));
- }
-#endif
+ cplen = strlen(INSTALL_PREFIX) + strlen(CACAO_RT_JAR_PATH);
+ cp = classpath;
+
+ classpath = MNEW(char, cplen + strlen(classpath) + 1);
+ strcpy(classpath, INSTALL_PREFIX);
+ strcat(classpath, CACAO_RT_JAR_PATH);
+ strcat(classpath, cp);
+
+ MFREE(cp, char, strlen(cp));
+
+
+ /* transform dots into slashes in the class name */
mainstring = argv[opt_ind++];
- for (i = strlen(mainstring) - 1; i >= 0; i--) { /* Transform dots into slashes */
- if (mainstring[i] == '.') mainstring[i] = '/'; /* in the class name */
+ for (i = strlen(mainstring) - 1; i >= 0; i--) {
+ if (mainstring[i] == '.') mainstring[i] = '/';
}