Skip to content

Commit 3da84bc

Browse files
committed
Small tweaks to reduce the need for inference
This reduces the number of generators that need to be compiled, fixes a minor inference issue, and adds a couple of precompiles. All of very minor consequence, but not bad to have.
1 parent 36a2f57 commit 3da84bc

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
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 = "1.2.6"
4+
version = "1.2.7"
55

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

99
[compat]
10-
JuliaInterpreter = "0.8"
10+
JuliaInterpreter = "0.8.8"
1111
julia = "1"
1212

1313
[extras]

src/codeedges.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ struct CodeLinks
3232
nameassigns::Dict{NamedVar,Vector{Int}}
3333
end
3434
function CodeLinks(nlines::Int, nslots::Int)
35-
return CodeLinks([Links() for _ = 1:nlines],
36-
[Links() for _ = 1:nlines],
37-
[Links() for _ = 1:nslots],
38-
[Links() for _ = 1:nslots],
35+
makelinks(n) = [Links() for _ = 1:n]
36+
37+
return CodeLinks(makelinks(nlines),
38+
makelinks(nlines),
39+
makelinks(nslots),
40+
makelinks(nslots),
3941
[Int[] for _ = 1:nslots],
4042
Dict{NamedVar,Links}(),
4143
Dict{NamedVar,Links}(),

src/packagedef.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ if ccall(:jl_generating_output, Cint, ()) == 1
4242
@assert precompile(Tuple{typeof(callchain), Vector{SelfCall}})
4343
@assert precompile(Tuple{typeof(callchain), Vector{NamedTuple{(:linetop, :linebody, :callee, :caller),Tuple{Int64,Int64,Symbol,Union{Bool, Symbol}}}}})
4444

45+
@assert precompile(CodeLinks, (Int, Int))
46+
@assert precompile(CodeEdges, (Int,))
4547
@assert precompile(CodeEdges, (CodeInfo,))
4648
@assert precompile(add_links!, (Pair{Union{SSAValue,SlotNumber,NamedVar},Links}, Any, CodeLinks))
4749
@assert precompile(lines_required!, (Vector{Bool}, Set{NamedVar}, CodeInfo, CodeEdges))

src/signatures.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function identify_framemethod_calls(frame)
143143
if length(tsrc.code) == 1
144144
tstmt = tsrc.code[1]
145145
if is_return(tstmt)
146-
tex = isa(tstmt, Expr) ? tstmt.args[1] : tstmt.val
146+
tex = JuliaInterpreter.get_return_node(tstmt)
147147
if isa(tex, Expr)
148148
if tex.head === :method && (methname = tex.args[1]; isa(methname, Symbol))
149149
push!(refs, methname=>i)

0 commit comments

Comments
 (0)