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

SCM Repository

[diderot] Diff of /trunk/src/compiler/IL/census-fn.sml
ViewVC logotype

Diff of /trunk/src/compiler/IL/census-fn.sml

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

revision 510, Tue Feb 8 16:12:38 2011 UTC revision 511, Tue Feb 8 17:01:43 2011 UTC
# Line 21  Line 21 
21      fun inc (IL.V{useCnt, ...}) = (useCnt := !useCnt + 1)      fun inc (IL.V{useCnt, ...}) = (useCnt := !useCnt + 1)
22      fun setBinding (IL.V{bind, ...}, vb) = bind := vb      fun setBinding (IL.V{bind, ...}, vb) = bind := vb
23    
24      fun init (IL.Program{globals, globalInit, actors}) = let      fun init (IL.Program{globals, globalInit, strands}) = let
25            fun clearVar (IL.V{useCnt, ...}) = useCnt := 0            fun clearVar (IL.V{useCnt, ...}) = useCnt := 0
26          (* clear the counts of the variables defined in a node *)          (* clear the counts of the variables defined in a node *)
27            fun clearNode (IL.ND{kind, ...}) = (case kind            fun clearNode (IL.ND{kind, ...}) = (case kind
# Line 29  Line 29 
29                    | IL.BLOCK{body, ...} => List.app (fn (x, _) => clearVar x) (!body)                    | IL.BLOCK{body, ...} => List.app (fn (x, _) => clearVar x) (!body)
30                    | _ => ()                    | _ => ()
31                  (* end case *))                  (* end case *))
32          (* clear the counts of the variables defined in an actor *)          (* clear the counts of the variables defined in an strand *)
33            fun clearActor (IL.Actor{params, state, stateInit, methods, ...}) = let            fun clearStrand (IL.Strand{params, state, stateInit, methods, ...}) = let
34                  fun clearMethod (IL.Method{stateIn, body, ...}) = (                  fun clearMethod (IL.Method{stateIn, body, ...}) = (
35                        List.app clearVar stateIn;                        List.app clearVar stateIn;
36                        IL.applyToNodes clearNode body)                        IL.applyToNodes clearNode body)
# Line 67  Line 67 
67                    | IL.NEW{args, ...} => incList args                    | IL.NEW{args, ...} => incList args
68                    | _ => ()                    | _ => ()
69                  (* end case *))                  (* end case *))
70          (* increment the counts of the variables used in an actor *)          (* increment the counts of the variables used in a strand *)
71            fun incActor (IL.Actor{params, state, stateInit, methods, ...}) = let            fun incStrand (IL.Strand{params, state, stateInit, methods, ...}) = let
72                  fun incMethod (IL.Method{stateIn, stateOut, body, ...}) = (                  fun incMethod (IL.Method{stateIn, stateOut, body, ...}) = (
73                        List.app (fn x => setBinding(x, IL.VB_STATE_VAR)) stateIn;                        List.app (fn x => setBinding(x, IL.VB_STATE_VAR)) stateIn;
74                        incList stateOut;                        incList stateOut;
# Line 82  Line 82 
82            (* first clear the counts of all variables *)            (* first clear the counts of all variables *)
83              List.app clearVar globals;              List.app clearVar globals;
84              IL.applyToNodes clearNode globalInit;              IL.applyToNodes clearNode globalInit;
85              List.app clearActor actors;              List.app clearStrand strands;
86            (* then count uses *)            (* then count uses *)
87              IL.applyToNodes incNode globalInit;              IL.applyToNodes incNode globalInit;
88              List.app incActor actors              List.app incStrand strands
89            end            end
90    
91    end    end

Legend:
Removed from v.510  
changed lines
  Added in v.511

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