Commit Graph

842 Commits

Author SHA1 Message Date
Ben Barham
bfd26d01d5 Add missing header in ObjectFile 2023-07-28 09:03:28 -07:00
Mike Ash
2d238bcea5 Merge pull request #67168 from mikeash/ptrauth-struct-context-descriptors
[Runtime][IRGen] Sign type context descriptor pointers.
2023-07-11 17:03:53 -04:00
Mike Ash
fe7e13bba5 [Runtime][IRGen] Sign type context descriptor pointers.
Ensure that context descriptor pointers are signed in the runtime by putting the ptrauth_struct attribute on the types.

We use the new __builtin_ptrauth_struct_key/disc to conditionally apply ptrauth_struct to TrailingObjects based on the signing of the base type, so that pointers to TrailingObjects get signed when used with a context descriptor pointer.

We add new runtime entrypoints that take signed pointers where appropriate, and have the compiler emit calls to the new entrypoints when targeting a sufficiently new OS.

rdar://111480914
2023-07-07 18:10:35 -04:00
Nate Chandler
86769af439 [NFC] Included header with referenced type. 2023-07-04 11:52:13 -07:00
Slava Pestov
8742b1a1e2 Runtime: Fix shape requirement handling in _checkGenericRequirements()
We would say the shape requirement was always satisfied since we
incorrectly checked the left-hand side type twice.
2023-06-21 15:03:53 -04:00
Slava Pestov
d1cb9307c9 Runtime: Support for conditional conformances with pack conformance requirements 2023-06-21 13:42:57 -04:00
Konrad `ktoso` Malawski
cad608eb81 [Discarding] Don't leak retained "first error" task when retaining it 2023-05-24 18:03:28 +02:00
Konrad `ktoso` Malawski
0586c14b60 [Concurrency] SerialExecutor.isSameExclusiveExecutionContext (#64604) 2023-03-28 15:56:28 +09:00
Konrad `ktoso` Malawski
e0877594da [Concurrency] Custom executors with move-only Job (#63569) 2023-03-18 14:02:43 +09:00
Konrad `ktoso` Malawski
41f99fc2ae [Executors][Distributed] custom executors for distributed actor (#64237)
* [Executors][Distributed] custom executors for distributed actor

* harden ordering guarantees of synthesised fields

* the issue was that a non-default actor must implement the is remote check differently

* NonDefaultDistributedActor to complete support and remote flag handling

* invoke nonDefaultDistributedActorInitialize when necessary in SILGen

* refactor inline assertion into method

* cleanup

* [Executors][Distributed] Update module version for NonDefaultDistributedActor

* Minor docs cleanup

* we solved those fixme's

* add mangling test for non-def-dist-actor
2023-03-15 23:42:55 +09:00
Konrad `ktoso` Malawski
ac0c3b75c6 [Concurrency] Freeze JobPriority, comment that Flags location is assumed (#64267) 2023-03-10 16:49:37 +09:00
Slava Pestov
17086962c3 Runtime: Add swift_getTypePackByMangledName() entry point
For now this has SWIFT_RUNTIME_LIBRARY_VISIBILITY, but in the
future we might want to make it public so that IRGen can use it
to build packs out of concrete types.
2023-03-09 01:54:51 -05:00
Slava Pestov
8731eb4394 Runtime: On-heap packs know their own length 2023-03-09 01:54:51 -05:00
Dario Rexin
5fe716577b [IRGen] Add layout strings for generic and resilient types (#64023)
* [IRGen] Add layout strings for generic and resilient types

rdar://105837048

* Add some corner cases

* Add flag to enable generic instantiation and some fixes

* Fix resilient types

* Fix metadata accessor function pointers in combined layout strings
2023-03-05 15:26:45 -08:00
Rokhini Prabhu
758b38f5b6 Fix warnings around initialization of union
Radar-Id: rdar://problem/106095698
2023-03-03 18:55:09 -08:00
Slava Pestov
66ed09e72b Runtime: Variadic generic type fixes 2023-03-03 02:24:01 -05:00
Slava Pestov
13020c479c Runtime: Remove unused method 2023-03-03 02:22:15 -05:00
Slava Pestov
32caa17b11 Runtime: Finish removing the 'extra argument' notion 2023-03-03 02:21:08 -05:00
Slava Pestov
6df72d606e Runtime: Move GenericContextDescriptorFlags and GenericPackKind to MetadataValues.h 2023-03-03 02:21:08 -05:00
Slava Pestov
8f022b9c36 Merge pull request #64008 from slavapestov/variadic-generic-types-metadata-cache-key
Runtime metadata cache key support for packs
2023-03-02 07:41:27 -05:00
Slava Pestov
86248e4b86 Runtime: Add a comment 2023-03-01 15:54:33 -05:00
Slava Pestov
2173db0a2a Merge pull request #63961 from slavapestov/variadic-generic-types-plumbing
Start working on runtime support for variadic generic types
2023-03-01 15:48:11 -05:00
Slava Pestov
ac199ac7c6 Runtime: Metadata cache key support for packs 2023-03-01 15:48:01 -05:00
Slava Pestov
864f5f0b5f Runtime: GenericParamPackShapeDescriptor => GenericPackShapeDescriptor
We also need to track witness table packs, and store an index here for
convenient access from the metadata caching key comparison logic.
2023-03-01 14:58:08 -05:00
Slava Pestov
5215406bb5 Runtime: Plumb through the pack shape stuff in more places 2023-03-01 12:14:58 -05:00
Slava Pestov
70c56dee0c Runtime: Fix incorrect numTrailingObjects() overload in TargetExtendedExistentialTypeShape 2023-03-01 12:14:58 -05:00
Slava Pestov
d5b75fe7d2 Runtime: Add GenericRequirementKind::SameShape and stub out cases 2023-02-28 17:33:06 -05:00
Slava Pestov
480a917fa2 Runtime: Sketch out metadata for variadic generic types 2023-02-28 17:33:06 -05:00
Rokhini Prabhu
8a930ca7c7 Merge pull request #63919 from apple/rokhinip/105932276-track-task-enqueued-executor
Track  the executor that a task is enqueued in, in dependency records
2023-02-28 13:43:33 -08:00
Rokhini Prabhu
7dd16da3b1 Merge pull request #63916 from apple/rokhinip/105930505-updateStatusRecord-and-friends
Improve functionality available for manipulating status records.
2023-02-28 13:42:36 -08:00
Slava Pestov
2d15d1c4d5 Runtime: Repurpose TargetGenericContextDescriptorHeader::NumExtraArguments for flags
For now, we have a single flag, which indicates that our generic
context has generic parameter packs.
2023-02-28 02:12:32 -05:00
Slava Pestov
d764167783 Runtime: Fix Windows build 2023-02-28 02:12:32 -05:00
Slava Pestov
560aad797e Runtime: Wrap pack pointers in a fancy TargetPackPointer template instead of twiddling the LSB by hand
This is more type safe in theory, but in practice it's just catnip for C++ fans.
2023-02-28 02:12:32 -05:00
Joe Groff
03a2393a6c IRGen: Track IsCopyable through type infos.
And use the new bit to ensure we don't try to lower move-only types
with common layout value witness surrogates. Take a bit in the runtime
value witness flags to represent types that are not copyable.
2023-02-27 18:52:50 -08:00
Rokhini Prabhu
534811c3dc When a task gets enqueued on an executor, start tracking which executor
it is enqueued on. This way, we have the necessary bookkeeping to
escalate an executor when a task that is enqueued, is escalated.

Radar-Id: rdar://problem/101864092
2023-02-25 17:01:03 -08:00
Rokhini Prabhu
d77306729b Improve TaskDependencyStatusRecord so that it can now track the executor
you are enqueued on

Radar-Id: rdar://problem/101864092
2023-02-25 16:58:02 -08:00
Rokhini Prabhu
d0aa55670a Provide an updateStatusRecord function which allows clients to update a
status record that is already registered with the task. Provide more
versatile removeStatusRecord functions and update clients to use them

Radar-Id: rdar://problem/101864092
2023-02-25 16:55:38 -08:00
Dario Rexin
a8d4d57f11 [IRGen] Generate compressed representation of value witnesses (#63813)
rdar://105837040

* WIP: Store layout string in type metadata

* WIP: More cases working

* WIP: Layout strings almost working

* Add layout string pointer to struct metadata

* Fetch bytecode layout strings from metadata in runtime

* More efficient bytecode layout

* Add support for interpreted generics in layout strings

* Layout string instantiation, take and more

* Remove duplicate information from layout strings

* Include size of previous object in next objects offset to reduce number of increments at runtime

* Add support for existentials

* Build type layout strings with StructBuilder to support target sizes and metadata pointers

* Add support for resilient types

* Properly cache layout strings in compiler

* Generic resilient types working

* Non-generic resilient types working

* Instantiate resilient type in layout when possible

* Fix a few issues around alignment and signing

* Disable generics, fix static alignment

* Fix MultiPayloadEnum size when no extra tag is necessary

* Fixes after rebase

* Cleanup

* Fix most tests

* Fix objcImplementattion and non-Darwin builds

* Fix BytecodeLayouts on non-Darwin

* Fix Linux build

* Fix sizes in linux tests

* Sign layout string pointers

* Use nullptr instead of debug value
2023-02-24 15:40:28 -08:00
Rokhini Prabhu
444f79e903 Merge pull request #63800 from apple/rokhinip/105634683-allow-addStatusRecord-to-other-task
Loosen requirement that task can only addStatusRecords to itself
2023-02-21 23:21:11 -08:00
Rokhini Prabhu
3c0f4f79fe Provide a convenience for addStatusRecord for clients who have already
done the load or who need the oldStatus information after adding the
status record.

Change some of the memory barrier logic since we can take advantage of
load-through HW address dependency.

Radar-Id: rdar://problem/105634683
2023-02-20 23:14:47 -08:00
Arnold Schwaighofer
1fa68ff82b Sign relative protocol witness tables
rdar://98583748
2023-02-20 12:29:13 -08:00
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
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
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
Arnold Schwaighofer
0f9bfac94b Remove undefined behavior in RelativeWitnessTable::getDescription() 2023-02-02 07:02:21 -08:00
Arnold Schwaighofer
770648f161 Initial runtime changes to support relative protocol witness tables 2023-01-31 10:59:37 -08:00
swift-ci
93a0a6d905 Merge pull request #62914 from ktoso/wip-task-group-twotypes
[Concurrency] DiscardingTaskGroup (rev 3)
2023-01-11 01:37:33 -08:00
Konrad `ktoso` Malawski
4b90cdbe5c Revert "cleanup"
This reverts commit 128e2b2099.
2023-01-11 13:03:22 +09:00