Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/codegen/codegen-env.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/codegen/codegen-env.sml

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

revision 4474, Tue Aug 30 14:28:38 2016 UTC revision 4475, Tue Aug 30 14:38:50 2016 UTC
# Line 21  Line 21 
21      val empty : TargetSpec.t -> t      val empty : TargetSpec.t -> t
22    
23    (* code generation callbacks *)    (* code generation callbacks *)
24      type map_reduce_cb = t * TreeIR.map_reduce list * TreeVar.t -> t * CLang.stm list      type map_reduce_cb =
25              t * TreeIR.map_reduce list * TreeVar.t * CLang.stm list -> t * CLang.stm list
26      val setMapReduceCB : t * map_reduce_cb -> unit      val setMapReduceCB : t * map_reduce_cb -> unit
27      val mapReduceCB : map_reduce_cb      val mapReduceCB : map_reduce_cb
28    
# Line 63  Line 64 
64          mapReduceCB : map_reduce_cb option ref          mapReduceCB : map_reduce_cb option ref
65        }        }
66    
67      withtype map_reduce_cb = t * TreeIR.map_reduce list * TreeVar.t -> t * CLang.stm list      withtype map_reduce_cb =
68            t * TreeIR.map_reduce list * TreeVar.t * CLang.stm list -> t * CLang.stm list
69    
70      fun new {spec, world, global, selfIn, selfOut} = Env{      fun new {spec, world, global, selfIn, selfOut} = Env{
71              vmap = List.foldl VMap.insert' VMap.empty [              vmap = List.foldl VMap.insert' VMap.empty [
# Line 83  Line 85 
85            }            }
86    
87      fun setMapReduceCB (Env{mapReduceCB, ...}, cbFun) = mapReduceCB := SOME cbFun      fun setMapReduceCB (Env{mapReduceCB, ...}, cbFun) = mapReduceCB := SOME cbFun
88      fun mapReduceCB (env as Env{mapReduceCB, ...}, mrs, src) = (case !mapReduceCB      fun mapReduceCB (env as Env{mapReduceCB, ...}, mrs, src, stms) = (case !mapReduceCB
89             of SOME cbFun => cbFun (env, mrs, src)             of SOME cbFun => cbFun (env, mrs, src, stms)
90              | NONE => raise Fail "mapReduceCB: no callback set"              | NONE => raise Fail "mapReduceCB: no callback set"
91            (* end case *))            (* end case *))
92    
# Line 124  Line 126 
126              print "*****\n"              print "*****\n"
127            end            end
128    
129    (* +DEBUG *)
130  val mapReduceCB = fn arg => (mapReduceCB arg) handle ex => (dump("ENV", #1 arg); raise ex)  val mapReduceCB = fn arg => (mapReduceCB arg) handle ex => (dump("ENV", #1 arg); raise ex)
131    (* -DEBUG *)
132    
133    end    end

Legend:
Removed from v.4474  
changed lines
  Added in v.4475

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