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

Diff of /sml/trunk/src/cm/compile/bfc.sml

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

revision 770, Sun Dec 24 20:06:28 2000 UTC revision 771, Sat Dec 30 13:06:09 2000 UTC
# Line 14  Line 14 
14   *)   *)
15  signature BFC = sig  signature BFC = sig
16      type bfc      type bfc
17      val new : unit -> { store: SmlInfo.info * bfc -> unit,      type stats = { env: int, inlinfo: int, data: int, code: int }
18                          get: SmlInfo.info -> bfc }      val new : unit -> { store: SmlInfo.info * { content: bfc, stats: stats }
19                                   -> unit,
20                            get: SmlInfo.info -> { content: bfc, stats: stats } }
21      val getStable : { stable: string, offset: int, descr: string } -> bfc      val getStable : { stable: string, offset: int, descr: string } -> bfc
22  end  end
23    
# Line 26  Line 28 
28      structure BF = MachDepVC.Binfile      structure BF = MachDepVC.Binfile
29      structure E = GenericVC.Environment      structure E = GenericVC.Environment
30      type bfc = BF.bfContent      type bfc = BF.bfContent
31        type stats = { env: int, inlinfo: int, data: int, code: int }
32    
33      val emap = GenericVC.ModuleId.emptyTmap      val emap = GenericVC.ModuleId.emptyTmap
34    
35      fun new () = let      fun new () = let
36          val m = ref SmlInfoMap.empty          val m = ref SmlInfoMap.empty
37    
38          fun store (i, bfc) = m := SmlInfoMap.insert (!m, i, bfc)          fun store (i, x) = m := SmlInfoMap.insert (!m, i, x)
39    
40          fun get i =          fun get i =
41              case SmlInfoMap.find (!m, i) of              case SmlInfoMap.find (!m, i) of
42                  SOME bfc => bfc                  SOME x => x
43                | NONE => let                | NONE => let
44                      val binname = SmlInfo.binname i                      val binname = SmlInfo.binname i
45                      fun reader s = let                      fun reader s = let
46                          val bfc = BF.read { stream = s, name = binname,                          val x = BF.read { stream = s, name = binname,
47                                              modmap = emap }                                              modmap = emap }
48                      in                      in
49                          store (i, bfc);                          store (i, x);
50                          bfc                          x
51                      end                      end
52                  in                  in
53                      SafeIO.perform { openIt = fn () => BinIO.openIn binname,                      SafeIO.perform { openIt = fn () => BinIO.openIn binname,
# Line 61  Line 64 
64              (Seek.seek (s, offset);              (Seek.seek (s, offset);
65               (* We can use an empty static env because no               (* We can use an empty static env because no
66                * unpickling will be done. *)                * unpickling will be done. *)
67               BF.read { stream = s, name = descr, modmap = emap })               #content (BF.read { stream = s, name = descr, modmap = emap }))
68      in      in
69          SafeIO.perform { openIt = fn () => BinIO.openIn stable,          SafeIO.perform { openIt = fn () => BinIO.openIn stable,
70                           closeIt = BinIO.closeIn,                           closeIt = BinIO.closeIn,

Legend:
Removed from v.770  
changed lines
  Added in v.771

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