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

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/c-target/c-target.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/c-target/c-target.sml

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

revision 2065, Thu Nov 1 03:05:08 2012 UTC revision 2066, Fri Nov 2 12:58:14 2012 UTC
# Line 229  Line 229 
229          fun init (Prog{tgt, topDecls, ...}, init) = let          fun init (Prog{tgt, topDecls, ...}, init) = let
230                val worldTy = CL.T_Ptr(CL.T_Named(N.worldTy tgt))                val worldTy = CL.T_Ptr(CL.T_Named(N.worldTy tgt))
231                val globTy = CL.T_Ptr(CL.T_Named(N.globalTy tgt))                val globTy = CL.T_Ptr(CL.T_Named(N.globalTy tgt))
232                val init = CL.mkBlock(                val wrldV = CL.mkVar "wrld"
233                      CL.mkDeclInit(globTy, "glob", CL.mkIndirect(CL.mkVar "wrld", "globals")) ::              (* the body of the global initializtion code *)
234                      CL.unBlock init @ [CL.mkReturn(SOME(CL.mkVar "false"))])                val initStms =
235                        CL.mkDeclInit(globTy, "glob", CL.mkIndirect(wrldV, "globals")) ::
236                        CL.unBlock init @ [CL.mkReturn(SOME(CL.mkVar "false"))]
237                (* for libraries, we need to make sure that the inputs are initialized *)
238                  val initStms = if not(#exec tgt)
239                        then CL.mkIfThen(
240                          CL.mkApply(N.checkDefined tgt, [wrldV]),
241                          CL.mkReturn(SOME(CL.mkBool true))) :: initStms
242                        else initStms
243                val initFn = CL.D_Func(                val initFn = CL.D_Func(
244                      ["static"], CL.boolTy, N.initGlobals,                      ["static"], CL.boolTy, N.initGlobals,
245                      [CL.PARAM([], worldTy, "wrld")],                      [CL.PARAM([], worldTy, "wrld")],
246                      init)                      CL.mkBlock initStms)
247                in                in
248                  topDecls := initFn :: !topDecls                  topDecls := initFn :: !topDecls
249                end                end
# Line 459  Line 467 
467                  ppDecl (GenInputs.genDefinedInpStruct (tgt, !inputs));                  ppDecl (GenInputs.genDefinedInpStruct (tgt, !inputs));
468                  ppDecl (genGlobalStruct (tgt, List.rev(!globals)));                  ppDecl (genGlobalStruct (tgt, List.rev(!globals)));
469                  ppDecl (genWorldStruct(tgt, strand));                  ppDecl (genWorldStruct(tgt, strand));
                 List.app ppDecl (List.rev (!topDecls));  
470                  List.app ppDecl (GenInputs.genInputFuns(tgt, !inputs));                  List.app ppDecl (GenInputs.genInputFuns(tgt, !inputs));
471                    List.app ppDecl (List.rev (!topDecls));
472                  List.app ppDecl (genStrand strand);                  List.app ppDecl (genStrand strand);
473                  List.app ppDecl outputs;                  List.app ppDecl outputs;
474                  ppStrandTable (ppStrm, [strand]);                  ppStrandTable (ppStrm, [strand]);

Legend:
Removed from v.2065  
changed lines
  Added in v.2066

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