Create analysis model for string literals in disjointness analysis that supports...
[IRC.git] / Robust / src / Analysis / Disjoint / ReachGraph.java
index 2e16ad1f464b4fa5318500ea330fadcf99ab4bfb..6eedd6ba33374576d5dc230d3447b230b10450b5 100644 (file)
@@ -12,8 +12,18 @@ public class ReachGraph {
   protected static final boolean DISABLE_STRONG_UPDATES = false;
   protected static final boolean DISABLE_GLOBAL_SWEEP   = false;
 
-  // a special out-of-scope temp
-  protected static final TempDescriptor tdReturn = new TempDescriptor("_Return___");
+  // a special out-of-scope temps
+  protected static TempDescriptor tdReturn;
+  protected static TempDescriptor tdStrLiteralBytes;
+  
+  public static void initOutOfScopeTemps() {
+    tdReturn = new TempDescriptor("_Return___");
+
+    tdStrLiteralBytes = 
+      new TempDescriptor("_strLiteralBytes___",
+                         new TypeDescriptor(TypeDescriptor.CHAR).makeArray( state )
+                         );
+  }
 
   // predicate constants
   public static final ExistPred predTrue   = ExistPred.factory();    // if no args, true
@@ -380,6 +390,26 @@ public class ReachGraph {
   //
   ////////////////////////////////////////////////////
 
+  public void assignTempEqualToStringLiteral(TempDescriptor  x,
+                                             AllocSite       asStringLiteral,
+                                             AllocSite       asStringLiteralBytes,
+                                             FieldDescriptor fdStringBytesField) {
+    // model this to get points-to information right for
+    // pointers to string literals, even though it doesn't affect
+    // reachability paths in the heap
+    assignTempEqualToNewAlloc( x, 
+                               asStringLiteral );
+
+    assignTempEqualToNewAlloc( tdStrLiteralBytes, 
+                               asStringLiteralBytes );
+
+    assignTempXFieldFEqualToTempY( x,
+                                   fdStringBytesField,
+                                   tdStrLiteralBytes,
+                                   null );
+  }
+
+
   public void assignTempXEqualToTempY(TempDescriptor x,
                                       TempDescriptor y) {
     assignTempXEqualToCastedTempY(x, y, null);