diff --git a/Project.toml b/Project.toml index 49d7ae23..544bc91c 100644 --- a/Project.toml +++ b/Project.toml @@ -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.6.4" +version = "0.6.5" [deps] IRTools = "7869d1d1-7146-5819-86e3-90919afe41df" diff --git a/src/tapedfunction.jl b/src/tapedfunction.jl index 9ed039ac..a9043ce2 100644 --- a/src/tapedfunction.jl +++ b/src/tapedfunction.jl @@ -34,6 +34,7 @@ end val(x) = x val(x::Box) = x.val val(x::TapedFunction) = x.func +val(x::GlobalRef) = getproperty(x.mod, x.name) box(x) = Box(x) box(x::Box) = x Base.show(io::IO, box::Box) = print(io, "Box(", box.val, ")") @@ -247,6 +248,8 @@ function intercept(ir; recorder=:track!) elseif Meta.isexpr(st.expr, :new) args = st.expr.args ir[x] = IRTools.xcall(@__MODULE__, recorder, tape, _new, args...) + elseif isa(st.expr, GlobalRef) + ir[x] = IRTools.xcall(@__MODULE__, recorder, tape, val, st.expr) else @warn "Unknown IR code: " st end