Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/branches/SMLNJ/src/compiler/TopLevel/batch/binfile.sml
ViewVC logotype

Diff of /sml/branches/SMLNJ/src/compiler/TopLevel/batch/binfile.sml

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

revision 438, Wed Sep 15 16:37:27 1999 UTC revision 439, Wed Sep 15 16:37:27 1999 UTC
# Line 47  Line 47 
47      datatype bfContent =      datatype bfContent =
48          BFC of {          BFC of {
49                  imports: C.import list,                  imports: C.import list,
50                  hasExports: bool,                  exportPid: pid option,
51                  cmData: pid list,                  cmData: pid list,
52                  senv: senv pData,                  senv: senv pData,
53                  lambda: lambda option pData,                  lambda: lambda option pData,
# Line 56  Line 56 
56                 }                 }
57    
58      fun staticPidOf (BFC { senv = { pid, ... }, ... }) = pid      fun staticPidOf (BFC { senv = { pid, ... }, ... }) = pid
59      fun exportPidOf (bfc as BFC { hasExports, ... }) =      fun exportPidOf (bfc as BFC { exportPid, ... }) = exportPid
         if hasExports then SOME (staticPidOf bfc) else NONE  
60      fun lambdaPidOf (BFC { lambda = { pid, ... }, ... }) = pid      fun lambdaPidOf (BFC { lambda = { pid, ... }, ... }) = pid
61      fun cmDataOf (BFC { cmData, ... }) = cmData      fun cmDataOf (BFC { cmData, ... }) = cmData
62      fun senvOf (BFC { senv = { unpickled, ... }, ... }) = unpickled ()      fun senvOf (BFC { senv = { unpickled, ... }, ... }) = unpickled ()
63      fun symenvOf (bfc as BFC { senv, lambda, hasExports, ... }) =      fun symenvOf (bfc as BFC { senv, lambda, ... }) =
64          C.mksymenv (exportPidOf bfc, #unpickled lambda ())          C.mksymenv (exportPidOf bfc, #unpickled lambda ())
65    
66      local      local
# Line 413  Line 412 
412                  in                  in
413                      (mkSenv, penv)                      (mkSenv, penv)
414                  end                  end
             val hasExports = isSome exportPid  
415              fun pd (u, p, pk) = { unpickled = u, pid = p, pickled = pk }              fun pd (u, p, pk) = { unpickled = u, pid = p, pickled = pk }
416          in          in
417              BFC { imports = imports,              BFC { imports = imports,
418                    hasExports = hasExports,                    exportPid = exportPid,
419                    cmData = cmData,                    cmData = cmData,
420                    senv = pd (senv, staticPid, penv),                    senv = pd (senv, staticPid, penv),
421                    lambda = pd (lambda_i, lambdaPid, plambda),                    lambda = pd (lambda_i, lambdaPid, plambda),
# Line 436  Line 434 
434           * It calculates the number of bytes written by a corresponding           * It calculates the number of bytes written by a corresponding
435           * call to "write". *)           * call to "write". *)
436          fun size { content = bfc, nopickle } = let          fun size { content = bfc, nopickle } = let
437              val BFC { imports, hasExports, senv, cmData, lambda,  ... } = bfc              val BFC { imports, exportPid, senv, cmData, lambda,  ... } = bfc
438              val { unpickled = lut, pickled = lambdaP, ... } = lambda              val { unpickled = lut, pickled = lambdaP, ... } = lambda
439              val pidSz = Word8Vector.length (Pid.toBytes (#pid senv))              val pidSz = Word8Vector.length (Pid.toBytes (#pid senv))
440              val (_, picki) = pickleImports imports              val (_, picki) = pickleImports imports
441              val csegs = codeSegments bfc              val csegs = codeSegments bfc
442                val hasExports = isSome exportPid
443          in          in
444              magicBytes +              magicBytes +
445              9 * 4 +              9 * 4 +
# Line 455  Line 454 
454    
455          (* Keep this in sync with "size" (see above). *)          (* Keep this in sync with "size" (see above). *)
456          fun write { stream = s, content = bfc, nopickle } = let          fun write { stream = s, content = bfc, nopickle } = let
457              val BFC { imports, hasExports, cmData, senv, lambda, ... } = bfc              val BFC { imports, exportPid, cmData, senv, lambda, ... } = bfc
458              val { pickled = senvP, pid = staticPid, ... } = senv              val { pickled = senvP, pid = staticPid, ... } = senv
459              val { pickled = lambdaP, pid = lambdaPid, unpickled = lut } =              val { pickled = lambdaP, pid = lambdaPid, unpickled = lut } =
460                  lambda                  lambda
# Line 463  Line 462 
462              val envPids = staticPid :: lambdaPid :: cmData              val envPids = staticPid :: lambdaPid :: cmData
463              val (leni, picki) = pickleImports imports              val (leni, picki) = pickleImports imports
464              val importSzB = Word8Vector.length picki              val importSzB = Word8Vector.length picki
465              val (ne, epl) = if hasExports then (1, [staticPid]) else (0, [])              val (ne, epl) =
466                    case exportPid of
467                        NONE => (0, [])
468                      | SOME p => (1, [p])
469              val nei = length envPids              val nei = length envPids
470              val cmInfoSzB = nei * bytesPerPid              val cmInfoSzB = nei * bytesPerPid
471              val sa2 =              val sa2 =
# Line 517  Line 519 
519                              symenv=symenv, compInfo=cinfo, checkErr=check,                              symenv=symenv, compInfo=cinfo, checkErr=check,
520                              runtimePid=runtimePid, splitting=splitting}                              runtimePid=runtimePid, splitting=splitting}
521              val {hash = lambdaPid, pickle} = PickMod.pickleFLINT inlineExp              val {hash = lambdaPid, pickle} = PickMod.pickleFLINT inlineExp
             val hasExports = isSome exportPid  
522              fun pd (u, p, x) =              fun pd (u, p, x) =
523                  { unpickled = fn () => u, pid = p, pickled = x }                  { unpickled = fn () => u, pid = p, pickled = x }
524          in          in
525              BFC { imports = imports,              BFC { imports = imports,
526                    hasExports = hasExports,                    exportPid = exportPid,
527                    cmData = cmData,                    cmData = cmData,
528                    senv = pd (newstatenv, staticPid, envPickle),                    senv = pd (newstatenv, staticPid, envPickle),
529                    lambda = pd (inlineExp, lambdaPid, pickle),                    lambda = pd (inlineExp, lambdaPid, pickle),

Legend:
Removed from v.438  
changed lines
  Added in v.439

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