Skip to content

Commit e624440

Browse files
authored
inference: add missing tfuncs to the xxxglobal builtins (#56641)
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. @nanosoldier `runbenchmarks("inference", vs=":master")`
1 parent 858cb62 commit e624440

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Compiler/src/tfuncs.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,8 +2469,6 @@ function getfield_effects(𝕃::AbstractLattice, argtypes::Vector{Any}, @nospeci
24692469
return Effects(EFFECTS_TOTAL; consistent, nothrow, inaccessiblememonly, noub)
24702470
end
24712471

2472-
2473-
24742472
"""
24752473
builtin_effects(𝕃::AbstractLattice, f::Builtin, argtypes::Vector{Any}, rt) -> Effects
24762474
@@ -3065,6 +3063,14 @@ end
30653063
return M Module && s Symbol
30663064
end
30673065

3066+
add_tfunc(getglobal, 2, 3, @nospecs((𝕃::AbstractLattice, args...)->Any), 1)
3067+
add_tfunc(setglobal!, 3, 4, @nospecs((𝕃::AbstractLattice, args...)->Any), 3)
3068+
add_tfunc(swapglobal!, 3, 4, @nospecs((𝕃::AbstractLattice, args...)->Any), 3)
3069+
add_tfunc(modifyglobal!, 4, 5, @nospecs((𝕃::AbstractLattice, args...)->Any), 3)
3070+
add_tfunc(replaceglobal!, 4, 6, @nospecs((𝕃::AbstractLattice, args...)->Any), 3)
3071+
add_tfunc(setglobalonce!, 3, 5, @nospecs((𝕃::AbstractLattice, args...)->Bool), 3)
3072+
add_tfunc(Core.get_binding_type, 2, 2, @nospecs((𝕃::AbstractLattice, args...)->Type), 0)
3073+
30683074
# foreigncall
30693075
# ===========
30703076

0 commit comments

Comments
 (0)