Skip to content

Commit

Permalink
sprinkle self-profiling code
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Oct 9, 2020
1 parent a0a6a02 commit b7d057f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,12 @@ function typeinf(interp::TPInterpreter, frame::InferenceState)
end
end

# @info "before typeinf" frame.linfo => ret

ret = @invoke typeinf(interp::AbstractInterpreter, frame::InferenceState)

# @info "after typeinf" frame.linfo => ret

# report (local) undef var error
# this only works when optimization is enabled, just because `:throw_undef_if_not` and
# `:(unreachable)` are introduced by `optimize`
Expand Down
15 changes: 15 additions & 0 deletions src/tpcache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,21 @@ WorldView(tpc::TPCache, args...) = WorldView(tpc, WorldRange(args...))
CC.haskey(tpc::TPCache, mi::MethodInstance) = CC.haskey(tpc.native, mi)

function CC.get(tpc::TPCache, mi::MethodInstance, default)
# # for self profiling
# if isa(mi.def, Method)
# # ignore cache for TypeProfiler's code itself
# mod = mi.def.module
# if mod == (@__MODULE__) || mod == JuliaInterpreter
# return default
# end
#
# file = mi.def.file
# # ignoring entire cache for `Core.Compiler` will slows down profiling performance too bad
# if file === Symbol("compiler/typeinfer.jl") || file === Symbol("compiler/abstractinterpretation.jl")
# return default
# end
# end

ret = CC.get(tpc.native, mi, default)

ret === default && return default
Expand Down

0 comments on commit b7d057f

Please sign in to comment.