Commit graph

209 commits

Author SHA1 Message Date
Douglas Katzman 70b20e891b Fix %concatenate-to-vector 2021-07-07 12:00:44 -04:00
Douglas Katzman af6abcaf16 Remove ELEMENT-TYPE arg from DATA-VECTOR-FROM-INITS
Always call it with widetag + n-bits-shift.
And never pass NIL for n-bits-shift to ALLOCATE-VECTOR-WITH-WIDETAG.
2021-07-07 11:08:34 -04:00
Douglas Katzman 42b516eaa6 Rename :array-ubsan to :ubsan
Detection of all undefined behaviors should be under control of 1 feature.
2021-06-08 21:22:01 -04:00
Douglas Katzman 30070c8f9e Delete !MAKE-REPLACE-TRANSFORM
It hid some needlessly obfuscated expressions such as
`(funcall #',bash-function ...) with bash-function being a symbol.
2021-05-31 23:39:38 -04:00
Douglas Katzman 59ae6af4fc array-ubsan: Allocate shadow bits only if needed
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)
2021-05-20 18:59:18 -04:00
Douglas Katzman 647077e62b Remove more assumptions of implicit 0-fill for all vectors
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.
2021-05-18 19:44:15 -04:00
Philipp Marek 1a91bd73aa Fix typo in docstring of REPLACE. 2021-02-21 12:01:10 +00:00
Bike 05471076c3 Fix MAP-INTO-ing extended sequences
Use the required protocol functions.
2020-10-03 23:47:37 +03:00
Stas Boukarev a02f8bcd4c Inline nreverse-word-specialized-vector.
It's only used inside vector-nreverse.
2020-09-06 21:04:27 +03:00
Charles Zhang dd407e3c31 Ensure unqualified standard library constants refer to target values.
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.
2020-08-17 19:10:40 -07:00
Stas Boukarev 85157e7f25 Disable block-compilation on +sb-devel 2020-05-03 03:28:38 +03:00
Charles Zhang 59adefd671 Sprinkle block compilation declarations into self build.
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.
2020-05-02 02:04:57 -07:00
Douglas Katzman dc8cab9fd1 Optionally use jump table in array dispatch 2019-11-12 19:10:05 -05:00
Stas Boukarev b3ce63b8fe Better errors for ELT.
Make it similar to AREF, but mention the fill-pointer if present.
Include the length of non-vector sequences
2019-05-27 23:31:01 +03:00
Douglas Katzman 894477d6a8 Consistently use SB-XC: prefix on standard constants
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.
2019-02-02 18:14:34 -05:00
Douglas Katzman cc8f1e5fb3 Replace more feature expressions with standard reader syntax
Just: perl -pi -e 's/#\!([-+])sb-dynamic-core/#$1sb-dynamic-core/g' **/*lisp
and similarly sb-{thread, unicode, fluid, simd-pack, show}, gencgc, cheneygc,
win32, linux, darwin, {little,big}-endian, 64-bit, immobile-space.

About 1200 lines involving bang feature expressions remain at this point.
2019-01-28 17:58:41 -05:00
Stas Boukarev 45b3596b68 Swap around REPLACE parameters. 2019-01-06 15:00:44 +03:00
Stas Boukarev a9a354027b Better lambda lists for SEARCH and REPLACE.
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.
2019-01-06 02:51:15 +03:00
Douglas Katzman 85d0dda259 Search-and-replace SB!{PCL,MOP} with SB-{PCL,MOP}
Remove a comment that became nonsense in light of the rename.
2018-12-05 14:04:23 -05:00
Douglas Katzman 3f2d2890ec Search-and-replace SB!SEQUENCE with SB-SEQUENCE 2018-12-05 13:57:50 -05: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 2def8ebf95 Search-and-replace SB!XC with SB-XC 2018-12-05 11:54:16 -05:00
Douglas Katzman 317aed7500 Search-and-replace SB!C with SB-C 2018-12-05 11:50:01 -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 5e2bfc2639 Change package of "src/code/array" to SB!VM
>110 sb!vm:: qualifieres are gone, and only ~4 sb!impl:: are added.
2018-04-22 19:23:08 -04:00
Douglas Katzman fb1ba6de5e Remove more strange idioms for symbol pruning
[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.
2018-04-21 21:08:53 -04:00
Douglas Katzman 1e3491983d Remove spurious SB!XC - it's just DEFMACRO in target code 2018-04-21 19:31:29 -04:00
Douglas Katzman 4bdae836d7 Add dynamic-extent declarations
The code in compiler-extras was used to find places to add these.

Also fix bug in defboot from prior change
2018-04-09 16:14:20 -04:00
Douglas Katzman 54987f9346 Use DEFINE-SEQUENCE-TRAVERSER slightly more correctly
It will automatically coerce an argument named PREDICATE, but not PRED
2018-04-09 14:11:33 -04:00
Douglas Katzman a0f7bb8b08 Change lots of DEFGLOBALs to DEFINE-LOAD-TIME-GLOBAL
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.
2018-03-10 16:42:42 -05:00
Douglas Katzman bbaae542da Remove anti-pattern
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.
2018-02-26 13:56:05 -05:00
Stas Boukarev 163104568d Fix REPLACE and REPLACE transforms when copying zero elements.
The indexes can become -1 conflicting with the INDEX type.
2018-02-18 15:21:48 +03:00
Stas Boukarev 70b1a3a5b9 Add EVAL-WHEN-COMPILE-TOPLEVEL macro.
And enable :load-toplevel with #!+sb-devel.
2018-02-18 14:02:48 +03:00
Stas Boukarev cad6753be3 Optimize out-of-line (replace vector vector)
On T and word-sized specialized vectors.
2018-02-10 22:26:09 +03:00
Jan Moringen 693f59830d New convenience function %PROGRAM-ERROR 2018-01-22 16:33:46 +01:00
Stas Boukarev 2b33bd288e Revert "Report type errors coming from (THE NIL 0)."
This reverts commit 9f1f8743c1.

Breaks self-build.
2018-01-18 00:55:46 +03:00
Stas Boukarev 9f1f8743c1 Report type errors coming from (THE NIL 0).
It was silently ignored.
c
2018-01-17 21:13:59 +03:00
Stas Boukarev 2f2210d68c Don't cons in COUNT.
A closure was being consed.
2018-01-01 14:14:27 +03:00
Stas Boukarev b1a7e4aeec ELT: don't check the array bounds twice. 2017-12-14 04:19:04 +03:00
Stas Boukarev a6e96820ee Stack allocate complex arrays.
Extend the make-array-header* trick.
2017-10-03 03:00:37 +03:00
Douglas Katzman 39992b8822 Use defglobal less 2017-08-18 09:46:50 -04:00
Douglas Katzman 1a95e78ec9 Use defglobal more 2017-08-17 23:24:48 -04:00
Douglas Katzman 46111ddc2c Fix misnomer: %ARRAY-DATA-VECTOR -> %ARRAY-DATA
It can hold an array of any rank when array displacement is involved.
2017-06-13 15:48:39 -04:00
Stas Boukarev 876b05ec8e Reduce consing in list SUBSEQ.
Declare the head cons dynamic extent.
2017-05-08 12:55:38 +03:00
Douglas Katzman 7644df2923 Remove reader conditionals for #!+sb-doc, part 3 of 3. 2017-02-01 17:04:05 -05:00
Douglas Katzman 28f8162bfa Remove reader conditionals for #!+sb-doc, part 2 of 3.
Done via this script:
% perl -ni -e 'print if !/^\s*#!?\+sb-doc$/' src/**/*.lisp
2017-02-01 16:31:24 -05:00
Stas Boukarev a2dae197d3 Add context to locations.
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
2017-01-22 23:44:44 +03:00
Stas Boukarev bc8f1c7c96 Speed up array word size calculation.
Use shifts instead of multiplication.
2016-12-19 20:50:56 +03:00
Stas Boukarev db5ace1d25 Fix vector-fill* on -64-bit.
double-float vectors have no bashers either.
2016-12-14 20:42:17 +03:00