forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
effects: add effects analysis for array construction (JuliaLang#46015)
This commit implements an infrastructure to analyze effects of `:foreigncall` expression, and especially implements effects analysis for array constructions. Some improvements: ```julia julia> @noinline construct_array(@nospecialize(T), args...) = Array{T}(undef, args...); julia> function check_dims(T, dims) construct_array(T, dims...) return nothing end; ``` ```julia julia> code_typed() do check_dims(Int, (1,2,3)) end ``` ```diff diff --git a/_master b/_pr index b0ed0eaac1..38e2d3553d 100644 --- a/_master +++ b/_pr @@ -1,6 +1,4 @@ 1-element Vector{Any}: CodeInfo( -1 ─ invoke Main.construct_array(Int64::Any, -1::Int64, 2::Vararg{Int64}, 3)::Any -│ %2 = Main.nothing::Nothing -└── return %2 +1 ─ return nothing ) => Nothing ``` ```julia julia> code_typed() do check_dims(Int, (-1,2,3)) end ``` ```diff diff --git a/_master b/_pr index b0ed0eaac1..e5e724db10 100644 --- a/_master +++ b/_pr @@ -1,6 +1,5 @@ 1-element Vector{Any}: CodeInfo( -1 ─ invoke Main.construct_array(Int64::Any, -1::Int64, 2::Vararg{Int64}, 3)::Any -│ %2 = Main.nothing::Nothing -└── return %2 -) => Nothing +1 ─ invoke Main.check_dims(Main.Int::Type, (-1, 2, 3)::Tuple{Int64, Int64, Int64})::Union{} +└── unreachable +) => Union{} ```
- Loading branch information
Showing
5 changed files
with
145 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters