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

Port Ice Swift src to use async/await #2534

Merged
merged 39 commits into from
Aug 1, 2024

Conversation

externl
Copy link
Member

@externl externl commented Jul 19, 2024

This PR removes PromiseKit and replaces the Promise based API with async/await. We make use of the Swift/ObjC async interop support as well as the Swift's withCheckedContinuation helper function.

CI is failing as I have not disabled or ported the tests yet (I have some done locally). Just opening this draft PR for feedback. There's also still some cleanup to be done.

Things of note:

  • We no longer need the C++ dispatch queues. The C++ threads hand off to the global executor roughly when we switch from Objc++ to Swift. As a consequence of this thread switch there's no way to provide back pressure by hogging the C++ thread.
  • The optional test takes a long time to compile. Not sure what we can do about it.

Future cleanup and improvements:

  • Port a few tests which are currently commented out
  • Remove sync API entirely (I'm a little concerned about compile time)
  • Remove sent callback
  • Implemented MaxDispatches per OA

@externl externl requested review from bernardnormier and pepone July 19, 2024 15:01
@externl externl force-pushed the swift-async-await branch from 8cf6d20 to a5e0ddd Compare July 19, 2024 15:01
Copy link
Member

@bernardnormier bernardnormier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Larger question: what's your plan in terms of sync API for proxies and servants?

  • keep sync + async APIs like in other language mappings
  • provide only an async API like in IceRPC, and the current sync + async APIs is a temporary step?

cpp/src/slice2swift/SwiftUtil.h Outdated Show resolved Hide resolved
swift/src/Ice/Dispatcher.swift Show resolved Hide resolved
swift/src/Ice/Object.swift Show resolved Hide resolved
cpp/src/slice2swift/Gen.cpp Show resolved Hide resolved
swift/src/Ice/ServantManager.swift Outdated Show resolved Hide resolved
swift/src/IceImpl/DispatchAdapter.mm Outdated Show resolved Hide resolved
@externl externl force-pushed the swift-async-await branch from 945cd4a to 8957fb5 Compare July 26, 2024 14:08
@externl externl marked this pull request as ready for review July 29, 2024 15:59
@externl externl requested a review from bernardnormier July 29, 2024 15:59
Copy link
Member

@bernardnormier bernardnormier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start!

swift/src/IceImpl/DispatchAdapter.mm Show resolved Hide resolved
swift/src/IceImpl/DispatchAdapter.mm Outdated Show resolved Hide resolved
swift/test/Ice/ami/AllTests.swift Show resolved Hide resolved
swift/test/Ice/ami/AllTests.swift Show resolved Hide resolved
swift/test/Ice/ami/AllTests.swift Outdated Show resolved Hide resolved
swift/src/IceImpl/DispatchAdapter.mm Outdated Show resolved Hide resolved
swift/test/Ice/exceptions/ServerAMD.swift Outdated Show resolved Hide resolved
@externl externl merged commit 52094e8 into zeroc-ice:main Aug 1, 2024
19 checks passed
@externl externl deleted the swift-async-await branch August 1, 2024 13:37
InsertCreativityHere pushed a commit to InsertCreativityHere/compiler-comparison that referenced this pull request Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants