From 8f58a2cedc9b7a6ebfef7640d87c288a94bcadaf Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Wed, 14 Sep 2022 17:33:15 +0200 Subject: [PATCH 1/2] improve type stability of `sort!(v::AbstractVector, lo::Integer, hi::Integer, ::InsertionSortAlg, o::Ordering)` This fixes some invalidations when loading Static.jl. --- base/sort.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/base/sort.jl b/base/sort.jl index 6bbe43c61b0c7..d668424a641b0 100644 --- a/base/sort.jl +++ b/base/sort.jl @@ -516,7 +516,8 @@ const SMALL_ALGORITHM = InsertionSort const SMALL_THRESHOLD = 20 function sort!(v::AbstractVector, lo::Integer, hi::Integer, ::InsertionSortAlg, o::Ordering) - @inbounds for i = lo+1:hi + lo_plus_1 = (lo + 1)::Integer + @inbounds for i = lo_plus_1:hi j = i x = v[i] while j > lo From e7d3a0e6721380d7782cd8c87b4b17f917910ac6 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Wed, 14 Sep 2022 17:34:01 +0200 Subject: [PATCH 2/2] improve type stability of `fmt(buf, pos, arg, spec::Spec{T}) where {T <: Strings}` This fixes some invalidations when loading Static.jl. --- stdlib/Printf/src/Printf.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/Printf/src/Printf.jl b/stdlib/Printf/src/Printf.jl index c8c6df9179730..03d37e16593ac 100644 --- a/stdlib/Printf/src/Printf.jl +++ b/stdlib/Printf/src/Printf.jl @@ -281,7 +281,7 @@ end @inline function fmt(buf, pos, arg, spec::Spec{T}) where {T <: Strings} leftalign, hash, width, prec = spec.leftalign, spec.hash, spec.width, spec.precision str = string(arg) - slen = textwidth(str) + (hash ? arg isa AbstractString ? 2 : 1 : 0) + slen = textwidth(str)::Int + (hash ? arg isa AbstractString ? 2 : 1 : 0) op = p = prec == -1 ? slen : min(slen, prec) if !leftalign && width > p for _ = 1:(width - p)