change the debug mode for capturing null dereference to a global compilar option
[IRC.git] / Robust / src / IR / State.java
index 0caa0ba7469e40973da0dbcabbbd8727b95447ee..a5d048b2632df9ed1105c165d342dfd019b2e984 100644 (file)
@@ -6,18 +6,32 @@ 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();
     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();
@@ -26,6 +40,8 @@ public class State {
     this.excprefetch=new HashSet();
     this.classpath=new Vector();
     this.cd2locationOrderMap=new Hashtable();
+    this.cd2locationPropertyMap=new Hashtable();
+    this.fn2labelMap=new Hashtable();
     this.lines=0;
   }
 
@@ -53,6 +69,8 @@ public class State {
 
   /** Boolean flag which indicates whether compiler is compiling a task-based
    * program. */
+  public boolean JNI=false;
+  public boolean CAPTURE_NULL_DEREFERENCES=false;
   public boolean POINTER=false;
   public boolean COREPROF=false;
   public boolean WEBINTERFACE=false;
@@ -77,7 +95,7 @@ public class State {
   public String OWNERSHIPDEBUGCALLEE=null;
   public String OWNERSHIPDEBUGCALLER=null;
 
-  
+
   public boolean DISJOINT=false;
 
   public int DISJOINTALLOCDEPTH=1;
@@ -115,7 +133,7 @@ public class State {
   public boolean RCR_DEBUG=false;
   public boolean RCR_DEBUG_VERBOSE=false;
   public boolean NOSTALLTR=false;
-  
+
   //SSJava
   public boolean SSJAVA=false;
 
@@ -131,7 +149,7 @@ public class State {
   public boolean METHODEFFECTS=false;
   public static double TRUEPROB=0.8;
   public static boolean PRINTFLAT=false;
-  
+
   //DSM options
   public boolean DSM=false;
   public boolean DSMTASK=false;
@@ -149,7 +167,7 @@ public class State {
   public boolean DELAYCOMP=false;
   public boolean DUALVIEW=false;
   public boolean HYBRID=false;
-  
+
   // Bamboo options
   public boolean MULTICORE=false;
   public boolean MULTICOREGC=false;
@@ -167,7 +185,8 @@ public class State {
   public String outputdir = "/scratch/";
   // MGC options
   public boolean MGC=false;
-  
+  public boolean OBJECTLOCKDEBUG=false;
+
   //Other options
   public String structfile;
   public String main;
@@ -183,7 +202,6 @@ public class State {
   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
@@ -192,6 +210,8 @@ public class State {
   private int numstaticblocks=0;
   private int arraycount=0;
   public Hashtable cd2locationOrderMap;
+  public Hashtable cd2locationPropertyMap;
+  public Hashtable fn2labelMap;
   public boolean OPTIMIZE=false;
   public boolean LINENUM=false;
 
@@ -241,6 +261,11 @@ public class State {
     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");
@@ -254,30 +279,15 @@ public class State {
       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;
   }
@@ -297,7 +307,7 @@ public class State {
   public SymbolTable getTaskSymbolTable() {
     return tasks;
   }
-  
+
   public SymbolTable getSClassSymbolTable() {
     return sclasses;
   }
@@ -349,13 +359,21 @@ public class State {
     tasks.add(td);
     numtasks++;
   }
-  
-  public void addLocationOrder(ClassDescriptor cd, Lattice order){
+
+  public void addLocationOrder(ClassDescriptor cd, Lattice order) {
     cd2locationOrderMap.put(cd,order);
   }
-  
-  public Hashtable getCd2LocationOrder(){
+
+  public Hashtable getCd2LocationOrder() {
     return cd2locationOrderMap;
   }
-  
+
+  public void addLocationPropertySet(ClassDescriptor cd, Set<String> set) {
+    cd2locationPropertyMap.put(cd,set);
+  }
+
+  public Hashtable getCd2LocationPropertyMap() {
+    return cd2locationPropertyMap;
+  }
+
 }