Skip to content

Add WASI support in CoreFoundation_Prefix.h #2873

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

Merged
merged 1 commit into from
Sep 15, 2020

Conversation

MaxDesiatov
Copy link
Contributor

Dispatch is not available on WASI due to SR-12097. Atomic shims such as OSAtomicCompareAndSwapPtr are made available as they would have a no-op implementation for compatibility in a separate PR.

@MaxDesiatov
Copy link
Contributor Author

@swift-ci please test

@@ -20,7 +20,11 @@

#include <CoreFoundation/CFAvailability.h>

#if TARGET_OS_WASI
Copy link
Contributor

Choose a reason for hiding this comment

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

Huh; do things even build correctly without dispatch, or at least shims? I'm pretty sure we depend on dispatch_* kind of all over the place, which is why __HAS_DISPATCH__ was kept fixed at 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, at least a certain subset (albeit a useful subset) does. That's why there's more #if TARGET_OS_WASI all over the codebase of our fork, more than a 100 files touched, and certain APIs are disabled completely. I'm going to submit those as separate PRs obviously.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is WASI strictly single-threaded?

Copy link
Contributor Author

@MaxDesiatov MaxDesiatov Sep 15, 2020

Choose a reason for hiding this comment

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

Yes, multi-threading support and atomics aren't standardised yet, and will be available in some future (unspecified) browser versions. Only Chrome has a working implementation hidden with experimental flags, as as I remember.

This restriction applies to whole WebAssembly, not just WASI.

@millenomi millenomi merged commit 76068b8 into master Sep 15, 2020
@MaxDesiatov MaxDesiatov deleted the maxd/wasi-corefoundation-prefix branch September 15, 2020 07:57
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.

2 participants