Commit Graph

21434 Commits

Author SHA1 Message Date
Egor Zhdan
9fe13ece49 [cxx-interop] Allow initializing std::map from Swift Dictionary
This adds initializers for `std::map` and `std::unordered_map` that take a Swift dictionary as a single parameter.

rdar://133691563
2024-08-14 13:32:30 +01:00
Egor Zhdan
915b5312ba Merge pull request #75662 from ADKaster/disable-tbb-execution-on-newer-libstdcxx
[cxx-interop] Disable c++ execution header with libstdcxx versions >= 11
2024-08-14 13:15:19 +01:00
Evan Wilde
cae88d3344 Fix add_swift_target_library for the static SDK
add_swift_target_library was missing pieces for passing sources and
flags to the static SDK build. As a result, the static SDK was missing
pieces (specifically Mutex).

Also adding the Musl import to the Linux Mutex implementation.
2024-08-13 15:59:31 -07:00
Mykola Pokhylets
6151731d26 Updated implementation to handle SWIFT_CONCURRENCY_ACTORS_AS_LOCKS 2024-08-13 12:30:21 +02:00
Crazy凡
cbaef38968 [c++-interop] Improve performance of creating a C++ std::string from a contiguous UTF-8 Swift.String 2024-08-13 13:58:56 +08:00
Alex Lorenz
d35af38ce4 Merge pull request #75721 from hyp/eng/75691
[windows] split out complex module from ucrt module, to allow new swi…
2024-08-12 08:30:47 -07:00
Yuta Saito
90799cfdf7 Revert "[wasm] Fix ambiguous errno error when importing WASILibc module"
This reverts commit 164ec0adaa.
2024-08-10 13:29:48 +00:00
Alastair Houghton
a95b69cdb8 Merge pull request #75709 from al45tair/eng/PR-132710670
[Build][Backtracing] Make sure the target for OS X is at least 10.14.4.
2024-08-09 18:48:21 +01:00
Guillaume Lessard
79bf5d51ca Merge pull request #75782 from glessard/rdar133343460-incorrectly-sendable
[stdlib] fix sendability of ManagedBufferPointer
2024-08-08 16:28:19 -07:00
Kuba (Brecka) Mracek
f9631e121c Merge pull request #75768 from kubamracek/embedded-string-switch
[embedded] Add StringSwitch.swift to the embedded stdlib
2024-08-08 15:28:22 -07:00
Guillaume Lessard
f9eb3223fe [stdlib] mark ManagedBufferPointer non-Sendable 2024-08-08 11:26:30 -07:00
Alex Martini
906efcbe93 Merge pull request #75625 from amartini51/param_132944086
Match parameter names in documentation to declaration

Fixes: rdar://132944086
2024-08-08 09:22:11 -07:00
Kuba Mracek
3c9f1ebb55 [embedded] Add StringSwitch.swift to the embedded stdlib 2024-08-07 21:37:01 -07:00
Alex Martini
d0d15167d3 Add missing "parameters" directive
Co-authored-by: Ben Rimmington <me@benrimmington.com>
2024-08-07 11:07:54 -07:00
Yuta Saito
164ec0adaa [wasm] Fix ambiguous errno error when importing WASILibc module
This commit fixes an ambiguous `errno` error when importing WASILibc
module and SwiftWASILibc Clang module.

The error is caused by the fact that we define a shim for `errno` in
`Platform.swift` file, but wasi-libc defines `errno` in a way
ClangImporter can understand. We don't need to define shims for it,
otherwise we get two candidates for `errno` identifier.
2024-08-07 04:28:29 +00:00
Guillaume Lessard
29a4b8abff Merge pull request #75622 from glessard/rdar132941798-aEIC-private-consternation 2024-08-06 20:31:04 -07:00
Richard L Zarth III
e2c9541537 Allow TaskGroup's ChildTaskResult Type To Be Inferred (#74517)
Co-authored-by: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
2024-08-07 11:11:33 +09:00
Alex Lorenz
b62eafd866 [windows] split out complex module from ucrt module, to allow new swift-foundation to import ucrt when C++ interoperability is enabled
Fixes https://github.com/swiftlang/swift/issues/75691
2024-08-06 11:33:03 -07:00
Alastair Houghton
02f87e3d8e [Build][Backtracing] Make sure the deployment target for OS X is over 10.14.4.
We need to make sure that we build swift-backtrace with a deployment target
newer than 10.14.4 in order that we get linked against
`/usr/lib/swift/libswiftCore.dylib` rather than using an `@rpath`-based
path.

If we fail to do that, dyld becomes confused and we end up crashing with
weird errors about missing method implementations on `Swift.__StringStorage`.

To make this work, add support for `DEPLOYMENT_VERSION_*` in the
`add_swift_target_executable()` CMake function.  And since I spotted a bug
in it, fix the existing support in `add_swift_target_library()` while I'm
there.

rdar://132710670
2024-08-06 15:03:01 +01:00
Andrew Kaster
65cd7e4ea3 fix centos7 build (hopefully) 2024-08-05 09:06:39 -06:00
Mike Ash
66303f6140 Merge pull request #75643 from mikeash/mangled-name-verification-null-check
[Runtime] Check for NULL demangling when verifying mangled name roundtrips.
2024-08-05 10:39:09 -04:00
Yuta Saito
34588acedb Merge pull request #75671 from kateinoigakukun/yt/add-alias-errno-const
[wasm] Add shims for aliased errno constants in WASILibc overlay
2024-08-05 18:45:16 +09:00
Yuta Saito
650e90a2b0 [Runtime] Repair build of getenv mode in EnvironmentVariables.cpp
Follow-up fix to 4b3a197dc2
2024-08-03 08:36:36 +00:00
Yuta Saito
65f9badbcd [wasm] Add shims for aliased errno constants in WASILibc overlay
We provide shims for errno constants in WASILibc overlay since
wasi-libc's errno.h defines those constants in a way that cannot be
imported by ClangImporter.
However, some errno constants are aliased in wasi-libc, and we didn't
provided shims for them. This patch adds those missing shims.
2024-08-03 07:51:49 +00:00
Andrew Kaster
fd41d2601f [cxx-interop] Disable c++ execution header with libstdcxx versions >= 11
Workaround for https://github.com/swiftlang/swift/issues/75661
2024-08-02 17:04:20 -06:00
Allan Shortlidge
65bf2d04cd Merge pull request #75646 from tshortli/zippered-os-version-at-least-or-variant-at-least
stdlib: Add runtime support for zippered availability checks
2024-08-02 16:03:49 -07:00
Mike Ash
5e15d8a6f1 Merge pull request #75376 from mikeash/libprespecialize-descriptor-map
[Runtime] Support type descriptor map in LibPrespecialized.
2024-08-02 16:25:11 -04:00
Allan Shortlidge
41fad31e64 stdlib: Add runtime support for zippered availability checks.
Now that `__isPlatformOrVariantPlatformVersionAtLeast()` is available in
upstream LLVM, the implementation of the zippered variant of the OS version
check utility can use the `targetOSVersionOrVariantOSVersionAtLeast` builtin
safely.

Resolves rdar://103960437.
2024-08-02 10:25:40 -07:00
Mike Ash
1d2ea6f949 [Runtime] Check for NULL demangling when verifying mangled name roundtrips.
_swift_buildDemanglingForMetadata can fail, so check for NULL and warn about it instead of crashing.
2024-08-02 11:26:57 -04:00
Konrad `ktoso` Malawski
f300164acc [Concurrency] Improve crash message on continuation misuse (#75613) 2024-08-02 00:46:45 -07:00
Ben Rimmington
28e1fdf919 [stdlib] Remove _FixedArray16 from GroupInfo.json (#75631) 2024-08-01 19:54:09 -07:00
Guillaume Lessard
dd854faad1 [stdlib] use temporary rebinding as appropriate 2024-08-01 16:26:34 -07:00
Guillaume Lessard
a77b8cea70 [stdlib] alter inconsistent declarations
`private` declarations should never be allowed to carry the `@_alwaysEmitIntoClient` attribute. This has been allowed by mistake for a while, but newer compilers should make this an error.
2024-08-01 16:26:34 -07:00
Mike Ash
4b3a197dc2 [Runtime] Support type descriptor map in LibPrespecialized.
The descriptor map is keyed by a simplified mangling that canonicalizes the differences that we accept in _contextDescriptorMatchesMangling, such as the ability to specify any kind of type with an OtherNominalType node.

This simplified mangling is not necessarily unique, but we use _contextDescriptorMatchesMangling for the final equality checking when looking up entries in the map, so occasional collisions are acceptable and get resolved when probing the table.

The table is meant to be comprehensive, so it includes all descriptors that can be looked up by name, and a negative result means the descriptor does not exist in the shared cache. We add a flag to the options that can mark it as non-definitive in case we ever need to degrade this, and fall back to a full search after a negative result.

The map encompasses the entire shared cache but we need to reject lookups for types in images that aren't loaded. The map includes an image index which allows us to cheaply query whether a given descriptor is in a loaded image or not, so we can ignore ones which are not.

TypeMetadataPrivateState now has a separate sections array for sections within the shared cache. _searchTypeMetadataRecords consults the map first. If no result is found in the map and the map is marked as comprehensive, then only the sections outside the shared cache need to be scanned.

Replace the SWIFT_DEBUG_ENABLE_LIB_PRESPECIALIZED environment variable with one specifically for metadata and one for descriptor lookup so they can be controlled independently. Also add SWIFT_DEBUG_VALIDATE_LIB_PRESPECIALIZED_DESCRIPTOR_LOOKUP which consults the map and does the full scan, and ensures they produce the same result, for debugging purposes.

Enhance the environment variable code to track whether a variable was set at all. This allows SWIFT_DEBUG_ENABLE_LIB_PRESPECIALIZED to override the default in either direction.

Remove the disablePrespecializedMetadata global and instead modify the mapConfiguration to disable prespecialized metadata when an image is loaded that overrides one in the shared cache.

rdar://113059233
2024-08-01 18:43:15 -04:00
Tim Kientzle
9debfbc08c Merge pull request #75607 from tbkka/tbkka-remotemirror-unsafecontinuation
[RemoteMirror] Handle UnsafeContinuation
2024-08-01 13:46:09 -07:00
Eric Miotto
5c31c10dcf Merge pull request #75566 from edymtt/edymtt/promote-concurrency-stringprocessing-to-core-libraries
Promote _Concurrency and StringProcessing to core subset of the stdlib
2024-08-01 11:06:41 -07:00
Alex Martini
63323e04a9 Match parameter names in docs to the declaration 2024-08-01 11:01:02 -07:00
Alex Martini
70536cd56a Match parameter name in docs to declaration 2024-08-01 10:28:26 -07:00
Tim Kientzle
4bad739ad4 Remove FIXME since this is actually right! 2024-08-01 07:27:43 -07:00
Tim Kientzle
9e1dcd6c9f [RemoteMirror] Handle UnsafeContinuation
UnsafeContinuations can be stored in variables or properties,
so it's important for RemoteMirror to be able to at least minimally
recognize them.

This just treats an UnsafeContinuation as a refcounted pointer.
Which might be "good enough" for now.

Working towards rdar://110351406
2024-07-31 18:15:27 -07:00
Tim Kientzle
725dc3c011 Merge pull request #75587 from tbkka/tbkka-remotemirror-generic-depth
[RemoteMirror] Fix generic depth calculation
2024-07-31 17:56:27 -07:00
Tim Kientzle
039e78d31a [RemoteMirror] Fix generic depth calculation
The "generic depth" is used to match up generic type variables.
For example:
```
struct Foo<T> { // `T` at generic depth 0
  struct Bar {
    struct Baz<U> { // 'U' at generic depth 1
      ...
}}}
```

Note in the above that `Bar` is not counted in the
generic depth.  The previous logic did count `Bar` in
the generic depth calculation, leading to mismatches
when trying to associate references to generic variables.

This adds a new test with cases like the above and of course
corrects the calculation.

Resolves rdar://127450037
2024-07-31 07:08:08 -07:00
Karoy Lorentey
56bcc8dc83 [stdlib] Remove _FixedArray16
We are no longer using this internal type; remove it from the stdlib.
2024-07-30 16:14:05 -07:00
Philippe Hausler
5b20f7d10f [Embedded] Correct the signature of free to avoid using Builtin module for potential client implementations (#75496) 2024-07-30 11:59:24 -07:00
Kavon Farvardin
972373b129 NCGenerics: begin process of removing compat hack
The reverse-condfail workaround needs to be removed, and this is the
first step to allowing the stdlib to build with conditionally escapable
types.

resolves rdar://132453000
2024-07-29 17:27:17 -07:00
Dave Lee
abe697ff72 [Debug] Rename DebugDescription fallback property to lldbDescription (#75305)
From feedback, replace the name `_debugDescription`, which was confusing because of the 
underscore, with `lldbDescription`. This new name also indicates that this property may 
contain [LLDB Summary Strings](https://lldb.llvm.org/use/variable.html#summary-strings).
2024-07-29 11:10:43 -07:00
Eric Miotto
5512833d18 Promote _Concurrency and StringProcessing to core subset of the stdlib
This is needed to support Apple internal configurations.

Addresses rdar://125909114
2024-07-29 08:58:04 -07:00
Alex Lorenz
d9b7994cfe Merge pull request #75494 from hyp/eng/posix_filesystem_fix
[android] fix path and cmake local build target tracking for posix_fi…
2024-07-29 08:17:10 -07:00
Xiaodi Wu
ea1baed83a Address 128-bit integer comparison type inference issue (#75529) 2024-07-28 21:38:38 -07:00
Ben Rimmington
66e6c009eb [stdlib] Move unused functions to LegacyABI.swift (#75462) 2024-07-27 04:45:31 +01:00