Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: interprocedural alias analysis #93

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/EAUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function code_escapes(@nospecialize(f), @nospecialize(types=Base.default_tt(f));
interp = EscapeAnalyzer(interp, tt, optimize)
results = Base.code_typed_by_type(tt; optimize=true, world, interp)
isone(length(results)) || throw(ArgumentError("`code_escapes` only supports single analysis result"))
return EscapeResult(interp.ir, interp.state, interp.linfo, debuginfo===:source)
return EscapeResult(interp.ir, interp.state, interp.linfo, interp, debuginfo===:source)
end

# in order to run a whole analysis from ground zero (e.g. for benchmarking, etc.)
Expand Down Expand Up @@ -182,7 +182,7 @@ and then caches it into a global cache for later interprocedural propagation.
"""
function cache_escapes!(interp::EscapeAnalyzer,
caller::InferenceResult, estate::EscapeState, cacheir::IRCode)
cache = ArgEscapeCache(estate)
cache = ArgEscapeCache(cacheir, estate)
ecache = EscapeCache(cache, estate, cacheir)
interp.cache[caller] = ecache
return cache
Expand Down Expand Up @@ -305,11 +305,13 @@ struct EscapeResult
ir::IRCode
state::EscapeState
linfo::Union{Nothing,MethodInstance}
interp::Union{Nothing,EscapeAnalyzer}
source::Bool
function EscapeResult(ir::IRCode, state::EscapeState,
linfo::Union{Nothing,MethodInstance} = nothing,
interp::Union{Nothing,EscapeAnalyzer} = nothing,
source::Bool=false)
return new(ir, state, linfo, source)
return new(ir, state, linfo, interp, source)
end
end
Base.show(io::IO, result::EscapeResult) = print_with_info(io, result)
Expand Down
Loading