Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/MLRISC/aliasing/pointsTo.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/aliasing/pointsTo.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 589, Fri Mar 31 16:14:36 2000 UTC revision 590, Sat Apr 1 02:24:08 2000 UTC
# Line 146  Line 146 
146     fun pi(x,i)  = getIth(PI,i,x)     fun pi(x,i)  = getIth(PI,i,x)
147     fun dom(x,i) = getIth(DOM,i,x)     fun dom(x,i) = getIth(DOM,i,x)
148     fun ran(x,i) = getIth(RAN,i,x)     fun ran(x,i) = getIth(RAN,i,x)
149     fun sub(x,i) = (mut x; getIth(PI,i,x))     fun sub(x,i) = let val m = getIth(PI,i,x) in mut m; m end
150    
151     fun offset(x,i) = (unify(x,newTop{mutable=false,name=""}); find x)     fun offset(x,i) = (unify(x,newTop{mutable=false,name=""}); find x)
152    
# Line 182  Line 182 
182    
183     fun strongUpdate(a,i,x) = unify(sub(a,i),x)     fun strongUpdate(a,i,x) = unify(sub(a,i),x)
184     fun strongSubscript(a,i) = sub(a,i)     fun strongSubscript(a,i) = sub(a,i)
185     fun weakUpdate(a,x) = (weak a; unify(sub(a,0),a))     fun weakUpdate(a,x) =
186     fun weakSubscript(a) = (weak a; sub(a,0))         let val elem = sub(a, 0)
187           in  weak elem; unify(elem, x) end
188       fun weakSubscript(a) =
189           let val elem = sub(a, 0)
190           in  weak elem; elem end
191    
192     fun interfere(x,y) = find x = find y     fun interfere(x,y) = find x = find y
193    
194     fun show(LINK x) = show(!x)     val maxLevels = MLRiscControl.getInt "points-to-show-max-levels"
195       | show(SREF(id,es)) = "strong-ref("^Int.toString id^")"^edges es     val _ = maxLevels := 3
      | show(WREF(id,es)) = "weak-ref("^Int.toString id^")"^edges es  
      | show(SCELL(id,es)) = "strong("^Int.toString id^")"^edges es  
      | show(WCELL(id,es)) = "weak("^Int.toString id^")"^edges es  
      | show(TOP{name="",mutable=true,id,...}) = "var("^Int.toString id^")"  
      | show(TOP{name="",mutable=false,id,...}) = "const("^Int.toString id^")"  
      | show(TOP{name,...}) = name  
   
    and edges es =  
        foldr (fn ((PI,i,x),s) => "pi"^Int.toString i^"="^toString(x)^" "^s  
                | (_,s) => s)  
              "" (!es)  
196    
197     and toString r = show(!r)     fun toString r = show(!r, !maxLevels)
198    
199       and show(LINK x, lvl) = show(!x, lvl)
200         | show(SREF(id,es), lvl) = "sref"^Int.toString id^edges(es, lvl)
201         | show(WREF(id,es), lvl) = "wref"^Int.toString id^edges(es, lvl)
202         | show(SCELL(id,es), lvl) = "s"^Int.toString id^edges(es, lvl)
203         | show(WCELL(id,es), lvl) = "w"^Int.toString id^edges(es, lvl)
204         | show(TOP{name="",mutable=true,id,...}, _) = "var"^Int.toString id
205         | show(TOP{name="",mutable=false,id,...}, _) = "const"^Int.toString id
206         | show(TOP{name,...}, _) = name
207    
208       and edges(es, ~1) = ""
209         | edges(es, lvl) =
210           let fun prInt i = if i < 0 then "-"^Int.toString(~i) else Int.toString i
211               fun add(a,"") = a
212                 | add(a,b)  = a^","^b
213               fun cnv((PI,i,x),s) = add(prInt i^"->"^show(!x, lvl-1),s)
214                 | cnv(_,s) = s
215           in  case foldr cnv "" (!es) of
216                 "" => ""
217               | t  => if lvl = 0 then "..." else "["^t^"]"
218           end
219    
220  end  end

Legend:
Removed from v.589  
changed lines
  Added in v.590

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0