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/cm/smlfile/smlinfo.sml
ViewVC logotype

Diff of /sml/trunk/src/cm/smlfile/smlinfo.sml

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

revision 364, Fri Jul 2 07:33:12 1999 UTC revision 365, Fri Jul 2 08:38:07 1999 UTC
# Line 103  Line 103 
103    
104      val knownInfo = ref (SrcPathMap.empty: persinfo SrcPathMap.map)      val knownInfo = ref (SrcPathMap.empty: persinfo SrcPathMap.map)
105    
106        fun countParseTrees () = let
107            fun one (PERS { parsetree = ref (SOME _), ... }, i) = i + 1
108              | one (_, i) = i
109        in
110            SrcPathMap.foldl one 0 (!knownInfo)
111        end
112    
113      fun forgetParsetree (INFO { persinfo = PERS { parsetree, ... }, ... }) =      fun forgetParsetree (INFO { persinfo = PERS { parsetree, ... }, ... }) =
114          parsetree := NONE          parsetree := NONE
115    
# Line 199  Line 206 
206                                             closeIt = TextIO.closeIn,                                             closeIt = TextIO.closeIn,
207                                             work = work,                                             work = work,
208                                             cleanup = fn () => () })                                             cleanup = fn () => () })
209              in                  (* Counting the trees explicitly may be a bit slow,
210                  parsetree := pto;                   * but maintaining an accurate count is difficult, so
211                     * this method should be robust.  (I don't think that
212                     * the overhead of counting will make a noticeable
213                     * difference.) *)
214                    val ntrees = countParseTrees ()
215                    val treelimit = EnvConfig.getSet StdConfig.parse_caching NONE
216                in
217                    if ntrees < treelimit then
218                        parsetree := pto
219                    else ();
220                  pto                  pto
221              end handle exn as IO.Io _ => (err (General.exnMessage exn); NONE)              end handle exn as IO.Io _ => (err (General.exnMessage exn); NONE)
222                       | SF.Compile msg => (err msg; NONE)                       | SF.Compile msg => (err msg; NONE)

Legend:
Removed from v.364  
changed lines
  Added in v.365

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