From: Taylor R Campbell <campbell@mumble.net>
Date: Tue, 11 Dec 2018 15:44:19 +0000 (+0000)
Subject: Split svm1 into four architectures: svm1 x {32,64} x {be,le}.
X-Git-Tag: mit-scheme-pucked-10.1.9~3^2~35^2~43
X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=a520063ade2630dfef5255fe2d586e568975468f;p=mit-scheme.git

Split svm1 into four architectures: svm1 x {32,64} x {be,le}.

--with-cross-target must specify exactly which one to use for now.

--enable-native-code=svm1 or svm1-le or svm1-64 will fill in the
remaining parameters (word size, byte order) from the host system
characteristics.
---

diff --git a/src/compiler/base/fasdump.scm b/src/compiler/base/fasdump.scm
index e4228902d..700c49d4b 100644
--- a/src/compiler/base/fasdump.scm
+++ b/src/compiler/base/fasdump.scm
@@ -223,6 +223,11 @@ USA.
 (define fasl-format:aarch64le (make-std64le-fasl-format 25))
 (define fasl-format:aarch64be (make-std64be-fasl-format 25))
 
+(define fasl-format:svm1-32be (make-std32be-fasl-format 26))
+(define fasl-format:svm1-32le (make-std32le-fasl-format 27))
+(define fasl-format:svm1-64be (make-std64be-fasl-format 28))
+(define fasl-format:svm1-64le (make-std64le-fasl-format 29))
+
 #;
 (define fasl-format:pdp10
   (make-fasl-format
diff --git a/src/compiler/choose-machine.sh b/src/compiler/choose-machine.sh
index 051886040..b2c372786 100755
--- a/src/compiler/choose-machine.sh
+++ b/src/compiler/choose-machine.sh
@@ -36,10 +36,11 @@ if test x"${TARGET_ARCH}" = xc; then
     exit 0
 fi
 
-if test x"${TARGET_ARCH}" = xsvm1; then
+case ${TARGET_ARCH} in
+svm1-32be|svm1-32le|svm1-64be|svm1-64le)
     echo svm
     exit 0
-fi
+esac
 
 if test -d "${HERE}/machines/${TARGET_ARCH}"; then
     echo "${TARGET_ARCH}"
diff --git a/src/compiler/configure b/src/compiler/configure
index 169bc1a6e..2bb703755 100755
--- a/src/compiler/configure
+++ b/src/compiler/configure
@@ -55,3 +55,22 @@ for FN in ${LINKS}; do
     CMDS="rm -f ${FN} && ln -s machine/${FN} ${FN}"
     echo "${CMDS}"; eval "${CMDS}"
 done
+
+case ${TARGET_ARCH} in
+svm1-32be|svm1-32le)
+    ln -sf wordsize-32.scm machine/wordsize.scm
+    ;;
+svm1-64be|svm1-64le)
+    ln -sf wordsize-64.scm machine/wordsize.scm
+    ;;
+esac
+
+case ${TARGET_ARCH} in
+svm1-32be|svm1-64be)
+    ln -sf big-endian.scm machine/endian.scm
+    ;;
+svm1-32le|svm1-64le)
+    ln -sf little-endian.scm machine/endian.scm
+    ;;
+esac
+
diff --git a/src/compiler/machines/C/compiler.pkg b/src/compiler/machines/C/compiler.pkg
index a77dd7baa..bfa97abfa 100644
--- a/src/compiler/machines/C/compiler.pkg
+++ b/src/compiler/machines/C/compiler.pkg
@@ -408,6 +408,10 @@ USA.
 	  fasl-format:mips32le
 	  fasl-format:ppc32
 	  fasl-format:sparc32
+	  fasl-format:svm1-32be
+	  fasl-format:svm1-32le
+	  fasl-format:svm1-64be
+	  fasl-format:svm1-64le
 	  portable-fasdump))
 
 (define-package (compiler constraints)
diff --git a/src/compiler/machines/i386/compiler.pkg b/src/compiler/machines/i386/compiler.pkg
index f1fd35bcd..fb11b624e 100644
--- a/src/compiler/machines/i386/compiler.pkg
+++ b/src/compiler/machines/i386/compiler.pkg
@@ -394,6 +394,10 @@ USA.
 	  fasl-format:mips32le
 	  fasl-format:ppc32
 	  fasl-format:sparc32
+	  fasl-format:svm1-32be
+	  fasl-format:svm1-32le
+	  fasl-format:svm1-64be
+	  fasl-format:svm1-64le
 	  portable-fasdump))
 
 (define-package (compiler constraints)
diff --git a/src/compiler/machines/svm/.gitignore b/src/compiler/machines/svm/.gitignore
index 26b0acef8..6b5a626a7 100644
--- a/src/compiler/machines/svm/.gitignore
+++ b/src/compiler/machines/svm/.gitignore
@@ -1,4 +1,6 @@
 assembler-db.scm
 assembler-rules.exp
+endian.scm
 svm1-defns.h
 svm1-opcodes.scm
+wordsize.scm
diff --git a/src/compiler/machines/svm/big-endian.scm b/src/compiler/machines/svm/big-endian.scm
new file mode 100644
index 000000000..6ca26b837
--- /dev/null
+++ b/src/compiler/machines/svm/big-endian.scm
@@ -0,0 +1,32 @@
+#| -*-Scheme-*-
+
+Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+    1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
+    2017, 2018 Massachusetts Institute of Technology
+
+This file is part of MIT/GNU Scheme.
+
+MIT/GNU Scheme is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+MIT/GNU Scheme is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with MIT/GNU Scheme; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+USA.
+
+|#
+
+;;;; Machine Model for SVM: Byte Order
+;;; package: (compiler)
+
+(declare (usual-integrations))
+
+(define-integrable endianness 'BIG)
\ No newline at end of file
diff --git a/src/compiler/machines/svm/compile-assembler.scm b/src/compiler/machines/svm/compile-assembler.scm
index bdfaa12e1..cc9725691 100644
--- a/src/compiler/machines/svm/compile-assembler.scm
+++ b/src/compiler/machines/svm/compile-assembler.scm
@@ -28,6 +28,8 @@ USA.
   (lambda ()
     (let ((environment (make-top-level-environment)))
       (load "../../base/macros" environment)
+      (load "endian" environment)
+      (load "wordsize" environment)
       (load "machine" environment)
       ;; Load assembler-compiler before -runtime.
       ;; It needs to create RULE-MATCHER anti-syntax.
diff --git a/src/compiler/machines/svm/compiler.pkg b/src/compiler/machines/svm/compiler.pkg
index 939e5b5bb..4762af8c3 100644
--- a/src/compiler/machines/svm/compiler.pkg
+++ b/src/compiler/machines/svm/compiler.pkg
@@ -36,6 +36,8 @@ USA.
 	 "base/sets"			;set abstraction
 	 "base/mvalue"			;multiple-value support
 	 "base/scode"			;SCode abstraction
+	 "machines/svm/endian"		;byte order
+	 "machines/svm/wordsize"	;word size
 	 "machines/svm/machine"		;machine dependent stuff
 	 "back/asutl"			;back-end odds and ends
 	 "base/utils"			;odds and ends
@@ -394,6 +396,10 @@ USA.
 	  fasl-format:mips32le
 	  fasl-format:ppc32
 	  fasl-format:sparc32
+	  fasl-format:svm1-32be
+	  fasl-format:svm1-32le
+	  fasl-format:svm1-64be
+	  fasl-format:svm1-64le
 	  portable-fasdump))
 
 (define-package (compiler constraints)
diff --git a/src/compiler/machines/svm/compiler.sf b/src/compiler/machines/svm/compiler.sf
index 0dc3d58e6..4c5db39af 100644
--- a/src/compiler/machines/svm/compiler.sf
+++ b/src/compiler/machines/svm/compiler.sf
@@ -75,6 +75,8 @@ USA.
 	((access initialize-package! environment)))
       (sf-and-load "base/pmlook")
       (sf-and-load "base/pmpars")
+      (sf-and-load "machines/svm/endian")
+      (sf-and-load "machines/svm/wordsize")
       (sf-and-load "machines/svm/machine")
       (sf-and-load "back/syntax")
       (sf-and-load "base/scode")
diff --git a/src/compiler/machines/svm/decls.scm b/src/compiler/machines/svm/decls.scm
index 67ef02e76..df6c9f5d1 100644
--- a/src/compiler/machines/svm/decls.scm
+++ b/src/compiler/machines/svm/decls.scm
@@ -349,7 +349,8 @@ USA.
 			   "object" "proced" "rvalue"
 			   "scode" "subprb" "utils"))
 	 (machine-base
-	  (append (filename/append "machines/svm" "machine")
+	  (append (filename/append "machines/svm" "endian" "wordsize"
+				   "machine")
 		  (filename/append "back" "asutl")))
 	 (rtl-base
 	  (filename/append "rtlbase"
diff --git a/src/compiler/machines/svm/little-endian.scm b/src/compiler/machines/svm/little-endian.scm
new file mode 100644
index 000000000..4e9de574b
--- /dev/null
+++ b/src/compiler/machines/svm/little-endian.scm
@@ -0,0 +1,32 @@
+#| -*-Scheme-*-
+
+Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+    1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
+    2017, 2018 Massachusetts Institute of Technology
+
+This file is part of MIT/GNU Scheme.
+
+MIT/GNU Scheme is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+MIT/GNU Scheme is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with MIT/GNU Scheme; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+USA.
+
+|#
+
+;;;; Machine Model for SVM: Byte Order
+;;; package: (compiler)
+
+(declare (usual-integrations))
+
+(define-integrable endianness 'LITTLE)
\ No newline at end of file
diff --git a/src/compiler/machines/svm/machine.scm b/src/compiler/machines/svm/machine.scm
index 83fe59022..bc8d62640 100644
--- a/src/compiler/machines/svm/machine.scm
+++ b/src/compiler/machines/svm/machine.scm
@@ -31,15 +31,24 @@ USA.
 
 ;;;; Architecture Parameters
 
-;; XXX Invent an svm1 fasdump format.
-(define (target-fasl-format) fasl-format:amd64) ;XXX
+(define (target-fasl-format)
+  (cond ((and (eq? endianness 'BIG) (= scheme-object-width 32))
+	 fasl-format:svm1-32be)
+	((and (eq? endianness 'LITTLE) (= scheme-object-width 32))
+	 fasl-format:svm1-32le)
+	((and (eq? endianness 'BIG) (= scheme-object-width 64))
+	 fasl-format:svm1-64be)
+	((and (eq? endianness 'LITTLE) (= scheme-object-width 64))
+	 fasl-format:svm1-64le)
+	(else
+	 (error "Unknown byte order and object width:"
+		`(,endianness ENDIAN)
+		`(,scheme-object-width BITS)))))
 
 (define use-pre/post-increment? #t)
-(define-integrable endianness 'LITTLE)
 (define-integrable addressing-granularity 8)
 (define-integrable scheme-type-width 6)
 (define-integrable scheme-type-limit #x40)
-(define-integrable scheme-object-width (if (fix:fixnum? #x100000000) 64 32))
 
 (define-integrable scheme-datum-width
   (- scheme-object-width scheme-type-width))
diff --git a/src/compiler/machines/svm/wordsize-32.scm b/src/compiler/machines/svm/wordsize-32.scm
new file mode 100644
index 000000000..d0de6f986
--- /dev/null
+++ b/src/compiler/machines/svm/wordsize-32.scm
@@ -0,0 +1,32 @@
+#| -*-Scheme-*-
+
+Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+    1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
+    2017, 2018 Massachusetts Institute of Technology
+
+This file is part of MIT/GNU Scheme.
+
+MIT/GNU Scheme is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+MIT/GNU Scheme is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with MIT/GNU Scheme; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+USA.
+
+|#
+
+;;;; Machine Model for SVM: Word Size
+;;; package: (compiler)
+
+(declare (usual-integrations))
+
+(define-integrable scheme-object-width 32)
\ No newline at end of file
diff --git a/src/compiler/machines/svm/wordsize-64.scm b/src/compiler/machines/svm/wordsize-64.scm
new file mode 100644
index 000000000..d1ca83be7
--- /dev/null
+++ b/src/compiler/machines/svm/wordsize-64.scm
@@ -0,0 +1,32 @@
+#| -*-Scheme-*-
+
+Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+    1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
+    2017, 2018 Massachusetts Institute of Technology
+
+This file is part of MIT/GNU Scheme.
+
+MIT/GNU Scheme is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+MIT/GNU Scheme is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with MIT/GNU Scheme; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+USA.
+
+|#
+
+;;;; Machine Model for SVM: Word Size
+;;; package: (compiler)
+
+(declare (usual-integrations))
+
+(define-integrable scheme-object-width 64)
\ No newline at end of file
diff --git a/src/compiler/machines/x86-64/compiler.pkg b/src/compiler/machines/x86-64/compiler.pkg
index c06a21a57..f8b09924d 100644
--- a/src/compiler/machines/x86-64/compiler.pkg
+++ b/src/compiler/machines/x86-64/compiler.pkg
@@ -394,6 +394,10 @@ USA.
 	  fasl-format:mips32le
 	  fasl-format:ppc32
 	  fasl-format:sparc32
+	  fasl-format:svm1-32be
+	  fasl-format:svm1-32le
+	  fasl-format:svm1-64be
+	  fasl-format:svm1-64le
 	  portable-fasdump))
 
 (define-package (compiler constraints)
diff --git a/src/configure.ac b/src/configure.ac
index abcc2b015..c2cdb77e3 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -150,17 +150,20 @@ c)
     INSTALL_LIARC_BUNDLES=install-liarc-bundles
     IF_LIARC=
     ;;
-svm1)
+svm1-32be|svm1-32le|svm1-64be|svm1-64le)
     IF_SVM=
     ;;
 esac
 
 MIT_SCHEME_COMPILER_TARGET([${with_compiler_target}])
-if test x"${mit_scheme_compiler_target}" = xsvm1; then
+case ${mit_scheme_compiler_target} in
+svm1-32be|svm1-32le|svm1-64be|svm1-64le)
     IF_SVM_COMPILER=
-else
+    ;;
+*)
     IF_SVM_COMPILER='#!svm compiler: '
-fi
+    ;;
+esac
 
 AUXDIR_NAME=mit-scheme-${mit_scheme_native_code}
 AUXDIR='$(libdir)'/${AUXDIR_NAME}
@@ -264,12 +267,11 @@ directory, which is usually \`/usr/local/lib/mit-scheme-${mit_scheme_native_code
 fi
 
 # A 32bit host running LIAR/svm needs a large heap.
-if test x"${mit_scheme_native_code}" = xsvm1; then
-    AC_CHECK_SIZEOF([unsigned long])
-    if test ${ac_cv_sizeof_unsigned_long} -eq 4; then
-	HOST_COMPILER_HEAP="--heap 10000"
-    fi
-fi
+case ${mit_scheme_native_code} in
+svm1-32be|svm1-32le)
+    HOST_COMPILER_HEAP="--heap 10000"
+    ;;
+esac
 
 if test x"${enable_x11}" = x && test x"${enable_default_plugins}" = xyes; then
     AC_PATH_X
diff --git a/src/microcode/aclocal.m4 b/src/microcode/aclocal.m4
index 990eacd72..54361014d 100644
--- a/src/microcode/aclocal.m4
+++ b/src/microcode/aclocal.m4
@@ -4,6 +4,12 @@ AC_DEFUN([MIT_SCHEME_NATIVE_CODE],[
 _mit_scheme_native_code_spec=$1
 _mit_scheme_native_code_host_cpu=$2
 
+AC_CHECK_SIZEOF([unsigned long])
+AC_C_BIGENDIAN(
+    [mit_scheme_host_byteorder=be],
+    [mit_scheme_host_byteorder=le],
+    [AC_MSG_ERROR([unknown host byte order])])
+
 AC_MSG_CHECKING([for native-code support])
 MIT_SCHEME_ARCHITECTURE([${_mit_scheme_native_code_spec}])
 
@@ -45,7 +51,40 @@ none)
 c)
     AC_MSG_RESULT([yes, using portable C code])
     ;;
-svm1)
+svm1|svm1-32|svm1-64|svm1-be|svm1-le|svm1-32be|svm1-32le|svm1-64be|svm1-64le)
+    case ${mit_scheme_native_code} in
+    svm1|svm1-be|svm1-le)
+	case ${ac_cv_sizeof_unsigned_long} in
+	4)
+	    mit_scheme_svm_wordsize=32
+	    ;;
+	8)
+	    mit_scheme_svm_wordsize=64
+	    ;;
+	*)
+	    AC_MSG_ERROR([Unknown host word size])
+	    ;;
+	esac
+	;;
+    svm1-32le|svm1-32be)
+	mit_scheme_svm_wordsize=32
+	;;
+    svm1-64le|svm1-64be)
+	mit_scheme_svm_wordsize=64
+	;;
+    esac
+    case ${mit_scheme_native_code} in
+    svm1|svm1-32|svm1-64)
+	mit_scheme_svm_byteorder="${mit_scheme_host_byteorder}"
+	;;
+    svm1-32be|svm1-64be)
+	mit_scheme_svm_byteorder=be
+	;;
+    svm1-32le|svm1-64le)
+	mit_scheme_svm_byteorder=le
+	;;
+    esac
+    mit_scheme_native_code=svm1-${mit_scheme_svm_wordsize}${mit_scheme_svm_byteorder}
     AC_MSG_RESULT([yes, using portable SVM code])
     ;;
 *)
@@ -99,8 +138,8 @@ yes|YES|y|Y)
 c|C)
     mit_scheme_architecture=c
     ;;
-svm|svm1)
-    mit_scheme_architecture=svm1
+svm1-32be|svm1-32le|svm1-64be|svm1-64le)
+    mit_scheme_architecture=${_mit_scheme_architecture_spec}
     ;;
 no|NO|none|NONE|n|N)
     mit_scheme_architecture=none
diff --git a/src/microcode/cmpintmd/svm1-config.h b/src/microcode/cmpintmd/svm1-config.h
index 178b03a2c..b89ea3182 100644
--- a/src/microcode/cmpintmd/svm1-config.h
+++ b/src/microcode/cmpintmd/svm1-config.h
@@ -31,4 +31,6 @@ USA.
 #define CC_IS_SVM 1
 #define CC_IS_GENERIC 1
 
+extern const fasl_arch_t svm_fasl_arch;
+
 #endif /* !SCM_CMPINTMD_CONFIG_H_INCLUDED */
diff --git a/src/microcode/configure.ac b/src/microcode/configure.ac
index 076a2a31b..136691c64 100644
--- a/src/microcode/configure.ac
+++ b/src/microcode/configure.ac
@@ -861,7 +861,7 @@ c)
     AUX_PROGRAMS="gen-nonce extract-liarc-decls"
     INSTALL_INCLUDE=install-include
     ;;
-svm1)
+svm1-32be|svm1-32le|svm1-64be|svm1-64le)
     OPTIONAL_BASES="${OPTIONAL_BASES} svm1-interp"
     ;;
 *)
@@ -880,10 +880,18 @@ if test x"${mit_scheme_compiler_target}" = xc; then
     AC_CONFIG_FILES([liarc-ld], [chmod +x liarc-ld])
 fi
 
+case ${mit_scheme_native_code} in
+svm1-32be|svm1-32le|svm1-64be|svm1-64le)
+    cmpintmd=svm1
+    ;;
+*)
+    cmpintmd=${mit_scheme_native_code}
+    ;;
+esac
 AC_CONFIG_LINKS([
-    cmpintmd.h:cmpintmd/${mit_scheme_native_code}.h
-    cmpintmd.c:cmpintmd/${mit_scheme_native_code}.c
-    cmpintmd-config.h:cmpintmd/${mit_scheme_native_code}-config.h
+    cmpintmd.h:cmpintmd/${cmpintmd}.h
+    cmpintmd.c:cmpintmd/${cmpintmd}.c
+    cmpintmd-config.h:cmpintmd/${cmpintmd}-config.h
     ])
 
 for base in ${OPTIONAL_BASES}; do
diff --git a/src/microcode/confshared.h b/src/microcode/confshared.h
index bcbadf5d2..13ce4c3ea 100644
--- a/src/microcode/confshared.h
+++ b/src/microcode/confshared.h
@@ -222,6 +222,10 @@ typedef enum
   FASL_IA64,
   FASL_ARM,
   FASL_AARCH64,
+  FASL_SVM1_32BE,
+  FASL_SVM1_32LE,
+  FASL_SVM1_64BE,
+  FASL_SVM1_64LE,
 } fasl_arch_t;
 
 /* Possible values for COMPILER_PROCESSOR_TYPE.  This identifies the
@@ -657,4 +661,9 @@ extern void win32_stack_reset (void);
 #  define HEAP_FREE(address)
 #endif
 
+#ifdef CC_IS_SVM
+#  undef CURRENT_FASL_ARCH
+#  define CURRENT_FASL_ARCH svm_fasl_arch
+#endif
+
 #endif /* SCM_CONFSHARED_H */
diff --git a/src/microcode/svm1-interp.c b/src/microcode/svm1-interp.c
index 9ee92f5ea..96d2a7225 100644
--- a/src/microcode/svm1-interp.c
+++ b/src/microcode/svm1-interp.c
@@ -51,6 +51,22 @@ USA.
 
 typedef SCHEME_OBJECT word_t;	/* convenience abbreviation */
 
+#if (SIZEOF_UNSIGNED_LONG == 4)
+#  ifdef WORDS_BIGENDIAN
+const fasl_arch_t svm_fasl_arch = FASL_SVM1_32BE;
+#  else
+const fasl_arch_t svm_fasl_arch = FASL_SVM1_32LE;
+#  endif
+#elif (SIZEOF_UNSIGNED_LONG == 8)
+#  ifdef WORDS_BIGENDIAN
+const fasl_arch_t svm_fasl_arch = FASL_SVM1_64BE;
+#  else
+const fasl_arch_t svm_fasl_arch = FASL_SVM1_64LE;
+#  endif
+#else
+#error Neither 32-bit nor 64-bit, what is this, a PDP-10?
+#endif
+
 #define N_WORD_REGISTERS 0x100
 #define N_FLOAT_REGISTERS 0x100