Skip to content

Instantly share code, notes, and snippets.

View KristofferC's full-sized avatar
🇸🇪

Kristoffer Carlsson KristofferC

🇸🇪
View GitHub Profile

Compiled Pkg apps: open questions

Design questions for compiling Pkg apps to native executables with JuliaC ([apps.<name>] juliac = true). Status of each: Decided (prototype on kc/apps-juliac implements it, with rationale), Open (needs an answer before upstreaming), Deferred (explicitly out of scope for now).

Companion branches: Pkg.jl#kc/apps-juliac, KristofferC/Runic.jl#pkg-apps-juliac (trim=unsafe + preference), KristofferC/ProcessMonitor.jl#pkg-apps-juliac (jtop, trim=unsafe-warn).

PR 780 P1 reproductions

These standalone scripts reproduce the three P1 findings from the review. Run them from the Ferrite.jl repository root. Each script currently fails at the documented invariant; after a fix, it should complete without error.

julia --project=. review_mwes/p1_balanceforest_3d_corner.jl
julia --project=. review_mwes/p1_q2_conformity.jl
julia --project=. review_mwes/p1_subdomain_conformity.jl
#!/usr/bin/env python3
"""Sort a precompile_*.jl file by the `#= NNN.N ms =#` timing comment.
Lines look like:
#= 465.4 ms =# precompile(Tuple{...})
Some lines are wrapped in ANSI color escapes (e.g. \\033[33m ... \\033[0m) and
end with `# recompile`; those escapes are stripped from all output.

verify_method logs phantom insert_backedges_callee invalidations for CodeInstances that are then promoted (wrong sentinel in the emit guard)

cc @topolarity @Keno — load-time backedge verification / invalidation logging on 1.12 and 1.14-DEV.

TL;DR

During package load, verify_method pushes an insert_backedges_callee entry to the invalidation log for any edge whose per-edge max_valid2 ≠ typemax. But the neutral (unconstrained) value inside verify_method is validation_world, not typemax. So an edge that constrains nothing — e.g. a Core.Binding edge to a

Why Julia's atomic modify doesn't fold to atomicrmw (and when it actually does)

Investigation notes for mwe.jl. Versions tested: 1.12.6, 1.13.0-rc1, 1.14.0-DEV.2212 (062a90bc8c). Source references are to julia master (6e40a4a448, 2026-06-08).

TL;DR

The MWE's code_llvm-based counting is partly misled by a reflection artifact. The real situation, measured on **native code of the actual JIT

#!/usr/bin/env julia
#
#===- git-runic - Runic Git Integration ----------------------*- julia -*--===#
#
# Based on `git-clang-format`, which is part of the LLVM Project, under the
# Apache License v2.0 with LLVM Exceptions (see https://llvm.org/LICENSE.txt).
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#
using SnoopCompileCore
# First load OhMyREPL so its methods are compiled
using OhMyREPL
# Now track invalidations caused by loading SymbolicUtils
invs = @snoop_invalidations using SymbolicUtils;
using SnoopCompile
using SnoopCompile: countchildren

=== SnoopCompile Invalidations Report ===

rebinding Core.Binding(:(Base.HashArrayMappedTries.iterate), #undef, #undef, Any[CodeInstance for MethodInstance for getproperty(::Module, ::Symbol)], 0x00) invalidated:
   mt_backedges: 1: signature Base.HashArrayMappedTries.iterate triggered MethodInstance for getproperty(::Module, ::Symbol) (0 children)


inserting readline(io::VSCodeServer.IJuliaCore.IJuliaStdio) @ VSCodeServer.IJuliaCore ~/dyad1.12/julia-vscode/scripts/packages/IJuliaCore/src/stdio.jl:230 invalidated:
   backedges: 1: superseding readline(s::IO; keep) @ Base io.jl:619 with MethodInstance for readline(::IO) (2 children)
# use with Julia 1.11
using Cassette
Cassette.@context TraceCtx
mutable struct CallTrace
depth::Int
pending_newline::Bool
CallTrace() = new(0, false)

Plots.jl precompile issue

  • Create LocalPreferences.toml with
    [PrecompileTools]
    precompile_workloads = false
  • Install Plots + HTTP.
  • Run julia +1.10 --project --trace-compile=plots_compile.jl
  • Run the following: