Commit graph

8007 commits

Author SHA1 Message Date
Stas Boukarev bf95715fa5 arm64, return ldp/stp optimization: fix constants reuse
Some checks are pending
CL-host / sbcl (push) Waiting to run
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 / 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
2026-09-10 09:29:28 +03:00
Aaron Estrada d1afdc52ec x86-64: fix EVEX disassembly for vpmovzx/vpmovsx and ymm-ymm-imm register extension
- Allow EVEX printer generation for vpmovsx* (#x20-#x25) and vpmovzx*
  (#x30-#x35) in map 0F38 in avx2-inst-printer-list.
- Use xmmreg/mem for 4x/8x widening conversions and half-ymmreg/mem for 2x
  widening conversions so source operands disassemble with their correct
  architectural register width (XMM or YMM).
- Define evex-ymmreg-b to incorporate EVEX.X / B' (bit 4) for register-direct
  operands in EVEX-ymm-ymm-imm format, correctly decoding registers 16-31 for
  vpslldq, vpsrldq, and shift/rotate instructions.
- Widen register bounds checks in print-ymmreg-rm, print-ymmreg-vvvv,
  print-ymmreg, and print-xmmreg from (unsigned-byte 4) to (mod 32).
- Add regression tests in tests/simd-pack-512.pure.lisp.
2026-09-09 21:30:10 -06:00
Stas Boukarev f4a731c355 Warn about improper lists created by list* 2026-09-09 07:46:37 +03:00
Stas Boukarev d6c5a50395 Catch bad array dimensions in (make-array (list -1 x)) 2026-09-09 07:39:07 +03:00
Stas Boukarev 248bbb1fff (concatenate (string (code-char i))) splice the character directly
As is already done with (concatenate 'string (list (code-char i)))
2026-09-09 06:34:22 +03:00
Stas Boukarev f47b711b3e Account for commutativity when finding iteration steps
(incf x y) actually expands into (setq x (+ y x)), and
iteration-step-values only checks the first argument. Using
combination-match brings commutative matching automatically.
Then the set isn't reoptimized when y changes, again looking for the
first argument.
2026-09-09 04:26:39 +03:00
Aaron Estrada 2428c1efd0 x86-64: implement AVX-512_FP16 instruction set and CPUID detection
- avx2-insts.lisp: expand EVEX prefix encoder to support 3-bit mmm
  opcode map selection, enabling Map 5 (#b101) and Map 6 (#b110).
- x86-64-arch.c: add runtime CPUID detection for AVX-512_FP16
  (leaf 7, subleaf 0, EDX bit 23) guarded by OS ZMM state enablement.
- avx512-insts.lisp: implement complete AVX-512_FP16 instruction suite:
  * vector and scalar arithmetic (vaddph/sh, vsubph/sh, vmulph/sh,
    vdivph/sh, vminph/sh, vmaxph/sh, vsqrtph/sh, vrcpph/sh, vrsqrtph/sh,
    vscalefph/sh)
  * fused multiply-add (vfmadd*ph/sh, vfmsub*ph/sh, vfnmadd*ph/sh,
    vfnmsub*ph/sh, vfmaddsub*ph, vfmsubadd*ph, vfcmaddcph, vfmaddcph)
  * comparisons and classification (vcmpph/sh, vcomish, vucomish,
    vfpclassph/sh, vrndscaleph/sh)
  * conversions (vcvtph2psx, vcvtps2phx, vcvtdq2ph, vcvtph2dq,
    vcvttph2dq, vcvtuw2ph, vcvtw2ph, vcvtph2w, vcvtph2uw, vcvttph2w,
    vcvttph2uw, vcvtsd2sh, vcvtss2sh, vcvtsi2sh, vcvtsh2si, vcvttsh2si)
  * scalar and GPR moves (vmovsh, vmovw)
  * masked instruction variants with {k} and {z} zeroing
- tests/assembler.pure.lisp: verify bit-exact binary emission and
  round-trip disassembly across all FP16 instruction categories.
2026-09-09 02:17:02 +03:00
Aaron Estrada 0546c92588 x86-64: add AVX-512CD, AVX-512VNNI, and AVX-512BF16 instruction definitions 2026-09-09 02:16:32 +03:00
Aaron Estrada db9c8af135 x86-64: add AVX-512 instruction definitions (vcmpps, vbroadcast, arithmetic)
- Add EVEX compare-to-mask instructions (vcmpps, vcmppd, vcmpss, vcmpsd)
  with opmask destination and optional input opmask.
- Extend vbroadcastss to accept XMM register sources with auto-promotion.
- Extend vpbroadcastd/vpbroadcastq with GPR32/64 sources (opcode #x7C)
  and XMM vector sources.
- Fix kmovd/kmovq GPR transfer prefix and W bits (#xF2 prefix).
- Add 14 masked arithmetic and logic instructions with opmask and
  zero-masking ({z}) support.
- Add AVX-512 EVEX test cases to tests/assembler.pure.lisp.
2026-09-09 02:16:32 +03:00
Stas Boukarev 4c24ec8547 case: warn about duplicate keys in the same clause 2026-09-09 02:16:11 +03:00
Stas Boukarev 2fc0da234d x86-64: off by one when binding multiple values 2026-09-09 01:47:29 +03:00
Charles Zhang d57ec16e2a ir1opt: Allow %analyze-set-uses to look through let bindings as well
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
Which helps loops where the index wrapped around or transformed by
intermediate immutable variable bindings.

This particularly helps type inference for SSA form programs where
multiple sets correspond to fresh variable bindings that are related
through the bindings.
2026-09-08 11:19:28 +02:00
Stas Boukarev 4df6bfd828 Fix a typep transform when mixing integers and rationals 2026-09-08 07:10:40 +03:00
Stas Boukarev a42c09f297 Fix cut-to-width
The logand mask has to be checked to be unsigned

Fixes lp#2166725
2026-09-08 06:07:34 +03:00
Stas Boukarev b7fb00e028 Disable a flaky test 2026-09-08 04:14:50 +03:00
Stas Boukarev d638084646 Be more diligent about deleted nodes in do-nodes :restart-p t
Fixes lp#2166714
2026-09-08 03:51:58 +03:00
Stas Boukarev 39aa19ebee combination-match: transition some logand and logtest transforms 2026-09-08 03:41:33 +03:00
Charles Zhang 731c203ff2 Add a WITH-TEST.
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
2026-09-07 11:48:56 +02:00
Charles Zhang bc2c8e1fa9 constraint: Handle equality constraints for local calls generally.
Which allows us to do bounds elimination for the attached test cases.

The constraint propagation code to handle general local calls now
resembles something like a cross between the code that handles LET and
SET, corresponding to the fact that local call binds variables as LET
does but also must clear existing information while propagating some
of the old information as SET does.
2026-09-07 11:48:56 +02:00
Charles Zhang 4a1cbf4f1a constraint: Improve assignment lambda handling.
Assignment lambdas have first order control flow like let lambdas
do. So we can just do global constraint propagation around their
blocks like normal instead of having to reason about higher-order
control flow through local calls.

This speeds things up by not having to do conset bookkeeping in local
calls and stopping the leading blocks optimization. Possibly as a
consequence, it also seems to derive more constraints this way as
shown in the attached test case.

In any case, this is clearly how assignment lambdas should be
handled (by that I mean the same type propagation logic as with other
local call function kinds, but without needing higher order control
flow reasoning), so mark the old TODO item around assignment lambdas
as finished.
2026-09-07 11:48:56 +02:00
Stas Boukarev f8160932da integer-type-length: work on union types 2026-09-05 18:45:30 +03:00
Stas Boukarev 2865cf89d7 (logxor n (ash n -63)) is (unsigned-byte 63) for (signed-byte 64) n 2026-09-05 18:45:30 +03:00
Douglas Katzman 42549b22cc De-flake a test of sxhash hash quality
I asked Gemini to do the math on this, and it said that it's no surprise
a flake was seen with only 20 objects.  Changing to 60 objects reduces the
chance of spurious failure to 1 in 5e-16
2026-09-05 11:14:43 -04:00
Stas Boukarev 6e8c214ff1 Use word-sized-lvar-p more
Addresses an issue reported by Qiantan Hong.

Tests by Qiantan Hong.
2026-09-05 14:38:26 +03:00
Stas Boukarev 37ddc92c87 Stop stack-analyze interfering with direct mv-calls
They don't push any values.
2026-09-05 04:05:56 +03:00
Stas Boukarev 9107d0306d Add --interpret to parallel-exec
[skip ci]
2026-09-04 22:09:31 +03:00
Stas Boukarev ea4332cd1f Disable pass-through-path-p for NLX
nlx-entry-pass-through currently makes the whole function return,
bypassing any other cleanups.
2026-09-04 20:07:50 +03:00
Douglas Katzman f2e1794438 x86-64: Pass-through multiple values across harmless cleanups
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
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 (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
Optimize non-tail full calls followed by "easy" cleanups that do not execute
arbitrary forms. "Easy" includes DX allocations, special var unbinding, popping
the CATCH block stack. Then the unknown values can be directly returned as if
by tail call, bypassing the RETURN-MULTIPLE helper routine.

We annotate return LVAR as :pass-through, suppress register restoration
after the call (:save-p :compute-only), and emit return as LEAVE+RET.
Cleanup VOPs (unbind-n, %catch-breakup) must preserve the carry flag, and use
only clobberable temporary registers.

For CATCH, decouple the normal return path from the NLX path. The normal path
eliminates use of the stack for buffering the mv-save area and then restoring
it from the stack.
2026-09-04 04:44:09 +00:00
Douglas Katzman 78e706bf96 Generalize the number of MV return regs in gc-common
And treat the values as movable roots, not pinned roots
2026-09-01 21:37:55 +00:00
Stas Boukarev ce99730828 x86-64: fix passing packed structs by value
Reported by Andrew Wolven.
2026-09-02 00:24:05 +03:00
Stas Boukarev b746310040 Skip tests on #+interpreter 2026-09-01 18:01:23 +03:00
Douglas Katzman 9daea02bac win32: disable agressive stack scrub
Some checks are pending
Linux arm / build (push) Waiting to run
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 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
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 arm64 / build () (push) Waiting to run
Linux qemu / build (ppc64le) (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
2026-09-01 09:59:48 -04:00
Stas Boukarev 303db288a5 Correctly not check ftypes of unused optionals
Fixes lp#2165974
2026-09-01 16:53:10 +03:00
Charles Zhang 9685c98e78 Auto-stack-allocate self and mutually-referential functions as well.
Teach environment analysis how to detect when functions which have
references in other functions (potentially itself) are automatically
stack allocatable. This is done by marrying the closure environment
analysis with some of the existing escape analysis utilities, and by
combining those analysis with a step to annotate the correct derived
dynamic extent lifetime, which further required some IR1 flow-graph
hacking utilities to revoke tail call semantics when
necessary. Additionally, the escape analysis performed for functions
is also now somewhat unified with how values are handled, so such
functions are now also stack allocated when all their references
deliver values to e.g. dx-safe functions. In fact, dx-safe as an
ir1-info annotation should probably just be removed in favor of
user-defined dx declarations.

We have thus deleted the arbitrary restriction on auto-dxification of
functions that made us just give up the moment a reference to a
potentially dxable function was in a different environment.

This fixes the existing expected test failures we had regarding being
able to auto stack allocate self-referential functions. We also add a
bunch of new tests to exercise stack-allocatability and correctness of
mutually referential functions which close over each other as well.

We can now remove some explicit dynamic extent declarations in the
system that are now automatically inferred by the compiler, since it
is safer that way in case the functions are changed. It may work to
remove more declarations but these are clearly the instances that the
compiler now handles.

Some test cases provided by Gemini. Everything else written by me.
2026-09-01 13:09:51 +02:00
Charles Zhang ee1e63f0fb Be even more conservative around cons and non-simple array types.
While it could be argued that

(lambda (x)
  (declare (optimize speed))
  (declare (type (array * (4 4)) x))
  (adjust-array x '(3 5))
  (array-dimension (the (array t) x) 0))

should be able to return 4 (I think this is rather dubious though),
clearly it is not correct for the attached test case to be able to do
so. Because declared types do not know anything about variable
subsitution, do not try and squeeze more type information from a
declared type if there is more than one reference to the variable.

While it is unfortunate that a test had to be disabled as a worse type
is derived, I don't see how to safely derive a better type without
making other cases incorrect. This could be fixed as a follow-up.

Notably

(lambda (x)
  (declare (type (or null (cons fixnum)) x))
  (setf (car x) 'foo)
  (if x
      (+ (car x) 4)
      0))

simply crashes without this fix and is not safe, which is not good
even if it's undefined behavior. The corresponding test case with a
variable substitution is not only unsafe but incorrect despite being
defined behavior.

Fixes lp#2165835.
2026-09-01 13:09:51 +02:00
Charles Zhang b69b11cc26 stack: Fix preservation of intervening stack lifetimes, again^n.
We were sometimes merging dynamic extent lifetimes in such a way that
the stack lvar of a dynamic extent later in the flowgraph was used
instead of the earliest one. Fix this by checking the state of the
stack and making sure that dynamic extents always end up taking on the
stack lvars of dynamic extents that happen before them in the
flowgraph when merging their lifetimes.

Fix found with assistance from Gemini Pro after much heavy hinting
from me. Extended commentary and test case reduction by me.

Fixes lp#2156347.
2026-09-01 13:01:00 +02:00
Charles Zhang 2f5e20b7af Endow DX semantics to SET values at IR1tran time.
Instead of waiting for environment analysis to scan set nodes for
dxable values, we can just create a dynamic extent per lambda and
associate it with the value of a SET during IR1
translation. Environment analysis can then run as normal and only
needs to worry about checking whether the environments of the value
and the dynamic extent are the same.

Doing so provides the following benefits (notably fixing a bug):

* We make handling of DX and sets more uniform, so that we no longer
need to handle a case where let conversion has happened or not. This
has the following benefits:
** Assignment lambdas don't confuse DX anymore. This fixes
lp#2163043.
** Flushed initial values don't cause pessimization anymore, fixing a
FIXME.

* It is now straightforward/more clear how to make the compiler
handle free dynamic-extent declarations.

* We can optimize or transform away SET nodes (think copy propagation
or SSA type optimizations) during IR1 optimization without worrying about additional DX
bookkeeping.

Also, revise some commentary about dynamic extent handling across
locall and envanal.
2026-09-01 13:00:58 +02:00
Douglas Katzman 310019ac0e Add a hack to make GC weak-hash-table tests reliable
The optimization of not scrubbing the part of the control stack that you
think you don't have to scrub is contrary to the requirement of some tests.
Real use would not often care. As mentioned in the prior commit, the
scrubbing logic was actually deficient going back nearly 15 years,
so the new logic is merely differently deficient but geared toward avoiding
touching all memory of all stacks of all threads on every GC.
2026-09-01 00:04:57 -04:00
Stas Boukarev 39303703db with-interrupt-bindings: mv-count is a fixnum
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) (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
Mac / build (arm64, --with-sb-thread --with-nonstop-foreign-call) (push) Waiting to run
2026-09-01 00:53:12 +03:00
Stas Boukarev de01b60ddb Try more values in mv-return.impure
Some backends use 4 or 6 registers
2026-09-01 00:36:13 +03:00
Stas Boukarev 1dc3d56d15 Redo a test without using threads 2026-09-01 00:23:12 +03:00
Douglas Katzman 3a3d112d7e Fix interrupt-thread for #+tls-based-mv-return 2026-08-31 16:35:26 -04:00
Douglas Katzman 4abf6ef5f7 x86-64: Implement "possible win" cited in calling-convention.texinfo
Create a dedicated area of 'struct thread' to return multiple-values in excess
of the arg-passing registers. Gating feature is :TLS-BASED-MV-RETURN and not
enabled by default. The limit of 64 (inclusive) values is the minimum to get
most existing tests to pass unchanged.  After the optimizations outlined below
are done, the feature will be more compelling, and we can see about making it
opt-out rather than opt-in, or making MULTIPLE-VALUES-LIMIT configurable.
(I'm sure that some user will claim to need 1000 values.)

The benefit will be fully realized in some subsequent changes, namely:
freeing a DX alloc, unbinding a special var, and breaking up a catch block
will all return from their frame without invoking RETURN-MULTIPLE. Similarly,
some "simple" unwind-protect forms such as release-mutex could too- anything
that does not clobber the thread-local area during a cleanup.
Also this alleviates a big impediment to creating an LLVM-based backend
which could explore performance differences among the call conventions
offered, since micro-management of the stack becomes less critical.

Co-authored with Antigravity
2026-08-30 15:51:25 -04:00
Stas Boukarev 71c43e5aa0 Don't define very large simd-pack functions for printing
Some checks are pending
CL-host / cmucl (push) Waiting to run
CL-host / sbcl (push) Waiting to run
CL-host / ecl (push) Waiting to run
CL-host / clisp (push) Waiting to run
CL-host / ccl (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
Linux arm64 / build () (push) Waiting to run
Linux qemu / build (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 --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
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 qemu / build (riscv64) (push) Waiting to run
Mac / build (x86-64, --with-mark-region-gc --with-nonstop-foreign-call) (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-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
Just use sap-refs from memory.
Saves 1.1MB of core space.
2026-08-30 16:41:43 +03:00
Stas Boukarev 01bd7882b1 More partial result modification false positives 2026-08-30 12:06:55 +03:00
Stas Boukarev 5a5ce63459 Disable a test
[skip ci]
2026-08-30 05:21:37 +03:00
Stas Boukarev 1899deda6a Distinguish between full and partial constant pass-through 2026-08-30 04:47:33 +03:00
Stas Boukarev 5bfa2103ec More thorough tracking of macro argument modifications 2026-08-30 04:17:15 +03:00
Stas Boukarev e938a68479 (aref (vector a) 0) => a 2026-08-30 03:12:59 +03:00
Stas Boukarev d1b2b076bc Don't dx the list in (dx-let ((a (list a b))) (reverse a)) 2026-08-30 01:58:54 +03:00