Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jl_get_builtin_fptr not handled correctly for call resolution #83

Open
topolarity opened this issue Sep 18, 2024 · 0 comments
Open

jl_get_builtin_fptr not handled correctly for call resolution #83

topolarity opened this issue Sep 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@topolarity
Copy link
Member

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.

@topolarity topolarity added the bug Something isn't working label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant