X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Ffopcompile.lisp;h=266bcc6732e4a0a1adb76705718056b4f135a73d;hb=c553e4be6da2d18f0827f190589c88e837b8b8a6;hp=b1cbefe216516b10d361294a5828ef422a16667e;hpb=79a8e51bf4b06a5bd57bc90233605f98fee3b041;p=sbcl.git diff --git a/src/compiler/fopcompile.lisp b/src/compiler/fopcompile.lisp index b1cbefe..266bcc6 100644 --- a/src/compiler/fopcompile.lisp +++ b/src/compiler/fopcompile.lisp @@ -249,25 +249,31 @@ ;; Symbol macro (fopcompile macroexpansion path for-value-p) (let ((kind (info :variable :kind form))) - (if (member kind '(:special :constant)) - ;; Special variable - (fopcompile `(symbol-value ',form) path for-value-p) - ;; Lexical - (let* ((lambda-var (cdr (assoc form (lexenv-vars *lexenv*)))) - (handle (when lambda-var - (lambda-var-fop-value lambda-var)))) - (if handle - (when for-value-p - (sb!fasl::dump-push handle *compile-object*)) - (progn - ;; Undefined variable. Signal a warning, and - ;; treat it as a special variable reference, like - ;; the real compiler does -- do not elide even if - ;; the value is unused. - (note-undefined-reference form :variable) - (fopcompile `(symbol-value ',form) - path - for-value-p))))))))) + (cond + ((eq :special kind) + ;; Special variable + (fopcompile `(symbol-value ',form) path for-value-p)) + + ((member kind '(:global :constant)) + ;; Global variable or constant. + (fopcompile `(symbol-global-value ',form) path for-value-p)) + (t + ;; Lexical + (let* ((lambda-var (cdr (assoc form (lexenv-vars *lexenv*)))) + (handle (when lambda-var + (lambda-var-fop-value lambda-var)))) + (if handle + (when for-value-p + (sb!fasl::dump-push handle *compile-object*)) + (progn + ;; Undefined variable. Signal a warning, and + ;; treat it as a special variable reference, like + ;; the real compiler does -- do not elide even if + ;; the value is unused. + (note-undefined-reference form :variable) + (fopcompile `(symbol-value ',form) + path + for-value-p)))))))))) ((listp form) (multiple-value-bind (macroexpansion macroexpanded-p) (sb!xc:macroexpand form *lexenv*)