Skip to content

Commit

Permalink
Merge pull request #118 from jrevels/vc/1.2
Browse files Browse the repository at this point in the history
adapt Cassette for JuliaLang/julia#31191
  • Loading branch information
vchuravy committed Apr 3, 2019
2 parents b1e0e95 + b5de7d8 commit 25cdcd8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/overdub.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ else
copy_code_info(code_info) = copy(code_info)
end

if VERSION < v"1.2.0-DEV.573"
specialize_method(method, metharg, methsp, world, force) = Core.Compiler.code_for_method(method, metharg, methsp, world, force)
else
specialize_method(method, metharg, methsp, world, force) = Core.Compiler.specialize_method(method, metharg, methsp, force)
end



# Return `Reflection` for signature `sigtypes` and `world`, if possible. Otherwise, return `nothing`.
function reflect(@nospecialize(sigtypes::Tuple), world::UInt = typemax(UInt))
if length(sigtypes) > 2 && sigtypes[1] === typeof(invoke)
Expand Down Expand Up @@ -63,7 +71,7 @@ function reflect(@nospecialize(sigtypes::Tuple), world::UInt = typemax(UInt))
end
method_index === 0 && return nothing
type_signature, raw_static_params, method = _methods[method_index]
method_instance = Core.Compiler.code_for_method(method, type_signature, raw_static_params, world, false)
method_instance = specialize_method(method, type_signature, raw_static_params, world, false)
method_instance === nothing && return nothing
method_signature = method.sig
static_params = Any[raw_static_params...]
Expand Down Expand Up @@ -497,6 +505,7 @@ recurse(ctx::Context, ::typeof(Core._apply), f, args...) = Core._apply(recurse,
function overdub_definition(line, file)
return quote
function $Cassette.overdub($OVERDUB_CONTEXT_NAME::$Cassette.Context, $OVERDUB_ARGUMENTS_NAME...)
$(Expr(:meta, :generated_only))
$(Expr(:meta,
:generated,
Expr(:new,
Expand All @@ -509,6 +518,7 @@ function overdub_definition(line, file)
true)))
end
function $Cassette.recurse($OVERDUB_CONTEXT_NAME::$Cassette.Context, $OVERDUB_ARGUMENTS_NAME...)
$(Expr(:meta, :generated_only))
$(Expr(:meta,
:generated,
Expr(:new,
Expand Down

0 comments on commit 25cdcd8

Please sign in to comment.