From: Taylor R Campbell Date: Wed, 12 Dec 2018 19:33:05 +0000 (+0000) Subject: Distinguish bytes-per-object from target-bytes-per-object. X-Git-Tag: mit-scheme-pucked-10.1.9~3^2~35^2~28 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=e6a7729d2ff6fb7577e4bf153462976ba5eae777;p=mit-scheme.git Distinguish bytes-per-object from target-bytes-per-object. This is a kludge for now until we have a syntactic tower where we can use distinct environments at each level of syntax expansion. --- diff --git a/src/Makefile.in b/src/Makefile.in index cb5a0c278..f7470c382 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -75,7 +75,9 @@ AUXDIR = @AUXDIR@ @IF_CROSS@COMPILER_SETTINGS_CROSS = (set! compiler:cross-compiling? true) @IF_CROSS@SF_SETTINGS_CROSS = \ @IF_CROSS@ (set! sf/cross-compiling? true) \ -@IF_CROSS@ (set! package/cross-compiling? true) +@IF_CROSS@ (set! package/cross-compiling? true) \ +@IF_CROSS@ (set! target-bytes-per-object \ +@IF_CROSS@ (lambda () @mit_scheme_target_bytes_per_object@)) @IF_LIARC@COMPILER_SETTINGS_LIARC = (set! compiler:invoke-c-compiler? false) HOST_COMPILER_HEAP = @HOST_COMPILER_HEAP@ @@ -85,7 +87,7 @@ HOST_COMPILER_SETTINGS = \ $(COMPILER_SETTINGS_LIARC) HOST_COMPILER = '$(MIT_SCHEME_EXE)' --batch-mode $(HOST_COMPILER_HEAP) --no-init-file \ - --eval '(begin $(HOST_COMPILER_SETTINGS))' --load runtime/host-adapter.scm + --load runtime/host-adapter.scm --eval '(begin $(HOST_COMPILER_SETTINGS))' HOST_RUNTIME_ONLY = '$(MIT_SCHEME_EXE)' --batch-mode $(HOST_COMPILER_HEAP) \ --band runtime.com --no-init-file --load runtime/host-adapter.scm diff --git a/src/configure.ac b/src/configure.ac index 5456b89bd..e625cde9f 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -139,6 +139,9 @@ AC_ARG_ENABLE([mcrypt], AC_CANONICAL_HOST +AC_CHECK_SIZEOF([unsigned long]) +mit_scheme_target_bytes_per_object=$ac_cv_sizeof_unsigned_long + ALL_TARGET=all-native INSTALL_COM='$(INSTALL_DATA)' INSTALL_LIARC_BUNDLES= @@ -386,6 +389,7 @@ AC_SUBST([INSTALL_COM]) AC_SUBST([INSTALL_LIARC_BUNDLES]) AC_SUBST([MIT_SCHEME_EXE]) AC_SUBST([mit_scheme_native_code]) +AC_SUBST([mit_scheme_target_bytes_per_object]) AC_SUBST([OPTION_SUBDIRS]) AC_PROG_INSTALL diff --git a/src/runtime/boot.scm b/src/runtime/boot.scm index c73ab8d73..ff5a7a5ef 100644 --- a/src/runtime/boot.scm +++ b/src/runtime/boot.scm @@ -508,4 +508,12 @@ USA. ((ucode-primitive gc-space-status))) (define (bytes-per-object) - (vector-ref (gc-space-status) 0)) \ No newline at end of file + (vector-ref (gc-space-status) 0)) + +;;; XXX Cross-compilation kludge: We redefine this to return the +;;; characteristic of the target system. In the future, macro +;;; expanders should just see a binding of bytes-per-object that +;;; reflects the target system. + +(define (target-bytes-per-object) + (bytes-per-object)) \ No newline at end of file diff --git a/src/runtime/bytevector.scm b/src/runtime/bytevector.scm index a77216998..8743437c4 100644 --- a/src/runtime/bytevector.scm +++ b/src/runtime/bytevector.scm @@ -205,9 +205,16 @@ USA. (lambda (form rename compare) rename compare (syntax-check '(_ expression expression) form) + ;; XXX This queries the host system rather than the target system. + ;; We should expose definitions of fix:fixnum? to macro expanders + ;; that reflect the target system instead. + #; (if (fix:fixnum? #xFFFFFFFF) (cadr form) - (caddr form))))) + (caddr form)) + ;; XXX For now, we can use the number of bytes per word as a proxy + ;; for whether fixnums have 32 bits. + `(select-on-bytes-per-word ,(caddr form) ,(cadr form))))) (select-u32-code ;; Can use fixnums: diff --git a/src/runtime/host-adapter.scm b/src/runtime/host-adapter.scm index e7af3e285..4a9461158 100644 --- a/src/runtime/host-adapter.scm +++ b/src/runtime/host-adapter.scm @@ -35,4 +35,9 @@ USA. ;;; the new runtime. It contains temporary hacks that will be kept ;;; only until the new runtime is released. +(if (lexical-unreferenceable? (->environment '()) 'target-bytes-per-object) + (environment-define (->environment '()) + 'target-bytes-per-object + bytes-per-object)) + unspecific \ No newline at end of file diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index efd7d106c..f1e87b223 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -203,6 +203,7 @@ USA. set-predicate<=! simple-parser-method standard-print-method + target-bytes-per-object weak-car weak-cdr weak-cons diff --git a/src/runtime/sysmac.scm b/src/runtime/sysmac.scm index 47900b49e..1f9f216d5 100644 --- a/src/runtime/sysmac.scm +++ b/src/runtime/sysmac.scm @@ -112,7 +112,7 @@ USA. (lambda (form rename compare) (declare (ignore rename compare)) (syntax-check '(_ expression expression) form) - (let ((bpo (bytes-per-object))) + (let ((bpo (target-bytes-per-object))) (case bpo ((4) (cadr form)) ((8) (caddr form))