X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fir1tran.lisp;h=ac16a1d9c6005212862ebc9e3b1c2bbe03412dfe;hb=cfc3b695e6452907fef6492710777511ac4af979;hp=998cd23a6b4abbe247312731c4ef13fd684c1b16;hpb=34c2e4824a6ef0f30e0645303a894da562ebdacc;p=sbcl.git diff --git a/src/compiler/ir1tran.lisp b/src/compiler/ir1tran.lisp index 998cd23..ac16a1d 100644 --- a/src/compiler/ir1tran.lisp +++ b/src/compiler/ir1tran.lisp @@ -241,7 +241,7 @@ (let ((kind (info :variable :kind name)) (type (info :variable :type name)) (where-from (info :variable :where-from name))) - (when (and (eq where-from :assumed) (eq kind :global)) + (when (eq kind :unknown) (note-undefined-reference name :variable)) (setf (gethash name *free-vars*) (case kind @@ -457,7 +457,7 @@ (let* ((forms (if for-value `(,form) `(,form nil))) (res (ir1-convert-lambda-body forms () - :debug-name (debug-name 'top-level-form form)))) + :debug-name (debug-name 'top-level-form #+sb-xc-host nil #-sb-xc-host form)))) (setf (functional-entry-fun res) res (functional-arg-documentation res) () (functional-kind res) :toplevel) @@ -639,7 +639,10 @@ ;; KLUDGE: If the reference is dead, convert using SYMBOL-VALUE ;; which is not flushable, so that unbound dead variables signal ;; an error (bug 412). - (ir1-convert start next result `(symbol-value ',name)) + (ir1-convert start next result + (if (eq (global-var-kind var) :global) + `(symbol-global-value ',name) + `(symbol-value ',name))) (etypecase var (leaf (when (lambda-var-p var) @@ -707,8 +710,7 @@ (not (fun-lexically-notinline-p cmacro-fun-name))) (let ((res (careful-expand-macro cmacro-fun form))) (if (eq res form) - (ir1-convert-common-functoid start next result form - op) + (ir1-convert-common-functoid start next result form op) (ir1-convert start next result res))) (ir1-convert-common-functoid start next result form op))))))) @@ -1213,6 +1215,16 @@ (declare (list spec vars) (type lexenv res)) (collect ((new-venv nil cons)) (dolist (name (cdr spec)) + ;; While CLHS seems to allow local SPECIAL declarations for constants, + ;; whatever the semantics are supposed to be is not at all clear to me + ;; -- since constants aren't allowed to be bound it should be a no-op as + ;; no-one can observe the difference portably, but specials are allowed + ;; to be bound... yet nowhere does it say that the special declaration + ;; removes the constantness. Call it a spec bug and prohibit it. Same + ;; for GLOBAL variables. + (let ((kind (info :variable :kind name))) + (unless (member kind '(:special :unknown)) + (error "Can't declare ~(~A~) variable locally special: ~S" kind name))) (program-assert-symbol-home-package-unlocked context name "declaring ~A special") (let ((var (find-in-bindings vars name))) @@ -1507,7 +1519,7 @@ (check-type ctran symbol) (check-type lvar symbol) (let ((post-binding-lexenv-p (not (null post-binding-lexenv))) - (post-binding-lexenv (or post-binding-lexenv (gensym)))) + (post-binding-lexenv (or post-binding-lexenv (sb!xc:gensym "LEXENV")))) `(%processing-decls ,decls ,vars ,fvars ,ctran ,lvar ,post-binding-lexenv-p (lambda (,ctran ,lvar ,post-binding-lexenv)