Skip to content

Commit 027f96e

Browse files
committed
compute setfield! throwness with JuliaLang/julia#43603
1 parent 6a0d5d8 commit 027f96e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/EscapeAnalysis.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ function escape_builtin!(::typeof(setfield!), astate::AnalysisState, pc::Int, ar
997997
else
998998
# unanalyzable object (e.g. obj::GlobalRef): escape field value conservatively
999999
add_escape_change!(astate, val, AllEscape())
1000-
return false
1000+
@goto add_thrown_escapes
10011001
end
10021002
AliasEscapes = objinfo.AliasEscapes
10031003
if isa(AliasEscapes, Bool)
@@ -1065,7 +1065,14 @@ function escape_builtin!(::typeof(setfield!), astate::AnalysisState, pc::Int, ar
10651065
ssainfo = NoEscape()
10661066
end
10671067
add_escape_change!(astate, val, ssainfo)
1068-
return false
1068+
# compute the throwness of this setfield! call here since builtin_nothrow doesn't account for that
1069+
@label add_thrown_escapes
1070+
argtypes = Any[]
1071+
for i = 2:length(args)
1072+
push!(argtypes, argextype(args[i], ir))
1073+
end
1074+
setfield!_nothrow(argtypes) || add_thrown_escapes!(astate, pc, args, 2)
1075+
return true
10691076
end
10701077

10711078
function escape_builtin!(::typeof(arrayref), astate::AnalysisState, pc::Int, args::Vector{Any})

0 commit comments

Comments
 (0)