Commit graph

17 commits

Author SHA1 Message Date
Douglas Katzman a2d379665d Shrink globldb packed infos if #+compact-instance-header
Don't use a simple-vector for storage, as it essentially wasted 12 bytea
per vector (counting all the 0s in the header and length words).
Rather than invent a new primitive object, this change uses a variable-length
INSTANCE, similarly to how CONDITION primitive objects are represented,
yielding somewhere between 5% to 10% space reduction for those data,
which is significant if have >16MiB of 'em eating up heap space.

There is no savings for #-compact-instance-header, but there are easy ways
to remedy that: (1) invent a new headered primitive object that is vector-like
but with the length in the header, (2) put a bit in an instance header saying
that next word which would ordinarily be a LAYOUT is not, (3) just use the
LAYOUT slot for whatever we like, and make GC robust against failure.
Option (3) isn't actually too unsafe - the 0th info element is a fixnum.
Of course there's always option (4) - implement #+compact-instance-header.
And there's no real benefit for 32-bit, since there wasn't as much waste.

A few more points to note:
- SYMBOL-INFO-VECTOR got renamed to SYMBOL-DBINFO, and SYMBOL-INFO to
  SYMBOL-%INFO for the primitive slot to try to keep things clearer
  as to which accesses the globaldb.
- It wasn't worth redoing all the specialized vops for SYMBOL-PLIST
  that would have been needed, so they're all gone.
- these days we don't need so much of the "!" convention for removing
  unnecessary symbols rom the core, since the tree-shaker does that.
2021-11-22 15:52:39 -05:00
Charles Zhang e09b2148a2 Less SB-XC: noise. 2020-08-17 19:12:29 -07:00
Douglas Katzman fedb5a8420 Fix spelling 2020-06-14 15:33:03 -04:00
Douglas Katzman a2b990e220 Search-and-replace SB!KERNEL with SB-KERNEL 2018-12-05 12:05:55 -05:00
Douglas Katzman ebd6f3689f Search-and-replace SB!IMPL with SB-IMPL 2018-12-05 11:59:20 -05:00
Douglas Katzman 36910867d8 Search-and-replace SB!VM with SB-VM
Performed via:
 % perl -pi -e 's/SB!VM/SB-VM/g' **/*lisp *.lisp-expr **/*.texinfo
 % perl -pi -e 's/sb!vm/sb-vm/g' **/*lisp *.lisp-expr
2018-12-04 22:24:42 -05:00
Douglas Katzman 53785c5132 Remove last remaining uses of DEF!CONSTANT
It is a completely unnecessary complication because:

- The cross-compiler, a program defined by a subset of 'build-order.lisp-expr',
  either gets compiled right, or doesn't. If it does, then it must not have any
  forward references within itself to global symbols.

- That SAME program is compiled again, as the compiler, so if it worked to
  compile it in make-host-1, it should work to compile it in make-host-2.

- This leaves open to question whether any of the runtime files not common
  to both make-host passes contain forward references (the "remedy" for which
  was to use DEF!CONSTANT). There are (at least) three better fixes:

 (1) Fix the build order. Correct code should not forward-reference constants.

 (2) If the use of the constant is injected by a source-transform or macro
     whose expander was defined in make-host-1 and whose constant value
     was also defined in make-host-1, the expanded code can contain
     the VALUE of the constant, not the name of the constant.

 (3) In a pinch, "#." might do the trick. While potentially the least desirable
     fix, it is more explainable then yet another means (such as is DEF!foo)
     of injecting definitions into the cross-compiler despite that it has not
     digested a defining forms. (See ADDRESS-BASED-COUNTER-VAL, which is
     cross-compiled before 'objdef'. It needs the host's value of a thread
     slot offset, but in an inline function, not a macro.)
2018-03-07 11:10:38 -05:00
Douglas Katzman ecdba7cbea Rely on ordinary hash-table to implement globaldb in cross-compiler
Remove needless conditionalization from lock-free code
since it doesn't really work as advertised on the host anyway.
2017-12-07 09:41:36 -05:00
Douglas Katzman e2081d2e9d Move globaldb functions out of SB!C package 2017-05-16 10:23:01 -04:00
Douglas Katzman c79427ea45 Rename TYPE-NUMBER to INFO-NUMBER.
Mainly just search-and-replace but also export more from SB-INT
and move a defconstant to avoid a suboptimal piece of code.
2015-02-27 23:08:25 -05:00
Douglas Katzman 30299bb087 Replace CLEAR-INFO-VALUE with CLEAR-INFO-VALUES 2014-07-08 11:50:21 -04:00
Douglas Katzman f6f734c93a Tweak INFO-VECTOR-FDEFINITION 2014-04-18 23:15:48 -04:00
Douglas Katzman 463f8ccc0f Some changes to bootstrap the quasi-lockfree globaldb info hashtable.
Also a clearer way of expressing the PUTHASH algorithm,
and a unit test that it works in the cross-compiler host.
2014-03-12 20:22:48 -04:00
Douglas Katzman 0fb6f83412 Initial reimplementation of globaldb - fast INFO and (SETF INFO).
The main idea is that info values are stored in a vector attached to
each symbol when possible. When not possible, the storage reverts
to the volatile [sic] environment, but still using a vector as the
payload instead of the chained hashing/alist approach.

This strives to be very fast at lookup at the expense of some added
complexity during updates. Performance testing suggests that it is
at least 2x to 3x faster at (INFO :class :type name), and FBOUNDP
is almost 4x faster. In a repeatable test, a file that took 1.8 seconds
to compile now takes 1.7 seconds but with more consing (as expected).

sbcl.core itself increases in size by <1% for 64-bit architecture,
and less for 32-bit architecture because there is proportionaly less
wasted space. A compact environment's table is effectively the
concatenation of all info vectors into one, so the added overhead is
in vector headers. However the fallback hash is now smaller,
so there used to be more wasted cells in the compact env.

Eventually the compact and volatile environments will both go away,
but not until the quasi-lockfree hashtable bootstraps properly.
The problem is an inability to use raw slots in early cold init.
It's actually not a problem of using them - the compiled code is ok -
but cold-init drops into 'ldb' due to how defstruct expands.

Among the bugs fixed by this (not straightforwardly testable) is that
the compact environment would hold into symbols that became otherwise
inaccessible. It no longer does, but still holds onto other names.

This patch builds with CCL as host, and for 32-on-64 and vice-versa,
so nothing seems terribly broken in terms of assumptions made.
2014-03-07 12:51:29 -05:00
Nikodemus Siivola 45bc305be4 1.0.17.24: refactor handling of constants in the compiler
* Coalesce non-circular lists, bit-vectors, and non-base-strings in the
   file-compiler. (We could do more, but these are the "easy" ones.) Takes
   care of OPTIMIZATIONS #34 in practice: outside the file compiler one can
   still trick the system into similar behaviour, but that seems a fairly
   academic concern.

 * Never go through SYMBOL-VALUE at runtime to fetch the value of a constant
   variable in compiled code.

 * Use (SYMBOL-VALUE <NAME>) as the load-form to dump references to named
   constants into fasls.

 * Signal a continuable error if an attempt to change the SYMBOL-VALUE of a
   constant variable is made.

 * Assignments to undefined variables go through SET, so that one
   cannot accidentally modify a constant by doing something like:

    (defun set-foo (x) (setq foo x))
    (defconstant foo 42)
    (set-foo 13)

 * Gets rid of INFO :VARIABLE :CONSTANT-VALUE, and just uses SYMBOL-VALUE to
   store constant values.

 * Move definition of SB!XC:LAMBDA-LIST-KEYWORDS to be beginning of the build,
   and use it instead of the host LAMBDA-LIST-KEYWORDS where appropriate.

 * Tests.
2008-06-04 12:39:38 +00:00
William Harold Newman 4898ef32c6 0.9.2.43:
another slice of whitespace canonicalization
	(Anyone who ends up here with "cvs annotate" probably
		wants to look at the "tabby" tagged version.)
2005-07-14 16:30:05 +00:00
Christophe Rhodes 409c08485f 0.7.3.22:
Test that the cross-compiler knows about constants on startup
		... or at least at the end of being built
	SunOS versions less than 5.8 now fully supported (thanks to Eric
		Marsden for diagnosis and testing)
2002-05-20 16:22:18 +00:00