xta full code
authorcarolyn <none@none>
Sat, 19 Feb 2005 11:46:27 +0000 (11:46 +0000)
committercarolyn <none@none>
Sat, 19 Feb 2005 11:46:27 +0000 (11:46 +0000)
src/vm/global.h
src/vm/jit/inline/inline.c
src/vm/jit/inline/parseRT.c
src/vm/jit/inline/parseXTA.c
src/vm/jit/inline/sets.c
src/vm/jit/inline/sets.h

index fd17e5b35ef23b4f9bf9deedfff061cee47aac7d..73408afb00ff7a964a62f3c896d6b253cd6a5a45 100644 (file)
@@ -32,7 +32,7 @@
                        Edwin Steiner
             Joseph Wenninger
 
-   $Id: global.h 1931 2005-02-10 10:55:47Z twisti $
+   $Id: global.h 1959 2005-02-19 11:46:27Z carolyn $
 
 */
 
@@ -503,9 +503,10 @@ typedef struct xtainfo {
        /*classSet      *PartClassSet */   /* method class type set                 */ 
 
        classSetNode    *paramClassSet; /* cone set of methods parameters       */
-
-       methSet         *calls;            /* methods this method calls                 */ 
-       methSet         *calledBy;         /* methods that call this method         */ 
+       
+       /* Needed for interative checking */
+       methSet         *calls;            /* Edges - methods this method calls                 */ 
+       methSet         *calledBy;         /* Edges - methods that call this method         */ 
        methSet         *marked;  /*not in Dez*/         /* methods that marked by this method    */ 
        methSet         *markedBy;
        fldSet          *fldsUsed;         /* fields used by this method             */ 
index cf447ca1348ab2072cbb9b662d0d3bcbfd3573e2..0fd765e1dc7e80b3b0e7d078e7c18e88edb494f8 100644 (file)
@@ -28,7 +28,7 @@ globals moved to structure and passed as parameter
 
    Authors: Dieter Thuernbeck
 
-   $Id: inline.c 1750 2004-12-10 23:21:03Z carolyn $
+   $Id: inline.c 1959 2005-02-19 11:46:27Z carolyn $
 
 */
 
@@ -70,7 +70,6 @@ Method to be inlined must:
 #include "vm/jit/jit.h"
 #include "vm/jit/parse.h"
 #include "vm/jit/inline/inline.h"
-#include "vm/jit/inline/sets.h"
 
 #undef  INVIRTDEBUG  /* prints if a method was found to be 
                         a unique virt/interface method  definition */
index 9912ff51cf63323bf05f322d82b6a74389738ad3..b2e41b9b50045c84fa475ea506c6607a47335b63 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Carolyn Oates
 
-   $Id: parseRT.c 1927 2005-02-10 10:50:55Z twisti $
+   $Id: parseRT.c 1959 2005-02-19 11:46:27Z carolyn $
 
 */
 
@@ -165,8 +165,8 @@ void rtaAddUsedInterfaceMethods(classinfo *ci) {
                                                /* 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))
+                                       if ((utf_clinit != imi->name) &&
+                                           (utf_init != imi->name))
                                            rtaMarkSubs(ci,imi);
                                }
                        }
@@ -232,8 +232,8 @@ void RTAaddClassInit(classinfo *ci, bool clinits, bool finalizes, bool addmark)
        
   if (clinits) { /* No <clinit>  available - ignore */
     mi = class_findmethod(ci, 
-                       utf_new_char("<clinit>")
-                       utf_new_char("()V"));
+                       utf_clinit
+                       utf_void__void);
     if (mi) { 
        if (ci->classUsed != USED)
            ci->classUsed = PARTUSED;
@@ -251,7 +251,7 @@ void RTAaddClassInit(classinfo *ci, bool clinits, bool finalizes, bool addmark)
   if (finalizes) {
     mi = class_findmethod(ci, 
                        utf_new_char("finalize"), 
-                       utf_new_char("()V"));
+                       utf_void__void);
     if (mi) { 
        if (ci->classUsed != USED)
            ci->classUsed = PARTUSED;
@@ -424,12 +424,6 @@ void rtaMarkInterfaceSubs(methodinfo *mi) {
                } /* end while */
 } 
 
-
-
-
-
-
-
 /*********************************************************************/
 
 int parseRT(methodinfo *m)
@@ -539,9 +533,6 @@ if ((RTA_DEBUGr)||(RTA_DEBUGopcodes)) printf("\n");
                                        return 0; /* was NULL */
 
                                CLASSNAME(fi->class,"\tPUT/GETSTATIC: ",RTA_DEBUGr);
-                               if (!fi->class->initialized) {
-                                       m->isleafmethod = false;
-                                       }       
                                RTAaddClassInit(        fi->class,
                                                CLINITS_T,FINALIZE_T,ADDMARKED_F);
                        }
@@ -556,7 +547,6 @@ if ((RTA_DEBUGr)||(RTA_DEBUGopcodes)) printf("\n");
                                constant_FMIref *mr;
                                methodinfo *mi;
 
-                               m->isleafmethod = false;
                                mr = class_getconstant(m->class, i, CONSTANT_Methodref);
                                LAZYLOADING(mr->class) 
                                mi = class_resolveclassmethod(  mr->class,
@@ -576,81 +566,73 @@ if ((RTA_DEBUGr)||(RTA_DEBUGopcodes)) printf("\n");
                                     || (mi->flags & ACC_PRIVATE)  
                                     || (mi->flags & ACC_FINAL) )  
                                        {
-                                       if (mi->class->classUsed == PARTUSED){ 
-                                                       RTAaddClassInit(mi->class, 
+                                       if (mi->class->classUsed != USED){ /* = NOTUSED or PARTUSED */
+                                               RTAaddClassInit(mi->class, 
                                                                CLINITS_T,FINALIZE_T,ADDMARKED_T); 
-                                                       } 
-                                       else { 
-                                               if (mi->class->classUsed == NOTUSED){ 
-                                                               RTAaddClassInit(mi->class, 
-                                                                       CLINITS_T,FINALIZE_T,ADDMARKED_T); 
-                                                       if (mi->class->classUsed == NOTUSED){    
-                                                                       /* Leaf methods are used whether class is or not */
-                                                                       /*   so mark class as PARTlyUSED                 */
-                                                       mi->class->classUsed = PARTUSED;                                                   
-                                                                       }  
-                                                               } 
-                                                       } 
-                                               /* Add to RTA working list/set of reachable methods     */
-                                               if (opcode == JAVA_INVOKESTATIC)  /* if stmt just for debug tracing */     
-                                                       addToRtaWorkList(mi, 
+                                                               /* Leaf methods are used whether class is or not */
+                                                               /*   so mark class as PARTlyUSED                 */
+                                               mi->class->classUsed = PARTUSED; 
+                                               } 
+                                       /* Add to RTA working list/set of reachable methods     */
+                                       if (opcode == JAVA_INVOKESTATIC)  /* if stmt just for debug tracing */     
+                                               addToRtaWorkList(mi, 
                                                                "addTo INVOKESTATIC "); 
-                                               else 
-                                                       addToRtaWorkList(mi, 
+                                       else 
+                                               addToRtaWorkList(mi, 
                                                                "addTo INVOKESPECIAL ");        
-                                               
+                                       } 
                                        
-                                       else {
+                                  else {
                                        /*---- Handle special <init> calls ---------------------------------------------*/
                                   
-                                               if (mi->class->classUsed != USED) {
-                                               /* RTA special case:
-                                                       call of super's <init> then
-                                                       methods of super class not all used */
+                                       if (mi->class->classUsed != USED) {
+                                       /* RTA special case:
+                                               call of super's <init> then
+                                               methods of super class not all used */
                                                        
-                                               /*--- <init>  ()V  is equivalent to "new" 
-                                                       indicating a class is used = instaniated ---- */        
-                                               if (utf_new_char("<init>")==mi->name) {
-                                                       if ((m->class->super == mi->class) 
-                                                       &&  (m->descriptor == utf_new_char("()V")) ) 
-                                                                       {
-                                                                       METHINFOt(mi,"SUPER INIT:",RTA_DEBUGopcodes);
-                                                                       /* super init so class may be only used because of its sub-class */
-                                                               RTAaddClassInit(mi->class,
+                                               /*--- <init>  ()V  is equivalent to "new" 
+                                               indicating a class is used = instaniated ---- */        
+                                               if (utf_init==mi->name) {
+                                                       if ((m->class->super == mi->class) 
+                                                       &&  (m->descriptor == utf_void__void) ) 
+                                                               {
+                                                               METHINFOt(mi,"SUPER INIT:",RTA_DEBUGopcodes);
+                                                               /* super init so class may be only used because of its sub-class */
+                                                               RTAaddClassInit(mi->class,
                                                                        CLINITS_T,FINALIZE_T,ADDMARKED_F);
-                                                                       if (mi->class->classUsed == NOTUSED) mi->class->classUsed = PARTUSED;
-                                                                       }
-                                                       else {
-                                                               /* since <init> indicates classes is used, then add marked methods, too */
-                                                                       METHINFOt(mi,"NORMAL INIT:",RTA_DEBUGopcodes);
-                                                               RTAaddClassInit(mi->class,
-                                                                               CLINITS_T,FINALIZE_T,ADDMARKED_T);
-                                                               }
-                                                               addToRtaWorkList(mi,
-                                                                       "addTo INIT ");
-                                                               } /* end just for <init> ()V */
+                                                               if (mi->class->classUsed == NOTUSED) mi->class->classUsed = PARTUSED;
+                                                               }
+                                                       else {
+                                                               /* since <init> indicates classes is used, then add marked methods, too */
+                                                               METHINFOt(mi,"NORMAL INIT:",RTA_DEBUGopcodes);
+                                                               RTAaddClassInit(mi->class,
+                                                                       CLINITS_T,FINALIZE_T,ADDMARKED_T);
+                                                               }
+                                                       addToRtaWorkList(mi,
+                                                               "addTo INIT ");
+                                                       } /* end just for <init> ()V */
                                                        
-                                                       /* <clinit> for class inits do not add marked methods; class not yet instaniated */      
-                                                       if (utf_new_char("<clinit>")==mi->name)
-                                                               RTAaddClassInit(        mi->class,
-                                                                       CLINITS_T,FINALIZE_T,ADDMARKED_F);
-
-                                                       if (!((utf_new_char("<init>")==mi->name))
-                                                       ||   (utf_new_char("<clinit>")==mi->name)) {
-                                                               METHINFOt(mi,"SPECIAL not init:",RTA_DEBUGopcodes)
-                                                               if (mi->class->classUsed !=USED)
-                                                                       mi->class->classUsed = PARTUSED;
-                                                               addToRtaWorkList(mi,
-                                                                       "addTo SPEC notINIT ");
-                                                               
-                                                               
-                                                       } /* end init'd class not used = class init process was needed */ 
+                                               /* <clinit> for class inits do not add marked methods; class not yet instaniated */      
+                                               if (utf_clinit==mi->name)
+                                                       RTAaddClassInit(        mi->class,
+                                                                               CLINITS_T,FINALIZE_T,ADDMARKED_F);
+
+                                               if (!((utf_init==mi->name))
+                                               ||   (utf_clinit==mi->name)) {
+                                                       METHINFOt(mi,"SPECIAL not init:",RTA_DEBUGopcodes)
+                                                       if (mi->class->classUsed !=USED)
+                                                               mi->class->classUsed = PARTUSED;
+                                                       addToRtaWorkList(mi,
+                                                               "addTo SPEC notINIT ");
+                                                       } 
+                                                                       
+                                               } /* end init'd class not used = class init process was needed */ 
                                                        
-                                               /* add method to RTA list = set of reachable methods */ 
-                                               addToRtaWorkList(mi,
+                                       /* add method to RTA list = set of reachable methods */ 
+                                       addToRtaWorkList(mi,
                                                        "addTo SPEC whymissed ");
-                                               } /* end inits */
-                                       
+                                       } /* end inits */
+                                  } 
 /***  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
@@ -668,7 +650,6 @@ utf_display(mr->descriptor); printf("\n");fflush(stdout);
                                constant_FMIref *mr;
                                 methodinfo *mi;
 
-                                       m->isleafmethod = false;
                                mr = m->class->cpinfos[i];
                                 /*mr = class_getconstant(m->class, i, CONSTANT_Methodref)*/
                                LAZYLOADING(mr->class) 
@@ -713,8 +694,6 @@ utf_display(mr->descriptor); printf("\n");fflush(stdout);
                                 constant_FMIref *mr;
                                 methodinfo *mi;
 
-                                m->isleafmethod = false;
-
                                 mr = class_getconstant(m->class, i, CONSTANT_InterfaceMethodref);
                                 LAZYLOADING(mr->class)
 
@@ -742,9 +721,7 @@ 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;  */
                        /* add marked methods */
                        CLASSNAME(ci,"NEW : do nothing",RTA_DEBUGr);
                        RTAaddClassInit(ci, CLINITS_T, FINALIZE_T,ADDMARKED_T);   
@@ -807,16 +784,15 @@ else
        addToRtaWorkList(callmeth,txt);
 
 
-/*--  
-    Initialize RTA work list with methods/classes from:  
+/*-- ----------------------------------------------------------------------------- 
       System calls 
        and 
       rtMissedIn list (missed becaused called from NATIVE &/or dynamic calls
---*/
+ *-- -----------------------------------------------------------------------------*/
 methodinfo *initializeRTAworklist(methodinfo *m) {
        classinfo  *c;
         methodinfo* callmeth;
-       char systxt[]    = "System     Call :";
+               char systxt[]    = "System     Call :";
        char missedtxt[] = "rtMissedIn Call :";
 
        FILE *rtMissedIn; /* Methods missed during previous RTA parse */
@@ -863,6 +839,7 @@ methodinfo *initializeRTAworklist(methodinfo *m) {
 
 
 
+/*-------------------------------------------------------------------------------*/
 methodinfo *missedRTAworklist()  
 {
        FILE *rtMissedIn; /* Methods missed during previous RTA parse */
@@ -891,11 +868,8 @@ methodinfo *missedRTAworklist()
            class = strtok(line, " \n");
            meth  = strtok(NULL, " \n");
            desc  = strtok(NULL, " \n");
-           if ((class == NULL) || (meth == NULL) || (desc == NULL)) { 
-               fprintf(stderr,"Error in rtMissedIn file for: %s.%s %s\n",class, meth, desc); 
-               fflush(stderr);
+           if ((class == NULL) || (meth == NULL) || (desc == NULL))  
                panic ("Error in rtMissedIn file for: class.meth, desc\n"); 
-               }
            SYSADD(class,meth,desc,missedtxt)
            }
        fclose(rtMissedIn);
index 135eb3522b8088d47302d536c5e9b6b416334046..1943191807514df09a019fe50860cdcc345a9b2e 100644 (file)
 
    Authors: Carolyn Oates
 
-   $Id: parseXTA.c 1927 2005-02-10 10:50:55Z twisti $
+   $Id: parseXTA.c 1959 2005-02-19 11:46:27Z carolyn $
 
 */
 
+/*--------------------------------------
+XTA so far
+static
+fields
+virtual 
+interfaces - started
+clinit / final
+general initialization 
+----
+interfaces
++ hand coded calls for system
+2nd interation (want to try it in inlining)
+
+Testing
+
+?? PARTUSED???
+----------------------------------*/
+
 /***************
Rapid Type Static Analysis of Java program
XTA Type Static Analysis of Java program
    used -xta option is turned on either explicitly 
  or automatically with inlining of virtuals.
 
+ XTA is called for reachable methods and keeps sets for each Method and Field used as follows:
+1. Work list of reachable methods is initialized to main + JVM called methods 
+                                               + missed methods
+2. For virtual method call from M of e.m then
+  a. Add all static lookup of m in the cone of e = ce.mi to reachable worklist
+       JAVA_INVOKESTATIC/ JAVA_INVOKESPECIAL - addXTAcallededges
+       JAVA_INVOKEVIRTUAL - xtaMarkSubs
+       JAVA_INVOKEINTERFACES
+  b. Add mi's parameters class + subtypes that are used by M to mi used classes
+       When XTA parsed follow the calls list (beg. parseXTA)
+  c. Add mi's return type + subtypes used by mi to M's used classes
+       When XTA parsed follow the calledBy list (end parseXTA)
+  d. Add ce of mi to mi's used classes
+       static/special  - addXTAcalledges
+
+3. new C (new, <init>, & similiar) then add  C to M's used classes
+       JAVA_NEW, INVOKE_SPECIAL <init>, JAVA_CHECKCAST / JAVA_INSTANCEOF - classinit 
+4. read Field X.f: add X to M's used classes
+       JAVA_GETSTATIC
+5. write Field X.f: add X+subtypes that are used by M to X's classes
+       JAVA_PUTSTATIC
+
+ If M calls 
  USAGE:
  Methods called by NATIVE methods and classes loaded dynamically
  cannot be found by parsing. The following files supply missing methods:
@@ -85,205 +127,391 @@ bool XTA_DEBUGinf = false;
 bool XTA_DEBUGr = false;
 bool XTA_DEBUGopcodes = false;
  
+/*********************************************************************/
+/*********************************************************************/
 
+/*-------------------------------------------------------------------------------*/
 
-/*********************************************************************/
+xtafldinfo * xtafldinfoInit (fieldinfo *f)
+{
+        if (f->xta != NULL)
+                return f->xta;
 
-void addToXtaWorkList(methodinfo *meth, char *info) {
-    xtaNode    *xta;
+        f->xta = NEW(xtafldinfo);
 
-if (meth->methodUsed == USED) return;
+        f->xta->fieldChecked = false;
+        f->xta->fldClassType = NULL;
+        f->xta->XTAclassSet = NULL;
 
-if (!(meth->flags & ACC_ABSTRACT))  {
-    count_methods_marked_used++;
-    METHINFOt(meth,info,XTA_DEBUGopcodes)
-       if (meth->class->super != NULL) {
-               CLASSNAME(meth->class->super,"\tsuper=",XTA_DEBUGr)
-               }
-       else {
-               if (XTA_DEBUGr) printf("\tsuper=NULL\n");}
-       fflush(stdout);
-    meth ->methodUsed = USED;
+        return f->xta;
+}
+
+/*-------------------------------------------------------------------------------*/
+
+xtainfo *xtainfoInit(methodinfo *m)
+{
+        if (m->xta != NULL)
+                return m->xta; /* already initialized */
+
+       count_methods_marked_used++;
+
+        m ->xta = (xtainfo *) NEW(xtainfo);
+        m ->xta-> XTAmethodUsed = NOTUSED;
+
+       /* xta sets for a method */
+        m->xta->fldsUsed        = NULL;
+        m ->xta-> XTAclassSet   = NULL;
+                               /* Methods's have access to the class they are a part of */
+        m ->xta-> XTAclassSet   = add2ClassSet ( m ->xta-> XTAclassSet, m->class);  
+       /* cone set of methods parameters */ 
+                        /* what if no param?? is it NULL then, too? */ 
+        m->xta->paramClassSet = descriptor2typesL(m); 
+
+       /* Edges */
+        m->xta->calls         = NULL;
+        m->xta->calledBy      = NULL;
+
+        m ->xta->markedBy     = NULL;
+        m->xta->chgdSinceLastParse = false;
+        return m->xta;
+
+       /* thought needed at some earlier point */
+        /*m->xta->marked        = NULL; * comment out*/
+        /*m ->xta->interfaceCalls    = NULL*/
+}
+
+/*-------------------------------------------------------------------------------*/
+void xtaAddCallEdges(methodinfo *mCalls, methodinfo *mCalled, s4 monoPoly, char *info) {
+    xtaNode    *xta;
+
+/* First call to this method initializations */
+if (mCalled->methodUsed != USED) {
+  if (!(mCalled->flags & ACC_ABSTRACT))  {
+    mCalled->xta = xtainfoInit(mCalled);
+    mCalled ->methodUsed = USED; /* used to see if method in the work list of methods */ 
     xta = NEW(xtaNode);
-    xta->method = meth ;
+    xta->method = mCalled ;
     list_addlast(xtaWorkList,xta);
-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,true)
-     }
-***/
+  else return; /* abstract */
+  }
+
+if ((mCalls == NULL) && (monoPoly == SYSCALL)) return;
+/* Add call edges */
+mCalls->xta->calls = add2MethSet(mCalls->xta->calls, mCalled);
+                       /* mono if static, private, final else virtual so poly */
+mCalls->xta->calls->tail->monoPoly = monoPoly;  
+
+mCalled->xta->calledBy = add2MethSet(mCalled->xta->calledBy, mCalls);
+
+/* IS THIS REALLY NEEDED???? */
+if (mCalled->xta->calledBy == NULL) panic("mCalled->xta->calledBy is NULL!!!");
+if (mCalls->xta->calls == NULL) panic("mCalls->xta->calls is NULL!!!");
+
 }
 
-/**************************************************************************/
-void xtaMarkSubs(classinfo *class, methodinfo *topmethod); 
 
-/*------------------------------------------------------------------------*/
-void xtaAddUsedInterfaceMethods(classinfo *ci) {
-       int jj,mm;
+/*-------------------------------------------------------------------------------*/
+bool xtaPassParams (methodinfo *Called, methodinfo *Calls, methSetNode *lastptrInto)
+{
+        classSetNode *p;
+        classSetNode *c;
+        classSetNode *c1;
+        classSetNode *cprev;
+        bool          chgd = false;
+
+        if (lastptrInto->lastptrIntoClassSet2 == NULL) {
+                if (Calls->xta->XTAclassSet != NULL)
+                        c1 = Calls->xta->XTAclassSet->head;
+                 /*else already c1 = NULL; */
+        }
+        else    {
+                /* start with type where left off */
+                c1 = lastptrInto->lastptrIntoClassSet2;
+                c1 = c1 -> nextClass;  /* even if NULL */
+        }
+       if (c1 == NULL) return false;
 
-       /* add used interfaces methods to callgraph */
-       for (jj=0; jj < ci -> interfacescount; jj++) {
-               classinfo *ici = ci -> interfaces [jj];
-       
-               if (XTA_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);
+        cprev = NULL;
+       /* for each Param Class */
+        for (   p=Called->xta->paramClassSet; p != NULL; p = p->nextClass) {
 
-               /* if interface class is used */
-        if (ici -> classUsed != NOTUSED) {
+                /* for each SmCalls class */
+                for (c=c1; c != NULL; c = c->nextClass) {
+                        vftbl_t *p_cl_vt = p->classType->vftbl;
+                        vftbl_t *c_cl_vt = c->classType->vftbl;
 
-                       /* for each interface method implementation that has already been used */
-                       for (mm=0; mm< ici->methodscount; mm++) {
-                               methodinfo *imi = &(ici->methods[mm]);
-                               if (XTA_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 (XTA_DEBUGinf) { 
-                                               printf("Interface Method used: "); utf_display(ici->name);printf(".");method_display(imi);fflush(stdout);
+                        /* if SmCalls class is in the Params Class range */
+                        if (  (p_cl_vt->baseval <=  c_cl_vt->baseval)
+                                  && (c_cl_vt->baseval <= (p_cl_vt->baseval+p_cl_vt->diffval)) ) {
+
+                                /*    add Calls class to CalledBy Class set */
+                                Called->xta->XTAclassSet = Called->xta->XTAclassSet = add2ClassSet(Called->xta->XTAclassSet, c->classType);
+                              chgd = true;
+                        }
+                        cprev = c;
+                }
+        }
+        lastptrInto->lastptrIntoClassSet2 = cprev;
+               return chgd;
+}
 
-                                               /* 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))
-                                           xtaMarkSubs(ci,imi);
-                               }
-                       }
-               }
-       }
 
+/*-------------------------------------------------------------------------------*/
+void xtaPassAllCalledByParams (methodinfo *m) {
+        methSetNode *SmCalled;
+        if (m->xta->calledBy == NULL)
+               return;
+        for (SmCalled  = m->xta->calledBy->head; 
+            SmCalled != NULL; 
+            SmCalled = SmCalled->nextmethRef) {
+                m->xta->chgdSinceLastParse = false;             /* re'init flag */
+                xtaPassParams(m, SmCalled->methRef,SmCalled);   /* chg flag output ignored for 1st regular parse */
+        }
 }
 
 
-/**************************************************************************/
-/* Add Marked methods for input class ci                                  */
-/* Add methods with the same name and descriptor as implemented interfaces*/
-/*   with the same method name                                            */
-/*                                                                        */
-/*------------------------------------------------------------------------*/
-void xtaAddMarkedMethods(classinfo *ci) {
-int ii,jj,mm;
+/*-------------------------------------------------------------------------------*/
+void xtaPassFldPUT(methodinfo *m, fldSetNode *fN)
+{
+       /* Field type is a class */
+       classSetNode *c;
+       classSetNode *c1 = NULL;
+       classSetNode *cp = NULL;
+       classSetNode *cprev= NULL;
+
+       fieldinfo *fi;
+       if (fN != NULL)
+               fi = fN->fldRef;
+       else
+               return;
+
+/* Use lastptr  so don't check whole XTA class set each time */
+       cp = fN->lastptrPUT;
+       if (cp != NULL) {
+               if (cp->nextClass != NULL)
+                       c1 = cp -> nextClass;
+       } 
+       else    {
+               if (m->xta->XTAclassSet != NULL)
+                       c1  = m->xta->XTAclassSet->head;
+       }
 
-/* add marked methods to callgraph */ 
-for (ii=0; ii<ci->methodscount; ii++) { 
-       methodinfo *mi = &(ci->methods[ii]);
+       /*--- PUTSTATIC specific ---*/
+       /* Sx = intersection of type+subtypes(field x)   */
+       /*   and Sm (where putstatic code is)            */
+       for (c=c1; c != NULL; c=c->nextClass) {
+               vftbl_t *f_cl_vt = fi->xta->fldClassType->vftbl;
+               vftbl_t *c_cl_vt =  c->   classType->vftbl;
 
-       if (mi->methodUsed == MARKED) { 
-                       addToXtaWorkList(mi,
-                               "addTo was MARKED:");
+               if ((f_cl_vt->baseval <= c_cl_vt->baseval)
+                       && (c_cl_vt->baseval <= (f_cl_vt->baseval+f_cl_vt->diffval)) ) {
+                       fi->xta->XTAclassSet = add2ClassSet(fi->xta->XTAclassSet,c->classType);
                }
+               cprev = c;
+       }
+       fN->lastptrPUT = cprev;
+}
+/*-------------------------------------------------------------------------------*/
+void xtaPassFldGET(methodinfo *m, fldSetNode *fN)
+{
+       /* Field type is a class */
+       classSetNode *c;
+       classSetNode *c1 = NULL;
+       classSetNode *cp = NULL;
+       classSetNode *cprev= NULL;
+
+       fieldinfo *fi;
+       if (fN != NULL)
+               fi = fN->fldRef;
+       else
+               return;
+
+/* Use lastptr  so don't check whole XTA class set each time */
+       cp = fN->lastptrGET;
+       if (cp != NULL) {
+               if (cp->nextClass != NULL)
+                       c1 = cp -> nextClass;
+       } 
        else    {
-               for (jj=0; jj < ci -> interfacescount; jj++) {
-                       classinfo *ici = ci -> interfaces [jj];
-                       /*  use resolve method....!!!! */
-                       if (ici -> classUsed != NOTUSED) {
-                               for (mm=0; mm< ici->methodscount; mm++) {
-                                       methodinfo *imi = &(ici->methods[mm]);
-                                       METHINFOt(imi,"NEW IMPD INTERFACE:",XTA_DEBUGinf)
-                                     /*if interface method=method is used*/
-                                       if  (      (imi->methodUsed == USED)
-                          &&    ( (imi->name == mi->name) 
-                          &&      (imi->descriptor == mi->descriptor))) {
-                                                 addToXtaWorkList(mi,
-                                    "addTo was interfaced used/MARKED:");
-                                         }
-                                       } /*end for */  
-                               }
+               if (fi->xta->XTAclassSet != NULL)
+                       c1  = fi->xta->XTAclassSet->head;
+       }
+
+       /*--- GETSTATIC specific ---*/
+       /* Sm = union of Sm and Sx */
+       for (c=c1; c != NULL; c=c->nextClass) {
+               bool addFlg = false;
+               if (m->xta->XTAclassSet ==NULL) 
+                       addFlg = true;
+               else    {
+                       if (!(inSet (m->xta->XTAclassSet->head, c->classType) )) 
+                               addFlg = true;
                        }
+               if (addFlg) {
+                       m->xta->XTAclassSet 
+                               = add2ClassSet(m->xta->XTAclassSet,c->classType);
                }
+               cprev = c;
        }
-}    
 
-#define CLINITS_T   true
-#define FINALIZE_T  true
-#define ADDMARKED_T true
+       fN->lastptrGET = cprev;
+}
 
-#define CLINITS_F   false 
-#define FINALIZE_F  false 
-#define ADDMARKED_F false
-/*********************************************************************/
-void XTAaddClassInit(classinfo *ci, bool clinits, bool finalizes, bool addmark)
-{
-  methodinfo *mi;
 
-  if (addmark)
-       ci->classUsed = USED;
+/*-------------------------------------------------------------------------------*/
+void xtaAllFldsUsed (methodinfo *m) {
+        fldSetNode  *f;
+        fldSetNode *f1=NULL;
+        /*      bool chgd = false */
+
+        if (m->xta->fldsUsed == NULL) return;
+
+        /* for each field that this method uses */
+        f1 = m->xta->fldsUsed->head;
+
+        for (f=f1; f != NULL; f = f->nextfldRef) {
+
+                if (f->writePUT)
+                        xtaPassFldPUT(m,f);
+                if (f->readGET)
+                        xtaPassFldGET(m,f);
+        }
+}
+
+/*-------------------------------------------------------------------------------*/
+bool xtaPassReturnType(methodinfo *Called, methodinfo *Calls) {
+
+       classSetNode* cs;
+       classSetNode* cs1;
+       bool          fchgd = false;
+
+       /* Get Called return class is null */
+       if ((Called->returnclass == NULL) && (Called->xta->paramClassSet == NULL)) {
+               Called->xta->paramClassSet = descriptor2typesL(Called); /* old comment - in new xta struc init */ 
+       }
+
+       if (Called->returnclass == NULL) {
+               return fchgd;
+       }
        
-  if (clinits) { /* No <clinit>  available - ignore */
-    mi = class_findmethod(ci, 
-                       utf_new_char("<clinit>"), 
-                       utf_new_char("()V"));
-    if (mi) { 
-       if (ci->classUsed != USED)
-           ci->classUsed = PARTUSED;
-       mi->monoPoly = MONO;
-        addToXtaWorkList(mi,"addTo CLINIT added:");
-      }     
-    }        
+       if (Called->xta->XTAclassSet == NULL) 
+               cs1 = NULL;
+       else
+               cs1 =  Called->xta->XTAclassSet->head;
+
+       for (cs =cs1; cs != NULL; cs = cs->nextClass) {
+               classinfo *c = cs->classType;
+               vftbl_t *r_cl_vt = Called->returnclass->vftbl; 
+               vftbl_t *c_cl_vt = c->vftbl; 
+
+               /* if class is a subtype of the return type, then add to Calls class set (ie.interscection)*/
+               if (  (r_cl_vt->baseval <=  r_cl_vt->baseval)
+                         && (c_cl_vt->baseval <= (r_cl_vt->baseval+r_cl_vt->diffval)) ) {
+                       Calls->xta->XTAclassSet = add2ClassSet(Calls->xta->XTAclassSet, c);  
+                       fchgd = true;
+               }
+       } 
 
-  /*Special Case for System class init:
-    add java/lang/initializeSystemClass to callgraph */
-  if (ci->name == utf_new_char("initializeSystemClass")) {
-    /* ?? what is name of method ?? */ 
-    } 
+       return fchgd; 
+}
 
-  if (finalizes) {
-    mi = class_findmethod(ci, 
-                       utf_new_char("finalize"), 
-                       utf_new_char("()V"));
-    if (mi) { 
-       if (ci->classUsed != USED)
-           ci->classUsed = PARTUSED;
-       mi->monoPoly = MONO;
-        addToXtaWorkList(mi,"addTo FINALIZE added:");
-      }     
-    }        
 
-  if (addmark) {
-    xtaAddMarkedMethods(ci);
-    }
-    xtaAddUsedInterfaceMethods(ci);
+/*-------------------------------------------------------------------------------*/
+void  xtaMethodCalls_and_sendReturnType(methodinfo *m)
+{
+        methSetNode *SmCalled;  /* for return type       */
+        methSetNode *SmCalls;   /* for calls param types */
+        methSetNode *s1=NULL;
+        bool chgd = false;
+        xtaAllFldsUsed (m);
+
+        /* for each method that this method calls */
+        if (m->xta->calls == NULL)
+                s1 = NULL;
+        else
+                s1 = SmCalls=m->xta->calls->head;
+
+        for (SmCalls=s1; SmCalls != NULL; SmCalls = SmCalls->nextmethRef) {
+                /*    pass param types  */
+                bool chgd = false;
+                chgd = xtaPassParams (SmCalls->methRef, m, SmCalls);
+                /* if true chgd after its own parse */
+                if (!(SmCalls->methRef->xta->chgdSinceLastParse)) {
+                        SmCalls->methRef->xta->chgdSinceLastParse = true;
+                }
+        }
 
+        /* for each calledBy method */
+        /*    send return type */
+        if (m->xta->calledBy == NULL)
+                s1 = NULL;
+        else
+                s1 = m->xta->calledBy->head;
+        for (SmCalled=s1; SmCalled != NULL; SmCalled = SmCalled->nextmethRef) {
+
+                chgd = xtaPassReturnType(m, SmCalled->methRef);
+                if (!(SmCalled->methRef->xta->chgdSinceLastParse)) {
+                        SmCalled->methRef->xta->chgdSinceLastParse = chgd;
+                }
+        }
 }
 
+/*-------------------------------------------------------------------------------*/
+bool xtaAddFldClassTypeInfo(fieldinfo *fi) {
+
+       bool is_classtype = false; /* return value */
+
+       if (fi->xta->fieldChecked) {
+               if (fi->xta->fldClassType != NULL)
+                       return true;  /* field has a class type */
+               else
+                       return false;
+       }
+       fi->xta->fieldChecked = true;
+
+       if (fi->type == TYPE_ADDRESS) {
+               char *utf_ptr = fi->descriptor->text;  /* current position in utf text */
+
+               if (*utf_ptr != 'L') {
+                       while (*utf_ptr++ =='[') ;
+               }
+
+               if (*utf_ptr =='L') {
+                       is_classtype = true;
+                       if  (fi->xta->fldClassType== NULL) {
+                               char *desc;
+                               char *cname;
+                               classinfo * class;
+
+                               desc = MNEW(char, 256);
+                               strcpy(desc,++utf_ptr);
+                               cname = strtok(desc,";");
+                               class = class_get(utf_new_char(cname));
+                               fi->xta->fldClassType= class;    /* save field's type class ptr */      
+                       } 
+               }
+       }
+       return is_classtype;
+}
 
 /*--------------------------------------------------------------*/
 /* Mark the method with same name /descriptor in topmethod      */
 /* in class                                                     */
 /*                                                              */
 /* Class marked USED and method defined in this class ->        */
-/*    -> mark method as USED                                    */
+/*    -> add call edges = USED                                  */
 /* Class not marked USED and method defined in this class ->    */
 /*    -> if Method NOTUSED mark method as MARKED                */
 /*                                                              */
 /* Class USED, but method not defined in this class ->          */
 /* -> 1) search up the heirarchy and mark method where defined  */
 /*    2) if class where method is defined is not USED ->        */
-/*       -> mark class with defined method as PARTUSED          */
+/*       -> ????mark class with defined method as PARTUSED          */
 /*--------------------------------------------------------------*/
 
-void xtaMarkMethod(classinfo *class, methodinfo *topmethod) {
+
+void xtaMarkMethod(classinfo *class, methodinfo *mCalls, methodinfo *topmethod, classSetNode *subtypesUsedSet) {
 
 utf *name      = topmethod->name; 
 utf *descriptor = topmethod->descriptor;
@@ -298,29 +526,35 @@ if (submeth == NULL) {
        printf("parse XTA: Method not found in class hierarchy");fflush(stdout);
        panic("parse XTA: Method not found in class hierarchy");
        }
-if (submeth->methodUsed == USED) return;
-  
+
+/* if submeth called previously from this method then return */
+if (mCalls->xta->calls != NULL) {
+       if (inMethSet(mCalls->xta->calls->head,submeth)) return;
+       }
+
 #undef CTA 
 #ifdef CTA
   /* Class Type Analysis if class.method in virt cone marks it used */
   /*   very inexact, too many extra methods */
-  XTAaddClassInit(     submeth->class,
+  XTAaddClassInit(submeth,     submeth->class,
                CLINITS_T,FINALIZE_T,ADDMARKED_T);
-  submeth->monoPoly = POLY;
-  addToXtaWorkList(submeth,
-                  "addTo XTA VIRT CONE:");
+  if (inSet(subtypesUsedSet,submeth->class)) {
+      submeth->monoPoly = POLY;
+      xtaAddCallEdges(mCalls, submeth, submeth->monoPoly, 
+                     "addTo XTA VIRT CONE:");
+      }
   return;
 #endif
 
   if (submeth->class == class) { 
 
        /*--- Method defined in class -----------------------------*/
-       if (  submeth->class->classUsed == USED) { 
+       if (inSet(subtypesUsedSet,submeth->class)) {
                /* method defined in this class -> */
                /* Class IS  marked USED           */ 
                /*    -> mark method as USED       */
                submeth->monoPoly = POLY;
-               addToXtaWorkList(submeth,
+               xtaAddCallEdges(mCalls, submeth, submeth->monoPoly, 
                        "addTo VIRT CONE 1:");
                }
        else    {
@@ -330,7 +564,7 @@ if (submeth->methodUsed == USED) return;
                METHINFOt(submeth,
                        "\tmarked VIRT CONE 2:",XTA_DEBUGr);
                submeth->monoPoly = POLY;
-               submeth->methodUsed = MARKED;
+               submeth->xta->markedBy = add2MethSet(submeth->xta->markedBy,mCalls);
                /* Note: if class NOTUSED and subclass is used handled  */
                /*       by subsequent calls to xtaMarkMethods for cone */
                }
@@ -339,19 +573,19 @@ if (submeth->methodUsed == USED) return;
   else {
        /*--- Method NOT defined in class ---------------*/
         /* first mark classes if needed */
-       if (submeth->class->classUsed == NOTUSED) {
-               submeth->class->classUsed = PARTUSED;
-               if (class->classUsed != USED) {
+       if (!(inSet(subtypesUsedSet,submeth->class))) {
+               submeth->class->classUsed = PARTUSED; /**** ???? equivalant for xta ???? */
+               if (!(inSet(subtypesUsedSet,class))) {
                        submeth->monoPoly = POLY;
-                       submeth->methodUsed = MARKED;
+                       submeth->xta->markedBy = add2MethSet(submeth->xta->markedBy,mCalls);
                        METHINFOt(submeth,"JUST MARKED :",XTA_DEBUGr);
                        }
                }
         /* add method to xta work list if conditions met */
                /*??if ( (submeth->class->classUsed == USED) ||  */
-       if (class->classUsed == USED) {
+       if (inSet(subtypesUsedSet,class)) {
                submeth->monoPoly = POLY;
-               addToXtaWorkList(submeth,
+               xtaAddCallEdges(mCalls, submeth, submeth->monoPoly, 
                                "addTo VIRT CONE 3:");
                }
        } /* end NOT defined in class */
@@ -363,31 +597,180 @@ if (submeth->methodUsed == USED) return;
 /*   and any subclass where the method is defined and/or class is used  */
 /*                                                                      */
 /*----------------------------------------------------------------------*/
-void xtaMarkSubs(classinfo *class, methodinfo *topmethod) {
 
-  /* Mark method in class  */
-  CLASSNAME1(class," MARKSUBS ",XTA_DEBUGr);
-  METHINFOt(topmethod," TOP ",XTA_DEBUGr);
-  xtaMarkMethod(class, topmethod);  
+void xtaMarkSubs(methodinfo *mCalls, classinfo *class, methodinfo *topmethod, classSetNode *subtypesUsedSet) {
+        /* xtaPRINTmarkSubs1*/
+        xtaMarkMethod(class, mCalls, topmethod, subtypesUsedSet);   /* Mark method in class where it was found */
+        if (class->sub != NULL) {
+                classinfo *subs;
 
-  /* Mark method in subclasses */
-  if (class->sub != NULL) {
-     classinfo *subs;
+                if (!(topmethod->flags & ACC_FINAL )) {
+                        for (subs = class->sub; subs != NULL; subs = subs->nextsub) {
+                                /* xtaPRINTmarkSubs1 */
+                                xtaMarkSubs(mCalls, subs, topmethod, subtypesUsedSet);
+                                }
+                        }
+                }
+}
+
+
+/**************************************************************************/
+/* Add Marked methods for input class ci                                  */
+/* Add methods with the same name and descriptor as implemented interfaces*/
+/*   with the same method name                                            */
+/*  ??? not XTA checked                                                                      */
+/*------------------------------------------------------------------------*/
+void xtaAddMarkedMethods(methodinfo *mCalls, classinfo *ci) {
+int ii,jj,mm;
+
+/* add marked methods to callgraph */ 
+for (ii=0; ii<ci->methodscount; ii++) { 
+       methodinfo *mi = &(ci->methods[ii]);
+
+       if (mi->methodUsed == MARKED) { 
+               xtaAddCallEdges(mCalls, mi, MONO,  /* SHOULD this really be MONO ?????? */
+                               "addTo was MARKED:");
+               }
+       else    {
+               for (jj=0; jj < ci -> interfacescount; jj++) {
+                       classinfo *ici = ci -> interfaces [jj];
+                       /*  use resolve method....!!!! */
+                       if (ici -> classUsed != NOTUSED) {
+                               for (mm=0; mm< ici->methodscount; mm++) {
+                                       methodinfo *imi = &(ici->methods[mm]);
+                                       METHINFOt(imi,"NEW IMPD INTERFACE:",XTA_DEBUGinf)
+                                     /*if interface method=method is used*/
+                                       if  (      (imi->methodUsed == USED)
+                          &&    ( (imi->name == mi->name) 
+                          &&      (imi->descriptor == mi->descriptor))) {
+                               xtaAddCallEdges(mCalls, mi, mi->monoPoly, 
+                                    "addTo was interfaced used/MARKED:");
+                                         }
+                                       } /*end for */  
+                               }
+                       }
+               }
+       }
+}    
+void xtaAddUsedInterfaceMethods(methodinfo *m, classinfo *ci); /* prototype until check code for xta */
+
+/*----------------------------------------------------------------------*/
+
+#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 XTAaddClassInit(methodinfo *mCalls, classinfo *ci, bool clinits, bool finalizes, bool addmark)
+{
+  methodinfo *mi;
+
+  if (addmark)
+       ci->classUsed = USED;
        
-     if (!(topmethod->flags & ACC_FINAL )) {
-       for (subs = class->sub;subs != NULL;subs = subs->nextsub) {
-         CLASSNAME1(subs," SUBS ",XTA_DEBUGr);
-         xtaMarkSubs(subs, topmethod); 
-         }
+  if (clinits) { /* No <clinit>  available - ignore */
+    mi = class_findmethod(ci, utf_clinit, utf_void__void); 
+    if (mi) { 
+       if (ci->classUsed != USED)
+           ci->classUsed = PARTUSED;
+        mi->monoPoly = MONO;
+       xtaAddCallEdges(mCalls, mi, mi->monoPoly, 
+                       "addTo CLINIT added:");
+      }     
+    }        
+
+  /*Special Case for System class init:
+    add java/lang/initializeSystemClass to callgraph */
+  if (ci->name == utf_new_char("initializeSystemClass")) {
+    /* ?? what is name of method ?? */ 
+    } 
+
+  if (finalizes) {
+    mi = class_findmethod(ci, utf_finalize, utf_void__void);
+    if (mi) { 
+       if (ci->classUsed != USED)
+           ci->classUsed = PARTUSED;
+       mi->monoPoly = MONO;
+       xtaAddCallEdges(mCalls, mi, mi->monoPoly, 
+                       "addTo FINALIZE added:");
+      }     
+    }        
+
+  if (addmark) {
+    xtaAddMarkedMethods(mCalls, ci);
+    }
+  xtaAddUsedInterfaceMethods(mi,ci);
+
+}
+
+/*-------------------------------------------------------------------------------*/
+
+/*********************************************************************/
+/*********************************************************************/
+
+/**************************************************************************/
+
+/*------------------------------------------------------------------------*/
+void xtaAddUsedInterfaceMethods(methodinfo *m, classinfo *ci) {
+       int jj,mm;
+
+       /* add used interfaces methods to callgraph */
+       for (jj=0; jj < ci -> interfacescount; jj++) {
+               classinfo *ici = ci -> interfaces [jj];
+       
+               if (XTA_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 (XTA_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 (XTA_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_clinit != imi->name) &&
+                                           (utf_init != imi->name))
+                                               {
+                                               classSetNode *subtypesUsedSet = NULL;
+                                               xtaMarkSubs(m, ci, imi, subtypesUsedSet); /*** CODE not finished for set */
+                                               }
+                               }
+                       }
+               }
        }
-     }
-  return;
+
 }
 
 
 /*********************************************************************/
 
-void xtaMarkInterfaceSubs(methodinfo *mi) {                            
+void xtaMarkInterfaceSubs(methodinfo *m, methodinfo *mi) {                             
        classSetNode *subs;
        if (mi->class->classUsed == NOTUSED) {
                mi->class->classUsed = USED; 
@@ -407,18 +790,30 @@ void xtaMarkInterfaceSubs(methodinfo *mi) {
                         fflush(stdout);
                        }
        while (subs != NULL) {                  
-               classinfo * isubs = subs->classType;
                methodinfo *submeth;
                   if (XTA_DEBUGinf) {
-                      printf("\t");utf_display(isubs->name);fflush(stdout);
-                       printf(" <%i>\n",isubs->classUsed);fflush(stdout);
+                      printf("\t");utf_display(subs->classType->name);fflush(stdout);
+                       printf(" <%i>\n",subs->classType->classUsed);fflush(stdout);
                        }
                /*Mark method (mark/used) in classes that implement method*/
                                                
-               submeth = class_findmethod(isubs,mi->name, mi->descriptor); 
-               if (submeth != NULL)
+               submeth = class_findmethod(subs->classType, mi->name, mi->descriptor); 
+               if (submeth != NULL) {
+                       classSetNode *subtypesUsedSet = NULL;
                        submeth->monoPoly = POLY; /*  poly even if nosubs */
-               xtaMarkSubs(isubs, mi);  
+                       mi->xta->XTAmethodUsed = USED;
+                       if (m->xta->XTAclassSet != NULL) {
+                               subtypesUsedSet =
+                               intersectSubtypesWithSet
+                                       (subs->classType, m->xta->XTAclassSet->head);
+
+                                 subtypesUsedSet =
+                                 intersectSubtypesWithSet(mi->class, m->xta->XTAclassSet->head);
+                               }
+                         else
+                                 subtypesUsedSet = addElement(subtypesUsedSet, m->class);
+                         xtaMarkSubs(m, subs->classType, mi, subtypesUsedSet);
+                         }
                                
                subs = subs->nextClass;
                } /* end while */
@@ -428,7 +823,7 @@ void xtaMarkInterfaceSubs(methodinfo *mi) {
 
 
 
-
+                               
 
 /*********************************************************************/
 
@@ -443,6 +838,12 @@ int parseXTA(methodinfo *m)
 
 METHINFOt(m,"\n----XTA PARSING:",XTA_DEBUGopcodes); 
 if ((XTA_DEBUGr)||(XTA_DEBUGopcodes)) printf("\n");
+        if (m->xta == NULL) {
+               xtainfoInit (m);
+               }
+       else    {
+               xtaPassAllCalledByParams (m); 
+               }
 
 /* scan all java instructions */
        for (p = 0; p < m->jcodelength; p = nextp) {
@@ -518,8 +919,8 @@ if ((XTA_DEBUGr)||(XTA_DEBUGopcodes)) printf("\n");
                                 break;
                         }
  /*********************/
-               case JAVA_PUTSTATIC:
-               case JAVA_GETSTATIC:
+
+               case JAVA_PUTSTATIC: /* write */
 
                        i = code_get_u2(p + 1,m);
                        {
@@ -538,12 +939,42 @@ if ((XTA_DEBUGr)||(XTA_DEBUGopcodes)) printf("\n");
                                if (!fi)
                                        return 0; /* was NULL */
 
-                               CLASSNAME(fi->class,"\tPUT/GETSTATIC: ",XTA_DEBUGr);
-                               if (!fi->class->initialized) {
-                                       m->isleafmethod = false;
-                                       }       
-                               XTAaddClassInit(        fi->class,
+                               fi->xta = xtafldinfoInit(fi);
+                               XTAaddClassInit(m,      fi->class,
                                                CLINITS_T,FINALIZE_T,ADDMARKED_F);
+                               if (xtaAddFldClassTypeInfo(fi)) {
+                                       m->xta->fldsUsed = add2FldSet(m->xta->fldsUsed, fi, true,false);
+                                       }
+                       }
+                       break;
+
+
+               case JAVA_GETSTATIC: /* read */
+
+                       i = code_get_u2(p + 1,m);
+                       {
+                               constant_FMIref *fr;
+                               fieldinfo *fi;
+
+                               fr = class_getconstant(m->class, i, CONSTANT_Fieldref);
+                               LAZYLOADING(fr->class)
+
+                               fi = class_resolvefield(fr->class,
+                                                       fr->name,
+                                                       fr->descriptor,
+                                                       m->class,
+                                                       true);
+
+                               if (!fi)
+                                       return 0; /* was NULL */
+
+                               fi->xta = xtafldinfoInit(fi);
+                               XTAaddClassInit(m,      fi->class,
+                                               CLINITS_T,FINALIZE_T,ADDMARKED_F);
+                               if (xtaAddFldClassTypeInfo(fi)) {
+                                       m->xta->fldsUsed = add2FldSet(m->xta->fldsUsed, fi, false, true);
+                                       }
+
                        }
                        break;
 
@@ -556,7 +987,6 @@ if ((XTA_DEBUGr)||(XTA_DEBUGopcodes)) printf("\n");
                                constant_FMIref *mr;
                                methodinfo *mi;
 
-                               m->isleafmethod = false;
                                mr = class_getconstant(m->class, i, CONSTANT_Methodref);
                                LAZYLOADING(mr->class) 
                                mi = class_resolveclassmethod(  mr->class,
@@ -570,87 +1000,81 @@ if ((XTA_DEBUGr)||(XTA_DEBUGopcodes)) printf("\n");
                                   METHINFOt(mi,"INVOKESTAT/SPEC:: ",XTA_DEBUGopcodes)
                                   mi->monoPoly = MONO;
                                   
-                                  /*---- Handle "leaf" = static, private, final calls----------------------------*/
+                                  /*---- Handle "leaf" = static, private, final calls-------------*/
                                   if ((opcode == JAVA_INVOKESTATIC)       
                                     || (mi->flags & ACC_STATIC)  
                                     || (mi->flags & ACC_PRIVATE)  
                                     || (mi->flags & ACC_FINAL) )  
                                        {
-                                       if (mi->class->classUsed == PARTUSED){ 
-                                                       XTAaddClassInit(mi->class, 
+                                       if (mi->class->classUsed != USED) { /* = NOTUSED or PARTUSED */ 
+                                               XTAaddClassInit(m, mi->class, 
                                                                CLINITS_T,FINALIZE_T,ADDMARKED_T); 
-                                                       } 
-                                       else { 
-                                               if (mi->class->classUsed == NOTUSED){ 
-                                                               XTAaddClassInit(mi->class, 
-                                                                       CLINITS_T,FINALIZE_T,ADDMARKED_T); 
-                                                       if (mi->class->classUsed == NOTUSED){    
-                                                                       /* Leaf methods are used whether class is or not */
-                                                                       /*   so mark class as PARTlyUSED                 */
-                                                       mi->class->classUsed = PARTUSED;                                                   
-                                                                       }  
-                                                               } 
-                                                       } 
-                                               /* Add to XTA working list/set of reachable methods     */
-                                               if (opcode == JAVA_INVOKESTATIC)  /* if stmt just for debug tracing */     
-                                                       addToXtaWorkList(mi, 
-                                                               "addTo INVOKESTATIC "); 
-                                               else 
-                                                       addToXtaWorkList(mi, 
-                                                               "addTo INVOKESPECIAL ");        
+                                                               /* Leaf methods are used whether class is or not */
+                                                               /*   so mark class as PARTlyUSED                 */
+                                               mi->class->classUsed = PARTUSED; 
                                                } 
+                                       /* Add to XTA working list/set of reachable methods     */
+                                       if (opcode == JAVA_INVOKESTATIC)  /* if stmt just for debug tracing */     
+                                                            /* calls , called */
+                                               xtaAddCallEdges(m, mi, MONO, 
+                                                       "addTo INVOKESTATIC "); 
+                                       else 
+                                               xtaAddCallEdges(m, mi, MONO, 
+                                                       "addTo INVOKESPECIAL ");        
+                                       } /* end STATIC, PRIVATE, FINAL */ 
                                        
-                                       else {
+                                  else {
                                        /*---- Handle special <init> calls ---------------------------------------------*/
                                   
-                                               if (mi->class->classUsed != USED) {
-                                               /* XTA special case:
-                                                       call of super's <init> then
-                                                       methods of super class not all used */
+                                       if (mi->class->classUsed != USED) {
+                                       /* XTA special case:
+                                               call of super's <init> then
+                                               methods of super class not all used */
                                                        
-                                               /*--- <init>  ()V  is equivalent to "new" 
-                                                       indicating a class is used = instaniated ---- */        
-                                               if (utf_new_char("<init>")==mi->name) {
-                                                       if ((m->class->super == mi->class) 
-                                                       &&  (m->descriptor == utf_new_char("()V")) ) 
-                                                                       {
-                                                                       METHINFOt(mi,"SUPER INIT:",XTA_DEBUGopcodes);
-                                                                       /* super init so class may be only used because of its sub-class */
-                                                               XTAaddClassInit(mi->class,
+                                               /*--- <init>  ()V  is equivalent to "new" 
+                                                       indicating a class is used = instaniated ---- */        
+                                               if (utf_init==mi->name) {
+                                                       if ((m->class->super == mi->class) 
+                                                       &&  (m->descriptor == utf_void__void) ) 
+                                                               {
+                                                               METHINFOt(mi,"SUPER INIT:",XTA_DEBUGopcodes);
+                                                               /* super init so class may be only used because of its sub-class */
+                                                               XTAaddClassInit(m,mi->class,
                                                                        CLINITS_T,FINALIZE_T,ADDMARKED_F);
-                                                                       if (mi->class->classUsed == NOTUSED) mi->class->classUsed = PARTUSED;
-                                                                       }
+                                                               if (mi->class->classUsed == NOTUSED) mi->class->classUsed = PARTUSED;
+                                                               }
                                                        else {
                                                                /* since <init> indicates classes is used, then add marked methods, too */
                                                                        METHINFOt(mi,"NORMAL INIT:",XTA_DEBUGopcodes);
-                                                               XTAaddClassInit(mi->class,
+                                                               XTAaddClassInit(m, mi->class,
                                                                                CLINITS_T,FINALIZE_T,ADDMARKED_T);
                                                                }
-                                                               addToXtaWorkList(mi,
+                                                       xtaAddCallEdges(m, mi, MONO, 
                                                                        "addTo INIT ");
-                                                               } /* end just for <init> ()V */
+                                                       } /* end just for <init> ()V */
                                                        
-                                                       /* <clinit> for class inits do not add marked methods; class not yet instaniated */      
-                                                       if (utf_new_char("<clinit>")==mi->name)
-                                                               XTAaddClassInit(        mi->class,
+                                               /* <clinit> for class inits do not add marked methods; 
+                                                               class not yet instaniated */ 
+                                               if (utf_clinit==mi->name)
+                                                       XTAaddClassInit(m,      mi->class,
                                                                        CLINITS_T,FINALIZE_T,ADDMARKED_F);
 
-                                                       if (!((utf_new_char("<init>")==mi->name))
-                                                       ||   (utf_new_char("<clinit>")==mi->name)) {
-                                                               METHINFOt(mi,"SPECIAL not init:",XTA_DEBUGopcodes)
-                                                               if (mi->class->classUsed !=USED)
-                                                                       mi->class->classUsed = PARTUSED;
-                                                               addToXtaWorkList(mi,
-                                                                       "addTo SPEC notINIT ");
-                                                               
+                                               if (!((utf_init==mi->name))
+                                               ||   (utf_clinit==mi->name)) {
+                                                       METHINFOt(mi,"SPECIAL not init:",XTA_DEBUGopcodes)
+                                                       if (mi->class->classUsed !=USED)
+                                                               mi->class->classUsed = PARTUSED;
+                                                       xtaAddCallEdges(m, mi, MONO, 
+                                                               "addTo SPEC notINIT ");
+                                                       } 
                                                                
-                                                       } /* end init'd class not used = class init process was needed */ 
+                                               } /* end init'd class not used = class init process was needed */ 
                                                        
-                                               /* add method to XTA list = set of reachable methods */ 
-                                               addToXtaWorkList(mi,
-                                                       "addTo SPEC whymissed ");
-                                               } /* end inits */
-                                       
+                                       /* add method to XTA list = set of reachable methods */ 
+                                       xtaAddCallEdges(m, mi, MONO, 
+                                               "addTo SPEC whymissed ");
+                                       } /* end inits */
+                               } 
 /***  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
@@ -668,7 +1092,6 @@ utf_display(mr->descriptor); printf("\n");fflush(stdout);
                                constant_FMIref *mr;
                                 methodinfo *mi;
 
-                                       m->isleafmethod = false;
                                mr = m->class->cpinfos[i];
                                 /*mr = class_getconstant(m->class, i, CONSTANT_Methodref)*/
                                LAZYLOADING(mr->class) 
@@ -685,19 +1108,25 @@ utf_display(mr->descriptor); printf("\n");fflush(stdout);
                                   if ((mi->flags & ACC_STATIC) 
                                   ||  (mi->flags & ACC_PRIVATE)  
                                   ||  (mi->flags & ACC_FINAL) )  
-                                    {
+                                    { /*** DOES THIS EVER OCCUR ??? */
                                     if (mi->class->classUsed == NOTUSED){
-                                      XTAaddClassInit(mi->class,
+                                      XTAaddClassInit(m, mi->class,
                                                    CLINITS_T,FINALIZE_T,ADDMARKED_T);
                                       }
                                      mi->monoPoly = MONO;
-                                     addToXtaWorkList(mi,
+                                     xtaAddCallEdges(m, mi, MONO, 
                                                    "addTo INVOKEVIRTUAL ");
                                      } 
-                                  else {
-                                    mi->monoPoly = POLY;
-                                    xtaMarkSubs(mi->class,mi);
-                                    }
+                                  else { /* normal virtual */
+                                       classSetNode *subtypesUsedSet = NULL;
+                                       if (m->xta->XTAclassSet != NULL)
+                                               subtypesUsedSet =
+                                               intersectSubtypesWithSet(mi->class, m->xta->XTAclassSet->head);
+                                       else
+                                               subtypesUsedSet = addElement(subtypesUsedSet, m->class);
+                                      mi->monoPoly = POLY;
+                                      xtaMarkSubs(m, mi->class, mi, subtypesUsedSet);
+                                      }
                                   } 
                                else {
 CLASSNAME1(mr->class,"CouldNOT Resolve virt meth:",XTA_DEBUGr);printf(".");fflush(stdout);
@@ -713,8 +1142,6 @@ utf_display(mr->descriptor); printf("\n");fflush(stdout);
                                 constant_FMIref *mr;
                                 methodinfo *mi;
 
-                                m->isleafmethod = false;
-
                                 mr = class_getconstant(m->class, i, CONSTANT_InterfaceMethodref);
                                 LAZYLOADING(mr->class)
 
@@ -726,7 +1153,7 @@ utf_display(mr->descriptor); printf("\n");fflush(stdout);
                                        if (mi)
                                            {
                                           METHINFOt(mi,"\tINVOKEINTERFACE: ",XTA_DEBUGopcodes)
-                                          xtaMarkInterfaceSubs(mi);
+                                          xtaMarkInterfaceSubs(m,mi);
                                           }
                                /* see INVOKESTATIC for explanation about */
                                /*   case when Interface is not resolved  */
@@ -742,12 +1169,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;  */
                        /* add marked methods */
                        CLASSNAME(ci,"NEW : do nothing",XTA_DEBUGr);
-                       XTAaddClassInit(ci, CLINITS_T, FINALIZE_T,ADDMARKED_T);   
+                       XTAaddClassInit(m, ci, CLINITS_T, FINALIZE_T,ADDMARKED_T); 
+                       m->xta->XTAclassSet = add2ClassSet(m->xta->XTAclassSet,ci );
                        }
                         break;
 
@@ -762,8 +1188,9 @@ utf_display(mr->descriptor); printf("\n");fflush(stdout);
                         LAZYLOADING(cls)
                                CLASSNAMEop(cls,XTA_DEBUGr);
                         if (cls->classUsed == NOTUSED){
-                               XTAaddClassInit(cls,
+                               XTAaddClassInit(m, cls,
                                             CLINITS_T,FINALIZE_T,ADDMARKED_T);
+                               m->xta->XTAclassSet = add2ClassSet(m->xta->XTAclassSet,cls );
                                 }
                        }
                         break;
@@ -774,6 +1201,7 @@ utf_display(mr->descriptor); printf("\n");fflush(stdout);
                } /* end switch */
 
                } /* end for */
+        xtaMethodCalls_and_sendReturnType(m);
 
        return rc;
 }
@@ -790,29 +1218,28 @@ else
 /* Initialize XTA Work list ***********************************************/
 
 /*-- Get meth ptr for class.meth desc and add to XTA worklist --*/
-#define SYSADD(cls,meth,desc,txt) \
-        c = class_new(utf_new_char(cls)); \
-        LAZYLOADING(c) \
-        callmeth = class_resolveclassmethod(c, \
-              utf_new_char(meth), \
-              utf_new_char(desc), \
-              c, \
-              false); \
-        if (callmeth->class->classUsed != USED) {  \
-             c->classUsed = PARTUSED; \
-             XTAaddClassInit(callmeth->class, \
-                          CLINITS_T,FINALIZE_T,ADDMARKED_T);\
-             } \
-       callmeth->monoPoly = POLY; \
-       addToXtaWorkList(callmeth,txt);
-
-
-/*--  
+#define SYSADD(cls,meth,desc, is_mono_poly, txt) \
+  c = class_new(utf_new_char(cls)); \
+  LAZYLOADING(c) \
+  callmeth = class_resolveclassmethod(c, \
+    utf_new_char(meth), \
+    utf_new_char(desc), \
+    c, \
+    false); \
+  if (callmeth->class->classUsed != USED) {  \
+      c->classUsed = PARTUSED; \
+      XTAaddClassInit(callmeth, callmeth->class, \
+                  CLINITS_T,FINALIZE_T,ADDMARKED_T);\
+      } \
+  callmeth->monoPoly = is_mono_poly; \
+  xtaAddCallEdges(NULL, callmeth, is_mono_poly, txt); 
+
+/*-- ---------------------------------------------------------------------------- 
     Initialize XTA work list with methods/classes from:  
       System calls 
        and 
       xtaMissedIn list (missed becaused called from NATIVE &/or dynamic calls
---*/
+-------------------------------------------------------------------------------*/
 methodinfo *initializeXTAworklist(methodinfo *m) {
        classinfo  *c;
         methodinfo* callmeth;
@@ -831,13 +1258,13 @@ methodinfo *initializeXTAworklist(methodinfo *m) {
 
        /* Add first method to call list */
                m->class->classUsed = USED; 
-       addToXtaWorkList(m,systxt);
+        xtaAddCallEdges(NULL, m, SYSCALL, systxt); 
        /* Add system called methods */
-/***   SYSADD(mainstring, "main","([Ljava/lang/String;)V",systxt) ***/
-       SYSADD(MAINCLASS, MAINMETH, MAINDESC,systxt)
+/***   SYSADD(mainstring, "main","([Ljava/lang/String;)V", SYSCALL, systxt) ***/
+       SYSADD(MAINCLASS, MAINMETH, MAINDESC, SYSCALL, systxt)
        rm = callmeth;  
-/***   SYSADD("java/lang/System","exit","(I)V",systxt) ***/
-       SYSADD(EXITCLASS, EXITMETH, EXITDESC, systxt)
+/***   SYSADD("java/lang/System","exit","(I)V",SYSCALL, systxt) ***/
+       SYSADD(EXITCLASS, EXITMETH, EXITDESC, SYSCALL, systxt)
        /*----- xtaMissedIn 0 */
         if ( (xtaMissedIn = fopen("xtaMissedIn0", "r")) == NULL) {
                /*if (opt_verbose) */
@@ -848,7 +1275,8 @@ methodinfo *initializeXTAworklist(methodinfo *m) {
            class = strtok(line, " \n");
            meth  = strtok(NULL, " \n");
            desc  = strtok(NULL, " \n");
-               SYSADD(class,meth,desc,missedtxt)
+               SYSADD(class,meth,desc, POLY, missedtxt)
+               /* ??? Need to hand / hard code who calls it ??? */
                }
        fclose(xtaMissedIn);
 
@@ -862,13 +1290,14 @@ methodinfo *initializeXTAworklist(methodinfo *m) {
 /*- end initializeXTAworklist-------- */
 
 
-
+/*-------------------------------------------------------------------------------*/
 methodinfo *missedXTAworklist()  
 {
        FILE *xtaMissedIn; /* Methods missed during previous XTA parse */
        char filenameIn[256] = "xtaIn/";
        char line[256];
        char* class, *meth, *desc;
+       char* calls_class, *calls_meth, *calls_desc;
        char missedtxt[] = "xtaIn/ missed Call :";
        classinfo  *c;
         methodinfo* callmeth;
@@ -877,8 +1306,8 @@ methodinfo *missedXTAworklist()
 
 
 #if defined(USE_THREADS)
-       SYSADD(THREADCLASS, THREADMETH, THREADDESC, "systxt2")
-       SYSADD(THREADGROUPCLASS, THREADGROUPMETH, THREADGROUPDESC, "systxt2")
+       SYSADD(THREADCLASS, THREADMETH, THREADDESC, SYSCALL, "systxt2")
+       SYSADD(THREADGROUPCLASS, THREADGROUPMETH, THREADGROUPDESC, SYSCALL, "systxt2")
 #endif
        /*----- xtaMissedIn pgm specific */
         strcat(filenameIn, (const char *)mainstring);  
@@ -888,15 +1317,19 @@ methodinfo *missedXTAworklist()
                return rm;
                }
        while (XTAgetline(line,256,xtaMissedIn)) {
-           class = strtok(line, " \n");
+           calls_class = strtok(line, " \n");
+           calls_meth  = strtok(NULL, " \n");
+           calls_desc  = strtok(NULL, " \n");
+           
+           class = strtok(NULL, " \n");
            meth  = strtok(NULL, " \n");
            desc  = strtok(NULL, " \n");
-           if ((class == NULL) || (meth == NULL) || (desc == NULL)) { 
-               fprintf(stderr,"Error in xtaMissedIn file for: %s.%s %s\n",class, meth, desc); 
-               fflush(stderr);
-               panic ("Error in xtaMissedIn file for: class.meth, desc\n"); 
-               }
-           SYSADD(class,meth,desc,missedtxt)
+           
+           if ((calls_class == NULL) || (calls_meth == NULL) || (calls_desc == NULL) 
+           ||        (class == NULL) ||       (meth == NULL) ||       (desc == NULL))  
+               panic (
+               "Error in xtaMissedIn file: Missing a part of calls_class.calls_meth calls calls_desc class.meth desc \n"); 
+           SYSADD(class,meth,desc, POLY, missedtxt)
            }
        fclose(xtaMissedIn);
 
@@ -941,12 +1374,12 @@ int XTA_jit_parse(methodinfo *m)
   /* Should only be called once */
   if (firstCall) {
 
-        /*----- XTA initializations --------*/
-       if (opt_verbose) 
+    /*----- XTA initializations --------*/
+    if (opt_verbose) 
            log_text("XTA static analysis started.\n");
 
-       mainmeth = initializeXTAworklist(m);
-        firstCall = false; /* turn flag off */
+    mainmeth = initializeXTAworklist(m);
+    firstCall = false; /* turn flag off */
 
     if ( (xtaMissed = fopen("xtaMissed", "w")) == NULL) {
         printf("CACAO - xtaMissed file: cant open file to write\n");
index 4967d9b9decd004cb9b0ced13d67a1417a3232c2..890c60158915b2d922874cb0a8a2b04b913180bf 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Carolyn Oates
 
-   $Id: sets.c 1735 2004-12-07 14:33:27Z twisti $
+   $Id: sets.c 1959 2005-02-19 11:46:27Z carolyn $
 
 */
 
@@ -173,10 +173,10 @@ methSetNode *addMethRef(methSetNode *s,  methodinfo *m)
 }
 
 
-/*------------------------------------------------------------*/
+/*x------------------------------------------------------------*/
 methSet *add2MethSet(methSet *sm,  methodinfo *m)
 {
-       methSetNode *s1;
+       methSetNode *snew;
        methSetNode *s;
  
        if (sm == NULL) {
@@ -184,22 +184,22 @@ methSet *add2MethSet(methSet *sm,  methodinfo *m)
        }
        s = sm->head;
        if (!inMethSet(s,m)) {
-               s1 = NEW(methSetNode);
+               snew = NEW(methSetNode);
                if (sm->head == NULL) {
-                       sm->head = s1;
-                       sm->pos   = s1;
-                       s1->index = 1;
+                       sm->head  = snew;
+                       sm->pos   = snew;
+                       snew->index = 1;
                }        
                else {
-                       sm->tail->nextmethRef  = s1;
+                       sm->tail->nextmethRef  = snew;
                        sm->length++;
-                       s1->index = sm->length;
+                       snew->index = sm->length;
        }
-               s1->monoPoly = MONO; 
-               s1->nextmethRef= NULL;
-               s1->methRef = m;
-               s1->lastptrIntoClassSet2 = NULL;
-               sm->tail = s1;
+               snew->monoPoly = MONO; 
+               snew->nextmethRef= NULL;
+               snew->methRef = m;
+               snew->lastptrIntoClassSet2 = NULL; /* ????? */
+               sm->tail = snew;
        }
        return sm;
 }
index b12d41553da00b7e878c75e95dba0e4b5ce03dc6..4dd09c3c6b9813ce742d0ca191caf15c70f9699c 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Carolyn Oates
 
-   $Id: sets.h 1793 2004-12-21 10:14:35Z twisti $
+   $Id: sets.h 1959 2005-02-19 11:46:27Z carolyn $
 
 */
 
@@ -66,6 +66,7 @@ typedef struct classSetNode classSetNode;
 #define MARKED    1
 #define NOTUSED   0
 
+#define SYSCALL   -1 /* XTA initialization */
 #define MONO      0
 #define MONO1    1 /* potential poly that is really mono */
 #define POLY      2