Skip to content

Commit 6d582e3

Browse files
authored
Merge pull request #93 from JuliaDebug/teh/fix_92
Run `objectid` in Compiled mode (fixes #92)
2 parents 5855707 + fd45431 commit 6d582e3

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
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)

test/utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function evaluate_limited!(stack, frame::JuliaStackFrame, nstmts::Int, pc::Julia
5858
do_assignment!(frame, lhs, rhs)
5959
new_pc = pc + 1
6060
catch err
61-
new_pc = handle_err(frame, err)
61+
new_pc = handle_err(stack, frame, pc, err)
6262
end
6363
nstmts = refnstmts[]
6464
elseif stmt.head == :(=) && isexpr(stmt.args[2], :call) && !isa(stack, Compiled)
@@ -69,7 +69,7 @@ function evaluate_limited!(stack, frame::JuliaStackFrame, nstmts::Int, pc::Julia
6969
do_assignment!(frame, stmt.args[1], rhs)
7070
new_pc = pc + 1
7171
catch err
72-
new_pc = handle_err(frame, err)
72+
new_pc = handle_err(stack, frame, pc, err)
7373
end
7474
nstmts = refnstmts[]
7575
elseif stmt.head == :thunk

0 commit comments

Comments
 (0)