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

SCM Repository

[smlnj] Annotation of /sml/trunk/src/system/smlnj/init/init.cmi
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 573 - (view) (download)

1 : blume 573 #
2 :     # spec.cmi
3 :     #
4 :     # (C) 1999 Lucent Technologies, Bell Laboratories
5 :     #
6 :     # Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
7 :     #
8 :     # 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,
10 :     # to set up the core environment, and to build the pervasive environment.
11 :     # Because of its special nature, the init group cannot be described as
12 :     # an ordinary CM library. Instead, it is built from the DAG description
13 :     # in this file. The bootstrap compiler turns the init group into an
14 :     # ordinary stable group. The boot process fetches core and pervasive
15 :     # environment from that stable library.
16 :     #
17 :     # Besides core and pervasive environments, the init group can (and does)
18 :     # also export additional definitions. These can be accessed by client code
19 :     # (such as the implementation of the Basis library) by simply listing
20 :     # "init.cmi : cm" in their respective library description files. (Since CM
21 :     # does not automatically recognize the member class of ".cmi" files, the
22 :     # class "cm" must be given explicitly.) Clients who want to access "init.cmi"
23 :     # must be in possession of the privilege named "primitive".
24 :     #
25 :     # The specification is basically a DAG: "bind" statements define
26 :     # named environments which are the results of compiling the files on the
27 :     # right-hand side of "=" wrt. a combination of the environments given
28 :     # in parentheses.
29 :     #
30 :     # Format of this file:
31 :     # - The file is processed on a line-by-line basis.
32 :     # - Empty lines and lines beginning with "#" are ignored.
33 :     # - Actual whitespace, "=", ",", "(", and ")" are all counted as whitespace.
34 :     # (this means that the syntactic sugar you see below is really just
35 :     # sugar for the human eye; the program that processes this file can
36 :     # do without it)
37 :     # - A line that says "nosplit" disables cross-module inlining (aka
38 :     # "lambda-splitting") until the next line that says "split".
39 :     # - The (single) "rts-placeholder" line acts mostly like a "bind" line.
40 :     # Its purpose is to specify the module that plays the role of a
41 :     # placeholder for the runtime system.
42 :     # - "bind" lines (and the "rts-placeholder" line) must be in topological
43 :     # order (i.e., they cannot access environment names that are being
44 :     # defined later).
45 :     # - The last line that gets processed is the "return" line.
46 :     # It must specify at least two environment names in this order:
47 :     # * the one that is used as the system-wide "core" environment
48 :     # * the one that is used as the system-wide "pervasive" environment
49 :     # For any additional name n the exports of the module that was bound
50 :     # (by "bind") to n are added to the exports of the init group.
51 :     # These exports can be accessed by clients that explicitly list init.cmi
52 :     # in their own description files.
53 :     # Note: Since some clients need direct access to the core environment,
54 :     # the name "core" is listed twice: one time in its usual place, one time
55 :     # to have it exported from init.cmi.
56 :     # - There is one pre-defined name ("primitive") that refers to the
57 :     # Environment.primEnv. It must not be "exported" by the "return" line.
58 :     #
59 :     # There is a side-condition on the core environment:
60 :     # CM will first compile just the minimal required number of files that is
61 :     # sufficient for getting hold of the core environment. Naturally, these
62 :     # files are compiled _without_ access to core and, therefore, cannot make
63 :     # use of any language feature that lets the compiler try and access the core.
64 :     # As soon as core is available, all remaining files are compiled using that
65 :     # core, though.
66 :    
67 :     #### END OF EXPLANATION, SPEC STARTS HERE...
68 :    
69 :     # Turn off splitting. It would confuse the compiler because the following
70 :     # files are not actually loaded at boot time.
71 :     nosplit
72 :    
73 :     # The "signature" of the runtime system:
74 :     bind asig = assembly.sig (primitive)
75 :    
76 :     # The placeholder for the runtime system:
77 :     rts-placeholder rts = dummy.sml (asig, primitive)
78 :    
79 :     # We can now turn the cross-module optimizer on (when available)...
80 :     split
81 :    
82 :     # This defines the core environment to be used everywhere else...
83 :     bind core = core.sml (rts, asig, primitive)
84 :    
85 :     # The rest of the DAG...
86 :     bind built-in = built-in.sml (core, primitive)
87 :     bind pp = pre-perv.sml (built-in)
88 :     bind ps = pre-string.sml (core, built-in, pp)
89 :     bind ss-sig = substring.sig (pp, built-in)
90 :     bind ss = substring.sml (ss-sig, pp, ps, core, built-in)
91 :     bind print-hook = print-hook.sml (built-in)
92 :     bind use-hook = use-hook.sml (built-in)
93 :     bind exn-info-hook = exn-info-hook.sml (built-in)
94 :     bind init-utils = init-utils.sml (ps ss-sig ss)
95 :    
96 :     # Building the "pervasive" environment. This file should be
97 :     # kept as small as possible and only bind non-modular things
98 :     # (i.e., top-level types and values).
99 :     bind pervasive = pervasive.sml (core, ps, ss, pp, print-hook, use-hook, exn-info-hook, built-in)
100 :    
101 :     # Report the results to the world...
102 :     return (core, pervasive) built-in print-hook use-hook exn-info-hook core init-utils

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