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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/cfg-ir/check-ir-fn.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/cfg-ir/check-ir-fn.sml

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

revision 3484, Sat Dec 5 15:33:56 2015 UTC revision 3485, Sun Dec 6 13:48:48 2015 UTC
# Line 243  Line 243 
243              chkRHS (mask, xs)              chkRHS (mask, xs)
244            end            end
245    
246      fun check (phase, IR.Program{globals, props, inputInit, globalInit, initially, strands}) = let      fun check (phase, prog) = let
247              val IR.Program{
248                      props, consts, inputs, globals,
249                      constInit, globalInit, strand, create, update
250                    } = prog
251            val errBuf = ref []            val errBuf = ref []
252            val errFn = error errBuf            val errFn = error errBuf
253            fun final () = (case !errBuf            fun final () = (case !errBuf
# Line 362  Line 366 
366                    Avail.scrub nodes                    Avail.scrub nodes
367                  end                  end
368          (* check a strand definition *)          (* check a strand definition *)
369            fun checkStrand (IR.Strand{name, params, state, stateInit, methods}) = let            fun checkStrand (IR.Strand{name, params, state, stateInit, initM, updateM, stabilizeM}) =
370                    let
371                  val nStateVars = List.length state                  val nStateVars = List.length state
372                  val extraVars = params                  val extraVars = params
373                  fun checkMethod (IR.Method{name, body, ...}) = checkCFG (extraVars, body)                  fun checkMethod body = checkCFG (extraVars, body)
374  (*DEBUG*)handle ex => raise ex  (*DEBUG*)handle ex => raise ex
375                  in                  in
376                    checkCFG (extraVars, stateInit)                    checkCFG (extraVars, stateInit)
377  (*DEBUG*)handle ex => raise ex;  (*DEBUG*)handle ex => raise ex;
378                    List.app checkMethod methods                    Option.app checkMethod initM;
379                      checkMethod updateM;
380                      Option.app checkMethod stabilizeM
381                  end                  end
382          (* handle exceptions *)          (* handle exceptions *)
383            fun onExn exn =            fun onExn exn =
384                  errFn (S "uncaught exception: " :: S(exnMessage exn) ::                  errFn (S "uncaught exception: " :: S(exnMessage exn) ::
385                    List.foldr (fn (s, msg) => NL :: S "    raised at " :: S s :: msg)                    List.foldr (fn (s, msg) => NL :: S "    raised at " :: S s :: msg)
386                      [] (SMLofNJ.exnHistory exn))                      [] (SMLofNJ.exnHistory exn))
387              fun checkCFG' cfg = (checkCFG ([], cfg) handle ex => onExn ex)
388            in            in
389            (* check the input part *)            (* check the input part *)
390              checkCFG ([], inputInit) handle ex => onExn ex;              checkCFG' constInit;
391            (* check the global part *)            (* check the global part *)
392              checkCFG ([], globalInit) handle ex => onExn ex;              checkCFG' globalInit;
393  (* FIXME: need to check initially *)            (* check initial strand creation *)
394                case create of IR.Create{dim, code} => checkCFG' code;
395            (* check the strands *)            (* check the strands *)
396              (List.app checkStrand strands) handle ex => onExn ex;              (checkStrand strand) handle ex => onExn ex;
397              (* check the optional global update *)
398                Option.app checkCFG' update;
399            (* check for errors *)            (* check for errors *)
400              final()              final()
401            end            end

Legend:
Removed from v.3484  
changed lines
  Added in v.3485

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