Optimize (SYMBOL-[GLOBAL-]VALUE X) for constant X
commit879a304666eef00c6858a0bc2386fd8961f0fd25
authorDouglas Katzman <dougk@google.com>
Sat, 15 Jul 2017 23:36:52 +0000 (15 19:36 -0400)
committerDouglas Katzman <dougk@google.com>
Sun, 16 Jul 2017 00:00:23 +0000 (15 20:00 -0400)
treec92eec548d15dcf776b676e1695286ea4ca8db89
parent345c47c7d5b41b96cf987d0ba841740a417d147b
Optimize (SYMBOL-[GLOBAL-]VALUE X) for constant X

We can't turn (SYMBOL-VALUE 'S) into a use of the atom S because
IR1-CONVERT-VAR sometimes converts S into (SYMBOL-VALUE 'S) which
would result in an infinite loop. The remedy is to introduce a new
SYMEVAL function to distinguish compiler-generated symbol-value
calls from those which are user-written or expanded from macros.

Specifically this improves ATOMIC-{PUSH,POP} on a symbol,
the expansions of which entail (SYMBOL-VALUE '*GLOBAL*)
20 files changed:
NEWS
package-data-list.lisp-expr
src/code/cas.lisp
src/code/symbol.lisp
src/compiler/alpha/cell.lisp
src/compiler/arm/cell.lisp
src/compiler/arm64/cell.lisp
src/compiler/fndb.lisp
src/compiler/hppa/cell.lisp
src/compiler/ir1tran.lisp
src/compiler/mips/cell.lisp
src/compiler/ppc/cell.lisp
src/compiler/sparc/cell.lisp
src/compiler/srctran.lisp
src/compiler/x86-64/cell.lisp
src/compiler/x86/cell.lisp
src/compiler/xref.lisp
src/interpreter/special-forms.lisp
tests/compiler-2.pure.lisp
tests/fopcompiler.impure.lisp