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

Diff of /sml/trunk/src/cm/bootstrap/btcompile.sml

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

revision 364, Fri Jul 2 07:33:12 1999 UTC revision 372, Tue Jul 6 09:05:57 1999 UTC
# Line 45  Line 45 
45    
46      (* instantiate Stabilize... *)      (* instantiate Stabilize... *)
47      structure Stabilize =      structure Stabilize =
48          StabilizeFn (fun bn2statenv gp i = #1 (#stat (valOf (RT.bnode gp i)))          StabilizeFn (fun bn2statenv gp i = #1 (#stat (valOf (RT.bnode' gp i)))
                      val getPid = RecompPersstate.pid_fetch_sml  
49                       fun warmup (i, p) = ()                       fun warmup (i, p) = ()
50                       val recomp = recomp                       val recomp = recomp
51                       val transfer_state = RecompPersstate.transfer_state)                       val transfer_state = RecompPersstate.transfer_state)
52      (* ... and Parse *)      (* ... and Parse *)
53      structure Parse = ParseFn (structure Stabilize = Stabilize      structure Parse = ParseFn (structure Stabilize = Stabilize
54                                 val pending = AutoLoad.getPending)                                 fun pending () = SymbolMap.empty)
55    
56      fun cpTextStreams (ins, outs) = let      (* copying an input file to an output file safely... *)
57        fun copyFile (oi, ci, oo, co, inp, outp, eof) (inf, outf) = let
58            fun workIn is = let
59                fun workOut os = let
60          val N = 4096          val N = 4096
61          fun cp () =                  fun loop () =
62              if TextIO.endOfStream ins then ()                      if eof is then () else (outp (os, inp (is, N)); loop ())
63              else (TextIO.output (outs,              in
64                                   TextIO.inputN (ins, N));                  loop ()
65                    cp ())              end
66      in          in
67          cp ()              SafeIO.perform { openIt = fn () => oo outf,
68      end                               closeIt = co,
69                                 work = workOut,
     fun openTextStreams (inf, outf) () =  
         (TextIO.openIn inf, AutoDir.openTextOut outf)  
     fun closeTextStreams (ins, outs) =  
         (TextIO.closeIn ins; TextIO.closeOut outs)  
   
     fun copyFile (inf, outf) =  
         SafeIO.perform { openIt = openTextStreams (inf, outf),  
                          closeIt = closeTextStreams,  
                          work = cpTextStreams,  
70                           cleanup = fn () =>                           cleanup = fn () =>
71                              (F.remove outf handle _ => ()) }                              (F.remove outf handle _ => ()) }
72            end
73        in
74            SafeIO.perform { openIt = fn () => oi inf,
75                             closeIt = ci,
76                             work = workIn,
77                             cleanup = fn () => () }
78        end
79    
80        val copyTextFile =
81            copyFile (TextIO.openIn, TextIO.closeIn,
82                      AutoDir.openTextOut, TextIO.closeOut,
83                      TextIO.inputN, TextIO.output, TextIO.endOfStream)
84    
85        val copyBinFile =
86            copyFile (BinIO.openIn, BinIO.closeIn,
87                      AutoDir.openBinOut, BinIO.closeOut,
88                      BinIO.inputN, BinIO.output, BinIO.endOfStream)
89    
90      fun compile deliver dbopt = let      fun compile deliver dbopt = let
91    
# Line 100  Line 110 
110                              P.toString { isAbs = false, vol = "",                              P.toString { isAbs = false, vol = "",
111                                           arcs = bootdir :: arc1 :: arcn }                                           arcs = bootdir :: arc1 :: arcn }
112                      in                      in
113                          copyFile (p, bootpath)                          copyBinFile (p, bootpath)
114                      end                      end
115                  in                  in
116                      if copy andalso arc0 = bindir then doCopy () else ();                      if copy andalso arc0 = bindir then doCopy () else ();
# Line 167  Line 177 
177              val ovldR = GenericVC.Control.overloadKW              val ovldR = GenericVC.Control.overloadKW
178              val savedOvld = !ovldR              val savedOvld = !ovldR
179              val _ = ovldR := true              val _ = ovldR := true
180                val ts = RT.start ()
181    
182              (* here we build a new gp -- the one that uses the freshly              (* here we build a new gp -- the one that uses the freshly
183               * brewed pervasive env, core env, and primitives *)               * brewed pervasive env, core env, and primitives *)
184              val core = valOf (RT.sbnode ginfo_nocore core)              val core = valOf (RT.sbnode ts ginfo_nocore core)
185              val corenv =  CoerceEnv.es2bs (#1 (#stat core))              val corenv =  CoerceEnv.es2bs (#1 (#stat core))
186              val core_sym = #1 (#sym core)              val core_sym = #1 (#sym core)
187    
# Line 182  Line 193 
193              val ginfo_justcore = { param = param_justcore, groupreg = groupreg,              val ginfo_justcore = { param = param_justcore, groupreg = groupreg,
194                                     errcons = errcons }                                     errcons = errcons }
195    
196              fun rt n = valOf (RT.sbnode ginfo_justcore n)              fun rt n = valOf (RT.sbnode ts ginfo_justcore n)
197              val rts = rt rts              val rts = rt rts
198              val pervasive = rt pervasive              val pervasive = rt pervasive
199    
200              fun sn2pspec (name, n) = let              fun sn2pspec (name, n) = let
201                  val { stat = (s, sp), sym = (sy, syp), ctxt } = rt n                  val { stat = (s, sp), sym = (sy, syp), ctxt, bfc } = rt n
202                  val env =                  val env =
203                      E.mkenv { static = s, symbolic = sy, dynamic = emptydyn }                      E.mkenv { static = s, symbolic = sy, dynamic = emptydyn }
204                  val pidInfo = { statpid = sp, sympid = syp, ctxt = ctxt }                  val pidInfo = { statpid = sp, sympid = syp, ctxt = ctxt }
# Line 199  Line 210 
210    
211              val _ = ovldR := savedOvld              val _ = ovldR := savedOvld
212    
213              (* This is a hack but must be done for both the symbolic              (* To be consistent, we would have to call RT.finish here.
214                 * However, this isn't really necessary because no dynamic
215                 * values exist and we drop "ts" at this point anyway. *)
216                (* val _ = RT.finish ts *)
217    
218                (* The following is a hack but must be done for both the symbolic
219               * and later the dynamic part of the core environment:               * and later the dynamic part of the core environment:
220               * we must include these parts in the pervasive env. *)               * we must include these parts in the pervasive env. *)
221              val perv_sym = E.layerSymbolic (#1 (#sym pervasive), core_sym)              val perv_sym = E.layerSymbolic (#1 (#sym pervasive), core_sym)
# Line 243  Line 259 
259                              app show bootstrings                              app show bootstrings
260                          end                          end
261                      in                      in
                       Say.say ["Runtime System PID is: ", rtspid, "\n"];  
262                        if deliver then                        if deliver then
263                         (SafeIO.perform { openIt = fn () =>                         (SafeIO.perform { openIt = fn () =>
264                                             AutoDir.openTextOut pidfile,                                             AutoDir.openTextOut pidfile,
# Line 260  Line 275 
275                                           cleanup = fn () =>                                           cleanup = fn () =>
276                                             OS.FileSys.remove listfile                                             OS.FileSys.remove listfile
277                                             handle _ => () };                                             handle _ => () };
278                          copyFile (SrcPath.osstring initgspec, cmifile))                          copyTextFile (SrcPath.osstring initgspec, cmifile);
279                            Say.say ["Runtime System PID is: ", rtspid, "\n"])
280                        else ();                        else ();
281                        true                        true
282                      end                      end
# Line 279  Line 295 
295      fun deliver () = deliver' NONE      fun deliver () = deliver' NONE
296      fun reset () =      fun reset () =
297          (RecompPersstate.reset ();          (RecompPersstate.reset ();
298           RT.resetAll ();           RT.reset ();
299           Recomp.reset ())           Recomp.reset ();
300             Parse.reset ())
301  end  end

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

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