Skip to content

Commit

Permalink
Fix llvmcall usage: ptr arg should be literal.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Dec 12, 2017
1 parent 88be715 commit e934079
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion examples/sum_integrated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ end

# make Julia compile and execute the function
push!(function_attributes(sum), EnumAttribute("alwaysinline"))
call_sum(x, y) = Base.llvmcall(LLVM.ref(sum), Int32, Tuple{Int32, Int32}, x, y)
ptr = LLVM.ref(sum)
call_sum(x, y) = Base.llvmcall(ptr, Int32, Tuple{Int32, Int32}, x, y)
@show call_sum(x, y)
3 changes: 2 additions & 1 deletion src/interop/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ argument values (eg. `:((1,2))`), which will be splatted into the call to the fu
# and an expression yielding a tuple of the actual argument values.
function call_function(llvmf::LLVM.Function, rettyp::Type=Void, argtyp::Type=Tuple{},
args::Expr=:())
ref = LLVM.ref(llvmf)
quote
Base.@_inline_meta
Base.llvmcall(LLVM.ref($llvmf), $rettyp, $argtyp, $args...)
Base.llvmcall($(convert(Ptr{Void},ref)), $rettyp, $argtyp, $args...)
end
end

Expand Down

0 comments on commit e934079

Please sign in to comment.