Skip to content

Commit a974c71

Browse files
authored
use a Set of compiled modules instead of hardcoding it (#244)
1 parent 798f514 commit a974c71

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

docs/src/dev_reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ JuliaInterpreter.BreakpointRef
8383
JuliaInterpreter.framedict
8484
JuliaInterpreter.genframedict
8585
JuliaInterpreter.compiled_methods
86+
JuliaInterpreter.compiled_modules
8687
```
8788

8889
## Utilities

src/JuliaInterpreter.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ function set_compiled_methods()
7777
# These are currently extremely slow to interpret (https://github.com/JuliaDebug/JuliaInterpreter.jl/issues/193)
7878
push!(compiled_methods, which(subtypes, Tuple{Module, Type}))
7979
push!(compiled_methods, which(subtypes, Tuple{Type}))
80+
81+
push!(compiled_modules, Core.Compiler)
82+
push!(compiled_modules, Base.Threads)
8083
end
8184

8285
function __init__()

src/construct.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ rather than recursed into via the interpreter.
2020
"""
2121
const compiled_methods = Set{Method}()
2222

23+
"""
24+
`mod ∈ compiled_modules` indicates that any method in `mod` should be run using [`Compiled`](@ref)
25+
rather than recursed into via the interpreter.
26+
"""
27+
const compiled_modules = Set{Module}()
28+
2329
const junk = Base.IdSet{FrameData}() # to allow re-use of allocated memory (this is otherwise a bottleneck)
2430
recycle(frame) = push!(junk, frame.framedata) # using an IdSet ensures that a frame can't be added twice
2531

@@ -116,7 +122,7 @@ end
116122

117123
function prepare_framecode(method::Method, @nospecialize(argtypes); enter_generated=false)
118124
sig = method.sig
119-
if method.module == Core.Compiler || method.module == Base.Threads || method compiled_methods
125+
if method.module compiled_modules || method compiled_methods
120126
return Compiled()
121127
end
122128
# Get static parameters

0 commit comments

Comments
 (0)