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/trunk/src/system/smlnj/init/init.cmi
ViewVC logotype

Diff of /sml/trunk/src/system/smlnj/init/init.cmi

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

revision 591, Mon Apr 3 01:19:20 2000 UTC revision 592, Mon Apr 3 07:04:12 2000 UTC
# Line 1  Line 1 
1  #  #
2  # spec.cmi  # spec.cmi
3  #  #
4  #  (C) 1999 Lucent Technologies, Bell Laboratories  #  (C) 2000 Lucent Technologies, Bell Laboratories
5  #  #
6  # Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)  # Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
7  #  #
8  # This is the specification for how to build the "init group".  # This is the specification for how to build the "init group".
9  # The main purpose of the init group is to tie in the runtime system,  # The main purpose of the init group is to tie in the runtime system
10  # to set up the core environment, and to build the pervasive environment.  # and to build the pervasive environment.  The pervasive enviroment
11    # must contain a binding of the "special" structure named "_Core".
12  # Because of its special nature, the init group cannot be described as  # Because of its special nature, the init group cannot be described as
13  # an ordinary CM library.  Instead, it is built from the DAG description  # an ordinary CM library.  Instead, it is built from the DAG description
14  # in this file.  The bootstrap compiler turns the init group into an  # in this file.  The bootstrap compiler turns the init group into an
15  # ordinary stable group.  The boot process fetches core and pervasive  # ordinary stable group.  The boot process fetches the pervasive
16  # environment from that stable library.  # environment from that stable library.
17  #  #
18  # Besides core and pervasive environments, the init group can (and does)  # In addition to the pervasive environments, the init group can (and does)
19  # also export additional definitions.  These can be accessed by client code  # also export additional definitions.  These can be accessed by client code
20  # (such as the implementation of the Basis library) by simply listing  # (such as the implementation of the Basis library) by simply listing
21  # "init.cmi : cm" in their respective library description files.  (Since CM  # "init.cmi : cm" in their respective library description files.  (Since CM
# Line 39  Line 40 
40  #  - The (single) "rts-placeholder" line acts mostly like a "bind" line.  #  - The (single) "rts-placeholder" line acts mostly like a "bind" line.
41  #    Its purpose is to specify the module that plays the role of a  #    Its purpose is to specify the module that plays the role of a
42  #    placeholder for the runtime system.  #    placeholder for the runtime system.
43  #  - "bind" lines (and the "rts-placeholder" line) must be in topological  #  - A "bind-core" line acts like a "bind" line, but it has an additional
44  #    order (i.e., they cannot access environment names that are being  #    first argument which must be the name of a structure bound at top-level
45  #    defined later).  #    by the named .sml file.  CM replaces these bindings by corresponding
46    #    bindings of the internal structure symbol "_Core".
47    #  - "bind" lines (as well as "bind-core" lines and the "rts-placeholder"
48    #    line) must be in topological order (i.e., they cannot access environment
49    #    names that are being defined later).
50  #  - The last line that gets processed is the "return" line.  #  - The last line that gets processed is the "return" line.
51  #    It must specify at least two environment names in this order:  #    It must specify at least one environment name, namely the one that is
52  #      * the one that is used as the system-wide "core" environment  #    used as the system-wide "pervasive" environment.
 #      * the one that is used as the system-wide "pervasive" environment  
53  #    For any additional name n the exports of the module that was bound  #    For any additional name n the exports of the module that was bound
54  #    (by "bind") to n are added to the exports of the init group.  #    (by "bind") to n are added to the exports of the init group.
55  #    These exports can be accessed by clients that explicitly list init.cmi  #    These exports can be accessed by clients that explicitly list init.cmi
56  #    in their own description files.  #    in their own description files.
57  #    Note: Since some clients need direct access to the core environment,  #    Note: Since some clients need direct access to the core environment,
58  #    the name "core" is listed twice: one time in its usual place, one time  #    the name "core" is also listed.  This "core" (as opposed to "xcore"
59  #    to have it exported from init.cmi.  #    has a binding for structure "Core" which can be accessed directly
60    #    from SML source code.)
61  #  - There is one pre-defined name ("primitive") that refers to the  #  - There is one pre-defined name ("primitive") that refers to the
62  #    Environment.primEnv.  It must not be "exported" by the "return" line.  #    Environment.primEnv.  It must not be "exported" by the "return" line.
63  #  #
64  # There is a side-condition on the core environment:  # Note that a binding for structure _Core is necessary ALMOST EVERYWHERE.
65  # CM will first compile just the minimal required number of files that is  # Therefore, it is necessary that the pervasive environment has such a
66  # sufficient for getting hold of the core environment.  Naturally, these  # binding.  For files of this initial group (which do not yet have the
67  # files are compiled _without_ access to core and, therefore, cannot make  # benefit of being able to access the pervasive environment), a trivial
68  # use of any language feature that lets the compiler try and access the core.  # member "xcore" is used to supply _Core.
 # As soon as core is available, all remaining files are compiled using that  
 # core, though.  
69    
70  #### END OF EXPLANATION, SPEC STARTS HERE...  #### END OF EXPLANATION, SPEC STARTS HERE...
71    
# Line 70  Line 73 
73  # files are not actually loaded at boot time.  # files are not actually loaded at boot time.
74  nosplit  nosplit
75    
76  # The "signature" of the runtime system:  # The "signature" of the runtime system.  (No _Core yet.)
77  bind asig = assembly.sig (primitive)  bind asig = assembly.sig (primitive)
78    
79  # The placeholder for the runtime system:  # The placeholder for the runtime system. (No _Core yet.)
80  rts-placeholder rts = dummy.sml (asig, primitive)  rts-placeholder rts = dummy.sml (asig, primitive)
81    
82  # We can now turn the cross-module optimizer on (when available)...  # We can now turn the cross-module optimizer on (when available)...
83  split  split
84    
85  # This defines the core environment to be used everywhere else...  # This defines the core environment to be used everywhere else...
86    # (This binds the structure symbol "Core", which is not yet the one that
87    # is used implicitly by the compiler.  Of course, "core.sml" itself cannot
88    # yet have access to _Core.)
89  bind core = core.sml (rts, asig, primitive)  bind core = core.sml (rts, asig, primitive)
90    
91    # Now we make the binding for structure _Core for use by the remaining
92    # members of the init group. (Everybody else in the world gets access to
93    # _Core via the pervasive env.)
94    # The "bind-core" line says that its first argument ("xCore") should be
95    # re-written as "_Core" before compilation. This rewriting is done
96    # internally after the parser has already completed. Normally, there is
97    # no way of referring explicitly to a structure named _Core.
98    bind-core (xCore) xcore = xcore.sml (core)
99    
100  # The rest of the DAG...  # The rest of the DAG...
101  bind built-in = built-in.sml (core, primitive)  # (Everybody implicitly depends on xcore to have access to _Core.)
102  bind pp = pre-perv.sml (built-in)  bind built-in = built-in.sml (core, primitive, xcore)
103  bind ps = pre-string.sml (core, built-in, pp)  bind pp = pre-perv.sml (built-in, xcore)
104  bind ss-sig = substring.sig (pp, built-in)  bind ps = pre-string.sml (core, built-in, pp, xcore)
105  bind ss = substring.sml (ss-sig, pp, ps, core, built-in)  bind ss-sig = substring.sig (pp, built-in, xcore)
106  bind print-hook = print-hook.sml (built-in)  bind ss = substring.sml (ss-sig, pp, ps, core, built-in, xcore)
107  bind use-hook = use-hook.sml (built-in)  bind print-hook = print-hook.sml (built-in, xcore)
108  bind exn-info-hook = exn-info-hook.sml (built-in)  bind use-hook = use-hook.sml (built-in, xcore)
109  bind init-utils = init-utils.sml (ps ss-sig ss)  bind exn-info-hook = exn-info-hook.sml (built-in, xcore)
110    bind init-utils = init-utils.sml (ps ss-sig ss, xcore)
111    
112  # Building the "pervasive" environment.  This file should be  # Building the "pervasive" environment.  This file should be
113  # kept as small as possible and only bind non-modular things  # kept as small as possible and only bind non-modular things
114  # (i.e., top-level types and values).  # (i.e., top-level types and values).
115  bind pervasive = pervasive.sml (core, ps, ss, pp, print-hook, use-hook, exn-info-hook, built-in)  # Make sure everybody else in the world gets access to structure _Core...
116    bind-core (xCore) pervasive = pervasive.sml (core, ps, ss, pp, print-hook, use-hook, exn-info-hook, built-in, xcore)
117    
118  # Report the results to the world...  # Report the results to the world...
119  return (core, pervasive) built-in print-hook use-hook exn-info-hook core init-utils  return (pervasive) built-in print-hook use-hook exn-info-hook core init-utils

Legend:
Removed from v.591  
changed lines
  Added in v.592

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