Skip to content

Commit d6186c6

Browse files
authored
Support :foreigncall to an SSAValue-referenced symbol (fixes #220) (#223)
1 parent bae1a98 commit d6186c6

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/interpret.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ end
118118
function resolvefc(frame, @nospecialize(expr))
119119
if isa(expr, SlotNumber)
120120
expr = lookup_var(frame, expr)
121+
elseif isa(expr, SSAValue)
122+
expr = lookup_var(frame, expr)
123+
isa(expr, Symbol) && return QuoteNode(expr)
121124
end
122125
(isa(expr, Symbol) || isa(expr, String) || isa(expr, Ptr) || isa(expr, QuoteNode)) && return expr
123126
isa(expr, Tuple{Symbol,Symbol}) && return expr

test/interpret.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,3 +446,10 @@ end
446446
# Check #args for builtins (#217)
447447
f217() = <:(Float64, Float32, Float16)
448448
@test_throws ArgumentError @interpret(f217())
449+
450+
# issue #220
451+
function hash220(x::Tuple{Ptr{UInt8},Int}, h::UInt)
452+
h += Base.memhash_seed
453+
ccall(Base.memhash, UInt, (Ptr{UInt8}, Csize_t, UInt32), x[1], x[2], h % UInt32) + h
454+
end
455+
@test @interpret(hash220((Ptr{UInt8}(0),0), UInt(1))) == hash220((Ptr{UInt8}(0),0), UInt(1))

0 commit comments

Comments
 (0)