GNU header update.
[cacao.git] / src / vm / jit / inline / parseRT.c
index a0e18c0c54db2f979fe324e72e8ecb4552bdf739..1c802ba87c7282e400682f27c5fe76a4ee1eeb76 100644 (file)
@@ -1,9 +1,9 @@
 /* jit/parseRT.c - parser and print functions for Rapid Type Analyis
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   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.
 
 
    Authors: Carolyn Oates
 
-   $Id: parseRT.c 1469 2004-11-08 21:08:13Z carolyn $
-
-Changes:
-opcode put into functions
-changed class_findmethod class_fetchmethod
+   $Id: parseRT.c 1735 2004-12-07 14:33:27Z twisti $
 
 */
 
 /***************
+ Rapid Type Static Analysis of Java program
+   used -rt option is turned on either explicitly 
+ or automatically with inlining of virtuals.
 
  USAGE:
  Methods called by NATIVE methods and classes loaded dynamically
@@ -57,71 +56,32 @@ changed class_findmethod class_fetchmethod
 
 Results: (currently) with -stat see # methods marked used
  
-TODO: end analysis if mono- or polymorphic call (in parseRTstats)
 ****************/
 
 #include <stdio.h>
 #include <string.h>
-#include "tables.h"
-
-#include "statistics.h"
-#include "loader.h"
-#include "main.h"
-#include "options.h"
-#include "jit/jit.h"
-#include "jit/parse.h"
+
+#include "cacao/cacao.h"
+#include "mm/memory.h"   
 #include "toolbox/list.h"
-#include "toolbox/memory.h"   
-#include "parseRT.h"
-#include "parseRTstats.h"
+#include "vm/tables.h"
+#include "vm/statistics.h"
+#include "vm/loader.h"
+#include "vm/options.h"
+#include "vm/jit/jit.h"
+#include "vm/jit/parse.h"
+#include "vm/jit/inline/parseRT.h"
+#include "vm/jit/inline/parseRTstats.h"
+
 
 static bool firstCall= true;
 static list *rtaWorkList;
 FILE *rtMissed;   /* Methods missed during RTA parse of Main  */
  
-#define LAZYLOADING(class) { \
-        if (!class_load(class)) \
-                return 0; \
-        if (!class_link(class)) \
-                return 0; }
-
+bool DEBUGinf = false;
 bool DEBUGr = false;
 bool DEBUGopcodes = false;
 
-#define METHINFO(mm) \
-if (DEBUGr == true) { \
-       printf("<c%i/m%i/p%i>\t", \
-               mm->class->classUsed,mm->methodUsed, mm->monoPoly); \
-       utf_display(mm->class->name); printf("."); fflush(stdout); \
-       method_display(mm); fflush(stdout); }
-
-#define METHINFOt(mm,TXT) \
-if (DEBUGr == true) { \
-                printf(TXT); \
-               printf("<c%i/m%i/p%i>\t", \
-               mm->class->classUsed,mm->methodUsed, mm->monoPoly); \
-               utf_display(mm->class->name); printf("."); fflush(stdout); \
-               method_display(mm); fflush(stdout); }
-
-#define CLASSNAME1(cls,TXT) \
-if (DEBUGr == true) {printf(TXT); \
-       printf("<c%i>\t",cls->classUsed); \
-       utf_display(cls->name); fflush(stdout);}
-
-#define CLASSNAMEop(cls) \
-if (DEBUGr == true) {printf("\t%s: ",opcode_names[opcode]);\
-       printf("<c%i>\t",cls->classUsed); \
-       utf_display(cls->name); printf("\n");fflush(stdout);}
-
-#define CLASSNAME(cls,TXT) \
-if (DEBUGr == true) { printf(TXT); \
-               printf("<c%i>\t",cls->classUsed); \
-               utf_display(cls->name); printf("\n");fflush(stdout);} 
-
-#define SHOWOPCODE \
-if (DEBUGopcodes == true) {printf("Parse p=%i<%i<   opcode=<%i> %s\n", \
-                          p, m->jcodelength,opcode,opcode_names[opcode]);}
-
 /*********************************************************************/
 
 void addToRtaWorkList(methodinfo *meth, char *info) {
@@ -131,9 +91,9 @@ if (meth->methodUsed == USED) return;
 
 if (!(meth->flags & ACC_ABSTRACT))  {
     count_methods_marked_used++;
-    METHINFOt(meth,info)
+    METHINFOt(meth,info,DEBUGopcodes)
        if (meth->class->super != NULL) {
-               CLASSNAME(meth->class->super,"\tsuper=")
+               CLASSNAME(meth->class->super,"\tsuper=",DEBUGr)
                }
        else {
                if (DEBUGr) printf("\tsuper=NULL\n");}
@@ -142,18 +102,75 @@ if (!(meth->flags & ACC_ABSTRACT))  {
     rta = NEW(rtaNode);
     rta->method = meth ;
     list_addlast(rtaWorkList,rta);
-if (meth->class->classUsed == NOTUSED) 
-       panic("\nADDED method in class not used at all!\n");
+if (meth->class->classUsed == NOTUSED) {
+       METHINFOx(meth)
+       printf("\nADDED method in class not used at all!\n");
+       fflush(stdout);
+       }
     }
 /***
 else {
      printf("Method not added to work list!!!<%i> : ",
      meth->methodUsed); fflush(stdout);
-     METHINFO(meth)
+     METHINFO(meth,true)
      }
 ***/
 }
 
+/**************************************************************************/
+void rtaMarkSubs(classinfo *class, methodinfo *topmethod); 
+
+/*------------------------------------------------------------------------*/
+void rtaAddUsedInterfaceMethods(classinfo *ci) {
+       int jj,mm;
+
+       /* add used interfaces methods to callgraph */
+       for (jj=0; jj < ci -> interfacescount; jj++) {
+               classinfo *ici = ci -> interfaces [jj];
+       
+               if (DEBUGinf) { 
+                       printf("BInterface used: ");fflush(stdout); 
+                       utf_display(ici->name);
+                       printf("<%i>\t",ici -> classUsed ); fflush(stdout); 
+                       if (ici -> classUsed == NOTUSED) printf("\t classUsed=NOTUSED\n" );
+                       if (ici -> classUsed == USED) printf("\t classUsed=USED\n");
+                       if (ici -> classUsed == PARTUSED) printf("\t classUsed=PARTUSED\n");
+                       fflush(stdout);
+               }
+               /* add class to interfaces list of classes that implement it */
+               ici -> impldBy =  addElement(ici -> impldBy,  ci);
+
+               /* if interface class is used */
+        if (ici -> classUsed != NOTUSED) {
+
+                       /* for each interface method implementation that has already been used */
+                       for (mm=0; mm< ici->methodscount; mm++) {
+                               methodinfo *imi = &(ici->methods[mm]);
+                               if (DEBUGinf) { 
+                                       if  (imi->methodUsed != USED) {
+                                               if (imi->methodUsed == NOTUSED) printf("Interface Method notused: "); 
+                                               if (imi->methodUsed == MARKED) printf("Interface Method marked: "); 
+                                               utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
+                                       }
+                               } 
+                               if  (imi->methodUsed == USED) {
+                                       if (DEBUGinf) { 
+                                               printf("Interface Method used: "); utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
+
+                                               /* Mark this method used in the (used) implementing class and its subclasses */
+                                               printf("rMAY ADD methods that was used by an interface\n");
+                                       }
+                                       if ((utf_new_char("<clinit>") != imi->name) &&
+                                           (utf_new_char("<init>") != imi->name))
+                                           rtaMarkSubs(ci,imi);
+                               }
+                       }
+               }
+       }
+
+}
+
+
 /**************************************************************************/
 /* Add Marked methods for input class ci                                  */
 /* Add methods with the same name and descriptor as implemented interfaces*/
@@ -178,6 +195,7 @@ for (ii=0; ii<ci->methodscount; ii++) {
                        if (ici -> classUsed != NOTUSED) {
                                for (mm=0; mm< ici->methodscount; mm++) {
                                        methodinfo *imi = &(ici->methods[mm]);
+                                       METHINFOt(imi,"NEW IMPD INTERFACE:",DEBUGinf)
                                      /*if interface method=method is used*/
                                        if  (      (imi->methodUsed == USED)
                           &&    ( (imi->name == mi->name) 
@@ -192,7 +210,13 @@ for (ii=0; ii<ci->methodscount; ii++) {
        }
 }    
 
+#define CLINITS_T   true
+#define FINALIZE_T  true
+#define ADDMARKED_T true
 
+#define CLINITS_F   false 
+#define FINALIZE_F  false 
+#define ADDMARKED_F false
 /*********************************************************************/
 void addClassInit(classinfo *ci, bool clinits, bool finalizes, bool addmark)
 {
@@ -234,6 +258,7 @@ void addClassInit(classinfo *ci, bool clinits, bool finalizes, bool addmark)
   if (addmark) {
     rtaAddMarkedMethods(ci);
     }
+    rtaAddUsedInterfaceMethods(ci);
 
 }
 
@@ -261,8 +286,13 @@ methodinfo *submeth;
 
 /* See if method defined in class heirarchy */
 submeth = class_resolvemethod(class, name, descriptor); 
-if (submeth == NULL)
+METHINFOt(submeth,"rtaMarkMethod submeth:",DEBUGr);
+if (submeth == NULL) {
+       utf_display(class->name); printf(".");
+       METHINFOx(topmethod);
+       printf("parse RT: Method not found in class hierarchy");fflush(stdout);
        panic("parse RT: Method not found in class hierarchy");
+       }
 if (submeth->methodUsed == USED) return;
   
 #undef CTA 
@@ -270,7 +300,7 @@ if (submeth->methodUsed == USED) return;
   /* Class Type Analysis if class.method in virt cone marks it used */
   /*   very inexact, too many extra methods */
   addClassInit(        submeth->class,
-               true,true,true);
+               CLINITS_T,FINALIZE_T,ADDMARKED_T);
   submeth->monoPoly = POLY;
   addToRtaWorkList(submeth,
                   "addTo RTA VIRT CONE:");
@@ -293,7 +323,7 @@ if (submeth->methodUsed == USED) return;
                /* Class IS NOT  marked USED (PART or NOTUSED) */ 
                /* -> if Method NOTUSED mark method as  MARKED */
                METHINFOt(submeth,
-                       "\tmarked VIRT CONE 2:");
+                       "\tmarked VIRT CONE 2:",DEBUGr);
                submeth->monoPoly = POLY;
                submeth->methodUsed = MARKED;
                /* Note: if class NOTUSED and subclass is used handled  */
@@ -309,11 +339,11 @@ if (submeth->methodUsed == USED) return;
                if (class->classUsed != USED) {
                        submeth->monoPoly = POLY;
                        submeth->methodUsed = MARKED;
-                       METHINFOt(submeth,"JUST MARKED :");
+                       METHINFOt(submeth,"JUST MARKED :",DEBUGr);
                        }
                }
         /* add method to rta work list if conditions met */
-       //if ( (submeth->class->classUsed == USED) ||
+               /*??if ( (submeth->class->classUsed == USED) ||  */
        if (class->classUsed == USED) {
                submeth->monoPoly = POLY;
                addToRtaWorkList(submeth,
@@ -331,8 +361,8 @@ if (submeth->methodUsed == USED) return;
 void rtaMarkSubs(classinfo *class, methodinfo *topmethod) {
 
   /* Mark method in class  */
-  CLASSNAME1(class," MARKSUBS ");
-  METHINFOt(topmethod," TOP ");
+  CLASSNAME1(class," MARKSUBS ",DEBUGr);
+  METHINFOt(topmethod," TOP ",DEBUGr);
   rtaMarkMethod(class, topmethod);  
 
   /* Mark method in subclasses */
@@ -341,7 +371,7 @@ void rtaMarkSubs(classinfo *class, methodinfo *topmethod) {
        
      if (!(topmethod->flags & ACC_FINAL )) {
        for (subs = class->sub;subs != NULL;subs = subs->nextsub) {
-         CLASSNAME1(subs," SUBS ");
+         CLASSNAME1(subs," SUBS ",DEBUGr);
          rtaMarkSubs(subs, topmethod); 
          }
        }
@@ -365,24 +395,36 @@ void rtaMarkInterfaceSubs(methodinfo *mi) {
 
        subs =  mi->class->impldBy; 
             /*RTAPRINT08invokeInterface1*/
+                  if (DEBUGinf) {
+                       METHINFO(mi,DEBUGinf)
+                        printf("Implemented By classes :\n");fflush(stdout);
+                        if (subs == NULL) printf("\tNOT IMPLEMENTED !!!\n");
+                        fflush(stdout);
+                       }
        while (subs != NULL) {                  
                classinfo * isubs = subs->classType;
-          /*RTAPRINT09invokeInterface2*/
-               /* Mark method (mark/used) in classes that implement the method */
-               if (isubs->classUsed != NOTUSED) {
-                       methodinfo *submeth;
-                                               
-                       submeth = class_findmethod(isubs,mi->name, mi->descriptor); 
-                       if (submeth != NULL)
-                               submeth->monoPoly = POLY; /*  poly even if nosubs */
-                       rtaMarkSubs(isubs, mi);  
+               methodinfo *submeth;
+                  if (DEBUGinf) {
+                      printf("\t");utf_display(isubs->name);fflush(stdout);
+                       printf(" <%i>\n",isubs->classUsed);fflush(stdout);
                        }
+               /*Mark method (mark/used) in classes that implement method*/
+                                               
+               submeth = class_findmethod(isubs,mi->name, mi->descriptor); 
+               if (submeth != NULL)
+                       submeth->monoPoly = POLY; /*  poly even if nosubs */
+               rtaMarkSubs(isubs, mi);  
                                
                subs = subs->nextClass;
                } /* end while */
 } 
 
 
+
+
+
+
+
 /*********************************************************************/
 
 int parseRT(methodinfo *m)
@@ -394,8 +436,8 @@ int parseRT(methodinfo *m)
         bool iswide = false;        /* true if last instruction was a wide*/
         int rc = 1;
 
-METHINFOt(m,"\n----RT PARSING:"); 
-if (DEBUGr) printf("\n");
+METHINFOt(m,"\n----RT PARSING:",DEBUGopcodes); 
+if ((DEBUGr)||(DEBUGopcodes)) printf("\n");
 
 /* scan all java instructions */
        for (p = 0; p < m->jcodelength; p = nextp) {
@@ -489,14 +531,14 @@ if (DEBUGr) printf("\n");
                                                        true);
 
                                if (!fi)
-                                       return 0; // was NULL
+                                       return 0; /* was NULL */
 
-                               CLASSNAME(fi->class,"\tPUTSTATIC: ");
+                               CLASSNAME(fi->class,"\tPUT/GETSTATIC: ",DEBUGr);
                                if (!fi->class->initialized) {
                                        m->isleafmethod = false;
                                        }       
                                addClassInit(   fi->class,
-                                               true,true,false);
+                                               CLINITS_T,FINALIZE_T,ADDMARKED_F);
                        }
                        break;
 
@@ -519,21 +561,24 @@ if (DEBUGr) printf("\n");
 
                                if (mi) 
                                   {
+                                  METHINFOt(mi,"INVOKESTAT/SPEC:: ",DEBUGopcodes)
                                   mi->monoPoly = MONO;
                                   if ((opcode == JAVA_INVOKESTATIC)       
                                     || (mi->flags & ACC_STATIC)  
                                     || (mi->flags & ACC_PRIVATE)  
                                     || (mi->flags & ACC_FINAL) )  
                                     {
-                                    if (mi->class->classUsed == NOTUSED){
-                                       addClassInit(   mi->class,
-                                                       true,true,false);
-                                       if (mi->class->classUsed == NOTUSED){
-                                           mi->class->classUsed = PARTUSED;                                            } 
+                                    if (mi->class->classUsed == PARTUSED){
+                                          addClassInit(mi->class,
+                                                       CLINITS_T,FINALIZE_T,ADDMARKED_T);
                                        }
-                                    if (mi->class->classUsed == NOTUSED) {
-                                       METHINFOt(mi,"WAS / WARUM 1")
-                                       panic("WAS /WARUM 1 ????");
+                                    else {
+                                       if (mi->class->classUsed == NOTUSED){
+                                          addClassInit(mi->class,
+                                               CLINITS_T,FINALIZE_T,ADDMARKED_T);
+                                          if (mi->class->classUsed == NOTUSED){
+                                              mi->class->classUsed = PARTUSED;                                            } 
+                                          }
                                        }
                                     if (opcode == JAVA_INVOKESTATIC)      
                                       addToRtaWorkList(mi,
@@ -546,49 +591,51 @@ if (DEBUGr) printf("\n");
                                     /* Handle special <init> calls */
                                        
                                     /* for now same as rest */
-                                    if (mi->class->classUsed == NOTUSED){
+                                    if (mi->class->classUsed != USED){
                                       /* RTA special case:
                                          call of super's <init> then
                                          methods of super class not all used */
                                       if (utf_new_char("<init>")==mi->name) {
-                                           if (m->class->super == mi->class) {
+                                           if ((m->class->super == mi->class) 
+                                           &&  (m->descriptor == utf_new_char("()V")) ) 
+                                               {
+                                               METHINFOt(mi,"SUPER INIT:",DEBUGopcodes);
                                                /* super init */
                                                addClassInit(mi->class,
-                                                       true,true,false);
+                                                       CLINITS_T,FINALIZE_T,ADDMARKED_F);
                                                if (mi->class->classUsed == NOTUSED) mi->class->classUsed = PARTUSED;
                                                }
                                            else {
+                                               METHINFOt(mi,"NORMAL INIT:",DEBUGopcodes);
                                                addClassInit(mi->class,
-                                                       true,true,true);
+                                                       CLINITS_T,FINALIZE_T,ADDMARKED_T);
                                                }
+                                           addToRtaWorkList(mi,
+                                                    "addTo INIT ");
                                         } 
                                       if (utf_new_char("<clinit>")==mi->name)
                                          addClassInit( mi->class,
-                                                       true,true,false);
+                                                       CLINITS_T,FINALIZE_T,ADDMARKED_F);
 
                                       if (!((utf_new_char("<init>")==mi->name))
                                       ||   (utf_new_char("<clinit>")==mi->name)) {
-                                         METHINFOt(mi,"SPECIAL not init:")
-                                         addClassInit( mi->class,
-                                                       true,true,true);
+                                         METHINFOt(mi,"SPECIAL not init:",DEBUGopcodes)
+                                           if (mi->class->classUsed !=USED)
+                                             mi->class->classUsed = PARTUSED;
+                                           addToRtaWorkList(mi,
+                                                    "addTo SPEC notINIT ");
                                          } 
                                       } 
+                                           addToRtaWorkList(mi,
+                                                    "addTo SPEC whymissed ");
                                           
-                                    if (utf_new_char("<init>")==mi->name) {
-                                      if (mi->class->classUsed == NOTUSED) {
-                                         METHINFOt(mi,"WAS / WARUM 2")
-                                         panic("WAS /WARUM 2 ????");
-                                         }
-                                       addToRtaWorkList(mi,
-                                                    "addTo INVOKESPECIAL ");
-                                       } 
                                     } 
                                   } 
 /***  assume if method can't be resolved won't actually be called or
       there is a real error in classpath and in normal parse an exception
       will be thrown. Following debug print can verify this
 else  from if (mi) {
-CLASSNAME1(mr->class,"CouldNOT Resolve method:");printf(".");fflush(stdout);
+CLASSNAME1(mr->class,"CouldNOT Resolve method:",,DEBUGr);printf(".");fflush(stdout);
 utf_display(mr->name); printf(" "); fflush(stdout);
 utf_display(mr->descriptor); printf("\n");fflush(stdout);
 ***/
@@ -614,14 +661,14 @@ utf_display(mr->descriptor); printf("\n");fflush(stdout);
 
                                if (mi) 
                                   {
-                                  METHINFOt(mi,"INVOKEVIRTUAL ::");
+                                  METHINFOt(mi,"INVOKEVIRTUAL ::",DEBUGopcodes);
                                   if ((mi->flags & ACC_STATIC) 
                                   ||  (mi->flags & ACC_PRIVATE)  
                                   ||  (mi->flags & ACC_FINAL) )  
                                     {
                                     if (mi->class->classUsed == NOTUSED){
                                       addClassInit(mi->class,
-                                                   true,true,true);
+                                                   CLINITS_T,FINALIZE_T,ADDMARKED_T);
                                       }
                                      mi->monoPoly = MONO;
                                      addToRtaWorkList(mi,
@@ -633,7 +680,7 @@ utf_display(mr->descriptor); printf("\n");fflush(stdout);
                                     }
                                   } 
                                else {
-CLASSNAME1(mr->class,"CouldNOT Resolve virt meth:");printf(".");fflush(stdout);
+CLASSNAME1(mr->class,"CouldNOT Resolve virt meth:",DEBUGr);printf(".");fflush(stdout);
 utf_display(mr->name); printf(" "); fflush(stdout);
 utf_display(mr->descriptor); printf("\n");fflush(stdout);
                                   }
@@ -658,12 +705,13 @@ utf_display(mr->descriptor); printf("\n");fflush(stdout);
                                                           false);
                                        if (mi)
                                            {
-                                          METHINFOt(mi,"\tINVOKEINTERFACE: ")
+                                          METHINFOt(mi,"\tINVOKEINTERFACE: ",DEBUGopcodes)
                                           rtaMarkInterfaceSubs(mi);
                                           }
                                /* see INVOKESTATIC for explanation about */
                                /*   case when Interface is not resolved  */
-                                //descriptor2types(mi); ?? do need paramcnt?
+                                /*descriptor2types(mi); 
+                               ?? do need paramcnt? for RTA (or just XTA)*/
                         }
                         break;
 
@@ -675,10 +723,11 @@ utf_display(mr->descriptor); printf("\n");fflush(stdout);
                        classinfo *ci;
                         ci = class_getconstant(m->class, i, CONSTANT_Class);
                         m->isleafmethod = false; /* why for new ? */
-                        // s_count++; look for s_counts for VTA
-                       //ci->classUsed=USED;
+                        /*** s_count++; look for s_counts for VTA */
+                       /***ci->classUsed=USED;  */
                        /* add marked methods */
-                       CLASSNAME(ci,"NEW : do nothing");
+                       CLASSNAME(ci,"NEW : do nothing",DEBUGr);
+                       addClassInit(ci, CLINITS_T, FINALIZE_T,ADDMARKED_T);   
                        }
                         break;
 
@@ -691,10 +740,10 @@ utf_display(mr->descriptor); printf("\n");fflush(stdout);
                                 (classinfo *)
                             class_getconstant(m->class, i, CONSTANT_Class);
                         LAZYLOADING(cls)
-                               CLASSNAMEop(cls);
+                               CLASSNAMEop(cls,DEBUGr);
                         if (cls->classUsed == NOTUSED){
                                addClassInit(cls,
-                                             true,true,true);
+                                            CLINITS_T,FINALIZE_T,ADDMARKED_T);
                                 }
                        }
                         break;
@@ -732,7 +781,7 @@ else
         if (callmeth->class->classUsed != USED) {  \
              c->classUsed = PARTUSED; \
              addClassInit(callmeth->class, \
-                          true,true,true);\
+                          CLINITS_T,FINALIZE_T,ADDMARKED_T);\
              } \
        callmeth->monoPoly = POLY; \
        addToRtaWorkList(callmeth,txt);
@@ -753,7 +802,6 @@ methodinfo *initializeRTAworklist(methodinfo *m) {
        FILE *rtMissedIn; /* Methods missed during previous RTA parse */
        char line[256];
        char* class, *meth, *desc;
-       char filename[256] = "rtMissed";
        methodinfo *rm =NULL;  /* return methodinfo ptr to main method */
 
 
@@ -768,12 +816,10 @@ methodinfo *initializeRTAworklist(methodinfo *m) {
        /* Add system called methods */
        SYSADD(mainstring, "main","([Ljava/lang/String;)V",systxt)
        rm = callmeth;  
-       SYSADD("java/lang/Runtime","getRuntime","()Ljava/lang/Runtime;",systxt)
-       SYSADD("java/lang/Runtime","exit","(I)V",systxt)
-
+       SYSADD("java/lang/System","exit","(I)V",systxt)
        /*----- rtMissedIn 0 */
         if ( (rtMissedIn = fopen("rtMissedIn0", "r")) == NULL) {
-               //if (verbose) 
+               /*if (opt_verbose) */
                    {printf("No rtMissedIn0 file\n");fflush(stdout);} 
                return  rm;
                }
@@ -785,43 +831,95 @@ methodinfo *initializeRTAworklist(methodinfo *m) {
                }
        fclose(rtMissedIn);
 
+
+
+
+       return rm;
+
+}
+
+/*- end initializeRTAworklist-------- */
+
+
+
+methodinfo *missedRTAworklist()  
+{
+       FILE *rtMissedIn; /* Methods missed during previous RTA parse */
+       char filenameIn[256] = "rtIn/";
+       char line[256];
+       char* class, *meth, *desc;
+       char missedtxt[] = "rtIn/ missed Call :";
+       classinfo  *c;
+        methodinfo* callmeth;
+
+       methodinfo *rm =NULL;  /* return methodinfo ptr to main method */
+
        /*----- rtMissedIn pgm specific */
-        strcat(filename, (const char *)mainstring);  
-        if ( (rtMissedIn = fopen(filename, "r")) == NULL) {
-               //if (verbose) 
-                   {printf("No rtMissedIn=%s file\n",filename);fflush(stdout);} 
+        strcat(filenameIn, (const char *)mainstring);  
+        if ( (rtMissedIn = fopen(filenameIn, "r")) == NULL) {
+               /*if (opt_verbose)*/ 
+                   {printf("No rtIn/=%s file\n",filenameIn);fflush(stdout);} 
                return rm;
                }
        while (getline(line,256,rtMissedIn)) {
            class = strtok(line, " \n");
            meth  = strtok(NULL, " \n");
            desc  = strtok(NULL, " \n");
-               SYSADD(class,meth,desc,missedtxt)
+           if ((class == NULL) || (meth == NULL) || (desc == NULL)) { 
+               fprintf(stderr,"Error in rtMissedIn file for: %s.%s %s\n",class, meth, desc); 
+               fflush(stderr);
+               panic ("Error in rtMissedIn file for: class.meth, desc\n"); 
                }
+           SYSADD(class,meth,desc,missedtxt)
+           }
        fclose(rtMissedIn);
        return rm;
 }
 
-/*- end initializeRTAworklist-------- */
 
 
+/*--------------------------------------------------------*/
+/* parseRTmethod                                          */
+/* input: method to be RTA static parsed                  */
+/*--------------------------------------------------------*/
+void parseRTmethod(methodinfo *rt_method) {
+       if (! (  (rt_method->flags & ACC_NATIVE  )
+            ||   (rt_method->flags & ACC_ABSTRACT) ) ) 
+           {
+           /* RTA parse to approxmate....
+               what classes/methods will really be used during execution */
+           parseRT(rt_method);  
+           }
+       else {
+           if (rt_method->flags & ACC_NATIVE  )
+               {
+              METHINFOt(rt_method,"TO BE NATIVE RTA PARSED :",DEBUGopcodes);
+               /* parseRTpseudo(rt_method); */
+               }   
+           else {
+              printf("Abstract method in RTA Work List: ");
+              METHINFOx(rt_method);
+              panic("Abstract method in RTA Work List.");
+               }
+            }                  
+}
+
 
 /*-- RTA -- *******************************************************/
 int RT_jit_parse(methodinfo *m)
 {
-  methodinfo *rt_method;
   rtaNode    *rta;
   methodinfo *mainmeth;
 
   /* Should only be called once */
   if (firstCall) {
-        firstCall = false; /* turn flag off */
 
         /*----- RTA initializations --------*/
-       if (verbose) 
+       if (opt_verbose) 
            log_text("RTA static analysis started.\n");
 
        mainmeth = initializeRTAworklist(m);
+        firstCall = false; /* turn flag off */
 
     if ( (rtMissed = fopen("rtMissed", "w")) == NULL) {
         printf("CACAO - rtMissed file: cant open file to write\n");
@@ -833,36 +931,25 @@ int RT_jit_parse(methodinfo *m)
         rta != NULL; 
         rta =list_next(rtaWorkList,rta)) 
         { 
-        rt_method = rta->method;
-       if (! (  (rt_method->flags & ACC_NATIVE  )
-            ||   (rt_method->flags & ACC_ABSTRACT) ) ) 
-           {
-           /* RTA parse to approxmate....
-               what classes/methods will really be used during execution */
-           parseRT(rt_method);  
-           }
-       else {
-           if (rt_method->flags & ACC_NATIVE  )
-               {
-               METHINFOt(rt_method,"TO BE NATIVE RTA PARSED :")
-               /* parseRTpseudo(rt_method); */
-               }   
-           else {
-              printf("Abstract method in RTA Work List: ");
-              METHINFO(rt_method);
-              panic("Abstract method in RTA Work List.");
-               }
-            }                  
+       parseRTmethod(rta->method);
        }       
+    missedRTAworklist();  
+    for (rta =list_first(rtaWorkList); 
+        rta != NULL; 
+        rta =list_next(rtaWorkList,rta)) 
+        { 
+       parseRTmethod(rta->method);
+       }       
+
     fclose(rtMissed);
-    if (verbose) {
+    if (opt_verbose) {
         if (opt_stat) {
           printRThierarchyInfo(m); 
          }
       printCallgraph(rtaWorkList); 
       }
 
-    if (verbose) {
+    if (opt_verbose) {
       log_text("RTA static analysis done.\n");
       }
   }
@@ -881,3 +968,4 @@ return 0;
  * tab-width: 4
  * End:
  */
+