Fix compilation problems for multicore code
[IRC.git] / Robust / src / IR / State.java
index 2a8a473e4b64784ac5a71a66bb4ba53b4a79ab22..eb61444024c5c3874a858c4e3d2fdec2f77e6d87 100644 (file)
@@ -2,6 +2,8 @@ package IR;
 import IR.Tree.*;
 import IR.Flat.*;
 import IR.*;
+import Util.Lattice;
+
 import java.util.*;
 import Analysis.TaskStateAnalysis.*;
 
@@ -11,8 +13,11 @@ public class State {
   public State() {
     this.classes=new SymbolTable();
     this.tasks=new SymbolTable();
+    this.sclasses=new SymbolTable();
     this.treemethodmap=new Hashtable();
     this.flatmethodmap=new Hashtable();
+    this.genAllMethods = true;
+    this.methods2gen = new SymbolTable();
     this.parsetrees=new HashSet();
     this.arraytypes=new HashSet();
     this.arraytonumber=new Hashtable();
@@ -20,6 +25,7 @@ public class State {
     this.selfloops=new HashSet();
     this.excprefetch=new HashSet();
     this.classpath=new Vector();
+    this.cd2locationOrderMap=new Hashtable();
     this.lines=0;
   }
 
@@ -47,6 +53,7 @@ public class State {
 
   /** Boolean flag which indicates whether compiler is compiling a task-based
    * program. */
+  public boolean POINTER=false;
   public boolean COREPROF=false;
   public boolean WEBINTERFACE=false;
   public boolean MINIMIZE=false;
@@ -59,6 +66,7 @@ public class State {
   public boolean FLATIRGRAPHTASKS=false;
   public boolean FLATIRGRAPHUSERMETHODS=false;
   public boolean FLATIRGRAPHLIBMETHODS=false;
+  public boolean KEEP_RG_FOR_ALL_PROGRAM_POINTS=false;
   public boolean OWNERSHIP=false;
   public int OWNERSHIPALLOCDEPTH=3;
   public boolean OWNERSHIPWRITEDOTS=false;
@@ -103,6 +111,13 @@ public class State {
 
   public boolean OOOJAVA=false;
   public boolean OOODEBUG=false;
+  public boolean RCR=false;
+  public boolean RCR_DEBUG=false;
+  public boolean RCR_DEBUG_VERBOSE=false;
+  public boolean NOSTALLTR=false;
+  
+  //SSJava
+  public boolean SSJAVA=false;
 
 
   public boolean OPTIONAL=false;
@@ -111,10 +126,8 @@ public class State {
   public boolean THREAD=false;
   public boolean CONSCHECK=false;
   public boolean INSTRUCTIONFAILURE=false;
-  public boolean MLP=false;
-  public boolean MLPDEBUG=false;
-  public int MLP_NUMCORES=0;
-  public int MLP_MAXSESEAGE=0;
+  public int OOO_NUMCORES=0;
+  public int OOO_MAXSESEAGE=0;
   public boolean METHODEFFECTS=false;
   public static double TRUEPROB=0.8;
   public static boolean PRINTFLAT=false;
@@ -152,6 +165,9 @@ public class State {
   public int CORENUM4GC = 0;
   public String profilename = null;
   public String outputdir = "/scratch/";
+  // MGC options
+  public boolean MGC=false;
+  
   //Other options
   public String structfile;
   public String main;
@@ -162,14 +178,20 @@ public class State {
   public Vector classpath;
   public SymbolTable classes;
   public SymbolTable tasks;
+  public SymbolTable sclasses; // table of classes with static field/blocks
   public Set parsetrees;
   public Hashtable treemethodmap;
   public Hashtable flatmethodmap;
+  SymbolTable methods2gen;
+  public boolean genAllMethods;
   private HashSet arraytypes;
   public Hashtable arraytonumber;
   private int numclasses=1; // start from 1 instead of 0 for multicore gc
+  private int numinterfaces = 0;
   private int numtasks=0;
+  private int numstaticblocks=0;
   private int arraycount=0;
+  public Hashtable cd2locationOrderMap;
   public boolean OPTIMIZE=false;
 
   private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
@@ -222,12 +244,42 @@ public class State {
     if (classes.contains(tdn.getSymbol()))
       throw new Error("Class "+tdn.getSymbol()+" defined twice");
     classes.add(tdn);
-    numclasses++;
+    if(tdn.isInterface()) {
+      numinterfaces++;
+    } else {
+      numclasses++;
+    }
+    if((tdn.numstaticfields != 0) || (tdn.numstaticblocks != 0)) {
+      sclasses.add(tdn);
+    }
   }
-
+  
+  public void setGenAllMethods(boolean flag) {
+    this.genAllMethods = flag;
+  }
+  
+  public void addMethod2gen(MethodDescriptor md) {
+    if(this.genAllMethods) {
+      throw new Error("The state.genAllMethods is TRUE, do not need to check methods to genenrate");
+    }
+    this.methods2gen.add(md);
+  }
+  
+  public SymbolTable getMethod2gen() {
+    return this.methods2gen;
+  }
+  
   public int numClasses() {
     return numclasses;
   }
+  
+  public int numInterfaces() {
+    return numinterfaces;
+  }
+  
+  public int numStaticBlocks() {
+    return numstaticblocks;
+  }
 
   public BlockNode getMethodBody(MethodDescriptor md) {
     return (BlockNode)treemethodmap.get(md);
@@ -244,6 +296,10 @@ public class State {
   public SymbolTable getTaskSymbolTable() {
     return tasks;
   }
+  
+  public SymbolTable getSClassSymbolTable() {
+    return sclasses;
+  }
 
   /** Returns Flat IR representation of MethodDescriptor md. */
 
@@ -292,4 +348,13 @@ public class State {
     tasks.add(td);
     numtasks++;
   }
+  
+  public void addLocationOrder(ClassDescriptor cd, Lattice order){
+    cd2locationOrderMap.put(cd,order);
+  }
+  
+  public Hashtable getCd2LocationOrder(){
+    return cd2locationOrderMap;
+  }
+  
 }