Skip to content

Conversation

nickrobinson251
Copy link
Member

@nickrobinson251 nickrobinson251 commented Jan 15, 2025

@nickrobinson251 nickrobinson251 force-pushed the v1.12.0-DEV+RAI branch 4 times, most recently from 966538b to 9da665d Compare January 29, 2025 13:01
@DelveCI DelveCI force-pushed the v1.12.0-DEV+RAI branch 7 times, most recently from 1cff7d7 to 1e6e20d Compare February 7, 2025 00:28
@DelveCI DelveCI force-pushed the v1.12.0-DEV+RAI branch 5 times, most recently from 02e0f68 to 35024c5 Compare February 18, 2025 00:28
@DelveCI DelveCI force-pushed the v1.12.0-DEV+RAI branch 4 times, most recently from fb189dc to 7e4f1cb Compare February 27, 2025 00:29
@DelveCI DelveCI force-pushed the v1.12.0-DEV+RAI branch 3 times, most recently from 7eb4dc1 to d4a2432 Compare March 9, 2025 00:27
@DelveCI DelveCI force-pushed the v1.12.0-DEV+RAI branch 5 times, most recently from f36b557 to 4abc802 Compare March 26, 2025 00:30
ajwheeler and others added 12 commits September 2, 2025 08:15
…Lang#59300)

[The "parsing" section of the "eval" dev docs
page](https://docs.julialang.org/en/v1/devdocs/eval/#dev-parsing) was
not updated when JuliaSyntax.jl was adopted in 1.10. This updates the
text to reflect that it is the default parser and briefly mentions how
to switch back.

(cherry picked from commit ec27274)
…iaLang#59327)

Fixes JuliaLang#59326.

Change the logic that decides not to specialize a function parameter
based on whether or not the supplied argument is a Function, and that
function is not used, so that it will still work if the SpecType is a
Union{Function,Nothing} or any other union that contains a Function.

The logic is changed from a hardcoded rule of `type_i == Function ||
type_i == Any || type_i == Base.Callable` to `type_i >: Function`.

This covers all of the above cases, but also includes custom
`Union{Function, T}` such as `Union{Function, Nothing}`.

---------

Co-authored-by: Nick Robinson <[email protected]>
Co-authored-by: Jameson Nash <[email protected]>
(cherry picked from commit 9612115)
…uliaLang#59329)

We already save some memory here by deleting the `jl_native_code_desc_t`
after
we're done serializing the combined module, but some data in the
module's
`LLVM::Context` lives on until the end of the scope in
`jl_dump_native_impl`.
Once we're done with the module, move the lock and `ThreadSafeContext`
so the
reference count drops to zero.

A crude measurement shows that when compiling the Base sysimage, about 3
GiB is
in use. Deleting the `jl_native_code_desc_t` (as before) saves about 600
MiB,
and cleaning up the context saves an additional ~500 MiB.

(cherry picked from commit ceeb661)
The `@__artifact_str` macro was updated in
JuliaLang#55707.

```julia-repl
# Before
julia> @time import ZeroMQ_jll
  0.119653 seconds (313.44 k allocations: 16.855 MiB, 79.48% compilation time)

# After
julia> @time import ZeroMQ_jll
  0.024658 seconds (22.61 k allocations: 1.830 MiB)
```

(cherry picked from commit d28a587)
…uliaLang#59363)

Use a separate inference_start and compilation_start, where
compilation_start does not do anything special for reentrancy.

Here is an example which has a quick-to-compile nested dynamic dispatch,
but that nested function runs for a long time:
```julia
./julia --startup=no --trace-compile=stderr --trace-compile-timing -e '
  Base.@assume_effects :foldable function nested1(x)
      sum(collect(x for _ in 1:1000_000_000))
  end
  f1(x) = nested1(sizeof(x)) + x
  f1(2)'
#=   12.7 ms =# precompile(Tuple{typeof(Main.nested1), Int64})
#= 3809.3 ms =# precompile(Tuple{typeof(Main.f1), Int64})
```
This fixes a small issue introduced here:
https://github.com/JuliaLang/julia/pull/59220/files#r2292021838

(cherry picked from commit be59100)
…uliaLang#59367)

The only method of the `__require_prelocked` function in `Base` gets
compiled with bad inference for two variables, `path` and `reasons`,
which get pessimistically boxed (and inferred as `Any`), even though
both of them are only assigned to once across both the method and the
closure within (neither is assigned to within the closure).

My guess for what causes this would be either of these, or the
combination:

* (mis)use of GOTO

* `try`-`catch`

The least demanding way to work around the issue is adding a `let`
around the closure, as advised in the Performance tips. That is what
this change does.

This change should fix several bad inference results within method
instances such as `__require_prelocked(::PkgId, ::Nothing)` and
`__require_prelocked(::PkgId, ::String)`. Consequently, the sysimage
should become less vulnerable to invalidation happening when loading
certain packages.

(cherry picked from commit 547f858)
…byte pointer (JuliaLang#59395)

On 32 bit machines, for an atomic of size 9 to 11 bytes, the result fits
in the 16 byte pool, but only with a maximum write of 12 bytes (there is
1 byte reserved for the `success` plus 4 for the type tag, leaving 11
bytes for the data). This was accidentally doing a 16 byte write
instead, which could smash the type tag field (usually will NULL) of the
next object. Not sure how to test, since just noticed this while reading
the code.

(cherry picked from commit bbd491a)
…59399)

The FAQ for Julia v1.12 and master still contains a paragraph that
explains how to work around the impossibility to redefine a type in a
REPL session. This paragraph is now obsolete thanks to JuliaLang#57253 so I
propose to simply remove it.

(cherry picked from commit 0c1fab4)
KristofferC and others added 16 commits September 2, 2025 13:36
Prevent transparent huge pages (THP) overallocating pysical memory.

Co-authored-by: Adnan Alhomssi <[email protected]>
Prepend `[signal (X) ]thread (Y) ` to each backtrace line that is
displayed.

Co-authored-by: Diogo Netto <[email protected]>
Alternative to JuliaLang#58146.

We want to compile a subset of the possible specializations of a
function. To this end, we have a number of manually written `precompile`
statements. Creating this list is, unfortunately, error-prone, and the
list is also liable to going stale. Thus we'd like to validate each
`precompile` statement in the list.

The simple answer is, of course, to actually run the `precompile`s, and
we naturally do so, but this takes time.

We would like a relatively quick way to check the validity of a
`precompile` statement.
This is a dev-loop optimization, to allow us to check "is-precompilable"
in unit tests.

We can't use `hasmethod` as it has both false positives (too loose):
```julia
julia> hasmethod(sum, (AbstractVector,))
true

julia> precompile(sum, (AbstractVector,))
false

julia> Base.isprecompilable(sum, (AbstractVector,)) # <- this PR
false
```
and also false negatives (too strict):
```julia
julia> bar(@nospecialize(x::AbstractVector{Int})) = 42
bar (generic function with 1 method)

julia> hasmethod(bar, (AbstractVector,))
false

julia> precompile(bar, (AbstractVector,))
true

julia> Base.isprecompilable(bar, (AbstractVector,)) # <- this PR
true
```
We can't use `hasmethod && isconcretetype` as it has false negatives
(too strict):
```julia
julia> has_concrete_method(f, argtypes) = all(isconcretetype, argtypes) && hasmethod(f, argtypes)
has_concrete_method (generic function with 1 method)

julia> has_concrete_method(bar, (AbstractVector,))
false

julia> has_concrete_method(convert, (Type{Int}, Int32))
false

julia> precompile(convert, (Type{Int}, Int32))
true

julia> Base.isprecompilable(convert, (Type{Int}, Int32))  # <- this PR
true
```
`Base.isprecompilable` is essentially `precompile` without the actual
compilation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.