Decentralize per-thread initial special bindings.
commit22bccab1869d9effcbb6fb996d76c25828c1e90b
authorDouglas Katzman <dougk@google.com>
Tue, 17 Oct 2017 01:58:10 +0000 (16 21:58 -0400)
committerDouglas Katzman <dougk@google.com>
Tue, 17 Oct 2017 02:58:41 +0000 (16 22:58 -0400)
tree0a115a7be6fbc88ec361bb1d80a92cc5120135db
parent6fc96c13023ceaa840c893ecd87604e829eec8e1
Decentralize per-thread initial special bindings.

This change ensures that initial bindings in the main thread are made like in
other threads. They weren't, because INITIAL-THREAD-FUNCTION-TRAMPOLINE never
gets called for the main thread. The effect was that the main thread's value of
any of the affected symbols resolved to the global value unless later rebound.
Consequently it was not possible to optimize out the no-tls-value-marker check
for references to them. Such an optimization becomes possible now.

This change also revealed a few other tidbits:

- Absence of a binding for *HANDLER-CLUSTERS* during genesis was the likely
  reason for inability to muffle warnings during cold-init.

- STREAM-REINIT saw the old global value of *CURRENT-THREAD* from a dumped core
  rather than new value.

Other improvements aside, it's best not to state each variable's initializer
in two places - in the DEFVAR and in the thread creation trampoline.
16 files changed:
package-data-list.lisp-expr
src/code/cold-init-helper-macros.lisp
src/code/cold-init.lisp
src/code/deadline.lisp
src/code/early-package.lisp
src/code/early-step.lisp
src/code/early-thread.lisp
src/code/reader.lisp
src/code/serve-event.lisp
src/code/target-error.lisp
src/code/target-thread.lisp
src/code/toplevel.lisp
src/compiler/generic/genesis.lisp
src/compiler/generic/parms.lisp
src/runtime/thread.c
src/runtime/thread.h