Commit Graph

1311 Commits

Author SHA1 Message Date
Pavel Yaskevich
498721c9df [TypeChecker] SE-360: Add support for if #unavailable
Lift a temporary restriction and make `if #available`
and `if #unavailable` behave consistently.
2022-07-20 13:26:43 -07:00
Pavel Yaskevich
225341e3d2 [Decl] Start storing and serializing "unavailability" bit per condition 2022-07-20 13:26:43 -07:00
swift-ci
a5e7bd7dd3 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-20 07:53:55 -07:00
Egor Zhdan
d85d2e9e75 [cxx-interop] Synthesize conformances to UnsafeCxxInputIterator
This teaches ClangImporter to synthesize conformances of C++ iterator types to `UnsafeCxxInputIterator` protocol from the `Cxx` module.

We consider a C++ type to be an iterator if it defines a subtype (usually a typedef or a using decl) called `iterator_category` that inherits from `std::input_iterator_tag`.

rdar://96235368
2022-07-20 11:44:25 +01:00
swift-ci
16a8ce5251 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-01 12:13:40 -07:00
John McCall
175f74d38f Implement symbolic demangling for extended existential metadata
Fixes rdar://96268090.
2022-07-01 11:21:53 -04:00
swift-ci
aadd41f994 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-21 22:34:35 -07:00
Konrad `ktoso` Malawski
53168355f0 [Distributed] Explicitly ban a class extending AnyActor as well 2022-06-22 09:21:55 +09:00
swift-ci
55000f53be Merge remote-tracking branch 'origin/main' into rebranch 2022-06-17 10:15:14 -07:00
zoecarver
bdc37c9b46 [nfc][cxx-interop] Create and use custom metadata builder, visitor for foreign reference types. 2022-06-16 15:14:47 -07:00
zoecarver
81181a0359 [nfc][cxx-interop] Add a few comments and asserts 2022-06-16 15:02:41 -07:00
zoecarver
f972f664d3 [cxx-interop] Runtime support for foreign reference types. 2022-06-14 12:18:05 -07:00
Ben Barham
b521dc7c42 [next] Handle new ObjectFormatTypes
LLVM has added two new object format types, add them as unhandled for
now.
2022-05-05 16:25:10 -07:00
Ben Barham
04035b43b7 [next] Temporarily use getPointerElementType
`PointerType::getElementType` has been removed entirely as part of the
opaque pointers migration. Update to `getPointerElementType` for now
until we've also migrated.
2022-05-05 16:25:10 -07:00
swift_jenkins
0a7f41ea77 Merge remote-tracking branch 'origin/main' into next 2022-04-22 01:01:17 -07:00
John McCall
bd77714537 Unique extended existential shapes using the generalized AST type.
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.
2022-04-21 23:47:01 -04:00
swift_jenkins
31f3c479a3 Merge remote-tracking branch 'origin/main' into next 2022-04-21 14:33:57 -07:00
Josh Soref
9fa14ca215 Spelling irgen (#42470)
* spelling: abstractable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: across

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: clazz

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: command

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: components

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: current

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: declared

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: discrimination

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: entities

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: except

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: existential

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: generic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialize

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: inserted

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: instantiate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: instantiation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interfere

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interferes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: intrinsic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: metadata

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: might

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multiple

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: necessary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: objective

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: occurrences

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: outlined

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parameters

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: payload

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: rearchitecting

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: replaceable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: reverse

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: rewritable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: shareably

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: specializations

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: speedup

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: template

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: that

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: the

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: transferred

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: uninitialized

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: witness

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-21 14:02:03 -07:00
swift_jenkins
713eb3e1ed Merge remote-tracking branch 'origin/main' into next 2022-04-18 17:20:44 -07:00
Zoe Carver
786d6ed53d Merge pull request #42427 from zoecarver/ufo-metadata 2022-04-18 17:16:07 -07:00
zoecarver
491f556b77 [cxx-interop] Add basic support for using UFOs as members, etc.
This does not add support for using UFOs in generic contexts, this just emits their struct/field metadata as opaque pointers.
2022-04-18 14:47:02 -07:00
swift_jenkins
53f277d3de Merge remote-tracking branch 'origin/main' into next 2022-04-12 16:40:41 -07:00
John McCall
6385934d7e Metadata emission for extended existential type shapes 2022-04-12 14:52:47 -04:00
swift_jenkins
7cdc0520e3 Merge remote-tracking branch 'origin/main' into next 2022-04-04 10:41:57 -07:00
Pavel Yaskevich
ece63bbdbb Merge pull request #42104 from xedin/irgen-part-of-multi-opaque
[IRGen] Augment opaque type descriptor to support limited availability underlying types
2022-04-04 10:31:32 -07:00
swift_jenkins
bd8ab4d291 Merge remote-tracking branch 'origin/main' into next 2022-04-04 03:00:24 -07:00
swift-ci
6af73245c6 Merge pull request #42136 from ktoso/wip-identifiable-synthesis-fix
[Distributed] ID synthesis must be eager, or we run into issues in real projects
2022-04-04 02:51:22 -07:00
Pavel Yaskevich
4fe16f5bf5 [IRGen] Augment opaque type descriptor to support limited availability underlying types
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.
2022-04-01 13:11:35 -07:00
Konrad `ktoso` Malawski
c88951354f [Distributed] ID synthesis must be eager, or we run into issues in real projects 2022-04-01 18:47:25 +09:00
swift_jenkins
36ebaa2377 Merge remote-tracking branch 'origin/main' into next 2022-03-31 10:20:42 -07:00
Joe Groff
15c21920a1 Merge pull request #42101 from jckarter/async-let-reabstraction
SILGen: Emit async let entry points at correct abstraction level.
2022-03-31 10:07:01 -07:00
swift_jenkins
79d03d3d46 Merge remote-tracking branch 'origin/main' into next 2022-03-31 08:01:10 -07:00
Yuta Saito
26ba09738e Merge pull request #42094 from kateinoigakukun/katei/wasm-uncond-abs-func-ptr
[Wasm][IRGen] Add initial support for unconditional absolute function pointer
2022-03-31 23:50:30 +09:00
Joe Groff
d451203b7f SILGen: Emit async let entry points at correct abstraction level.
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.
2022-03-30 14:51:46 -07:00
swift_jenkins
7db48f624f Merge remote-tracking branch 'origin/main' into next 2022-03-30 14:01:58 -07:00
Yuta Saito
43a25e89b7 [Wasm][IRGen] Add initial support for absolute function pointer
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.
2022-03-30 08:12:23 +00:00
Pavel Yaskevich
a5a50a3658 [AST] NFC: Rename underlying type accessors of OpaqueTypeDecl
Adds a `Unique` component to the accessor names to draw the
distinction between unique and conditionally available substitutions.
2022-03-28 16:22:08 -07:00
swift_jenkins
fafa199f05 Merge remote-tracking branch 'origin/main' into next 2022-03-09 10:00:38 -08:00
Erik Eckstein
6a020f8f15 Stabilize and simplify SIL linkage and serialization
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.
2022-03-09 15:28:05 +01:00
swift_jenkins
50333779f9 Merge remote-tracking branch 'origin/main' into next 2022-03-03 20:00:58 -08:00
zoecarver
2749026103 [cxx-interop] Class template specializations each need their own metadata.
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.
2022-03-03 14:26:37 -08:00
swift_jenkins
810042c69f Merge remote-tracking branch 'origin/main' into next 2022-02-13 11:41:02 -08:00
Slava Pestov
a1c03db381 AST: Generalize ProtocolDecl::getRequirementSignature() to a new RequirementSignature type
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.
2022-02-13 00:24:23 -05:00
swift_jenkins
77a523bdbc Merge remote-tracking branch 'origin/main' into next 2022-02-07 09:40:22 -08:00
Arnold Schwaighofer
1c5f9bc26e IRGen: Emit the protocol requirement descriptor async flag for initializers
rdar://88180938
2022-02-04 16:32:12 -08:00
swift_jenkins
908cfa10b6 Merge remote-tracking branch 'origin/main' into next 2022-02-03 06:00:40 -08:00
Kuba (Brecka) Mracek
ee7e04822c Add a -reflection-metadata-for-debugger-only flag that emits reflection metadata but does not link them from runtime data structures (#40853) 2022-02-03 05:53:31 -08:00
swift_jenkins
885ce9d4d3 Merge remote-tracking branch 'origin/main' into next 2022-02-02 12:20:32 -08:00
Kuba (Brecka) Mracek
17c5d6f0de Add a flag to disable compile-time preallocated instantiation caches (for type metadata and protocol conformances) (#41148) 2022-02-02 12:06:16 -08:00
swift_jenkins
83748daddd Merge remote-tracking branch 'origin/main' into next 2022-01-27 18:20:57 -08:00