Skip to content

Commit c3ee610

Browse files
authored
Restore trackedheads (#126)
- Fixes timholy/Revise.jl#906 - removes a compilation warning about conflict in SSAValue and SlotNumber. - improves handling of `setglobal!`
1 parent c0f289a commit c3ee610

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name = "LoweredCodeUtils"
22
uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b"
33
authors = ["Tim Holy <[email protected]>"]
4-
version = "3.2.0"
4+
version = "3.2.1"
55

66
[deps]
77
JuliaInterpreter = "aa1ae85d-cabe-5617-a682-6adf51b2e16a"
88

99
[compat]
10-
JuliaInterpreter = "0.9"
10+
JuliaInterpreter = "0.9.44"
1111
julia = "1.10"
1212

1313
[extras]

src/LoweredCodeUtils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module LoweredCodeUtils
1111

1212
using JuliaInterpreter
1313
using JuliaInterpreter: SSAValue, SlotNumber, Frame
14-
using JuliaInterpreter: @lookup, moduleof, pc_expr, step_expr!, is_global_ref, is_quotenode_egal, whichtt,
14+
using JuliaInterpreter: @lookup, moduleof, pc_expr, step_expr!, is_global_ref, is_global_ref_egal, is_quotenode_egal, whichtt,
1515
next_until!, finish_and_return!, get_return, nstatements, codelocation, linetable,
1616
is_return, lookup_return
1717

src/codeedges.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,21 @@ function namedkeys(cl::CodeLinks)
192192
return ukeys
193193
end
194194

195+
# Required by Revise, but otherwise deprecated
196+
# The depwarn is currently disabled because Revise's tests check for empty warning logs
197+
function is_assignment_like(@nospecialize stmt)
198+
# Base.depwarn("is_assignment_like is deprecated, switch to `LoweredCodeUtils.get_lhs_rhs`", :is_assignment_like)
199+
return isexpr(stmt, :(=)) || isexpr(stmt, :const, 2)
200+
end
201+
195202
function get_lhs_rhs(@nospecialize stmt)
196203
if isexpr(stmt, :(=))
197204
return Pair{Any,Any}(stmt.args[1], stmt.args[2])
198205
elseif isexpr(stmt, :const) && length(stmt.args) == 2
199206
return Pair{Any,Any}(stmt.args[1], stmt.args[2])
200207
elseif isexpr(stmt, :call) && length(stmt.args) == 4
201208
f = stmt.args[1]
202-
if isa(f, GlobalRef) && f.name === :setglobal!
209+
if is_global_ref_egal(f, :setglobal!, Core.setglobal!)
203210
mod = stmt.args[2]
204211
mod isa Module || return nothing
205212
name = stmt.args[3]

src/packagedef.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
Base.Experimental.@optlevel 1
22

33
using Core: SimpleVector
4-
using Core.IR
4+
using Core.IR: CodeInfo, GotoIfNot, GotoNode, IR, MethodInstance, ReturnNode
5+
@static if isdefined(Core.IR, :EnterNode)
6+
using Core.IR: EnterNode
7+
end
58
using Core.Compiler: construct_domtree, construct_postdomtree, nearest_common_dominator,
69
postdominates
710
using Base.Meta: isexpr
811

912
const SSAValues = Union{Core.Compiler.SSAValue, JuliaInterpreter.SSAValue}
1013

14+
const trackedheads = (:method,) # Revise uses this (for now), don't delete; also update test/hastrackedexpr if this list gets expanded
1115
const structdecls = (:_structtype, :_abstracttype, :_primitivetype)
1216

1317
export signature, rename_framemethods!, methoddef!, methoddefs!, bodymethod

0 commit comments

Comments
 (0)