Commit graph

5536 commits

Author SHA1 Message Date
Douglas Katzman 95d71c33d7 Merge codeblob tree changes from master 2022-06-09 14:40:29 -04:00
Douglas Katzman 52efb19000 Recognize bitmap update in aprof 2022-05-18 18:48:35 -04:00
Douglas Katzman a766523fcc Use fast algorithm for unsetting bitmap maps 2022-05-16 12:59:48 -04:00
Douglas Katzman 42821d99c0 Keep the bitmap updated during gc 2022-05-15 16:24:03 -04:00
Douglas Katzman 734ad7dd0a Create object header map for THREAD_MIXED pages 2022-05-02 20:26:47 -04:00
Douglas Katzman dee26d674f Distinguish eden pages from non-eden 2022-05-01 13:33:10 -04:00
Douglas Katzman 8d064ede48 x86-64: Inform ALLOCATION about using boxed or mixed TLAB 2022-04-30 22:15:42 -04:00
Douglas Katzman e24ec0993a Deflake a test 2022-04-30 22:09:01 -04:00
Douglas Katzman d71fa1b985 Parameterize gc_close_collector_regions
The code region is shared by the collector and mutators, so there
has to be a way to indicate use by one or the other.
2022-04-30 19:08:19 -04:00
Douglas Katzman d8ac32a1e9 Zeroize simple-vector suffix in %SHRINK-VECTOR
Because GC scavenging is more finicky now that it does not necessarily
proceed strictly object-by-object, non-zeroing could have caused
inadvertent floating garbage at best, or a crash at worst.
2022-04-30 17:36:10 -04:00
Douglas Katzman b6956ec887 Never realize FILLER_WIDETAG as a lisp object 2022-04-30 13:52:35 -04:00
Douglas Katzman f2950a0ede arm64: Enable traceroot test 2022-04-30 13:47:10 -04:00
Stas Boukarev 9f926c257f Make a test 32-bit compatible. 2022-04-30 20:35:35 +03:00
Douglas Katzman 0ece86aa87 Heap walk safely around */signed vop result
In general any cons with most-positive-word in the car.
I do like the idea of using -1 because it is unambiguously a filler
where (0 . 0) is possibly a real cons.
2022-04-30 10:59:07 -04:00
Douglas Katzman 7468417cc1 Make fcb-threads more reliable on more platforms
This test had a tendency to prevent the non-GC worker threads from running,
and/or cause heap exhaustion. Sometimes it would report thousands of GCs instead
of the expected couple of dozen or so. And ironically, tests that hammer on
GC rather than let it auto-trigger can cause garbage to promote from gen0
to gen1 on each cycle filling up gen1 by accident. The auto-trigger isn't
able to compensate for this unusual use-case by triggering in time.
2022-04-30 10:04:56 -04:00
Douglas Katzman 38d920da57 Express do-instance-tagged-slot in terms of do-layout-bitmap
Remove the option to scan the padding slot and/or specify a layout.
2022-04-29 14:42:31 -04:00
Charles Zhang 746145cb3a Remove failing test that uses deprecated function.
It fails because it uses a deprecated function.
2022-04-29 11:04:02 -07:00
Charles Zhang 2ccf4835aa Revert 8dc0bab872.
This was a very misleading change. This does not actually allow one to
block compile multiple files, and this approach can't work to actually
do so. The only thing it does is essentially the equivalent of
concatenating fasl files, which third party tools like ASDF can
already do. None of the state variables for compilation like ir1
namespacing get shared, which is crucial for block compilation.

We probably want to do multi-file block compilation through
WITH-COMPILATION-UNIT, or if we are going to do the "different
signature" route, we should go back to having source infos handle
multiple files, like CMU CL, as that is more efficient and more
general, because it actually treats multiple files as one thing to
read forms out of.
2022-04-29 11:02:56 -07:00
Charles Zhang 3e210f1ce4 Delete fopcompiler and simplify loader substantially.
The parent commit added functionality to allow the normal compiler to
produce smaller fasls than the fopcompiler in many cases, without a
real compile-time or load-time tradeoff. Therefore, remove the
fopcompiler, as it adds a lot of complexity and needs to be turned off
on high debug or instrumentation. As a bonus, the fopcode space is
freed up a bit.

It also suffers from multiple macroexpansion. Some things this allows
us to simplify:

* No need to have LOAD-FORM-IS-DEFAULT-MLFSS-P be used in the
compiler. The way we used it was sketchy anyway.
* The compiler and loader no longer need to keep track of skipping on
the FOP stack, or whether LOAD-TIME-VALUE needs it to be done or not.
2022-04-29 11:01:27 -07:00
Charles Zhang d3498a22a3 Do auto-tll smashing instead of fop compilation.
For top level forms we now smash top level lambdas into one component,
as if we were block compiling. We do it automatically 20 tlls at a
time, which significantly reduces the number of components that need
to get loaded and called at load time, reducing fasl size. Unlike CMU
CL, we've solved the problems of package environment interaction, so
that the optimization is semantically sound.

I also found a solution for recursive IR1 namespacing with respect to
forcing top level lambda smashing before emitting load time value and
constant junk, as it was causing problems with constant infos not
getting cleaned up properly. CMU CL also ran into this issue, but took
one step forward and one step back by removing a force call and adding
another one. Fix this by doing both force calls.

As a representative of compiling a large file, compiling
"src/compiler/node.lisp"
- with no tlf smashing:                 produces a fasl of  940039 bytes.
- with fop compilation:                 produces a fasl of  830003 bytes.
- with tlf smashing 20 forms at a time: produces a fasl of  752591 bytes.

Compiling ironclad shows no difference in speed. Loading the resulting
fasls also shows no measurable difference in speed when TIMEd.

Since we use the normal compiler, we don't sacrifice any debuggability
or coverage instrumentation, as well as avoiding issues with multiple
macroexpansion. This also opens up the possibility of using a real
byte-compiler in conjunction with tlf smashing to squeeze out even
more bytes out of fasls for loading top level code. The ir1-based cmu
cl byte compiler, for example, gets 6x space savings over (risc)
machine code on average (cf. cmu documentation). Note from the above
that fop-based byte compilation does not even produce more compact
code than machine code once top level lambdas are merged.

The fopcompiler will get removed in a subsequent change.
2022-04-29 11:01:27 -07:00
Charles Zhang 3760d2bdc0 Record whether inheritance is allowed when saving symbols.
When delaying toplevel form execution until after component loading in
the loader, shadowing would not effect the package environment
correctly during fasloading. Fix this by recording whether inheritance
for the symbol is allowed at the point of dumping. We are allowed to
do this because the specification says that in conforming code, the
package environment during compilation should be congruent to the
package environment during fasload.

This is the most expedient fix, but this could probably be done better
in a way that unifies the accessibility logic in cold load.
2022-04-29 11:01:27 -07:00
Charles Zhang 7eb3f2140f Make deprecation behavior exactly the same between compile and load.
We share the logic for deprecation warnings between compile file and
fasload, so that the same exact conditions are signalled when
fasloading as during compilation. This also significantly simplifies
the loader, as well as making it less flaky with respect to trying to
literally grovel the fop stack for a hardcoded pattern which doesn't
manifest at all on higher debug or coverage
instrumentation (specifically relying on fopcompilation to happen).
2022-04-29 10:57:40 -07:00
Charles Zhang 922c25d6c9 Fix non-conforming tests.
The order of evaluation for LOAD-TIME-VALUE with respect to other
top-level forms in the same file is unspecified.
2022-04-29 10:57:40 -07:00
Charles Zhang fc8e4f95c1 Turn off *check-consistency* for a test.
Check consistency doesn't work here on high debug. In addition, the
original test case didn't call for it anyway. The reason it doesn't
work is that signalling a compiler error while compiling breaks the
consistency of the IR. That's just how it is.
2022-04-29 10:57:40 -07:00
Douglas Katzman 6db04b68c1 Correct a test 2022-04-28 21:15:51 -04:00
Douglas Katzman e02e6bfa97 Mitigate code bloat from PCL accessors on defstructs
This essentially restores the state of things prior to rev d2ca90b6
but with the advantage of ahead-of-time compiling the anonymous
(and oxymoronic) writer functions for readonly slots.
2022-04-26 01:15:15 -04:00
Douglas Katzman e7bd68671f Fix DO-LAYOUT-BITMAP
When implementing variable-length trailing bitmaps, I half forgot that
there were variable-length data for the layout IDs of :INCLUDEd types.
C code was right but some Lisp code wasn't. BITMAP-NWORDS was right
if the depthoid did not require appending to the reserved ID words.
There is space for 6 included IDs by default (STRUCTURE-OBJECT being
implicit), so for typical structure definitions, no bug was evident.
2022-04-25 10:36:39 -04:00
Stas Boukarev 1bbd98ffa3 Don't transform bignump + integer<.
Integer< checks for all INTEGERs, which includes fixnums. Separate
VOPs could work on bignums, but (and bignump (< x 0)) are probably
rare.

Fixes lp#1970154
2022-04-25 17:34:21 +03:00
Stas Boukarev 88d2bc458e Don't delete empty special bindings if there is dynamic-extent around.
The usual pain inflicted by the fickle dynamic-extent handling.

Reported by Eric Marsden.
2022-04-22 19:26:21 +03:00
Douglas Katzman 86e49614e5 Remove boxed flag from SB-LOCKLESS::LIST-NODE layout 2022-04-18 23:56:43 -04:00
Douglas Katzman 28685b8c29 x86-64: Teach INITIALIZE-VECTOR about constant lvars + SIMPLE-VECTOR 2022-04-18 13:53:41 -04:00
Douglas Katzman d2ca90b6f3 Get rid of a use of PCL-COMPILE for defstruct
Never JIT-compile a writer for a readonly slot. Instead when macroexpanding
DEFSTRUCT, always create anonymized incarnations of each slot accessor
and hand those to the CLOS class installer. Thusly all rigmarole about whether
there is a pair of globally BOUNDP function names per slot is irrelevant.
2022-04-17 23:31:19 -04:00
Douglas Katzman 42e5e09341 Add negative test 2022-04-17 22:10:35 -04:00
Stas Boukarev 227c8a99f9 arith-combinations.pure: ensure type errors are signaled. 2022-04-18 00:33:36 +03:00
Stas Boukarev 041b530954 Test more combinations of arithmetic funs. 2022-04-18 00:29:01 +03:00
Charles Zhang 4a6c552cab Update tests to reflect better representation selection.
Our representation selection has been improved enough for a while
now (maybe since e6c2b1771c, or
earlier), such that we don't indiscriminately just store all
double-floats in an unboxed format. Update some tests to reflect that.
2022-04-17 13:35:17 -07:00
Charles Zhang 0f1fb5049a riscv: Fix potential source of GC unsafety.
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.
2022-04-17 11:45:17 -07:00
Jan Moringen f00b861d69 Handle intersection involving singleton infinity numeric types better
This change allows compiling

  (lambda (stream unsigned-p)
    (let ((number (readnum-helper stream unsigned-p)))
      (cond ((null number) nil)
            ((sb-ext:float-nan-p number) :nan)
            ((= number sb-ext:double-float-positive-infinity) number)
            ((= number sb-ext:double-float-negative-infinity) :-inf)
            (t :number))))

at all as well as inferring the return type

  (or (single-float +inf +inf) (double-float +inf +inf)
      (member nil :nan :inf :number))

The reason for the single float positive infinity in the return type
is that

  (= sb-ext:single-float-positive-infinity
     sb-ext:double-float-positive-infinity) => t

while

  (eql sb-ext:single-float-positive-infinity
       sb-ext:double-float-positive-infinity) => nil
2022-04-16 12:44:23 +02:00
Jan Moringen 088a277579 Extend float infinity handling in MAKE-NUMERIC-TYPE 2022-04-16 12:44:23 +02:00
Stas Boukarev d23a2ff60d Disable the (run-program :autoclose-streams) test, too flaky. 2022-04-16 01:11:56 +03:00
Douglas Katzman 4852650364 Add finalizers to run-program streams
Reported by Don Cohen on sbcl-help
2022-04-14 20:21:47 -04:00
Douglas Katzman 7981fb6f7e Funnel COMPILE calls in CLOS through a wrapper function
This simplifies rebinding of the warning and note muffler, and allows
tracing or otherwise intercepting system-generated compilation.

Also: gensym is considered harmful. I'm noticing tons of compilations
to the identical lambda, and it's a lot easier to figure out why
without having to think about symbols that differ for no good reason.
(I suspect that if N threads all need to invoke a GF for the first time
at about the same time, they'll all cache miss, and then all compile
the identical dfun. This is horrible and is need of good solution)
2022-04-14 16:53:10 -04:00
Douglas Katzman a2096d4cf5 Add regression test 2022-04-14 10:06:29 -04:00
Stas Boukarev 68a86e2529 ir2-optimize-jumps: don't delete branches from multiway-branch-if-eq.
multiway-branch-if-eq inserts extra jumps which are not in the
original ir2 and do not correspond to any predecessors.

Reported by Eric Marsden.
2022-04-13 20:13:59 +03:00
Christophe Rhodes b831e0d9ac Fix instances of loop while ... for = (pop ...)
This idiom is used for a loop on a list where inspection or other
action needs to be taken on the list during the rest of each
iteration.  It is straightforwardly reordered by using CAR rather than
POP in the variable clause, and performing POP in the body.
2022-04-10 22:02:11 +01:00
Christophe Rhodes 24538741ad Fix instances of loop repeat .. for .. pattern
Strictly speaking the variable clauses introduced by `for` must
precede the main clause introduced by `repeat`.  By placing the repeat
after the for, the semantics of the loop are changed observably in the
presence of a `finally` clause, which will see the effect of one extra
step of the iteration variable (and, if the step has side-effects,
those side-effects happen one more time).
2022-04-10 22:02:11 +01:00
Marco Heisig a5789ec946 Introduce more fine-grained integer simd pack types.
Split the type (simd-pack[-256] integer) into (simd-pack[-256] (A B)),
where A is one of {signed-byte,unsigned-byte} and where B is one of
{8,16,32,64}.  The benefits of doing so are more precise static type
checking, and a more helpful printed representation of integer SIMD packs.

Additionally, introduce a simd-pack[-256]-any primitive type that can be
used to implement VOPs whose implementation is independent of the actual
SIMD pack type, such as %simd-pack-low or %simd-pack-256-0.  This way, we
can get rid of the clumsy sb-vm:simd-pack[-256]-dispatch macros that lead
to unnecessary code bloat.
2022-04-08 20:06:30 -07:00
Stas Boukarev 2bc2c6d803 arm64: use a dedicated VOP for getting T/NIL from conditionals.
Simpler than wrapping in (if x t nil) and produces better code.
2022-04-07 01:11:31 +03:00
Stas Boukarev 359084a679 Move constraint tests to constraint.pure.lisp 2022-04-06 08:16:00 +03:00
Stas Boukarev 7e66f1f2f2 Avoid wrapping (if predicate t nil) if it's not translated.
Otherwise functions like two-arg-= which already return booleans are
needlessly wrapped and cannot be tail-called.
2022-04-06 08:13:26 +03:00