Skip to content

Commit 49263b7

Browse files
authored
Backports for 1.12 (#57444)
Backported PRs: - [x] #57302 <!-- Add explicit imports for types and fix bugs --> - [x] #57420 <!-- Compiler: Fix check for IRShow definedness --> - [x] #57419 <!-- generated: Switch resolution module back to what it was before --> - [x] #57421 <!-- bpart: Skip implicit import reval if using'd export set is unchanged --> - [x] #57425 <!-- Prohibit binding replacement in closed modules during precompile --> - [x] #57426 <!-- Prohibit `import`ing or `using` Main during incremental compilation --> - [x] #57433 <!-- bpart: Track whether any binding replacement has happened in image modules --> - [x] #57445 <!-- Run all `--sysimage-native-code=no` cmdlineargs tests single-threaded --> - [x] #57386 <!-- Only strip invariant.load from special pointers --> - [x] #57453 <!-- Revert "Make emitted egal code more loopy (#54121)" --> - [x] #57389 <!-- Change memory indexing to use the type as index instead of i8 --> - [x] #57447 <!-- Don't return null pointer when asking for the type of a declared global --> - [x] #57467 <!-- using/import: ensure world update after each observable operation --> - [x] #57471 <!-- staticdata: Don't use `newm` pointer after it has been invalidated --> - [x] #57416 <!-- lowering: Don't mutate lambda in `linearize` -->
2 parents b0c5f61 + bf42463 commit 49263b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+448
-327
lines changed

Compiler/src/Compiler.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ using Base.Order
7272

7373
import Base: ==, _topmod, append!, convert, copy, copy!, findall, first, get, get!,
7474
getindex, haskey, in, isempty, isready, iterate, iterate, last, length, max_world,
75-
min_world, popfirst!, push!, resize!, setindex!, size
75+
min_world, popfirst!, push!, resize!, setindex!, size, intersect
7676

7777
const getproperty = Core.getfield
7878
const setproperty! = Core.setfield!

Compiler/test/codegen.jl

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -889,57 +889,6 @@ ex54166 = Union{Missing, Int64}[missing -2; missing -2];
889889
dims54166 = (1,2)
890890
@test (minimum(ex54166; dims=dims54166)[1] === missing)
891891

892-
# #54109 - Excessive LLVM time for egal
893-
struct DefaultOr54109{T}
894-
x::T
895-
default::Bool
896-
end
897-
898-
@eval struct Torture1_54109
899-
$((Expr(:(::), Symbol("x$i"), DefaultOr54109{Float64}) for i = 1:897)...)
900-
end
901-
Torture1_54109() = Torture1_54109((DefaultOr54109(1.0, false) for i = 1:897)...)
902-
903-
@eval struct Torture2_54109
904-
$((Expr(:(::), Symbol("x$i"), DefaultOr54109{Float64}) for i = 1:400)...)
905-
$((Expr(:(::), Symbol("x$(i+400)"), DefaultOr54109{Int16}) for i = 1:400)...)
906-
end
907-
Torture2_54109() = Torture2_54109((DefaultOr54109(1.0, false) for i = 1:400)..., (DefaultOr54109(Int16(1), false) for i = 1:400)...)
908-
909-
@noinline egal_any54109(x, @nospecialize(y::Any)) = x === Base.compilerbarrier(:type, y)
910-
911-
let ir1 = get_llvm(egal_any54109, Tuple{Torture1_54109, Any}),
912-
ir2 = get_llvm(egal_any54109, Tuple{Torture2_54109, Any})
913-
914-
# We can't really do timing on CI, so instead, let's look at the length of
915-
# the optimized IR. The original version had tens of thousands of lines and
916-
# was slower, so just check here that we only have < 500 lines. If somebody,
917-
# implements a better comparison that's larger than that, just re-benchmark
918-
# this and adjust the threshold.
919-
920-
@test count(==('\n'), ir1) < 500
921-
@test count(==('\n'), ir2) < 500
922-
end
923-
924-
## Regression test for egal of a struct of this size without padding, but with
925-
## non-bitsegal, to make sure that it doesn't accidentally go down the accelerated
926-
## path.
927-
@eval struct BigStructAnyInt
928-
$((Expr(:(::), Symbol("x$i"), Pair{Any, Int}) for i = 1:33)...)
929-
end
930-
BigStructAnyInt() = BigStructAnyInt((Union{Base.inferencebarrier(Float64), Int}=>i for i = 1:33)...)
931-
@test egal_any54109(BigStructAnyInt(), BigStructAnyInt())
932-
933-
## For completeness, also test correctness, since we don't have a lot of
934-
## large-struct tests.
935-
936-
# The two allocations of the same struct will likely have different padding,
937-
# we want to make sure we find them egal anyway - a naive memcmp would
938-
# accidentally look at it.
939-
@test egal_any54109(Torture1_54109(), Torture1_54109())
940-
@test egal_any54109(Torture2_54109(), Torture2_54109())
941-
@test !egal_any54109(Torture1_54109(), Torture1_54109((DefaultOr54109(2.0, false) for i = 1:897)...))
942-
943892
bar54599() = Base.inferencebarrier(true) ? (Base.PkgId(Main),1) : nothing
944893

945894
function foo54599()

base/Base_compiler.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ function cld end
227227
function fld end
228228

229229
# Lazy strings
230+
import Core: String
230231
include("strings/lazy.jl")
231232

232233
# array structures

base/bool.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3+
import Core: Bool
4+
35
# promote Bool to any other numeric type
46
promote_rule(::Type{Bool}, ::Type{T}) where {T<:Number} = T
57

base/char.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

3+
import Core: AbstractChar, Char
4+
35
"""
46
The `AbstractChar` type is the supertype of all character implementations
57
in Julia. A character represents a Unicode code point, and can be converted

base/client.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ function exec_options(opts)
265265
distributed_mode = (opts.worker == 1) || (opts.nprocs > 0) || (opts.machine_file != C_NULL)
266266
if distributed_mode
267267
let Distributed = require(PkgId(UUID((0x8ba89e20_285c_5b6f, 0x9357_94700520ee1b)), "Distributed"))
268-
Core.eval(MainInclude, :(const Distributed = $Distributed))
268+
MainInclude.Distributed = Distributed
269269
Core.eval(Main, :(using Base.MainInclude.Distributed))
270270
invokelatest(Distributed.process_opts, opts)
271271
end
@@ -400,7 +400,7 @@ function load_InteractiveUtils(mod::Module=Main)
400400
try
401401
# TODO: we have to use require_stdlib here because it is a dependency of REPL, but we would sort of prefer not to
402402
let InteractiveUtils = require_stdlib(PkgId(UUID(0xb77e0a4c_d291_57a0_90e8_8db25a27a240), "InteractiveUtils"))
403-
Core.eval(MainInclude, :(const InteractiveUtils = $InteractiveUtils))
403+
MainInclude.InteractiveUtils = InteractiveUtils
404404
end
405405
catch ex
406406
@warn "Failed to import InteractiveUtils into module $mod" exception=(ex, catch_backtrace())
@@ -535,6 +535,10 @@ The thrown errors are collected in a stack of exceptions.
535535
"""
536536
global err = nothing
537537

538+
# Used for memoizing require_stdlib of these modules
539+
global InteractiveUtils::Module
540+
global Distributed::Module
541+
538542
# weakly exposes ans and err variables to Main
539543
export ans, err
540544
end

base/coreir.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ while processing a call, then `Conditional` everywhere else.
4949
"""
5050
Core.InterConditional
5151

52-
InterConditional(var::SlotNumber, @nospecialize(thentype), @nospecialize(elsetype)) =
52+
Core.InterConditional(var::SlotNumber, @nospecialize(thentype), @nospecialize(elsetype)) =
5353
InterConditional(slot_id(var), thentype, elsetype)

base/deprecated.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ end
353353
@deprecate one(i::CartesianIndex) oneunit(i)
354354
@deprecate one(I::Type{CartesianIndex{N}}) where {N} oneunit(I)
355355

356+
import .MPFR: BigFloat
356357
@deprecate BigFloat(x, prec::Int) BigFloat(x; precision=prec)
357358
@deprecate BigFloat(x, prec::Int, rounding::RoundingMode) BigFloat(x, rounding; precision=prec)
358359
@deprecate BigFloat(x::Real, prec::Int) BigFloat(x; precision=prec)

base/expr.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1694,6 +1694,6 @@ function (g::Core.GeneratedFunctionStub)(world::UInt, source::Method, @nospecial
16941694
Expr(:meta, :pop_loc))))
16951695
spnames = g.spnames
16961696
return generated_body_to_codeinfo(spnames === Core.svec() ? lam : Expr(Symbol("with-static-parameters"), lam, spnames...),
1697-
typename(typeof(g.gen)).module,
1697+
source.module,
16981698
source.isva)
16991699
end

base/filesystem.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ export File,
137137
S_IROTH, S_IWOTH, S_IXOTH, S_IRWXO
138138

139139
import .Base:
140-
IOError, _UVError, _sizeof_uv_fs, check_open, close, eof, eventloop, fd, isopen,
141-
bytesavailable, position, read, read!, readavailable, seek, seekend, show,
140+
IOError, _UVError, _sizeof_uv_fs, check_open, close, closewrite, eof, eventloop, fd, isopen,
141+
bytesavailable, position, read, read!, readbytes!, readavailable, seek, seekend, show,
142142
skip, stat, unsafe_read, unsafe_write, write, transcode, uv_error,
143143
setup_stdio, rawhandle, OS_HANDLE, INVALID_OS_HANDLE, windowserror, filesize,
144-
isexecutable, isreadable, iswritable, MutableDenseArrayType
144+
isexecutable, isreadable, iswritable, MutableDenseArrayType, truncate
145145

146146
import .Base.RefValue
147147

0 commit comments

Comments
 (0)