Commit Graph

73 Commits

Author SHA1 Message Date
Pavel Yaskevich
b2b1efd268 [Distributed] Decl: Add a new distributed-thunk bit
The flag is used to distinguish between regular functions/accessors
and synthesized distributed thunks.
2022-06-29 14:49:10 -07:00
Pavel Yaskevich
a016fae223 [TypeChecker] Distributed: Verify properties before attempting to synthesize a thunk 2022-06-29 14:49:10 -07:00
Pavel Yaskevich
d68961d407 [Distributed] Synthesize thunks for distributed computed properties 2022-06-29 14:49:10 -07:00
Pavel Yaskevich
c0479a5b0c [Distributed] NFC: remove a couple of unused variables from sythensis code 2022-06-29 14:49:10 -07:00
Pavel Yaskevich
5bdf94f346 [Distributed] Remove commented out code and print statements 2022-06-29 14:49:10 -07:00
Konrad `ktoso` Malawski
febfef97d4 [Distributed] Skeleton implementation of distributed computed properties 2022-06-29 14:49:04 -07:00
Konrad `ktoso` Malawski
6a2778645f Revert "Merge pull request #59481 from xedin/distributed-computed-properties"
This reverts commit 8125a85a8f, reversing
changes made to 728971c5b7.
2022-06-25 08:49:00 +09:00
Pavel Yaskevich
fa2e64c1fd [Distributed] Sema: Add a new distributed-thunk attribute
The attribute comes handy during solution application to
determine whether the call is using a distributed thunk.
2022-06-17 12:35:54 -07:00
Pavel Yaskevich
2078aa95d4 [Distributed] NFC: remove a couple of unused variables from sythensis code 2022-06-17 12:35:54 -07:00
Pavel Yaskevich
ce641063e0 [TypeChecker] Distributed: Verify properties before attempting to synthesize a thunk 2022-06-17 12:12:16 -07:00
Pavel Yaskevich
b963c6d20f [Distributed] Remove commented out code and print statements 2022-06-17 12:12:16 -07:00
Pavel Yaskevich
435aa65fbe [Distributed] Synthesize thunks for distributed computed properties 2022-06-17 12:12:16 -07:00
Konrad `ktoso` Malawski
5a5b7c007c towards distributed getters 2022-06-17 12:12:16 -07:00
Doug Gregor
74503f00ff Use the distributed thunk for non-distributed protocol requirements (#59513)
When a distributed-actor-isolated witness is provided for a
non-distributed-actor-isolated requirement, always hop to the
distributed thunk.

While here, mark distributed thunks as being `final`, to ensure that
we always statically call them vs. trying to retrieve them from the
vtable (since they aren't in the vtable).
2022-06-17 11:13:59 +09:00
Konrad `ktoso` Malawski
df462ea320 [Distributed] Be able to synthesize actorSystem prop from request (#59460)
* [Distributed] Be able to synthesize actorSystem prop from request

* [Distributed] remove duped lookupProp func, we have it in swift::

* Undo removal of method which was duped on 5.7 but is not on main
2022-06-16 09:53:37 +09:00
Konrad `ktoso` Malawski
1e489d6c0b [Distributed] Force the order of properties in AST 2022-05-08 18:20:50 +09:00
Konrad `ktoso` Malawski
e01bcc470f [Distributed] SILGen must consistently use prop get requests 2022-04-23 07:49:54 +09:00
Konrad `ktoso` Malawski
317fdd0740 [Distributed] Guard ID synthesis from synthesizing the property multiple times; e.g. during multi module builds 2022-04-22 23:18:16 +09:00
Konrad `ktoso` Malawski
7e176db932 [Distributed] Cache checking distributed func 2022-04-12 06:32:13 +09:00
Konrad `ktoso` Malawski
7332e4b3eb [Distributed] avoid double typechecking dist func decl 2022-03-29 09:02:43 +09:00
Konrad `ktoso` Malawski
fa5321877e [Distributed] Remove unused request, small cleanup 2022-03-25 21:53:10 +09:00
Konrad `ktoso` Malawski
ef10cd016a [Distributed] Fix generic returning distributed funcs 2022-03-25 16:19:08 +09:00
Kavon Farvardin
af683dc271 basic implementation of performing an init of the id after an assign of the actorSystem.
The resignID call within the initializer moved into DI, because an assignment to
the actorSystem, and thus initialization of the id, is no longer guaranteed to happen.
Thus, while we previously could model the resignation as a clean-up emitted on all
unwind paths in an initializer, now it's conditional, based on whether the id was
initialized. This is exactly what DI is designed to do, so we inject the resignation
call just before we call the identity's deinit.
2022-03-24 16:20:01 -07:00
Konrad `ktoso` Malawski
8d3e7d91c0 [Distributed] ResultHandler.onReturn must be ad-hoc because SerializationRequirement (#41916)
* [Distributed] Invoke handler.onReturn ad hoc via ast synthesized func

* reformat and cleanup

* remove unused var
2022-03-24 21:44:37 +09:00
Konrad `ktoso` Malawski
14fb9a03ff Merge pull request #41871 from xedin/fix-mark-protocol-issues-related-to-distributd
[Distributed] Strip marker protocols from distributed thunks and accessible functions
2022-03-18 21:08:04 +09:00
Pavel Yaskevich
c9a0295d6d [Distributed] Synthesis: Start using special mangling for distributed thunks 2022-03-17 14:02:42 -07:00
Konrad `ktoso` Malawski
5a5d1ba2e6 [Distributed] Implement RemoteCallArgument 2022-03-17 22:55:09 +09:00
Konrad `ktoso` Malawski
ea29723466 [Distributed] Add name parameter to recordArgument for better interop 2022-03-17 20:05:31 +09:00
Robert Widmann
b183ae13fa Merge pull request #41812 from CodaFi/imap
Stabilize VarDecl::isLet for ParamDecls
2022-03-15 15:51:14 -07:00
Konrad `ktoso` Malawski
14bbd27e83 [Distributed] remove a few warnings 2022-03-15 17:13:41 +09:00
Robert Widmann
539a5b3338 [NFC] Remove Redundant Calls to VarDecl::setIntroducer 2022-03-14 18:12:11 -07:00
Konrad `ktoso` Malawski
6d502fc042 [Distributed] Implicit Codable conformance for Dist Actors
[Witness] implement dump() on witness
2022-03-11 18:07:14 +09:00
Konrad `ktoso` Malawski
5ab8e0834d [Distributed] Reimplement distributed call thunks completely in AST (#41616)
* [Distributed] dist actor always has default executor (currently)

* [Distributed] extra test for missing makeEncoder

* [DistributedDecl] Add DistributedActorSystem to known SDK types

* [DistributedActor] ok progress on getting the system via witness

* [Distributed] allow hop-to `let any: any X` where X is DistActor

* [Distributed] AST: Add an accessor to determine whether type is distributed actor

- Classes have specialized method on their declarations
- Archetypes and existentials check their conformances for
  presence of `DistributedActor` protocol.

* [Distributed] AST: Account for distributed members declared in class extensions

`getConcreteReplacementForProtocolActorSystemType` should use `getSelfClassDecl`
otherwise it wouldn't be able to find actor if the member is declared in an extension.

* [Distributed] fix ad-hoc requirement checks for 'mutating'

[PreChecker] LookupDC might be null, so account for that

* [Distributed] Completed AST synthesis for dist thunk

* [Distributed][ASTDumper] print pretty distributed in right color in AST dumps

* wip on making the local/remote calls

* using the _local to mark the localCall as known local

* [Distributed] fix passing Never when not throwing

* fix lifetime of mangled string

* [Distributed] Implement recordGenericSubstitution

* [Distributed] Dont add .

* [Distributed] dont emit thunk when func broken

* [Distributed] fix tests; cleanups

* [Distributed] cleanup, move is... funcs to DistributedDecl

* [Distributed] Remove SILGen for distributed thunks, it is in Sema now!

* [Distributed]  no need to check stored props in protocols

* remote not used flag

* fix mangling test

* [Distributed] Synthesis: Don't re-use AST nodes for `decodeArgument` references

* [Distributed] Synthesis: Make sure that each thunk parameter has an internal name

* [Distributed/Synthesis] NFC: Add a comment regarding empty internal parameter names

* [Distributed] NFC: Adjust distributed thunk manglings in the accessor section test-cases

* cleanup

* [Distributed] NFC: Adjust distributed thunk manglings in the accessor thunk test-cases

* review follow ups

* xfail some linux tests for now so we can land the AST thunk

* Update distributed_actor_remote_functions.swift

Co-authored-by: Pavel Yaskevich <xedin@apache.org>
2022-03-10 23:58:23 +09:00
Konrad `ktoso` Malawski
005743c92c [Distributed] implement adhoc requirements properly for Encoder 2022-02-14 16:14:41 +09:00
Konrad `ktoso` Malawski
c7e3af84e4 [Distributed] Handle composite types in SerializationRequirement 2022-02-11 19:26:18 +09:00
Konrad `ktoso` Malawski
12932c7b3c [Distributed] Introduce DistributedDecl.h for greater reuse 2022-02-11 19:25:57 +09:00
Konrad `ktoso` Malawski
18db5af19d [Distributed] fix how we locate the system property; 2022-02-03 06:18:54 +09:00
Konrad `ktoso` Malawski
4bf2a92bda [Distributed] Remove @_dynamic replacements; impl remoteCall ad-hoc reqs
Squashed commit of the following:

commit e5a05ffe44
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 17:45:31 2022 +0900

    cleanup

commit 1f751cea5a
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 14:50:33 2022 +0900

    cleanups

commit c632f3215d
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 14:01:09 2022 +0900

    add test for generic from actor decl

commit 09b8bd50a7
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 14:00:58 2022 +0900

    cleanups

commit 31f4d0cffd
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 11:40:51 2022 +0900

    fix test

commit ad4db2fb6c
Merge: 97227edcca 07e2dfda56
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 26 23:31:41 2022 +0900

    Merge branch 'main' into wip-zzz

commit 97227edcca
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 26 21:01:25 2022 +0900

    remove @_dynamic methods!

    fix tests

commit 1c79344dbb
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 19 12:51:09 2022 +0900

    cleanup

    wip

    stuck

    fixed the stack cleanups

    cleanups pretty good now

    weird load

    rki

    works

    remove hack

    add take + throw + return

    fix test

    more tests fixed

    more tests fixed

    more tests fixed

commit 3ed494c175
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Tue Jan 18 21:09:28 2022 +0900

    stack issues in SIL verification

commit 5cf43a7f86
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Tue Jan 18 09:19:51 2022 +0900

    about to call the remoteCall

    goot to return, but missing subs

commit df8e47122a
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 13 14:09:49 2022 +0900

    [Distributed] Refactor Invocation to Decoder/Encoder

    getting there

    done-recording

    working on the string init

    stuck trying to get String initializer SILFunction

    created the remote call target

commit fc7bd62f32
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 23:01:14 2022 +0900

    [Distributed] Pass arguments from Invocation to HBuffer

commit cafc2cc058
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 22:08:47 2022 +0900

    works

commit a7d01837ff
Author: Pavel Yaskevich <pyaskevich@apple.com>
Date:   Tue Jan 11 15:48:58 2022 -0800

    [Distributed] Adjust interface of `swift_distributed_execute_target`

    Since this is a special function, `calleeContext` doesn't point to
    a direct parent but instead both parent context (uninitialized)
    and resume function are passed as last arguments which means that
    `callContext` has to act as an intermediate context in call to accessor.

commit c1f830be27
Author: Pavel Yaskevich <pyaskevich@apple.com>
Date:   Tue Jan 11 17:00:08 2022 -0800

    [Distributed] Drop optionality from result buffer in `_executeDistributedTarget`

    `RawPointer?` is lowered into a two arguments since it's a struct,
    to make it easy let's just allocate an empty pointer for `Void` result.

commit c83c2c37b6
Author: Pavel Yaskevich <pyaskevich@apple.com>
Date:   Tue Jan 11 17:02:45 2022 -0800

    [Distributed] NFC: Update _remoteCall test-case to check multiple different result types

commit 29e7cf50e4
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 21:32:37 2022 +0900

    wip

commit 9128ecc6f8
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 20:46:20 2022 +0900

    wip

commit a6b2a62a67
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 20:38:22 2022 +0900

    wip

commit 8b188f0d43
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 16:55:10 2022 +0900

    wip

commit 3796bec2b9
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 16:55:02 2022 +0900

    wip

commit 0ffc68b5ef
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Tue Jan 11 21:44:58 2022 +0900

    [Distributed] Implementing ad-hoc protocol requirements

commit 78862575e4
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 6 18:03:54 2022 +0900

    cleanup

commit 5f4ab89e25
Merge: 24a628e7c0 fdda6f2ee4
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 6 15:51:39 2022 +0900

    Merge branch 'main' into wip-impl-execute-swift

commit 24a628e7c0
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 6 15:33:21 2022 +0900

    wip

commit 69e7fed09d
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Dec 22 06:36:45 2021 +0900

    [Distributed] comment out distributed_actor_remoteCall for now

commit 376733a9f6
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Tue Dec 21 16:00:06 2021 +0900

    reimplement distributed get type info impls

commit 74ab47886a
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Dec 15 21:37:08 2021 +0900

    [Distributed] Implement func metadata and executeDistributedTarget

    dont expose new entrypoints

    able to get all the way to calling _execute
2022-01-27 17:51:43 +09:00
Konrad `ktoso` Malawski
cee89ec541 [Distributed] DistributedActorSystem renaming and redesign (#40387)
* [Distributed] towards DistributedActorSystem; synthesize the id earlier, since Identifiable.id

* Fix execute signature to what Pavel is working with

* funcs are ok in sil

* fixed lifetime of id in inits

* fix distributed_actor_deinit

* distributed_actor_local

* update more tests

fixing tests

fix TBD test

fix Serialization/distributed

fix irgen test

Fix null pointer crashes

* prevent issues with null func ptrs and fix Distributed prorotocol test

* fix deinit sil test
2021-12-13 11:29:25 +09:00
Konrad `ktoso` Malawski
f58b133a84 [Distributed] adjust conformance error messages a bit 2021-11-15 11:11:55 +09:00
Doug Gregor
214b1bd454 Add support for distributed functions in extensions of distributed actors.
Fix a few minor issues in the type checker and SILGen to properly cope with
distributed functions defined within extensions of distributed actors.
While here, centralize the logic that adds the "_remote_" function.

Fixes rdar://84325525.
2021-10-15 22:46:44 -07:00
Konrad `ktoso` Malawski
d4df6a3e65 [Distributed] Re-enable runtime tests 2021-10-05 06:31:49 +09:00
Doug Gregor
e0767e0e09 Stop relying on @_distributedActorIndependent anywhere.
This is an non-user-visible attribute that is semantically identical to
`nonisolated` except that it allows use in distributed actors. It is
only, and can only, be used for the two fields that distributed actors
have in both the local actor and in the remote proxy, "id" and
"actorTransport". So, special-case the "nonisolated" check for those
fields and stop using `@_distributedActorIndependent`.
2021-10-01 23:04:42 -07:00
Hamish Knight
47754822c7 [CodeSynthesis] Adopt ArgumentList
Most of this should be fairly mechanical, the
changes in PlaygroundTransform are a little more
involved though.
2021-09-01 18:40:26 +01:00
Konrad `ktoso` Malawski
d76690ef58 [Distributed] improve getting _remote funcs; cache gets 2021-08-30 21:50:49 +09:00
Konrad `ktoso` Malawski
c868bdd9f1 [Distributed] resolve synthesis via DerivedConformanceDistributedActor <3 2021-08-27 06:21:34 +09:00
Konrad `ktoso` Malawski
e408fa9722 [Distributed] unlock distributed_actor_deinit test again 2021-08-26 18:27:11 +09:00
Konrad `ktoso` Malawski
90d8816dee [Distributed] Move property synthesis to DerivedConformanceDistributedActor 2021-08-26 18:27:11 +09:00
Konrad `ktoso` Malawski
beaf8a3203 Revert "[Distributed] Ensure _remote funcs synthesized before dynamic replacement (#38974)"
This reverts commit fe4ba18bf7.
2021-08-23 13:23:39 +09:00
Konrad `ktoso` Malawski
fe4ba18bf7 [Distributed] Ensure _remote funcs synthesized before dynamic replacement (#38974)
* [Distributed] Ensure _remote funcs synthesized before dynamic replacement

* cleanup

* remove redundant synthesis cause
2021-08-23 11:40:12 +09:00