Skip to content

Commit

Permalink
Switch to is_quotenode_egal for invalidation-resistance (#68)
Browse files Browse the repository at this point in the history
Packages that specialize `==` could invalidate the former code,
this makes it resistant.
  • Loading branch information
timholy authored Aug 18, 2021
1 parent e836f50 commit ff8998f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/LoweredCodeUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module LoweredCodeUtils

using JuliaInterpreter
using JuliaInterpreter: SSAValue, SlotNumber, Frame
using JuliaInterpreter: @lookup, moduleof, pc_expr, step_expr!, is_global_ref, is_quotenode, whichtt,
using JuliaInterpreter: @lookup, moduleof, pc_expr, step_expr!, is_global_ref, is_quotenode_egal, whichtt,
next_until!, finish_and_return!, get_return, nstatements, codelocation, linetable,
is_return, lookup_return, is_GotoIfNot, is_ReturnNode

Expand Down
4 changes: 2 additions & 2 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ function typedef_range(src::CodeInfo, idx)
(stmt.head === :global || stmt.head === :return) && break
if stmt.head === :call
if (is_global_ref(stmt.args[1], Core, :_typebody!) ||
isdefined(Core, :_typebody!) && is_quotenode(stmt.args[1], Core._typebody!))
isdefined(Core, :_typebody!) && is_quotenode_egal(stmt.args[1], Core._typebody!))
have_typebody = true
elseif (is_global_ref(stmt.args[1], Core, :_equiv_typedef) ||
isdefined(Core, :_equiv_typedef) && is_quotenode(stmt.args[1], Core._equiv_typedef))
isdefined(Core, :_equiv_typedef) && is_quotenode_egal(stmt.args[1], Core._equiv_typedef))
have_equivtypedef = true
# Advance to the type-assignment
while iend <= n
Expand Down

0 comments on commit ff8998f

Please sign in to comment.