- compile-whole-program and compile-whole-library now copy the hash-bang

line from the wpo file (if it has one) to the object file.
    compile.ss,
    7.ms
- stex is now a submodule.  csug/Makefile and release_notes/Makefile
  set and use the required Scheme and STEXLIB variables accordingly.
  they default the machine type to a6le, but this can be overridden
  and is by the generated top-level Makefile.  the generated top-level
  Makefile now has a new docs target that runs make in both csug and
  release_notes, and an updated distclean target that cleans the same.
  the annoying csug Makefile .fig.pdf rule redefinition is now gone.
  copyright.stex and csug.stex now list May 2016 as the revision month
  and date; this will have to be updated for future releases.
    configure, makefiles/Makefile.in,
    csug/Makefile, copyright.stex, csug.stex,
    release_notes/Makefile
- rebuilt the boot files

original commit: 4bd78a692dd4ca2f88af5d404fd0993a2d141e7b
This commit is contained in:
dybvig 2016-05-04 20:35:38 -04:00
parent 245c1e460a
commit 9c1721c466
11 changed files with 136 additions and 52 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "nanopass"] [submodule "nanopass"]
path = nanopass path = nanopass
url = https://github.com/nanopass/nanopass-framework-scheme.git url = https://github.com/nanopass/nanopass-framework-scheme.git
[submodule "stex"]
path = stex
url = https://github.com/dybvig/stex

16
LOG
View File

@ -88,3 +88,19 @@
- added pdtml flag, which if set to t causes profile-dump-html to be - added pdtml flag, which if set to t causes profile-dump-html to be
called at the end of a mat run. called at the end of a mat run.
mats/Mf-base mats/Mf-base
- compile-whole-program and compile-whole-library now copy the hash-bang
line from the wpo file (if it has one) to the object file.
compile.ss,
7.ms
- stex is now a submodule. csug/Makefile and release_notes/Makefile
set and use the required Scheme and STEXLIB variables accordingly.
they default the machine type to a6le, but this can be overridden
and is by the generated top-level Makefile. the generated top-level
Makefile now has a new docs target that runs make in both csug and
release_notes, and an updated distclean target that cleans the same.
the annoying csug Makefile .fig.pdf rule redefinition is now gone.
copyright.stex and csug.stex now list May 2016 as the revision month
and date; this will have to be updated for future releases.
configure, makefiles/Makefile.in,
csug/Makefile, copyright.stex, csug.stex,
release_notes/Makefile

4
configure vendored
View File

@ -239,7 +239,9 @@ git submodule init && git submodule update || exit 1
./workarea $m $w ./workarea $m $w
sed -e 's/$(workarea)/'$w'/g' makefiles/Makefile.in > Makefile sed -e 's/$(m)/'$m'/g'\
-e 's/$(workarea)/'$w'/g'\
makefiles/Makefile.in > Makefile
cat makefiles/Makefile-workarea.in > $w/Makefile cat makefiles/Makefile-workarea.in > $w/Makefile

View File

@ -1,9 +1,13 @@
m = a6le
Scheme=../$m/bin/$m/scheme -b ../$m/boot/$m/petite.boot -b ../$m/boot/$m/scheme.boot
STEXLIB=../stex
installdir=/tmp/csug9
x = csug x = csug
latex = pdflatex latex = pdflatex
stexmacrofiles = tspl4-prep stexmacrofiles = tspl4-prep
bib = $(x).bib bib = $(x).bib
index=yes index=yes
installdir=/u/dyb/crs/www/csug9
TSPL=tspl4 TSPL=tspl4
DIR=$(shell basename `pwd`) DIR=$(shell basename `pwd`)
@ -39,15 +43,7 @@ logcheck2: $(x).thirdrun
false;\ false;\
fi fi
include ~/stex/Mf-stex include $(STEXLIB)/Mf-stex
# HACK to prevent lines from dropping below .5pt
# .5pt = 1/144in = 8.3 1200ths, so go for 10 1200ths
.fig.pdf:
fig2dev -Leps $*.fig > $*.eps\
&& grep -q '7.500 slw' $*.eps\
&& sed -e 's/7.500 slw/10.000 slw/' $*.eps | epstopdf --filter > $*.pdf\
&& /bin/rm $*.eps || (echo "CHECK GREP"; false)
stexsrc = csug.stex title.stex copyright.stex contents.stex\ stexsrc = csug.stex title.stex copyright.stex contents.stex\
preface.stex intro.stex use.stex expeditor.stex debug.stex foreign.stex\ preface.stex intro.stex use.stex expeditor.stex debug.stex foreign.stex\
@ -79,7 +75,7 @@ $(x).secondrun: $(x).presecondrun
$(x).presecondrun: $(x).firstrun $(x).presecondrun: $(x).firstrun
cat tspl.aux >> $x.aux cat tspl.aux >> $x.aux
cat tspl.rfm >> $x.rfm cat tspl.rfm >> $x.rfm
echo '(summary-make "$x")' | scheme setup.ss summary.ss echo '(summary-make "$x")' | $(Scheme) setup.ss summary.ss
cat tspl.idx >> $x.idx cat tspl.idx >> $x.idx
touch $(x).presecondrun touch $(x).presecondrun
@ -87,7 +83,7 @@ $(x).thirdrun: $(x).prethirdrun canned/cisco-logo.png
$(x).prethirdrun: $(x).secondrun $(x).prethirdrun: $(x).secondrun
cat tspl.aux >> $x.aux cat tspl.aux >> $x.aux
cat tspl.rfm >> $x.rfm cat tspl.rfm >> $x.rfm
echo '(summary-make "$x")' | scheme setup.ss summary.ss echo '(summary-make "$x")' | $(Scheme) setup.ss summary.ss
cat tspl.idx >> $x.idx cat tspl.idx >> $x.idx
touch $(x).prethirdrun touch $(x).prethirdrun
@ -146,7 +142,7 @@ checklibs: $(x).thirdrun
code: $(stexsrc) code: $(stexsrc)
extract.pl $(stexsrc) > code extract.pl $(stexsrc) > code
echo '(load "code" pretty-print)' | vscheme csv7.5 -q echo '(load "code" pretty-print)' | $(Scheme) -q
$(x).clean: $(x).clean:
-/bin/rm -f $(x).rfm $(x).sfm $(x).prefirstrun $(x).presecondrun\ -/bin/rm -f $(x).rfm $(x).sfm $(x).prefirstrun $(x).presecondrun\

View File

@ -22,7 +22,7 @@ Licensed under the Apache License Version 2.0\\
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
% NB: also update corresponding notice in csug.stex % NB: also update corresponding notice in csug.stex
Revised \INSERTREVISIONMONTHSPACEYEAR for Chez Scheme Version 9.4. Revised May 2016 for Chez Scheme Version 9.4.
\medskip\noindent \medskip\noindent
Cisco and the Cisco logo are trademarks or registered trademarks Cisco and the Cisco logo are trademarks or registered trademarks

View File

@ -44,7 +44,7 @@
Copyright &copy; 2016 Cisco Systems, Inc.<br> Copyright &copy; 2016 Cisco Systems, Inc.<br>
Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License Version 2.0</a> Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License Version 2.0</a>
(<a class=plain href="canned/copyright.html">full copyright notice.</a>).</br> (<a class=plain href="canned/copyright.html">full copyright notice.</a>).</br>
Revised \INSERTREVISIONMONTHSPACEYEAR for Chez Scheme Version 9.4<br> Revised May 2016 for Chez Scheme Version 9.4<br>
<a class=plain href="canned/about.html">about this book</a> <a class=plain href="canned/about.html">about this book</a>
</tr></table> </tr></table>
}} }}

View File

@ -27,10 +27,16 @@ test:
bootfiles: bootfiles:
(cd $(workarea) && $(MAKE) bootfiles) (cd $(workarea) && $(MAKE) bootfiles)
docs: build
(cd csug && $(MAKE) m=$(m))
(cd release_notes && $(MAKE) m=$(m))
clean: clean:
(cd $(workarea) && $(MAKE) clean) (cd $(workarea) && $(MAKE) clean)
distclean: distclean:
rm -rf $(workarea) rm -rf $(workarea)
(cd csug ; make reallyreallyclean)
(cd release_notes ; make reallyreallyclean)
rm -f Makefile rm -f Makefile
rm -f Make.out rm -f Make.out

View File

@ -1952,6 +1952,44 @@ evaluating module init
(equal? (equal?
(separate-eval '(load "testfile-wpo-ext-all.so")) (separate-eval '(load "testfile-wpo-ext-all.so"))
"(9 . 5)\n") "(9 . 5)\n")
; test propagation of #! shell-script line
(begin
(define $hash-bang-line "#! /usr/bin/scheme --program\n")
(delete-file "testfile-wpo-c8.so")
(delete-file "testfile-wpo-c8-all.so")
(delete-file "testfile-wpo-c8.wpo")
(with-output-to-file "testfile-wpo-c8.ss"
(lambda ()
(display-string $hash-bang-line)
(for-each pretty-print
'((import (chezscheme))
(printf "hello\n"))))
'replace)
(separate-compile
'(lambda (x)
(parameterize ([generate-wpo-files #t])
(compile-program x)))
'wpo-c8)
(separate-compile
'(lambda (x)
(compile-whole-program (format "~a.wpo" x) (format "~a-all.so" x)))
'wpo-c8)
#t)
(equal?
(separate-eval '(load "testfile-wpo-c8.so"))
"hello\n")
(equal?
(separate-eval '(load "testfile-wpo-c8-all.so"))
"hello\n")
(equal?
(call-with-port (open-file-input-port "testfile-wpo-c8-all.so")
(lambda (ip)
(get-bytevector-n ip (string-length $hash-bang-line))))
(string->utf8 $hash-bang-line))
) )
(mat compile-whole-library (mat compile-whole-library
@ -3037,8 +3075,7 @@ evaluating module init
'cwl-c13) 'cwl-c13)
(separate-compile (separate-compile
'(lambda (x) '(lambda (x)
(lambda (op) (compile-whole-program (format "~a.wpo" x) (format "~a.so" x)))
(compile-whole-program (format "~a.wpo" x) (format "~a.so" x))))
'cwl-c13) 'cwl-c13)
#t) #t)

View File

@ -1,3 +1,7 @@
m = a6le
Scheme=../$m/bin/$m/scheme -b ../$m/boot/$m/petite.boot -b ../$m/boot/$m/scheme.boot
STEXLIB=../stex
# define default document pathname here # define default document pathname here
# override on command line with 'make x=newdoc' # override on command line with 'make x=newdoc'
x = release_notes x = release_notes
@ -17,7 +21,7 @@ bib =
# define index if an index is to be generated # define index if an index is to be generated
# index=yes # index=yes
include ~/stex/Mf-stex include $(STEXLIB)/Mf-stex
# define or override suffixes here # define or override suffixes here

View File

@ -757,17 +757,36 @@
(define read-input-file (define read-input-file
(lambda (who ifn) (lambda (who ifn)
(call-with-port ($open-file-input-port who ifn (file-options compressed)) (call-with-port ($open-file-input-port who ifn)
(lambda (ip) (lambda (ip)
(on-reset (close-port ip) (on-reset (close-port ip)
(if ($compiled-file-header? ip) (let ([hash-bang-line
(let loop ([rls '()]) (let ([start-pos (port-position ip)])
(let ([x (fasl-read ip)]) (if (and (eqv? (get-u8 ip) (char->integer #\#))
(cond (eqv? (get-u8 ip) (char->integer #\!))
[(eof-object? x) (reverse rls)] (let ([b (lookahead-u8 ip)])
[(Lexpand? x) (loop (cons x rls))] (or (eqv? b (char->integer #\space))
[else ($oops who "unexpected wpo file object ~s" x)]))) (eqv? b (char->integer #\/)))))
($oops who "input file is source ~s" ifn))))))) (let-values ([(op get-bv) (open-bytevector-output-port)])
(put-u8 op (char->integer #\#))
(put-u8 op (char->integer #\!))
(let loop ()
(let ([b (get-u8 ip)])
(unless (eof-object? b)
(put-u8 op b)
(unless (eqv? b (char->integer #\newline))
(loop)))))
(get-bv))
(begin (set-port-position! ip start-pos) #f)))])
(port-file-compressed! ip)
(if ($compiled-file-header? ip)
(let loop ([rls '()])
(let ([x (fasl-read ip)])
(cond
[(eof-object? x) (values hash-bang-line (reverse rls))]
[(Lexpand? x) (loop (cons x rls))]
[else ($oops who "unexpected wpo file object ~s" x)])))
($oops who "input file is source ~s" ifn))))))))
(define find-library (define find-library
(lambda (who path what library-ext*) (lambda (who path what library-ext*)
@ -794,7 +813,8 @@
(cond (cond
[(find-library who path "wpo" (map (lambda (ext) (cons (car ext) (string-append (path-root (cdr ext)) ".wpo"))) (library-extensions))) => [(find-library who path "wpo" (map (lambda (ext) (cons (car ext) (string-append (path-root (cdr ext)) ".wpo"))) (library-extensions))) =>
(lambda (fn) (lambda (fn)
(let-values ([(no-program node*) (process-ir*! (read-input-file who fn) fn #f libs-visible?)]) (let*-values ([(hash-bang-line ir*) (read-input-file who fn)]
[(no-program node*) (process-ir*! ir* fn #f libs-visible?)])
(values fn node*)))] (values fn node*)))]
[(find-library who path "so" (library-extensions)) => [(find-library who path "so" (library-extensions)) =>
(lambda (fn) (values fn (read-binary-file path fn libs-visible?)))] (lambda (fn) (values fn (read-binary-file path fn libs-visible?)))]
@ -1250,13 +1270,12 @@
`(revisit-only ,(build-combined-library-ir node*))))))) `(revisit-only ,(build-combined-library-ir node*)))))))
(define finish-compile (define finish-compile
(lambda (who msg ifn ofn x1) (lambda (who msg ifn ofn hash-bang-line x1)
(let ([op ($open-file-output-port who ofn (let ([op ($open-file-output-port who ofn (file-options replace))])
(if (compile-compressed)
(file-options replace compressed)
(file-options replace)))])
(on-reset (delete-file ofn #f) (on-reset (delete-file ofn #f)
(on-reset (close-port op) (on-reset (close-port op)
(when hash-bang-line (put-bytevector op hash-bang-line))
(when (compile-compressed) (port-file-compressed! op))
(parameterize ([$target-machine (constant machine-type-name)] (parameterize ([$target-machine (constant machine-type-name)]
; dummy sfd for block-profile optimization ; dummy sfd for block-profile optimization
[$sfd (source-file-descriptor ifn #xc7c7c7)] [$sfd (source-file-descriptor ifn #xc7c7c7)]
@ -1310,29 +1329,29 @@
[(ifn ofn libs-visible?) [(ifn ofn libs-visible?)
(unless (string? ifn) ($oops who "~s is not a string" ifn)) (unless (string? ifn) ($oops who "~s is not a string" ifn))
(unless (string? ofn) ($oops who "~s is not a string" ofn)) (unless (string? ofn) ($oops who "~s is not a string" ofn))
(let ([entry* (read-input-file who ifn)]) (let*-values ([(hash-bang-line ir*) (read-input-file who ifn)]
(let-values ([(program-entry lib* no-wpo*) (build-graph who entry* ifn #t #f libs-visible?)]) [(program-entry lib* no-wpo*) (build-graph who ir* ifn #t #f libs-visible?)])
(safe-assert program-entry) (safe-assert program-entry)
(safe-assert (null? no-wpo*)) (safe-assert (null? no-wpo*))
(let ([node* (topological-sort program-entry lib*)]) (let ([node* (topological-sort program-entry lib*)])
(finish-compile who "whole program" ifn ofn (finish-compile who "whole program" ifn ofn hash-bang-line
(build-program-body program-entry node* lib*)) (build-program-body program-entry node* lib*))
(build-required-library-list node* lib*))))]))) (build-required-library-list node* lib*)))])))
(set-who! compile-whole-library (set-who! compile-whole-library
(lambda (ifn ofn) (lambda (ifn ofn)
(unless (string? ifn) ($oops who "~s is not a string" ifn)) (unless (string? ifn) ($oops who "~s is not a string" ifn))
(unless (string? ofn) ($oops who "~s is not a string" ofn)) (unless (string? ofn) ($oops who "~s is not a string" ofn))
(let ([entry* (read-input-file who ifn)]) (let*-values ([(hash-bang-line ir*) (read-input-file who ifn)]
(let-values ([(no-program lib* wpo*) (build-graph who entry* ifn #f (generate-wpo-files) #t)]) [(no-program lib* wpo*) (build-graph who ir* ifn #f (generate-wpo-files) #t)])
(safe-assert (not no-program)) (safe-assert (not no-program))
(safe-assert (or (not (generate-wpo-files)) (not (null? wpo*)))) (safe-assert (or (not (generate-wpo-files)) (not (null? wpo*))))
(when (null? lib*) ($oops "did not find libraries in input file ~s" ifn)) (when (null? lib*) ($oops "did not find libraries in input file ~s" ifn))
(let ([node* (topological-sort #f lib*)]) (let ([node* (topological-sort #f lib*)])
(write-wpo-file who ofn wpo*) (write-wpo-file who ofn wpo*)
(finish-compile who "whole library" ifn ofn (finish-compile who "whole library" ifn ofn hash-bang-line
(build-library-body node* lib*)) (build-library-body node* lib*))
(build-required-library-list node* lib*))))))) (build-required-library-list node* lib*))))))
(set! $c-make-code (set! $c-make-code
(lambda (func subtype free name size code-list info pinfo*) (lambda (func subtype free name size code-list info pinfo*)

1
stex Submodule

@ -0,0 +1 @@
Subproject commit 3bd2b86cc5ae1797d05fc5cc6f11cc43383f741d