From f63ededab8896471c71708a8f9d7c5eff88b20b1 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 23 Jul 2019 19:21:46 -0600 Subject: [PATCH] cs: fix copied environment setup from cross-compilation The copy of the environment setup for cross-compilation was out of sync with the main environment configuration. --- racket/src/cs/Makefile | 2 +- racket/src/cs/c/Makefile.in | 4 ++-- racket/src/cs/c/cross-serve.ss | 21 ++++----------------- racket/src/cs/c/mk-cross-serve.ss | 1 + racket/src/cs/expander.sls | 21 +++------------------ racket/src/cs/expander/env.ss | 19 +++++++++++++++++++ 6 files changed, 30 insertions(+), 38 deletions(-) create mode 100644 racket/src/cs/expander/env.ss diff --git a/racket/src/cs/Makefile b/racket/src/cs/Makefile index 400d7d7d1e..cb392f0f71 100644 --- a/racket/src/cs/Makefile +++ b/racket/src/cs/Makefile @@ -105,7 +105,7 @@ rktl: mkdir -p ../../bin touch ../../bin/racket -$(BUILDDIR)expander.$(CSO): expander.sls $(BUILDDIR)compiled/expander.scm $(PRIMITIVES_TABLES) $(EXPANDER_DEPS) $(COMPILE_FILE_DEPS) +$(BUILDDIR)expander.$(CSO): expander.sls expander/env.ss $(BUILDDIR)compiled/expander.scm $(PRIMITIVES_TABLES) $(EXPANDER_DEPS) $(COMPILE_FILE_DEPS) $(COMPILE_FILE) expander.sls $(EXPANDER_DEPS) $(BUILDDIR)compiled/expander.scm: $(BUILDDIR)compiled/expander.rktl $(CONVERT_DEPS) diff --git a/racket/src/cs/c/Makefile.in b/racket/src/cs/c/Makefile.in index cf15ac4b9f..4635b1804a 100644 --- a/racket/src/cs/c/Makefile.in +++ b/racket/src/cs/c/Makefile.in @@ -341,8 +341,8 @@ plain-install-upcased: SCHEME_XPATCH = $(SCHEME_SRC)/$(TARGET_MACH)/s/xpatch -compile-xpatch.$(TARGET_MACH): $(SCHEME_XPATCH) $(srcdir)/mk-cross-serve.ss $(srcdir)/cross-serve.ss - $(SCHEME) --script $(srcdir)/mk-cross-serve.ss $(srcdir)/cross-serve.ss +compile-xpatch.$(TARGET_MACH): $(SCHEME_XPATCH) $(srcdir)/mk-cross-serve.ss $(srcdir)/cross-serve.ss $(srcdir)/../expander/env.ss + $(SCHEME) --script $(srcdir)/mk-cross-serve.ss $(srcdir)/cross-serve.ss $(srcdir)/../expander/env.ss cat cross-serve.so $(SCHEME_XPATCH) > compile-xpatch.$(TARGET_MACH) RACKET_XPATCH = chezpart.$(MACH) rumble.$(MACH) thread.$(MACH) \ diff --git a/racket/src/cs/c/cross-serve.ss b/racket/src/cs/c/cross-serve.ss index 23088c44dc..5ad7720246 100644 --- a/racket/src/cs/c/cross-serve.ss +++ b/racket/src/cs/c/cross-serve.ss @@ -20,23 +20,10 @@ (enable-arithmetic-left-associative #t) (generate-procedure-source-information #t) (expand-omit-library-invocations #t) - ;; Set up the environment - (expand `(import (rename (rumble) - [correlated? syntax?] - [correlated-source syntax-source] - [correlated-line syntax-line] - [correlated-column syntax-column] - [correlated-position syntax-position] - [correlated-span syntax-span] - [correlated-e syntax-e] - [correlated->datum syntax->datum] - [datum->correlated datum->syntax] - [correlated-property syntax-property] - [correlated-property-symbol-keys syntax-property-symbol-keys]) - (thread) - (io) - (regexp) - (linklet))) + ;; Set up the environment; ../expander/env.ss must be loaded before compiling + (expand (let-syntax ([env (lambda (stx) + (datum->syntax stx (list 'quote environment-imports)))]) + env)) ;; Serve requests to compile or to fasl data: (let ([in (standard-input-port)] [out (standard-output-port)]) diff --git a/racket/src/cs/c/mk-cross-serve.ss b/racket/src/cs/c/mk-cross-serve.ss index 26ae7cdb5e..6358389bf7 100644 --- a/racket/src/cs/c/mk-cross-serve.ss +++ b/racket/src/cs/c/mk-cross-serve.ss @@ -1,2 +1,3 @@ (let ([args (command-line-arguments)]) + (load (cadr args)) (compile-file (car args) "cross-serve.so")) diff --git a/racket/src/cs/expander.sls b/racket/src/cs/expander.sls index 45777f5f5f..8c51e55d6c 100644 --- a/racket/src/cs/expander.sls +++ b/racket/src/cs/expander.sls @@ -87,27 +87,12 @@ ;; ---------------------------------------- + (include "expander/env.ss") + ;; The environment is used to evaluate linklets, so all primitives ;; need to be there imported there (parameterize ([expand-omit-library-invocations #f]) - (eval `(import (rename (rumble) - [correlated? syntax?] - [correlated-source syntax-source] - [correlated-line syntax-line] - [correlated-column syntax-column] - [correlated-position syntax-position] - [correlated-span syntax-span] - [correlated-e syntax-e] - [correlated->datum syntax->datum] - [datum->correlated datum->syntax] - [correlated-property syntax-property] - [correlated-property-symbol-keys syntax-property-symbol-keys]) - (thread) - (io) - (regexp) - (linklet) - (only (schemify) - force-unfasl))) + (eval environment-imports) ; defined in "expander/env.ss" ;; Ensure that the library is visited, especially for a wpo build: (eval 'variable-set!)) diff --git a/racket/src/cs/expander/env.ss b/racket/src/cs/expander/env.ss new file mode 100644 index 0000000000..f35912e895 --- /dev/null +++ b/racket/src/cs/expander/env.ss @@ -0,0 +1,19 @@ +(define environment-imports + `(import (rename (rumble) + [correlated? syntax?] + [correlated-source syntax-source] + [correlated-line syntax-line] + [correlated-column syntax-column] + [correlated-position syntax-position] + [correlated-span syntax-span] + [correlated-e syntax-e] + [correlated->datum syntax->datum] + [datum->correlated datum->syntax] + [correlated-property syntax-property] + [correlated-property-symbol-keys syntax-property-symbol-keys]) + (thread) + (io) + (regexp) + (linklet) + (only (schemify) + force-unfasl)))