Commit Graph

13857 Commits

Author SHA1 Message Date
Rokhini Prabhu
babaa4bc2a Merge pull request #63019 from apple/rokhinip/88093007-priority-escalation-to-future
Provide support for live priority escalation in the task runtime
2023-02-11 11:33:41 -08:00
Alejandro Alonso
4ac3800dae Merge pull request #63593 from Azoy/reflection-lock
[Reflection] Use bytes in lock size
2023-02-11 10:25:16 -08:00
Egor Zhdan
7a12003d9d Merge pull request #63570 from apple/egorzhdan/nfc-cxx-iterators
[cxx-interop] NFC: move unsafe iterator types to a separate file
2023-02-11 14:06:04 +00:00
Alejandro Alonso
e24f46fab8 swap lock size to bytes 2023-02-10 20:43:21 -08:00
Alejandro Alonso
72f9c3ff12 Merge pull request #63535 from Azoy/reflection-fixes
[Reflection] Some bug fixes and other improvements
2023-02-10 12:17:24 -08:00
Alejandro Alonso
4edc24189b Fix Lock and mark a few tests unsupported 2023-02-10 09:29:17 -08:00
Egor Zhdan
71cc1bb6f1 [cxx-interop] NFC: move unsafe iterator types to a separate file
Since the unsafe iterator types are now used throughout the overlay, not just by `CxxSequence` and `CxxRandomAccessCollection`, let's move them to a separate file.
2023-02-10 11:57:57 +00:00
Egor Zhdan
b9cf9adbf6 Merge pull request #63497 from apple/egorzhdan/cxx-dictionary
[cxx-interop] Add `CxxDictionary` protocol for `std::map` ergonomics
2023-02-09 19:00:02 +00:00
Egor Zhdan
919eea7045 [cxx-interop] Add CxxDictionary protocol for std::map ergonomics
This adds a protocol to the C++ standard library overlay which will improve the ergonomics of `std::map` and `std::unordered_map` when used from Swift code.

As of now, `CxxDictionary` adds a subscript with an optional return type that mimics the subscript of `Swift.Dictionary`.

Similar to https://github.com/apple/swift/pull/63244.
2023-02-09 14:31:06 +00:00
Erik Eckstein
fc6f1d862e stdlib: make type comparison functions transparent
This is needed to be able to optimize them at Onone
2023-02-09 06:49:58 +01:00
Rokhini Prabhu
e052ccef31 Create the notion of a TaskDependencyStatusRecord which tracks what a
task is blocked on. We can use this information to then perform live
priority escalation to a task future.

Radar-Id: rdar://problem/88093007
2023-02-08 17:29:55 -08:00
Rokhini Prabhu
2e6baf279d Add support to addStatusRecord and removeStatusRecord so that the flags
field of an ActiveTaskStatus can also be modified while the
TaskStatusRecord list is being modified. Make the StatusRecordLock
reentrant.

Radar-Id: rdar://problem/88093007
2023-02-08 17:29:05 -08:00
Alejandro Alonso
38e9af48e4 Move some tests into our testsuite and various other fixes 2023-02-08 16:07:39 -08:00
Alejandro Alonso
aa6ef504fa Swap to an unprotected load to get better codegen 2023-02-08 16:06:21 -08:00
Alejandro Alonso
acb7f8efda Implement generic signature checking for PartialType.create(with:) (#63496)
Check other constraints

some more fixes
2023-02-08 10:10:58 -08:00
swift-ci
38c89bf212 Merge pull request #63491 from ktoso/wip-custom-executor-not-directly-on-actor
[CustomExecutors] unownedExecutor can be declared not directly on actor
2023-02-08 01:33:48 -08:00
Konrad `ktoso` Malawski
6b95ff7a25 [Concurrenncy] add internal way to assert we're on expected executor 2023-02-08 15:41:25 +09:00
Konrad `ktoso` Malawski
307ec5a378 [Concurrency] unownedExecutor can be declared not directly on actor 2023-02-08 13:38:02 +09:00
Rokhini Prabhu
4152834319 Don't destroy the task private storage until task is destroyed since
other threads/tasks which have a reference to the task might need to
access parts of it even if the task itself is completed.

Radar-Id: rdar://problem/88093007
2023-02-07 14:34:29 -08:00
Rokhini Prabhu
62852262b4 Remove dead code with task nearest deadline logic
Radar-Id: rdar://problem/88093007
2023-02-07 14:34:29 -08:00
Tim Kientzle
000664b967 Merge pull request #37912 from tbkka/tbkka/sr14635-overlyAggressiveSwiftValueBoxing-Part2
SR-14635: __SwiftValue should be transparent to casting
2023-02-07 14:12:04 -08:00
Evan Wilde
c67e22e6aa Merge pull request #63192 from etcwilde/ewilde/fix-backdeploy-compat56-crash
Fixes for the compat56 library
2023-02-07 10:22:50 -08:00
Egor Zhdan
7ec8054064 [cxx-interop] Change the hierarchy of CxxSequence protocols
This makes `CxxConvertibleToCollection` the base protocol in the hierarchy. Both `CxxSequence` and `CxxRandomAccessCollection` now inherit from `CxxConvertibleToCollection`.
2023-02-06 22:41:26 +00:00
Egor Zhdan
ad208223ad [cxx-interop] Avoid extra copy in CxxConvertibleToCollection
This improves the performance of iterating over a C++ container that is automatically conformed to `CxxConvertibleToCollection` protocol by removing the extra copy of the container.

This also tightens the requirements of `CxxConvertibleToCollection` by making `begin()` and `end()` non-mutating.
2023-02-06 16:04:28 +00:00
Arnold Schwaighofer
a960346886 Merge pull request #63412 from aschwaighofer/conditionalize_relative_pwt_entry_points
runtime: conditionally generate relative protocol witness tables entry points
2023-02-06 07:10:04 -08:00
Jonathan Grynspan
75dfb56b67 Clarify documentation for CommandLine.unsafeArgv re: the trailing nil. (#58484) (#63413) 2023-02-03 16:28:45 -05:00
Dario Rexin
961125320a [Concurrency] Make error logging more robust (#63383)
rdar://104967560
2023-02-03 11:48:47 -08:00
Arnold Schwaighofer
9e2308295d runtime: conditionally generate relative protocol witness tables entry points 2023-02-03 08:54:58 -08:00
Anthony Latsis
26dd150a39 Merge pull request #62670 from valeriyvan/incorrect-format 2023-02-03 10:05:52 +03:00
swift-ci
d77fa0b016 Merge pull request #63307 from lorentey/identical-string-check
[stdlib] Add String._isIdentical(to:)
2023-02-02 21:04:20 -08:00
Julian Lettner
5ad0331e55 Adopt malloc_type for allocating Swift objects from runtime (#63226)
Adopt malloc_type for allocating Swift objects from runtime

Radar-Id: rdar://98998492
2023-02-02 17:08:41 -08:00
Arnold Schwaighofer
6d0a09295c Merge pull request #63380 from aschwaighofer/remove_ub_in_relative_witness_table_description
Remove undefined behavior in RelativeWitnessTable::getDescription()
2023-02-02 12:43:32 -08:00
Tim Kientzle
3a849abe08 Flip the bincompat switches on the tightened casting semantics
so the new behavior is always enabled by default on all OSes.

(This may change depending on whether anyone is actually depending
on this behavior.)
2023-02-02 08:45:50 -08:00
Tim Kientzle
00f49a98d0 Provide a Bincompat override for the newly tightened casting semantics 2023-02-02 08:45:50 -08:00
Tim Kientzle
1846545da1 Use SwiftValue unpacking API correctly 2023-02-02 08:45:50 -08:00
Tim Kientzle
6127cc286c Fix calling convention for unboxFromSwiftValueWithType 2023-02-02 08:45:50 -08:00
Tim Kientzle
b91f29dfcb SR-14635: __SwiftValue should be transparent to casting
This PR changes the casting machinery to avoid casting `__SwiftValue` boxes
directly.  This forces the caster to instead unwrap `__SwiftValue` boxes and
retry with the inner content.  This results in boxed values being cast like the
inner content.

This fixes the behavior in situations like the following:
```
   let t = ...
   let s = t as Any as! AnyObject
   // `s` is now a `__SwiftValue` box
   // Next line should be true iff t conforms to NSCopying
   // Prior to this change, it always succeeds
   s is NSCopying
```

After this change, the above cast succeeds only if `t` actually
conforms to `NSCopying`.

This is a follow-on to PR#37683.
Related to: SR-14635
2023-02-02 08:45:50 -08:00
Egor Zhdan
e4cc22ffa9 Merge pull request #62992 from apple/egorzhdan/cxx-overlay-improvements
[cxx-interop] Various improvements to the stdlib overlay
2023-02-02 16:24:16 +00:00
Arnold Schwaighofer
0f9bfac94b Remove undefined behavior in RelativeWitnessTable::getDescription() 2023-02-02 07:02:21 -08:00
Arnold Schwaighofer
a96e5d06c6 Merge pull request #63350 from aschwaighofer/relative_protocol_witness_tables_test_config
Relative protocol witness tables test configuration
2023-02-02 06:48:20 -08:00
Egor Zhdan
ed70f30101 [cxx-interop] Make Element a primary associated type of CxxSequence etc 2023-02-02 12:48:17 +00:00
Egor Zhdan
b350f2b90f [cxx-interop] NFC: rename initializer parameter 2023-02-02 12:47:08 +00:00
Egor Zhdan
b98f71f2d4 [cxx-interop] Allow initializing SetAlgebra from a C++ container 2023-02-02 12:47:08 +00:00
Egor Zhdan
16d02db7aa [cxx-interop] Add internal function CxxConvertibleToCollection.forEach 2023-02-02 12:47:08 +00:00
Egor Zhdan
e3effcc184 [cxx-interop] Allow initializing RangeReplaceableCollection from a C++ container
This makes `Array.init<C: CxxConvertibleToCollection>(C)` more generic by using `RangeReplaceableCollection` protocol instead of concrete `Array` type.
2023-02-02 12:47:08 +00:00
Egor Zhdan
34c2b0e50d [cxx-interop] Make String.init(std.string) unlabeled
`Swift.String` can be initialized from any other type with an unlabeled initializer, which is either going to use the `CustomStringConvertible` conformance, or reflection. We would like clients to use the most suitable initializer, which is the one that takes `std.string` as a parameter. For instance, that allows us to attach a doc comment to the initializer.

This change makes the initializer unlabeled to make sure it is chosed by overload resolution when a client invokes `String(myCxxString)`.
2023-02-02 12:47:08 +00:00
Egor Zhdan
1745c98dd6 [cxx-interop] Make two overlay functions inlinable 2023-02-02 12:43:29 +00:00
Egor Zhdan
d0164ddfb5 Merge pull request #63245 from whiteio/whiteio/add-customstringconvertible-conformance-to-std-string
Make std::string conform to CustomStringConvertible
2023-02-02 12:40:28 +00:00
Valeriy Van
3e85cc4862 [runtime] Fix incorrect format specifier 2023-02-02 14:04:25 +02:00
Kavon Farvardin
ab130883a3 Initial ban of move-only types from being used generically
Since values of generic type are currently assumed to always
support copying, we need to prevent move-only types from
being substituted for generic type parameters.

This approach leans on a `_Copyable` marker protocol to which
all generic type parameters implicitly must conform.

A few other changes in this initial implementation:

- Now every concrete type that can conform to Copyable will do so. This fixes issues with conforming to a protocol that requires Copyable.
- Narrowly ban writing a concrete type `[T]` when `T` is move-only.
2023-02-01 23:38:28 -08:00