Commit Graph

20 Commits

Author SHA1 Message Date
Erik Eckstein
2950e4521e SIL: representation for specialized witness tables
The main change here is to associate a witness table with a `ProtocolConformance` instead of a `RootProtocolConformance`.
A `ProtocolConformance` is the base class and can be a `RootProtocolConformance` or a `SpecializedProtocolConformance`.
2024-09-25 19:32:08 +02:00
Ellie Shin
72a7760027 Support package SIL linkage.
Decls with a package access level are currently set to public SIL
linkages. This limits the ability to have more fine-grained control
and optimize around resilience and serialization.
This PR introduces a separate SIL linkage and FormalLinkage for
package decls, pipes them down to IRGen, and updates linkage checks
at call sites to include package linkage.

Resolves rdar://121409846
2024-02-06 01:23:14 -08:00
Slava Pestov
79d4260ae2 SIL: Remove the incorrect old getTypeLinkage() 2024-01-03 14:45:29 -05:00
John McCall
0cde2dde05 Provide a version of getTypeLinkage that works.
Smaller values of FormalLinkage are actually wider scopes,
so std::min'ing with PublicUnique actually just gives you
a result that's always PublicUnique.  And we need to start
with PublicNonUnique because even things derived solely
from uniquely-emitted types are not themselves generally
unique.

I don't want to immediately open the can of worms that fixing
this for everyone would entail, so I'm just adding the new
version in parallel and moving new clients to it gradually.
2022-04-11 22:15:21 -04:00
John McCall
fb6883d0bb [NFC] Add a utility to compute formal linkage for a generic signature 2022-04-11 22:15:16 -04:00
Joe Groff
92f56e7ec8 Allow conversions from actor-bound sync function type to unbound async function type.
For `async` function types, an actor constraint can be enforced by the callee by hopping executors,
unlike with `sync` functions, so doesn't need to influence the outward type of the function.

rdar://76248452
2021-05-21 14:17:50 -07:00
John McCall
5553224fd4 Support the explicit representation of self-conformances.
Big, but actually NFC because we're never actually creating them.
2018-11-15 16:42:03 -05:00
Slava Pestov
498e6dc165 SIL: Remove FormalLinkage::HiddenNonUnique 2018-03-27 01:43:07 -07:00
Slava Pestov
005267f2b0 SIL: Remove obsolete comments from FormalLinkage.h 2018-01-10 21:32:54 -08:00
Slava Pestov
6fbf8b81a3 SIL: Kill completely bogus getTypeLinkage() function
- The overload of operator^ on FormalLinkage, while cute, was only used
  in this one place, and does not behave like an XOR.

- The structural type walk was totally unnecessary in the first place,
  because we were only ever calling getTypeLinkage() with builtin types
  and nominal types.

- Furthermore, the structural type walk was doing the wrong thing with
  nested nominal types, because the linkage of a nested type A.B
  should not be the intersection of the linkage of A and A.B. If A is an
  imported type and A.B is defined in an extension of A, we would give
  the metadata of A.B shared linkage, which is wrong.
2017-11-03 16:03:00 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Slava Pestov
b49a4525c3 SIL: Only give type metadata public linkage if -sil-serialize-all is on
Otherwise, any types referenced from transparent functions must be
public or @_versioned.
2016-03-28 14:14:50 -07:00
Slava Pestov
a9cbab70a7 SIL: Move getLinkageForProtocolConformance() to SIL.cpp, NFC 2016-03-28 13:24:21 -07:00
Slava Pestov
25319d9d4b SILGen: Use correct linkage for default witness thunks
Don't hardcode linkage of default witness thunks, addressing a FIXME.

This will allow us to emit default witness thunks for requirements of
internal protocols, too.
2016-03-17 03:57:23 -07:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Jordan Rose
014fd87928 Treat private type declarations as "hidden" in SIL (rather than public).
Easy cut down on exported symbols. Unless a private type is referenced in
an inlineable function, there's no way to generate a reference to it
outside of the current file, except in the debugger. (That last bit is why
we can't use fully private linkage, which would keep the symbol out of the
symbol table completely.)

We should be doing this for "internal" declarations as well, but the
standard library /does/ have references to internal types in inlineable
functions, and also has tests that directly access these types.

Swift SVN r24838
2015-01-30 03:54:04 +00:00
Manman Ren
47272fd25f [Linkage] move getSILLinkage from GenDec.cpp to FormalLinkage.h.
So SILGen can call getSILLinkage in follow-on patches to replace GlobalAddrInst
with SILGLobalAddrInst.

No functionaility change.


Swift SVN r21881
2014-09-11 17:49:39 +00:00
Joe Groff
c5feea4697 SILGen: Emit conformances for external definitions.
Teach IRGen to honor the linkage of SILWitnessTables, and teach SILGen to emit witness tables and protocol witness thunks for external definitions with shared linkage. Fixes <rdar://problem/16264703>.

Swift SVN r14908
2014-03-11 05:08:58 +00:00
John McCall
5da6defa1f Clean up the linkage model and the computation of linkage.
In general, this forces SILGen and IRGen code that's grabbing
a declaration to state whether it's doing so to define it.

Change SIL serialization to serialize the linkage of functions
and global variables, which means also serializing declarations.

Change the deserializer to use this stored linkage, even when
only deserializing a declaration, and to call a callback to
inform the client that it has deserialized a new entity.

Take advantage of that callback in the linking pass to alter
the deserialized linkage as appropriate for the fact that we
imported the declaration.  This computation should really take
advantage of the relationship between modules, but currently
it does not.

Swift SVN r12090
2014-01-09 08:58:07 +00:00