Skip to content

Commit 336f681

Browse files
KDr2yebai
andauthored
Track GlobalRef (#112)
* track GlobalRef * Update Project.toml Co-authored-by: Hong Ge <[email protected]>
1 parent fe3b390 commit 336f681

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Diff for: Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ uuid = "6f1fad26-d15e-5dc8-ae53-837a1d7b8c9f"
33
license = "MIT"
44
desc = "Tape based task copying in Turing"
55
repo = "https://github.com/TuringLang/Libtask.jl.git"
6-
version = "0.6.4"
6+
version = "0.6.5"
77

88
[deps]
99
IRTools = "7869d1d1-7146-5819-86e3-90919afe41df"

Diff for: src/tapedfunction.jl

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ end
3434
val(x) = x
3535
val(x::Box) = x.val
3636
val(x::TapedFunction) = x.func
37+
val(x::GlobalRef) = getproperty(x.mod, x.name)
3738
box(x) = Box(x)
3839
box(x::Box) = x
3940
Base.show(io::IO, box::Box) = print(io, "Box(", box.val, ")")
@@ -247,6 +248,8 @@ function intercept(ir; recorder=:track!)
247248
elseif Meta.isexpr(st.expr, :new)
248249
args = st.expr.args
249250
ir[x] = IRTools.xcall(@__MODULE__, recorder, tape, _new, args...)
251+
elseif isa(st.expr, GlobalRef)
252+
ir[x] = IRTools.xcall(@__MODULE__, recorder, tape, val, st.expr)
250253
else
251254
@warn "Unknown IR code: " st
252255
end

0 commit comments

Comments
 (0)