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

SCM Repository

[diderot] Diff of /branches/vis12-cl/src/compiler/c-target/c-target.sml
ViewVC logotype

Diff of /branches/vis12-cl/src/compiler/c-target/c-target.sml

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

revision 3087, Tue Mar 17 16:35:47 2015 UTC revision 3088, Tue Mar 17 18:27:27 2015 UTC
# Line 239  Line 239 
239        (* register the global initialization part of a program *)        (* register the global initialization part of a program *)
240          fun init (Prog{props, topDecls, ...}, init) = if #hasGlobals props          fun init (Prog{props, topDecls, ...}, init) = if #hasGlobals props
241                then let                then let
242                  val worldTy = CL.T_Ptr(CL.T_Named(N.worldTy props))                  val worldTy = N.worldPtrTy props
243                  val globTy = CL.T_Ptr(CL.T_Named(N.globalsTy props))                  val globTy = N.globalsPtrTy props
244                  val wrldV = CL.mkVar "wrld"                  val wrldV = CL.mkVar "wrld"
245                (* the body of the global initializtion code *)                (* the body of the global initializtion code *)
246                  val initStms =                  val initStms =
# Line 264  Line 264 
264  (* TODO: factor out common code from cl-target.sml *)  (* TODO: factor out common code from cl-target.sml *)
265          fun free (_, _, []) = ()          fun free (_, _, []) = ()
266            | free (Prog{props, topDecls, ...}, env, globals) = let            | free (Prog{props, topDecls, ...}, env, globals) = let
267                val worldTy = CL.T_Ptr(CL.T_Named(N.worldTy props))                val worldTy = N.worldPtrTy props
268                val globTy = CL.T_Ptr(CL.T_Named(N.globalsTy props))                val globTy = N.globalsPtrTy props
269                fun global x = CL.mkIndirect(CL.mkVar "glob", IL.GlobalVar.name x)                fun global x = CL.mkIndirect(CL.mkVar "glob", IL.GlobalVar.name x)
270                fun freeGlob (x, stms) = (case IL.GlobalVar.ty x                fun freeGlob (x, stms) = (case IL.GlobalVar.ty x
271                       of Ty.DynSeqTy _ => CL.mkCall("Diderot_DynSeqFree", [global x]) :: stms                       of Ty.DynSeqTy _ => CL.mkCall("Diderot_DynSeqFree", [global x]) :: stms
# Line 295  Line 295 
295              } = let              } = let
296                val name = Atom.toString strand                val name = Atom.toString strand
297                val nDims = List.length iters                val nDims = List.length iters
298                val worldTy = CL.T_Ptr(CL.T_Named(N.worldTy props))                val worldTy = N.worldPtrTy props
299                val globTy = CL.T_Ptr(CL.T_Named(N.globalsTy props))                val globTy = N.globalsPtrTy props
300                fun mapi f xs = let                fun mapi f xs = let
301                      fun mapf (_, []) = []                      fun mapf (_, []) = []
302                        | mapf (i, x::xs) = f(i, x) :: mapf(i+1, xs)                        | mapf (i, x::xs) = f(i, x) :: mapf(i+1, xs)

Legend:
Removed from v.3087  
changed lines
  Added in v.3088

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