Skip to content

Commit 4c452c3

Browse files
authored
Merge branch 'master' into os/more-memoryrefnew
2 parents 4a8e1a9 + a812f03 commit 4c452c3

Some content is hidden

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

61 files changed

+396
-245
lines changed

.github/workflows/PrAssignee.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,6 @@ jobs:
202202
// console.log('ERROR: Failed to add add prReviewLabel');
203203
// }
204204
205-
// Post a comment
206-
const commentBody = `Hello! I am a bot.\n\nThank you for your pull request!\n\nI have assigned \`@${selectedAssignee}\` to this pull request.\n\n\`@${selectedAssignee}\` can either choose to review this pull request themselves, or they can choose to find someone else to review this pull request.\n\nNote: If you are a Julia committer, please make sure that your organization membership is public.`
207-
console.log('Attempting to post bot comment on the PR...');
208-
await github.rest.issues.createComment({
209-
owner: context.repo.owner,
210-
repo: context.repo.repo,
211-
issue_number: context.payload.pull_request.number,
212-
body: commentBody,
213-
});
214-
215205
// Exit with error if any problems were encountered earlier
216206
if (weDidEncounterError) {
217207
const msg = 'ERROR: Encountered at least one problem while running the script';

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ corresponding test to ensure that the test is still passing with your changes.
5050
- If you are adding a new test, add it to an existing test file. Do not create a new test file unless explicitly instructed.
5151
- Write one comment at the top of the test to explain what is being tested.
5252
Otherwise keep comments minimal.
53+
- Use the environment variable `JULIA_TEST_FAILFAST=1` to make tests fail fast.
5354

5455
### External dependencies
5556

Compiler/LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2009-2024: Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors: https://github.com/JuliaLang/julia/contributors
3+
Copyright (c) 2009-2025: Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors: https://github.com/JuliaLang/julia/contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining
66
a copy of this software and associated documentation files (the

Compiler/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Compiler"
22
uuid = "807dbc54-b67e-4c79-8afb-eafe4df6f2e1"
3-
version = "0.1.0"
3+
version = "0.1.1"
44

55
[compat]
66
julia = "1.10"

Compiler/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ Compiler = "807dbc54-b67e-4c79-8afb-eafe4df6f2e1"
1919
Compiler = "0.1"
2020
```
2121

22-
With the setup above, [the special placeholder version (v0.1.0)](https://github.com/JuliaLang/BaseCompiler.jl)
22+
With the setup above, [the special placeholder version (v0.1)](https://github.com/JuliaLang/BaseCompiler.jl)
2323
will be installed by default.[^1]
2424

25-
[^1]: Currently, only version v0.1.0 is registered in the [General](https://github.com/JuliaRegistries/General) registry.
25+
[^1]: Currently, only version v0.1 is registered in the [General](https://github.com/JuliaRegistries/General) registry.
2626

2727
If needed, you can switch to a custom implementation of the `Compiler` module by running
2828
```julia-repl

Compiler/src/optimize.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ set_inlineable!(src::CodeInfo, val::Bool) =
113113
function inline_cost_clamp(x::Int)
114114
x > MAX_INLINE_COST && return MAX_INLINE_COST
115115
x < MIN_INLINE_COST && return MIN_INLINE_COST
116-
return convert(InlineCostType, x)
116+
x = ccall(:jl_encode_inlining_cost, UInt8, (InlineCostType,), x)
117+
x = ccall(:jl_decode_inlining_cost, InlineCostType, (UInt8,), x)
118+
return x
117119
end
118120

119121
const SRC_FLAG_DECLARED_INLINE = 0x1

Compiler/src/tfuncs.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,9 @@ end
405405
return isdefined_tfunc(𝕃, arg1, sym)
406406
end
407407
@nospecs function isdefined_tfunc(𝕃::AbstractLattice, arg1, sym)
408+
if arg1 isa MustAlias
409+
arg1 = widenmustalias(arg1)
410+
end
408411
arg1t = arg1 isa Const ? typeof(arg1.val) : isconstType(arg1) ? typeof(arg1.parameters[1]) : widenconst(arg1)
409412
a1 = unwrap_unionall(arg1t)
410413
if isa(a1, DataType) && !isabstracttype(a1)

Compiler/test/inference.jl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,12 +2313,6 @@ let 𝕃ᵢ = InferenceLattice(MustAliasesLattice(BaseInferenceLattice.instance)
23132313
@test ifelse_tfunc(MustAlias(2, AliasableField{Any}, 1, Int), Int, Int) === Union{}
23142314
end
23152315

2316-
@testset "issue #56913: `BoundsError` in type inference" begin
2317-
R = UnitRange{Int}
2318-
@test Type{AbstractVector} == Base.infer_return_type(Base.promote_typeof, Tuple{R, R, Vector{Any}, Vararg{R}})
2319-
@test Type{AbstractVector} == Base.infer_return_type(Base.promote_typeof, Tuple{R, R, Vector{Any}, R, Vararg{R}})
2320-
end
2321-
23222316
maybeget_mustalias_tmerge(x::AliasableField) = x.f
23232317
maybeget_mustalias_tmerge(x) = x
23242318
@test Base.return_types((Union{Nothing,AliasableField{Any}},); interp=MustAliasInterpreter()) do x
@@ -2593,6 +2587,19 @@ end |> only === Compiler.InterMustAlias
25932587
return 0
25942588
end == Integer
25952589

2590+
# `isdefined` accuracy for `MustAlias`
2591+
@test Base.infer_return_type((Any,); interp=MustAliasInterpreter()) do x
2592+
xx = Ref{Any}(x)
2593+
xxx = Some{Any}(xx)
2594+
Val(isdefined(xxx.value, :x))
2595+
end == Val{true}
2596+
2597+
@testset "issue #56913: `BoundsError` in type inference" begin
2598+
R = UnitRange{Int}
2599+
@test Type{AbstractVector} == Base.infer_return_type(Base.promote_typeof, Tuple{R, R, Vector{Any}, Vararg{R}})
2600+
@test Type{AbstractVector} == Base.infer_return_type(Base.promote_typeof, Tuple{R, R, Vector{Any}, R, Vararg{R}})
2601+
end
2602+
25962603
function f25579(g)
25972604
h = g[]
25982605
t = (h === nothing)

base/essentials.jl

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,26 @@ macro _nospecializeinfer_meta()
377377
return Expr(:meta, :nospecializeinfer)
378378
end
379379

380+
function _checkbounds_array(::Type{Bool}, A::Union{Array, GenericMemory}, i::Int)
381+
@inline
382+
ult_int(bitcast(UInt, sub_int(i, 1)), bitcast(UInt, length(A)))
383+
end
384+
function _checkbounds_array(A::Union{Array, GenericMemory}, i::Int)
385+
@inline
386+
_checkbounds_array(Bool, A, i) || throw_boundserror(A, (i,))
387+
end
388+
380389
default_access_order(a::GenericMemory{:not_atomic}) = :not_atomic
381390
default_access_order(a::GenericMemory{:atomic}) = :monotonic
382391
default_access_order(a::GenericMemoryRef{:not_atomic}) = :not_atomic
383392
default_access_order(a::GenericMemoryRef{:atomic}) = :monotonic
384393

385-
getindex(A::GenericMemory, i::Int) = (@_noub_if_noinbounds_meta;
386-
memoryrefget(memoryrefnew(A, i, @_boundscheck), default_access_order(A), false))
394+
function getindex(A::GenericMemory, i::Int)
395+
@_noub_if_noinbounds_meta
396+
(@_boundscheck) && _checkbounds_array(A, i)
397+
memoryrefget(memoryrefnew(A, i, false), default_access_order(A), false)
398+
end
399+
387400
getindex(A::GenericMemoryRef) = memoryrefget(A, default_access_order(A), @_boundscheck)
388401

389402
"""
@@ -949,13 +962,13 @@ end
949962
# linear indexing
950963
function getindex(A::Array, i::Int)
951964
@_noub_if_noinbounds_meta
952-
@boundscheck ult_int(bitcast(UInt, sub_int(i, 1)), bitcast(UInt, length(A))) || throw_boundserror(A, (i,))
965+
@boundscheck _checkbounds_array(A, i)
953966
memoryrefget(memoryrefnew(getfield(A, :ref), i, false), :not_atomic, false)
954967
end
955968
# simple Array{Any} operations needed for bootstrap
956969
function setindex!(A::Array{Any}, @nospecialize(x), i::Int)
957970
@_noub_if_noinbounds_meta
958-
@boundscheck ult_int(bitcast(UInt, sub_int(i, 1)), bitcast(UInt, length(A))) || throw_boundserror(A, (i,))
971+
@boundscheck _checkbounds_array(A, i)
959972
memoryrefset!(memoryrefnew(getfield(A, :ref), i, false), x, :not_atomic, false)
960973
return A
961974
end

base/iobuffer.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ function take!(io::IOBuffer)
771771
elseif io.writable
772772
data = wrap(Array, memoryref(io.data, io.ptr), nbytes)
773773
else
774-
data = read!(io, data)
774+
error("Unreachable IOBuffer state")
775775
end
776776
end
777777
if io.writable

0 commit comments

Comments
 (0)