enables the labeled_statements. The scope of a label declared by a labled statement...
[IRC.git] / Robust / src / IR / State.java
index c4a5e2b2a6b64e8b96e3e117c2259b5bc6a69bff..303d3e39d48a7ef2938bfdce1383284aaecf9284 100644 (file)
@@ -2,12 +2,30 @@ package IR;
 import IR.Tree.*;
 import IR.Flat.*;
 import IR.*;
+import Util.Lattice;
+
 import java.util.*;
 import Analysis.TaskStateAnalysis.*;
+import Analysis.CallGraph.CallGraph;
 
 public class State {
+  public static long startTime;
+  public static long lastTime;
+  public static void logEvent(String event) {
+    long currTime=System.nanoTime();
+    double delta=((double)(currTime-startTime))/1000000000;
+    double deltaLast=((double)(currTime-lastTime))/1000000000;
+    System.out.println("TLOG: Time of "+event+"="+delta);
+    System.out.println("TLOG: Elapsed time "+event+"="+deltaLast);
+    lastTime=currTime;
+  }
+
+  public static void initTimer() {
+    startTime=System.nanoTime();
+    lastTime=startTime;
+  }
 
-    public int lines;
+  public int lines;
   public State() {
     this.classes=new SymbolTable();
     this.tasks=new SymbolTable();
@@ -21,6 +39,8 @@ public class State {
     this.selfloops=new HashSet();
     this.excprefetch=new HashSet();
     this.classpath=new Vector();
+    this.cd2locationOrderMap=new Hashtable();
+    this.cd2locationPropertyMap=new Hashtable();
     this.lines=0;
   }
 
@@ -48,6 +68,8 @@ public class State {
 
   /** Boolean flag which indicates whether compiler is compiling a task-based
    * program. */
+  public boolean JNI=false;
+  public boolean POINTER=false;
   public boolean COREPROF=false;
   public boolean WEBINTERFACE=false;
   public boolean MINIMIZE=false;
@@ -109,6 +131,9 @@ public class State {
   public boolean RCR_DEBUG=false;
   public boolean RCR_DEBUG_VERBOSE=false;
   public boolean NOSTALLTR=false;
+  
+  //SSJava
+  public boolean SSJAVA=false;
 
 
   public boolean OPTIONAL=false;
@@ -117,10 +142,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;
@@ -160,6 +183,7 @@ public class State {
   public String outputdir = "/scratch/";
   // MGC options
   public boolean MGC=false;
+  public boolean OBJECTLOCKDEBUG=false;
   
   //Other options
   public String structfile;
@@ -175,13 +199,18 @@ public class State {
   public Set parsetrees;
   public Hashtable treemethodmap;
   public Hashtable flatmethodmap;
+  SymbolTable methods2gen;
   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 Hashtable cd2locationPropertyMap;
   public boolean OPTIMIZE=false;
+  public boolean LINENUM=false;
 
   private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
   private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
@@ -228,12 +257,19 @@ public class State {
     TypeDescriptor td=new TypeDescriptor(n);
     return td;
   }
+  
+  public static TypeDescriptor getTypeDescriptor(String n) {
+    TypeDescriptor td=new TypeDescriptor(n);
+    return td;
+  }
 
   public void addClass(ClassDescriptor tdn) {
     if (classes.contains(tdn.getSymbol()))
       throw new Error("Class "+tdn.getSymbol()+" defined twice");
     classes.add(tdn);
-    if(!tdn.isInterface()) {
+    if(tdn.isInterface()) {
+      numinterfaces++;
+    } else {
       numclasses++;
     }
     if((tdn.numstaticfields != 0) || (tdn.numstaticblocks != 0)) {
@@ -245,6 +281,10 @@ public class State {
     return numclasses;
   }
   
+  public int numInterfaces() {
+    return numinterfaces;
+  }
+  
   public int numStaticBlocks() {
     return numstaticblocks;
   }
@@ -316,4 +356,21 @@ public class State {
     tasks.add(td);
     numtasks++;
   }
+  
+  public void addLocationOrder(ClassDescriptor cd, Lattice order){
+    cd2locationOrderMap.put(cd,order);
+  }
+  
+  public Hashtable getCd2LocationOrder(){
+    return cd2locationOrderMap;
+  }
+  
+  public void addLocationPropertySet(ClassDescriptor cd, Set<String> set){
+    cd2locationPropertyMap.put(cd,set);
+  }
+  
+  public Hashtable getCd2LocationPropertyMap(){
+    return cd2locationPropertyMap;
+  }
+  
 }