De-weird-ify parts of the implementation of deprecated variables
commit345c47c7d5b41b96cf987d0ba841740a417d147b
authorDouglas Katzman <dougk@google.com>
Sat, 15 Jul 2017 22:53:22 +0000 (15 18:53 -0400)
committerDouglas Katzman <dougk@google.com>
Sat, 15 Jul 2017 23:02:28 +0000 (15 19:02 -0400)
tree9c7fbd6e6f6fdb2196de6b279eb0e0d4bd7b36fc
parent7d33c1e1a35872b5c91d12ff13fc3007f72c6dee
De-weird-ify parts of the implementation of deprecated variables

Don't transform (SYMBOL-[GLOBAL-]VALUE 'S) to a plain use of S
unless exactly semantics-preserving. It had a bunch of issues:
  - it changes behavior if SYMBOL-VALUE is declared notinline
  - it interacts poorly with transforms elsewhere in the compiler
    that may wish to observe the call to symbol-value
    and do a similar thing (to optimize the call per se)
  - it's too closely tied to knowledge of how the compiler translates
    "plain" uses of defvars by safely going through #'SYMBOL-VALUE.
    i.e. the logic for early/late stage deprecation knows that
    the compiler will ultimately call symbol-value and that a separate
    warning should not be issued in ir1-convert-var

As it happens, the easiest way to avoid warning one too many times
is just use FIND-FREE-VAR to warn since it at most once (per symbol
per component) creates a hash-table entry. This also fixes the problem that
no warning was issued for SETQ and LET bindings of deprecated variables.
This approach allows a subsequent change that was hampered by deprecation
checks in the compiler macros. I also suspect that we should re-question the
decision to represent variables in final deprecation stage as symbol-macros.
src/code/early-extensions.lisp
src/code/symbol.lisp
src/compiler/debug.lisp
src/compiler/ir1tran.lisp
tests/deprecation.impure.lisp
tests/deprecation.internal.impure.lisp