Skip to content

Commit 303075b

Browse files
KristofferCtimholy
authored andcommitted
add subtypes to compiled methods (#205)
1 parent 3277e09 commit 303075b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/JuliaInterpreter.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ function set_compiled_methods()
6868
push!(compiled_methods, which(Base.access_env, Tuple{Function, AbstractString}))
6969
push!(compiled_methods, which(Base._hasenv, Tuple{Vector{UInt16}}))
7070
end
71+
# These are currently extremely slow to interpret (https://github.com/JuliaDebug/JuliaInterpreter.jl/issues/193)
72+
push!(compiled_methods, which(subtypes, Tuple{Module, Type}))
73+
push!(compiled_methods, which(subtypes, Tuple{Type}))
7174
end
7275

7376
function __init__()

test/interpret.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,4 +417,10 @@ e = try
417417
locs = JuliaInterpreter.locals(JuliaInterpreter.enter_call(foo, ""))
418418
@test length(locs) == 3 # #self# + 2 variables
419419
@test JuliaInterpreter.Variable("", :x, false) in locs
420-
@test JuliaInterpreter.Variable(String, :T, true) in locs
420+
@test JuliaInterpreter.Variable(String, :T, true) in locs
421+
422+
# Test interpreting subtypes finishes in a reasonable time
423+
@test @interpret subtypes(Integer) == subtypes(Integer)
424+
@test @interpret subtypes(Main, Integer) == subtypes(Main, Integer)
425+
@test (@elapsed @interpret subtypes(Integer)) < 30
426+
@test (@elapsed @interpret subtypes(Main, Integer)) < 30

0 commit comments

Comments
 (0)