Skip to content

Commit 21c5d64

Browse files
committed
Run objectid in Compiled mode (fixes #92)
1 parent 5855707 commit 21c5d64

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/JuliaInterpreter.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ struct Variable
174174
isparam::Bool
175175
end
176176
Base.show(io::IO, var::Variable) = print(io, var.name, " = ", var.value)
177-
Base.isequal(var1::Variable, var2::Variable) =
177+
Base.isequal(var1::Variable, var2::Variable) =
178178
var1.value == var2.value && var1.name == var2.name && var1.isparam == var2.isparam
179179

180180
"""
@@ -1148,6 +1148,8 @@ function set_compiled_methods()
11481148
# issue #76
11491149
push!(compiled_methods, which(unsafe_store!, (Ptr{Any}, Any, Int)))
11501150
push!(compiled_methods, which(unsafe_store!, (Ptr, Any, Int)))
1151+
# issue #92
1152+
push!(compiled_methods, which(objectid, Tuple{Any}))
11511153
end
11521154

11531155
function __init__()

test/interpret.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,12 @@ let TT = Union{UInt8, Int8}
271271
@interpret unsafe_store!(pa, 0x1, 2)
272272
end
273273

274+
# issue #92
275+
let x = Core.TypedSlot(1, Any)
276+
f(x) = objectid(x)
277+
@test isa(@interpret(f(x)), UInt)
278+
end
279+
274280
# Some expression can appear nontrivial but lower to nothing
275281
@test isa(JuliaInterpreter.prepare_thunk(Main, :(@static if ccall(:jl_get_UNAME, Any, ()) == :NoOS 1+1 end)), Nothing)
276282
@test isa(JuliaInterpreter.prepare_thunk(Main, :(Base.BaseDocs.@kw_str "using")), Nothing)

0 commit comments

Comments
 (0)