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/Semant/pickle/unpickmod-new.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/Semant/pickle/unpickmod-new.sml

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

revision 489, Tue Nov 23 12:55:00 1999 UTC revision 504, Tue Dec 7 18:31:05 1999 UTC
# Line 5  Line 5 
5   *)   *)
6  signature UNPICKMOD = sig  signature UNPICKMOD = sig
7    
8        type env'n'ctxt = { env: StaticEnv.staticEnv, ctxt: ModuleId.Set.set }
9    
10      val unpickleEnv :      val unpickleEnv :
11          { context: CMStaticEnv.staticEnv,          { context: CMStaticEnv.staticEnv,
12            hash: PersStamps.persstamp,            hash: PersStamps.persstamp,
13            pickle: Word8Vector.vector }            pickle: Word8Vector.vector }
14          -> StaticEnv.staticEnv          -> env'n'ctxt
15    
16      val unpickleFLINT : Word8Vector.vector -> CompBasic.flint option      val unpickleFLINT : Word8Vector.vector -> CompBasic.flint option
17    
# Line 24  Line 26 
26          { prim_context: string -> CMStaticEnv.staticEnv option,          { prim_context: string -> CMStaticEnv.staticEnv option,
27            node_context: int * Symbol.symbol -> CMStaticEnv.staticEnv option }            node_context: int * Symbol.symbol -> CMStaticEnv.staticEnv option }
28          -> { symenv: SymbolicEnv.symenv UnpickleUtil.reader,          -> { symenv: SymbolicEnv.symenv UnpickleUtil.reader,
29               env: StaticEnv.staticEnv UnpickleUtil.reader,               env: env'n'ctxt UnpickleUtil.reader,
30               symbol: Symbol.symbol UnpickleUtil.reader,               symbol: Symbol.symbol UnpickleUtil.reader,
31               symbollist: Symbol.symbol list UnpickleUtil.reader }               symbollist: Symbol.symbol list UnpickleUtil.reader }
32  end  end
# Line 52  Line 54 
54      structure UU = UnpickleUtil      structure UU = UnpickleUtil
55      exception Format = UU.Format      exception Format = UU.Format
56    
57        type env'n'ctxt = { env: StaticEnv.staticEnv, ctxt: ModuleId.Set.set }
58    
59      (* The order of the entries in the following tables      (* The order of the entries in the following tables
60       * must be coordinated with pickmod! *)       * must be coordinated with pickmod! *)
61      val primop_table =      val primop_table =
# Line 376  Line 380 
380          val edListM = UU.mkMap ()          val edListM = UU.mkMap ()
381          val eenvBindM = UU.mkMap ()          val eenvBindM = UU.mkMap ()
382          val envM = UU.mkMap ()          val envM = UU.mkMap ()
383            val milM = UU.mkMap ()
384    
385          val { pid, string, symbol,          val { pid, string, symbol,
386                access, conrep, consig, lty, tyc, tkind, ltylist, tyclist,                access, conrep, consig, lty, tyc, tkind, ltylist, tyclist,
# Line 832  Line 837 
837          in          in
838              Env.consolidate (foldl bind Env.empty bindlist)              Env.consolidate (foldl bind Env.empty bindlist)
839          end          end
840    
841            fun env' () = let
842                val (e, mil) = pair (env, list milM modId) ()
843                val ctxt = ModuleId.Set.addList (ModuleId.Set.empty, mil)
844            in
845                { env = e, ctxt = ctxt }
846            end
847      in      in
848          env          { envUnpickler = env, envUnpickler' = env' }
849      end      end
850    
851      fun unpickleEnv { context, hash, pickle } = let      fun unpickleEnv { context, hash, pickle } = let
852          fun cvt lk i = case lk context i of SOME v => v | NONE => raise Format          val cs = ref ModuleId.Set.empty
853            fun cvt lk i =
854                case lk context i of
855                    SOME v => (cs := ModuleId.Set.add (!cs, i); v)
856                  | NONE => raise Format
857          fun dont _ = raise Format          fun dont _ = raise Format
858          val c = { lookSTR = cvt CMStaticEnv.lookSTR,          val c = { lookSTR = cvt CMStaticEnv.lookSTR,
859                    lookSIG = cvt CMStaticEnv.lookSIG,                    lookSIG = cvt CMStaticEnv.lookSIG,
# Line 863  Line 879 
879          val sharedStuff as { symbol, ... } = mkSharedStuff (session, import)          val sharedStuff as { symbol, ... } = mkSharedStuff (session, import)
880          val symbolListM = UU.mkMap ()          val symbolListM = UU.mkMap ()
881          val symbollist = UU.r_list session symbolListM symbol          val symbollist = UU.r_list session symbolListM symbol
882          val envUnpickler =          val { envUnpickler, ... } =
883              mkEnvUnpickler (session, symbollist, sharedStuff,              mkEnvUnpickler (session, symbollist, sharedStuff,
884                              c, fn () => hash)                              c, fn () => hash)
885      in      in
886          envUnpickler ()          (* order of evaluation is important here! *)
887            { env = envUnpickler (), ctxt = !cs }
888      end      end
889    
890      fun mkFlintUnpickler (session, sharedStuff) = let      fun mkFlintUnpickler (session, sharedStuff) = let
# Line 1089  Line 1106 
1106              mkSharedStuff (session, A.LVAR)              mkSharedStuff (session, A.LVAR)
1107          val symbolListM = UU.mkMap ()          val symbolListM = UU.mkMap ()
1108          val symbollist = UU.r_list session symbolListM symbol          val symbollist = UU.r_list session symbolListM symbol
1109          val envUnpickler =          val { envUnpickler', ... } =
1110              mkEnvUnpickler (session, symbollist, sharedStuff,              mkEnvUnpickler (session, symbollist, sharedStuff,
1111                              c, fn () => raise Format)                              c, fn () => raise Format)
1112          val flint = mkFlintUnpickler (session, sharedStuff)          val flint = mkFlintUnpickler (session, sharedStuff)
# Line 1098  Line 1115 
1115          val sbl = UU.r_list session sblM symbind          val sbl = UU.r_list session sblM symbind
1116          fun symenvUnpickler () = SymbolicEnv.fromListi (sbl ())          fun symenvUnpickler () = SymbolicEnv.fromListi (sbl ())
1117      in      in
1118          { symenv = symenvUnpickler, env = envUnpickler,          { symenv = symenvUnpickler, env = envUnpickler',
1119            symbol = symbol, symbollist = symbollist }            symbol = symbol, symbollist = symbollist }
1120      end      end
1121    

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

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