Commit Graph

62031 Commits

Author SHA1 Message Date
Sam Schweigel
079a15796b Fix bad assert 2026-05-27 11:49:21 -07:00
Sam Schweigel
acfef3ca71 Don't fail if objcache entry evicted before atime update 2026-05-27 11:47:58 -07:00
Sam Schweigel
c0f2f93ef3 Align obj and meta keys to 2 2026-05-27 10:53:11 -07:00
Sam Schweigel
4f55c9fad7 Abort transaction after failing to update atime 2026-05-27 09:45:15 -07:00
Sam Schweigel
1972cce109 Insert schema version on first use of cache, check every time 2026-05-27 09:18:15 -07:00
Sam Schweigel
c10c97099d Enable objcache by default 2026-05-27 09:09:33 -07:00
Sam Schweigel
ad2f9a5399 Merge remote-tracking branch 'upstream/master' into ss/objcache 2026-05-27 08:48:52 -07:00
matthias314
625f3c3308 prevent edit_move_right from extending an active region (#61378)
Some checks failed
Whitespace / Check whitespace (push) Has been cancelled
fixes #61377

See there for description and explanation of the bug.
2026-05-27 09:53:45 -04:00
Shuhei Kadowaki
7cf0a724ee Reland "Base.Docs: fix Binding constructor for renamed imports" (#61897) (#61903)
The stock `Base.Docs.Binding(m, v)` constructor keeps the local symbol
`v` while normalising the module via `binding_module(m, v)`. For renamed
imports such as `using X: y as z`, this produces a binding to a
non-existent `canonical_owner.z`, so `?` doc lookup fails:

    julia> using Base: isvisible as iv

    help?> iv
      No documentation found.
      Binding `Base.iv` does not exist.

Resolve the alias by walking the binding partition chain: for each
explicit by-name import (`PARTITION_KIND_EXPLICIT` /
`PARTITION_KIND_IMPORTED`), follow the partition's restriction to its
underlying `Core.Binding` and read the canonical `(mod, name)` from its
globalref. Iterate until a non-explicit-import partition is reached,
then defer to `binding_module` for any remaining implicit-import
normalisation.

The iterative walk is needed because neither primitive alone suffices
for chained re-exports: `partition_restriction` only walks one hop
(stopping at the intermediate module for a plain re-export of an
`as`-renamed binding), while `binding_module` walks all hops but drops
the name (losing the canonical symbol when an `as`-rename appears
anywhere in the chain).

The first reland attempt rewrote unconditionally on any explicit by-name
import, which broke the docs build for plain chained re-exports such as
`Libdl.DL_LOAD_PATH` (whose docstring lives one hop upstream of the
local import). See

https://buildkite.com/julialang/julia-master/builds/57392#019e4dd3-f9a5-42dc-984d-374451e1a32b
for the original failure.

Re-lands #61869, originally landed as #55119.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 14:51:17 +09:00
Em Chu
55681960b3 Preserve line number on generator methods (#61797)
An attempt to reduce garbage debuginfo that codegen needs to deal with:
stop dropping provenance when producing generator methods in lowering,
and generated expressions from `generated_body_to_codeinfo`. This change
appears to let us rule out a case in codegen, but I'll see what CI
thinks. The other changes are a provenance improvement regardless.
2026-05-26 17:01:19 -04:00
Shuhei Kadowaki
47c5e32bce docs: Add keyword docstring for typegroup (#61907)
`typegroup` had a section in the manual but no keyword docstring, so
`?typegroup` at the REPL returned no documentation. Add a
`kw"typegroup"` entry alongside `struct` and `mutable struct` in
`base/docs/basedocs.jl`.

This pull request was written with the assistance of generative AI
(Claude).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 02:02:38 +09:00
Sam Schweigel
4c1c821f77 Call OnAbandoned from JLJITLinkMemoryManager::InFlightAlloc::abandon (#61884)
Without this change, if ORC materialization fails with an error, we
instead see an assertion failure because of an unchecked Error rather
than seeing the ORC error. Improve the debugging experience by
"successfully" abandoning the allocation, even though we don't support
deallocating code. #61847 correctly prints the
`UnexpectedSymbolDefinitions` error that is the cause of the problem
after this change.

For example, we get this error message instead of a deadlock:
```
nthreads=32
starting workers
JIT session error: Unexpected definitions in module leaf_62-jitted-178: [ julia_leaf_62_0#0, julia_mid_59_0#0 ]
Internal error: Lookup failed: Failed to materialize symbols: { (JuliaOJIT, { julia_topB_52_0#0, jfptr_topB_52_0#0 }) }
Program aborted due to an unhandled Error:
Failed to materialize symbols: { (JuliaOJIT, { julia_topB_52_0#0, jfptr_topB_52_0#0 }) }
```
2026-05-26 09:27:32 -07:00
Andy Dienes
8cb3325be2 fix some major issues with map(f, ::BitArray...) (#61895)
previously:

```julia
# WRONG. output should be length 5, not 6. the last value here is junk from `similar`
julia> map(&, rand(6) .> 0.5, rand(5) .> 0.5)
6-element BitVector:
 0
 0
 0
 1
 0
 0

julia> dest = falses(64);

julia> map!(&, dest, trues(65), trues(64));

# what on earth?? should be 64
julia> count(dest)
1
```

the `and_iteratorsize` change is slightly drive-by but it makes the
implementation nicer (and more parallel to `Array`, so if one changes
they'll stay in sync). incidentally, it actually helps performance for
some `collect(zip(..))` calls too
```julia
julia> using BenchmarkTools

julia> @btime collect(z) setup=z=zip(1:10000, rand(100, 100));
  15.875 μs (16 allocations: 437.53 KiB) # master
  3.344 μs (3 allocations: 160.06 KiB) # PR
```


codeveloped (mostly tests) with codex 5.5

---------

Co-authored-by: Nathan Zimmerberg <39104088+nhz2@users.noreply.github.com>
2026-05-26 09:44:34 -04:00
Kristoffer Carlsson
9f531e188d module: avoid materializing binding partitions in names/exported_names (#61883) 2026-05-26 14:39:06 +02:00
Andy Dienes
32a8439612 clarify some ambiguity in in docstring (#61892)
otherwise it might be quite confusing that e.g. 
```julia
julia> (:a => NaN) in Dict(:a => NaN)
false

julia> (:a => missing) in Dict(:a => missing)
missing
```

---------

Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com>
2026-05-26 07:35:09 -04:00
Daniel Matz
ecceaba1c5 Include doc string for Base.@ccallable in the docs (#61592)
I recently noticed that the doc string for `Base.@ccallable` is not
included in the docs. Given how often it is used with PackageCompiler.jl
and JuliaC.jl at this point, I assume it was just an oversight, and not
an intentional exclusion.
2026-05-26 15:15:33 +09:00
Keno Fischer
bef642966f subtype: Treat free TypeVars as singleton identities (#61876)
This PR updates the semantics of free TypeVars in subtyping to act as
egality-compared atoms (as proposed in
https://github.com/JuliaLang/julia/issues/61242#issuecomment-4008886548).
Previously free typevars
in subtyping were undefined behavior although they generally behaved
universally (unless the same typevar by identity was present in a
UnionAll). This fixes #61242 by making sure that `Vector !=
Vector.body`.

Written by GPT 5.5.

---------

Co-authored-by: Keno Fischer <Keno@users.noreply.github.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 22:42:47 -04:00
PatrickHaecker
6de168ee13 Fix typo in comment about byte_offset (#61905) 2026-05-26 11:08:03 +09:00
Kristoffer Carlsson
71025e737d add some type asserts to preference loading code (#61878)
Co-authored-by: Cody Tapscott <84105208+topolarity@users.noreply.github.com>
2026-05-25 13:10:12 +02:00
Kristoffer Carlsson
f4596e54c5 set max_methods=1 for !=, >, >= to 1 (#61880) 2026-05-25 13:09:42 +02:00
Mosè Giordano
3c5f1ef2a7 Revert "Base.Docs: fix Binding constructor for renamed imports" (#61897)
This breaks building Julia:
https://github.com/JuliaLang/julia/pull/61869#issuecomment-4529617719.
Reverts JuliaLang/julia#61869.
2026-05-24 22:53:14 +02:00
Ian Butterworth
cf5f5ebff6 AGENTS.md: explain how to read buildkite logs (#61891) 2026-05-24 13:32:30 -04:00
Shuhei Kadowaki
e5d7225bad Base.Docs: fix Binding constructor for renamed imports (#61869)
Some checks failed
Whitespace / Check whitespace (push) Has been cancelled
The stock `Base.Docs.Binding(m, v)` constructor keeps the local symbol
`v` while normalising the module via `binding_module(m, v)`. For renamed
imports such as `using X: y as z`, this produces a binding to a
non-existent `canonical_owner.z`, so `?` doc lookup fails:

    julia> using Base: isvisible as iv

    help?> iv
      No documentation found.
      Binding `Base.iv` does not exist.

Resolve the alias via the binding partition system: when the local
binding's partition kind is `PARTITION_KIND_EXPLICIT` or
`PARTITION_KIND_IMPORTED` — the only kinds whose surface syntax (`using
X: y as z` / `import X: y as z`) admits an `as`-rename — the partition's
restriction is the underlying `Core.Binding` whose globalref carries the
canonical `(mod, name)` pair. Use that pair instead.

Re-lands #55119 with the binding partition API after the original
`jl_binding_owner`-based fix became stale (that C function no longer
exists on master).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 12:09:29 +09:00
Keno Fischer
c07cf8ff6a subtype: Tweak the diagonal rule to make it more clear (#61861)
Pop quiz: Which of these make `T` diagonal:

```
Tuple{S, T} where S<:T where T
Tuple{S, T} where S<:Tuple{T} where T
Tuple{S, T} where S<:Tuple{T,T} where T
```

The answer right now is 2 and 3, but I would argue that 2 is a bit of an
accident of implementation, because `Tuple` turns back on the variable
occurrence counting that the typevar consitency check tried to turn off
(but we depend on `3` and it clearly "looks" diagonal).

This PR changes the semantics so that 2 is no longer considered
diagonal. Instead, the diagonal rule conceptually applies to `Tuple`s:
The diagonal rule applies whenever any `Tuple` sees 2+ active typevars
in covariant position (and the typevar was not statically found in
invariant position by the outer UnionAll - same as before).

For a more extensive set of examples of cases that change behaviors, see
the test suite, but of note none of our existing tests depended on this
(other than a test_broken that now passes).

A particular motivation for this change is intersection, since
intersection needs to extensively reason about whether or not it is
possible for a variable to become diagonal (no intersection changes are
made in this PR, because intersection is not currently correct with
respect to various diagonal cases - however fixing that requires
defining what correctness means).

Idea by me. Tests by GPT-5.5 Pro. Implemented by Claude Opus 4.7.
2026-05-22 17:48:10 -04:00
Mark Kittisopikul
7740020486 Document reservation of double underscore names (dunders) (#51215)
In the recent discussion about `main`, `__main__` was proposed. One
reason in favor of this is that double underscore, or dunder, names are
reserved names in Julia. This however is not documented.

This pull request adds a paragraph reserving double underscore names for
Julia.

They are added to Base -> Essentials -> Keywords where other reserved
names are documented.

https://docs.julialang.org/en/v1.11-dev/base/base/#Keywords

cc: @StefanKarpinski

---------

Co-authored-by: 3f6a <126961207+3f6a@users.noreply.github.com>
2026-05-22 15:50:25 -04:00
Keno Fischer
8179404f37 subtype: Remove another bad test (#61875)
This test failed because `testintersect` is a typo for `typeintersect`,
but regardless the issue is fixed now, so just fold it into the previous
test.
2026-05-22 15:32:48 -04:00
Gabriel Baraldi
820bab15f8 processor: report actual JIT target in pkgimage rejection debug output (#61808)
## Summary

`jl_reflect_clone_targets` (exposed as `Base.current_image_targets()`)
was re-resolving `jl_options.cpu_target` from scratch via
`jl_get_llvm_clone_targets`, returning the originally-configured target
spec list rather than the JIT target that `match_pkgimg_target` actually
compares pkgimage clones against. The JIT target (`jit_targets.front()`)
differs from the configured one because it is:

- intersected with the loaded sysimage's clone features,
- clamped by max vector-register width (e.g., AVX-512 features are
stripped when the matched sysimage clone caps at AVX2).

As a result, `JULIA_DEBUG=loading` printed identical "Image Targets" and
"Current Targets" feature strings on pkgimage rejection — hiding the
real mismatch and making the rejection look spurious. See #61621 for two
examples.

This change makes `jl_reflect_clone_targets` serialize `jit_targets`
directly, with a fallback to the prior behavior in case it has not yet
been populated.

Fixes #61621

Pull request was written with the assistance of generative AI (Claude).

## Test plan

- [ ] Trigger a pkgimage rejection (e.g. load a pkgimage built against a
different sysimage clone) with `JULIA_DEBUG=loading` and confirm
"Current Targets" now shows the post-match JIT feature set rather than
the unmatched cpu_target spec.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 11:28:47 -03:00
Andy Dienes
8bb4ad6baa add LoopIdiomRecognizePass for memset-table loops (#61873)
fixes https://github.com/JuliaLang/julia/issues/61870, closes
https://github.com/JuliaLang/julia/pull/61871

```julia
julia> using BenchmarkTools

julia> function my_zero_inbounds!(A::Matrix{Float64})
           for i in eachindex(A)
               @inbounds A[i] = 0.0
           end
           return A
       end
my_zero_inbounds! (generic function with 1 method)

julia> function my_zero!(A::Matrix{Float64})
           for i in eachindex(A)
               A[i] = 0.0
           end
           return A
       end
my_zero! (generic function with 1 method)

julia> @benchmark my_zero_inbounds!(X) setup=X=rand(1000, 1000)
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
 Range (min … max):  27.083 μs … 226.500 μs  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     32.750 μs               ┊ GC (median):    0.00%
 Time  (mean ± σ):   41.400 μs ±  15.265 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%

  ▅▆██▇▅▃▂▁▁ ▇ ▂ ▂▃▂  ▁    ▂▅▅▅▄▃▂▁▂▁▁▃▁▁▁▂▂▂▁▁ ▁    ▁ ▃▂      ▂
  ██████████▇████████▇█▇▇▇▆██████████████████████▇███████▇▆▇█▆ █
  27.1 μs       Histogram: log(frequency) by time      82.8 μs <

 Memory estimate: 0 bytes, allocs estimate: 0.

julia> @benchmark my_zero!(X) setup=X=rand(1000, 1000)
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
 Range (min … max):  27.125 μs … 156.000 μs  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     30.167 μs               ┊ GC (median):    0.00%
 Time  (mean ± σ):   33.619 μs ±   5.419 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%

         █▇                            ▂                        
  ▂▃▃▄▂▂████▃▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▃▃▃▃▂▃▅▇▇█▄▂▂▂▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▂
  27.1 μs         Histogram: frequency by time         45.8 μs <

 Memory estimate: 0 bytes, allocs estimate: 0.
```

previously the non-inbounds one was slower
```julia
julia> @benchmark my_zero!(X) setup=X=rand(1000, 1000)
BenchmarkTools.Trial: 10000 samples with 1 evaluation per sample.
 Range (min … max):  55.250 μs …  1.088 ms  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     63.250 μs              ┊ GC (median):    0.00%
 Time  (mean ± σ):   67.430 μs ± 15.484 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%

  ▄ ▁▁▆▅▁   █▆▃▄▃▂▂▂▂▁▁▁▁▁▅▁▂▂▁▁▂▃▁▁                ▂▃▂▁      ▂
  ███████▇▇▇███████████████████████████▇▇▇▆▆▆▆▅▅▆▇▇█████▇█▇▇▇ █
  55.2 μs      Histogram: log(frequency) by time      98.4 μs <

 Memory estimate: 0 bytes, allocs estimate: 0.
```
2026-05-21 22:22:03 -04:00
Andy Dienes
76547c10a1 module: zero-init export_set_changed_since_require_world on module creation (#61874)
fix is fully claude one shot. I was also able to glean a small
reproducible test, but it was not deterministic and I don't have
confidence it would work on all machines, so I omitted it.


------------------------------------------------------------------------------------------

This `_Atomic(int8_t)` field was added in #57421 but never initialized
in `jl_new_module__`. `jl_gc_alloc` does not zero the returned memory,
so each fresh module started with whatever garbage was in the pool slot.
The field is read by `all_usings_unchanged_implicit` in
`src/staticdata.c` during pkgimage loading: a non-zero garbage value
spuriously forces binding-partition revalidation for downstream modules.

The fix matches the existing zero-init of the adjacent `has_reexports`
field that was added in #59859.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 21:46:49 -04:00
Keno Fischer
4c012f14f4 subtype: Remove a bad test comment (#61795)
The comment suggests that the `correct` variable holds the precise
intersection, but this is false. The precise intersection is (as far as
I can tell) not representable. While we're here, add a related
unsoundness that Claude found while looking at this. The common thread
is that these cases involve what Claude calls `F-bounded witnesses`,
i.e. types of the form `Ptr{T} where T<:Ptr`. I haven't read enough of
the literature on F-bounded polymorphism to know if this is a good name
or not, but for want of a better name, let's go with it.
2026-05-21 21:46:12 -04:00
Oscar Smith
019807b1a3 memoryrefunset fixes (#61872)
Address code review from @vtjnash on
https://github.com/JuliaLang/julia/pull/61759/changes#diff-07a80d46bd00f903348b4df9f5e0e2d88f5a2263f7115e200ed99c19064adb11
from after the PR merged.
2026-05-21 19:23:16 -04:00
Yi Lin
e98fbb4a53 MMTk: fix the version number for sha512 checksum (#61830)
Missing point version number in
https://github.com/JuliaLang/julia/pull/61769, which causes CI fail to
build MMTk.
2026-05-22 10:59:12 +12:00
Sam Schweigel
659c534978 Use sha256sum if it's on the path (Windows CI) 2026-05-21 14:51:23 -07:00
Cody Tapscott
c0763cba67 GC: permanently mark pkg/sysimage objects to speed up GC (#61474)
Image objects are already never freed and are ~somewhat rarely mutated,
making them candidates for "pretenuring".

Load image objects as permanently marked (`GC_OLD_MARKED`) so
`gc_try_setmark_tag` returns 0 immediately and the mark phase never
enters the image subgraph. Maintain any mutations as a dedicated
`image_remset` which effectively roots any "new" referents that are
referred to by the image subgraph.

This significantly speeds up (full) GC pause times when dominated by
immutable objects in the sysimage / pkgimage heaps.

This can likely also be generalized slightly to a "permalloc / pretenure"
operation that applies to objects not necessarily in images. I'm not sure
whether it'd be possible to "unfreeze" those objects once they are
promoted to permalloc'd / pretenured though.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-21 15:16:02 -04:00
Em Chu
70059dde5a Core.DebugInfo: expand C API, mostly to handle byte-precise information (#61817)
This change adds a basic C API for reading `jl_debuginfo_t`, both in its
current form and with byte-precise provenance to be generated by
JuliaLowering.

```
(debuginfo, pc) -> (firstbyte, lastbyte)
(debuginfo, byte) -> (line, column)
(debuginfo, pc) -> (firstline, firstcolumn)
debuginfo -> first_line_of_entire_codeinfo
```

Note that the byte-precise provenance is not yet produced (and I've
marked those branches unreachable). I'm making this change first so I
can use them to try and resolve issues in #61699 and #53925. (Namely,
I'm going to try and compute inlined frames from julia debuginfo
rather than DWARF.)

## Implementation of byte-precise info storage

The API shouldn't depend on how we do this, but I'll describe it here
for reference.

The simplicity of our current `Core.DebugInfo` (ref. #52415) is thanks
to simple line numbers looking the same as indices into the next 
debuginfo, so they can be stored in the same way. Unfortunately, 
byte-precise information breaks this:
from an index, we want to be able to know two byte positions, what lines
they fall on, and how far from the beginning of those lines they are.

I intend to store this info by putting a string in `linetable` like we
do for `di.codelocs`. The compression format is described in julia.h, but
only a couple points are relevant here:
- Like `di.codelocs` today, I made a reasonable attempt to compress it
  (so we don't blow up the sysimg) without trying to be too clever.
- Position lookup for a single IR statement can still be done without
  decompressing everything.

I've already implemented the compression/decompression code (in
JuliaLowering), but it's not part of this PR. This format might be torn
out when we start trying to store AST provenance.

---------

Co-authored-by: Cody Tapscott <topolarity@tapscott.me>
2026-05-21 13:23:43 -04:00
Oscar Smith
afd703e713 Add memoryrefunset intrinsic (#61759)
To allow for  write barriers to be added for concurrent GC.

Coauthored by claude.

---------

Co-authored-by: Cody Tapscott <84105208+topolarity@users.noreply.github.com>
2026-05-21 12:14:24 -04:00
Andy Dienes
062a90bc8c avoid untyped comprehensions in @generated functions (#61842)
Some checks failed
Whitespace / Check whitespace (push) Has been cancelled
because they end up calling into inference, which is illegal
2026-05-19 18:45:43 +09:00
Sam Schweigel
2bf73270b7 Mark all mdb_* functions as JL_NOTSAFEPOINT 2026-05-18 10:15:54 -07:00
Sam Schweigel
d0c29c19c4 Use shasum -a instead of sha1sum (macOS support) 2026-05-18 10:13:22 -07:00
DilumAluthgeBot
cad4314e3b 🤖 Bump LinearAlgebra stdlib 74a7cfa → f8b77b7 (#61831)
Stdlib: LinearAlgebra
URL: https://github.com/JuliaLang/LinearAlgebra.jl.git
Stdlib branch: master
Julia branch: master
Old commit: 74a7cfa
New commit: f8b77b7
Julia version: 1.14.0-DEV
LinearAlgebra version: 1.13.0 (Does not match)
Bump invoked by: @dkarrasch
Powered by:
[BumpStdlibs.jl](https://github.com/JuliaLang/BumpStdlibs.jl)

Diff:
74a7cfa6c6...f8b77b7482

```
$ git log --oneline 74a7cfa..f8b77b7
f8b77b7 Extend `matop_dest` mechanism to `UpperHessenberg` and `Factorization` (#1606)
62602d6 [RFC] remove matprod_dest (#1591)
6e26f4e make eigvals(::SymTridiagonal) accept sortby (#1595)
```

Co-authored-by: dkarrasch <26658441+dkarrasch@users.noreply.github.com>
2026-05-18 15:26:43 +02:00
Mosè Giordano
b616c52ecd Merge pull request #61827 from giordano/mg/unused-jl-timing-show-buf
Define `_jl_timing_show_buf` only when actually used
2026-05-18 08:24:54 -04:00
Ian Butterworth
201e056e9e perf: bulk fast paths for NTuple-from-array and rand!(::Array{Complex}) (#61762)
I pointed Claude at [perf.julialang.org](https://perf.julialang.org/)
and asked it to find opportunities to improve unusually slow benchmarks.

See
[JuliaCI/julia-ci-timing@main/analysis](https://github.com/JuliaCI/julia-ci-timing/tree/main/analysis)
for some of the scripts it used.

This is what it came up with:

----

Two small, BaseBenchmarks-driven perf fixes that share a theme — when
the
storage of an array already has the layout you want, dispatch to the
bulk
path on a `reinterpret` view instead of going through the per-element
fallback.

### `NTuple{N,E}(::Union{Array,Memory})` for `N >= 32`

The default `_totuple(::Type{All32{E,N}}, itr)` path collects into an
intermediate `Vector` and splats. The `All32` cap exists so we don't
specialize tuple construction on every `N`; this PR keeps that property
(no per-`N` codegen) by adding a single fast path for `Array`/`Memory`
inputs whose `isbits` element type matches the requested tuple element
type. In that case the storage is layout-identical to the tuple, so a
single `reinterpret` view + scalar load returns the tuple in O(1) (plus
a length check).

The fast path lives in `reinterpretarray.jl` because `reinterpret` on
arrays isn't yet defined when `tuple.jl` is loaded. Over-long inputs are
silently truncated to match the iterator-based fallback. Non-matching
eltypes / non-isbits eltypes fall through to the existing path
unchanged.

```
                                            master       this PR
NTuple{40,Float64}(::Vector{Float64})        1.36 μs      7.3 ns
NTuple{150,Float64}(::Vector{Float64})       4.92 μs     17.0 ns
```

(0 allocations on the fast path, vs. `N+~3` allocations and `~33 N` B
on master.)

### Bulk `rand!(::Array{Complex{T}})` for `T <: HWReal`

`rand!(::AbstractRNG, ::Array{Complex{T}})` previously fell through to
the generic `AbstractArray` path — two scalar `rand` calls per element.
A packed `Array{Complex{T}}` has the same memory layout as a length-`2N`
`Array{T}`, so reinterpreting and dispatching to the bulk `rand!` for
`T` (SIMD-vectorized for `HWReal` on Xoshiro/TaskLocalRNG, and pointer-
based for MersenneTwister) is correct and substantially faster.

Per @vtjnash's feedback in earlier review, this avoids
`unsafe_wrap`/`unsafe_load` entirely. Instead, the existing bulk
dispatches in `MersenneTwister` and `XoshiroSimd` are widened to also
accept a `NonReshapedReinterpretArray` over a `MutableDenseArrayType`
parent. `pointer`/`unsafe_convert` are already defined for
`ReinterpretArray` and forward to the parent's storage, so the existing
`GC.@preserve A ... pointer(A) ...` machinery keeps working unchanged.

Speedups on a length-1000 `Vector{Complex{T}}`, default RNG:

```
                  master       this PR
Complex{Float16}   3.5 μs       1.5 μs    2.4×
Complex{Float32}   3.4 μs       2.2 μs    1.5×
Complex{Float64}   3.1 μs       3.1 μs    ≈
Complex{Int8}      3.1 μs       539 ns    5.7×
Complex{Int16}     3.1 μs       1.1 μs    3.0×
Complex{Int32}     3.1 μs       1.9 μs    1.7×
Complex{Int64}     4.6 μs       4.2 μs    1.1×
Complex{UInt8}     3.1 μs       532 ns    5.9×
Complex{UInt16}    3.1 μs       1.0 μs    2.9×
Complex{UInt32}    3.0 μs       1.9 μs    1.6×
Complex{UInt64}    4.7 μs       4.2 μs    1.1×
```

All variants are 0-allocation. `Complex{Float64}` and the 64-bit integer
variants were already close to the bulk path's throughput on master and
see only a small win.

A reproducibility test was added so equal MT seeds keep producing equal
sequences for `Vector{Complex{T}}`.

---

Disclosure: written with the assistance of generative AI (GitHub
Copilot / Claude).

---------

Co-authored-by: GitHub Copilot <noreply@github.com>
2026-05-17 22:48:10 -04:00
DilumAluthgeBot
690a68d60b 🤖 Bump Pkg stdlib 43dcd1fc0 → 870fd2f63 (#61825)
Some checks failed
Whitespace / Check whitespace (push) Has been cancelled
2026-05-17 11:07:24 -04:00
Sam Schweigel
cd276d6997 Silence unused variable warning 2026-05-16 11:39:56 -07:00
Sam Schweigel
fd25dc2e3e Fix OBJCACHE_ATIME_GRANULARITY sign 2026-05-16 11:35:54 -07:00
Jesper Stemann Andersen
8c4818189c src: remove orphan features_*.h headers (#61821)
The processor_{x86,arm,fallback}.cpp files that included these headers
were deleted in #61292, which replaced the hand-maintained CPU/feature
tables with the [cpufeatures](https://github.com/JuliaLang/cpufeatures)
library. No remaining code in the tree references features_x86.h,
features_aarch32.h, or features_aarch64.h, nor the JL_FEATURE_DEF macro
they defined.

#61292 listed these headers under Files to delete.
2026-05-16 12:50:12 -03:00
Mosè Giordano
d0c9f4cd45 [deps] Update cpufeatures to commit 6e9b133f (#61774)
Co-authored-by: Dilum Aluthge <5619885+DilumAluthge@users.noreply.github.com>
Co-authored-by: Christian Guinard <28689358+christiangnrd@users.noreply.github.com>
Co-authored-by: Cody Tapscott <topolarity@tapscott.me>
2026-05-16 11:04:44 +01:00
Erik Schnetter
006266f6e9 mozillacerts: Update to 2026-05-14 (#61815) 2026-05-16 00:40:46 -04:00
Ian Butterworth
156343a6dd client: restrict repl_cmd to AbstractCmd arguments (#61816) 2026-05-16 00:28:46 -04:00
Arno Strouwen
6bd20ed92a doc: explain how type parameters interact with new in parametric constructors (#61442)
The constructors documentation used `new` with implicit and explicit
type parameters in examples without clearly stating the underlying rule.
This adds a subsection explaining that `new` inherits the type
parameters from the curly braces on the inner constructor name, when
explicit parameters are needed, and what happens when the constructor
name has fewer parameters than the type requires. The existing
explanation in the "Outer-only constructors" section is also updated to
reference this rule.

The rules described here were determined empirically, as the existing
documentation did not specify them. If any details are inaccurate,
corrections are welcome.

---------

Co-authored-by: James Wrigley <JamesWrigley@users.noreply.github.com>
2026-05-16 01:43:22 +02:00