Commit Graph

17237 Commits

Author SHA1 Message Date
Saleem Abdulrasool
b841523e4f Merge pull request #61799 from mhjacobson/freebsd-define-RTLD_DEFAULT
stdlib: define RTLD_DEFAULT for FreeBSD
2022-11-11 12:47:48 -08:00
Egor Zhdan
e6d981e1bd Merge pull request #62036 from apple/egorzhdan/cxx-explicit-iterator
[cxx-interop] Specify `Iterator` explicitly for `CxxRandomAccessCollection`
2022-11-10 14:04:00 -08:00
swift-ci
3cde3863bd Merge pull request #62030 from mikeash/fix-bridgeobjectretain-linux-arm64
[Runtime] Fix swift_bridgeObjectRetain on ARM64 Linux.
2022-11-10 14:02:34 -08:00
Evan Wilde
531df990af Merge pull request #61991 from etcwilde/ewilde/note-to-self
Add note to stop trying to fix compat tsan syms
2022-11-10 13:48:02 -08:00
Mike Ash
42899535d8 [Runtime] Fix swift_bridgeObjectRetain on ARM64 Linux.
The tail call of swift_retain isn't correct there. Revert back to a non-tail call for all !SWIFT_OBJC_INTEROP for now.

rdar://102152616
2022-11-10 12:19:07 -05:00
eeckstein
cd47e7ff98 Merge pull request #61921 from mhjacobson/freebsd-fix-bootstrapped-build
build: support bootstrapped build on FreeBSD
2022-11-10 15:45:07 +01:00
swift-ci
627dc1f69c Merge pull request #61911 from apple/rokhinip/99977665-continuations-support
Implement continuations in task-to-thread model.
2022-11-09 20:16:14 -08:00
Rokhini Prabhu
b2f51dd3de Implement continuations in task-to-thread model.
This is done using a condition variable upon which the awaiting thread
will block if the continuation has not be resumed by the point of await.
The resuming thread will signal this condition variable, thereby
unblocking the awaiting thread.

Rdar://99977665
2022-11-09 15:58:53 -08:00
Evan Wilde
801e090507 Add note to stop trying to fix compat tsan syms
I keep trying to fix the tsan symbol dance, avoiding duplicate symbols
for initializing the tsan acquire and release function pointers. The
idea this time was to expose an API from the runtime to return the
function pointers for the compatibility library. This won't work because
the compatibility library would need to backdeploy to a version of the
library that doesn't have those symbols, so it would fail to link.

Now, if I really wanted to increment the counter again, an idea might be
to pull the swift_tsan_acquire/swift_tsan_release symbols out of the
Swift concurrency runtime and make them into a toolchain static library
which would get linked by the driver when doing an ASAN build. The
sanitizer libraries are already shipped like this, so it wouldn't be
too weird to do this.
2022-11-08 17:10:32 -08:00
Mike Ash
b9391c03e5 Merge pull request #61794 from mikeash/retain-stack-frames
[Runtime] Eliminate stack frames in swift_retain and swift_bridgeObjectRetain on ARM64.
2022-11-08 15:32:55 -05:00
Erik Eckstein
0494db062a fix wrong attribute ordering in the runtime
This is required to a clang change. Attribute need to be in a certain order when building with a newer clang.

This fix might be replaced by something better, e.g. https://github.com/apple/swift/pull/61476
2022-11-08 09:35:44 +01:00
Egor Zhdan
da02016ec5 [cxx-interop] Specify Iterator explicitly for CxxRandomAccessCollection
This helps to avoid ambiguity errors when manually conforming a type to `CxxRandomAccessCollection` protocol.
2022-11-07 17:46:49 -08:00
Mike Ash
724a9a7da4 [Runtime] Eliminate stack frames in swift_retain and swift_bridgeObjectRetain on ARM64.
Rearrange the slow paths a bit to make them tail calls, which allows the compiler to emit these functions without frames.

Clang is happy to emit frameless functions on ARM64 if no stack space is needed on all execution paths. However, when there's a fast path which doesn't need stack space, and a slow path which does, clang emits code that pushes a stack frame and then decides which path to take. This is fine, but it means we're paying more than we'd like to on the fast path.

We can work around that by manually outlining the slow path, and ensuring that it's invoked with a tail call. Then the original function doesn't need a stack frame on any path and clang omits the stack frame.

We tweak RefCounts::increment to return the object it's being called on, which allows `swift_retain` to tail-call it. We manually outline the objc_retain call in swift_bridgeObjectRetain, which allows the swift_retain path to be frameless.

rdar://101764509
2022-11-07 15:38:14 -05:00
Alastair Houghton
9c321c02c5 Merge pull request #61931 from al45tair/eng/PR-101749382-take2
Remove erroneous ELF note.
2022-11-07 10:17:08 +00:00
Saleem Abdulrasool
67728ea6ef Merge pull request #61933 from compnerd/dispatch
Concurrency: support newer dispatch functionality on Windows
2022-11-05 10:44:29 -07:00
Kavon Farvardin
3c4dd9fad4 Merge pull request #61938 from kavon/annotate_inherits_backdeploy
add missing `@_unsafeInheritExecutor`'s to backdeploy library
2022-11-04 14:16:54 -07:00
Kavon Farvardin
3e9ab9a69a add missing @_unsafeInheritExecutor's to backdeploy library
resolves rdar://101934420
2022-11-04 10:28:16 -07:00
Alastair Houghton
26ded3f6b1 Also remove SWIFT_REFLECTION_METADATA_ELF_NOTE_MAGIC_STRING.
We aren't using this constant any more either.

rdar://101749382
2022-11-04 16:04:20 +00:00
Saleem Abdulrasool
a066a6ecfb Concurrency: support newer dispatch functionality on Windows
This addresses an unintended instance where new dispatch functionality
is not used on Windows as the lookup was never performed.  This limits
the runtime to shared linking which should generally be a safe
assumption on Windows.
2022-11-04 06:56:46 -07:00
Alastair Houghton
5e6c8b18ba Remove erroneous ELF note.
On ELF platforms we currently output an ELF note but with totally invalid
contents.  I tried experimenting to see whether it was possible to do it
properly and tie the result into ReflectionContext, but it turns out to be a
hard problem because of issues to do with cross-segment symbol references and
relocations.

The upshot is that I think for now it's best just to remove it.

We might revisit this in future at some point; it would be good to be able to
reliably find the Swift metadata just from the ELF Phdrs.

rdar://101749382
2022-11-04 02:51:20 -07:00
Matt Jacobson
61cf0970a1 build: support bootstrapped build on FreeBSD
Fixes failures to link and run the bootstrapping1 compiler.
2022-11-03 17:34:26 -04:00
Egor Zhdan
c7095e095b Merge pull request #61878 from apple/egorzhdan/cxx-rac-overrides
[cxx-interop] Add explicit typealiases to `CxxRandomAccessCollection`
2022-11-03 10:07:25 -07:00
Augusto Noronha
352c4c209a Merge pull request #61837 from augusto2112/reflect-optional-bool
Implement reading extra inhabitants of integers
2022-11-03 09:38:25 -07:00
Egor Zhdan
5359c13a83 [cxx-interop] Add explicit typealiases to CxxRandomAccessCollection
This will help us to auto-generate conformances to `CxxRandomAccessCollection`, since synthesized conformances must have all of their witnesses explicitly provided.
2022-11-02 13:51:34 -07:00
Augusto Noronha
363b5e4c77 Implement reading extra inhabitants of integers
Bools may have extra inhabitants. Implement reading the extra
inhabitants of bools in BuiltinTypeInfo::readExtraInhabitantIndex.
2022-11-02 13:27:00 -07:00
Stephen Canon
33d178cf60 Merge pull request #59623 from rxwei/cherry-42611 (#61793)
* Merge pull request #59623 from rxwei/cherry-42611

* Fixup switch.swift test from bad merge.

Co-authored-by: Richard Wei <rxrwei@gmail.com>
2022-11-02 14:02:16 -04:00
Saleem Abdulrasool
04dd83983b Merge pull request #61756 from mhjacobson/freebsd-define-CLongDouble-typealias
stdlib: define typealias CLongDouble for FreeBSD
2022-11-02 10:02:26 -07:00
Saleem Abdulrasool
0a2b10b777 Merge pull request #61815 from MillerTechnologyPeru/trunk/riscv64
[stdlib] Add RISCV64 support
2022-11-02 09:53:34 -07:00
Alsey Coleman Miller
62b7be4e9c [stdlib] Add RISCV64 support 2022-11-01 23:59:42 -07:00
Joe Groff
121adf6eb2 Merge pull request #60758 from fibrechannelscsi/faster-keypaths
KeyPath performance improvement: Omit projection across trivially-typed memory.
2022-11-01 11:59:44 -07:00
Martin Cwikla
bc4b38d747 Removed an unnecessary disabling of isPureStruct.
This would have prevented explicitly specified KeyPaths through pure structs, e.g., \A.b.c, from taking the optimized path.
2022-10-31 14:43:44 -06:00
Matt Jacobson
802d877460 stdlib: define typealias CLongDouble for FreeBSD on i386, x86_64
This fixes a failure compiling the stdlib where the importer cannot find (i.e.,
refuses to import) functions _stdlib_remainderl and _stdlib_squareRootl.
2022-10-31 15:52:26 -04:00
Matt Jacobson
90e466b1a8 stdlib: define RTLD_DEFAULT for FreeBSD
It's defined the same as on Darwin and OpenBSD.
2022-10-29 04:58:52 -04:00
John McCall
7f737d235d Synchronize with cancellation when removing a task from a task group
We were detaching the child by just modifying the list, but the cancellation path was assuming that that would not be done without holding the task status lock.

This patch just fixes the current runtime; the back-deployment side is complicated.

Fixes rdar://88398824
2022-10-29 00:10:28 -04:00
Martin Cwikla
92d7cf5725 Revised _tryToAppendKeyPaths(). Removed two instances of isPureStruct.append() that weren't needed. 2022-10-26 11:05:02 -06:00
Egor Zhdan
e97b1c8e5b Revert "[cxx-interop] Add conversions between std::u16string and Swift.String" 2022-10-26 11:54:39 +01:00
Robert Widmann
25e1c9f52a Add Missing _StringProcessing Dependencies
These two modules themselves depend on modules that implicitly import the _StringProcessing library. Take OSLog as an example, which imports ObjectiveC, which implicitly imports _StringProcessing. Thus, we can get into the following bad scenario:

- A compiler at module format X builds _StringProcessing
- A rebase is performed and the compiler is rebuilt at module format Y > X
- OSLog builds before _StringProcessing (since it has no dependency)
- But _StringProcessing is at module format X < Y, so we have to rebuild it

This normally manifests as an error at the desks of compiler engineers about a mismatch in the module format for _StringProcessing. Let's fix that by making CMake schedule _StringProcessing before them.
2022-10-25 13:40:52 -07:00
Martin Cwikla
21f175ae3c Added missing instances of pureStruct information propagation.
This means we no longer need to check for empty KeyPath Walker results.
2022-10-24 17:43:00 -06:00
Egor Zhdan
8a957014dd Merge pull request #61695 from apple/egorzhdan/cxx-u16string
[cxx-interop] Add conversions between `std::u16string` and `Swift.String`
2022-10-24 16:21:44 +01:00
Max Desiatov
ffc6152f68 [Distributed] fix deprecation warning in LocalTesting (#61415) 2022-10-24 20:19:41 +09:00
Egor Zhdan
306dcdfa96 [cxx-interop] Add conversions between std::u16string and Swift.String
This change adds a few extensions to the C++ stdlib overlay to allow convenient conversions between C++ UTF-16 strings and Swift strings.
2022-10-24 12:15:30 +01:00
유재호
c0c84f4a95 [stdlib] Fix typo in Hashable.swift 2022-10-22 10:31:19 +09:00
Eric Miotto
9ba404e043 Don't target arm64/arm64e for the back-deployed Concurrency dylib for watchOS (#61665)
Addresses rdar://101389307
2022-10-21 15:15:54 -07:00
Martin Cwikla
a6a2f509b3 Use Int(bitPattern) rather than distance(to) to compute the offset. 2022-10-20 14:26:35 -06:00
Martin Cwikla
4fb2f9e15e Modified storage of valid offsets in assignOffsetToStorage() and getOffsetFromStorage().
Got rid of isTuple(). Moved determination of pure struct KeyPaths into _instantiateKeyPathBuffer.
2022-10-20 14:26:35 -06:00
Martin Cwikla
d2912dca75 Fixed .unresolvedFieldOffset should count as an optimized offset. Restored optimization for KeyPath writes. 2022-10-20 14:25:40 -06:00
Martin Cwikla
2d5086c085 Fixed the failing unit tests in capture_propagate_keypath.swift.
Revisited formatting. Pulled in changes from the past four weeks.
2022-10-20 14:25:39 -06:00
Martin Cwikla
afebae5694 Moved computation of offset for pureStructKeyPaths into KeyPathPatternVisitors.
Next expected commit: Move information stored in _pureStructValueOffset to _kvcKeyPathStringPtr (or similar).
2022-10-20 14:25:39 -06:00
Martin Cwikla
353eb9ffd5 KeyPath offset tests were breaking on Ubuntu 20.04. It's possible _storedInlineOffset wasn't factored out correctly. 2022-10-20 14:25:39 -06:00
Martin Cwikla
5efc87c67e ABI stability fix: isPureStructKeyPath should be internal. 2022-10-20 14:25:39 -06:00