Commit graph

53 commits

Author SHA1 Message Date
Douglas Katzman 8c8d39553a Remove sentence which has been untrue for about 5 years 2025-11-09 18:53:29 -05: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
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
Douglas Katzman 6bcc976b70 Remove all remnants of FSHOW and QSHOW
Keep whatever little bit of C code was enabled by qshow for #+win32,
and good riddance to everything else.
2023-07-15 11:58:25 -04:00
Douglas Katzman 2c5664e677 Define alien-linkage-table-space-size as a constant
but not the -END.
This works better for relocatable alien linkage space (pending commit).
2022-09-08 23:45:44 -04:00
Douglas Katzman 851cbd2b77 Rename LINKAGE-TABLE to ALIEN-LINKAGE-TABLE
Anticipating that FDEFNs can be subsumed by something other than 1st-class
objects, we'll need a unified space of lisp function pointers. I tried to pick
a non-conflicting name for such space, but "linkage table" really fits.
Therefore this change renames the existing table. It was FOREIGN-LINKAGE-TABLE
in CMUCL, but "ALIEN" requires fewer keystrokes and matches DEFINE-ALIEN.
2022-09-03 17:27:36 -04:00
Douglas Katzman e0d0a4579c Remove inapplicable documentation
It was explicitly added in 60f84eda5c, which caused me some skepticism
as I saw no merit to keeping deceptive information in-tree. i.e. some of the
internals are not right for SBCL (and possibly not CMUCL any more) such as:

- SBCL executables don't produce three ELF files, there is no linker.sh etc.
- object.tex is more wrong than right. The widetags are completely wrong;
  as are nearly all the descriptions of various headered object types.
  (functions don't contain a pointer to "next function", and they don't embed
  their FTYPE in the raw data portion, etc etc)
- fasl.tex is sufficiently wrong as to be of little utility - the entire point
  of our LEB128-encoding is to remove bifurcation of all fops as it alludes to.
  Not to mention there's no fop-uniform-vector, fop-code-format,
  fop-pop-for-effect, and others.
- foreign-linkage-symbols and linkage-table-data aren't the same at all.
- our INFO database uses <category,kind> for the taxonomy, but CMUCL
  named them <class,type> and said that they are compared via STRING=.
  Neither is more obviously right, so this is just ridiculously confusing.
- The interpreter documentation is flat-out 100% wrong as pertains to SBCL.

All files files removed in this change are obsolete relative to SBCL, but to
revise them in-place would be worse - anyone would wonder whether they document
the current state of SBCL or CMUCL. The right fix would have been to take out
dangling links from our docs - someone can still do that! -  and not to add
explictly incorrect text that increases the amount of stuff you have to
mentally weed out when doing "git grep".

Some "internals" docs are more prosasic and theoretical than detail-oriented,
so it's hard to say whether they're right or wrong. (Is it wrong to postulate
counterfactuals like "it would be nice if x,y,z held ..."?)
I didn't know what to do with Makefile, so I removed it, as well as skeletal
table-of-contents files.
2022-08-27 11:07:23 -04:00
Douglas Katzman bd0d6c30fb Use all 1s for NO-TLS-VALUE
So that TLS can be initialized using memset(ptr,0xff,size).

In making this change I discovered that scavenge_control_stack() was slightly
inefficient - if (is_lisp_pointer() && !from_space_p()) there is no need
to check the scavtab[] entry.

Also the text in 'objects-in-memory' was wrong- no-tls-value marker
never appears "in" a symbol's TLS field, only on the binding stack.
2022-06-06 11:42:13 -04:00
Douglas Katzman e61b98dc5f Remove QSHOW_SIGNALS and FSHOW_SIGNAL
And all remarks about enabling those. Worst advice ever.
The comments even say they cause more problems.
("Yo dawg, I herd u like locks so I added extra locks
so you can deadlock while u deadlock")

I don't know what QSHOW_SAFE was either.
2022-05-12 15:33:03 -04:00
Charles Zhang 60f84eda5c Check in some CMU CL documentation verbatim.
Our source code makes direct reference to some internals .tex files
found only in the CMU CL source, and even our own manual has direct
references to the CMU CL manual because the corresponding sections
haven't been written yet (for over 2 decades).

We might as well check-in the original documentation. I doubt anyone
will ever be paid to write or even finish porting such high quality
documentation, and it would be a shame to have 95% correct internals
documentation be completely missing as well.
2022-04-13 01:54:28 -07:00
Douglas Katzman 478773c312 Delete mentions of *STATIC-FOREIGN-SYMBOLS* 2021-06-29 17:27:40 -04:00
Douglas Katzman ad751e288f Perform housecleaning 2021-04-07 17:25:08 -04:00
Douglas Katzman 8a2df46b46 Rip out the (ARRAY NIL (*)) is STRINGP logic
This undoes parts of 902e9373 in the interest of following the spec by its
intent and de-facto correct interpretation versus a theoretical view
that is of little practical value.

As the test file shows, among all other implementations examined, the consensus
is 8-to-2 against treating (VECTOR NIL) as a string even where support for
(ARRAY NIL) as a type exists. And the minority stance is weak- both outliers
upgrade NIL to their widest character type in MAKE-STRING, proving beyond a
doubt that they don't really think that NIL means empty type in that usage.
So now SBCL goes along with that for maximum compatibility with everyone.

I considered a hypothetical build-time #+vector-nil-is-string feature,
but it's not worth cluttering the code for. Nobody would/should use it.
2020-10-29 13:05:59 -04:00
Philipp Marek 79dd83cc95 A global search/replace of neccessary => necessary. 2019-10-21 15:07:06 +03: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 9ee5e0873f Combine arch_write_linkage_table_jmp() and _ref() into one thing 2018-03-04 20:48:28 -05:00
Jan Moringen 3e02f51b9a Remove .cvsignore files 2016-11-30 16:50:45 +01:00
Douglas Katzman bdf211ee45 Fix whitespace by manually removing stamp file.
Apparently the canonicalizer can latch into a state where it thinks
it does not need to run; however if run, it will have an effect.
2016-02-11 20:07:16 -05:00
Christoph Egger 3ac58dc13f Adding curly braces around subgraphs to make things build with current
dot.
2015-02-15 19:01:46 +03:00
Stas Boukarev ced29bbb5c Optimize special variable binding on sb-thread.
Remove a level of indirection when unbinding special bindings, instead
of saving a symbol on the binding stack, and then accessing its
tls-index to unbind it, save the tls-index directly, saving one memory
read.
2013-09-19 23:30:09 +04:00
Lutz Euler 04d3bdf96e Make clean.sh clean up doc/internals, too.
For completeness and equal treatment with doc/manual.
2013-06-10 12:37:22 +02:00
Lutz Euler 2e8076a2fd git: Add entries for the HTML manual to doc/internals/.gitignore.
These are the files and directories generated by "make html" in
doc/internals.
2013-06-10 12:37:22 +02:00
Lutz Euler a3d4610158 git: New file doc/internals/.gitignore.
Ignore the files generated by building the internals manual.
Copied and adapted from doc/manual/.gitignore.
2013-06-09 17:58:52 +02:00
Lutz Euler e35a79c777 Typo and other small fixes in the manuals and the man page
That is, in the texinfo files of the user manual, the internals manual,
and in sbcl.1. Fix spelling and grammar errors, put sufficiently many
dots in abbreviations and consistently write "SBCL" in all caps in
prose. Also, SIGABORT should be SIGABRT.
2012-10-13 21:11:43 +02:00
Lutz Euler 2273f3a907 Correct the info directory entry in sbcl-internals.texinfo.
The file name was wrong so that the info directory link wasn't working.
LP #1023175, thanks to Orivej Desh for the report and the fix.
2012-07-11 21:52:36 +02:00
Alastair Bridgewater e3f495427d 1.0.34.10: New chapter for internals manual.
* Chapter: Objects In Memory, describing type tags and heap object
layouts.
2010-01-25 03:47:20 +00:00
Gabor Melis cda9c2cef7 1.0.27.17: faster local calls on x86/x86-64
Instead of JMPing to TARGET, CALL a trampoline that saves the return
pc and jumps. Although this is an incredibly stupid trick, the paired
CALL/RET instructions are a big win.
2009-04-21 11:33:38 +00:00
Gabor Melis 952d16ab58 1.0.27.14: bias x86oid frame pointer
Forward port of Alastair Bridgewater's patch.

Duplicate it on x86-64.

Make it so that fp points to ocfp just as if the call had been made by
CALL to a function with the standard prologue "PUSH EBP; MOV ESP,
EBP".

Fix the debugger.
2009-04-21 11:25:51 +00:00
Gabor Melis 2973941cf2 1.0.27.11: swap ocfp and return-pc slots in x86oid call frames
Forward port of Alastair Bridgewater's patch. Also, port it to x86-64.
Bring x86 and x86-64 sources closer in the process.

Plus cleanups, indentation, remove dead code, comments, more checks.
2009-04-21 10:24:15 +00:00
Gabor Melis eadeb722a6 1.0.25.48: signals internals doc 2009-02-16 22:20:39 +00:00
Gabor Melis 3dd90b64c3 1.0.25.46: restore errno in signal handlers 2009-02-16 22:19:27 +00:00
Gabor Melis 89aafeff18 1.0.25.35: check that gc signals are unblocked
... when alloc() is called and when calling into Lisp.
2009-02-16 21:54:06 +00:00
Gabor Melis 85e1967527 1.0.25.30: INTERRUPT-THREAD without RT signals
All non-win32 platforms converted to use normal signals
(SIGINFO/SIGPWR) to implement INTERRUPT-THREAD.

Remove mention of RT signals from the internals manual.
2009-02-16 21:45:22 +00:00
Gabor Melis ce027af4a3 1.0.25.18: it's only SHOW
- fix compilation with QSHOW

- SHOW prints thread id on threaded builds

- SHOWing os_threads

  - do not print pthread_self() that's the job of SHOW
  - always print thread ids with %lu
  - states with %x

- add more SHOW to ease debugging

- gc_stop_the_world: don't flood with FSHOW_SIGNAL when waiting for
  another thread to change states

- signal safe SHOW

  (if QSHOW_SAFE is defined)
2009-02-16 21:31:32 +00:00
Christophe Rhodes fab0742469 1.0.9.48: texi2pdf rework (Aymeric Vincent sbcl-devel 2007-09-05)
It looks likely that texi2dvi is more ubiquitous than texi2pdf,
	so just apply the patch.
	... (plus whitespace and .cvsignore collateral changes).
2007-09-09 07:32:28 +00:00
Nikodemus Siivola dcf8b8ccc1 1.0.4.3: interrupt and GC issues
* Add WITHOUT-INTERRUPTS to WITHOUT-GCING.
 * Warn if WITH-INTERRUPTS nested in WITHOUT-GCING.
 * Make sure that SIG_STOP_FOR_GC and SIG_RESUME_FROM_GC are enabled on
   threaded builds before calling into SUB-GC from the runtime.
 * Better WITHOUT-GCING, WITHOUT-INTERRUPTS, and WITH-INTERRUPTS
   documentation.
 * Internals documentation about POSIX signal safety rules.
2007-03-26 10:30:21 +00:00
Christophe Rhodes 5775bbb100 0.9.17.11:
Scribble some notes on funcallable instances before I forget.
2006-10-09 14:56:43 +00:00
Gabor Melis 26bbfd93d0 0.9.17.10: async unwind for specials
* in UNBIND zero the symbol before the value
  * in UNBIND-TO-HERE zero the value even if the symbol is zero
2006-10-06 11:44:20 +00:00
Christophe Rhodes 83400ca414 0.9.14.2:
Happy birthday to me!

	Fix the internals manual
2006-06-28 08:12:29 +00:00
Christophe Rhodes e404d36bb8 0.9.13.4:
Explicitly disallow specializations on new-value for (setf
	slot-value-using-class), as suggested by Levente Mezaros
	sbcl-devel 2006-05-09.
	... documentation
	... internals documentation
	... also one or two other small cleanups: don't keep dfun
		information in special-case generic functions; make
		metaobject-protocol-violation an error, not just a
		condition.
2006-05-28 11:02:02 +00:00
Christophe Rhodes 67a2963059 0.9.10.19:
Add Alastair Bridgewater's chapter about calling conventions
2006-03-07 07:34:15 +00:00
Christophe Rhodes 04d819bb1a 0.9.8.27:
Merge patch from James Bielman fixing self-build under Win32.
	... a little bit of an accident ensued; I ran
		canonicalize-whitespace on .sh files, which seemed to
		work (except on wc.sh) until it scribbled all over
		make.sh, confusing the shell interpreter utterly.
	... the resulting files have built the system, nevertheless.
2006-01-09 13:00:17 +00:00
Christophe Rhodes 4ace729926 0.9.7.20:
Add documentation of the various SLOT-VALUEish optimizations
	performed.
	... and some FIXMEs where either (a) I'm not sure what's going on
		or (b) something fishy is happening.
2005-12-08 17:43:45 +00:00
Christophe Rhodes b544f7bf68 0.9.7.17:
Document what we've learnt about discriminating functions
	in the internals manual
	... now we depend on dot (graphviz) to draw pretty state
		transition graphs.
	... lots o' text.  I hope it's clear.

	(it would be good to upload this to the web somewhere, in
	order to be the top hit for e.g. "PCL CONSTANT-VALUE" on search
	engines, so that the next person to hit the swamp has a chance
	to get out before it's too late.  Hack the Makefile enough so
	that we can build an html version of an internals manual.)
2005-12-07 14:20:04 +00:00
Gabor Melis af4d83b575 0.9.6.48: more stability
* zero the value on the binding stack when UNBINDing to prevent gc
    lossage under rare circumstances (see internals manual)
2005-11-17 12:13:35 +00:00
Gabor Melis a1e7c2e819 0.9.5.80:
* added cold init explanation (Xof, #lisp 2005-10-19) to internals
    manual
2005-10-21 11:23:07 +00:00
Thiemo Seufer 51ef404e0b 0.9.5.9:
Fix typo in manual.
2005-09-28 21:11:56 +00:00
Gabor Melis c07c56242a 0.9.3.67:
* added chapter "Signal handling" to internals manual
  * added the beginnings of a threading chapter, too
2005-08-19 19:27:15 +00:00
Nikodemus Siivola bc80839e6c 0.9.2.27: update internals documentation 2005-07-05 12:42:30 +00:00
Nikodemus Siivola dc33d6a6b8 0.9.2.26: refactoring internals of foreign linkage
* rename FOREIGN-SYMBOL-ADDRESS => FOREIGN-SYMBOL-SAP,
     FOREIGN-SYMBOL-ADDRESS-AS-INTEGER => FOREIGN-SYMBOL-ADDRESS, and
     so forth. Follow this scheme consistently, calling foreign saps
     saps, and addresses addresses.
  * split GET-DYNAMIC-FOREIGN-SYMBOL-ADDRESS into
     FIND-DYNAMIC-FOREIGN-SYMBOL-ADDRESS and
     ENSURE-DYNAMIC-FOREIGN-SYMBOL-ADDRESS.
  * new function: FIND-FOREIGN-SYMBOL-ADDRESS, which doesn't enter
     the symbol to linkage table. Use it in SB-POSIX to detect the
     presence of foreign symbols.
  * merge patch by David Lichteblau:
     ENSURE-DYNAMIC-FOREIGN-SYMBOL-ADDRESS keeps track of used foreign
     symbols in hash-tables instead of lists.
2005-07-05 12:27:25 +00:00