Commit graph

26794 commits

Author SHA1 Message Date
Stas Boukarev 3e4bc556ac Change what (log -0.0) returns.
IEEE recommends -inf.
While CLHS has (complex (log (abs x)) (phase x)) as a definition (even
then, ambiguously it says "a complex logarithm"), we already don't
follow a similar definition for sqrt, (sqrt x) = (exp (/ (log x) 2)),
and return (sqrt -0.0) = -0.0

There also had been some confusion around type derivation and (log
(double-float 0d0)) derived as double-float. And an inlined log
produced -inf.
2025-09-12 02:16:34 +03:00
Stas Boukarev 528fdf09a1 Remove the member-fun from two-arg-derive-type.
Float zeros are no longer hiding in member types.
2025-09-12 02:16:34 +03:00
Stas Boukarev 8c81d9c770 Change the way FP zeros are handled in the type system.
Do not put them into member types. Treat them like ordinary components
of numeric-union-type, using -0.0 < 0.0 instead of -0.0 = 0.0. Now the
only places where they have to be treated specially are generating
type checks and printing type specifiers, which can share the same
code.
2025-09-12 02:16:32 +03:00
Stas Boukarev d526dd1968 Make the cross float sqrt work on -0.0 2025-09-11 02:55:36 +03:00
Stas Boukarev c76b206937 Reduce node walking in ir1-finalize
Handle casts and combinations in a single function.
2025-09-11 01:58:09 +03:00
Stas Boukarev d94c138481 Move hard-coded stuff from rewrite-full-call.
To the new rewrite-full-call optimizer.
2025-09-11 01:49:21 +03:00
Stas Boukarev 4b411993e3 Translate sqrt to specialized single/double-float functions. 2025-09-11 01:26:49 +03:00
Stas Boukarev 9bca09ede7 Translate LOG to specialized single/double-float functions.
Which have the fixed-args calling convention, reducing consing for the
input value, and it doesn't perform type dispatch.
2025-09-11 01:26:49 +03:00
Stas Boukarev df9b7a0b07 Inline (the real (log/sqrt single/double-float))
The complex case just needs to produce an error.
2025-09-11 01:26:46 +03:00
Stas Boukarev 973d606693 Add constraint-propagate-if for float-sign-bit-set-p 2025-09-10 22:40:41 +03:00
Douglas Katzman bf81737034 Differently hide a style-warning 2025-09-10 14:08:21 -04:00
Douglas Katzman fce048644d Remove (SETF SB-EXT:POSIX-GETENV) for #+win32
As the comment says, it should also exist for #+unix or not at all.
Not to mention, it's weird that it eithers sets or gets. Which is it?
2025-09-10 12:51:49 -04:00
Douglas Katzman 03395e74d5 Do a little more coercion to base-string 2025-09-10 12:39:01 -04:00
Douglas Katzman 9c841cfd69 Test a #-sb-unicode 64-bit build 2025-09-10 12:23:04 -04:00
Douglas Katzman bf1a1bd586 Fix default build (#+sb-unicode) on #-sb-unicode SBCL 2025-09-10 12:20:42 -04:00
Stas Boukarev 1e8d246128 save_context_for_ldb: don't fall to bad CSP. 2025-09-10 18:33:34 +03:00
Stas Boukarev b9936b9601 Derive the type of ABS to exclude -0d0
So that (abs (abs x)) is reduced to (abs x)
2025-09-10 18:33:34 +03:00
Stas Boukarev 97fd9eddb5 Don't use #'unboxed-function
The caller won't know how to call it.
2025-09-10 18:33:34 +03:00
Douglas Katzman 5f15844b32 Use existing functions for sb-posix getcwd,getenv 2025-09-10 11:06:08 -04:00
Stas Boukarev bdd32c6e7e note-top-level-form: include more context for DEFMETHOD.
Show
; processing (DEFMETHOD M :AROUND ((A CLASS)) ...)
instead of
; processing (DEFMETHOD M ...)

Based on a patch by Scott L. Burson.
2025-09-10 17:13:44 +03:00
Stas Boukarev d706d942ab Transform ABS on positive floats. 2025-09-10 16:54:32 +03:00
Douglas Katzman 0c37e54a4b Remove sb-unix:espipe, unused as of rev 8cad0235 2025-09-10 08:51:16 -04:00
Douglas Katzman c48a4dc077 Remove 3 inline function definitions when tree-shaking
At first glance these seem too large to beneficially inline, but because
they're all entirely confined to exactly 1 caller, we can nuke them
rather than remove the notinline on each.
2025-09-09 21:47:21 -04:00
Douglas Katzman 384ed91101 Try to return base-string from various libc functions
which generally avoids more casting later when the strings are passed to other
(often user-written) foreign functions that expect ASCII. To further improve
this, it should be possible to avoid double-copy in places by pre-scanning
each char* pointer to determine whether to cast to base-string in one step.
2025-09-09 21:09:17 -04:00
Stas Boukarev b8add98019 Adjust a test. 2025-09-10 01:00:45 +03:00
Stas Boukarev 9f79436915 Fix a comment. 2025-09-10 00:58:08 +03:00
Stas Boukarev d9a56a3d7e Transform (* x -1.0) to %negate.
For consistency with (* x -1) already being transformed.
2025-09-10 00:23:29 +03:00
Stas Boukarev f666752ebe Transform (- (- x) c) to (+ -c x) 2025-09-10 00:15:08 +03:00
Stas Boukarev 13770442f5 unsigned-byte-x-p: support any X, not just multiples of n-word-bits. 2025-09-09 23:25:42 +03:00
Stas Boukarev 41540af42b Add a transform for (logandc2 x constant) 2025-09-09 16:19:57 +03:00
Stas Boukarev d40ad3d175 Add a type deriver for %bignum-length. 2025-09-09 16:04:33 +03:00
Stas Boukarev e05bbc5c4c Transform (typep x '(signed-byte 128))
And other types with word-bits^x where x > 1.
2025-09-09 15:29:49 +03:00
Douglas Katzman 20945637e1 Fix compiling-in-many-threads benchmark a little 2025-09-08 13:15:36 -04:00
Douglas Katzman 424ffee59c Whitespace 2025-09-08 13:09:27 -04:00
Stas Boukarev 064d126c03 maybe-delete-cast: handle EXITs specially.
Move the cast to exit-value. exit-lvar is doing weird stuff for non
local exits.

Fixes lp#2122307
2025-09-08 18:35:14 +03:00
Douglas Katzman bb3c4804dd Remove unused slot for measuring free_pages_lock contention
Object allocation used to zero-fill GC pages (as needed) inside the lock scope.
It no longer does after rev 14c9b485 so there's not much to be gained by
measuring wait time, though I think pmrgc may have better lock usage than
gencgc, as it can optimistically look for - without locking - a usable page,
then try to obtain that exact page using the lock.
2025-09-08 10:51:44 -04:00
Douglas Katzman df7d6a1347 Remove allocator histogram slots from primitive thread
This little-used feature should not consume 96 words of TLS.
Instead access the vector of counts in a slot of *CURRENT-THREAD*,
making it more flexible and eliminating the TLS lock for reading.
2025-09-08 09:04:36 -04:00
Douglas Katzman 68e9440d17 build-all-cores 2025-09-08 08:12:59 -04:00
Douglas Katzman bf801b8b3f x86-64: accept immediate value in %set-sap-ref-lispobj 2025-09-07 21:33:35 -04:00
Stas Boukarev d958ff2a84 x86-64: fix unsigned-byte-x-p.
Can't use :dword to look for the sign-extension digit.
2025-09-08 02:35:59 +03:00
Douglas Katzman d62404c900 Initialize FOREIGN-THREAD using fewer SETFs 2025-09-07 19:15:59 -04:00
Stas Boukarev 0394e9bb75 x86-64: use a mem/reg instruction. 2025-09-08 01:45:11 +03:00
Stas Boukarev 09010341c4 x86-64: smaller >-integer-fixnum
Use mem/reg comparisons and load the length into a 32-bit register
which can be scaled in the EA.
2025-09-08 01:35:21 +03:00
Stas Boukarev 46d8e40365 More compact %bignum-length.
Bignum's length is a 32-bit integer placed after an 8 bit widetag. It
can be loaded into a 32-bit register, removing a right shift.
And on x86-64, even if a shift is needed, loading a dword is one byte
shorter and shifting left by 1 is shorter than shifting by 7.
2025-09-08 00:49:02 +03:00
Douglas Katzman d0e5951a6f Use PROPER-LIST-P instead of (NULL (CDR (LAST x)))
And don't use ASSERT to mean ERROR. It was that way since rev 0a3d799b
but invariant checks should be done using the lighter-weight AVER. Except
this is a type-check of user inputs. Almost nowhere else are users allowed
to edit the supplied args (apart from all the CLHS-stipulated restarts
on package operations perhaps) to system function in this manner.
2025-09-07 14:40:39 -04:00
Stas Boukarev 6125f5ea59 x86-64: implement unsigned-byte-64-p-move-to-word 2025-09-07 20:52:00 +03:00
Stas Boukarev 52d1a48496 Better cast movement around good uses.
Can't move a use with a fitting type directly after the cast if there
are intermediate nodes between the use and the cast. But if only one
use has a bad type the cast can be moved to that use.
2025-09-07 18:14:01 +03:00
Stas Boukarev 4d36ab7e27 Enable CMOV for CHARACTER,SAP-MOVE 2025-09-07 00:14:03 +03:00
Douglas Katzman 488379fb4d Correct accidental omissions from rev 0f08e80e 2025-09-06 13:38:59 -04:00
Douglas Katzman 1f143856c7 Adjust comments to match reality 2025-09-06 12:07:27 -04:00