`PointerType::getElementType` has been removed entirely as part of the
opaque pointers migration. Update to `getPointerElementType` for now
until we've also migrated.
I wrote out this whole analysis of why different existential types
might have the same logical content, and then I turned around and
immediately uniqued existential shapes purely by logical content
rather than the (generalized) formal type. Oh well. At least it's
not too late to make ABI changes like this.
We now store a reference to a mangling of the generalized formal
type directly in the shape. This type alone is sufficient to unique
the shape:
- By the nature of the generalization algorithm, every type parameter
in the generalization signature should be mentioned in the
generalized formal type in a deterministic order.
- By the nature of the generalization algorithm, every other
requirement in the generalization signature should be implied
by the positions in which generalization type parameters appear
(e.g. because the formal type is C<T> & P, where C constrains
its type parameter for well-formedness).
- The requirement signature and type expression are extracted from
the existential type.
As a result, we no longer rely on computing a unique hash at
compile time.
Storing this separately from the requirement signature potentially
allows runtimes with general shape support to work with future
extensions to existential types even if they cannot demangle the
generalized formal type.
Storing the generalized formal type also allows us to easily and
reliably extract the formal type of the existential. Otherwise,
it's quite a heroic endeavor to match requirements back up with
primary associated types. Doing so would also only allows us to
extract *some* matching formal type, not necessarily the *right*
formal type. So there's some good synergy here.
If particular opaque type descriptor has multiple conditionally available
underlying types, emit a special type and witness reference accessors that
would be called at runtime to determine actual underlying type.
Avoid a reabstraction thunk every time an async let entry point is emitted,
by setting the context abstraction level while we emit the implicit closure.
Adjust some surrounding logic that breaks when we do this:
- When lowering a non-throwing function type against a throwing abstraction
pattern, include the error type in the lowered substituted type. Async
throwing and nonthrowing functions would require another thunk to convert
away the throwingness of the async context, which would defeat the purpose.
- Adjust the code in IRGen that pads the initial context size for `async let`
entry points so that it works when the entry point has not yet emitted, by
marking the async function pointer to be padded later if it isn't defined
yet.
On some Harvard architectures like WebAssembly that allow sliding code
and data address space offsets independently, it's impossible to make
direct relative reference to code from data because the relative offset
between them is not representable.
Use absolute function references instead of relative ones on such targets.
The main point of this change is to make sure that a shared function always has a body: both, in the optimizer pipeline and in the swiftmodule file.
This is important because the compiler always needs to emit code for a shared function. Shared functions cannot be referenced from outside the module.
In several corner cases we missed to maintain this invariant which resulted in unresolved-symbol linker errors.
As side-effect of this change we can drop the shared_external SIL linkage and the IsSerializable flag, which simplifies the serialization and linkage concept.
Make sure each class template specialization has its own metadata/value witness table. The issue here is that we got the name wrong. We need to use the mangled name so its different for each specialization.
The RequirementSignature generalizes the old ArrayRef<Requirement>
which stores the minimal requirements that a conforming type's
witnesses must satisfy, to also record the protocol typealiases
defined in the protocol.
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: 97227edcca07e2dfda56
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: 24a628e7c0fdda6f2ee4
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
Use the generic signature and substitution map of `OpaqueTypeDecl` to
emit type metadata for each opaque generic parameter (rather than only
the "underyling type") and each conformance requirement on an opaque
generic parameter (or dependent member thereof) that needs a witness
table.
Fix a bug where opaque result type metadata would miscount the number
of witness tables, because it counted conformance requirements without
accounting for `@objc` and marker protocols that don't have witness
tables.