-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Runtime: Implement wrapper function to call metadata access functions #30024
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
Runtime: Implement wrapper function to call metadata access functions #30024
Conversation
Seems like a reasonable helper to me. I wonder if the dispatch code could be factored in such a way that the basic logic could be phrased in plain C and exposed into the standard library via |
@swift-ci Please smoke test |
I originally had this in in |
3b55c45
to
f35efee
Compare
I've gone ahead and moved this to SwiftShims! Let me know if there's anything else that needs changing. |
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.
Looks good, thanks!
@swift-ci Please test |
⛵ |
We are seeing failure on Swift in the OS bot - https://ci.swift.org/job/oss-swift_tools-RA_stdlib-RA-test-simulator-swift-in-the-os/2127/ Note this bot is using dylib from the OS not just built.
|
@shahmishal is this just a matter of forcing the test to use the just built libraries? How would one achieve that? |
@Azoy You will want to update your test so that it only runs on a newer Swift runtime that has your added metadata call. For unreleased features, you can do this by requiring version |
This was introduced by swiftlang#30024. rdar://61814566
I don't think we should've accepted this; it's a pretty limited API that's never going to handle arbitrary generics well. What exactly are you trying to do at a high level? I have some ideas about supporting higher-kinded types as a first-class language feature that would allow you to abstractly pass around uninstantiated generics. That would naturally result in code-generation like what you've got here, while also working correctly with constrained generics. Alternatively, if you're trying to do something more inherently reflective, I think we should think much more carefully about how we want to satisfy that. This API does not seem like a good stepping-stone for that; it's actually extremely unsafe. |
[5.3] Revert "Merge pull request #30024 from Azoy/calling-metadata-accessor-from-swift"
Revert "Merge pull request #30024 from Azoy/calling-metadata-accessor…-from-swift"
See here: https://forums.swift.org/t/bitcast-pointer-to-swift-function/32324
This is a runtime function that takes an arbitrary metadata access function along with the request and generics and calls said access function. This is useful for those creating their own Swift metadata libraries to be able to call these access functions.
Right now this is using the Swift cc so that I could play around with something in an interpreter test, but it might make more sense to give this the C cc.
cc: @jckarter @rjmccall