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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/tree-to-c/gen-strand.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/tree-to-c/gen-strand.sml

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

revision 3865, Mon May 16 16:32:19 2016 UTC revision 3866, Mon May 16 16:48:13 2016 UTC
# Line 18  Line 18 
18      structure CL = CLang      structure CL = CLang
19      structure Spec = TargetSpec      structure Spec = TargetSpec
20    
21      (* generate the strand-state initialization code.  The variables are the strand
22       * parameters.
23       *)
24        fun genStateInit (spec, strandName, params, body) = let
25              val globTy = N.globalsPtrTy props
26              val fName = strandName ^ "_init"
27              val selfParam = if Properties.dualState props
28                    then "selfOut"
29                    else "self"
30              val params =
31                    CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), selfParam) ::
32                      List.map (fn (CL.V(ty, x)) => CL.PARAM([], ty, x)) params
33              val params = if #hasGlobals props
34                    then CL.PARAM([], globTy, "glob") :: params
35                    else params
36              val body = ??
37              in
38                CL.D_Func(["static"], CL.voidTy, fName, params, body)
39              end
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 props
# Line 31  Line 51 
51            val params = if #hasGlobals spec            val params = if #hasGlobals spec
52                  then CL.PARAM([], globTy, "glob") :: stateParams                  then CL.PARAM([], globTy, "glob") :: stateParams
53                  else stateParams                  else stateParams
54              val body = ??
55            in            in
56              CL.D_Func(["static"], methTy, methName, params, body)              CL.D_Func(["static"], methTy, methName, params, body)
57            end            end
# Line 49  Line 70 
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            in            in
73                genStateInit (spec, name, ??, stateInit) ::
74              genInitiallyMethod (spec, name, initM) @              genInitiallyMethod (spec, name, initM) @
75              genUpdateMethod (spec, name, updateM) ::              genUpdateMethod (spec, name, updateM) ::
76              genStabilizeMethod (spec, name, stabilizeM)              genStabilizeMethod (spec, name, stabilizeM)

Legend:
Removed from v.3865  
changed lines
  Added in v.3866

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