27 Commits
Author SHA1 Message Date
Karoy Lorentey 44bf6b59dc Fix UnsafeAtomic's Sendable conformance
In Swift 5.5, `UnsafeAtomic` has gained an implicit, unconditional `Sendable` conformance, because it is a `@frozen public struct` whose sole stored property (an `UnsafeMutablePointer` is also `Sendable`. This is not correct -- we only want `UnsafeAtomic` to conform to `Sendable` if its `Value` does.

Explicitly declare the conformance on 5.5 to disable the bogus inference.
2021-09-24 14:51:07 -07:00
Karoly Lorentey fef04c75ae [Utilities] Upgrade gyb to Python 3 2021-09-22 19:25:08 -07:00
Karoy Lorentey 0e51be5d3a Unmanaged.retain(by:)/release(by:): Remove @inlinable
These are only ever called from opaque function bodies, so there is no need to make them inlinable anyway.

This allows us to stop linking client code with _AtomicsShims. (Although I don't quite understand how it was necessary before.)
2021-09-22 14:53:32 -07:00
Karoy Lorentey 98a31b396d [cmake] Fix building with CMake
- Disable building tests on Darwin
- Fix test registration on Linux when double-wide atomics aren't available
- Unconditionally enable double-wide atomics
2021-09-22 14:53:32 -07:00
Karoy Lorentey 2468fa3eac Also use compare-exchange in dispose() 2021-09-22 13:33:39 -07:00
Karoy Lorentey e08ad97132 Implement double-wide loads with compare-exchange on arm64 in debug builds with the Swift 5.5 commpiler
Resolves https://github.com/apple/swift-atomics/issues/41.
2021-09-22 13:06:19 -07:00
Karoy Lorentey 5d07eab6fe [shims] Only define atomic shims in Swift's Clang Importer
Per #37, we currently happen to use some non-standard C atomics that only work in Clang; to prevent issues when this module gets compiled using other compilers, `#ifdef` out all the actual shims, leaving only the definitions for `retain_n`/`release_n`.

(For example, CMake builds the shims module using the system C compiler by default, which is usually GCC on Linux.)
2021-09-08 18:11:06 -07:00
Karoy Lorentey 59f7fbf479 Merge pull request #36 from apple/unsupported-library-evolution-fixes
Fix build errors with library evolution enabled
2021-08-30 14:16:24 -07:00
Karoy Lorentey 1d4afa40d7 Fix build errors with library evolution enabled
We do not support building this package with `-enable-library-evolution`, but I don't see a reason not to fix build errors with that configuration.
2021-08-30 12:54:20 -07:00
Karoy Lorentey d4a3aae83b [shims] Fix i386/armv7 regression introduced in #26 2021-08-30 12:28:45 -07:00
Karoy Lorentey 299d1251f1 Regenerate gybbed sources 2021-08-27 17:19:56 -07:00
Karoy Lorentey eb7e1335f8 [NFC] Update copyright notices 2021-08-27 17:13:03 -07:00
Saleem Abdulrasool 67bbf646d8 build: add a CMake based build for Atomics
This adds an initial implementation of a CMake based build system.
2021-04-30 08:32:45 -07:00
Saleem Abdulrasool 7294d12edd _AtomicShims: simplify double word setup
Unify the double word path by using a bit more macro expansion.  The two
differences between 32-bit and 64-bit is:
  - `__uint128_t` vs `uint64_t`
  - 64-bit shifts vs 32-bit shifts

We can simply use a macro to expand out the underlying C type rather
than bifurcating the definitions.  For the second difference, we can
simply use the `__INTPTR_WIDTH__` for the shifts.  We explicitly use
macros for the type-definitions to hide the typedef from Swift.

Use the C11 aggregate constructor to further reduce the code.
2021-04-23 08:24:29 -07:00
Akis Kesoglou 7e101a5653 Mark the additional Bool methods as public
…inline with the static methods on AtomicStorage and AtomicIntegerStorage.
2021-03-14 19:20:38 +02:00
Karoy Lorentey 09ddcdd88d DoubleWord._readersBitWidth: Switch to using Int.bitWidth
This fixes a spurious warning about `arch(arm64_32)` emitted by swift.org compiler builds.

Resolves #19
2021-01-26 17:38:10 -08:00
Karoy Lorentey df9f811f19 [shims] Remove unnecessary #include 2020-11-18 16:41:58 -08:00
Karoy Lorentey 47c88d732f Work around some compiler issues in Swift 5.2
This allows the package to be built with the Swift 5.2.4 toolchain.

Resolves #15
2020-11-09 13:52:03 -08:00
JP Simard 55a062c4a8 Fix typo in AtomicMemoryOrderings.swift docstring 2020-10-22 06:03:22 -07:00
Karoy Lorentey 9ad914d118 Make double-wide atomics conditional on platform support
Linux on x86_64 unfortunately disables support for cmpxchg16 by default, making double-wide atomic operations fall back to using locks. We cannot currently override this on the package level, so stop providing double-wide atomics in this configuration by default.

To enable codegen support for double-wide atomics on Linux/x86_64, compile the package with `-Xcc -mcx16 -Xswiftc -DENABLE_DOUBLEWIDE_ATOMICS`.
2020-10-09 14:52:33 -07:00
Karoy Lorentey 6e09389a3d Revert "[shims] Make retain_n/release_n shims header-only" 2020-10-07 23:57:38 -07:00
Karoy Lorentey 40bd3bac4f [shims] Force-inline new shims 2020-10-06 18:39:11 -07:00
Karoy Lorentey 45fa32a922 [shims] Make retain_n/release_n shims header-only.
Resolves issue #8.
2020-10-06 18:00:10 -07:00
Daniel Jackson 42691f8636 Commit changes from running generate-sources 2020-10-02 16:29:09 -07:00
Daniel Jackson 778e62b8c6 Fix successOrdering typo in documentation, in the gyb file 2020-10-02 16:28:33 -07:00
Dan Jackson ad1fb15167 Update documentation typo: double ‘the’ 2020-10-02 09:28:57 -07:00
Karoy Lorentey b97750eb18 Initial commit. 2020-10-01 16:57:36 -07:00