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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/target-cpu/gen-strand.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/target-cpu/gen-strand.sml

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

revision 3906, Mon May 23 22:09:41 2016 UTC revision 3907, Mon May 23 23:30:23 2016 UTC
# Line 22  Line 22 
22     * parameters.     * parameters.
23     *)     *)
24      fun genStateInit (spec, strandName, params, body) = let      fun genStateInit (spec, strandName, params, body) = let
25            val globTy = N.globalsPtrTy props            val globTy = N.globalsPtrTy spec
26            val fName = strandName ^ "_init"            val fName = strandName ^ "_init"
27            val selfParam = if Properties.dualState props            val selfParam = if Spec.dualState spec
28                  then "selfOut"                  then "selfOut"
29                  else "self"                  else "self"
30            val params =            val params =
31                  CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), selfParam) ::                  CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), selfParam) ::
32                    List.map (fn (CL.V(ty, x)) => CL.PARAM([], ty, x)) params                    List.map (fn (CL.V(ty, x)) => CL.PARAM([], ty, x)) params
33            val params = if #hasGlobals props            val params = if #hasGlobals spec
34                  then CL.PARAM([], globTy, "glob") :: params                  then CL.PARAM([], globTy, "glob") :: params
35                  else params                  else params
36            val body = ??            val body = ??
# Line 40  Line 40 
40    
41    (* generate a function definition for a strand method *)    (* generate a function definition for a strand method *)
42      fun genMethod (spec, strandName, methTy, methName, body) = let      fun genMethod (spec, strandName, methTy, methName, body) = let
43            val globTy = N.globalsPtrTy props            val globTy = N.globalsPtrTy spec
44            val fName = concat[strandName, "_", methName]            val fName = concat[strandName, "_", methName]
45            val stateParams = if Spec.dualState spec            val stateParams = if Spec.dualState spec
46                  then [                  then [
# Line 58  Line 58 
58    
59      fun genInitiallyMethod (_, _, NONE) = []      fun genInitiallyMethod (_, _, NONE) = []
60        | genInitiallyMethod (spec, strandName, SOME body) =        | genInitiallyMethod (spec, strandName, SOME body) =
61            genMethod (spec, strandName, CL.T_Named "StrandStatus_t", "initially", body)            [genMethod (spec, strandName, CL.T_Named "StrandStatus_t", "initially", body)]
62    
63      fun genUpdateMethod (spec, strandName, body) =      fun genUpdateMethod (spec, strandName, body) =
64            genMethod (spec, strandName, CL.T_Named "StrandStatus_t", "update", body)            genMethod (spec, strandName, CL.T_Named "StrandStatus_t", "update", body)
65    
66      fun genStabilizeMethod (_, _, NONE) = []      fun genStabilizeMethod (_, _, NONE) = []
67        | genStabilizeMethod (spec, strandName, SOME body) =        | genStabilizeMethod (spec, strandName, SOME body) =
68            genMethod (spec, strandName, CL.voidTy, "stabilize", body)            [genMethod (spec, strandName, CL.voidTy, "stabilize", body)]
69    
70      fun gen (spec : TargetSpec.t, strand) = let      fun gen (spec : TargetSpec.t, strand) = let
71            val IR.Strand{name, params, state, stateInit, initM, updateM, stabilizeM} = strand            val IR.Strand{name, params, state, stateInit, initM, updateM, stabilizeM} = strand
72              val name = Atom.toString name
73            in            in
74              genStateInit (spec, name, ??, stateInit) ::              genStateInit (spec, name, ??, stateInit) ::
75              genInitiallyMethod (spec, name, initM) @              genInitiallyMethod (spec, name, initM) @

Legend:
Removed from v.3906  
changed lines
  Added in v.3907

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