expander: fix make for generating BC source

Also, update "README.txt" to explain both CS and BC setup.
This commit is contained in:
Matthew Flatt 2020-08-06 14:09:53 -06:00
parent 06ed5bf8f5
commit 581f02d6f8
3 changed files with 97 additions and 80 deletions

View File

@ -125,72 +125,72 @@
(define kw2194 (string->keyword "set-hash!")) (define kw2194 (string->keyword "set-hash!"))
(define hash2936 (define hash2936
(hasheq (hasheq
kw2755
'25
kw2641
'4
kw2129
'16
kw2821
'11
kw2607
'3
kw3245
'13
kw2582
'13
kw2099
'5
kw2201
'20
kw2226
'6
kw2535
'17
kw3163 kw3163
'9 '9
kw2600
'23
kw2333
'14
kw2626
'8
kw2603
'1
kw2931
'15
kw2802
'12
kw2525
'10
kw2967
'12
kw2677
'26
kw2804
'24
kw2762
'27
kw2473
'14
kw1932
'2
kw2496
'7
kw2169
'21
kw2707 kw2707
'22 '22
kw2600
'23
kw2241 kw2241
'18 '18
kw2333
'14
kw2645 kw2645
'19 '19
kw2626
'8
kw3357 kw3357
'14 '14
kw2603
'1
kw2796 kw2796
'13 '13
kw2755
'25
kw2931
'15
kw2897 kw2897
'28)) '28
kw2641
'4
kw2802
'12
kw2129
'16
kw2525
'10
kw2821
'11
kw2967
'12
kw2607
'3
kw2677
'26
kw3245
'13
kw2804
'24
kw2582
'13
kw2762
'27
kw2099
'5
kw2473
'14
kw2201
'20
kw1932
'2
kw2226
'6
kw2496
'7
kw2535
'17
kw2169
'21))
(define kw2162 (string->keyword "not-recorded")) (define kw2162 (string->keyword "not-recorded"))
(define hash2430 (define hash2430
(hasheq (hasheq

View File

@ -1,4 +1,4 @@
This package contains the implementation of Racket's front-end: macro This package contains the implementation of Racket's front end: macro
expander, reader, and module systems. A copy of this implementation is expander, reader, and module systems. A copy of this implementation is
extracted and built into the Racket executable, so normally this extracted and built into the Racket executable, so normally this
package's modules are not run directly. The expander or reader can be package's modules are not run directly. The expander or reader can be
@ -92,31 +92,6 @@ Running:
Expands and extracts <file-path> as a single linklet, compiles it Expands and extracts <file-path> as a single linklet, compiles it
and then writes the bytecode into <outfile-path>. and then writes the bytecode into <outfile-path>.
% racket bootstrap-run.rkt -c <dir> -O <checkout-dir>/racket
Compiles the expander to source files in <dir> --- note that
"bootstrap-run.rkt" must be used to get source compiles --- and
writes the flattened linklet to "startup.inc" in a Git checkout of
a linklet-based Racket. Be sure to increment the target Racket
version if you change the serialization of syntax objects or the
linklet protocol.
When you `make`, then "startup.inc" will be automatically compiled
to bytecode for for embedding into the Racket executable. If you
change the expander in a way that makes existing compiled files
invalid, be sure to update "schvers.h". (Updating "schvers.h" is
important both for bytecode files and the makefile/preprocessor
dance that generates the bytecode version of the expander itself.)
% make
A shortcut for the above: When this package resides in an existing
in-place build from the main Racket repo, then the makefile uses
that copy of Racket to build the expander and drop a replacement
into the "src" directory. Re-making the Racket tree will then use
the updated expander. You may have to manually discard
"compiled/cache-src" when things change.
% make demo % make demo
% make run ARGS="<arg> ..." % make run ARGS="<arg> ..."
@ -127,6 +102,48 @@ Running:
---------------------------------------- ----------------------------------------
Building Racket to use this expander:
After you change the expander, you must perform an explicit build step
to use it when making Racket CS or Racket BC. Normally, for that case,
the expander would be modified as part of a Racket repo checkout.
Then:
* For Racket CS, go to "racket/src/cs" in the repo and run `make`.
That will update files in "racket/src/cs/schemified", including
using the new expander to rebuild the Racket-implemented parts of
Racket CS that are in "../thread", "../io", etc.
After this step, a `make cs` in the top level of the Racket repo
will build Racket CS using the new expander.
* For Racket BC, run `make` here, which will update the file
"racket/src/bc/src/startup.inc". Then, when you build Racket BC,
"startup.inc" will be automatically compiled to bytecode for
embedding into the Racket BC executable.
After this step, a `make bc` in the top level of the Racket repo
will build Racket CS using the new expander.
For either of these steps, the makefile will assume that Racket is
already built in the surrounding checkout, so Racket can be run as
`../../bin/racket`. Use `make RACKET=....` to use a different Racket
build, but beware that the version of Racket must be essentially the
same version as the target build.
Before building new CS and BC executables, increment the target Racket
version in "../version/racket_version.h" if you change the
serialization of syntax objects or the linklet protocol. Updating
"racket_version.h" is important both for bytecode files and the
makefile/preprocessor dance that generates the bytecode version of the
expander itself.
The `make` step for Racket BC generates source files in
"compiled/cache-src". In come cases (hopefully rare), you may have to
manually discard "compiled/cache-src" when things change.
----------------------------------------
Roadmap to the implementation: Roadmap to the implementation:
read/ - the readers read/ - the readers

View File

@ -77,7 +77,7 @@
(set! extract? #t) (set! extract? #t)
(set! extract-to-c? #t) (set! extract-to-c? #t)
(linklet-compile-to-s-expr #t) (linklet-compile-to-s-expr #t)
(set! print-extracted-to (build-path checkout-directory "src" "racket" "src" "startup.inc"))] (set! print-extracted-to (build-path checkout-directory "src" "bc" "src" "startup.inc"))]
#:once-each #:once-each
[("-k") dir "Use Racket checkout at <dir>" [("-k") dir "Use Racket checkout at <dir>"
(set! checkout-directory (path->complete-path dir))] (set! checkout-directory (path->complete-path dir))]