Skip to content

Commit 25d95fb

Browse files
committed
minor code efficiency refactors
1 parent 959706d commit 25d95fb

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/toplevel/virtualprocess.jl

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,16 +1156,18 @@ function is_known_call(@nospecialize(stmt), func::Symbol, stmts::Vector{Any})
11561156
end
11571157
function is_known_getproperty(@nospecialize(stmt), func::Symbol, stmts::Vector{Any})
11581158
isexpr(stmt, :call) || return false
1159+
length(stmt.args) 3 || return false
11591160
f = stmt.args[1]
11601161
if f isa SSAValue
11611162
f = stmts[f.id]
11621163
end
1163-
callee_matches(f, Base, :getproperty) && length(stmt.args) 3 &&
1164-
is_quotenode_egal(stmt.args[3], func) && return true
1165-
callee_matches(f, Core, :getproperty) && length(stmt.args) 3 &&
1166-
is_quotenode_egal(stmt.args[3], func) && return true
1167-
callee_matches(f, Core.Compiler, :getproperty) && length(stmt.args) 3 &&
1168-
is_quotenode_egal(stmt.args[3], func) && return true
1164+
if (callee_matches(f, Base, :getproperty) ||
1165+
callee_matches(f, Core, :getproperty) ||
1166+
callee_matches(f, Core.Compiler, :getproperty))
1167+
if is_quotenode_egal(stmt.args[3], func)
1168+
return true
1169+
end
1170+
end
11691171
return false
11701172
end
11711173

@@ -1244,17 +1246,15 @@ function add_required_inplace!(concretize::BitVector, src::CodeInfo, edges, cl)
12441246
changed = false
12451247
for i = 1:length(src.code)
12461248
stmt = src.code[i]
1247-
if isexpr(stmt, :call)
1249+
if isexpr(stmt, :call) && length(stmt.args) 2
12481250
func = stmt.args[1]
12491251
if (callee_matches(func, Base, :push!) ||
12501252
callee_matches(func, Base, :pop!) ||
12511253
callee_matches(func, Base, :empty!) ||
12521254
callee_matches(func, Base, :setindex!))
1253-
if length(stmt.args) 2
1254-
if is_arg_requested(stmt.args[2], concretize, edges, cl)
1255-
if !concretize[i]
1256-
changed = concretize[i] = true
1257-
end
1255+
if is_arg_requested(stmt.args[2], concretize, edges, cl)
1256+
if !concretize[i]
1257+
changed = concretize[i] = true
12581258
end
12591259
end
12601260
end
@@ -1268,9 +1268,8 @@ function is_arg_requested(@nospecialize(arg), concretize, edges, cl)
12681268
return concretize[arg.id] || any(@view concretize[edges.preds[arg.id]])
12691269
elseif arg isa SlotNumber
12701270
return any(@view concretize[cl.slotassigns[arg.id]])
1271-
else
1272-
return false
12731271
end
1272+
return false
12741273
end
12751274

12761275
function select_dependencies!(concretize::BitVector, src::CodeInfo, edges, cl)

0 commit comments

Comments
 (0)