Skip to content

Commit

Permalink
wip: inference: allow semi-concrete interpret to perform recursive in…
Browse files Browse the repository at this point in the history
…ference

TODOs that should be addressed before merging:
- [x] implement a simple recursion detection mechanism for `IRInterpretationState`
- [x] add proper invalidation support
- [x] allow constant inference from semi-concrete interpretation
- [x] propagate callinfo and allow double inlining

fix #48679

wip
  • Loading branch information
aviatesk committed Mar 16, 2023
1 parent bcfa77d commit 45a6049
Show file tree
Hide file tree
Showing 13 changed files with 741 additions and 568 deletions.
348 changes: 177 additions & 171 deletions base/compiler/abstractinterpretation.jl

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion base/compiler/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ include("compiler/ssair/domtree.jl")
include("compiler/ssair/ir.jl")

include("compiler/abstractlattice.jl")

include("compiler/inferenceresult.jl")
include("compiler/inferencestate.jl")

Expand Down
8 changes: 3 additions & 5 deletions base/compiler/inferenceresult.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function va_process_argtypes(@nospecialize(va_handler!), 𝕃::AbstractLattice,
nargs = Int(def.nargs)
if isva || isvarargtype(given_argtypes[end])
isva_given_argtypes = Vector{Any}(undef, nargs)
for i = 1:(nargs - isva)
for i = 1:(nargs-isva)
isva_given_argtypes[i] = argtype_by_index(given_argtypes, i)
end
if isva
Expand All @@ -110,10 +110,8 @@ function most_general_argtypes(method::Union{Method, Nothing}, @nospecialize(spe
isva = !toplevel && method.isva
linfo_argtypes = Any[(unwrap_unionall(specTypes)::DataType).parameters...]
nargs::Int = toplevel ? 0 : method.nargs
if !withfirst
# For opaque closure, the closure environment is processed elsewhere
nargs -= 1
end
# For opaque closure, the closure environment is processed elsewhere
!withfirst && (nargs -= 1)
cache_argtypes = Vector{Any}(undef, nargs)
# First, if we're dealing with a varargs method, then we set the last element of `args`
# to the appropriate `Tuple` type or `PartialStruct` instance.
Expand Down
Loading

0 comments on commit 45a6049

Please sign in to comment.