what's your julia version and OS? code_native shouldn't be doing that
anymore (https://github.com/JuliaLang/julia/issues/7910)

On Sun Jan 25 2015 at 6:00:49 PM Luthaf <[email protected]> wrote:

>  The @code_llvm, @code_native and @code_lowered macros (but not the
> @code_typed) macro behavior does not feels right with the call overloading
> syntax:
>
> julia> type Foo end
>
> julia> Base.call(::Foo, x) = x + 4
> call (generic function with 891 methods)
>
> julia> f = Foo()
> Foo()
>
> julia> @code_llvm f(3)
> ERROR: MethodError: `code_llvm` has no method matching code_llvm(::Foo,
> ::Type{(Int64,)})
> Closest candidates are:
>   code_llvm(::Function, ::(Type{T<:Top}...,))
>
>  in __text at no file (repeats 3 times)
>
>  I know I can use the call(::Foo, x) form, but this fails with the
> @code_native macro :
>
> julia> @code_llvm call(f, 3)
>
> define i64 @julia_call_43695(%jl_value_t*, i64) {
> top:
>   %2 = add i64 %1, 4, !dbg !8
>   ret i64 %2, !dbg !8
> }
>
> julia> @code_native call(f, 3)
> error: failed to compute relocation: X86_64_RELOC_UNSIGNED
> error: failed to compute relocation: X86_64_RELOC_UNSIGNED
> error: failed to compute relocation: X86_64_RELOC_UNSIGNED
> error: failed to compute relocation: X86_64_RELOC_UNSIGNED
> error: failed to compute relocation: X86_64_RELOC_UNSIGNED
>     .section    __TEXT,__text,regular,pure_instructions
>     push    rbp
>     push    rbp
>     push    rbp
>     push    rbp
>     push    rbp
>     push    rbp
>     push    rbp
>     push    rbp
>     push    rbp
>     push    rbp
>     push    rbp
>     push    rbp
>     push    rbp
>     push    rbp
>     push    rbp
>     push    rbp
>
> Is this an issue, or is this the intended behavior ?
>
> Regards,
> Guillaume
>

Reply via email to