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/split.sml
ViewVC logotype

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

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

revision 488, Tue Nov 23 11:07:04 1999 UTC revision 489, Tue Nov 23 12:55:00 1999 UTC
# Line 33  Line 33 
33  val mklv = LambdaVar.mkLvar  val mklv = LambdaVar.mkLvar
34  val cplv = LambdaVar.dupLvar  val cplv = LambdaVar.dupLvar
35    
36    fun S_rmv(x, s) = S.delete(s, x) handle NotFound => s
37    
38  fun addv (s,F.VAR lv) = S.add(s, lv)  fun addv (s,F.VAR lv) = S.add(s, lv)
39    | addv (s,_) = s    | addv (s,_) = s
40  fun addvs (s,vs) = foldl (fn (v,s) => addv(s, v)) s vs  fun addvs (s,vs) = foldl (fn (v,s) => addv(s, v)) s vs
41  fun rmvs (s,lvs) = foldl (fn (l,s) => S.delete(s, l)) s lvs  fun rmvs (s,lvs) = foldl (fn (l,s) => S_rmv(l, s)) s lvs
42    
43  exception Unknown  exception Unknown
44    
# Line 63  Line 65 
65   *   This implies that fvI == S.empty, which in turn prevents us from   *   This implies that fvI == S.empty, which in turn prevents us from
66   *   mistakenly adding anything to leI.   *   mistakenly adding anything to leI.
67   *)   *)
68  fun sexp env lexp =  fun sexp env lexp =                     (* fixindent *)
69      let      let
70          (* non-side effecting binds are copied to leI if exported *)          (* non-side effecting binds are copied to leI if exported *)
71          fun let1 (le,lewrap,lv,vs,effect) =          fun let1 (le,lewrap,lv,vs,effect) =
# Line 71  Line 73 
73                  val leE = lewrap o leE                  val leE = lewrap o leE
74              in if effect orelse not (S.member(fvI, lv))              in if effect orelse not (S.member(fvI, lv))
75                 then (leE, leI, fvI, leRet)                 then (leE, leI, fvI, leRet)
76                 else (leE, lewrap leI, addvs(S.delete(fvI, lv), vs), leRet)                 else (leE, lewrap leI, addvs(S_rmv(lv, fvI), vs), leRet)
77              end              end
78    
79      in case lexp      in case lexp
# Line 206  Line 208 
208             in if not(S.member(fvI, f)) then (nleE, leI, fvI, leRet)             in if not(S.member(fvI, f)) then (nleE, leI, fvI, leRet)
209                else (nleE,                else (nleE,
210                      F.FIX([fdecI], F.FIX([nfdec], leI)),                      F.FIX([fdecI], F.FIX([nfdec], leI)),
211                      S.add(S.union(S.delete(fvI, f), S.intersection(env, fvbI)), fE),                      S.add(S.union(S_rmv(f, fvI), S.intersection(env, fvbI)), fE),
212                      leRet)                      leRet)
213             end             end
214      end      end
# Line 230  Line 232 
232                 val nlE = fn e => F.TFN(ntfdec, leE e)                 val nlE = fn e => F.TFN(ntfdec, leE e)
233             in if not(S.member(fvI, tf)) then (nlE, leI, fvI, leRet)             in if not(S.member(fvI, tf)) then (nlE, leI, fvI, leRet)
234                else (nlE, F.TFN(ntfdec, leI),                else (nlE, F.TFN(ntfdec, leI),
235                      S.delete(S.union(fvI, fvbI), tf), leRet)                      S_rmv(tf, S.union(fvI, fvbI)), leRet)
236             end             end
237           | (_,fvbIs) =>           | (_,fvbIs) =>
238             let (* tfdecE *)             let (* tfdecE *)
# Line 257  Line 259 
259             in if not(S.member(fvI, tf)) then (nleE, leI, fvI, leRet)             in if not(S.member(fvI, tf)) then (nleE, leI, fvI, leRet)
260                else (nleE,                else (nleE,
261                      F.TFN((tfkI, tf, argsI, bodyI), leI),                      F.TFN((tfkI, tf, argsI, bodyI), leI),
262                      S.add(S.union(S.delete(fvI, tf), S.intersection(env, fvbI)), tfE),                      S.add(S.union(S_rmv(tf, fvI), S.intersection(env, fvbI)), tfE),
263                      leRet)                      leRet)
264             end             end
265      end      end

Legend:
Removed from v.488  
changed lines
  Added in v.489

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