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/compiler/FLINT/opt/collect.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/FLINT/opt/collect.sml

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

revision 651, Thu Jun 1 18:34:03 2000 UTC revision 733, Fri Nov 17 05:13:45 2000 UTC
# Line 84  Line 84 
84  struct  struct
85  local  local
86      structure F  = FLINT      structure F  = FLINT
87      structure M  = Intmap      structure M  = IntHashTable
88      structure FU = FlintUtil      structure FU = FlintUtil
89      structure LV = LambdaVar      structure LV = LambdaVar
90      structure PP = PPFlint      structure PP = PPFlint
# Line 102  Line 102 
102    
103  exception NotFound  exception NotFound
104    
105  val m : info M.intmap = M.new(128, NotFound)  val m : info M.hash_table = M.mkTable(128, NotFound)
106    
107  fun new args lv =  fun new args lv =
108      let val i = Info{uses=ref 0, calls=ref 0, int=ref(0,0)}      let val i = Info{uses=ref 0, calls=ref 0, int=ref(0,0)}
109      in M.add m (lv, i); i      in M.insert m (lv, i); i
110      end      end
111    
112  (* map related helper functions *)  (* map related helper functions *)
113  fun get lv = (M.map m lv)  fun get lv = (M.lookup m lv)
114                    handle x as NotFound =>                    handle x as NotFound =>
115                    ((* say ("Collect: ERROR: get unknown var "^                    ((* say ("Collect: ERROR: get unknown var "^
116                          (LV.lvarName lv)^                          (LV.lvarName lv)^
# Line 134  Line 134 
134          val i2 = get lv2          val i2 = get lv2
135      in addto(i1, i2);      in addto(i1, i2);
136          (* note the transfer by redirecting the map *)          (* note the transfer by redirecting the map *)
137          M.add m (lv1, i2)          M.insert m (lv1, i2)
138      end      end
139    
140  fun inc ri = (ri := !ri + 1)  fun inc ri = (ri := !ri + 1)
# Line 179  Line 179 
179    
180  (* Ideally, we should check that usenb = 1, but we may have been a bit  (* Ideally, we should check that usenb = 1, but we may have been a bit
181   * conservative when keeping the counts uptodate *)   * conservative when keeping the counts uptodate *)
182  fun kill lv = (M.rmv m lv)  fun kill lv = ignore (M.remove m lv) handle _ => ()
183    
184  (* ********************************************************************** *)  (* ********************************************************************** *)
185  (* ********************************************************************** *)  (* ********************************************************************** *)

Legend:
Removed from v.651  
changed lines
  Added in v.733

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