base: remove all @inbounds annotations via LLVM elision or effect splits
Removes every `@inbounds` annotation from base/ (only the macro's own
definition, docstring and export remain), replacing the unsafe assertion
with one of two mechanisms:
* Plain removal where modern LLVM already elides the bounds checks
(verified per function by compiling an annotation-stripped copy and
inspecting the emitted LLVM), or where the code is cold enough that
checks are acceptable.
* A `:nothrow` effect split (`Base.@split_effects :nothrow f(args...)`,
i.e. `Core.invoke_split_effects`) at the highest boundary that still
fully splits, letting the compiler synthesize a nothrow precondition
from the kernel's own code and produce a check-free fast path with an
outlined fully-checked fallback. Where the kernel body was the
annotated code itself, it is outlined into an `_impl`/`_kernel`
function called through the split.
The work was performed by a fleet of audit agents (one manifest per file
recording per-function signatures, evidence and mechanism) followed by
apply agents, with the compiler's synthesis extended in tandem (see the
previous commits). Sites where synthesis cannot fire yet (opaque
partial-throw builtins, boxed-element loads that may throw UndefRefError,
structural mutation like resize!, data-dependent checks under both arms
of a branch) are plainly removed with active bounds checks and the
blocking reason recorded in the audit manifests.
Notable adjustments beyond mechanical removal:
* base/special/log.jl: the log lookup tables become Memory-backed consts
so the table load can be effect-split (tuple `getfield` with a dynamic
index cannot); the statement-position `@assume_effects :nothrow :noub
@inbounds` annotations become plain effect splits.
* base/sort.jl: `sortperm`/`_sortperm` gain `Base.@constprop :aggressive`;
the split-enlarged optimized bodies otherwise defeat the constant
propagation heuristic for the keyword wrappers, leaving a dynamically
dispatched kwcall (caught by the sortperm allocation tests).
* base/range.jl and base/essentials.jl use bootstrap-safe forms
(statement-position `@inline`; the `@split_effects` macro body uses only
builtins since macro bodies run in their definition world).
* base/ryu/Ryu.jl: the `writeshortest` wrappers split at the public
boundary, hoisting the digit-buffer bounds checks of the Ryu kernels.
This commit was written with the assistance of generative AI (Claude).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>