Removed gc function definitions.
[cacao.git] / main.c
diff --git a/main.c b/main.c
index 9bae68c79d3cc9ba880a7676bd7ae246bc918d16..20e7d8f0909c7aa2e8357ede388b46ed9a6f6f05 100644 (file)
--- a/main.c
+++ b/main.c
@@ -37,7 +37,7 @@
      - Calling the class loader
      - Running the main method
 
-   $Id: main.c 1465 2004-11-08 11:09:01Z twisti $
+   $Id: main.c 1505 2004-11-14 14:15:58Z jowenn $
 
 */
 
@@ -263,6 +263,7 @@ static void print_usage()
        printf("                 u(tf) ......... show the utf - hash\n");
        printf("          -i     n ............. activate inlining\n");
        printf("                 v ............. inline virtual methods\n");
+       printf("                                 uses/turns rt option on\n");
        printf("                 e ............. inline methods with exceptions\n");
        printf("                 p ............. optimize argument renaming\n");
        printf("                 o ............. inline methods of foreign classes\n");
@@ -557,10 +558,17 @@ int main(int argc, char **argv)
                        for (j = 0; j < strlen(opt_arg); j++) {         
                                switch (opt_arg[j]) {
                                case 'n':
+                                    /* define in options.h; Used in main.c, jit.c & inline.c */
+                                    #ifdef INAFTERMAIN
+                                       useinliningm = true;
+                                       useinlining = false;
+                                    #else
                                        useinlining = true;
+                                    #endif
                                        break;
                                case 'v':
                                        inlinevirtuals = true;
+                                       opt_rt = true;
                                        break;
                                case 'e':
                                        inlineexceptions = true;
@@ -639,7 +647,8 @@ int main(int argc, char **argv)
        jit_init();
 
        /* initialize exceptions used in the system */
-       init_system_exceptions();
+       if (!init_system_exceptions())
+               throw_main_exception_exit();
 
        native_loadclasses();
 
@@ -659,14 +668,15 @@ int main(int argc, char **argv)
 
        
        
-        jni_init();
+/*        jni_init(); */
        cacao_initializing = false;
 
        /************************* Start worker routines ********************/
 
        if (startit) {
                methodinfo *mainmethod;
-               java_objectarray *a; 
+               java_objectarray *a;
+                s4 result=0; 
 
                /* create, load and link the main class */
                mainclass = class_new(utf_new_char(mainstring));
@@ -714,8 +724,10 @@ int main(int argc, char **argv)
                asm_calljavafunction(mainmethod, a, NULL, NULL, NULL);
 
                /* exception occurred? */
-               if (*exceptionptr)
+               if (*exceptionptr) {
+                        result=1;
                        throw_main_exception();
+                }
 
 #if defined(USE_THREADS)
 #if defined(NATIVE_THREADS)
@@ -727,7 +739,7 @@ int main(int argc, char **argv)
 
                /* now exit the JavaVM */
 
-               cacao_exit(0);
+               cacao_exit(result);
        }
 
        /************* If requested, compile all methods ********************/
@@ -875,7 +887,7 @@ void cacao_exit(s4 status)
        if (!m)
                throw_main_exception_exit();
 
-       asm_calljavafunction(m, rt, (void *) 0, NULL, NULL);
+       asm_calljavafunction(m, rt, (void *) status, NULL, NULL);
 
        /* this should never happen */