Commit Graph

21821 Commits

Author SHA1 Message Date
Evan Wilde
9ff70cdb43 Merge pull request #81010 from etcwilde/ewilde/runtime-fix-clobbered-memories
[SwiftCore]: Don't always clobber memory
2025-04-24 10:06:40 -07:00
Mike Ash
66111530e1 [Runtime] Change the unowned reference fatal error to "was already destroyed."
The "was already deallocated" message is incorrect, since the target of an unowned reference stays allocated even after being deinitialized. We could say "was already deinitialized" but that's a bit of a niche term. "Was already destroyed" conveys what happened without the reader needing to worry about deinitialization versus deallocation.

rdar://149237704
2025-04-23 15:28:16 -04:00
Kuba (Brecka) Mracek
685572ed49 Merge pull request #80977 from kubamracek/embedded-concurrency-function-sections
[embedded][Concurrency] Build C++ runtime Concurrency code with -ffunction-sections and more embedded friendly flags
2025-04-23 07:11:17 -07:00
Kuba (Brecka) Mracek
84ba9dd1ad Merge pull request #81011 from kubamracek/embedded-conc-non-darwin2
[embedded][Concurrency] Also apply non-Darwin flags in Concurrency C++ runtime builds when targeting armv7m/armv7em
2025-04-22 23:06:11 -07:00
Kuba (Brecka) Mracek
3597454f71 Merge pull request #80973 from kubamracek/embedded-empty-box
[embedded] Add swift_allocEmptyBox to the embedded runtime
2025-04-22 22:31:21 -07:00
Evan Wilde
6f39a52afc [SwiftCore]: Don't always clobber memory
The new build system set `SWIFT_RUNTIME_CLOBBER_FREED_OBJECTS` to 0.
Unfortunately, the check in the Swift runtime used `#ifdef`, so even
though it was turned off, it was actually enabled in some cases.

Fixing the issue in the build system as well as switching the check to
verify that value of `SWIFT_RUNTIME_CLOBBER_FREED_OBJECTS` is taken into
account in the sources. C/C++ implicitly defines macro values to 1 when
set without a value and 0 when it is not set.

Also making the hex a bit more recognizable and grep'able by including
it as a comment.

Fixes: rdar://149210738
2025-04-22 16:51:28 -07:00
Kuba Mracek
04df4ad12e [embedded][Concurrency] Also apply non-Darwin flags in Concurrency C++ runtime builds when targeting armv7m/armv7em 2025-04-22 15:51:15 -07:00
Alastair Houghton
77eb4f05ec Merge pull request #80896 from al45tair/eng/PR-149346132
[Concurrency] Make initial executor construction fully thread safe.
2025-04-22 16:25:26 +01:00
Ian Anderson
0ae5a4251c Merge pull request #80951 from ian-twilightcoder/embedded-builtin_float
[embedded] Build the _Builtin_float overlay in embedded Swift mode
2025-04-22 00:32:30 -07:00
Kuba Mracek
71ed50c360 [embedded][Concurrency] Build C++ runtime Concurrency code with -ffunction-sections and more embedded friendly flags 2025-04-21 18:21:12 -07:00
Kuba Mracek
c0ea02f86d [embedded] Add swift_allocEmptyBox to the embedded runtime 2025-04-21 15:47:34 -07:00
Kuba (Brecka) Mracek
1281f5910a Merge pull request #80682 from kubamracek/embedded-lossless-convertible
[embedded] Add back LosslessStringConvertible to Bool and integer types
2025-04-21 14:50:57 -07:00
Meghana Gupta
b76047a846 Merge pull request #80930 from meg-gupta/relandpr
Reland #79707
2025-04-21 11:19:33 -07:00
Ian Anderson
b1e2746c38 [embedded] Build the _Builtin_float overlay in embedded Swift mode
Add embedded targets for the _Builtin_float overlay.

rdar://123951443
2025-04-21 10:34:30 -07:00
Evan Wilde
f0430eb033 Merge pull request #80934 from etcwilde/ewilde/fix-bootstrap-builds
Fix Bootstrap: UTF8EncoddingError
2025-04-21 09:49:39 -07:00
Doug Gregor
54e4400e92 Merge pull request #80933 from DougGregor/safe-nested-in-unsafe-fixes
[Strict memory safety] Improve handling of safe types nested within unsafe ones
2025-04-20 02:31:48 -07:00
Evan Wilde
783c969e10 Fix Bootstrap: UTF8EncoddingError
The pass that annotated control-flow positions unreachable after an
infinite loop was migrated to pure Swift in PR 79186
(https://github.com/swiftlang/swift/pull/79186). As a result, the
C++-only bootstrap compiler is unable to determine that the
code-location is unreachable. Placing a fatalError after the infinite
while loop.

Fixes: rdar://149631113
2025-04-19 23:42:08 -07:00
Doug Gregor
1c9875e14a Remove extraneous unsafe from the concurrency library 2025-04-19 22:02:30 -07:00
Doug Gregor
457eb4cc64 [Strict memory safety] Update standard library for nested safe/unsafe types
Use this to mark a few internal types @safe now that it works properly.
2025-04-19 19:54:32 -07:00
Meghana Gupta
d81b5f7e27 Reland #79707
Revert "Merge pull request #80767 from meg-gupta/reverttransparent"

This reverts commit 198a802719, reversing
changes made to 8eb43af590.
2025-04-19 09:55:06 -07:00
Meghana Gupta
a0fc6e2eaf Merge pull request #80712 from meg-gupta/fixoslog
Add  @_transparent to some more Integer operations
2025-04-19 09:51:07 -07:00
Doug Gregor
fe6856726e [Strict memory safety] Remove now-extraneous "unsafe" from the standard libraries
Now that we aren't propagating "unsafe" to nested types, remove
unnecessary "unsafe" keywords from the standard library.
2025-04-19 08:13:05 -07:00
Guillaume Lessard
493e853039 Merge pull request #80684 from glessard/rdar137710901-addressable-utf8view-span
[SE-0456] enable span properties for the small-String representation
2025-04-17 22:52:14 -07:00
Alastair Houghton
3d0d0b4328 [Concurrency] Make initial executor construction fully thread safe.
I had originally thought that we'd get away without this because the
executor construction generally happens in the async `main` function,
but of course if a program doesn't already use Swift Concurrency,
and someone uses it from a plug-in or library it loads, there's a
risk that we might have a race condition.

rdar://149346132
2025-04-17 21:48:42 +01:00
Eric Miotto
ac07594025 Merge pull request #80866 from edymtt/emiotto/mark-executorimpl_cpp-optional
CMake Embedded Stdlib: mark `ExecutorImpl.cpp` as optional
2025-04-17 10:09:22 -07:00
Dave Lee
6cc65c53ce Concurrency: Use "prioritized" spelling (NFC) (#80475)
These changes all reflect the the name `DefaultActorImplFooter::prioritizedJobs`. See also https://github.com/swiftlang/swift/pull/70910#discussion_r1581409259.
2025-04-17 09:39:28 -07:00
Guillaume Lessard
a5c561fb13 Merge pull request #80831 from glessard/rdar149227278-nonescapable-mutating-accessor
[LifetimeDependenceMutableAccessors] defensive feature flag
2025-04-17 09:27:23 -07:00
Doug Gregor
0ec146a687 Merge pull request #80865 from DougGregor/conformance-cache-extended-entry-deleak
[Runtime] Properly deallocate extended storage for conformance cache entries
2025-04-17 08:53:25 -07:00
Konrad `ktoso` Malawski
e454c0a5c3 Merge pull request #79457 from nickolas-pohilets/mpokhylets/hashable-stream-continuation
Added Hashable conformance to Async(Throwing)Stream.Continuation
2025-04-17 08:09:55 +09:00
Eric Miotto
a249e7fd8d CMake Embedded Stdlib: mark ExecutorImpl.cpp as optional
This is needed for internal Apple configurations that build the Embedded
Stdlib on its own.

Addresses rdar://149410405
2025-04-16 15:45:11 -07:00
Doug Gregor
885f829a63 [Conformance cache] Add allocated extended-storage for entries to the free list
This memory is part of the conformance cache concurrent hash map, so
when we clear the conformance cache, record each of the allocated
pointers within the concurrent map's free list. This way, it'll be
freed with the rest of the concurrent map when it's safe to do so.
2025-04-16 15:11:59 -07:00
Doug Gregor
d576fa30c9 [Runtime] Replace use of C++ new with malloc() 2025-04-16 14:04:14 -07:00
Doug Gregor
9eebee8b7c Merge pull request #80844 from DougGregor/conformance-cache-entry-stole-the-wrong-bit
[Runtime] Don't use the low bit of a WitnessTable pointer in the conformance cache
2025-04-16 13:45:16 -07:00
Karoy Lorentey
0c406b89e6 [stdlib] Allow metatype comparisons to work with outdated compilers
Add a new language feature to avoid the stdlib’s swiftinterface becoming unintelligible to outdated compiler builds due to the generalization of Builtin.is_same_metatype.

rdar://149396721
2025-04-16 12:45:09 -07:00
Doug Gregor
d0812a4143 Merge pull request #80838 from DougGregor/relative-witness-tables-isolation-check
[Runtime] Handle relative witness tables in _getIsolationCheckingOptionsFromExecutorWitnessTable
2025-04-16 08:54:08 -07:00
Alejandro Alonso
ace5c20b12 Merge pull request #78248 from Azoy/value-generic-static-member
[NameLookup] Allow value generics to show up as static members
2025-04-16 08:03:46 -07:00
Konrad `ktoso` Malawski
2dd6348898 Merge pull request #80821 from ktoso/wip-refine-scheduling-of-task-start-synchronously
[Concurrency] Improve in order synchronous enqueue of startSynchronously
2025-04-16 16:42:37 +09:00
Doug Gregor
5f0043711c [Conformance cache] Handle missing protocol descriptors
This can happen when running against an older version of a library that
doesn't have the protocol defined.
2025-04-15 21:11:19 -07:00
Doug Gregor
aeb7056991 [Runtime] Don't use the low bit of a WitnessTable pointer in the conformance cache
With relative witness tables, the low bit of a witness table pointer is
an indicator that we need to load from the given pointer. We were also
using the low bit of the witness table pointer in the conformance
cache entry as part of a pointer union. Hilarity ensures [*].

Switch to another low bit by exploding the conformance cache key
into separate fields and taking the low bit of one of those pointers
that isn't reserved.

Fixes the remainder of rdar://149326058, I hope.

[*] No, I am not laughing.
2025-04-15 18:12:18 -07:00
Meghana Gupta
198a802719 Merge pull request #80767 from meg-gupta/reverttransparent
Revert #79707
2025-04-15 15:45:15 -07:00
Doug Gregor
663ef8aa2e [Runtime] Handle relative witness tables in _getIsolationCheckingOptionsFromExecutorWitnessTable
Part of rdar://148687148.
2025-04-15 13:47:26 -07:00
Guillaume Lessard
3670664ce6 [stdlib] use “LifetimeDependenceMutableAccessors” 2025-04-15 10:41:27 -07:00
Konrad 'ktoso' Malawski
a24a28c217 [Concurrency] Improve in order synchronous enqueue of startSynchronously
Previously there was still a sneaky hop which caused ordering issues.
This introduced a specific test startSynchronously_order which checks
that the task enqueues indeed are "immediate" and cleans up how we
handle this.

This also prepares for the being discussed in SE review direction of
this API that it SHOULD be ALLOWED to actually hop and NOT be
synchronous at all IF the isolation is specified on the closure and is
DIFFERENT than the callers dynamic isolation.

This effectively implements "synchronously run right now if dynamically
on the exact isolation as requested by the closure; otherwise enqueue
the task as usual".

resolves rdar://149284186
cc @drexin
2025-04-15 19:59:15 +09:00
Alejandro Alonso
b3f3dd79cf Handle dynamically accessing the static member from type(of:) 2025-04-14 15:32:46 -07:00
QuietMisdreavus
41120da702 [SymbolGraphGen] add flags to filter platforms out of availability metadata (#80778)
* add option to filter availability metadata in symbol graphs

* filter out platform-specific availability in the stdlib docs

rdar://144379124
2025-04-14 15:20:22 -07:00
Alejandro Alonso
c384db5b91 Merge pull request #80658 from Azoy/public-cell
[stdlib] Make _Cell public
2025-04-14 12:07:46 -07:00
Guillaume Lessard
524b717944 [stdlib] work around autoclosure issues
- The move-only checker has issues with the existence of autoclosures.
- These `borrowing` accessors are within the purview of the move-only checker.
2025-04-14 10:48:42 -07:00
Guillaume Lessard
2d50c6cce9 Revert "[temporary] disable small-string support"
This reverts commit ea44ff9fc9.
2025-04-14 10:48:42 -07:00
Konrad `ktoso` Malawski
aaec5aa124 Merge pull request #80794 from ktoso/wip-parent-cancel-must-cancel-group
[Concurrency] Parent task cancellation must cancel task group itself.
2025-04-15 01:02:36 +09:00
Mykola Pokhylets
90cac69a4e Use concrete SwiftStdlib version 2025-04-14 16:58:43 +02:00