Commit graph

20468 commits

Author SHA1 Message Date
Douglas Katzman 95d71c33d7 Merge codeblob tree changes from master 2022-06-09 14:40:29 -04:00
Douglas Katzman fdd3c5e5af Patch in revision 5d798d95f3 2022-05-18 22:44:08 -04:00
Douglas Katzman 52efb19000 Recognize bitmap update in aprof 2022-05-18 18:48:35 -04:00
Douglas Katzman caf02fb647 Add unboxed pages to bitmap 2022-05-18 14:12:53 -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 46ebaa57b9 Skip STATE_DEAD threads in save_gc_crashdump() 2022-04-30 20:00:56 -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 c61cae4bb9 Macroize something
When I tried implementing non-prezeroed unboxed pages, the first things
to break were hash-tables because I totally failed to remove the assumption
of 0-fill in the array allocator. The hash-table code is correct as-is,
but might as well keep the checker as an amulet to ward off evil.
2022-04-30 12:15:22 -04:00
Douglas Katzman 5a7e8d9ba7 Improve write_generation_stats again
* Anticipate the division of generation 0 into two kinds of pages-
  those allocated by threads and those allocated by the collector.
  The latter are ok to scan from Lisp because the collector updates
  page_bytes_used() whenever it runs, whereas TLAB pages have
  some concurrency problems that are not easily resolved.
  (Hence the occasional crash in sb-sprof trying to find a code blob)
  Also, we can more easily implement different policies on whether to
  pre-zero generation 0 for the mutators versus collector.

* Allow for writing to a stdio stream or a file descriptor or both, so
  this can be called from Lisp. Avoiding stdio streams in the collector
  is preferable because we've seen many reports that enabling GC logging
  may cause lockup. I've found snprintf() and write() to be more reliable
  in that regard even though the entire printf() family is absent
  from https://man7.org/linux/man-pages/man7/signal-safety.7.html
2022-04-30 11:46:16 -04:00
Douglas Katzman 47b7c77f3e Make private-cons page generation a manifest constant
and choose 6 instead of 0
2022-04-30 11:17:21 -04: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
Stas Boukarev 633b06ba9b Now there can be multiple top-level lambdas in a single component.
Even without block compilation.
2022-04-30 17:18:59 +03: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 15985aeae9 Use FILLER_WIDETAG in dynamic space
instead of code blobs as filler (like in immobile space)
2022-04-30 03:22:51 -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 7cec92a55f Fix a FIXME.
By pushing around the scoping of some special variables. Bonus: We
cons less by not making a new hash table for every top level form,
instead reusing the *SOURCE-PATHS* hash table. (I understand the
intent of wanting to cons fresh objects instead of reusing them, but a
new hash table for every top level form is not nothing in terms of
cost.)
2022-04-29 11:01:27 -07:00
Charles Zhang 18fc1d09df Microoptimize FOP-FUNCALL and friends.
The vast majority of FOP-FUNCALLs the loader will encounter will have
0 arguments. FUNCALL is a good deal faster than APPLY.
2022-04-29 11:01:27 -07:00
Charles Zhang 800e6e6bc0 Make comment match code. 2022-04-29 11:01:27 -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 ce2a45dd0d Use FIND-CONSTANT instead of MAKE-CONSTANT.
To ensure only one LEAF is created.
2022-04-29 11:01:27 -07:00
Charles Zhang 3e30f7ef7f Fix really weird source of cross-host discrepancy.
When block compiling this file, using unquoting rather than read eval
caused some unintuitive list* fops to get dumped on sbcl host, whereas
ccl host wouldn't have used a list* fop. With the reader eval, sbcl
dumps the list structure similarly to CCL. It's so weird that we have
a host sensitivity here, since the dump logic should be host agnostic
at this point, but I suspect it has something to do with how this list
is literally spliced in into the next DEFTRANSFORM, causing
coalescing, and maybe because it was spliced into a host only function
in the same file. ?????????????
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 076075ae36 sb-fasteval: Define RETURN-CONSTANT later
It is unportable/undefined behavior for LOAD-TIME-VALUE to reference
stuff defined in the same file, and doesn't work with block
compilation.
2022-04-29 11:01:15 -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 f6fd6d7bcb Let LOAD-LAYOUT incompatible redefinition errors be restartable.
By reusing %REDEFINE-DEFSTRUCT. This makes loading incompatible
defstructs less brittle when it comes to what order top-level forms in
compiled files get run with respect to literal layout loads.
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 4f4453ee5b Treat deferred packages with respect to recursive loads right.
This subtle situation was encountered when trying to bootstrap asdf.
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
Stas Boukarev 1e7d2505db Highlight the slot clause for bad initforms in defclass. 2022-04-29 20:45:41 +03:00
Stas Boukarev ecb6518979 x86-64: add a vop for (signed-byte-64-p unsigned) 2022-04-29 20:45:41 +03:00
Stas Boukarev fae7b6cbd7 x86-64: add unsigned-signed comparison VOPs. 2022-04-29 20:45:41 +03:00
Christophe Rhodes b0f6cecc4e 2.2.4: will be tagged as "sbcl-2.2.4" 2022-04-29 17:16:59 +01:00
Douglas Katzman 6db04b68c1 Correct a test 2022-04-28 21:15:51 -04:00
Douglas Katzman 813250e7d7 Remove obsolete selections from make-config
* Sparc allows only gencgc, not cheneygc
* PPC/Darwin was removed
2022-04-26 11:07:20 -04:00
Douglas Katzman 2d4c389bc9 Deal with C warnings for sparc-linux
The usual never-ending battle to figure out how to receive the fewest
warnings on the most machines. So today on the machine that I tried,
os_context_register_t has to be unsigned int, not unsigned long,
which is just as likely wrong for some other libc release.
2022-04-26 11:02:24 -04:00
Douglas Katzman 356a849abd Fix editcore's handling of raw slots 2022-04-26 02:11:58 -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
Stas Boukarev 28f8c2085e Assign a block number in split-ir2-block.
Some random unused number for find-dominators to work later. It
happens late enough for the number to not matter.
2022-04-26 03:44:51 +03:00