Instead of trying to materialize immediate values greater than 32
bits, which is hard to do GC-safely on riscv64, don't treat >32 bit
immediate values as immediates at all. Rather, always treat them as
boxed constants. If we ever fix up how immediates are materialized on
riscv64, such that no untagged intermediates could possibly be loaded
into descriptor-regs, then we can go back to loading in immediates for
all fixnum values.
This also corrects a misunderstanding on what immediate-constant-sc is
supposed to do, as tested for in vm.before-xc.lisp. It's actually
entirely backend/implementation dependent for what we treat as an
immediate. It just happened that on 32-bit MIPS, encoded fixnums
coincided with the conveniently materializable immediate, so the idea
of fixnum = immediate got adopted to the other platforms, even when
this wasn't the original design intention.
And also give SAPs the same treatment.
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.
Prior to saving, we unintern all symbols, pointing weakly to them,
then collect garbage (starting only at static roots and stacks),
and re-intern the non-broken pointers.
Any symbol with a reference chain from a known root is always retained.
A symbol having no incoming reference except for a package is dealt
with in one of the following manners dependent on its home package:
1. require preserving all external symbols
(with some new exports in package-data-list to make this work)
2. preserve only specific (ad-hoc) internal symbols
2. preserve externals plus some specific symbols
4. preserve any symbol with any interesting properties at all-
function binding, value, globaldb data, etc.
The result is more than a 4% core size reduction with x86-64.
It is likely that this will discover occurences of add-on libraries
poking around with SBCL-internal symbols that disappeared.
This is as intended even if means having to unbreak some things
by fixing 3rd-party code or adding more symbol preservation exceptions.
VM routines were defined using two functions, one calling another
through structure slots. This is unnecessary, removing leads to a
~200KB core size reduction on x86-64.
Fix fixnum / sb!xc:fixnum xc bug (as in discussion with Bruno Haible
sbcl-devel 2005-03/2005-04)
... don't use the CL:FIXNUM type in immediate-constant-sc;
... write and use a test in before-xc.