Arrays that have :INITIAL-CONTENTS or -ELEMENT can save space
by not using shadow bits.
A simple and reliable way to decide whether to allocate the bits is by
passing a extra argument to ALLOCATE-VECTOR rather than inferring based
on data flow and seeing or not seeing the initialization step.
(MOVEs can always mess you up if not done carefully)
Most of these were genuinely using elements that were (potentially)
never assigned, but in the case of %%FILL-BASHERS%% and *BACKEND-SBS*
nothing should use the unset elements, except that even so much as
examining the data in a REPL could in theory be undefined, so
in the interest of safety, assign all elements.
Rather than complaining when someone uses a host constant by accident,
make this mistake almost impossible by having unqualified constant
references always do the right thing.
These were added by mostly "restoring" the ones found in CMU CL. As a
lot of compiler code (and some newer system code) was originally
written in a coding style which explicitly leaned on block compilation
for performance (for example, the liberal use of once-called DEFUNs in
performance hotspots, like ir1-conversion/optimization, reg-alloc, and
representation selection), we trust that the wizards of old had
written these declarations thoughtfully.
Indeed, the warm core shrunk by ~90 KB on x86-64 from adding these
declarations alone, as a result of let-converting many functions away
and emitting less argument parsing and checking code due to more
aggressive use of local call. Even some more type derivation was
enabled, as seen by the additional float math done.
A little rearrangment was needed to get everything to work out. Some
stuff may not have been put in the most logical place.
I plan to remove the heuristic in find-free-var that checks whether a constant
matches the host's. It's going to always be an error to use any symbol that
names a CL constant. Enforcing that found several places in code compiled in
make-host-1 which failed to use the proper symbol and got the host's value.
The change only fixes the symbols and doesn't change the leniency.
SEQUENCE1 and SEQUENCE2 do not provide enough clues and require
additional mental overhead when using these functions.
Use sub-sequence1/main-sequence2 and source-sequence1/target-sequence2
leaving 1 and 2 for :start1/:end2 correspondence.
[Continuing with theme from change bbaae542da]
Of the tricks employed to prevent compile-time-only junk from remaining in
the pristine core, the (EVAL-WHEN (:COMPILE-TOPLEVEL) (SB!XC:DEFMACRO ...))
pattern is particularly unnecessary in as much as it presents an obstacle
to understanding. The tree-shaker will remove unused macros more cleanly.
Moreover, seeing symbols not get dropped as expected by the tree-shaker
shows where we had created a dangling reference to a deleted macro.
(See comment at end of src/code/bignum for example)
Also note that many macros don't need the leading #\! any more,
which eliminates yet another bit of weirdness.
As mentioned in several other changes, it is unfortunate that DEFGLOBAL
implies compile-time evaluation since it is always possible to opt-in
to a compile-time effect via eval-when. But that ship has sailed,
and we have spell this out using two different macros.
So this change touches a subset of DEFGLOBALs seen in make-host-2 but not
make-host-1. If a given DEFGLOBAL is seen during both passes, changing it
to DEFINE-LOAD-TIME-GLOBAL is no different, because the symbol already
satisfies BOUNDP. But if only seen in make-host-2, this change explicitly
avoids reliance on the compile-time value.
Target-only code with eval-when around defmacro, or worse, sb!xc:defmacro,
is wrong. The cross-compiler will only ever want the target's variant of
defmacro (and to imply otherwise is obfuscatory).
The tree shaker does the right thing with no further code decorations needed.
Any location can now have context, use it for type errors.
New special form, SB-KERNEL:THE-CONTEXT, used as (the-context type
context value), when an error is signaled the condition will be
augmented with CONTEXT.
Use this for structure slot setters:
(defstruct foo (x nil :type fixnum))
(make-foo) =>
The value
NIL
is not of type
FIXNUM
when setting slot X of structure FOO