Skip to content

Commit

Permalink
inference: add missing tfuncs to the xxxglobal builtins
Browse files Browse the repository at this point in the history
These builtins are now special-cased within `abstract_call_known` after
#56299, making them unnecessary for basic inference. As a
result, their tfuncs have been removed in the PR. However the algorithm
for calculating inlining costs still looks up these tfuncs, so they need
to be recovered. Additionally, the `generate_builtins.jl` script in
JuliaInterpreter also uses these tfuncs, so it would be worthwhile to
register even simple placeholder tfuncs for now.
  • Loading branch information
aviatesk committed Nov 21, 2024
1 parent 1fb8df6 commit 9e39fa5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Compiler/src/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2469,8 +2469,6 @@ function getfield_effects(𝕃::AbstractLattice, argtypes::Vector{Any}, @nospeci
return Effects(EFFECTS_TOTAL; consistent, nothrow, inaccessiblememonly, noub)
end



"""
builtin_effects(𝕃::AbstractLattice, f::Builtin, argtypes::Vector{Any}, rt) -> Effects
Expand Down Expand Up @@ -3065,6 +3063,14 @@ end
return M βŠ‘ Module && s βŠ‘ Symbol
end

add_tfunc(getglobal, 2, 3, @nospecs((𝕃::AbstractLattice, args...)->Any), 1)
add_tfunc(setglobal!, 3, 4, @nospecs((𝕃::AbstractLattice, args...)->Any), 3)
add_tfunc(swapglobal!, 3, 4, @nospecs((𝕃::AbstractLattice, args...)->Any), 3)
add_tfunc(modifyglobal!, 4, 5, @nospecs((𝕃::AbstractLattice, args...)->Any), 3)
add_tfunc(replaceglobal!, 4, 6, @nospecs((𝕃::AbstractLattice, args...)->Any), 3)
add_tfunc(setglobalonce!, 3, 5, @nospecs((𝕃::AbstractLattice, args...)->Bool), 3)
add_tfunc(Core.get_binding_type, 2, 2, @nospecs((𝕃::AbstractLattice, args...)->Type), 0)

# foreigncall
# ===========

Expand Down

0 comments on commit 9e39fa5

Please sign in to comment.