Their definition is fully visible to clients to be copied into them, and there isn't necessarily
a symbol for the property descriptor in the defining module, so it isn't necessary or desirable to
try to use a property descriptor with them. Trying to reference the descriptor leads to missing
symbol errors at load time when trying to use keypaths with older versions of the defining dylib,
which goes against the purpose of `@_alwaysEmitIntoClient` meaning "no ABI liabilities for the
defining module". Fixes rdar://94049160.
The runtime that shipped with Swift 5.1 and earlier had a bug that interfered with backward
deployment of binaries that dynamically check for protocol conformances on conditionally-available
tests. This was fixed in the top-of-tree Swift runtime by https://github.com/apple/swift/pull/29887;
however, that doesn't do much good for running binaries on older OSes that don't have that fix.
In order for binaries built with a newer Swift compiler to run successfully on older OSes,
introduce a compatibility hook that replaces the conformance cache implementation in the original
OS runtime with a version based on the current implementation that has the fix for the protocol
conformance bug. Fixes rdar://problem/59460603
The ConformanceCandidate constructor would eagerly instantiate metadata for
all non-generic types in the conformance cache. This was not the intention
of the code though, because it can compare nominal type descriptors --
which are emitted statically -- for those types that have them, namely
everything except for foreign and Objective-C classes.
Change the order of two calls so that the lazy path has a chance to run.
This fixes a crash when type metadata uses weakly-linked symbols
which are not available, which can come up in backward deployment
scenarios.
Fixes <rdar://problem/59460603>.
It is expected that under enable-private-import internal/private symbols
become public. So that symbol-diffing would fail. Disable symbol diffing
under that test mode.
rdar://51304243
Windows uses `\` for the path separator while other targets use `/`
Use the correct seprator for calculating the basename of the executable
to enable the test on Windows.
PE/COFF does not support weak linking semantics. Disable the tests
until we can emulate the required behaviour. This will allow us to
enable running the validation test suite on Windows in the mean time.
The resilience test helper builds up invocations of the tooling. In
order to do this, we need to know what host we are building for. Plumb
the value for `-triple` from the test harness into the utility. This
will be used subsequently to enable additional testing for Windows.
We have to set the SILFunction's 'weakLinked' flag in the defining
module too, so that it can be serialized. Otherwise when we
deserialize it we are not weak linking calls to the function.
If the conforming type is generic, we have to treat the conformance as
resilient if it is defined outside of the current module.
This is because it can resiliently change from being non-dependent
to dependent.
The naming convention is different on Windows than on Unix-like
environments. In order to follow the convention we need to substitute
the prefix and the suffix. Take the opportunity to rename the
`target-dylib-extension` to the CMake-like variable
`target-shared-library-suffix` and introduce
`target-shared-library-prefix`. This helps linking the test suite
binaries on Windows.
Basically the pattern to optimize is:
inject_enum_addr %stackloc, #SomeCase
switch_enum_addr %stackloc ...
This works even if the enum is resilient and the case does not have a payload. As long as we don't have opaque values in SIL we need this peephole to optimize the pattern.
This change fixes the code generation for Float.rounded().
rdar://problem/46353885
@_fixed_layout classes have resilient vtables now, so we can add and
re-order methods.
Removing overrides is not legal though because they are subject to
devirtualization.
- We don't want to support changing a root class of a class, so don't
pretend that works. Some of these tests got removed recently in
d8104e7e43 but one still remained.
- For the tests that insert a non-root superclass in the inheritance
hierarchy, also test calling a method of the derived class. This
works now that we no longer hardcode vtable offsets and instead use
dispatch thunks.
We want removing a property override to be a resilient change, so
keypaths should not reference them, preferring to reference the
base declaration instead.
Instead of passing in a DeclContext, which we don't have when emitting a keypath
accessor, pass in a ModuleDecl and ResilienceExpansion.
Keypaths now work well enough in inlinable contexts that we can check in an
end-to-end resilience test.
A resilient change should not *remove* previously-public symbols.
Note that currently, the test_superclass_properties test does not
meet this critierion, because we always emit keypath property
descriptors, even when the property is an override. Fixing this
is a larger change that I'll address in a follow-on PR, so for now
I'm just going to disable the symbol check for this one test only.
Part of <rdar://problem/40432647>.
Get the attribute working for more link entity kinds, which addresses
all the FIXME:s in the original test case.
Now the protocol resilience tests can be updated to use @_weakLinked
for all newly-added protocol requirements and default implementations.
This allows the tests to pass in the backward deployment test scenario
as well.
Eventually this will be based on availability instead of a special
attribute.
This completes <rdar://problem/29888071>.
The witness table for an empty, resilient protocol might need to be
instantiated, if a newer version of the protocol contains defaulted
associated type requirements. In such cases, we would either fail to
instantiate or assert in the runtime. Replace the assertion with a
proper check (to require instantiation in such cases) and cope with
filling in defaults even when the provided generic witness table has
no resilient witnesses.
For a resilient protocol that has defaulted associated types, emit
default associated conformance witnesses that compute associated
conformances based on that default witness.
This completes the implementation of resilience protocols that
add new, defaulted associated types, rdar://problem/44167982.
When an associated type witness has a default, record that as part of
the protocol and emit a default associated type metadata accessor into the
default witness table. This allows a defaulted associated type to be
added to a protocol resiliently.
This is another part of rdar://problem/44167982, but it’s still very
limiting because the new associated type cannot have any conformances.
Generic parameter references, which occur in generic requirement
metadata, were hardcoding associated type indices. Instead, use
relative references to associated type descriptors and perform the
index calculation at runtime.
Associated types can now be reordered resiliently (without relying on
sorting), which is the first main step toward rdar://problem/44167982.