feat(ffm): add support for async Swift functions via CompletableFuture - #870
Open
amanmaurya92 wants to merge 4 commits into
Open
feat(ffm): add support for async Swift functions via CompletableFuture#870amanmaurya92 wants to merge 4 commits into
amanmaurya92 wants to merge 4 commits into
Conversation
amanmaurya92
marked this pull request as ready for review
August 7, 2026 10:16
ktoso
reviewed
Aug 10, 2026
ktoso
left a comment
Collaborator
There was a problem hiding this comment.
Please include a runtime test in the Samples/FFM sample, we must have runtime testing of new substantial functionality.
Collaborator
|
Uhm, this doesn't even add any tests -- please add tests asserting the shape of generated thunks. We don't mind AI generated contributions, which this really seems like, but please make sure the quality of contributions is higher -- you must include tests, both source and runtime. Look at other PRs how new features are introduced please. |
ktoso
requested changes
Aug 10, 2026
ktoso
left a comment
Collaborator
There was a problem hiding this comment.
Please include tests as well as update documentation for the supported feature list in docs.
ktoso
reviewed
Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title:
feat(ffm): add support for async Swift functions via CompletableFuture
Description:
Resolves #392.
This PR adds Foreign Function & Memory (FFM) API support for Swift
asyncfunctions, bridging them to Java'sCompletableFuture(achieving parity with the existing JNI implementation).Key Changes:
asyncfunction returns toVoidin the C declaration, and appendedasync$completionandasync$errorcallback pointers for asynchronous resolution.CompletableFuture<T>. When the downcall is invoked, it allocates MemorySegments for the upcalls and resolves theCompletableFuturefrom within the C callback stubs.Taskto call the original Swift async function, bridging the execution context from the synchronous C call. The C callback pointers are invoked upon Task completion.Testing:
JExtractSwiftTestsensuring the C/Java layout and lowering logic functions correctly for FFM. (All 500 FFM code generation tests pass successfully).