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

Diff of /sml/trunk/src/cm/stable/stabilize.sml

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

revision 652, Tue Jun 6 02:14:56 2000 UTC revision 653, Wed Jun 7 07:59:06 2000 UTC
# Line 52  Line 52 
52               val compare = SymbolSet.compare               val compare = SymbolSet.compare
53          end)          end)
54    
     structure SNMap = MapFn  
         (struct  
              type ord_key = DG.snode  
              fun compare (DG.SNODE n, DG.SNODE n') =  
                  SmlInfo.compare (#smlinfo n, #smlinfo n')  
         end)  
   
55      structure PU = PickleUtil      structure PU = PickleUtil
56      structure UU = UnpickleUtil      structure UU = UnpickleUtil
57    
58      val libstamp_nbytes = 16      val libstamp_nbytes = 16
59    
60      type map = { ss: PU.id SSMap.map, sn: PU.id SNMap.map, pm: P.map }      type map = { ss: PU.id SSMap.map, sn: PU.id SmlInfoMap.map, pm: P.map }
61    
62      val emptyMap = { ss = SSMap.empty, sn = SNMap.empty, pm = P.emptyMap }      val emptyMap : map =
63            { ss = SSMap.empty, sn = SmlInfoMap.empty, pm = P.emptyMap }
64    
65      val lifter =      val lifter =
66          { extract = fn (m: map) => #pm m,          { extract = fn (m: map) => #pm m,
# Line 85  Line 79 
79            insert = fn ({ ss, sn, pm }, k, v) =>            insert = fn ({ ss, sn, pm }, k, v) =>
80                         { sn = sn, ss = SSMap.insert (ss, k, v), pm = pm } }                         { sn = sn, ss = SSMap.insert (ss, k, v), pm = pm } }
81      val SNs =      val SNs =
82          { find = fn (m: map, k) => SNMap.find (#sn m, k),          { find = fn (m: map, DG.SNODE k) => SmlInfoMap.find (#sn m,#smlinfo k),
83            insert = fn ({ ss, sn, pm }, k, v) =>            insert = fn ({ ss, sn, pm }, DG.SNODE k, v) =>
84                         { ss = ss, sn = SNMap.insert (sn, k, v), pm = pm } }                        { ss = ss,
85                            sn = SmlInfoMap.insert (sn, #smlinfo k, v),
86                            pm = pm } }
87    
88      fun fetch_pickle s = let      fun fetch_pickle s = let
89          fun bytesIn n = let          fun bytesIn n = let
# Line 568  Line 564 
564              val (registerOffset, getOffset) = let              val (registerOffset, getOffset) = let
565                  val dict = ref SmlInfoMap.empty                  val dict = ref SmlInfoMap.empty
566                  val cur = ref 0                  val cur = ref 0
567                  fun reg (i, sz) = let                  fun get0 i = SmlInfoMap.find (!dict, i)
568                    fun reg (i, sz) =
569                        case get0 i of
570                            (* This test is necessary because of a tiny chance
571                             * that a portion of a pickle needs to be re-done
572                             * by the pickler because it underestimated its
573                             * size during lazy pickling. Ideally, the pickler
574                             * should run without side-effects, but in the
575                             * present case all we need is idempotence. *)
576                            SOME os => os
577                          | NONE => let
578                      val os = !cur                      val os = !cur
579                  in                  in
580                      cur := os + sz;                      cur := os + sz;
# Line 576  Line 582 
582                      members := i :: (!members);                      members := i :: (!members);
583                      os                      os
584                  end                  end
585                  fun get i = valOf (SmlInfoMap.find (!dict, i))                  val get = valOf o get0
586              in              in
587                  (reg, get)                  (reg, get)
588              end              end

Legend:
Removed from v.652  
changed lines
  Added in v.653

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