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

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

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

revision 368, Sat Jul 3 13:05:59 1999 UTC revision 369, Sun Jul 4 12:55:20 1999 UTC
# Line 12  Line 12 
12      structure DG = DependencyGraph      structure DG = DependencyGraph
13      structure GG = GroupGraph      structure GG = GroupGraph
14  in  in
15      functor CompileGenericFn (structure CT: COMPILATION_TYPE) :> sig      functor CompileGenericFn (structure CT: COMPILATION_TYPE) :> TRAVERSAL
16            where type envdelta = CT.envdelta
17          type envdelta = CT.envdelta            and type result = CT.result =
18          type result = CT.result      struct
   
         val bnode : GP.info -> DG.bnode -> envdelta option  
         val group : GP.info -> GG.group -> result option  
         val impexpmap :  
             GP.info -> DependencyGraph.impexp SymbolMap.map -> result option  
   
         (* If you go through the "sbnode" interface, then  
          * you must reset explicitly when you are done. *)  
         val sbnode : GP.info -> DG.sbnode -> envdelta option  
         val reset : unit -> unit  
   
         val resetAll : unit -> unit  
     end = struct  
19    
20          type envdelta = CT.envdelta          type envdelta = CT.envdelta
21          type env = CT.env          type env = CT.env
# Line 37  Line 24 
24    
25          val smlcache = ref (SmlInfoMap.empty: envdelta option SmlInfoMap.map)          val smlcache = ref (SmlInfoMap.empty: envdelta option SmlInfoMap.map)
26          val stablecache = ref (StableMap.empty: envdelta option StableMap.map)          val stablecache = ref (StableMap.empty: envdelta option StableMap.map)
27          fun reset () = smlcache := SmlInfoMap.empty          fun reset () = (CT.nestedTraversalReset ();
28                            smlcache := SmlInfoMap.empty)
29          fun resetAll () = (reset (); stablecache := StableMap.empty)          fun resetAll () = (reset (); stablecache := StableMap.empty)
30    
31          (* To implement "keep_going" we have two different ways of          (* To implement "keep_going" we have two different ways of
# Line 61  Line 49 
49                                    Option.map CT.bnofilter o bnode gp))                                    Option.map CT.bnofilter o bnode gp))
50    
51              fun bn (DG.PNODE p) = SOME (CT.primitive gp p)              fun bn (DG.PNODE p) = SOME (CT.primitive gp p)
52                | bn (DG.BNODE n) = let                | bn (node as DG.BNODE n) = let
53                      val { bininfo, localimports = li, globalimports = gi } = n                      val { bininfo, localimports = li, globalimports = gi } = n
54                  in                  in
55                      case StableMap.find (!stablecache, bininfo) of                      case StableMap.find (!stablecache, bininfo) of
# Line 69  Line 57 
57                        | NONE => let                        | NONE => let
58                              fun mkenv () =                              fun mkenv () =
59                                  loc (glob (SOME (CT.bpervasive gp)) gi) li                                  loc (glob (SOME (CT.bpervasive gp)) gi) li
60                              val r = CT.dostable (bininfo, mkenv, gp)                              val r = CT.dostable (bininfo, mkenv, gp, node)
61                          in                          in
62                              stablecache :=                              stablecache :=
63                                 StableMap.insert (!stablecache, bininfo, r);                                 StableMap.insert (!stablecache, bininfo, r);
# Line 87  Line 75 
75                | (SOME d, NONE) => SOME (CT.bnofilter d)                | (SOME d, NONE) => SOME (CT.bnofilter d)
76                | (SOME d, SOME s) => SOME (CT.bfilter (d, s))                | (SOME d, SOME s) => SOME (CT.bfilter (d, s))
77    
78          fun snode gp (DG.SNODE n) = let          fun snode gp (node as DG.SNODE n) = let
79    
80              val k = #keep_going (#param gp)              val k = #keep_going (#param gp)
81              val glob =              val glob =
# Line 106  Line 94 
94                      val e = loc ge li                      val e = loc ge li
95                      val r = case e of                      val r = case e of
96                          NONE => NONE                          NONE => NONE
97                        | SOME e => CT.dosml (smlinfo, e, gp)                        | SOME e => CT.dosml (smlinfo, e, gp, node)
98                  in                  in
99                      smlcache := SmlInfoMap.insert (!smlcache, smlinfo, r);                      smlcache := SmlInfoMap.insert (!smlcache, smlinfo, r);
100                      r                      r

Legend:
Removed from v.368  
changed lines
  Added in v.369

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