Skip to content

Fix #161 #162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ uuid = "6f1fad26-d15e-5dc8-ae53-837a1d7b8c9f"
license = "MIT"
desc = "Tape based task copying in Turing"
repo = "https://github.com/TuringLang/Libtask.jl.git"
version = "0.8.5"
version = "0.8.6"

[deps]
FunctionWrappers = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e"
Expand Down
7 changes: 7 additions & 0 deletions src/Libtask.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ export TapedTask, consume, produce

export TArray, tzeros, tfill, TRef # legacy types back compat


const TypedSlot = @static if isdefined(Core, :TypedSlot) # Julia v1.10 removed Core.TypedSlot
Core.TypedSlot
else
Core.Compiler.TypedSlot
end

include("tapedfunction.jl")
include("tapedtask.jl")

Expand Down
8 changes: 4 additions & 4 deletions src/tapedfunction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ function bind_var!(var::QuoteNode, bindings::Bindings, ir::Core.CodeInfo)
LOGGING[] && @info "evaluating QuoteNode $var at compile time"
bind_var!(eval(var), bindings, ir)
end
function bind_var!(var::Core.TypedSlot, bindings::Bindings, ir::Core.CodeInfo)
function bind_var!(var::TypedSlot, bindings::Bindings, ir::Core.CodeInfo)
# turn TypedSlot to SlotNumber
bind_var!(Core.SlotNumber(var.id), bindings, ir)
end
Expand All @@ -295,9 +295,9 @@ end
function bind_var!(var::Core.SSAValue, bindings::Bindings, ir::Core.CodeInfo)
get!(bindings[1], var, allocate_binding!(var, bindings, ir.ssavaluetypes[var.id]))
end

allocate_binding!(var, bindings::Bindings, c::Core.Const) =
allocate_binding!(var, bindings, _loose_type(Type{c.val}))
allocate_binding!(var, bindings, _loose_type(Type{_accurate_typeof(c.val)}))

allocate_binding!(var, bindings::Bindings, c::Core.PartialStruct) =
allocate_binding!(var, bindings, _loose_type(c.typ))
function allocate_binding!(var, bindings::Bindings, ::Type{T}) where T
Expand Down Expand Up @@ -378,7 +378,7 @@ function translate!!(var::IRVar, line::NTuple{N, Symbol},
return Instruction(func, input, output)
end

function translate!!(var::IRVar, line::Core.TypedSlot,
function translate!!(var::IRVar, line::TypedSlot,
bindings::Bindings, isconst::Bool, ir)
input_box = bind_var!(Core.SlotNumber(line.id), bindings, ir)
return Instruction(identity, (input_box,), bind_var!(var, bindings, ir))
Expand Down