Skip to content

Commit 25cdcd8

Browse files
authored
Merge pull request #118 from jrevels/vc/1.2
adapt Cassette for JuliaLang/julia#31191
2 parents b1e0e95 + b5de7d8 commit 25cdcd8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/overdub.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ else
3333
copy_code_info(code_info) = copy(code_info)
3434
end
3535

36+
if VERSION < v"1.2.0-DEV.573"
37+
specialize_method(method, metharg, methsp, world, force) = Core.Compiler.code_for_method(method, metharg, methsp, world, force)
38+
else
39+
specialize_method(method, metharg, methsp, world, force) = Core.Compiler.specialize_method(method, metharg, methsp, force)
40+
end
41+
42+
43+
3644
# Return `Reflection` for signature `sigtypes` and `world`, if possible. Otherwise, return `nothing`.
3745
function reflect(@nospecialize(sigtypes::Tuple), world::UInt = typemax(UInt))
3846
if length(sigtypes) > 2 && sigtypes[1] === typeof(invoke)
@@ -63,7 +71,7 @@ function reflect(@nospecialize(sigtypes::Tuple), world::UInt = typemax(UInt))
6371
end
6472
method_index === 0 && return nothing
6573
type_signature, raw_static_params, method = _methods[method_index]
66-
method_instance = Core.Compiler.code_for_method(method, type_signature, raw_static_params, world, false)
74+
method_instance = specialize_method(method, type_signature, raw_static_params, world, false)
6775
method_instance === nothing && return nothing
6876
method_signature = method.sig
6977
static_params = Any[raw_static_params...]
@@ -497,6 +505,7 @@ recurse(ctx::Context, ::typeof(Core._apply), f, args...) = Core._apply(recurse,
497505
function overdub_definition(line, file)
498506
return quote
499507
function $Cassette.overdub($OVERDUB_CONTEXT_NAME::$Cassette.Context, $OVERDUB_ARGUMENTS_NAME...)
508+
$(Expr(:meta, :generated_only))
500509
$(Expr(:meta,
501510
:generated,
502511
Expr(:new,
@@ -509,6 +518,7 @@ function overdub_definition(line, file)
509518
true)))
510519
end
511520
function $Cassette.recurse($OVERDUB_CONTEXT_NAME::$Cassette.Context, $OVERDUB_ARGUMENTS_NAME...)
521+
$(Expr(:meta, :generated_only))
512522
$(Expr(:meta,
513523
:generated,
514524
Expr(:new,

0 commit comments

Comments
 (0)