1 /* src/cacao/cacao.c - contains main() of cacao
3 Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4 R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5 C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6 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., 59 Temple Place - Suite 330, Boston, MA
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Reinhard Grafl
34 This module does the following tasks:
35 - Command line option handling
36 - Calling initialization routines
37 - Calling the class loader
38 - Running the main method
40 $Id: cacao.c 2022 2005-03-09 12:07:57Z twisti $
49 #include "cacao/cacao.h"
51 #include "mm/memory.h"
52 #include "native/jni.h"
53 #include "native/native.h"
54 #include "toolbox/logging.h"
55 #include "vm/exceptions.h"
56 #include "vm/global.h"
57 #include "vm/loader.h"
58 #include "vm/options.h"
59 #include "vm/statistics.h"
60 #include "vm/stringlocal.h"
61 #include "vm/tables.h"
62 #include "vm/jit/asmpart.h"
63 #include "vm/jit/jit.h"
65 #ifdef TYPEINFO_DEBUG_TEST
66 #include "vm/jit/verify/typeinfo.h"
70 /* define heap sizes **********************************************************/
72 #define HEAP_MAXSIZE 64 * 1024 * 1024; /* default 64MB */
73 #define HEAP_STARTSIZE 2 * 1024 * 1024; /* default 2MB */
76 /* Invocation API variables ***************************************************/
78 JavaVM *jvm; /* denotes a Java VM */
79 JNIEnv *env; /* pointer to native method interface */
81 JDK1_1InitArgs vm_args; /* JDK 1.1 VM initialization arguments */
84 bool cacao_initializing;
86 char *bootclasspath; /* contains the boot classpath */
87 char *classpath; /* contains the classpath */
90 static classinfo *mainclass;
92 #if defined(USE_THREADS) && !defined(NATIVE_THREADS)
93 void **stackbottom = 0;
97 /* define command line options ************************************************/
99 #define OPT_CLASSPATH 2
103 #define OPT_VERBOSE1 6
104 #define OPT_VERBOSE 7
105 #define OPT_VERBOSEGC 8
106 #define OPT_VERBOSECALL 9
107 #define OPT_NOIEEE 10
108 #define OPT_SOFTNULL 11
114 #define OPT_METHOD 17
115 #define OPT_SIGNATURE 18
119 #define OPT_INLINING 25
121 #define STATIC_ANALYSIS
122 #if defined(STATIC_ANALYSIS)
126 #endif /* STATIC_ANALYSIS */
128 #define OPT_VERBOSETC 29
129 #define OPT_NOVERIFY 30
130 #define OPT_LIBERALUTF 31
131 #define OPT_VERBOSEEXCEPTION 32
139 #define OPT_BOOTCLASSPATH 36
140 #define OPT_BOOTCLASSPATH_A 37
141 #define OPT_BOOTCLASSPATH_P 38
142 #define OPT_VERSION 39
145 opt_struct opts[] = {
146 { "classpath", true, OPT_CLASSPATH },
147 { "cp", true, OPT_CLASSPATH },
148 { "D", true, OPT_D },
149 { "Xms", true, OPT_MS },
150 { "Xmx", true, OPT_MX },
151 { "ms", true, OPT_MS },
152 { "mx", true, OPT_MX },
153 { "noasyncgc", false, OPT_IGNORE },
154 { "noverify", false, OPT_NOVERIFY },
155 { "liberalutf", false, OPT_LIBERALUTF },
156 { "oss", true, OPT_IGNORE },
157 { "ss", true, OPT_IGNORE },
158 { "v", false, OPT_VERBOSE1 },
159 { "verbose", false, OPT_VERBOSE },
160 { "verbosegc", false, OPT_VERBOSEGC },
161 { "verbosecall", false, OPT_VERBOSECALL },
162 { "verboseexception", false, OPT_VERBOSEEXCEPTION },
163 #ifdef TYPECHECK_VERBOSE
164 { "verbosetc", false, OPT_VERBOSETC },
166 #if defined(__ALPHA__)
167 { "noieee", false, OPT_NOIEEE },
169 { "softnull", false, OPT_SOFTNULL },
170 { "time", false, OPT_TIME },
171 #if defined(STATISTICS)
172 { "stat", false, OPT_STAT },
174 { "log", true, OPT_LOG },
175 { "c", true, OPT_CHECK },
176 { "l", false, OPT_LOAD },
177 { "eager", false, OPT_EAGER },
178 { "m", true, OPT_METHOD },
179 { "sig", true, OPT_SIGNATURE },
180 { "s", true, OPT_SHOW },
181 { "all", false, OPT_ALL },
182 { "oloop", false, OPT_OLOOP },
183 { "i", true, OPT_INLINING },
184 #ifdef STATIC_ANALYSIS
185 { "rt", false, OPT_RT },
186 { "xta", false, OPT_XTA },
187 { "vta", false, OPT_VTA },
190 { "lsra", false, OPT_LSRA },
192 { "jar", false, OPT_JAR },
193 { "Xbootclasspath:", true, OPT_BOOTCLASSPATH },
194 { "Xbootclasspath/a:", true, OPT_BOOTCLASSPATH_A },
195 { "Xbootclasspath/p:", true, OPT_BOOTCLASSPATH_P },
196 { "version", false, OPT_VERSION },
201 /******************** interne Function: print_usage ************************
203 Prints the correct usage syntax to stdout.
205 ***************************************************************************/
209 printf("Usage: cacao [options] classname [program arguments]\n\n");
211 printf("Options:\n");
212 printf(" -cp <path> specify a path to look for classes\n");
213 printf(" -classpath <path> specify a path to look for classes\n");
214 printf(" -jar jarfile execute a jar file\n");
215 printf(" -D<name>=<value> add an entry to the property list\n");
216 printf(" -Xmx<size>[kK|mM] specify the size for the heap\n");
217 printf(" -Xms<size>[kK|mM] specify the initial size for the heap\n");
218 printf(" -mx<size>[kK|mM] specify the size for the heap\n");
219 printf(" -ms<size>[kK|mM] specify the initial size for the heap\n");
220 printf(" -Xbootclasspath:<path> set search path for bootstrap classes and resources\n");
221 printf(" -Xbootclasspath/a:<path> append to end of bootstrap class path\n");
222 printf(" -Xbootclasspath/p:<path> prepend in front of bootstrap class path\n");
223 printf(" -v ................... write state-information\n");
224 printf(" -verbose ............. write more information\n");
225 printf(" -verbosegc ........... write message for each GC\n");
226 printf(" -verbosecall ......... write message for each call\n");
227 printf(" -verboseexception .... write message for each step of stack unwinding\n");
228 #ifdef TYPECHECK_VERBOSE
229 printf(" -verbosetc ........... write debug messages while typechecking\n");
231 printf(" -version print product version and exit\n");
232 #if defined(__ALPHA__)
233 printf(" -noieee .............. don't use ieee compliant arithmetic\n");
235 printf(" -noverify ............ don't verify classfiles\n");
236 printf(" -liberalutf........... don't warn about overlong UTF-8 sequences\n");
237 printf(" -softnull ............ use software nullpointer check\n");
238 printf(" -time ................ measure the runtime\n");
239 #if defined(STATISTICS)
240 printf(" -stat ................ detailed compiler statistics\n");
242 printf(" -log logfile ......... specify a name for the logfile\n");
243 printf(" -c(heck)b(ounds) ..... don't check array bounds\n");
244 printf(" s(ync) ....... don't check for synchronization\n");
245 printf(" -oloop ............... optimize array accesses in loops\n");
246 printf(" -l ................... don't start the class after loading\n");
247 printf(" -eager ............... perform eager class loading and linking\n");
248 printf(" -all ................. compile all methods, no execution\n");
249 printf(" -m ................... compile only a specific method\n");
250 printf(" -sig ................. specify signature for a specific method\n");
251 printf(" -s(how)a(ssembler) ... show disassembled listing\n");
252 printf(" c(onstants) ... show the constant pool\n");
253 printf(" d(atasegment).. show data segment listing\n");
254 printf(" i(ntermediate). show intermediate representation\n");
255 printf(" m(ethods)...... show class fields and methods\n");
256 printf(" u(tf) ......... show the utf - hash\n");
257 printf(" -i n ............. activate inlining\n");
258 printf(" v ............. inline virtual methods\n");
259 printf(" uses/turns rt option on\n");
260 printf(" e ............. inline methods with exceptions\n");
261 printf(" p ............. optimize argument renaming\n");
262 printf(" o ............. inline methods of foreign classes\n");
263 #ifdef STATIC_ANALYSIS
264 printf(" -rt .................. use rapid type analysis\n");
265 printf(" -xta ................. use x type analysis\n");
266 printf(" -vta ................. use variable type analysis\n");
269 printf(" -lsra ................ use linear scan register allocation\n");
272 /* exit with error code */
278 /* version *********************************************************************
280 Only prints cacao version information and exits.
282 *******************************************************************************/
284 static void version()
286 printf("cacao "VERSION"\n");
291 #ifdef TYPECHECK_STATISTICS
292 void typecheck_print_statistics(FILE *file);
297 /* getmainclassfromjar ************************************************************
299 gets the name of the main class form a jar's manifest file
301 **********************************************************************************/
303 char *getmainclassnamefromjar(JNIEnv *env, char *mainstring)
309 class = (*env)->FindClass(env, "java/util/jar/JarFile");
311 log_text("unable to find java.util.jar.JarFile");
312 throw_main_exception_exit();
315 mid = (*env)->GetMethodID(NULL, class, "<init>","(Ljava/lang/String;)V");
317 log_text("unable to find constructor in java.util.jar.JarFile");
322 obj = (*env)->NewObject(NULL,class,mid,((*env)->NewStringUTF(NULL,(char*)mainstring)));
323 if ((*env)->ExceptionOccurred(NULL) != NULL) {
324 (*env)->ExceptionDescribe(NULL);
328 mid = (*env)->GetMethodID(NULL, class, "getManifest","()Ljava/util/jar/Manifest;");
330 log_text("unable to find getMainfest method");
334 /* get manifest object */
335 obj = (*env)->CallObjectMethod(NULL,obj,mid);
336 if ((*env)->ExceptionOccurred(NULL) != NULL) {
337 (*env)->ExceptionDescribe(NULL);
341 mid = (*env)->GetMethodID(NULL, (jclass)((java_objectheader*) obj)->vftbl->class, "getMainAttributes","()Ljava/util/jar/Attributes;");
343 log_text("unable to find getMainAttributes method");
347 /* get Main Attributes */
348 obj = (*env)->CallObjectMethod(NULL,obj,mid);
349 if ((*env)->ExceptionOccurred(NULL) != NULL) {
350 (*env)->ExceptionDescribe(NULL);
355 mid = (*env)->GetMethodID(NULL, (jclass)((java_objectheader*) obj)->vftbl->class, "getValue","(Ljava/lang/String;)Ljava/lang/String;");
357 log_text("unable to find getValue method");
361 /* get property Main-Class */
362 obj = (*env)->CallObjectMethod(NULL,obj,mid,(*env)->NewStringUTF(NULL,"Main-Class"));
363 if ((*env)->ExceptionOccurred(NULL) != NULL) {
364 (*env)->ExceptionDescribe(NULL);
368 return javastring_tochar((java_objectheader *) obj);
373 * void exit_handler(void)
374 * -----------------------
375 * The exit_handler function is called upon program termination to shutdown
376 * the various subsystems and release the resources allocated to the VM.
378 void exit_handler(void)
380 /********************* Print debug tables ************************/
382 if (showmethods) class_showmethods(mainclass);
383 if (showconstantpool) class_showconstantpool(mainclass);
384 if (showutf) utf_show();
386 #if defined(USE_THREADS) && !defined(NATIVE_THREADS)
387 clear_thread_flags(); /* restores standard file descriptor
391 /************************ Free all resources *******************/
396 MFREE(classpath, u1, strlen(classpath));
398 if (opt_verbose || getcompilingtime || opt_stat) {
399 log_text("CACAO terminated");
401 #if defined(STATISTICS)
404 #ifdef TYPECHECK_STATISTICS
405 typecheck_print_statistics(get_logfile());
409 if (getcompilingtime)
417 /************************** Function: main *******************************
421 **************************************************************************/
423 int main(int argc, char **argv)
428 /********** interne (nur fuer main relevante Optionen) **************/
430 char logfilename[200] = "";
436 char *specificmethodname = NULL;
437 char *specificsignature = NULL;
440 #if defined(USE_THREADS) && !defined(NATIVE_THREADS)
441 stackbottom = &dummy;
444 if (atexit(exit_handler))
445 throw_cacao_exception_exit(string_java_lang_InternalError,
446 "Unable to register exit_handler");
449 /************ Collect info from the environment ************************/
451 /* set the bootclasspath */
453 cp = getenv("BOOTCLASSPATH");
455 bootclasspath = MNEW(char, strlen(cp) + 1);
456 strcpy(bootclasspath, cp);
459 cplen = strlen(CACAO_INSTALL_PREFIX) + strlen(CACAO_RT_JAR_PATH);
461 bootclasspath = MNEW(char, cplen + 1);
462 strcpy(bootclasspath, CACAO_INSTALL_PREFIX);
463 strcat(bootclasspath, CACAO_RT_JAR_PATH);
467 /* set the classpath */
469 cp = getenv("CLASSPATH");
471 classpath = MNEW(char, strlen(cp) + 1);
472 strcat(classpath, cp);
475 classpath = MNEW(char, 2);
476 strcpy(classpath, ".");
480 /***************** Interpret the command line *****************/
485 heapmaxsize = HEAP_MAXSIZE;
486 heapstartsize = HEAP_STARTSIZE;
489 while ((i = get_opt(argc, argv, opts)) != OPT_DONE) {
494 case OPT_BOOTCLASSPATH:
495 /* Forget default bootclasspath and set the argument as new boot */
497 MFREE(bootclasspath, char, strlen(bootclasspath));
499 bootclasspath = MNEW(char, strlen(opt_arg) + 1);
500 strcpy(bootclasspath, opt_arg);
503 case OPT_BOOTCLASSPATH_A:
504 /* append to end of bootclasspath */
505 cplen = strlen(bootclasspath);
507 bootclasspath = MREALLOC(bootclasspath,
510 cplen + 1 + strlen(opt_arg) + 1);
512 strcat(bootclasspath, ":");
513 strcat(bootclasspath, opt_arg);
516 case OPT_BOOTCLASSPATH_P:
517 /* prepend in front of bootclasspath */
521 bootclasspath = MNEW(char, strlen(opt_arg) + 1 + cplen + 1);
523 strcpy(bootclasspath, opt_arg);
524 strcat(bootclasspath, ":");
525 strcat(bootclasspath, cp);
527 MFREE(cp, char, cplen);
531 /* forget old classpath and set the argument as new classpath */
532 MFREE(classpath, char, strlen(classpath));
534 classpath = MNEW(char, strlen(opt_arg) + 1);
535 strcpy(classpath, opt_arg);
544 for (j = 0; j < strlen(opt_arg); j++) {
545 if (opt_arg[j] == '=') {
547 create_property(opt_arg, opt_arg + j + 1);
552 /* if no '=' is given, just create an empty property */
553 create_property(opt_arg, "");
563 c = opt_arg[strlen(opt_arg) - 1];
565 if (c == 'k' || c == 'K') {
566 j = 1024 * atoi(opt_arg);
568 } else if (c == 'm' || c == 'M') {
569 j = 1024 * 1024 * atoi(opt_arg);
571 } else j = atoi(opt_arg);
573 if (i == OPT_MX) heapmaxsize = j;
574 else heapstartsize = j;
587 compileverbose = true;
590 case OPT_VERBOSEEXCEPTION:
591 verboseexception = true;
595 collectverbose = true;
598 #ifdef TYPECHECK_VERBOSE
600 typecheckverbose = true;
604 case OPT_VERBOSECALL:
621 opt_liberalutf = true;
629 getcompilingtime = true;
630 getloadingtime = true;
633 #if defined(STATISTICS)
640 strcpy(logfilename, opt_arg);
644 for (j = 0; j < strlen(opt_arg); j++) {
645 switch (opt_arg[j]) {
660 makeinitializations = false;
669 specificmethodname = opt_arg;
670 makeinitializations = false;
674 specificsignature = opt_arg;
680 makeinitializations = false;
683 case OPT_SHOW: /* Display options */
684 for (j = 0; j < strlen(opt_arg); j++) {
685 switch (opt_arg[j]) {
687 showdisassemble = true;
688 compileverbose = true;
691 showconstantpool = true;
694 showddatasegment = true;
697 showintermediate = true;
698 compileverbose = true;
717 for (j = 0; j < strlen(opt_arg); j++) {
718 switch (opt_arg[j]) {
720 /* define in options.h; Used in main.c, jit.c & inline.c */
729 inlinevirtuals = true;
733 inlineexceptions = true;
736 inlineparamopt = true;
739 inlineoutsiders = true;
747 #ifdef STATIC_ANALYSIS
749 opt_rt = true; /* default for inlining */
753 opt_xta = true; /* in test currently */
757 printf("\nVTA is not yet available\n");
759 /***opt_vta = true; not yet **/
765 #if defined(__I386__) || defined(__ALPHA__) || defined (__X86_64__) || defined(__POWERPC__)
768 printf("LSRA not available for this architecture\n");
775 printf("Unknown option: %s\n", argv[opt_ind]);
784 /* transform dots into slashes in the class name */
786 mainstring = argv[opt_ind++];
788 /* do not mangle jar filename */
789 for (i = strlen(mainstring) - 1; i >= 0; i--) {
790 if (mainstring[i] == '.') mainstring[i] = '/';
794 /* put jarfile in classpath */
796 classpath = MNEW(char, strlen(mainstring) + 1 + strlen(classpath) + 1);
797 strcpy(classpath, mainstring);
798 strcat(classpath, ":");
799 strcat(classpath, cp);
801 MFREE(cp, char, strlen(cp));
804 /**************************** Program start *****************************/
806 log_init(logfilename);
809 log_text("CACAO started -------------------------------------------------------");
811 /* initialize JavaVM */
813 vm_args.version = 0x00010001; /* New in 1.1.2: VM version */
815 /* Get the default initialization arguments and set the class path */
817 JNI_GetDefaultJavaVMInitArgs(&vm_args);
818 vm_args.classpath = classpath;
820 /* load and initialize a Java VM, return a JNI interface pointer in env */
822 JNI_CreateJavaVM(&jvm, &env, &vm_args);
825 /* initialize the garbage collector */
827 gc_init(heapmaxsize, heapstartsize);
831 /* initialize the loader with bootclasspath and append classpath entries */
833 suck_init(bootclasspath);
834 suck_init(classpath);
836 cacao_initializing = true;
838 #if defined(USE_THREADS)
839 #if defined(NATIVE_THREADS)
845 /* install architecture dependent signal handler used for exceptions */
848 /* initializes jit compiler and codegen stuff */
851 /* initialize some cacao subsystems */
855 loader_init((u1 *) &dummy);
858 throw_main_exception_exit();
860 if (!exceptions_init())
861 throw_main_exception_exit();
863 #if defined(USE_THREADS)
864 initThreads((u1 *) &dummy);
867 *threadrootmethod = NULL;
869 /*That's important, otherwise we get into trouble, if the Runtime static
870 initializer is called before (circular dependency. This is with
871 classpath 0.09. Another important thing is, that this has to happen
872 after initThreads!!! */
874 if (!class_init(class_java_lang_System))
875 throw_main_exception_exit();
877 cacao_initializing = false;
880 /* start worker routines **************************************************/
883 classinfo *cl; /* java/lang/ClassLoader */
884 classinfo *mainclass; /* java/lang/Class */
889 /* set return value to OK */
894 /* open jar file with java.util.jar.JarFile */
895 mainstring = getmainclassnamefromjar((JNIEnv *) &env, mainstring);
898 /* get system classloader */
900 m = class_resolveclassmethod(class_java_lang_ClassLoader,
901 utf_new_char("getSystemClassLoader"),
902 utf_new_char("()Ljava/lang/ClassLoader;"),
903 class_java_lang_Object,
906 cl = (classinfo *) asm_calljavafunction(m, NULL, NULL, NULL, NULL);
908 /* get `loadClass' method */
910 m = class_resolveclassmethod(cl->header.vftbl->class,
911 utf_new_char("loadClass"),
912 utf_new_char("(Ljava/lang/String;)Ljava/lang/Class;"),
913 class_java_lang_Object,
916 /* load the main class */
919 (classinfo *) asm_calljavafunction(m,
921 javastring_new_char(mainstring),
925 /* error loading class, clear exceptionptr for new exception */
927 if (*exceptionptr || !mainclass) {
928 /* *exceptionptr = NULL; */
930 /* *exceptionptr = */
931 /* new_exception_message(string_java_lang_NoClassDefFoundError, */
933 throw_main_exception_exit();
936 /* find the `main' method of the main class */
938 m = class_resolveclassmethod(mainclass,
939 utf_new_char("main"),
940 utf_new_char("([Ljava/lang/String;)V"),
941 class_java_lang_Object,
944 /* there is no main method or it isn't static */
946 if (*exceptionptr || !m || !(m->flags & ACC_STATIC)) {
947 *exceptionptr = NULL;
950 new_exception_message(string_java_lang_NoSuchMethodError,
952 throw_main_exception_exit();
955 /* build argument array */
957 a = builtin_anewarray(argc - opt_ind, class_java_lang_String);
958 for (i = opt_ind; i < argc; i++) {
959 a->data[i - opt_ind] =
960 (java_objectheader *) javastring_new(utf_new_char(argv[i]));
963 #ifdef TYPEINFO_DEBUG_TEST
964 /* test the typeinfo system */
967 /*class_showmethods(currentThread->group->header.vftbl->class); */
969 *threadrootmethod = m;
973 asm_calljavafunction(m, a, NULL, NULL, NULL);
975 /* exception occurred? */
977 throw_main_exception();
981 #if defined(USE_THREADS)
982 #if defined(NATIVE_THREADS)
985 killThread(currentThread);
989 /* now exit the JavaVM */
991 /* (*jvm)->DestroyJavaVM(jvm); */
996 /************* If requested, compile all methods ********************/
1004 /* create all classes found in the classpath */
1005 /* XXX currently only works with zip/jar's */
1006 create_all_classes();
1008 /* load and link all classes */
1009 for (slot = 0; slot < class_hash.size; slot++) {
1010 c = class_hash.ptr[slot];
1015 throw_main_exception_exit();
1019 throw_main_exception_exit();
1021 /* compile all class methods */
1022 for (i = 0; i < c->methodscount; i++) {
1023 m = &(c->methods[i]);
1025 (void) jit_compile(m);
1035 /******** If requested, compile a specific method ***************/
1037 if (specificmethodname) {
1040 /* create, load and link the main class */
1041 mainclass = class_new(utf_new_char(mainstring));
1043 if (!class_load(mainclass))
1044 throw_main_exception_exit();
1046 if (!class_link(mainclass))
1047 throw_main_exception_exit();
1049 if (specificsignature) {
1050 m = class_resolveclassmethod(mainclass,
1051 utf_new_char(specificmethodname),
1052 utf_new_char(specificsignature),
1056 m = class_resolveclassmethod(mainclass,
1057 utf_new_char(specificmethodname),
1064 char message[MAXLOGTEXT];
1065 sprintf(message, "%s%s", specificmethodname,
1066 specificsignature ? specificsignature : "");
1069 new_exception_message(string_java_lang_NoSuchMethodException,
1072 throw_main_exception_exit();
1080 /* keep compiler happy */
1086 /* cacao_exit ******************************************************************
1088 Calls java.lang.Runtime.exit(I)V to exit the JavaVM correctly.
1090 *******************************************************************************/
1092 void cacao_exit(s4 status)
1097 /* class should already be loaded, but who knows... */
1099 c = class_new(utf_new_char("java/lang/System"));
1102 throw_main_exception_exit();
1105 throw_main_exception_exit();
1107 /* call System.exit(I)V */
1109 m = class_resolveclassmethod(c,
1110 utf_new_char("exit"),
1111 utf_new_char("(I)V"),
1112 class_java_lang_Object,
1116 throw_main_exception_exit();
1118 /* call the exit function with passed exit status */
1120 /* both inlinevirtual and outsiders not allowed on exit */
1121 /* not sure if permanant or temp restriction */
1122 if (inlinevirtuals) inlineoutsiders = false;
1124 asm_calljavafunction(m, (void *) (ptrint) status, NULL, NULL, NULL);
1126 /* this should never happen */
1129 throw_exception_exit();
1131 throw_cacao_exception_exit(string_java_lang_InternalError,
1132 "System.exit(I)V returned without exception");
1136 /*************************** Shutdown function *********************************
1138 Terminates the system immediately without freeing memory explicitly (to be
1139 used only for abnormal termination)
1141 *******************************************************************************/
1143 void cacao_shutdown(s4 status)
1145 if (opt_verbose || getcompilingtime || opt_stat) {
1146 log_text("CACAO terminated by shutdown");
1147 dolog("Exit status: %d\n", (s4) status);
1155 * These are local overrides for various environment variables in Emacs.
1156 * Please do not remove this and leave it at the end of the file, where
1157 * Emacs will automagically detect them.
1158 * ---------------------------------------------------------------------
1161 * indent-tabs-mode: t