Commit graph

619 commits

Author SHA1 Message Date
Gabor Melis 289db46c16 sb-manual: do not document unbuilt contribs
Some checks are pending
CL-host / ecl (push) Waiting to run
CL-host / clisp (push) Waiting to run
CL-host / ccl (push) Waiting to run
CL-host / cmucl (push) Waiting to run
CL-host / sbcl (push) Waiting to run
CL-host / compare-xc-host-fasls (ccl, false) (push) Blocked by required conditions
CL-host / compare-xc-host-fasls (clisp, false) (push) Blocked by required conditions
CL-host / compare-xc-host-fasls (cmucl, false) (push) Blocked by required conditions
CL-host / compare-xc-host-fasls (self, false) (push) Blocked by required conditions
Linux arm / build (push) Waiting to run
Linux arm64 / build () (push) Waiting to run
Linux qemu / build (ppc64le) (push) Waiting to run
Linux qemu / build (riscv64) (push) Waiting to run
Linux / build (x86, --with-sb-thread, ) (push) Waiting to run
Linux / build (x86, --without-sb-thread, ) (push) Waiting to run
Linux / build (x86, --without-sb-unicode, ) (push) Waiting to run
Linux / build (x86-64, --with-mark-region-gc --with-nonstop-foreign-call) (push) Waiting to run
Linux / build (x86-64, --with-sb-fasteval --without-sb-eval --with-nonstop-foreign-call, fasteval) (push) Waiting to run
Linux / build (x86-64, --with-sb-thread --with-nonstop-foreign-call --with-tls-based-mv-return, sse4) (push) Waiting to run
Linux / build (x86-64, --with-sb-thread, ) (push) Waiting to run
Linux / build (x86-64, --without-sb-thread, ) (push) Waiting to run
Linux / build (x86-64, --without-sb-unicode, ) (push) Waiting to run
Mac / build (arm64, --with-mark-region-gc --with-nonstop-foreign-call --with-tls-based-mv-return) (push) Waiting to run
Mac / build (arm64, --with-sb-thread --with-nonstop-foreign-call --with-tls-based-mv-return) (push) Waiting to run
Mac / build (x86-64, --with-mark-region-gc --with-nonstop-foreign-call --with-tls-based-mv-return) (push) Waiting to run
Mac / build (x86-64, --with-sb-thread --with-nonstop-foreign-call --with-tls-based-mv-return) (push) Waiting to run
Windows arm64 / build (arm64, clang-aarch64, clangarm64) (push) Waiting to run
Windows / build (x86-64, ucrt-x86_64, ucrt64) (push) Waiting to run
Also, test texinfo generation on github.
2026-09-03 14:09:06 +02:00
Gabor Melis a797aedf9d fix ffi documentation at the source
The generated texinfo files (e.g. ffi.texinfo) are under version
control only to be able to conveniently track the Markdown-to-Texinfo
output until it's deemed stable enough.
2026-08-15 17:50:15 +02:00
Stas Boukarev f832c8e48e ffi.texinfo: struct by value is supported on Windows
[skip ci]
2026-08-15 17:47:32 +03:00
Gabor Melis e45c5c70b5 sb-manual: fix indented code block parsing
... when the first line of the block looks like a list item.
2026-07-24 16:47:02 +02:00
Douglas Katzman 1ce38f9567 Change SSET to not use tombstones
Some checks are pending
CL-host / compare-xc-host-fasls (ccl, false) (push) Blocked by required conditions
CL-host / compare-xc-host-fasls (clisp, false) (push) Blocked by required conditions
Linux arm / build (push) Waiting to run
Linux arm64 / build () (push) Waiting to run
Linux qemu / build (ppc64le) (push) Waiting to run
Linux qemu / build (riscv64) (push) Waiting to run
Linux / build (x86, --with-sb-thread, ) (push) Waiting to run
Linux / build (x86, --without-sb-thread, ) (push) Waiting to run
CL-host / compare-xc-host-fasls (cmucl, false) (push) Blocked by required conditions
CL-host / compare-xc-host-fasls (self, false) (push) Blocked by required conditions
CL-host / ecl (push) Waiting to run
CL-host / clisp (push) Waiting to run
CL-host / ccl (push) Waiting to run
CL-host / cmucl (push) Waiting to run
CL-host / sbcl (push) Waiting to run
Linux / build (x86-64, --with-sb-thread --with-nonstop-foreign-call, sse4) (push) Waiting to run
Linux / build (x86-64, --with-sb-thread, ) (push) Waiting to run
Linux / build (x86-64, --without-sb-thread, ) (push) Waiting to run
Linux / build (x86-64, --without-sb-unicode, ) (push) Waiting to run
Mac / build (arm64, --with-mark-region-gc --with-nonstop-foreign-call) (push) Waiting to run
Mac / build (arm64, --with-sb-thread --with-nonstop-foreign-call) (push) Waiting to run
Mac / build (x86-64, --with-mark-region-gc --with-nonstop-foreign-call) (push) Waiting to run
Mac / build (x86-64, --with-sb-thread --with-nonstop-foreign-call) (push) Waiting to run
Windows arm64 / build (arm64, clang-aarch64, clangarm64) (push) Waiting to run
Windows / build (x86-64, ucrt-x86_64, ucrt64) (push) Waiting to run
Linux / build (x86, --without-sb-unicode, ) (push) Waiting to run
Linux / build (x86-64, --with-mark-region-gc --with-nonstop-foreign-call) (push) Waiting to run
Linux / build (x86-64, --with-sb-fasteval --without-sb-eval --with-nonstop-foreign-call, fasteval) (push) Waiting to run
Avoids 1 comparison and branch in the probe loop
2026-07-10 01:15:48 +00:00
Gabor Melis 2be4173812 various documentation changes
Some checks are pending
CL-host / ecl (push) Waiting to run
CL-host / clisp (push) Waiting to run
CL-host / ccl (push) Waiting to run
CL-host / cmucl (push) Waiting to run
CL-host / sbcl (push) Waiting to run
CL-host / compare-xc-host-fasls (ccl, false) (push) Blocked by required conditions
CL-host / compare-xc-host-fasls (clisp, false) (push) Blocked by required conditions
CL-host / compare-xc-host-fasls (cmucl, false) (push) Blocked by required conditions
CL-host / compare-xc-host-fasls (self, false) (push) Blocked by required conditions
Linux arm / build (push) Waiting to run
Linux arm64 / build () (push) Waiting to run
Linux qemu / build (ppc64le) (push) Waiting to run
Linux qemu / build (riscv64) (push) Waiting to run
Linux / build (x86, --without-sb-unicode, ) (push) Waiting to run
Linux / build (x86, --with-sb-thread, ) (push) Waiting to run
Linux / build (x86, --without-sb-thread, ) (push) Waiting to run
Linux / build (x86-64, --with-mark-region-gc --with-nonstop-foreign-call) (push) Waiting to run
Linux / build (x86-64, --with-sb-fasteval --without-sb-eval --with-nonstop-foreign-call, fasteval) (push) Waiting to run
Linux / build (x86-64, --with-sb-thread --with-nonstop-foreign-call, sse4) (push) Waiting to run
Linux / build (x86-64, --with-sb-thread, ) (push) Waiting to run
Linux / build (x86-64, --without-sb-thread, ) (push) Waiting to run
Linux / build (x86-64, --without-sb-unicode, ) (push) Waiting to run
Mac / build (arm64, --with-mark-region-gc --with-nonstop-foreign-call) (push) Waiting to run
Mac / build (arm64, --with-sb-thread --with-nonstop-foreign-call) (push) Waiting to run
Mac / build (x86-64, --with-mark-region-gc --with-nonstop-foreign-call) (push) Waiting to run
Mac / build (x86-64, --with-sb-thread --with-nonstop-foreign-call) (push) Waiting to run
Windows arm64 / build (arm64, clang-aarch64, clangarm64) (push) Waiting to run
Windows / build (x86-64, ucrt-x86_64, ucrt64) (push) Waiting to run
- make bug reporting instructions more consistent

- add DOCUMENTATION file

- deduplicate Texinfo @cindex lines

- fix typos and URLs

- update obsolete references to Texinfo

- standardize the spelling of HyperSpec
2026-07-02 14:47:25 +02:00
Gabor Melis 739a65fe11 doc: fix some typos and readability issues
Thanks to Štěpán Němec.
2026-07-01 15:14:58 +02:00
Gabor Melis 2c524ff00b Reduce core size impact of docstring normalization
- Conditionalize it on #+sb-doc.

- Drop Markdown blockquote support (it's not needed by any docstring
  currently).

- Make the code more compact.

Without :SB-DOC, the core size impact is thus zero. With :SB-DOC, the
core size is increased by ~0.05% (~10kB).
2026-07-01 15:14:37 +02:00
Sylvia Harrington cb716e24d6 sb-simd: arm64 support 2026-07-01 01:15:08 +03:00
Gabor Melis 1b4ec23342 doc: remove unnecessary markup 2026-06-30 17:00:48 +02:00
Stas Boukarev ca75aca96a Make sb-int:misc-index foldable, flushable 2026-06-29 17:14:19 +03:00
Gabor Melis ab6fa91796 sb-manual: add links from/to PAX world 2026-06-29 14:01:32 +02:00
Gabor Melis 34812e52a1 sb-manual: readd concepts 2026-06-29 14:01:32 +02:00
Gabor Melis 40658bfd6a sb-manual: implement concept indexing 2026-06-29 14:01:32 +02:00
Gabor Melis 7901ac4063 doc: fix compilation on windows 2026-06-29 14:01:31 +02:00
Gabor Melis 61e352d105 sb-manual: add support for [label](uri) and [label][id] 2026-06-29 14:01:31 +02:00
Gabor Melis 7c2785fe2a Add support for (DOCUMENTATION ... 'declaration)
- Add docstrings for user-facing declaration.

- Fix the hacks for declarations in the manual.

- Add documentation of DOCUMENTATION extensions to the manual.

- Add a "Declaration Index" appendix to the manual.
2026-06-29 14:01:31 +02:00
Gabor Melis b3bfe02876 doc: update generated texinfo files 2026-06-29 14:01:31 +02:00
Gabor Melis 4271a2f375 doc: PAXlike docs
Summary
-------

Implement of a subset of PAX so that we can write PAX:DEFSECTIONlike
forms that supports the same restricted Markdown that we use for
docstrings and generate doc/manual/*.texinfo files from them.

Without PAX
-----------

There is no hard dependency on PAX. When the new SB-MANUAL contrib is
loaded, one can M-. around in documentation (sections are variables),
and function docstrings can now link to sections.

The generated Texinfo files are quite close to the originals, with
some loss of "semantic" markup: e.g. Markdown has `FOO` but no
@var{FOO} and @code{FOO}. We didn't derive much practical benefit from
that distinction.

With PAX
--------

(SB-MANUAL::SWITCH-TO-PAX) ensures that PAX is loaded and patches things
up, as if everything had been defined with PAX to begin with. Now, we
get PAX::@BROWSING-LIVE-DOCUMENTATION for low-latency, interactive
documentation work and PAX::@GENERATING-DOCUMENTATION for auto-linked
documentation.

Notable features:

- auto-generated links within the manual: if SB-EXT:EXIT is mentioned,
  then it's linked to its documentation.

- auto-generated links to the CLHS (these links are red in PDF)

- locatives (e.g. the "[function]" in "- [function] SB-EXT:EXIT" are
  also links and they go to the sources on GitHub (in live browsing,
  they tell Slime to open the definition)

Details
-------

- Factor out the Markdown-to-Texinfo code into a new SB-MANUAL
  contrib.

- Convert doc/manual/*.texinfo files to PAXlike DEFSECTION format and
  add each chapter as a contrib/sb-manual/doc/<chapter>.lisp file.

- Fix a *lot* of small issues during the conversion.

- Make doc/make-doc.sh regenerate the all .texinfo files except
  sbcl.texinfo and backmatter.texinfo.

- Fix docstrings of Lisp definitions used in the manual to conform to
  the supported Markdown syntax.

- Retain the Texinfo function, variable and type indicies but drop the
  concept index. There is no obvious way to support that in Markdown,
  and it was used rather sporadically rather incomplete.

- Even with  the new features, the  amount of Lisp code  didn't change
  significantly.

- See contrib/sb-manual/README for the Todo list
2026-06-29 14:01:31 +02:00
Gabor Melis 2868d4dd0e doc: define and clean up docstring syntax
Previously, the format was ad-hoc and implicitly defined by
doc/manual/docstrings.lisp. Now, it is a bit less ad-hoc and still
implicitly defined docstrings.lisp.

The syntax is now a simple, strict subset of Markdown with escaping
extensions. The long comment near the top of docstrings.lisp has the
documentation.

Some notable changes:

- Markdown backticks are supported (e.g. `exit`(3),
  `/usr/local/bin/`).

- When the heuristic codification is overly eager, use backslashes to
  prevent codification (e.g. \\HTTP, where the backslash is doubled
  assuming that this is in a docstring).

- It is now possible to have code that's not downcased
  (`\\\\AC_LOCAL`, backslashes doubled again).

- Fenced code blocks are supported (but use them sparingly).

- Texinfo @itemize is used instead of @table.

- Texinfo @var was inconsistently used at best. What used to be @var
  is now simply @code.

For the user, the most visible effect of this change is that the
manual has much fewer errors in codification, and a few docstrings
have backticks and escapes in them, which should be acceptably
readable in the sources or via CL:DOCUMENTATION.
2026-05-30 11:14:29 +02:00
Gabor Melis cec8b39657 doc: improve @code{}ification in the user manual
1. Previously, all uppercase words were downcased and enclosed in
texinfo @code{}, which didn't handle many common cases correctly. With
this change, only words that name interned symbols or packages are
codified:

        POSIX -> POSIX (was @code{posix})
        UDP -> UDP (was @code{udp})

    The symbol name is looked up in the heuristically determined package,
    which tries to match the package in the IN-PACKAGE form in effect
    where the docstring is in the sources. This means that if M-. works in
    Slime, then the documentation generator should be able to figure out
    that it's code.

    This change revealed several typos in the docstrings where the all
    uppercase word did not correspond to the name of an interned
    symbol.

2. Lowercase suffixes are now stripped from the word:

    STRINGs -> @code{string}s (was STRINGS)
    CLASSes -> @code{class}es (was CLASSes)
    SETFable -> @code{setf}able (was SETFable)

3. #\' is now a delimiter, so this works:

    ARRAY's -> @code{array}'s (was ARRAY's)

4. Trailing #\: characters followed by whitespace are considered
delimiters:

    NIL: -> @code{nil}: (was @code{nil:})

5. Fixed the *NOT-SYMBOLS* opt-out mechanism (renamed to *NOT-CODE*)
and added an opt-in (*CODE*).

Overall, the new heuristics work much better with current docstring
style. However, there is no way to get all cases right, so explicit
markup in docstrings will be needed. Fixing that would require even
more of MGL-PAX, so I'm stopping here.

Also, we should probably have the generated documentation (a single
file, in a format suitable for diffing) under version control so that
we can detect documentation typos more easily.
2026-05-30 11:14:29 +02:00
Gabor Melis 02bd195c1a doc: tweaks 2026-05-30 11:14:29 +02:00
Gabor Melis 92d060d082 Housekeeping: whitespace, typos, comments, credits 2026-05-30 10:57:36 +02:00
Gabor Melis 48063e4170 doc: document sb-introspect 2026-05-30 10:57:36 +02:00
Gabor Melis d9b4878a31 Make FDEFINITION not strip encapsulation
This fixes the ANSI non-compliance passed down from early
CMUCL (1991-10-31). The bug was that FDEFINITION did not return the
same value as SYMBOL-FUNCTION for symbols (lp#799533). The fix is an
incompatible change but only affects encapsulated (e.g. TRACEd and
SP-PROFILE:PROFILEd) non-generic functions.

However, encapsulations belong to the definition (the name) and not to
the function associated with the name, so (SETF (FDEFINITION NAME) FN)
strips encapsulations from FN and keeps the encapsulations of NAME.

- SB-EXT:UNENCAPSULATED-FUNCTION was added.

- Encapsulated functions are printed as

    #<FUNCTION FOO ENCAPSULATED>

  or, if they have no proper name, as

    #<FUNCTION FOO ENCAPSULATED {B1782332}>

  This is the same as for unencapsulated functions except for the
  additional " ENCAPSULATED".

- Unused slots were removed from SB-PROFILE:PROFILE-INFO.

- Since generic function identity is stable in face of encapsulation,
  CLOS is largely unaffected by this change.
2026-05-30 10:55:46 +02:00
Carl Gay 1f3beec71d Fix URLs in the Manual "Introduction"
Some broken links but mostly using the URL that was the target of a redirect.
2026-02-18 14:26:18 -05:00
Stas Boukarev 528de53506 Typo.
[skip ci]
2026-02-13 01:41:12 +03:00
Gabor Melis c90e6cde90 Document --tls-limit 2026-02-11 11:06:20 +01:00
Jesse Bouwman da0a051bc4 with-alien struct initialization 2026-02-02 00:23:18 +03:00
Jesse Bouwman 7f4c1e2174 Support stack-allocation of struct-typed alien funcall return values using with-alien 2026-02-02 00:23:18 +03:00
Jesse Bouwman e9baa62bff Support struct-by-value for x86-64 and ARM64 foreign calls
Add the ability to pass and return C structs by value in alien
function calls and callbacks on x86-64 linux and ARM64 darwin. Note

- x86-64: eightbyte classification with INTEGER/SSE register classes
- ARM64: HFA detection for float aggregates, GPR pairs for small structs

Large structs (>16 bytes) use hidden pointer passing. Small structs
are unpacked from registers into heap on return.

Callbacks preserve the hidden return pointer across the Lisp call and
copy results to the caller-provided destination.
2026-01-14 09:53:37 +03:00
Stas Boukarev 7cfd6dbda5 Change the ctz pattern to (lognor n (- n))
No particular reason other than it's shorter.
2025-12-12 02:18:58 +03:00
Stas Boukarev 1e60b7df45 Mention signed modular arithmetic. 2025-12-10 20:04:30 +03:00
Stas Boukarev a317e17646 Remove unsigned-word-find-first-bit 2025-12-10 18:50:37 +03:00
Stas Boukarev 2c3722ef6c Recognize (integer-length (ldb (byte 64 0) (1- (logand n (- n))))) as ctz 2025-12-10 18:29:01 +03:00
Christophe Rhodes 82f7993787 Document :newline option for external formats
After discussion on sbcl-help between Dave Tenny and tpeplt
2025-11-30 16:47:28 +00:00
Douglas Katzman 8c8d39553a Remove sentence which has been untrue for about 5 years 2025-11-09 18:53:29 -05:00
Stas Boukarev bcbb189bd7 More understandable wording in the manual. 2025-09-22 16:42:02 +03:00
Stas Boukarev 69f1ea3279 Update the manual. 2025-09-22 13:55:11 +03:00
Stas Boukarev 4b6df4f435 Remove an unused file. 2025-06-19 23:15:42 +03:00
Charles Zhang 2c56c5901d Auto-stack-allocate local functions even with multiple references.
With all the machinery in place to insert cleanup code correctly given
multiple derived dynamic extents, we just need to weaken the condition
for stack allocating a closure from having a single reference to
having all references be downward funarg uses.

Update the manual not only to document this new optimization but also
the existing way for users to declare downward funargs for their own
functions.

Also, there are a couple cases in the self-build where this
optimization applies. Remove those explicit dynamic extent
declarations which no longer do (or never did) anything and let the
compiler prove/auto-stack-allocate many of the valid cases. This makes
it easier to find the cases that the compiler cannot prove safe to
stack allocate yet, which led to finding some potential optimizations
that don't work yet, which failing test cases have been added for.
2025-06-01 12:43:15 +02:00
Charles Zhang aae95ff05d Add more documentation related to tracing encapsulation.
Some checks are pending
CL-host / ecl (push) Waiting to run
CL-host / clisp (push) Waiting to run
CL-host / ccl (push) Waiting to run
CL-host / cmucl (push) Waiting to run
CL-host / sbcl (push) Waiting to run
CL-host / compare-xc-host-fasls (ccl, false) (push) Blocked by required conditions
CL-host / compare-xc-host-fasls (clisp, false) (push) Blocked by required conditions
CL-host / compare-xc-host-fasls (cmucl, false) (push) Blocked by required conditions
CL-host / compare-xc-host-fasls (self, false) (push) Blocked by required conditions
Linux arm / build (push) Waiting to run
Linux arm64 / build (--with-sb-thread) (push) Waiting to run
Linux qemu / ppc64le (push) Waiting to run
Linux / build (x86, --with-sb-thread, ) (push) Waiting to run
Linux / build (x86, --without-sb-thread, ) (push) Waiting to run
Linux / build (x86, --without-sb-unicode, ) (push) Waiting to run
Linux / build (x86-64, --with-mark-region-gc) (push) Waiting to run
Linux / build (x86-64, --with-sb-fasteval --without-sb-eval, fasteval) (push) Waiting to run
Linux / build (x86-64, --with-sb-thread, ) (push) Waiting to run
Linux / build (x86-64, --with-sb-thread, sse4) (push) Waiting to run
Linux / build (x86-64, --without-sb-thread, ) (push) Waiting to run
Linux / build (x86-64, --without-sb-unicode, ) (push) Waiting to run
Mac / build (--without-sb-thread, x86-64) (push) Waiting to run
Mac / build (arm64, --with-mark-region-gc) (push) Waiting to run
Mac / build (arm64, --with-sb-thread) (push) Waiting to run
Mac / build (x86-64, --with-mark-region-gc) (push) Waiting to run
Mac / build (x86-64, --with-sb-thread) (push) Waiting to run
Windows / build (push) Waiting to run
2025-03-11 12:25:54 +01:00
Charles Zhang 1f586e8c1b Add step* command documentation. 2025-03-07 21:14:44 +01:00
Charles Zhang f97a89306e Resurrect breakpoint commands and breakpoint based stepping.
The code for breakpoint commands in the debugger inherited from CMU CL
was deleted in 8a8a892280, presumably
because it was slightly broken on x86oids due to a constant being
wrong. c7e96cb3045bc64179b9e81f266fb611aa67e1ac fixed that, so the
breakpoint commands can be resurrected. The step command based on
breakpoints has been included but under a different name because the
single stepper exists now. All the functionality of the
instrumentation based single stepper could likely be subsumed in the
breakpoint based stepper without the instrumentation overhead, but for
now let's have them coexist.
2025-03-07 20:44:00 +01:00
Charles Zhang 4cc0bdabab callbacks: WITH-ALIEN-CALLABLE, redefinition semantics, recycling
Some checks failed
CL-host / ecl (push) Waiting to run
CL-host / clisp (push) Waiting to run
CL-host / ccl (push) Waiting to run
CL-host / cmucl (push) Waiting to run
CL-host / sbcl (push) Waiting to run
CL-host / compare-xc-host-fasls (ccl, false) (push) Blocked by required conditions
CL-host / compare-xc-host-fasls (clisp, false) (push) Blocked by required conditions
CL-host / compare-xc-host-fasls (cmucl, false) (push) Blocked by required conditions
CL-host / compare-xc-host-fasls (self, false) (push) Blocked by required conditions
Linux arm / build (push) Waiting to run
Linux arm64 / build (--with-sb-thread) (push) Waiting to run
Linux / build (x86, --with-sb-thread, ) (push) Waiting to run
Linux / build (x86, --without-sb-thread, ) (push) Waiting to run
Linux / build (x86, --without-sb-unicode, ) (push) Waiting to run
Linux / build (x86-64, --with-mark-region-gc) (push) Waiting to run
Linux / build (x86-64, --with-sb-fasteval --without-sb-eval, fasteval) (push) Waiting to run
Linux / build (x86-64, --with-sb-thread, ) (push) Waiting to run
Linux / build (x86-64, --with-sb-thread, sse4) (push) Waiting to run
Linux / build (x86-64, --without-sb-thread, ) (push) Waiting to run
Linux / build (x86-64, --without-sb-unicode, ) (push) Waiting to run
Mac / build (--without-sb-thread, x86-64) (push) Waiting to run
Mac / build (arm64, --with-mark-region-gc) (push) Waiting to run
Mac / build (arm64, --with-sb-thread) (push) Waiting to run
Mac / build (x86-64, --with-mark-region-gc) (push) Waiting to run
Mac / build (x86-64, --with-sb-thread) (push) Waiting to run
Windows / build (push) Waiting to run
Linux qemu / ppc64le (push) Failing after 1s
* Define a way to free alien callbacks so that we can recycle their
trampoline entry points per function type, instead of indefinitely
eating static space.

* Document and define redefinition semantics for alien callables,
allowing incremental redefinition. These semantics are based on how
CMU CL handles redefining callbacks, with the difference that type
incompatibility is stricter, and incompatible redefinitions invalidate
the old callback. I'm not sure whether have strict type equality or
having a weaker notion of compatibility is better. The docstring is
cribbed from CMU CL, and the interface now matches their DEF-CALLBACK
closely otherwise.

* ALIEN-LAMBDA now returns a Lisp function rather than a callback,
since its semantics were always a bit suspicious: it allocated a new
entry trampoline per closure allocation, and users would've needed to
call the new free function on the value explicitly after it was done
being used somehow in order to recycle trampoline. The symbol is
unexported but used by CFFI prior to commit
22762bf8d2.

* Export WITH-ALIEN-CALLABLE instead, which imitates the dynamic
extent behavior of WITH-ALIEN and frees the alien callback at the end
of its scope. This allows a convenient, exported way to create local
callables that close over Lisp values without indefinitely allocating
trampolines, since the types of the local alien functions are constant
and hence the entry point trampoline SAPs will just be reused.

* Define documentation methods for ALIEN-VALUEs and names bound by
SB-ALIEN:DEFINE-ALIEN-CALLABLE.

* The SB-ALIEN:DEFINE-ALIEN-CALLABLE interface does linkage by name,
so we can remove various non-exported functions that tried to deal in
ALIEN-VALUEs directly

* We don't need to bother with caching callback SAPs by function,
since we recycle SAPs per function type for local alien callbacks and
type-incompatibly redefined name-bound alien callbacks.
2025-02-17 23:40:45 +01:00
Charles Zhang 8351107b85 Inline alien callback Lisp wrappers.
* Declare ENTER-ALIEN-CALLBACK as unsafe.

* Instead of trying to share the Lisp from alien type parsing code for
all callbacks with the same type signature, just inline the wrapper
code directly into the body of the Lisp function. This simplifies how
callbacks are handled and allows us to remove the Lisp trampoline
layer as well, thereby reducing some call indirection
overhead. Another benefit is that the declared types of the arguments
are available to the compiler now that the type parsing code and the
actual function body are in the same function, allowing the compiler
to use unboxed arithmetic for addition when the arguments are both
declared sb-alien:INT for example.

* We dispose of the ALIEN-CALLBACK macro which associates a callback
entry point directly to an existing Lisp function. This functionality
was not exported and people don't seem to use callbacks in this
way. If the user wants a Lisp function that is associated with
multiple differently typed callbacks, the user can do so manually by
declaring a separate Lisp function and defining multiple alien
callables calling it. It is better to allow the user the option of
using unboxed arithmetic than to default to allowing differently typed
callbacks for the same function.

* The desire to share these Lisp wrappers may have been due to space
concerns, but generally speaking other kinds of argument and result
coercion code is typically inlined and furthermore the type parsing
code resides in GC-managed space, so it's okay that the code now
exists per alien callable instead of per type signature. It's actually
more of a concern that assembler wrappers are allocated per alien
callable in uncollected static space.

* A micro-benchmark with an alien-funcall of a callback that adds two
numbers shows a 5-10% improvement in speed, presumably due to losing a
layer of indirection.

* Update the internals manual entry accordingly, noting in passing how
foreign threads are handled specially.
2025-02-10 15:08:24 +01:00
Christophe Rhodes b108f82926 Fix a typo in the manual.
Fixes lp#2084370, reported by Koga Kazuo
2024-10-26 09:14:08 +01:00
Douglas Katzman 3730b247da Briefly explain the to-be-commited #+linkage-space patch
(which sounds unfortunately similar to #+linkage-table
for alien linkage, but happily that old feature name has been
eradicated, as all platforms implement the alien linkage table
and there are no runtime choices based on presence/absence)
2024-06-13 17:44:34 -04:00
Douglas Katzman 7e9b907b11 Rename alien-linkage-table-space (again)
It was previously renamed in rev 851cbd2b but the new name was too wordy.
The motivation here is the same: some pending changes for x86-64 that make
lisp-to-lisp calls go through a linkage table (almost doing away with
all FDEFNs) is nearly ready to be committed for real now.
2024-06-12 21:23:00 -04:00
Philipp Marek 8c614de019 Add missing argument in documentation. 2024-06-12 15:04:24 +03:00