Skip to content

Commit cc89e74

Browse files
bump the minimum supported Julia version to 1.10 (LTS) (#654)
* bump the minimum supported Julia version to 1.10 (LTS) Maintaining this package that closely depends on Julia internals across multiple Julia versions is very cumbersome. Now that the LTS has been updated to 1.10, let's drop compatibility with earlier versions and simplify the code. * use `Base._uncompressed_ir` * use `Base.method_instances` * remove unnecessary `@static` from `bulitins.jl` * Update .github/workflows/CI.yml Co-authored-by: Kristoffer Carlsson <[email protected]> * fix comment * make this a patch bump --------- Co-authored-by: Kristoffer Carlsson <[email protected]>
1 parent 0421a75 commit cc89e74

19 files changed

+166
-366
lines changed

.github/workflows/CI.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
include:
17-
- version: '1.6' # old LTS
17+
- version: '1' # current stable
1818
os: ubuntu-latest
1919
arch: x64
20-
- version: '1.10' # current stable
20+
- version: '1.10' # lowest version supported
2121
os: ubuntu-latest
2222
arch: x64
23-
- version: '~1.11.0-0' # next release
23+
- version: '1.12-nightly' # next release
2424
os: ubuntu-latest
2525
arch: x64
2626
- version: 'nightly' # dev

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "JuliaInterpreter"
22
uuid = "aa1ae85d-cabe-5617-a682-6adf51b2e16a"
3-
version = "0.9.37"
3+
version = "0.9.38"
44

55
[deps]
66
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
@@ -10,7 +10,7 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
1010

1111
[compat]
1212
CodeTracking = "0.5.9, 1"
13-
julia = "1.6"
13+
julia = "1.10"
1414

1515
[extras]
1616
CassetteOverlay = "d78b62d4-37fa-4a6f-acd8-2f19986eb9ee"

bin/generate_builtins.jl

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,26 @@
22
# Should be run on the latest Julia nightly
33
using InteractiveUtils
44

5-
# All builtins present in 1.6
6-
const ALWAYS_PRESENT = Core.Builtin[
7-
(<:), (===), Core._abstracttype, Core._apply_iterate, Core._apply_pure,
8-
Core._call_in_world, Core._call_latest, Core._equiv_typedef, Core._expr,
9-
Core._primitivetype, Core._setsuper!, Core._structtype, Core._typebody!,
10-
Core._typevar, Core.apply_type, Core.ifelse, Core.sizeof, Core.svec,
11-
applicable, fieldtype, getfield, invoke, isa, isdefined, nfields,
12-
setfield!, throw, tuple, typeassert, typeof
5+
# Builtins not present in 1.10 (the lowest supported version)
6+
const RECENTLY_ADDED = Core.Builtin[
7+
Core.current_scope,
8+
Core.memoryref_isassigned,
9+
Core.memoryrefget,
10+
Core.memoryrefmodify!,
11+
Core.memoryrefnew,
12+
Core.memoryrefoffset,
13+
Core.memoryrefreplace!,
14+
Core.memoryrefset!,
15+
Core.memoryrefsetonce!,
16+
Core.memoryrefswap!,
17+
Core.throw_methoderror,
18+
modifyglobal!,
19+
replaceglobal!,
20+
setfieldonce!,
21+
setglobalonce!,
22+
swapglobal!,
1323
]
14-
# Builtins present from 1.6, not builtins (potentially still normal functions) anymore
24+
# Builtins present from 1.10, not builtins (potentially still normal functions) anymore
1525
const RECENTLY_REMOVED = GlobalRef.(Ref(Core), [
1626
:arrayref, :arrayset, :arrayset, :const_arrayref, :memoryref, :set_binding_type!
1727
])
@@ -132,9 +142,9 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
132142
f = @lookup(frame, fex)
133143
end
134144
135-
if @static isdefined(Core, :OpaqueClosure) && f isa Core.OpaqueClosure
145+
if f isa Core.OpaqueClosure
136146
if expand
137-
if !Core.Compiler.uncompressed_ir(f.source).inferred
147+
if !Base.uncompressed_ir(f.source).inferred
138148
return Expr(:call, f, args[2:end]...)
139149
else
140150
@debug "not interpreting opaque closure \$f since it contains inferred code"
@@ -235,7 +245,7 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
235245

236246
id = findfirst(isequal(f), Core.Compiler.T_FFUNC_KEY)
237247
fcall = generate_fcall(f, Core.Compiler.T_FFUNC_VAL, id)
238-
if !(f in ALWAYS_PRESENT)
248+
if f in RECENTLY_ADDED
239249
print(io,
240250
"""
241251
$head @static isdefined($(ft.name.module), $(repr(nameof(f)))) && f === $fname
@@ -324,16 +334,14 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
324334
"""
325335
if isa(f, Core.IntrinsicFunction)
326336
cargs = getargs(args, frame)
327-
@static if isdefined(Core.Intrinsics, :have_fma)
328-
if f === Core.Intrinsics.have_fma && length(cargs) == 1
329-
cargs1 = cargs[1]
330-
if cargs1 == Float64
331-
return Some{Any}(FMA_FLOAT64[])
332-
elseif cargs1 == Float32
333-
return Some{Any}(FMA_FLOAT32[])
334-
elseif cargs1 == Float16
335-
return Some{Any}(FMA_FLOAT16[])
336-
end
337+
if f === Core.Intrinsics.have_fma && length(cargs) == 1
338+
cargs1 = cargs[1]
339+
if cargs1 == Float64
340+
return Some{Any}(FMA_FLOAT64[])
341+
elseif cargs1 == Float32
342+
return Some{Any}(FMA_FLOAT32[])
343+
elseif cargs1 == Float16
344+
return Some{Any}(FMA_FLOAT16[])
337345
end
338346
end
339347
if f === Core.Intrinsics.muladd_float && length(cargs) == 3

src/breakpoints.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,9 @@ function framecode_matches_breakpoint(framecode::FrameCode, bp::BreakpointSignat
9797
meth isa Method || return false
9898
bp.f isa Method && return meth === bp.f
9999
f = extract_function_from_method(meth)
100-
if !(bp.f === f || @static isdefined(Core, :kwcall) ?
101-
f === Core.kwcall && let ftype = Base.unwrap_unionall(meth.sig).parameters[3]
100+
if !(bp.f === f || (f === Core.kwcall && let ftype = Base.unwrap_unionall(meth.sig).parameters[3]
102101
!Base.has_free_typevars(ftype) && bp.f isa ftype
103-
end :
104-
Core.kwfunc(bp.f) === f
105-
)
102+
end))
106103
return false
107104
end
108105
bp.sig === nothing && return true

src/builtins.jl

Lines changed: 29 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
3838
f = @lookup(frame, fex)
3939
end
4040

41-
if @static isdefined(Core, :OpaqueClosure) && f isa Core.OpaqueClosure
41+
if f isa Core.OpaqueClosure
4242
if expand
43-
if !Core.Compiler.uncompressed_ir(f.source).inferred
43+
if !Base.uncompressed_ir(f.source).inferred
4444
return Expr(:call, f, args[2:end]...)
4545
else
4646
@debug "not interpreting opaque closure $f since it contains inferred code"
@@ -86,7 +86,7 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
8686
return Some{Any}(Core._apply_pure(getargs(args, frame)...))
8787
elseif f === Core._call_in_world
8888
return Some{Any}(Core._call_in_world(getargs(args, frame)...))
89-
elseif @static isdefined(Core, :_call_in_world_total) && f === Core._call_in_world_total
89+
elseif f === Core._call_in_world_total
9090
return Some{Any}(Core._call_in_world_total(getargs(args, frame)...))
9191
elseif f === Core._call_latest
9292
args = getargs(args, frame)
@@ -99,7 +99,7 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
9999
push!(new_expr.args, QuoteNode(x))
100100
end
101101
return maybe_recurse_expanded_builtin(frame, new_expr)
102-
elseif @static isdefined(Core, :_compute_sparams) && f === Core._compute_sparams
102+
elseif f === Core._compute_sparams
103103
return Some{Any}(Core._compute_sparams(getargs(args, frame)...))
104104
elseif f === Core._equiv_typedef
105105
return Some{Any}(Core._equiv_typedef(getargs(args, frame)...))
@@ -111,7 +111,7 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
111111
return Some{Any}(Core._setsuper!(getargs(args, frame)...))
112112
elseif f === Core._structtype
113113
return Some{Any}(Core._structtype(getargs(args, frame)...))
114-
elseif @static isdefined(Core, :_svec_ref) && f === Core._svec_ref
114+
elseif f === Core._svec_ref
115115
return Some{Any}(Core._svec_ref(getargs(args, frame)...))
116116
elseif f === Core._typebody!
117117
return Some{Any}(Core._typebody!(getargs(args, frame)...))
@@ -123,7 +123,7 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
123123
end
124124
elseif f === Core.apply_type
125125
return Some{Any}(Core.apply_type(getargs(args, frame)...))
126-
elseif @static isdefined(Core, :compilerbarrier) && f === Core.compilerbarrier
126+
elseif f === Core.compilerbarrier
127127
if nargs == 2
128128
return Some{Any}(Core.compilerbarrier(@lookup(frame, args[2]), @lookup(frame, args[3])))
129129
else
@@ -139,9 +139,9 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
139139
else
140140
return Some{Any}(Core.current_scope(getargs(args, frame)...))
141141
end
142-
elseif @static isdefined(Core, :donotdelete) && f === Core.donotdelete
142+
elseif f === Core.donotdelete
143143
return Some{Any}(Core.donotdelete(getargs(args, frame)...))
144-
elseif @static isdefined(Core, :finalizer) && f === Core.finalizer
144+
elseif f === Core.finalizer
145145
if nargs == 2
146146
return Some{Any}(Core.finalizer(@lookup(frame, args[2]), @lookup(frame, args[3])))
147147
elseif nargs == 3
@@ -151,12 +151,8 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
151151
else
152152
return Some{Any}(Core.finalizer(getargs(args, frame)...))
153153
end
154-
elseif @static isdefined(Core, :get_binding_type) && f === Core.get_binding_type
155-
if nargs == 2
156-
return Some{Any}(Core.get_binding_type(@lookup(frame, args[2]), @lookup(frame, args[3])))
157-
else
158-
return Some{Any}(Core.get_binding_type(getargs(args, frame)...))
159-
end
154+
elseif f === Core.get_binding_type
155+
return Some{Any}(Core.get_binding_type(getargs(args, frame)...))
160156
elseif f === Core.ifelse
161157
if nargs == 3
162158
return Some{Any}(Core.ifelse(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4])))
@@ -255,14 +251,8 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
255251
else
256252
return Some{Any}(getfield(getargs(args, frame)...))
257253
end
258-
elseif @static isdefined(Core, :getglobal) && f === getglobal
259-
if nargs == 2
260-
return Some{Any}(getglobal(@lookup(frame, args[2]), @lookup(frame, args[3])))
261-
elseif nargs == 3
262-
return Some{Any}(getglobal(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4])))
263-
else
264-
return Some{Any}(getglobal(getargs(args, frame)...))
265-
end
254+
elseif f === getglobal
255+
return Some{Any}(getglobal(getargs(args, frame)...))
266256
elseif f === invoke
267257
if !expand
268258
argswrapped = getargs(args, frame)
@@ -285,7 +275,7 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
285275
else
286276
return Some{Any}(isdefined(getargs(args, frame)...))
287277
end
288-
elseif @static isdefined(Core, :modifyfield!) && f === modifyfield!
278+
elseif f === modifyfield!
289279
if nargs == 4
290280
return Some{Any}(modifyfield!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4]), @lookup(frame, args[5])))
291281
elseif nargs == 5
@@ -294,20 +284,14 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
294284
return Some{Any}(modifyfield!(getargs(args, frame)...))
295285
end
296286
elseif @static isdefined(Core, :modifyglobal!) && f === modifyglobal!
297-
if nargs == 4
298-
return Some{Any}(modifyglobal!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4]), @lookup(frame, args[5])))
299-
elseif nargs == 5
300-
return Some{Any}(modifyglobal!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4]), @lookup(frame, args[5]), @lookup(frame, args[6])))
301-
else
302-
return Some{Any}(modifyglobal!(getargs(args, frame)...))
303-
end
287+
return Some{Any}(modifyglobal!(getargs(args, frame)...))
304288
elseif f === nfields
305289
if nargs == 1
306290
return Some{Any}(nfields(@lookup(frame, args[2])))
307291
else
308292
return Some{Any}(nfields(getargs(args, frame)...))
309293
end
310-
elseif @static isdefined(Core, :replacefield!) && f === replacefield!
294+
elseif f === replacefield!
311295
if nargs == 4
312296
return Some{Any}(replacefield!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4]), @lookup(frame, args[5])))
313297
elseif nargs == 5
@@ -318,15 +302,7 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
318302
return Some{Any}(replacefield!(getargs(args, frame)...))
319303
end
320304
elseif @static isdefined(Core, :replaceglobal!) && f === replaceglobal!
321-
if nargs == 4
322-
return Some{Any}(replaceglobal!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4]), @lookup(frame, args[5])))
323-
elseif nargs == 5
324-
return Some{Any}(replaceglobal!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4]), @lookup(frame, args[5]), @lookup(frame, args[6])))
325-
elseif nargs == 6
326-
return Some{Any}(replaceglobal!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4]), @lookup(frame, args[5]), @lookup(frame, args[6]), @lookup(frame, args[7])))
327-
else
328-
return Some{Any}(replaceglobal!(getargs(args, frame)...))
329-
end
305+
return Some{Any}(replaceglobal!(getargs(args, frame)...))
330306
elseif f === setfield!
331307
if nargs == 3
332308
return Some{Any}(setfield!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4])))
@@ -345,25 +321,11 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
345321
else
346322
return Some{Any}(setfieldonce!(getargs(args, frame)...))
347323
end
348-
elseif @static isdefined(Core, :setglobal!) && f === setglobal!
349-
if nargs == 3
350-
return Some{Any}(setglobal!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4])))
351-
elseif nargs == 4
352-
return Some{Any}(setglobal!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4]), @lookup(frame, args[5])))
353-
else
354-
return Some{Any}(setglobal!(getargs(args, frame)...))
355-
end
324+
elseif f === setglobal!
325+
return Some{Any}(setglobal!(getargs(args, frame)...))
356326
elseif @static isdefined(Core, :setglobalonce!) && f === setglobalonce!
357-
if nargs == 3
358-
return Some{Any}(setglobalonce!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4])))
359-
elseif nargs == 4
360-
return Some{Any}(setglobalonce!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4]), @lookup(frame, args[5])))
361-
elseif nargs == 5
362-
return Some{Any}(setglobalonce!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4]), @lookup(frame, args[5]), @lookup(frame, args[6])))
363-
else
364-
return Some{Any}(setglobalonce!(getargs(args, frame)...))
365-
end
366-
elseif @static isdefined(Core, :swapfield!) && f === swapfield!
327+
return Some{Any}(setglobalonce!(getargs(args, frame)...))
328+
elseif f === swapfield!
367329
if nargs == 3
368330
return Some{Any}(swapfield!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4])))
369331
elseif nargs == 4
@@ -372,13 +334,7 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
372334
return Some{Any}(swapfield!(getargs(args, frame)...))
373335
end
374336
elseif @static isdefined(Core, :swapglobal!) && f === swapglobal!
375-
if nargs == 3
376-
return Some{Any}(swapglobal!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4])))
377-
elseif nargs == 4
378-
return Some{Any}(swapglobal!(@lookup(frame, args[2]), @lookup(frame, args[3]), @lookup(frame, args[4]), @lookup(frame, args[5])))
379-
else
380-
return Some{Any}(swapglobal!(getargs(args, frame)...))
381-
end
337+
return Some{Any}(swapglobal!(getargs(args, frame)...))
382338
elseif f === throw
383339
if nargs == 1
384340
return Some{Any}(throw(@lookup(frame, args[2])))
@@ -500,16 +456,14 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool)
500456
end
501457
if isa(f, Core.IntrinsicFunction)
502458
cargs = getargs(args, frame)
503-
@static if isdefined(Core.Intrinsics, :have_fma)
504-
if f === Core.Intrinsics.have_fma && length(cargs) == 1
505-
cargs1 = cargs[1]
506-
if cargs1 == Float64
507-
return Some{Any}(FMA_FLOAT64[])
508-
elseif cargs1 == Float32
509-
return Some{Any}(FMA_FLOAT32[])
510-
elseif cargs1 == Float16
511-
return Some{Any}(FMA_FLOAT16[])
512-
end
459+
if f === Core.Intrinsics.have_fma && length(cargs) == 1
460+
cargs1 = cargs[1]
461+
if cargs1 == Float64
462+
return Some{Any}(FMA_FLOAT64[])
463+
elseif cargs1 == Float32
464+
return Some{Any}(FMA_FLOAT32[])
465+
elseif cargs1 == Float16
466+
return Some{Any}(FMA_FLOAT16[])
513467
end
514468
end
515469
if f === Core.Intrinsics.muladd_float && length(cargs) == 3

src/commands.jl

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ function maybe_step_through_wrapper!(@nospecialize(recurse), frame::Frame)
226226
if unwrap1 isa DataType
227227
param1 = Base.unwrap_unionall(unwrap1.parameters[1])
228228
if param1 isa DataType
229-
is_kw = isdefined(Core, :kwcall) ? param1.name.name === Symbol("#kwcall") :
230-
endswith(String(param1.name.name), "#kw")
229+
is_kw = param1.name.name === Symbol("#kwcall")
231230
end
232231
end
233232
end
@@ -255,13 +254,8 @@ function maybe_step_through_wrapper!(@nospecialize(recurse), frame::Frame)
255254
end
256255
maybe_step_through_wrapper!(frame::Frame) = maybe_step_through_wrapper!(finish_and_return!, frame)
257256

258-
if isdefined(Core, :kwcall)
259-
const kwhandler = Core.kwcall
260-
const kwextrastep = 0
261-
else
262-
const kwhandler = Core.kwfunc
263-
const kwextrastep = 1
264-
end
257+
const kwhandler = Core.kwcall
258+
const kwextrastep = 0
265259

266260
"""
267261
frame = maybe_step_through_kwprep!(recurse, frame)

0 commit comments

Comments
 (0)