raz / commit dc5e4bcc

commit
dc5e4bcc054c2990817cc130a6fe0f33c7bf7a48
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
a61882bd
sbcl: ADR of a string constant's byte, so it compiles src/

A string's bytes have an address, as a ^U8 made from the string does;
a typed constant's parts still don't. Built by sbcl/raz, the raz
compiler passes conform/ and makes the same bytes as the native one.

patch · log

2 files changed, +9 -2

sbcl/README.md (history) modified +5 -0

@@ -123,6 +123,11 @@
123123
124124 ## Beyond conform/
125125
126+It compiles the raz compiler, `src/` (with `-I build/src` for its
127+`Version`), in about 4 seconds. That compiler, run on SBCL, passes
128+`conform/`, and makes executables byte for byte the same as the native
129+one's, its own included.
130+
126131 Of the reference compiler's own tests, `test/run` and `examples/`, all
127132 pass whose expected output this target can give: the rest are x86
128133 code procedures (`Asm`, `Atomic`, `Edge`, `Results`, `Simd`, `Single`,

sbcl/src/expr.lisp (history) modified +4 -2

@@ -612,7 +612,7 @@
612612 (when (is ty :string)
613613 ;; a string constant is indexed and sliced as an array of U8
614614 (setf ty (make-array-type (ty-len ty) (basic "U8"))
615- item (make-item :mode :var :type ty :form (string-address (item-val item)) :ro :const :tok tk)))
615+ item (make-item :mode :var :type ty :form (string-address (item-val item)) :ro :string :tok tk)))
616616 (unless (member (ty-kind ty) '(:array :slice :ptr))
617617 (fail-tok tk "~a can't be indexed" (type-name ty)))
618618 (when (and (is ty :ptr) (is (ptr-base ty) :array))
@@ -755,6 +755,7 @@
755755 (case (item-ro a)
756756 (:export (fail-tok tk "another module's variable can't be ~a" what))
757757 (:const (fail-tok tk "a constant can't be ~a" what))
758+ (:string (fail-tok tk "a string's bytes can't be ~a" what))
758759 (:value (fail-tok tk "a part of a value can't be ~a" what))))
759760
760761 (defun vararg-form (a)
@@ -893,7 +894,8 @@
893894 (arity args 1)
894895 (let ((x (arg 0)))
895896 (unless (eq (item-mode x) :var) (fail-tok tk "ADR takes a variable"))
896- (check-writable x tk "given to ADR")
897+ ;; a string's bytes have an address, as a ^U8 made from it does (5.10)
898+ (unless (eq (item-ro x) :string) (check-writable x tk "given to ADR"))
897899 (when (item-noaddr x) (fail-tok tk "a field of a packed record has no address"))
898900 (val-item (make-ptr-type (item-type x) (item-vol x)) (item-form x) tk)))
899901 ((string= name "LEN")