Skip to content

Commit 7f708ce

Browse files
committed
audit usages of Compiled
1 parent 4c91fa2 commit 7f708ce

File tree

9 files changed

+29
-23
lines changed

9 files changed

+29
-23
lines changed

src/commands.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Run `frame` until execution terminates. `pc` is either `nothing` (if execution t
66
when it hits a `return` statement) or a reference to a breakpoint.
77
In the latter case, `leaf(frame)` returns the frame in which it hit the breakpoint.
88
9-
`interp` controls call evaluation; `interp = Compiled()` evaluates :call expressions
9+
`interp` controls call evaluation; `interp = NonRecursiveInterpreter()` evaluates :call expressions
1010
by normal dispatch, whereas the default `interp = RecursiveInterpreter()` uses recursive interpretation.
1111
"""
1212
function finish!(interp::Interpreter, frame::Frame, istoplevel::Bool=false)
@@ -252,7 +252,7 @@ function maybe_step_through_wrapper!(interp::Interpreter, frame::Frame)
252252
end
253253
end
254254
ret = @invoke evaluate_call!(BreakOnCall()::Interpreter, frame::Frame, last::Expr)
255-
if !isa(ret, BreakpointRef) # Happens if next call is Compiled
255+
if !isa(ret, BreakpointRef) # Happens if next call is compiled
256256
return frame
257257
end
258258
frame.framedata.ssavalues[frame.pc] = Wrapper()

src/construct.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ for the generator itself, its framecode would be stored in [`framedict`](@ref).
1515
const genframedict = Dict{Tuple{Method,Type},FrameCode}() # the same for @generated functions
1616

1717
"""
18-
`meth ∈ compiled_methods` indicates that `meth` should be run using [`Compiled`](@ref)
18+
`meth ∈ compiled_methods` indicates that `meth` should be run using [`NonRecursiveInterpreter`](@ref)
1919
rather than recursed into via the interpreter.
2020
"""
2121
const compiled_methods = Set{Method}()
2222

2323
"""
24-
`meth ∈ interpreted_methods` indicates that `meth` should *not* be run using [`Compiled`](@ref)
24+
`meth ∈ interpreted_methods` indicates that `meth` should *not* be run using [`NonRecursiveInterpreter`](@ref)
2525
and recursed into via the interpreter. This takes precedence over [`compiled_methods`](@ref) and
2626
[`compiled_modules`](@ref).
2727
"""
2828
const interpreted_methods = Set{Method}()
2929

3030
"""
31-
`mod ∈ compiled_modules` indicates that any method in `mod` should be run using [`Compiled`](@ref)
31+
`mod ∈ compiled_modules` indicates that any method in `mod` should be run using [`NonRecursiveInterpreter`](@ref)
3232
rather than recursed into via the interpreter.
3333
"""
3434
const compiled_modules = Set{Module}()

src/interpret.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ function maybe_eval_with_scope(@nospecialize(f), fargs::Vector{Any}, frame::Fram
224224
return nothing
225225
end
226226

227-
function evaluate_call!(interp::Compiled, frame::Frame, call_expr::Expr, enter_generated::Bool=false)
227+
function evaluate_call!(interp::NonRecursiveInterpreter, frame::Frame, call_expr::Expr, enter_generated::Bool=false)
228228
# @assert !enter_generated
229229
pc = frame.pc
230230
ret = bypass_builtins(interp, frame, call_expr, pc)
@@ -520,7 +520,7 @@ function step_expr!(interp::Interpreter, frame::Frame, @nospecialize(node), isto
520520
end
521521
elseif node.head === :thunk
522522
newframe = Frame(moduleof(frame), node.args[1]::CodeInfo)
523-
if isa(interp, Compiled)
523+
if isa(interp, NonRecursiveInterpreter)
524524
finish!(interp, newframe, true)
525525
else
526526
newframe.caller = frame
@@ -610,9 +610,9 @@ end
610610
Execute the next statement in `frame`. `pc` is the new program counter, or `nothing`
611611
if execution terminates, or a [`BreakpointRef`](@ref) if execution hits a breakpoint.
612612
613-
`interp` controls call evaluation; `interp = Compiled()` evaluates :call expressions
614-
by normal dispatch. The default value `interp = RecursiveInterpreter()` will use recursive
615-
interpretation.
613+
`interp` controls call evaluation; `interp = NonRecursiveInterpreter()` evaluates :call
614+
expressions by normal dispatch.
615+
The default value `interp = RecursiveInterpreter()` will use recursive interpretation.
616616
617617
If you are evaluating `frame` at module scope you should pass `istoplevel=true`.
618618
"""

src/optimize.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ function build_compiled_llvmcall!(stmt::Expr, code::CodeInfo, idx::Int, evalmod:
181181
frame.pc = idxstart
182182
if idxstart < idx
183183
while true
184-
pc = step_expr!(Compiled(), frame)
184+
pc = step_expr!(NonRecursiveInterpreter(), frame)
185185
pc === idx && break
186186
pc === nothing && error("this should never happen")
187187
end

src/packagedef.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ using Random
1010
using Random.DSFMT
1111
using InteractiveUtils
1212

13-
export BreakpointRef, Compiled, ExprSplitter, Frame, Interpreter, RecursiveInterpreter,
14-
@bp, @breakpoint, @interpret,
13+
export BreakpointRef, Compiled, ExprSplitter, Frame,
14+
Interpreter, NonRecursiveInterpreter, RecursiveInterpreter
15+
export @bp, @breakpoint, @interpret,
1516
break_off, break_on, breakpoint, breakpoints, debug_command, disable, enable, leaf,
1617
on_breakpoints_updated, remove, root, toggle
1718

src/types.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ compiler.
2929
"""
3030
struct NonRecursiveInterpreter <: Interpreter end
3131

32+
"""
33+
const Compiled = NonRecursiveInterpreter
34+
35+
See [`NonRecursiveInterpreter`](@ref) for the details.
36+
"""
3237
const Compiled = NonRecursiveInterpreter # for backward compatibility
3338
Base.similar(::Compiled, sz) = Compiled() # to support similar(stack, 0)
3439

test/interpret.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -965,10 +965,10 @@ end
965965
@testset "changing interpreter for @interpret" begin
966966
@test sin(42) == @interpret sin(42)
967967
@test sin(42) == @interpret interp=RecursiveInterpreter() sin(42)
968-
@test sin(42) == @interpret interp=Compiled() sin(42)
969-
@test ((@allocated @interpret interp=RecursiveInterpreter() sin(42)) (@allocated @interpret interp=Compiled() sin(42)))
968+
@test sin(42) == @interpret interp=NonRecursiveInterpreter() sin(42)
969+
@test ((@allocated @interpret interp=RecursiveInterpreter() sin(42)) (@allocated @interpret interp=NonRecursiveInterpreter() sin(42)))
970970
let interp1 = RecursiveInterpreter(),
971-
interp2 = Compiled()
971+
interp2 = NonRecursiveInterpreter()
972972
@test sin(42) == @interpret interp=interp1 sin(42)
973973
@test sin(42) == @interpret interp=interp2 sin(42)
974974
end

test/interpret_scopedvalues.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ let m = only(methods(_sval1_func2))
3333
end
3434
end
3535
let frame = JuliaInterpreter.enter_call(sval1_func2)
36-
@test 2 == JuliaInterpreter.finish_and_return!(Compiled(), frame)
36+
@test 2 == JuliaInterpreter.finish_and_return!(NonRecursiveInterpreter(), frame)
3737
end
3838

3939
# preset `current_scope` support

test/utils.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function stacklength(frame)
2323
end
2424

2525
# Execute a frame using Julia's regular compiled-code dispatch for any :call expressions
26-
runframe(frame) = Some{Any}(finish_and_return!(Compiled(), frame))
26+
runframe(frame) = Some{Any}(finish_and_return!(NonRecursiveInterpreter(), frame))
2727

2828
# Execute a frame using the interpreter for all :call expressions (except builtins & intrinsics)
2929
runstack(frame) = Some{Any}(finish_and_return!(frame))
@@ -74,7 +74,7 @@ function evaluate_limited!(interp::Interpreter, frame::Frame, nstmts::Int, istop
7474
# _lnn_ = Aborted(frame, pc).at
7575
# _lnn_.file == Symbol("fake.jl") && _lnn_.line == 5 && isa(stmt, Core.GotoIfNot) && @show nstmts
7676
if isa(stmt, Expr)
77-
if stmt.head === :call && !isa(interp, Compiled)
77+
if stmt.head === :call && !isa(interp, NonRecursiveInterpreter)
7878
limited_interp.nstmts = nstmts
7979
try
8080
rhs = evaluate_call!(limited_interp, frame, stmt)
@@ -86,7 +86,7 @@ function evaluate_limited!(interp::Interpreter, frame::Frame, nstmts::Int, istop
8686
new_pc = handle_err(interp, frame, err)
8787
end
8888
nstmts = limited_interp.nstmts
89-
elseif stmt.head === :(=) && isexpr(stmt.args[2], :call) && !isa(interp, Compiled)
89+
elseif stmt.head === :(=) && isexpr(stmt.args[2], :call) && !isa(interp, NonRecursiveInterpreter)
9090
limited_interp.nstmts = nstmts
9191
try
9292
rhs = evaluate_call!(limited_interp, frame, stmt.args[2])
@@ -105,7 +105,7 @@ function evaluate_limited!(interp::Interpreter, frame::Frame, nstmts::Int, istop
105105
else
106106
limited_interp.nstmts = nstmts
107107
newframe = Frame(moduleof(frame), stmt)
108-
if isa(interp, Compiled)
108+
if isa(interp, NonRecursiveInterpreter)
109109
finish!(interp, newframe, true)
110110
else
111111
newframe.caller = frame
@@ -161,7 +161,7 @@ end
161161
### Functions needed on workers for running tests
162162

163163
function configure_test()
164-
# To run tests efficiently, certain methods must be run in Compiled mode,
164+
# To run tests efficiently, certain methods must be run in the compiled mode,
165165
# in particular those that are used by the Test infrastructure
166166
cm = JuliaInterpreter.compiled_methods
167167
empty!(cm)
@@ -205,7 +205,7 @@ function run_test_by_eval(test, fullpath, nstmts)
205205
ret, nstmtsleft = evaluate_limited!(frame, nstmtsleft, true)
206206
if isa(ret, Aborted)
207207
push!(aborts, ret)
208-
JuliaInterpreter.finish_stack!(Compiled(), frame, true)
208+
JuliaInterpreter.finish_stack!(NonRecursiveInterpreter(), frame, true)
209209
end
210210
end
211211
println("Finished ", $test)

0 commit comments

Comments
 (0)