Skip to content

Commit 5d52f02

Browse files
committed
Merge pull request #16379 from JuliaLang/jb/exprcopy
only copy Exprs when copying IR
2 parents f76d49c + 8268ea0 commit 5d52f02

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

base/expr.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ end
2323
## expressions ##
2424

2525
copy(e::Expr) = (n = Expr(e.head);
26-
n.args = astcopy(e.args);
26+
n.args = copy_exprargs(e.args);
2727
n.typ = e.typ;
2828
n)
2929

3030
# copy parts of an AST that the compiler mutates
31-
astcopy(x::Expr) = copy(x)
32-
astcopy(x::Array{Any,1}) = Any[astcopy(a) for a in x]
33-
astcopy(x) = x
31+
copy_exprs(x::Expr) = copy(x)
32+
copy_exprs(x::ANY) = x
33+
copy_exprargs(x::Array{Any,1}) = Any[copy_exprs(a) for a in x]
3434

3535
==(x::Expr, y::Expr) = x.head === y.head && isequal(x.args, y.args)
3636
==(x::QuoteNode, y::QuoteNode) = isequal(x.value, y.value)

base/inference.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,7 +1397,7 @@ function unshare_linfo!(li::LambdaInfo)
13971397
if !isa(li.code, Array{Any,1})
13981398
li.code = ccall(:jl_uncompress_ast, Any, (Any,Any), li, li.code)
13991399
else
1400-
li.code = astcopy(li.code)
1400+
li.code = copy_exprargs(li.code)
14011401
end
14021402
li.slotnames = copy(li.slotnames)
14031403
li.slotflags = copy(li.slotflags)
@@ -2457,7 +2457,7 @@ function inlineable(f::ANY, ft::ANY, e::Expr, atypes::Vector{Any}, sv::Inference
24572457
if !isa(ast,Array{Any,1})
24582458
ast = ccall(:jl_uncompress_ast, Any, (Any,Any), linfo, ast)
24592459
else
2460-
ast = astcopy(ast)
2460+
ast = copy_exprargs(ast)
24612461
end
24622462
ast = ast::Array{Any,1}
24632463

0 commit comments

Comments
 (0)