Skip to content

jl_get_builtin_fptr not handled correctly for call resolution #83

Open

Description

julia> foo() = Core.current_scope()
foo (generic function with 1 method)

julia> @code_llvm foo()
; Function Signature: foo()
;  @ REPL[3]:1 within `foo`
define nonnull ptr @julia_foo_2954() #0 {
top:
  %0 = call ptr @jl_get_builtin_fptr(ptr nonnull @"+Core.#current_scope#2956.jit")
  %Builtin_ret = call nonnull ptr %0(ptr nonnull @"jl_global#2957.jit", ptr null, i32 0)
  ret ptr %Builtin_ret
}

julia> check_allocs(foo, (); ignore_throw = false)
2-element Vector{Any}:
 Allocating runtime call to "jl_get_builtin_fptr" in ./REPL[3]:1
  | (source not available)
Stacktrace:
 [1] foo()
   @ Main ./REPL[3]:1

 Dynamic dispatch in ./REPL[3]:1
  | (source not available)
Stacktrace:
 [1] foo()
   @ Main ./REPL[3]:1

This should be a single runtime call (and it's also not allocating).

As part of fixing this, we should probably add an UnknownRuntimeFunction error type. That way we don't imply something is allocating when really we have an unresolved runtime call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions