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

"Delayed" Calls and trimming #57888

Open
gbaraldi opened this issue Mar 25, 2025 · 3 comments
Open

"Delayed" Calls and trimming #57888

gbaraldi opened this issue Mar 25, 2025 · 3 comments
Labels
trimming Issues with trimming functionality or PR's relevant to its performance/functionality

Comments

@gbaraldi
Copy link
Member

One of the missing features around trimming currently is what I'm calling "delayed" calls. Basically operations that mean that a call will be performed using a specificic signature, but instead of going through the typical Expr(:invoke path, they might happen eventually.

An incomplete list of operations is

  • cfunction
  • tasks
  • Opaque Closures
  • atexit
  • Finalizers

They all could be represented by something like a :virtual_invoke, which serves just as a token that indicates to typeinf_ext_toplevel/create_native that code must be compiled for those code_instances. ccallable is already an example of a delayed call, but it's more well behaved since it depends only on function definitions

@topolarity topolarity added the trimming Issues with trimming functionality or PR's relevant to its performance/functionality label Mar 25, 2025
@topolarity
Copy link
Member

A challenge with the proposal is that we need a way to associate this with the original primitive. so that --trim verification can know the dispatch was resolved.

Otherwise, how do I know that

   Expr(:virtual_invoke, #= ... =#)
   Expr(:call, Core.finalizer, #= ... =#)

is a resolved version of that finalizer call?

This could instead be two finalizer calls, one of which was resolved and then deleted due to, e.g., effects analysis and another which we neither resolved nor deleted.

@vchuravy
Copy link
Member

vchuravy commented Mar 25, 2025

Why do we need a new IR statement? Wouldn't it be enough for the interpreter to recognize these constructs?

TKF and I did this for tasks.

@gbaraldi
Copy link
Member Author

Im not attached to that other expr at all to be clear, I think there are other options, we can bundle it to specific other stmts kind of like the ccall op bundle or any other suggestion actually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
trimming Issues with trimming functionality or PR's relevant to its performance/functionality
Projects
None yet
Development

No branches or pull requests

3 participants