Skip to content

Commit a5e1f88

Browse files
committed
update LTS, drop v1.0 support
1 parent 701a99e commit a5e1f88

14 files changed

+42
-141
lines changed

.github/workflows/CI.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
version:
16-
- '1.0'
17-
- '1'
16+
- '1.6' # LTS
17+
- '1' # current stable
1818
- 'nightly'
1919
os:
2020
- ubuntu-latest

src/commands.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ function maybe_step_through_wrapper!(@nospecialize(recurse), frame::Frame)
218218
length(stmts) < 2 && return frame
219219
last = stmts[end-1]
220220
isexpr(last, :(=)) && (last = last.args[2])
221-
comp = VERSION < v"1.4.0-DEV.215" ? startswith : endswith
222-
is_kw = isa(scope, Method) && comp(String(Base.unwrap_unionall(Base.unwrap_unionall(scope.sig).parameters[1]).name.name), "#kw")
221+
is_kw = isa(scope, Method) && endswith(String(Base.unwrap_unionall(Base.unwrap_unionall(scope.sig).parameters[1]).name.name), "#kw")
223222
has_selfarg = isexpr(last, :call) && any(isequal(SlotNumber(1)), last.args)
224223
issplatcall, _callee = unpack_splatcall(last)
225224
if is_kw || has_selfarg || (issplatcall && is_bodyfunc(_callee))

src/construct.jl

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,6 @@ function get_source(g::GeneratedFunctionStub, env)
9494
return eval(b)
9595
end
9696

97-
function copy_codeinfo(code::CodeInfo)
98-
@static if VERSION < v"1.1.0-DEV.762"
99-
newcode = ccall(:jl_new_struct_uninit, Any, (Any,), CodeInfo)::CodeInfo
100-
for (i, name) in enumerate(fieldnames(CodeInfo))
101-
if isdefined(code, name)
102-
val = getfield(code, name)
103-
ccall(:jl_set_nth_field, Cvoid, (Any, Csize_t, Any), newcode, i-1, val===nothing || isa(val, Union{Type, Method}) ? val : copy(val))
104-
end
105-
end
106-
return newcode
107-
else
108-
# Inline this when support for VERSION above is dropped
109-
return copy(code)
110-
end
111-
end
112-
11397
"""
11498
frun, allargs = prepare_args(fcall, fargs, kwargs)
11599
@@ -148,13 +132,6 @@ function prepare_args(@nospecialize(f), allargs, kwargs)
148132
return f, allargs
149133
end
150134

151-
if VERSION < v"1.2-" || !isdefined(Core.Compiler, :specialize_method)
152-
specialize_method(method::Method, @nospecialize(atypes), sparams::SimpleVector) =
153-
Core.Compiler.code_for_method(method, atypes, sparams, typemax(UInt))
154-
else
155-
const specialize_method = Core.Compiler.specialize_method
156-
end
157-
158135
function prepare_framecode(method::Method, @nospecialize(argtypes); enter_generated=false)
159136
sig = method.sig
160137
if (method.module compiled_modules || method compiled_methods) && !(method interpreted_methods)
@@ -174,7 +151,7 @@ function prepare_framecode(method::Method, @nospecialize(argtypes); enter_genera
174151
# If we're stepping into a staged function, we need to use
175152
# the specialization, rather than stepping through the
176153
# unspecialized method.
177-
code = Core.Compiler.get_staged(specialize_method(method, argtypes, lenv))
154+
code = Core.Compiler.get_staged(Core.Compiler.specialize_method(method, argtypes, lenv))
178155
code === nothing && return nothing
179156
generator = false
180157
else
@@ -282,7 +259,7 @@ end
282259

283260
function prepare_framedata(framecode, argvals::Vector{Any}, lenv::SimpleVector=empty_svec, caller_will_catch_err::Bool=false)
284261
src = framecode.src
285-
slotnames = src.slotnames::SlotNamesType
262+
slotnames = src.slotnames
286263
ssavt = src.ssavaluetypes
287264
ng, ns = isa(ssavt, Int) ? ssavt : length(ssavt::Vector{Any}), length(src.slotflags)
288265
if length(junk_framedata) > 0
@@ -514,15 +491,6 @@ function queuenext!(iter::ExprSplitter)
514491
ex = ex.args[3]::Expr
515492
push_modex!(iter, mod, ex)
516493
return queuenext!(iter)
517-
elseif VERSION < v"1.2" && is_function_def(ex)
518-
# Newer Julia versions insert a LineNumberNode between statements, but at least Julia 1.0 does not.
519-
# Scan the function body for a LNN
520-
lnn = firstline(ex)
521-
if isa(lnn, LineNumberNode)
522-
if iter.lnn === nothing || iter.lnn.line < lnn.line
523-
iter.lnn = LineNumberNode(lnn.line-1, lnn.file)
524-
end
525-
end
526494
elseif head === :macrocall
527495
iter.lnn = ex.args[2]::LineNumberNode
528496
elseif head === :block || head === :toplevel

src/interpret.jl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,13 @@ function evaluate_structtype(@nospecialize(recurse), frame, node)
329329
end
330330
end
331331
Core.eval(mod, newstructexpr)
332-
VERSION < v"1.2.0-DEV.239" && set_structtype_const(mod, name)
333332
end
334333

335334
function evaluate_abstracttype(@nospecialize(recurse), frame, node)
336335
name, mod = structname(frame, node)
337336
params = lookup_or_eval(recurse, frame, node.args[2])::SimpleVector
338337
supertype = lookup_or_eval(recurse, frame, node.args[3])::Type
339338
Core.eval(mod, Expr(:abstract_type, name, params, supertype))
340-
VERSION < v"1.2.0-DEV.239" && set_structtype_const(mod, name)
341339
end
342340

343341
function evaluate_primitivetype(@nospecialize(recurse), frame, node)
@@ -346,7 +344,6 @@ function evaluate_primitivetype(@nospecialize(recurse), frame, node)
346344
nbits = node.args[3]::Int
347345
supertype = lookup_or_eval(recurse, frame, node.args[4])::Type
348346
Core.eval(mod, Expr(:primitive_type, name, params, nbits, supertype))
349-
VERSION < v"1.2.0-DEV.239" && set_structtype_const(mod, name)
350347
end
351348

352349
function do_assignment!(frame, @nospecialize(lhs), @nospecialize(rhs))
@@ -407,7 +404,7 @@ function eval_rhs(@nospecialize(recurse), frame, node::Expr)
407404
return length(frame.framedata.exception_frames)
408405
elseif head === :boundscheck
409406
return true
410-
elseif head === :meta || head === :inbounds || head == (@static VERSION >= v"1.2.0-DEV.462" ? :loopinfo : :simdloop) ||
407+
elseif head === :meta || head === :inbounds || head == :loopinfo ||
411408
head === :gc_preserve_begin || head === :gc_preserve_end
412409
return nothing
413410
elseif head === :method && length(node.args) == 1
@@ -517,9 +514,7 @@ function step_expr!(@nospecialize(recurse), frame, @nospecialize(node), istoplev
517514
else
518515
mod, name = moduleof(frame), g::Symbol
519516
end
520-
if VERSION >= v"1.2.0-DEV.239" # depends on https://github.com/JuliaLang/julia/pull/30893
521-
Core.eval(mod, Expr(:const, name))
522-
end
517+
Core.eval(mod, Expr(:const, name))
523518
elseif node.head === :thunk
524519
newframe = Frame(moduleof(frame), node.args[1])
525520
if isa(recurse, Compiled)

src/optimize.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ function lookup_global_refs!(ex::Expr)
133133
return nothing
134134
end
135135

136-
# See https://github.com/JuliaLang/julia/pull/32800
137-
const foreigncall_version = VERSION < v"1.3.0-alpha.108" ? 0 : 1
138-
139136
"""
140137
optimize!(code::CodeInfo, mod::Module)
141138
@@ -190,7 +187,7 @@ function optimize!(code::CodeInfo, scope)
190187
append!(delete_idxs, delete_idx)
191188
end
192189
elseif stmt.head === :foreigncall && scope isa Method
193-
nargs = foreigncall_version == 0 ? stmt.args[5]::Int : length(stmt.args[3]::SimpleVector)
190+
nargs = length(stmt.args[3]::SimpleVector)
194191
# Call via `invokelatest` to avoid compiling it until we need it
195192
delete_idx = Base.invokelatest(build_compiled_call!, stmt, :ccall, code, idx, nargs, sparams, evalmod)
196193
if delete_idx !== nothing
@@ -365,7 +362,7 @@ function build_compiled_call!(stmt::Expr, fcall, code, idx, nargs::Int, sparams:
365362
push!(wrapargs, :(::$TVal{$sparam}))
366363
end
367364
methname = gensym("compiledcall")
368-
calling_convention = stmt.args[foreigncall_version == 0 ? 4 : 5]
365+
calling_convention = stmt.args[5]
369366
if calling_convention === :(:llvmcall)
370367
def = :(
371368
function $methname($(wrapargs...)) where {$(sparams...)}

src/packagedef.jl

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,9 @@ module CompiledCalls
1818
# This module is for handling intrinsics that must be compiled (llvmcall) as well as ccalls
1919
end
2020

21-
# "Backport" of https://github.com/JuliaLang/julia/pull/31536
22-
if VERSION < v"1.2.0-DEV.572"
23-
Base.convert(::Type{Some{T}}, x::Some{T}) where {T} = x
24-
end
25-
26-
const SlotNamesType = VERSION < v"1.2.0-DEV.606" ? Vector{Any} : Vector{Symbol}
21+
const SlotNamesType = Vector{Symbol}
2722

28-
@static if VERSION < v"1.3.0-DEV.179"
29-
const append_any = Base.append_any
30-
else
31-
append_any(@nospecialize x...) = append!([], Core.svec((x...)...))
32-
end
23+
append_any(@nospecialize x...) = append!([], Core.svec((x...)...))
3324

3425
if isdefined(Base, :mapany)
3526
const mapany = Base.mapany

src/precompile.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ function _precompile_()
3636
@assert precompile(Tuple{typeof(extract_args), Module, Expr})
3737
@assert precompile(Tuple{typeof(enter_call), Int, Int})
3838
@assert precompile(Tuple{typeof(enter_call_expr), Expr})
39-
@assert precompile(Tuple{typeof(copy_codeinfo), Core.CodeInfo})
4039
@assert precompile(Tuple{typeof(optimize!), Core.CodeInfo, Module})
4140
@assert precompile(Tuple{typeof(optimize!), Core.CodeInfo, Method})
4241
@assert precompile(Tuple{typeof(build_compiled_call!), Expr, Symbol, Core.CodeInfo, Int, Int, Vector{Symbol}, Module})
@@ -48,9 +47,7 @@ function _precompile_()
4847
@assert precompile(Tuple{typeof(find_used), Core.CodeInfo})
4948
@assert precompile(Tuple{typeof(do_assignment!), Frame, Any, Any})
5049
@assert precompile(Tuple{typeof(pc_expr), Frame})
51-
if VERSION >= v"1.3.0-DEV.179" # there are different definitions depending on Julia version
52-
@assert precompile(Tuple{typeof(append_any), Any})
53-
@assert precompile(Tuple{typeof(append_any), Any, Vararg{Any, 100}})
54-
end
50+
@assert precompile(Tuple{typeof(append_any), Any})
51+
@assert precompile(Tuple{typeof(append_any), Any, Vararg{Any, 100}})
5552
@assert precompile(Tuple{typeof(whichtt), Any})
5653
end

src/types.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ function is_breakpoint_expr(ex::Expr)
112112
end
113113
function FrameCode(scope, src::CodeInfo; generator=false, optimize=true)
114114
if optimize
115-
src, methodtables = optimize!(copy_codeinfo(src), scope)
115+
src, methodtables = optimize!(copy(src), scope)
116116
else
117-
src = replace_coretypes!(copy_codeinfo(src))
117+
src = replace_coretypes!(copy(src))
118118
methodtables = Vector{Union{Compiled,DispatchableMethod}}(undef, length(src.code))
119119
end
120120
breakpoints = Vector{BreakpointState}(undef, length(src.code))

src/utils.jl

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -199,20 +199,11 @@ is_call_or_return(@nospecialize(node)) = is_call(node) || is_return(node)
199199

200200
is_dummy(bpref::BreakpointRef) = bpref.stmtidx == 0 && bpref.err === nothing
201201

202-
if VERSION >= v"1.4.0-DEV.304"
203-
function unpack_splatcall(stmt)
204-
if isexpr(stmt, :call) && length(stmt.args) >= 3 && is_quotenode_egal(stmt.args[1], Core._apply_iterate)
205-
return true, stmt.args[3]
206-
end
207-
return false, nothing
208-
end
209-
else
210-
function unpack_splatcall(stmt)
211-
if isexpr(stmt, :call) && length(stmt.args) >= 2 && is_quotenode_egal(stmt.args[1], Core._apply)
212-
return true, stmt.args[2]
213-
end
214-
return false, nothing
202+
function unpack_splatcall(stmt)
203+
if isexpr(stmt, :call) && length(stmt.args) >= 3 && is_quotenode_egal(stmt.args[1], Core._apply_iterate)
204+
return true, stmt.args[3]
215205
end
206+
return false, nothing
216207
end
217208

218209
function is_bodyfunc(@nospecialize(arg))
@@ -316,28 +307,10 @@ function getline(ln::Union{LineTypes,Expr})
316307
_getline(ln::Expr) = ln.args[1] # assuming ln.head === :line
317308
return Int(_getline(ln))::Int
318309
end
319-
# work around compiler error on 1.2
320-
@static if v"1.2.0" <= VERSION < v"1.3"
321-
getfile(ln) = begin
322-
path = if isexpr(ln, :line)
323-
String(ln.args[2])
324-
else
325-
try
326-
file = String(ln.file)
327-
isfile(file)
328-
file
329-
catch err
330-
""
331-
end
332-
end
333-
CodeTracking.maybe_fixup_stdlib_path(path)
334-
end
335-
else
336-
function getfile(ln::Union{LineTypes,Expr})
337-
_getfile(ln::LineTypes) = ln.file::Symbol
338-
_getfile(ln::Expr) = ln.args[2]::Symbol # assuming ln.head === :line
339-
return CodeTracking.maybe_fixup_stdlib_path(String(_getfile(ln)))
340-
end
310+
function getfile(ln::Union{LineTypes,Expr})
311+
_getfile(ln::LineTypes) = ln.file::Symbol
312+
_getfile(ln::Expr) = ln.args[2]::Symbol # assuming ln.head === :line
313+
return CodeTracking.maybe_fixup_stdlib_path(String(_getfile(ln)))
341314
end
342315

343316
function firstline(ex::Expr)
@@ -448,7 +421,7 @@ function framecode_lines(src::CodeInfo)
448421
buf = IOBuffer()
449422
if isdefined(Base.IRShow, :show_ir_stmt)
450423
lines = String[]
451-
src = replace_coretypes!(copy_codeinfo(src); rev=true)
424+
src = replace_coretypes!(copy(src); rev=true)
452425
reverse_lookup_globalref!(src.code)
453426
io = IOContext(buf, :displaysize => displaysize(stdout),
454427
:SOURCE_SLOTNAMES => Base.sourceinfo_slotnames(src))
@@ -485,7 +458,7 @@ function print_framecode(io::IO, framecode::FrameCode; pc=0, range=1:nstatements
485458
offset = lineoffset(framecode)
486459
ndline = isempty(lt) ? 0 : ndigits(getline(lt[end]) + offset)
487460
nullline = " "^ndline
488-
src = copy_codeinfo(framecode.src)
461+
src = copy(framecode.src)
489462
replace_coretypes!(src; rev=true)
490463
code = framecode_lines(src)
491464
isfirst = true
@@ -515,7 +488,7 @@ function locals(frame::Frame)
515488
vars, var_counter = Variable[], Int[]
516489
varlookup = Dict{Symbol,Int}()
517490
data, code = frame.framedata, frame.framecode
518-
slotnames = code.src.slotnames::SlotNamesType
491+
slotnames = code.src.slotnames
519492
for (sym, counter, val) in zip(slotnames, data.last_reference, data.locals)
520493
counter == 0 && continue
521494
val = something(val)
@@ -702,7 +675,7 @@ function Base.StackTraces.StackFrame(frame::Frame)
702675
atypes = Tuple{mapany(_Typeof, method_args)...}
703676
sig = method.sig
704677
sparams = Core.svec(frame.framedata.sparams...)
705-
mi = specialize_method(method, atypes, sparams)
678+
mi = Core.Compiler.specialize_method(method, atypes, sparams)
706679
fname = frame.framecode.scope.name
707680
else
708681
mi = frame.framecode.src

test/breakpoints.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,7 @@ empty!(breakpoint_update_hooks)
408408
# breakpoint in top-level line
409409
mod, ex = exprs[1]
410410
frame = Frame(mod, ex)
411-
if VERSION < v"1.2"
412-
@test_broken JuliaInterpreter.shouldbreak(frame, frame.pc)
413-
else
414-
@test JuliaInterpreter.shouldbreak(frame, frame.pc)
415-
end
411+
@test JuliaInterpreter.shouldbreak(frame, frame.pc)
416412
ret = JuliaInterpreter.finish_and_return!(frame, true)
417413
@test ret === 2
418414

test/eval_code.jl

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,14 @@ fr, bp = debug_command(fr, :c)
7474
eval_code(fr, "non_accessible_variable = 5.0")
7575
@test eval_code(fr, "non_accessible_variable") == 5.0
7676

77-
if VERSION >= v"1.4" # for var"" syntax
78-
# Evaluating SSAValues
79-
f(x) = x^2
80-
frame = JuliaInterpreter.enter_call(f, 5)
81-
JuliaInterpreter.step_expr!(frame)
82-
JuliaInterpreter.step_expr!(frame)
83-
# This could change with changes to Julia lowering
84-
@test eval_code(frame, "var\"%2\"") == Val(2)
85-
@test eval_code(frame, "var\"@_1\"") == f
86-
end
77+
# Evaluating SSAValues
78+
f(x) = x^2
79+
frame = JuliaInterpreter.enter_call(f, 5)
80+
JuliaInterpreter.step_expr!(frame)
81+
JuliaInterpreter.step_expr!(frame)
82+
# This could change with changes to Julia lowering
83+
@test eval_code(frame, "var\"%2\"") == Val(2)
84+
@test eval_code(frame, "var\"@_1\"") == f
8785

8886
function fun(;output=:sym)
8987
x = 5

test/interpret.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ end
746746
@test length(JuliaInterpreter.locals(frame)) > 0
747747
end
748748

749-
@static if VERSION >= v"1.5" && Sys.islinux()
749+
@static if Sys.islinux()
750750
@testset "@ccall" begin
751751
f(s) = @ccall strlen(s::Cstring)::Csize_t
752752
@test @interpret(f("asd")) == 3

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Core.eval(JuliaInterpreter, :(debug_recycle() = true))
1616
include("limits.jl")
1717
include("eval_code.jl")
1818
include("breakpoints.jl")
19-
VERSION >= v"1.8.0-DEV.370" && include("code_coverage/code_coverage.jl")
19+
@static VERSION >= v"1.8.0-DEV.370" && include("code_coverage/code_coverage.jl")
2020
remove()
2121
include("debug.jl")
2222
end

0 commit comments

Comments
 (0)