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/README
ViewVC logotype

Diff of /sml/trunk/src/system/README

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

revision 572, Thu Mar 9 02:43:06 2000 UTC revision 573, Thu Mar 9 15:23:52 2000 UTC
# Line 1  Line 1 
1  Compiler Hacker's Guide to the new CM...  Compiler Hacker's Guide to the new CM...
2  ========================================  ========================================
3    
4  Last change: 2/2000  Last change: 3/2000
5    
6  * Libraries  * Libraries
7  -----------  -----------
# Line 19  Line 19 
19  the compiler ("*" means that I consider the library potentially useful  the compiler ("*" means that I consider the library potentially useful
20  in its own right):  in its own right):
21    
22          * basis.cm      - The SML'97 basis library    * basis.cm                            SML'97 Basis Library (pre-loaded)
23          - cm-hook.cm    - an internal library for organizational purposes    * smlnj-lib.cm                        SML/NJ Utility Library
24          - cm-lib.cm     - the library that implements CM's functionality    * html-lib.cm                         SML/NJ HTML Library
25          * comp-lib.cm   - a helper library for the compiler, MLRISC, and CM    * pp-lib.cm                           SML/NJ Pretty-print Library
26          * full-cm.cm    - the library that exports the public interface to  
27                            the compilation manager (i.e., structure CM)    * ml-yacc-lib.cm                      SML/NJ ML-Yacc runtime library
28          * minimal-cm.cm - exports a reduced version of structure CM;  
29                            this one is pre-registered at the top level    * smlnj/compiler/{alpha32,hppa,ppc,sparc,x86}.cm
30          * host-cmb.cm   - the library that exports the public interface to                                          cross-compiler libraries, exporting
31                            the bootstrap compiler (i.e., structure CMB)                                          structure <Arch>Compiler
32          - host-compiler-0.cm    * smlnj/compiler/current.cm           structure Compiler (current arch)
33                          - an internal library for organizational purposes    * smlnj/compiler/all.cm               all cross-compilers and all cross-CMBs
34          * host-compiler.cm  
35                          - the library that exports the public interface to    * smlnj/cm/minimal.cm                 minimal CM (pre-loaded)
36                            the visible compiler (i.e., structure Compiler)    * smlnj/cm/full.cm                    full structure CM (see manual)
37          - intsys.cm     - an internal library for organizational purposes    * smlnj/cm/tools.cm                   CM tools library
38                            (In fact, its the "root" of the main hierarchy.)  
39          * ml-yacc-lib.cm - needs no further comment    * smlnj/cmb/{alpha32,hppa,ppc,sparc,x86}-unix.cm
40          * smlnj-lib.cm  - needs no further comment                                          cross-bootstrap-compilers for Unix
41          * <arch>-compiler.cm - exports the Compiler structure for the                                          (structure <Arch>UnixCMB)
42                             given architecture (<Arch>Compiler).    * smlnj/cmb/ppc-macos.cm              ...for Mac (structure PPCMacosCMB)
43          * <arch>-<os>.cm - exports <Arch><OS>CMB for the given architecture-    * smlnj/cmb/x86-win32.cm              ...for Windoze (structure X86Win32CMB)
44                             OS combination.    * smlnj/cmb/current.cm                structure CMB (current arch/os)
45          * target-compilers.cm  
46                          - library exporting target-specific versions of    * smlnj/compiler.cm                   abbrev. for smlnj/compiler/current.cm
47                            structure Compiler and of structure CMB.    * smlnj/cm.cm                         abbrev. for smlnj/cm/full.cm
48                            This is a summary of all the <arch>-compiler.cm    * smlnj/cmb.cm                        abbrev. for smlnj/cmb/current.cm
49                            and <arch>-<os>.cm libraries above.  
50                            (The existence of these libraries is the moral    * comp-lib.cm                         Utility library for compiler
51                             equivalent of "CMB.retarget" in the old CM.)  
52          * viscomp-core.cm - library that implements the machine-independent    - smlnj/viscomp/core.cm               Compiler core functionality
53                            core of the compiler.    - smlnj/viscomp/{alpha32,hppa,ppc,sparc,x86}.cm
54          * viscomp-<arch>.cm - library that implements the visible compiler                                          Machine-specific parts of compiler
55                             for a given architecture.  
56      - smlnj/internal/{intsys,cm-lib,cm-hook,host-compiler-0}.cm
57                                            Glue that holds the interactive system
58                                            together
59    
60      * MLRISC/{MLRISC,Control,Lib,ALPHA,HPPA,PPC,SPARC,IA32}.cm
61                                            Various MLRISC bits
62    
63      * {mlyacc,mllex,mlburg}-tool.cm       CM plug-in libraries for common tools
64      * {grm,lex,burg}-ext.cm               CM plug-in libraries for common file
65                                            extensions
66    
67  * Before you can use the bootstrap compiler (CMB)...  * Before you can use the bootstrap compiler (CMB)...
68  ----------------------------------------------------  ----------------------------------------------------
69    
70  To be able to use CMB at all, you must first say  To be able to use CMB at all, you must first say
71    
72          CM.autoload "host-cmb.cm";          CM.autoload "smlnj/cmb.cm";
73    
74  after you start sml.  Alternatively -- and perhaps more conveniently --  after you start sml.  Alternatively -- and perhaps more conveniently --
75  you can provide "host-cmb.cm" as a command-line argument to sml:  you can provide "host-cmb.cm" as a command-line argument to sml:
76    
77        $ sml host-cmb.cm        $ sml smlnj/cmb.cm
78    
79  * Compiling the compiler  * Compiling the compiler
80  ------------------------  ------------------------
# Line 179  Line 189 
189  * Cross-compiling  * Cross-compiling
190  -----------------  -----------------
191    
192  All cross-compilers live in the "target-compilers.cm" library.  You  All cross-compilers live in the "smlnj/compiler/all.cm" library.  You
193  must first say  must first say
194    
195          CM.autoload "target-compilers.cm";          CM.autoload "smlnj/compiler/all.cm";
196    
197  before you can access them.  (This step corresponds to the old  before you can access them.  (This step corresponds to the old
198  CMB.retarget call.)  After that, _all_ cross-compilers are available  CMB.retarget call.)  After that, _all_ cross-compilers are available
# Line 209  Line 219 
219  implementation of the basis library for the MacOS.)  implementation of the basis library for the MacOS.)
220    
221  Alternatively, you can select just the one single structure that you  Alternatively, you can select just the one single structure that you
222  are interested in by auto-loading <arch>-compiler.cm or <arch>-<os>.cm.  are interested in by auto-loading smlnj/compiler/<arch>.cm or
223    smlnj/cmb/<arch>-<os>.cm.
224  <arch> currently ranges over "alpha32", "hppa", "ppc", "sparc", and "x86.  <arch> currently ranges over "alpha32", "hppa", "ppc", "sparc", and "x86.
225  <os> can be either "unix" or "macos" or "win32".  <os> can be either "unix" or "macos" or "win32".
226  (Obviously, not all combinations are valid.)  (Obviously, not all combinations are valid.)
227    
228  Again, as with host-cmb.cm, you can specify the .cm file as an  Again, as with smlnj/cmb.cm, you can specify the .cm file as an
229  argument to the sml command:  argument to the sml command:
230    
231      $ sml target-compilers.cm      $ sml smlnj/compiler/all.cm
232    
233  or  or
234    
235      $ sml alpha32-unix.cm      $ sml smlnj/cmb/alpha32-unix.cm
236    
237  * Path configuration  * Path configuration
238  --------------------  --------------------
# Line 327  Line 338 
338    
339    mv <image>.<arch>-<osvariant> ../../bin/.heap/sml.<arch>-<osvariant>    mv <image>.<arch>-<osvariant> ../../bin/.heap/sml.<arch>-<osvariant>
340    
341  and then:  After this you must also move all libraries from <image>.libs/* to their
342    corresponding position in ../../lib.
343    
344    rm -r ../../lib/*.cm  Since this is cumbersome to do by hand, there is a script called
345    mv <image>.libs/*.cm ../../lib  "installml" that automates this task.  Using the script has the added
346    advantage that it will not clobber libraries that belong to other than
347  For convenience, there is a script called "installml" that automates  the current architecture.  (A rather heavy-handed "rm/mv" approach
348  this task.  Using the script has the added advantage that it will not  will delete all stable libraries for all architectures.)
349  clobber libraries that belong to other than the current architecture.  "installml" also patches the ../../lib/pathconfig file as necessary.
 (The rather heavy-handed "rm/mv" approach above will delete all stable  
 libraries for all architectures.)  "installml" also patches the  
 ../../lib/pathconfig file as necessary.  
350    
351  Of course, you can organize things differently for yourself -- the  Of course, you can organize things differently for yourself -- the
352  path configuration mechanism should be sufficiently flexible.  path configuration mechanism should be sufficiently flexible.
# Line 403  Line 412 
412  init group source files, but it still does use its regular cutoff  init group source files, but it still does use its regular cutoff
413  recompilation mechanism.  Therefore, dependencies must be given  recompilation mechanism.  Therefore, dependencies must be given
414  explicitly.  This is done by a special description file which  explicitly.  This is done by a special description file which
415  currently lives in Init/init.cmi.  See the long comment at the  currently lives in ../system/smlnj/init/init.cmi.  See the long comment
416  beginning of that file for more details.  at the beginning of that file for more details.
417    
418  After it is built, init.cmi can be used as an "ordinary" library by  After it is built, smlnj/init/init.cmi can be used as an "ordinary" library
419  other libraries.  (This is done, for example, by the implementation of  by other libraries.  (This is done, for example, by the implementation of
420  the Basis library.)  Access to "init.cmi" is protected by the  the Basis library.)  Access to "smlnj/init/init.cmi" is protected by the
421  privilege named "primitive".  Also, note that the .cmi-file is not  privilege named "primitive".  Also, note that the .cmi-file is not
422  automatically recognized as as CM description file.  Therefore, it  automatically recognized as as CM description file.  Therefore, it
423  must be given an explicit member class:  must be given an explicit member class:
424    
425       init.cmi : cm       smlnj/init/init.cmi : cm
426    
427  * Autoloader  * Autoloader
428  ------------  ------------
# Line 441  Line 450 
450  which can easily be made accessible via CM.autoload (or, non-lazily,  which can easily be made accessible via CM.autoload (or, non-lazily,
451  via CM.make):  via CM.make):
452    
453          full-cm.cm              - provides the actual ("full") structure CM          smlnj/cm.cm             - provides the actual ("full") structure CM
454                                    as described in the CM manual                                    as described in the CM manual
455          host-compiler.cm        - provides "structure Compiler"          smlnj/cm/full.cm        - same as smlnj/cm.cm
456          host-cmb.cm             - provides "structure CMB"          smlnj/compiler.cm       - provides "structure Compiler"
457          target-compilers.cm     - provides "structure <Arch>Compiler" and          smlnj/compiler/current.cm - same as smlnj/compiler.cm
458            smlnj/cmb.cm            - provides "structure CMB"
459            smlnj/cmb/current.cm    - same as smlnj/cmb.cm
460            smlnj/compiler/all.cm   - provides "structure <Arch>Compiler" and
461                                    "structure <Arch><OS>CMB" for various                                    "structure <Arch><OS>CMB" for various
462                                    values of <Arch> and <OS>                                    values of <Arch> and <OS>
463          smlnj-lib.cm            - the SML/NJ library          smlnj-lib.cm            - the SML/NJ library
# Line 552  Line 564 
564  without having to move large source trees at the same time. (See my  without having to move large source trees at the same time. (See my
565  new build/install.sh script for examples of that.)  new build/install.sh script for examples of that.)
566    
567    It is possible to simulate aliases (in a way that is safer than the
568    original alias mechanism).  For example, the root.cm file (which is the
569    root of the whole system as far as CMB.make is concerned) acts as an
570    alias for smlnj/internal/intsys.cm.  In this case, root.cm is a group
571    to avoid having a (trivial) stable library file built for it.
572    
573    A library can act as an "alias" for another library if it has a
574    verbatim copy of the export list and mentions the other library as its
575    only member.  Examples for this are smlnj/cm.cm (for smlnj/cm/full.cm),
576    smlnj/compiler.cm (for smlnj/compiler/current.cm), etc.
577    
578  * Don't use relative or absolute pathnames to refer to libraries  * Don't use relative or absolute pathnames to refer to libraries
579  ----------------------------------------------------------------  ----------------------------------------------------------------
580    

Legend:
Removed from v.572  
changed lines
  Added in v.573

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