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

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

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

revision 198, Sun Nov 22 02:11:29 1998 UTC revision 199, Wed Nov 25 18:30:38 1998 UTC
# Line 184  Line 184 
184                                          [], le))                                          [], le))
185    
186             (* process each fun *)             (* process each fun *)
187             fun ffun (fdec as (fk,f,args,body):F.fundec,(s,fv,funs,m)) =             fun ffun (fdec as (fk as {isrec,...},f,args,body):F.fundec,
188                         (s,fv,funs,m)) =
189                 case curry (true,false,!maxargs) (F.FIX([fdec], F.RET[F.VAR f]))                 case curry (true,false,!maxargs) (F.FIX([fdec], F.RET[F.VAR f]))
190                  of (args as _::_::_,body) => (* curried function *)                  of (args as _::_::_,body) => (* curried function *)
191                     let val ((fk,f,fargs,fbody),(fk',f',fargs',fbody')) =                     let val ((fk,f,fargs,fbody),(fk',f',fargs',fbody')) =
# Line 199  Line 200 
200                     let val (fs,ffv,body) = fexp(S.empty, body)                     let val (fs,ffv,body) = fexp(S.empty, body)
201                         val ffv = rmvs(ffv, map #1 args) (* fun's freevars *)                         val ffv = rmvs(ffv, map #1 args) (* fun's freevars *)
202                         val ifv = S.inter(ffv, funs) (* set of rec funs ref'ed *)                         val ifv = S.inter(ffv, funs) (* set of rec funs ref'ed *)
203                           val fs = fs div (case isrec of SOME(_,F.LK_TAIL) => 3
204                                                        | SOME(_,F.LK_LOOP) => 1
205                                                        | _ => 1)
206                     in                     in
207                         (fs + s, S.union(ffv, fv), funs,                         (fs + s, S.union(ffv, fv), funs,
208                          M.add(m, f, (S.members ifv, fs, fk, args, body)))                          M.add(m, f, (S.members ifv, fs, fk, args, body)))
# Line 235  Line 239 
239                                  * This heuristic is pretty bad since it doesn't                                  * This heuristic is pretty bad since it doesn't
240                                  * take the number of rec-calls into account *)                                  * take the number of rec-calls into account *)
241                                 case (isrec,inline)                                 case (isrec,inline)
242                                  of (SOME(_,(F.LK_LOOP|F.LK_WHILE)),F.IH_SAFE) =>                                  of (SOME(_,(F.LK_LOOP|F.LK_TAIL)),F.IH_SAFE) =>
243                                     if s < !CTRL.unrollThreshold then                                     if s < !CTRL.unrollThreshold then
244                                         {inline=F.IH_UNROLL, isrec=isrec,                                         {inline=F.IH_UNROLL, isrec=isrec,
245                                          cconv=cconv, known=known}                                          cconv=cconv, known=known}

Legend:
Removed from v.198  
changed lines
  Added in v.199

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