Skip to content

Commit c4d6d64

Browse files
committed
Add fixes for Julia 1.0
1 parent 1e96a81 commit c4d6d64

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

src/MethodAnalysis.jl

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ function worlds(mi::Core.MethodInstance)
3434
w = Tuple{UInt,UInt}[]
3535
if isdefined(mi, :cache)
3636
ci = mi.cache
37-
push!(w, (ci.min_world, ci.max_world))
37+
push!(w, (ci.min_world % UInt, ci.max_world % UInt))
3838
while isdefined(ci, :next)
3939
ci = ci.next
40-
push!(w, (ci.min_world, ci.max_world))
40+
push!(w, (ci.min_world % UInt, ci.max_world % UInt))
4141
end
4242
end
4343
return w
@@ -46,16 +46,19 @@ end
4646
# Not sure we want to change the meaning of == here, so let's define our own name
4747
# A few fields are deliberately unchecked
4848
function equal(ci1::Core.CodeInfo, ci2::Core.CodeInfo)
49-
return ci1.code == ci2.code &&
50-
ci1.codelocs == ci2.codelocs &&
51-
ci1.ssavaluetypes == ci2.ssavaluetypes &&
52-
ci1.ssaflags == ci2.ssaflags &&
53-
ci1.method_for_inference_limit_heuristics == ci2.method_for_inference_limit_heuristics &&
54-
ci1.linetable == ci2.linetable &&
55-
ci1.slotnames == ci2.slotnames &&
56-
ci1.slotflags == ci2.slotflags &&
57-
ci1.slottypes == ci2.slottypes &&
58-
ci1.rettype == ci2.rettype
49+
ret = ci1.code == ci2.code &&
50+
ci1.codelocs == ci2.codelocs &&
51+
ci1.ssavaluetypes == ci2.ssavaluetypes &&
52+
ci1.ssaflags == ci2.ssaflags &&
53+
ci1.method_for_inference_limit_heuristics == ci2.method_for_inference_limit_heuristics &&
54+
ci1.linetable == ci2.linetable &&
55+
ci1.slotnames == ci2.slotnames &&
56+
ci1.slotflags == ci2.slotflags
57+
if VERSION >= v"1.2"
58+
ret &= ci1.slottypes == ci2.slottypes &&
59+
ci1.rettype == ci2.rettype
60+
end
61+
return ret
5962
end
6063
equal(p1::Pair, p2::Pair) = p1.second == p2.second && equal(p1.first, p2.first)
6164

test/runtests.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,11 @@ applyf(Any[1, true])
121121
end
122122

123123
@testset "Invalidation" begin
124-
src, w = Invalidation.src, Invalidation.w
125-
mi = instance(Invalidation.applyf, (Vector{Any},))
126-
@test MethodAnalysis.equal(src, src)
127-
@test worlds(mi) != w
128-
@test !MethodAnalysis.equal(src, code_typed(Invalidation.applyf, (Vector{Any},))[1])
124+
if VERSION >= v"1.2"
125+
src, w = Invalidation.src, Invalidation.w
126+
mi = instance(Invalidation.applyf, (Vector{Any},))
127+
@test MethodAnalysis.equal(src, src)
128+
@test worlds(mi) != w
129+
@test !MethodAnalysis.equal(src, code_typed(Invalidation.applyf, (Vector{Any},))[1])
130+
end
129131
end

0 commit comments

Comments
 (0)