If class is not initialized in put/getstatic we generate a call, thus
[cacao.git] / main.c
diff --git a/main.c b/main.c
index b5d20cac40ca5ad321bd04ecfaf3964bfd8dd236..c5e3676834fec8b864cb556109f87c3d6f1de644 100644 (file)
--- a/main.c
+++ b/main.c
@@ -37,7 +37,7 @@
      - Calling the class loader
      - Running the main method
 
-   $Id: main.c 806 2003-12-21 13:56:27Z twisti $
+   $Id: main.c 862 2004-01-06 23:42:01Z stefan $
 
 */
 
 
 bool verbose =  false;
 bool compileall = false;
-bool runverbose = false;
+bool runverbose = false;       /* trace all method invocation                */
 bool collectverbose = false;
 
 bool loadverbose = false;
 bool linkverbose = false;
 bool initverbose = false;
 
-bool opt_rt = false;            /* true if RTA parse should be used     RT-CO */
-bool opt_xta = false;           /* true if XTA parse should be used    XTA-CO */
-bool opt_vta = false;           /* true if VTA parse should be used    VTA-CO */
+bool opt_rt = false;           /* true if RTA parse should be used     RT-CO */
+bool opt_xta = false;          /* true if XTA parse should be used    XTA-CO */
+bool opt_vta = false;          /* true if VTA parse should be used    VTA-CO */
 
 bool showmethods = false;
 bool showconstantpool = false;
 bool showutf = false;
 
-bool compileverbose =  false;
+bool compileverbose =  false;  /* trace compiler actions                     */
 bool showstack = false;
-bool showdisassemble = false; 
-bool showddatasegment = false; 
-bool showintermediate = false;
-
-bool useinlining = false;
-bool inlinevirtuals = false;
-bool inlineexceptions = false;
-bool inlineparamopt = false;
-bool inlineoutsiders = false;
-
-bool checkbounds = true;
-bool checknull = true;
-bool opt_noieee = false;
-bool checksync = true;
-bool opt_loops = false;
+bool showdisassemble = false;  /* generate disassembler listing              */
+bool showddatasegment = false; /* generate data segment listing              */
+bool showintermediate = false; /* generate intermediate code listing         */
+
+bool useinlining = false;      /* use method inlining                        */
+bool inlinevirtuals = false;   /* inline unique virtual methods              */
+bool inlineexceptions = false; /* inline methods, that contain excptions     */
+bool inlineparamopt = false;   /* optimize parameter passing to inlined methods */
+bool inlineoutsiders = false;  /* inline methods, that are not member of the invoker's class */
+
+bool checkbounds = true;       /* check array bounds                         */
+bool checknull = true;         /* check null pointers                        */
+bool opt_noieee = false;       /* don't implement ieee compliant floats      */
+bool checksync = true;         /* do synchronization                         */
+bool opt_loops = false;        /* optimize array accesses in loops           */
 
 bool makeinitializations = true;
 
 bool getloadingtime = false;   /* to measure the runtime                     */
 s8 loadingtime = 0;
 
+bool getcompilingtime = false; /* compute compile time                       */
+s8 compilingtime = 0;          /* accumulated compile time                   */
+
+int has_ext_instr_set = 0;     /* has instruction set extensions */
+
+bool statistics = false;
+
 bool opt_verify = true;        /* true if classfiles should be verified      */
 
 
@@ -515,16 +522,15 @@ static void print_stats()
 }
 
 
-
 /********** Function: class_compile_methods   (debugging only) ********/
 
-void class_compile_methods ()
+void class_compile_methods()
 {
        int        i;
        classinfo  *c;
        methodinfo *m;
        
-       c = list_first (&linkedclasses);
+       c = list_first(&linkedclasses);
        while (c) {
                for (i = 0; i < c -> methodscount; i++) {
                        m = &(c->methods[i]);
@@ -537,7 +543,6 @@ void class_compile_methods ()
 }
 
 
-
 /*
  * void exit_handler(void)
  * -----------------------
@@ -837,19 +842,17 @@ int main(int argc, char **argv)
                log_text("CACAO started -------------------------------------------------------");
        }
 
-       suck_init(classpath);
        native_setclasspath(classpath);
                
        tables_init();
+       suck_init(classpath);
+
        heap_init(heapsize, heapstartsize, &dummy);
 
-       log_text("calling jit_init");
        jit_init();
 
-       log_text("calling loader_init");
        loader_init((u1 *) &dummy);
 
-       log_text("calling native_loadclasses");
        native_loadclasses();
 
 
@@ -860,16 +863,18 @@ int main(int argc, char **argv)
                if (cp[i] == '.') cp[i] = '/';          /* in the class name */
        }
 
+       /*printf("-------------------->%s\n",cp);*/
        topclass = loader_load(utf_new_char(cp));
+       /*class_showmethods(topclass);  */
 
-       if (exceptionptr != 0) {
+       if (*exceptionptr != 0) {
                printf("Exception in thread \"main\" ");
-               utf_display(exceptionptr->vftbl->class->name);
+               utf_display((*exceptionptr)->vftbl->class->name);
                printf(": ");
-               utf_display(javastring_toutf(((java_lang_Throwable *) exceptionptr)->detailMessage, false));
+               utf_display(javastring_toutf(((java_lang_Throwable *) *exceptionptr)->detailMessage, false));
                printf("\n");
 
-               exceptionptr = 0;
+               *exceptionptr = 0;
        }
 
        if (topclass == 0) {
@@ -919,14 +924,14 @@ int main(int argc, char **argv)
                /* here we go... */
                asm_calljavafunction(mainmethod, a, NULL, NULL, NULL);
        
-               if (exceptionptr) {
+               if (*exceptionptr) {
                        printf("Exception in thread \"main\" ");
-                       utf_display(exceptionptr->vftbl->class->name);
+                       utf_display((*exceptionptr)->vftbl->class->name);
 
                        /* do we have a detail message? */
-                       if (((java_lang_Throwable *) exceptionptr)->detailMessage) {
+                       if (((java_lang_Throwable *) *exceptionptr)->detailMessage) {
                                printf(": ");
-                               utf_display(javastring_toutf(((java_lang_Throwable *) exceptionptr)->detailMessage, false));
+                               utf_display(javastring_toutf(((java_lang_Throwable *) *exceptionptr)->detailMessage, false));
                        }
                        printf("\n");
                }