Rebuilding Moscow ML to Avoid the Chr Exception

With the standard Moscow ML (version 2.01), and large HOL theories it is possible to overload Moscow ML’s internal table of global constants. Luckily, Peter Sestoft provided us with a patch to make this table much bigger. Here are the instructions (slightly updated by Peter Homeier) on how to apply it.

  1. Make a backup of your old mosml installation
  2. Before unpacking the attached, make a build of mosml 2.01:

    In mosml/src/ do

            make clean world
    
  3. Unpack the attached:

    In mosml/src/ do

            tar xvfz mosml-patch.tgz
    
  4. Recompile the compiler to generate the new bytecode:

    In mosml/src/compiler do

            touch Patch.sml Reloc.sml
            make all
    
  5. Promote the compiler:

    In mosml/src/compiler do

            mv mosmllnk mosmlcmp ..
    

    (I believe mosmllnk is unchanged, but promote for good measure)

  6. Generate new bytecode for libraries, compiler and lexer by recompiling:

    In mosml/src/mosmllib do

            make clean all
    

    In mosml/src/compiler do

            make clean all
    

    In mosml/src/lex do

            make clean all
    
  7. Recompile the runtime:

    In mosml/src/runtime do

            touch expand.c fix_code.c interp.c
            make all
    
  8. Promote the runtime, compiler and lexer:

    In mosml/src/runtime do

            mv camlrunm ..
    

    In mosml/src/compiler do

            mv mosmllnk mosmlcmp ..
    

    In mosml/src/lex do

            mv mosmllex ..
    
  9. Check that the top-level works:

    In mosml/src do

            ./camlrunm compiler/mosmltop -stdlib mosmllib
    

    and evaluate some expressions.

  10. Rebuild everything to check that the system is stable:

    In mosml/src do

            make clean world
    

    Check that

            src/mosmlcmp = src/compiler/mosmlcmp
            src/mosmllnk = src/compiler/mosmllnk
            src/mosmllex = src/lex/mosmllex
    
  11. Install

    In mosml/src do

            make install
    
  12. Check that HOL builds. (You will need to do a bin/build cleanAll to begin.)

Time-stamp: "Thursday, 16 July 2009; 00:47 UTC (Michael Norrish)"