-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix opaque closure codegen ABI #40001
Conversation
src/codegen.cpp
Outdated
argType = jl_unwrap_unionall( | ||
(jl_value_t*)jl_opaque_closure_type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems strange to intentionally introduce an invalid type object here as the argument type with jl_unwrap_unionall
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is to make emit_getfield_knownidx
below work since the layout is independent of the type parameters. I guess I could just do OpaqueClosure{Tuple{Any}, Any}
to make something valid or we could just manually compute the offset. Maybe the latter makes the most sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, yeah, I'm surprised we don't end up tagging that load with some nonsensical type too and causing confusion
I guess the latter possibly does make the most sense, as later the intent is to inline the data, rather than making it a separate Tuple{Any} allocation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, alright, let me just do that.
At the moment our ABI for specfun opaque closures is that the opaque closure itself remains a GC tracked pointer out of which the function itself implicitly loads the environment and the world age. In the future we may want to improve this ABI, but it seems fine for now. However, this ABI wasn't quite implemented correctly after we've started turning on inference of OpaqueClosure where the first argument of the MethodInstance's linfo actually stores the type of the closure environment rather than the closure itself. Fix this by manually forcing the signature determination code to just treat that argument as `Any`, though of course in the future we may want to do something fancier.
At the moment our ABI for specfun opaque closures is that the opaque closure itself remains a GC tracked pointer out of which the function itself implicitly loads the environment and the world age. In the future we may want to improve this ABI, but it seems fine for now. However, this ABI wasn't quite implemented correctly after we've started turning on inference of OpaqueClosure where the first argument of the MethodInstance's linfo actually stores the type of the closure environment rather than the closure itself. Fix this by manually forcing the signature determination code to just treat that argument as `Any`, though of course in the future we may want to do something fancier.
At the moment our ABI for specfun opaque closures is that the opaque closure itself remains a GC tracked pointer out of which the function itself implicitly loads the environment and the world age. In the future we may want to improve this ABI, but it seems fine for now. However, this ABI wasn't quite implemented correctly after we've started turning on inference of OpaqueClosure where the first argument of the MethodInstance's linfo actually stores the type of the closure environment rather than the closure itself. Fix this by manually forcing the signature determination code to just treat that argument as `Any`, though of course in the future we may want to do something fancier.
At the moment our ABI for specfun opaque closures is that the
opaque closure itself remains a GC tracked pointer out of which
the function itself implicitly loads the environment and the world
age. In the future we may want to improve this ABI, but it seems
fine for now. However, this ABI wasn't quite implemented correctly
after we've started turning on inference of OpaqueClosure where
the first argument of the MethodInstance's linfo actually stores
the type of the closure environment rather than the closure itself.
Fix this by manually forcing the signature determination code to
just treat that argument as
Any
, though of course in the futurewe may want to do something fancier.