New changes (since 10/25):

   tuned Cprim.c
   added -fomit-frame-pointer flag to gcc flags
   remove Config.mo for CompC.mos

----------

List of changes and additions to the runtime system for sml2c and
sun4's running Mach.

For sml2c:

The major change to the existing runtime system was to make labels
for closures built in the assembly language files point to their tags 
instead of their first elements (that is, the first field
of the closure).  I did this because I can't build labels which point
into the middle of a structure or an array in C.

Changed allmo.c: datalist now points to the tag for its record instead
	         of the first element of the record.

Added Cprim.c: implements primitives in C, not assembly language.
Uses the C math library.

Added CompC.mos: for linkdata

Added C.dep.c: "machine" dependency file for C machine

Changed cfuns.c: Added include for "prim.h", changed references to
	         callc_v.

Changed cstruct.c: Added include for prim.h, changed references
	           to closure labels and datalist to add 1.  Also, constructs
	           record for math structure for C machine in addition to
	           M68000.

Changed exncode.c: Bug fix for runtime on MIPS under Mach, not related
	           to any of the sml2c changes.  Mach maps the code
	           passed to signal handlers for floating point exceptions
	           and integer overflow to the corresponding BSD codes.
	           The machine-specific code for the MIPS in exncode.c
	           isn't needed for Mach

Changed export.c: Disabled export for sml2c for unknown machines; nothing
	          happens when it is called in that case.

Changed linkdata.c: datalist now points to the tag for its record, instead
	            of the first element of its record.

Changed Makefile: added features to make the library (libsml2c.a) with which
	          to link sml2c programs

Changed ml_state.h: Added macros defining layout of the ML state vector 
	            for a "C" machine.

Added prim.h.  It describes the types of everything
defined in the *.prim.s and Cprim.c files.

Changed request.h: Added REQ_RUN.

Changed run.c: Added include for prim.h, changed reference to datalist.
	       Does not expect the name of a function to run for
	       the "C" machine -- the Loader structure for C runs
	       everything in the datalist.  The "C" machine, like the
	       M68000, uses a predefined math structure.

Changed run_ml.c: Added request: REQ_RUN, moved restore_regs to
	          bottom of loop, added code for C to use setjmp
	          to get to top of loop, added include for "prim.h",
	          added include for <setjmp.h>, changed uses of
	          primitive functions to use macros.

Changed signal.c: We adjust a pseudo-limit pointer (in a variable
called plimit) for C.  This allows John's stuff to work with sml2c.
Added include for prim.h, removed declaration of the type of
sigh_resume in this file.

Changed M68.prim.s, VAX.prim.s, SPARC.prim.s, MIPS.prim.s, NS32.prim.s:
Labels for closures point to the tag intead of the first element of the
closure.

Changed makeml: Deleted the code which tries to automatically determine
the machine were running on.  We don't want this happening when trying
to build a runtime for sml2c programs.

Added two options: -sml2c is like -debug, in that it builds a different
version of the compiler (the sml2c version) for an existing machine.
The -c {os} {known machine} option is a machine similar to the current ones.
These options are described in the documentation on sml2c.  It only builds the
library with which one should link the code generated by sml2c.  I didn't add
any error checking to see if this was being used with incompatible options.
----------------------
For sun4's running Mach:

[These changes were contributed by Eric Cooper (ecc@cs.cmu.edu.  Some of these
may eventually be changed in Sun4 Mach, which is still
being alpha tested.  Take them with a grain of salt.]

makeml:
"cc -n"  produces broken binaries on Sun4 Mach; using the default
(ZMAGIC) works fine, and gives much better performance, since the binary
is demand loaded.

SPARC.prim.s, SPARC.dep.c, exncode.c:
ST_INT_OVERFLOW is not defined in the Mach trap.h file.  Mapping from
UNIX signal + subcode to exceptions had to be fixed.  Need SIGILL
handler for integer overflow.

export.c:
The format of an a.out file is different; export didn't work.

Fix:

diff -c old/SPARC.dep.c new/SPARC.dep.c
*** old/SPARC.dep.c	Mon May 28 16:42:17 1990
--- new/SPARC.dep.c	Wed Aug 22 13:57:41 1990
***************
*** 97,102 ****
--- 97,103 ----
  {
      SETSIG (SIGEMT, ghandle, mask);
      SETSIG (SIGFPE, fpe_handler, mask);
+     SETSIG (SIGILL, fpe_handler, mask);
  
      set_fsr (0x0f000000); /* enable FP exceptions NV, OF, UF & DZ */
  }
diff -c old/SPARC.prim.s new/SPARC.prim.s
*** old/SPARC.prim.s	Sat Sep  8 15:56:19 1990
--- new/SPARC.prim.s	Tue Sep 11 15:43:29 1990
***************
*** 72,77 ****
--- 72,81 ----
  #include "tags.h"
  #include "request.h"
  
+ #ifdef	MACH
+ #define	ST_INT_OVERFLOW		0x07
+ #endif	MACH
+ 
  /* Macros to fetch and store values in memory; use %o3 as an
addressing register. */
  #define FETCH(addr, reg)			\
  	    sethi   %hi(addr),%o3;		\
diff -c old/exncode.c new/exncode.c
*** old/exncode.c	Wed Aug 22 09:29:01 1990
--- new/exncode.c	Tue Aug 28 10:56:17 1990
***************
*** 94,99 ****
--- 94,102 ----
  #ifdef K_FLTOVF
  	  case K_FLTOVF:
  #endif
+ #if	defined(SPARC) && defined(MACH)
+ 	  case 0x8:
+ #endif	defined(SPARC) && defined(MACH)
  	    fault_exn = PTR_CtoML(overflow_e0+1);
  	    return;
  #ifdef CODE_ZERODIV
***************
*** 117,122 ****
--- 120,128 ----
  #ifdef K_FLTDIV
  	  case K_FLTDIV:
  #endif
+ #if	defined(SPARC) && defined(MACH)
+ 	  case 0x82:
+ #endif	defined(SPARC) && defined(MACH)
  	    fault_exn = PTR_CtoML(div_e0+1);
  	    return;
  #ifdef CODE_FLTUND
***************
*** 149,154 ****
--- 155,168 ----
  	else
  	    die ("exnCode: code was %d\n",code);
  #endif HPUX
+ #if	defined(SPARC) && defined(MACH)
+       case SIGILL:
+ 	if (code == 0x87) {
+ 	    fault_exn = PTR_CtoML(overflow_e0+1);
+ 	    return;
+ 	} else
+ 	    die ("SIGILL code 0x%x\n", code);
+ #endif	defined(SPARC) && defined(MACH)
  
  #ifdef MIPS
        case SIGTRAP:
diff -c old/export.c new/export.c
*** old/export.c	Tue Jul  3 16:02:26 1990
--- new/export.c	Wed Aug 22 14:57:23 1990
***************
*** 118,124 ****
      E.a_magic.file_type = ZMAGIC;
      E.a_magic.system_id = HP9000S200_ID;
  #else
! #if defined(sun3) || defined(SPARC)
      E.a_magic = NMAGIC;
  #else
  #  if defined(NS32)
--- 118,124 ----
      E.a_magic.file_type = ZMAGIC;
      E.a_magic.system_id = HP9000S200_ID;
  #else
! #if defined(sun3) || (defined(SPARC) && !defined(MACH))
      E.a_magic = NMAGIC;
  #else
  #  if defined(NS32)
***************
*** 149,155 ****
--- 149,159 ----
      E.a_text = (int)
CEIL(((int)&etext+textstart),getpagesize())-textstart;
  #else
      E.a_text = (int) CEIL(((int)&etext),getpagesize())-textstart;
+ #if defined(SPARC) && defined(MACH)
+     datastart = (int) CEIL(((int)&etext),getpagesize());
+ #else
      datastart = N_DATADDR(E);
+ #endif !defined(SPARC) || !defined(MACH)
      E.a_bss = 0;
  #ifndef NS32
      E.a_syms = 0;
***************
*** 191,197 ****
--- 195,205 ----
      lseek(filid,N_DATADDR(E),0);
      bulletproofWrite(filid,CEIL((int)&etext,getpagesize()),E.a_data);
  #else
+ #if defined(SPARC) && defined(MACH)
+     bulletproofWrite(filid,textstart+sizeof(E),E.a_text-sizeof(E));
+ #else
      bulletproofWrite(filid,textstart,E.a_text);
+ #endif !defined(SPARC) || !defined(MACH)
      bulletproofWrite(filid,datastart,E.a_data);
  #endif HPUX
  }
diff -c old/makeml new/makeml
*** old/makeml	Wed Aug 22 10:29:31 1990
--- new/makeml	Tue Aug 28 10:49:21 1990
***************
*** 313,319 ****
      ;;
      SPARC)
  	DEFS="$DEFS -DBSD -Dsun4"
! 	CFL="-n"
  	MO=${MO-"../mo.sparc"}
  	MODULE="$MODULEKIND"Sparc"$DEBUG"
      ;;
--- 313,322 ----
      ;;
      SPARC)
  	DEFS="$DEFS -DBSD -Dsun4"
! 	if [ $OPSYS = SUNOS ]
! 	then
! 		CFL="-n"
! 	fi
  	MO=${MO-"../mo.sparc"}
  	MODULE="$MODULEKIND"Sparc"$DEBUG"
      ;;
