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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/translate/analyze-simple.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/translate/analyze-simple.sml

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

revision 4375, Sat Aug 6 15:48:53 2016 UTC revision 4516, Mon Sep 5 16:19:47 2016 UTC
# Line 209  Line 209 
209                  end                  end
210              | doStm (S.S_Return x, (live, assigns)) = (addVar (x, live), assigns)              | doStm (S.S_Return x, (live, assigns)) = (addVar (x, live), assigns)
211              | doStm (S.S_Print xs, (live, assigns)) = (addList (xs, live), assigns)              | doStm (S.S_Print xs, (live, assigns)) = (addList (xs, live), assigns)
212              | doStm (S.S_MapReduce{results, ...}, acc) = (              | doStm (S.S_MapReduce mrs, acc) = (
213                  List.app (fn x => markUpdate (cxt, x)) results;                  List.app (fn (S.MapReduce{result, ...}) => markUpdate (cxt, result)) mrs;
214                  acc)                  acc)
215              | doStm (_, acc) = acc              | doStm (_, acc) = acc
216            val (bnd, assigns) = doBlock (blk, VSet.empty)            val (bnd, assigns) = doBlock (blk, VSet.empty)
# Line 218  Line 218 
218              setGlobalsOfBlock (blk, !globals)              setGlobalsOfBlock (blk, !globals)
219            end            end
220    
221      fun analyze (S.Program{constInit, funcs, globInit, strand, create, init, update, ...}) = let      fun analyze prog = let
222            val S.Strand{stateInit, initM, updateM, stabilizeM, ...} = strand            val S.Program{
223                      props, constInit, funcs, globInit, strand, create, start, update, ...
224                    } = prog
225              val S.Strand{state, stateInit, startM, updateM, stabilizeM, ...} = strand
226            in            in
227              (* if the program has communication then the "pos" variable is shared *)
228                if Properties.hasProp Properties.StrandCommunication props
229                  then (case List.find (fn x => (SV.nameOf x = "pos")) state
230                     of SOME x => markSharedStateVar x
231                      | NONE => raise Fail "impossible: missing 'pos' state variable"
232                    (* end case *))
233                  else ();
234              analyzeBlock ConstInit constInit;              analyzeBlock ConstInit constInit;
235              List.app (fn (S.Func{f, body, ...}) => analyzeBlock UserFunc body) funcs;              List.app (fn (S.Func{f, body, ...}) => analyzeBlock UserFunc body) funcs;
236              analyzeBlock GlobalInit globInit;              analyzeBlock GlobalInit globInit;
237              analyzeBlock StateInit stateInit;              analyzeBlock StateInit stateInit;
238              Option.app (analyzeBlock InitMeth) initM;              Option.app (analyzeBlock InitMeth) startM;
239              analyzeBlock UpdateMeth updateM;              analyzeBlock UpdateMeth updateM;
240              Option.app (analyzeBlock StabilizeMeth) stabilizeM;              Option.app (analyzeBlock StabilizeMeth) stabilizeM;
241              Create.app (analyzeBlock Create) create;              Create.app (analyzeBlock Create) create;
242              Option.app (analyzeBlock GlobalUpdate) init;              Option.app (analyzeBlock GlobalUpdate) start;
243              Option.app (analyzeBlock GlobalUpdate) update              Option.app (analyzeBlock GlobalUpdate) update
244            end            end
245    

Legend:
Removed from v.4375  
changed lines
  Added in v.4516

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