[MLton] cvs commit: world no longer contains a preprocessed basis library

sweeks@mlton.org sweeks@mlton.org
Fri, 14 Nov 2003 16:16:32 -0800


sweeks      03/11/14 16:16:32

  Modified:    .        Makefile
               mlton/main compile.sig main.fun
  Log:
  Moved the preprocessed basis library out of world.mlton (but not out
  of the SML/NJ heap).  I did this because the world is starting to get
  really huge with all of the type information and with the multiple
  bases.  It's currently at about 25M.  Even with compression, it's
  getting annoying having that in the package.
  
  With all the basis library processing, compiling an empty file now
  takes about 3.5 seconds on my 1.6 GHz machine, which I think is
  livable.
  
  In addition to making our binary packages much smaller, the even more
  important advantage is that binary packages will now contain the basis
  library SML source code.  So, it encourages people to look at it, and
  allows people to easily fix bugs or make improvements.  It is also the
  next step towards providing lots of other library sources in our
  packages.
  
  I would like to provide support for preprocessing and caching prefixes
  of programs, but in a more general way that allows users to build a
  world for any prefix, not just the basis library.  If any one else
  wants to give this a try, it should be a pretty simple project that
  will provide a nice feature.  Anyways, speak up on this list and we
  can discuss designs.
  
  Unfortunately, the change to main.fun in this checkin tickles a
  long-latent bug in the SSA shrinker, which means that 20030716 fails
  to compile this version of MLton.  I have checked in a fix which means
  that this version of MLton can compile itself, but if you have any
  earlier version before todays checkin, you will have problems.  The
  way I worked around this was to compile a version of MLton with just
  the SSA fix, and then to use that to compile this version.  A bit
  messy.  I'm not sure what I'm gonna do to allow us to build on all our
  platforms, which typically requires an older MLton to compile the
  current one.

Revision  Changes    Path
1.98      +4 -3      mlton/Makefile

Index: Makefile
===================================================================
RCS file: /cvsroot/mlton/mlton/Makefile,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -r1.97 -r1.98
--- Makefile	24 Sep 2003 17:54:01 -0000	1.97
+++ Makefile	15 Nov 2003 00:16:32 -0000	1.98
@@ -106,7 +106,7 @@
 
 .PHONY: dirs
 dirs:
-	mkdir -p $(BIN) $(LIB)/$(TARGET) $(LIB)/include
+	mkdir -p $(BIN) $(LIB)/sml $(LIB)/$(TARGET) $(LIB)/include
 
 .PHONY: docs
 docs:
@@ -203,8 +203,9 @@
 
 .PHONY: world
 world: 
-	@echo 'Processing basis library.'
-	$(LIB)/$(AOUT) @MLton -- $(SRC)/basis-library $(LIB)/world
+	@echo 'Making world.'
+	$(CP) $(SRC)/basis-library $(LIB)/sml
+	$(LIB)/$(AOUT) @MLton -- $(LIB)/world.mlton
 
 # The TBIN and TLIB are where the files are going to be after installing.
 # The DESTDIR and is added onto them to indicate where the Makefile actually



1.11      +1 -0      mlton/mlton/main/compile.sig

Index: compile.sig
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/main/compile.sig,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- compile.sig	10 Oct 2003 20:07:38 -0000	1.10
+++ compile.sig	15 Nov 2003 00:16:32 -0000	1.11
@@ -26,5 +26,6 @@
       val layoutBasisLibrary: unit -> Layout.t
       (* output a C file to print out the basis constants. *)
       val outputBasisConstants: Out.t -> unit
+      val setBasisLibraryDir: Dir.t -> unit
       val typeCheck: {input: File.t list} -> unit
    end



1.7       +16 -2     mlton/mlton/main/main.fun

Index: main.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/main/main.fun,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- main.fun	7 Nov 2003 00:21:29 -0000	1.6
+++ main.fun	15 Nov 2003 00:16:32 -0000	1.7
@@ -394,7 +394,10 @@
       open Control
       val args =
 	 case args of
-	    lib :: args => (libDir := lib; args)
+	    lib :: args =>
+	       (libDir := lib
+		; Compile.setBasisLibraryDir (concat [lib, "/sml/basis-library"])
+		; args)
 	  | _ => Error.bug "incorrect args from shell script"
       val _ = setTargetType ("self", usage)
       val result = parse args
@@ -789,7 +792,18 @@
    
 fun exportMLton (): unit =
    case CommandLine.arguments () of
-      [root, file] => exportNJ (root, file)
+      [worldFile] =>
+	 let
+	    datatype z = datatype MLton.World.status
+	 in
+	    OS.Process.exit
+	    (case MLton.World.save worldFile of
+		Clone =>
+		   (commandLine (CommandLine.arguments ())
+		    handle _ => OS.Process.failure)
+	     | Original =>
+		  OS.Process.success)
+	 end
     | _ => Error.bug "usage: exportMLton root file"
 
 end