Commit Graph

19016 Commits

Author SHA1 Message Date
Doug Gregor
82ebc54857 Merge pull request #70520 from DougGregor/no-opaque-parameters-in-stdlib
Don't use opaque parameters in the standard library
2023-12-18 10:33:25 -08:00
Doug Gregor
3b4e37e5fe Don't use opaque parameters in the standard library
The SIL printer is printing opaque parameters as <anonymous>, which
breaks the SIL parser. Stop using opaque parameters in the standard
library for the moment to unbreak SIL parsing of the standard library.
2023-12-18 10:14:57 -08:00
Doug Gregor
6536f57ab5 Merge pull request #70516 from DougGregor/typed-throw-try-bang
[Typed throws] Terminate with an error message for typed try! failures.
2023-12-17 02:41:48 -08:00
Doug Gregor
d740965753 [Typed throws] Terminate with an error message for typed try! failures. 2023-12-16 23:58:51 -08:00
Kavon Farvardin
b43f861827 [NCGenerics] delete _Copyable from stdlib
resolves rdar://115793371
2023-12-16 11:17:31 -08:00
Daniel Rodríguez Troitiño
a7a8ba1108 [CMake] Add dep in add_swift_target_library_single from install component (#70490)
While `add_swift_target_library` has code to add a dependency from the
install component to the target, similar code was missing from
`add_swift_target_library_single`, probably because
`add_swift_target_library` calls `add_swift_target_library_single`, so
the extra dependency is not necessary.

However, there's usages of `add_swift_target_library_single` outside
`add_swift_target_library` which were creating targets that were not
dependencies of their install components. Some of  those cases are the
embedded stdlib targets, which are installed as part of the `stdlib`
component.

It normally does not matter when using `build-script`, because those
targets are build as part of `all`, but it does matter if one is using
CMake/Ninja directly or in cases where `build-script` is not used.
Trying to use targets like `install-stdlib` will had missed building the
embedded stdlib, and failed the installation.
2023-12-16 01:00:56 -08:00
Ben Barham
406d5337dc Merge pull request #69538 from finagolfin/android
[android] Add more changes to build the compiler
2023-12-15 10:57:21 -08:00
nate-chandler
680c737ddb Merge pull request #64789 from nate-chandler/more-move-values
[SILGen] Used move_value for more lexical values.
2023-12-15 07:07:54 -08:00
Doug Gregor
0fbbc6ae65 [SE-0392] Back-deploy assertIsolation/assumeIsolation
The assertIsolation/assumeIsolation operations on actors are
back-deployable back to the introduction of concurrency. Do so.

Resolves rdar://111880539
2023-12-14 15:13:46 -08:00
Nate Chandler
10ce0c6b16 [SILGen] Used move_value for lexical lets.
Instead of using begin_borrow [lexical] + copy_value.
2023-12-14 13:35:26 -08:00
Alejandro Alonso
2cbe75d49d Merge pull request #70406 from AtariDreams/buffer
Prevent modulo in places where we can check the length
2023-12-14 09:08:25 -08:00
Rose
9998161e97 Prevent modulo in places where we can check the length
NFC.

We know maxLength must be positive and non-zero, and therefore, i += 1 will be the next index until we reach maxLength, in which case the result is 0. Rather than perform a modulo, which requires division, every time, we can just reset i when it reaches the end of the buffer.
2023-12-13 19:13:54 -05:00
Rokhini Prabhu
ed8ed32dba Clean up Concurrency build system so that all the logic around choice of
which executor for which type of setting, is consolidated and we have a
single knob we use to determine when to use dispatch as our global
executor.

Radar-Id: rdar://problem/119416196
2023-12-13 16:09:51 -08:00
Alastair Houghton
7689c29e08 [Runtime] Fix call site for malloc_type_posix_memalign.
Seems I missed off the type ID.  Oops.

rdar://119137861
2023-12-13 20:52:51 +00:00
Kuba (Brecka) Mracek
4f592f0022 Merge pull request #70407 from kubamracek/embedded-placeholders
[embedded] Fix editor placeholders by adding a StaticString variant of _undefined
2023-12-13 09:00:10 -08:00
eeckstein
295b6accef Merge pull request #62226 from eeckstein/read-only-static-arrays
IRGen: fix and re-enable static read-only arrays
2023-12-13 16:43:58 +01:00
Alastair Houghton
46d37d2a15 Merge pull request #70366 from al45tair/eng/PR-119137861
[Runtime] Use malloc_type_posix_memalign().
2023-12-13 12:43:04 +00:00
Erik Eckstein
e4ea7491a2 IRGen: fix and re-enable static read-only arrays
Static read-only arrays didn't work when passed to ObjectiveC as NSArray.
The storage class of static read-only arrays doesn't carry information about the Element type.
The new `__SwiftDeferredStaticNSArray` is generic over the element type and doesn't have to rely on the element type information of the array storage.

rdar://94185998
2023-12-13 11:45:01 +01:00
Dave Lee
a56c89f97e [Debug] Conditional _DebugDescription macro declaration (#70351)
Make `_DebugDescription` macro conditional upon macro availability in the build.

The `Macros` feature is based on the value of `SWIFT_BUILD_SWIFT_SYNTAX`.

See https://github.com/apple/swift/pull/69626#issuecomment-1848221971
2023-12-12 15:19:49 -08:00
Kuba Mracek
8ee33d2260 [embedded] Use #if instead of unavailability for _undefined 2023-12-12 13:06:16 -08:00
Ian Anderson
35eb5cb7f4 Merge pull request #69707 from ian-twilightcoder/builtin-flag
[ClangImporter] Swift needs to pass `-Xclang -fbuiltin-headers-in-system-modules` for its module maps that group cstd headers
2023-12-12 11:35:17 -08:00
Kuba Mracek
996f51e3be [embedded] Fix editor placeholders by adding a StaticString variant of _undefined 2023-12-12 11:04:14 -08:00
Kuba (Brecka) Mracek
b9f7acb8b5 Merge pull request #70309 from kubamracek/embedded-dfe
[embedded] Run DeadFunctionAndGlobalElimination after MandatoryPerformanceOptimizations
2023-12-12 10:21:11 -08:00
Konrad `ktoso` Malawski
828f589be4 Initial Task Executor implementation Task(on:), addTask(on:) etc. (#68793)
Co-authored-by: John McCall <rjmccall@gmail.com>
2023-12-12 17:14:24 +09:00
Kuba (Brecka) Mracek
b8b68f0d2e Merge pull request #70352 from kubamracek/embedded-install-concurrency
[embedded] Make sure to install the embedded Concurrency .a libraries into the toolchain
2023-12-11 08:55:38 -08:00
Alastair Houghton
9fc61ddb8b [Runtime] Use malloc_type_posix_memalign().
We can't use `malloc_type_aligned_alloc()` because `aligned_alloc()` requires
that `size` be a multiple of `alignment`, which isn't something we expect here.

rdar://119137861
2023-12-11 12:21:02 +00:00
eeckstein
484fc77a8c Merge pull request #70301 from eeckstein/fixed-array
Add experimental support for fixed arrays
2023-12-11 09:36:29 +01:00
Alastair Houghton
665eb4f85b Merge pull request #70320 from al45tair/eng/PR-116593541
[Backtracing] Improve warning message about thread suspension failure.
2023-12-11 08:24:52 +00:00
Slava Pestov
026d3f0078 Merge pull request #70311 from slavapestov/type-witness-system-inference-stdlib
Get the standard library to build with -enable-experimental-associated-type-inference
2023-12-10 17:50:33 -05:00
Slava Pestov
4bf0cc2490 Always build the stdlib with -enable-experimental-associated-type-inference 2023-12-10 11:21:35 -05:00
Kavon Farvardin
a4a6c69e97 Merge pull request #70277 from kavon/inverse-escapable
[NCGenerics] add `~Escapable`
2023-12-10 05:42:24 -08:00
Kavon Farvardin
e99ce1cc5d [NCGenerics] add ~Escapable
Basic implementation of `~Escapable` in the type system.

rdar://119216918
2023-12-10 01:25:43 -08:00
Kuba Mracek
bb1ba7c95c [embedded] Run DeadFunctionAndGlobalElimination after MandatoryPerformanceOptimizations 2023-12-09 22:39:55 -08:00
Erik Eckstein
43c4fce773 stdlib: make Array.count an array semantic function
So far the semantic annotation was just added to the internal `_getCount` function.
But for FixedArray it is also required to add the `@_semantics("array.get_count")` to the public API.
2023-12-09 18:49:58 +01:00
Erik Eckstein
dd9ce40ba1 add the allocVector builtin 2023-12-09 18:49:57 +01:00
Ian Anderson
94e860e795 [ClangImporter] Swift needs to pass -Xclang -fbuiltin-headers-in-system-modules for its module maps that group cstd headers
Swift has some module maps it overlays on Linux and Windows that groups all of the C standard library headers into a single module. This doesn’t allow clang and C++ headers to layer properly with the OS/SDK modules. clang will set -fbuiltin-headers-in-system-modules as necessary for Apple SDKs, but Swift will need to pass that flag itself when required by its module maps.
2023-12-08 22:33:12 -08:00
Kuba Mracek
9581e92589 [embedded] Make sure to install the embedded Concurrency .a libraries into the toolchain 2023-12-08 21:38:33 -08:00
Rokhini Prabhu
ffd1ad2286 Convert use of std::mutex in task groups to use Mutex from threading package
Radar-Id: rdar://problem/119415891
2023-12-08 20:17:52 -08:00
Dave Lee
ad585b3195 [Debug] Add _DebugDescription macro (#69626)
Implementation of the DebugDescription macro pitched on the forums: 
https://forums.swift.org/t/pitch-debug-description-macro/67711. In this initial commit, 
the macro is named `_DebugDescription` to indicate it's internal use at this time, 
pending Swift Evolution.

rdar://115180949
2023-12-08 15:19:16 -08:00
Alastair Houghton
c9abb0bc61 [Backtracing] Improve warning message about thread suspension failure.
In the event that the backtracer fails to suspend a thread, it emits a
warning message.  Unfortunately the exact meaning of this message isn't
obvious and it doesn't make clear that it's a secondary problem (that is,
you've already crashed at this point).

Update the message to make things clearer.

rdar://116593541
2023-12-08 13:53:38 +00:00
Saleem Abdulrasool
43d8c37f81 Merge pull request #70235 from compnerd/deprecated
SwiftShims: silence a deprecation warning on Windows
2023-12-07 09:55:27 -08:00
Mike Ash
95eaeafa15 Merge pull request #70284 from kubamracek/embedded-darwin-bad
[embedded] Disable building Darwin as embedded, unbreak the build and CI
2023-12-06 20:27:15 -05:00
Kuba Mracek
2796e150fe [embedded] Disable building Darwin as embedded, unbreak the build and CI 2023-12-06 17:11:23 -08:00
Stephen Canon
d66f233839 Add concrete overload for != on all stdlib integer types. (#70043)
* Add concrete overload for  on all stdlib integer types.

* Add very basic tests for type inference of comparands.

* Add a comment explaining why these overloads are present.
2023-12-06 16:40:16 -05:00
nate-chandler
684739e3ec Merge pull request #70248 from nate-chandler/rdar96956089
[stdlib] BitwiseCopyable loadUnaligned overloads.
2023-12-06 12:13:38 -08:00
Eric Miotto
4ab800e1a4 CMake: allow to build embedded stdlib in a standalone preset (#70238)
This would be needed to support Apple internal configurations.

Addresses rdar://119192035
2023-12-06 08:35:02 -08:00
Nate Chandler
b7f5171b83 [stdlib] BitwiseCopyable loadUnaligned overloads.
The new overloads will make use the new BitwiseCopyableArchetypeTypeInfo
to avoid the extra copy that is currently done.
2023-12-05 17:21:05 -08:00
Daniel Rodríguez Troitiño
f0594a4190 [embedded] Make embedded target triples conditional on LLVM support (#70218)
LLVM might not be build with support for all architectures to save time.
The changes in this commit check the value of LLVM_TARGETS_TO_BUILD
provided by LLVMConfig.cmake to add or skip the different embedded
targets if LLVM happens to not build with support for that target.

While x86_64 and ARM/AArch64 are very common in `LLVM_TARGETS_TO_BUILD`,
targets like RISCV are more specialized and might not be always enabled.

This is not a problem for builds using the `build-script` because of the
changes introduced in #70057, but it is still a problem for other builds
that do not use `build-script`. This solution should work for any build.
2023-12-05 12:39:04 -08:00
Saleem Abdulrasool
6f9a28921a SwiftShims: silence a deprecation warning on Windows
Silence a deprecation warning on Windows by using the Microsoft
extension.
2023-12-05 07:51:20 -08:00
Egor Zhdan
c39c8da4db [cxx-interop] Use APINotes to apply import_owned attr to std::string and std::vector
This removes a special case in the compiler for these types, and applies the `import_owned` attribute to all instantiations of `vector` and `basic_string` via API Notes.
2023-12-04 19:54:17 +00:00