Fix oversight in the bootstrap procedure
Stage 0 is supposed to emit compiled versions of system.scm and compiler.scm. The compiler.scm bytecode wasn't emitted properly because the emitter put the two files' bytecode in two separate C variables instead of concatenating them into the same variable as they should be.
This commit is contained in:
parent
cccbe54bb5
commit
d781c65862
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +1,16 @@
|
||||||
(define (dump-buffer-as-c-literal buf)
|
(define (dump-buffers-as-c-literal . bufs)
|
||||||
(princ "char boot_image[] = \"")
|
(princ "char boot_image[] = \"")
|
||||||
(let next ((i 0))
|
(let loop-bufs ((bufs bufs))
|
||||||
(let ((char (read-u8 buf)))
|
(if (not (null? bufs))
|
||||||
(if (not (io.eof? buf))
|
(begin (let ((buf (car bufs)))
|
||||||
(let ((code (+ char 0)))
|
(let loop-buf-bytes ((i 0))
|
||||||
(if (= 0 (mod i 16)) (princ "\"\n\""))
|
(let ((char (read-u8 buf)))
|
||||||
(princ "\\x")
|
(if (not (io.eof? buf))
|
||||||
(if (< code #x10) (princ "0"))
|
(let ((code (+ char 0)))
|
||||||
(princ (number->string code 16))
|
(if (= 0 (mod i 16)) (princ "\"\n\""))
|
||||||
(next (+ i 1))))))
|
(princ "\\x")
|
||||||
|
(if (< code #x10) (princ "0"))
|
||||||
|
(princ (number->string code 16))
|
||||||
|
(loop-buf-bytes (+ i 1)))))))
|
||||||
|
(loop-bufs (cdr bufs)))))
|
||||||
(princ "\";\n"))
|
(princ "\";\n"))
|
||||||
|
|
|
@ -19,6 +19,6 @@
|
||||||
(io.seek out 0)
|
(io.seek out 0)
|
||||||
out))
|
out))
|
||||||
|
|
||||||
(for-each (lambda (file)
|
(dump-buffers-as-c-literal
|
||||||
(dump-buffer-as-c-literal (compile-file->buffer file)))
|
(compile-file->buffer "system.scm")
|
||||||
(cdr *argv*))
|
(compile-file->buffer "compiler.scm"))
|
||||||
|
|
|
@ -4,4 +4,4 @@
|
||||||
(load "compiler.scm")
|
(load "compiler.scm")
|
||||||
(load "dump.scm")
|
(load "dump.scm")
|
||||||
|
|
||||||
(dump-buffer-as-c-literal (system-image->buffer))
|
(dump-buffers-as-c-literal (system-image->buffer))
|
||||||
|
|
|
@ -113,8 +113,7 @@ cd ../scheme-core
|
||||||
echo "Entering directory '$PWD'"
|
echo "Entering directory '$PWD'"
|
||||||
echo "Creating stage 0 boot file..."
|
echo "Creating stage 0 boot file..."
|
||||||
set -x
|
set -x
|
||||||
../"$builddir"/upscheme mkboot0.scm system.scm compiler.scm \
|
../"$builddir"/upscheme mkboot0.scm >../scheme-boot/boot_image.h.new
|
||||||
>../scheme-boot/boot_image.h.new
|
|
||||||
mv ../scheme-boot/boot_image.h.new ../scheme-boot/boot_image.h
|
mv ../scheme-boot/boot_image.h.new ../scheme-boot/boot_image.h
|
||||||
|
|
||||||
{ set +x; } 2>/dev/null
|
{ set +x; } 2>/dev/null
|
||||||
|
@ -129,8 +128,7 @@ cd ../scheme-core
|
||||||
echo "Entering directory '$PWD'"
|
echo "Entering directory '$PWD'"
|
||||||
echo "Creating stage 1 boot file..."
|
echo "Creating stage 1 boot file..."
|
||||||
set -x
|
set -x
|
||||||
../"$builddir"/upscheme mkboot1.scm \
|
../"$builddir"/upscheme mkboot1.scm >../scheme-boot/boot_image.h.new
|
||||||
>../scheme-boot/boot_image.h.new
|
|
||||||
mv ../scheme-boot/boot_image.h.new ../scheme-boot/boot_image.h
|
mv ../scheme-boot/boot_image.h.new ../scheme-boot/boot_image.h
|
||||||
|
|
||||||
{ set +x; } 2>/dev/null
|
{ set +x; } 2>/dev/null
|
||||||
|
|
Loading…
Reference in New Issue