Skip to content

Commit

Permalink
Fix #161 (#162)
Browse files Browse the repository at this point in the history
* Fix #161

* TypedSlot is in Core.Compiler in Julia v1.10

* Update src/Libtask.jl

Co-authored-by: David Widmann <[email protected]>

* Update Project.toml

---------

Co-authored-by: Hong Ge <[email protected]>
Co-authored-by: David Widmann <[email protected]>
  • Loading branch information
3 people authored Apr 5, 2023
1 parent 73c5fe6 commit 95e32aa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
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

2 comments on commit 95e32aa

@yebai
Copy link
Member

@yebai yebai commented on 95e32aa Apr 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/81079

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.8.6 -m "<description of version>" 95e32aa525be3649d0671ce3e47efb6e38382421
git push origin v0.8.6

Please sign in to comment.