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

SCM Repository

[diderot] Annotation of /trunk/src/compiler/translate/translate.sml
ViewVC logotype

Annotation of /trunk/src/compiler/translate/translate.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2462 - (view) (download)

1 : jhr 137 (* translate.sml
2 :     *
3 : jhr 435 * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4 : jhr 137 * All rights reserved.
5 :     *
6 : jhr 1116 * Translate Simple-AST code into the IL representation. This translation is based on the
7 :     * algorithm described in
8 :     *
9 : jhr 2356 * Single-pass generation of static single assignment form for structured languages
10 :     * ACM TOPLAS, Nov. 1994
11 :     * by Brandis and MossenBock.
12 : jhr 137 *)
13 :    
14 :     structure Translate : sig
15 :    
16 : jhr 176 val translate : Simple.program -> HighIL.program
17 : jhr 137
18 :     end = struct
19 :    
20 : jhr 176 structure S = Simple
21 : jhr 394 structure Ty = Types
22 : jhr 137 structure VMap = Var.Map
23 : jhr 189 structure VSet = Var.Set
24 : jhr 168 structure IL = HighIL
25 : jhr 1640 structure Op = HighOps
26 : jhr 394 structure DstTy = HighILTypes
27 : jhr 1116 structure Census = HighILCensus
28 : jhr 137
29 : jhr 1640 val cvtTy = TranslateTy.tr
30 :    
31 : jhr 1116 (* maps from SimpleAST variables to the current corresponding SSA variable *)
32 : jhr 511 type env = IL.var VMap.map
33 :    
34 : jhr 1640 (* +DEBUG *)
35 :     fun prEnv (prefix, env) = let
36 :     val wid = ref 0
37 :     fun pr s = (print s; wid := !wid + size s)
38 :     fun nl () = if (!wid > 0) then (print "\n"; wid := 0) else ()
39 :     fun prElem (src, dst) = let
40 :     val s = String.concat [
41 :     " ", Var.uniqueNameOf src, "->", IL.Var.toString dst
42 :     ]
43 :     in
44 :     pr s;
45 :     if (!wid >= 100) then (nl(); pr " ") else ()
46 :     end
47 :     in
48 :     pr prefix; pr " ENV: {"; nl(); pr " ";
49 :     VMap.appi prElem env;
50 :     nl(); pr "}"; nl()
51 :     end
52 :     (* -DEBUG *)
53 :    
54 : jhr 197 fun lookup env x = (case VMap.find (env, x)
55 : jhr 2356 of SOME x' => x'
56 :     | NONE => raise Fail(concat[
57 :     "no binding for ", Var.uniqueNameOf x, " in environment"
58 :     ])
59 :     (* end case *))
60 : jhr 176
61 : jhr 189 (* create a new instance of a variable *)
62 : jhr 394 fun newVar x = IL.Var.new (Var.nameOf x, cvtTy(Var.monoTypeOf x))
63 : jhr 189
64 : jhr 1116 (* generate fresh SSA variables and add them to the environment *)
65 :     fun freshVars (env, xs) = let
66 : jhr 2356 fun cvtVar (x, (env, xs)) = let
67 :     val x' = newVar x
68 :     in
69 :     (VMap.insert(env, x, x'), x'::xs)
70 :     end
71 :     val (env, xs) = List.foldl cvtVar (env, []) xs
72 :     in
73 :     (env, List.rev xs)
74 :     end
75 : jhr 1116
76 :     (* a pending-join node tracks the phi nodes needed to join the assignments
77 :     * that flow into the join node.
78 :     *)
79 :     datatype join = JOIN of {
80 : jhr 2356 env : env, (* the environment that was current at the conditional *)
81 :     (* associated with this node. *)
82 :     arity : int ref, (* actual number of predecessors *)
83 :     nd : IL.node, (* the CFG node for this pending join *)
84 :     phiMap : IL.phi VMap.map ref, (* a mapping from Simple AST variables that are assigned *)
85 :     (* to their phi nodes. *)
86 :     predKill : bool array (* killed predecessor edges (because of DIE or STABILIZE *)
87 : jhr 1116 }
88 :    
89 :     (* a stack of pending joins. The first component specifies the path index of the current
90 :     * path to the join.
91 :     *)
92 :     type pending_joins = (int * join) list
93 :    
94 :     (* create a new pending-join node *)
95 : jhr 1232 fun newJoin (env, arity) = JOIN{
96 : jhr 2356 env = env, arity = ref arity, nd = IL.Node.mkJOIN [], phiMap = ref VMap.empty,
97 :     predKill = Array.array(arity, false)
98 :     }
99 : jhr 1116
100 :     (* record that a path to the top join in the stack has been killed because f DIE or STABILIZE *)
101 :     fun killPath ((i, JOIN{arity, predKill, ...}) :: _) = (
102 : jhr 2356 arity := !arity - 1;
103 :     Array.update (predKill, i, true))
104 : jhr 1116 | killPath _ = ()
105 :    
106 :     (* record an assignment to the IL variable dstVar (corresponding to the Simple AST variable
107 :     * srcVar) in the current pending-join node. The predIndex specifies which path into the
108 :     * JOIN node this assignment occurs on.
109 :     *)
110 : jhr 1232 fun recordAssign ([], _, _) = ()
111 :     | recordAssign ((predIndex, JOIN{env, phiMap, predKill, nd, ...})::_, srcVar, dstVar) = let
112 : jhr 2356 val arity = Array.length predKill (* the original arity before any killPath calls *)
113 :     val m = !phiMap
114 :     in
115 :     case VMap.find (env, srcVar)
116 :     of NONE => () (* local temporary *)
117 :     | SOME dstVar' => (case VMap.find (m, srcVar)
118 :     of NONE => let
119 :     val lhs = newVar srcVar
120 :     val rhs = List.tabulate (arity, fn i => if (i = predIndex) then dstVar else dstVar')
121 :     in
122 : jhr 1232 (*
123 :     print(concat["recordAssign: ", Var.uniqueNameOf srcVar, " --> ", IL.Var.toString lhs,
124 :     " @ ", IL.Node.toString nd, "\n"]);
125 :     *)
126 : jhr 2356 phiMap := VMap.insert (m, srcVar, (lhs, rhs))
127 :     end
128 :     | SOME(lhs, rhs) => let
129 :     fun update (i, l as x::r) = if (i = predIndex)
130 :     then dstVar::r
131 :     else x::update(i+1, r)
132 :     | update _ = raise Fail "invalid predecessor index"
133 :     in
134 :     phiMap := VMap.insert (m, srcVar, (lhs, update(0, rhs)))
135 :     end
136 :     (* end case *))
137 :     (* end case *)
138 :     end
139 : jhr 1116
140 :     (* complete a pending join operation by filling in the phi nodes from the phi map and
141 :     * updating the environment.
142 :     *)
143 : jhr 1232 fun commitJoin (joinStk, JOIN{env, arity, nd, phiMap, predKill}) = (case !arity
144 : jhr 2356 of 0 => (env, NONE)
145 :     | 1 => let
146 :     (* there is only one path to the join, so we do not need phi nodes, but
147 :     * we still need to propogate assignments to the next join on the stack.
148 :     *)
149 :     val IL.ND{kind=IL.JOIN{phis, ...}, ...} = nd
150 :     val ix = let (* find pred of this join *)
151 :     fun find i = if Array.sub(predKill, i) then find(i+1) else i
152 :     in
153 :     find 0
154 :     end
155 :     fun doVar (srcVar, (_, xs), env) = let
156 :     val dstVar = List.nth(xs, ix)
157 :     in
158 : jhr 1766 (*
159 :     print(concat["doVar (", Var.uniqueNameOf srcVar, ", ", IL.phiToString phi, ", _) @ ", IL.Node.toString nd, "\n"]);
160 :     *)
161 : jhr 2356 recordAssign (joinStk, srcVar, dstVar);
162 :     VMap.insert (env, srcVar, dstVar)
163 :     end
164 :     val env = VMap.foldli doVar env (!phiMap)
165 :     in
166 :     (env, SOME nd)
167 :     end
168 :     | n => if (n = Array.length predKill)
169 :     then let
170 :     val IL.ND{kind=IL.JOIN{phis, ...}, ...} = nd
171 :     fun doVar (srcVar, phi as (dstVar, _), (env, phis)) = (
172 : jhr 1232 (*
173 :     print(concat["doVar (", Var.uniqueNameOf srcVar, ", ", IL.phiToString phi, ", _) @ ", IL.Node.toString nd, "\n"]);
174 :     *)
175 : jhr 2356 recordAssign (joinStk, srcVar, dstVar);
176 :     (VMap.insert (env, srcVar, dstVar), phi::phis))
177 :     val (env, phis') = VMap.foldli doVar (env, []) (!phiMap)
178 :     in
179 :     phis := phis';
180 :     (env, SOME nd)
181 :     end
182 :     else raise Fail "FIXME: prune killed paths."
183 :     (* end case *))
184 : jhr 1116
185 : jhr 168 (* expression translation *)
186 : jhr 1116 fun cvtExp (env : env, lhs, exp) = (case exp
187 : jhr 2356 of S.E_Var x => [IL.ASSGN(lhs, IL.VAR(lookup env x))]
188 :     | S.E_Lit lit => [IL.ASSGN(lhs, IL.LIT lit)]
189 :     | S.E_Tuple xs => raise Fail "E_Tuple not implemeted"
190 :     | S.E_Apply(f, tyArgs, args, ty) => let
191 :     val args' = List.map (lookup env) args
192 :     in
193 :     TranslateBasis.translate (lhs, f, tyArgs, args')
194 :     end
195 :     | S.E_Cons args => [IL.ASSGN(lhs, IL.CONS(IL.Var.ty lhs, List.map (lookup env) args))]
196 :     | S.E_Slice(x, indices, ty) => let
197 :     val x = lookup env x
198 :     val mask = List.map isSome indices
199 :     fun cvt NONE = NONE
200 :     | cvt (SOME x) = SOME(lookup env x)
201 :     val indices = List.mapPartial cvt indices
202 :     in
203 :     if List.all (fn b => b) mask
204 :     then [IL.ASSGN(lhs, IL.OP(Op.TensorSub(IL.Var.ty x), x::indices))]
205 :     else [IL.ASSGN(lhs, IL.OP(Op.Slice(IL.Var.ty x, mask), x::indices))]
206 :     end
207 :     | S.E_Coerce{srcTy, dstTy, x} => (case (srcTy, dstTy)
208 :     of (Ty.T_Int, Ty.T_Tensor _) =>
209 :     [IL.ASSGN(lhs, IL.OP(Op.IntToReal, [lookup env x]))]
210 :     | (Ty.T_Field _, Ty.T_Field _) =>
211 :     (* change in continuity is a no-op *)
212 :     [IL.ASSGN(lhs, IL.VAR(lookup env x))]
213 :     | _ => raise Fail(concat[
214 :     "unsupported type coercion: ", TypeUtil.toString srcTy,
215 :     " ==> ", TypeUtil.toString dstTy
216 :     ])
217 :     (* end case *))
218 : jhr 2462 | S.E_Input(_, name, NONE, NONE) =>
219 :     [IL.ASSGN(lhs, IL.OP(HighOps.Input(IL.Var.ty lhs, name, ""), []))]
220 :     | S.E_Input(_, name, SOME desc, NONE) =>
221 : jhr 2356 [IL.ASSGN(lhs, IL.OP(HighOps.Input(IL.Var.ty lhs, name, desc), []))]
222 : jhr 2462 | S.E_Input(_, name, NONE, SOME dflt) =>
223 :     [IL.ASSGN(lhs, IL.OP(HighOps.InputWithDefault(IL.Var.ty lhs, name, ""), [lookup env dflt]))]
224 :     | S.E_Input(_, name, SOME desc, SOME dflt) =>
225 : jhr 2356 [IL.ASSGN(lhs, IL.OP(HighOps.InputWithDefault(IL.Var.ty lhs, name, desc), [lookup env dflt]))]
226 :     | S.E_LoadImage(info, name) => [IL.ASSGN(lhs, IL.OP(HighOps.LoadImage info, [lookup env name]))]
227 :     (* end case *))
228 : jhr 168
229 : jhr 1640 (* add nodes to save the strand state, followed by an exit node *)
230 :     fun saveStrandState (env, (srcState, dstState), exit) = let
231 :     val stateOut = List.map (lookup env) srcState
232 :     fun save (x, x', cfg) = IL.CFG.appendNode (cfg, IL.Node.mkSAVE(x, x'))
233 :     in
234 :     IL.CFG.appendNode (
235 :     ListPair.foldlEq save IL.CFG.empty (dstState, stateOut),
236 :     exit)
237 :     end
238 : jhr 2356 (*DEBUG*)handle ex => raise ex
239 : jhr 1640
240 : jhr 1116 fun cvtBlock (state, env : env, joinStk, S.Block stms) = let
241 : jhr 2356 fun cvt (env : env, cfg, []) = (cfg, env)
242 :     | cvt (env, cfg, stm::stms) = (case stm
243 :     of S.S_Var x => let
244 :     val x' = newVar x
245 :     in
246 :     cvt (VMap.insert (env, x, x'), cfg, stms)
247 :     end
248 :     | S.S_Assign(lhs, rhs) => let
249 :     val lhs' = newVar lhs
250 :     val assigns = cvtExp (env, lhs', rhs)
251 :     in
252 : jhr 1232 (*
253 :     print "doAssign\n";
254 :     *)
255 : jhr 2356 recordAssign (joinStk, lhs, lhs');
256 :     cvt (
257 :     VMap.insert(env, lhs, lhs'),
258 :     IL.CFG.concat(cfg, IL.CFG.mkBlock assigns),
259 :     stms)
260 :     end
261 :     | S.S_IfThenElse(x, b0, b1) => let
262 :     val x' = lookup env x
263 :     val join = newJoin (env, 2)
264 :     val (cfg0, _) = cvtBlock (state, env, (0, join)::joinStk, b0)
265 :     val (cfg1, _) = cvtBlock (state, env, (1, join)::joinStk, b1)
266 :     val cond = IL.Node.mkCOND {
267 :     cond = x',
268 :     trueBranch = IL.Node.dummy,
269 :     falseBranch = IL.Node.dummy
270 :     }
271 :     in
272 :     IL.Node.addEdge (IL.CFG.exit cfg, cond);
273 :     case commitJoin (joinStk, join)
274 :     of (env, SOME joinNd) => (
275 :     if IL.CFG.isEmpty cfg0
276 :     then (
277 :     IL.Node.setTrueBranch (cond, joinNd);
278 :     IL.Node.setPred (joinNd, cond))
279 :     else (
280 :     IL.Node.setTrueBranch (cond, IL.CFG.entry cfg0);
281 :     IL.Node.setPred (IL.CFG.entry cfg0, cond);
282 :     IL.Node.addEdge (IL.CFG.exit cfg0, joinNd));
283 :     if IL.CFG.isEmpty cfg1
284 :     then (
285 :     IL.Node.setFalseBranch (cond, joinNd);
286 :     IL.Node.setPred (joinNd, cond))
287 :     else (
288 :     IL.Node.setFalseBranch (cond, IL.CFG.entry cfg1);
289 :     IL.Node.setPred (IL.CFG.entry cfg1, cond);
290 :     IL.Node.addEdge (IL.CFG.exit cfg1, joinNd));
291 :     cvt (
292 :     env,
293 : jhr 1339 IL.CFG.concat (
294 :     cfg,
295 :     IL.CFG{entry = cond, exit = joinNd}),
296 : jhr 2356 stms))
297 :     (* the join node has only zero predecessors, so
298 :     * it was killed.
299 :     *)
300 :     | (env, NONE) => raise Fail "unimplemented" (* FIXME *)
301 :     (* end case *)
302 :     end
303 :     | S.S_New(strandId, args) => let
304 :     val nd = IL.Node.mkNEW{
305 :     strand = strandId,
306 :     args = List.map (lookup env) args
307 :     }
308 :     in
309 :     cvt (env, IL.CFG.appendNode (cfg, nd), stms)
310 :     end
311 :     | S.S_Die => (
312 : jhr 1640 killPath joinStk;
313 : jhr 2356 (IL.CFG.appendNode (cfg, IL.Node.mkDIE ()), env))
314 :     | S.S_Stabilize => (
315 :     killPath joinStk;
316 : jhr 1640 (IL.CFG.concat (cfg, saveStrandState (env, state, IL.Node.mkSTABILIZE())), env))
317 : jhr 2356 | S.S_Return _ => raise Fail "unexpected return"
318 : jhr 1640 | S.S_Print args => let
319 :     val args = List.map (lookup env) args
320 :     val nd = IL.Node.mkMASSIGN([], Op.Print(List.map IL.Var.ty args), args)
321 :     in
322 :     cvt (env, IL.CFG.appendNode (cfg, nd), stms)
323 :     end
324 : jhr 2356 (* end case *))
325 :     in
326 :     cvt (env, IL.CFG.empty, stms)
327 :     end
328 : jhr 1339 (*DEBUG*)handle ex => raise ex
329 : jhr 168
330 : jhr 1232 fun cvtTopLevelBlock (env, blk, mkExit) = let
331 : jhr 2356 val (cfg, env) = cvtBlock (([], []), env, [], blk)
332 : jhr 1640 val cfg = IL.CFG.prependNode (IL.Node.mkENTRY(), cfg)
333 :     val cfg = IL.CFG.concat (cfg, mkExit env)
334 : jhr 2356 in
335 :     (cfg, env)
336 :     end
337 : jhr 1339 (*DEBUG*)handle ex => raise ex
338 : jhr 256
339 : jhr 1116 (* FIXME: the following function could be refactored with cvtTopLevelBlock to share code *)
340 : jhr 1232 fun cvtFragmentBlock (env0, blk) = let
341 : jhr 2356 val (cfg, env) = cvtBlock (([], []), env0, [], blk)
342 :     val entry = IL.Node.mkENTRY ()
343 :     (* the live variables out are those that were not live coming in *)
344 :     val liveOut = VMap.foldli
345 :     (fn (x, x', xs) => if VMap.inDomain(env0, x) then xs else x'::xs)
346 :     [] env
347 :     val exit = IL.Node.mkFRAGMENT liveOut
348 :     in
349 :     if IL.CFG.isEmpty cfg
350 :     then IL.Node.addEdge (entry, exit)
351 :     else (
352 :     IL.Node.addEdge (entry, IL.CFG.entry cfg);
353 :     IL.Node.addEdge (IL.CFG.exit cfg, exit));
354 :     (IL.CFG{entry = entry, exit = exit}, env)
355 :     end
356 : jhr 1339 (*DEBUG*)handle ex => raise ex
357 : jhr 1116
358 : jhr 1640 fun cvtMethod (env, name, state, svars, blk) = let
359 :     (* load the state into fresh variables *)
360 :     val (env, loadCFG) = let
361 :     (* allocate shadow variables for the state variables *)
362 :     val (env, stateIn) = freshVars (env, state)
363 :     fun load (x, x') = IL.ASSGN(x, IL.STATE x')
364 :     in
365 :     (env, IL.CFG.mkBlock (ListPair.map load (stateIn, svars)))
366 :     end
367 : jhr 2356 (* convert the body of the method *)
368 :     val (cfg, env) = cvtBlock ((state, svars), env, [], blk)
369 :     (* add the entry/exit nodes *)
370 :     val entry = IL.Node.mkENTRY ()
371 : jhr 1640 val loadCFG = IL.CFG.prependNode (entry, loadCFG)
372 : jhr 2356 val exit = (case name
373 : jhr 1640 of StrandUtil.Update => IL.Node.mkACTIVE ()
374 :     | StrandUtil.Stabilize => IL.Node.mkRETURN []
375 : jhr 1444 (* end case *))
376 : jhr 1640 val body = IL.CFG.concat (loadCFG, cfg)
377 :     (*DEBUG**val _ = prEnv (StrandUtil.nameToString name, env);*)
378 :     (* FIXME: the following code doesn't work properly *)
379 :     val body = if IL.Node.hasSucc(IL.CFG.exit body)
380 :     then IL.CFG.concat (body, saveStrandState (env, (state, svars), exit))
381 :     else IL.CFG{entry = IL.CFG.entry body, exit = exit}
382 : jhr 2356 in
383 :     IL.Method{
384 :     name = name,
385 :     body = body
386 :     }
387 :     end
388 : jhr 1640 (*DEBUG*)handle ex => (print(concat["error in cvtMethod(", StrandUtil.nameToString name, ", ...)\n"]); raise ex)
389 : jhr 1116
390 :     (* convert the initially code *)
391 :     fun cvtInitially (env, S.Initially{isArray, rangeInit, create, iters}) = let
392 : jhr 2356 val S.C_Create{argInit, name, args} = create
393 :     fun cvtIter ({param, lo, hi}, (env, iters)) = let
394 :     val param' = newVar param
395 :     val env = VMap.insert (env, param, param')
396 :     val iter = (param', lookup env lo, lookup env hi)
397 :     in
398 :     (env, iter::iters)
399 :     end
400 :     val (cfg, env) = cvtFragmentBlock (env, rangeInit)
401 :     val (env, iters) = List.foldl cvtIter (env, []) iters
402 :     val (argInitCFG, env) = cvtFragmentBlock (env, argInit)
403 :     in
404 :     IL.Initially{
405 :     isArray = isArray,
406 :     rangeInit = cfg,
407 :     iters = List.rev iters,
408 :     create = (argInitCFG, name, List.map (lookup env) args)
409 :     }
410 :     end
411 : jhr 256
412 : jhr 1640 (* check strands for properties *)
413 :     fun checkProps strands = let
414 : jhr 2356 val hasDie = ref false
415 :     val hasNew = ref false
416 :     fun chkStm e = (case e
417 : jhr 1640 of S.S_IfThenElse(_, b1, b2) => (chkBlk b1; chkBlk b2)
418 :     | S.S_New _ => (hasNew := true)
419 :     | S.S_Die => (hasDie := true)
420 :     | _ => ()
421 : jhr 2356 (* end case *))
422 :     and chkBlk (S.Block body) = List.app chkStm body
423 :     fun chkStrand (S.Strand{stateInit, methods, ...}) = let
424 :     fun chkMeth (S.Method(_, body)) = chkBlk body
425 :     in
426 :     chkBlk stateInit;
427 :     List.app chkMeth methods
428 :     end
429 :     fun condCons (x, v, l) = if !x then v::l else l
430 :     in
431 :     List.app chkStrand strands;
432 :     condCons (hasDie, StrandUtil.StrandsMayDie,
433 :     condCons (hasNew, StrandUtil.NewStrands, []))
434 :     end
435 : jhr 1640
436 : jhr 2356 fun translate (S.Program{globals, globalInit, funcs, init, strands}) = let
437 :     val (globalInit, env) = let
438 : jhr 1640 fun mkExit env = let
439 :     val nd = IL.Node.mkRETURN(VMap.listItems env)
440 :     in
441 :     IL.CFG{entry = nd, exit = nd}
442 :     end
443 :     in
444 :     cvtTopLevelBlock (VMap.empty, globalInit, mkExit)
445 :     end
446 : jhr 2356 (* construct a reduced environment that just defines the globals. *)
447 :     val env = let
448 :     val lookup = lookup env
449 :     fun cvtVar (x, env) = VMap.insert(env, x, lookup x)
450 :     val env = List.foldl cvtVar VMap.empty globals
451 :     in
452 :     env
453 :     end
454 :     val init = cvtInitially (env, init)
455 :     fun cvtStrand (S.Strand{name, params, state, stateInit, methods}) = let
456 :     (* extend the global environment with the strand's parameters *)
457 :     val (env, params) = let
458 :     fun cvtParam (x, (env, xs)) = let
459 :     val x' = newVar x
460 :     in
461 :     (VMap.insert(env, x, x'), x'::xs)
462 :     end
463 :     val (env, params) = List.foldl cvtParam (env, []) params
464 :     in
465 :     (env, List.rev params)
466 :     end
467 : jhr 1640 (* create the state variables *)
468 :     val svars = let
469 :     fun newSVar x = IL.StateVar.new (
470 :     Var.kindOf x = S.StrandOutputVar,
471 :     Var.nameOf x, cvtTy(Var.monoTypeOf x))
472 :     in
473 :     List.map newSVar state
474 :     end
475 : jhr 2356 (* convert the state initialization code *)
476 :     val (stateInit, env) = let
477 : jhr 1640 fun mkExit env = saveStrandState (env, (state, svars), IL.Node.mkSINIT())
478 : jhr 2356 in
479 :     cvtTopLevelBlock (env, stateInit, mkExit)
480 :     end
481 :     fun cvtMeth (S.Method(name, blk)) = cvtMethod (env, name, state, svars, blk)
482 :     in
483 :     IL.Strand{
484 :     name = name,
485 :     params = params,
486 :     state = svars,
487 :     stateInit = stateInit,
488 :     methods = List.map cvtMeth methods
489 :     }
490 :     end
491 :     val prog = IL.Program{
492 : jhr 1640 props = checkProps strands,
493 : jhr 2356 globalInit = globalInit,
494 :     initially = init,
495 :     strands = List.map cvtStrand strands
496 :     }
497 :     in
498 :     Census.init prog;
499 :     prog
500 :     end
501 : jhr 176
502 : jhr 137 end

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