Commit Graph

131 Commits

Author SHA1 Message Date
Anthony Latsis
3fcadf6c15 Gardening: Migrate test suite to GH issues: validation-test/Evolution 2022-09-19 22:34:06 +03:00
Joe Groff
53e8e7b1d8 SILGen: Don't reference external property descriptors for @_alwaysEmitIntoClient properties.
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.
2022-06-01 16:54:38 -07:00
Josh Soref
0f78f006bb Spelling validation test (#58561) 2022-05-27 22:07:10 -07:00
Joe Groff
ca48939816 Compatibility51: Backport the 5.2 implementation of the conformance cache.
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
2020-04-24 10:52:29 -07:00
Slava Pestov
d37cf8e47a Disable test_backward_deploy_conformance completely on Swift-in-the-OS bots
Fixes <rdar://problem/59670363>.
2020-02-21 13:09:05 -05:00
Slava Pestov
00ed9e4885 Disable test_backward_deploy_conformance.swift on Swift-in-the-OS bots
We need a backward compatibility shim before this can work.

Fixes <rdar://problem/59631880>.
2020-02-20 13:02:12 -05:00
Slava Pestov
1ca2b61f7a Runtime: Less eager instantiation of type metadata in the conformance cache
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>.
2020-02-17 16:24:42 -05:00
Karoy Lorentey
b90e2ef776 [test] Denineninenineninify behavioral tests added for 5.1 2019-08-27 15:44:04 -07:00
Arnold Schwaighofer
a22b4f79ec Merge pull request #25406 from aschwaighofer/enable_remaining_implicit_dynamic
Remove the remaining swift_test_mode_optimize_none_with_implicit_dynamic
2019-06-13 08:17:13 -07:00
Arnold Schwaighofer
127b2ab939 Remove the remaining swift_test_mode_optimize_none_with_implicit_dynamic
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
2019-06-12 15:54:49 -07:00
Saleem Abdulrasool
9e901eb0f8 test: fix the path separator for Evolution.test_rth
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.
2019-06-12 13:48:08 -07:00
Slava Pestov
6798eea160 Evolution: Some of these tests pass with swift_test_mode_optimize_none_with_implicit_dynamic
The remaining failures still warrant investigation.
2019-06-11 00:54:32 -07:00
Saleem Abdulrasool
01cf8a8dfc tests: disable backward deployment tests 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.
2019-06-10 17:05:56 -07:00
Saleem Abdulrasool
1e630a5969 test: plumb --triple to the resilience test helper
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.
2019-06-02 17:55:34 -07:00
Ben Cohen
e9d4687e31 De-underscore @frozen, apply it to structs (#24185)
* De-underscore @frozen for enums

* Add @frozen for structs, deprecate @_fixed_layout for them

* Switch usage from _fixed_layout to frozen
2019-05-30 17:55:37 -07:00
Arnold Schwaighofer
11c665715c Opaque types require the next Swift runtime
rdar://50503909
2019-05-08 09:50:53 -07:00
Arnold Schwaighofer
a793dfb451 Respect resilience when specializing opaque type archetypes 2019-05-01 09:31:07 -07:00
Arnold Schwaighofer
e113ef8c93 Add a mode to test implicit dynamic with private imports 2019-03-20 14:34:01 -07:00
Slava Pestov
b9bda84e28 SIL: Fix calls of @_weakLinked functions from serialized SIL
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.
2019-02-22 21:10:18 -05:00
Slava Pestov
71ab1bbe77 IRGen: Fix isResilientConformance() check
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.
2019-02-20 20:00:46 -05:00
Arnold Schwaighofer
c711181f83 Merge pull request #21256 from aschwaighofer/irgen_conditionally_test_weak_enum_cases
IRGen: Conditionally test weakly linked enum cases
2018-12-13 08:06:47 -08:00
swift-ci
f453092465 Merge pull request #21152 from compnerd/library-prefix-suffix 2018-12-12 12:45:21 -08:00
Arnold Schwaighofer
5ae00ee2a2 IRGen: Conditionally test weakly linked enum cases
rdar://46438568
2018-12-12 11:18:12 -08:00
Arnold Schwaighofer
0c01906218 Address review feedback 2018-12-12 08:22:09 -08:00
Saleem Abdulrasool
b212229db1 test: add and use prefix substitutions for libraries
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.
2018-12-11 15:56:06 -08:00
Arnold Schwaighofer
2f34bdcbbc IRGen: Don't hoist metadata for weakly linked types
rdar://46438608
2018-12-11 13:15:33 -08:00
Erik Eckstein
5c17f0f6f8 SILCombine: peephole to propagate resilient enum cases
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
2018-12-10 16:14:15 -08:00
Slava Pestov
a6f4c8a60d Evolution: Code review feedback for backward deployment tests 2018-12-04 15:13:44 -05:00
Slava Pestov
f5b448f75a Evolution: Add backward deployment tests 2018-12-03 20:36:03 -05:00
Slava Pestov
57c4dc3831 Evolution: Stylistic fixes for tests 2018-12-03 20:36:03 -05:00
Slava Pestov
a5abb9d7ed Evolution: Add some tests for @_fixed_layout classes
@_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.
2018-11-29 23:20:02 -05:00
Slava Pestov
9af20c71f0 Evolution: Clean up superclass insertion tests a bit
- 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.
2018-11-29 23:20:02 -05:00
Slava Pestov
547746719a Evolution: Test adding a new convenience init to an open class 2018-11-28 12:39:04 -05:00
Slava Pestov
e24c4c3f63 Evolution: Test that adding willSet/didSet to a stored property works 2018-11-28 12:39:04 -05:00
Slava Pestov
6028912131 Evolution: Test that adding or removing weak/unowned is a resilient change 2018-11-28 12:39:04 -05:00
Slava Pestov
890bf2eeed Evolution: Test adding a class deinit 2018-11-28 12:39:04 -05:00
Slava Pestov
16fccd6a51 Evolution: Test moving methods between class/struct and extension 2018-11-28 12:39:04 -05:00
Slava Pestov
0781ab85b6 Evolution: Add test changing a lazy property a computed property with a mutating getter 2018-11-28 12:39:04 -05:00
Slava Pestov
62d44a3a4f Evolution: Rename some tests in preparation for testing @_fixed_layout classes more 2018-11-28 12:39:04 -05:00
Slava Pestov
0e1b62dcad SILGen: Don't emit or reference property descriptors for overrides
We want removing a property override to be a resilient change, so
keypaths should not reference them, preferring to reference the
base declaration instead.
2018-11-16 23:18:30 -05:00
Slava Pestov
0a8ee10621 AST: Refactor AbstractStorageDecl::getAccessStrategy() for keypath resilience
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.
2018-11-16 23:18:30 -05:00
Slava Pestov
5243cc718d Evolution: Compare symbols before and after
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>.
2018-11-15 19:55:46 -05:00
Slava Pestov
517f37088c Evolution: Tweak existing tests to not remove public symbols 2018-11-15 14:55:44 -05:00
Slava Pestov
57979d1f7c IRGen: Use @_weakLinked to test backward deployment of resilient protocols
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>.
2018-10-31 19:55:01 -04:00
Doug Gregor
3ed69d4ee7 [Runtime] Instantiate witness tables even with no resilient witnesses.
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.
2018-09-19 14:00:28 -07:00
Doug Gregor
fb62977c2b [IRGen] Emit default associated conformance 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.
2018-09-19 10:56:20 -07:00
Doug Gregor
2ef9363bd1 [ABI] Add default associated type witnesses to resilient protocols.
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.
2018-09-15 22:04:46 -07:00
Doug Gregor
350391db9d [ABI] Use associated type descriptors for generic parameter references.
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.
2018-09-14 20:59:03 -07:00
Slava Pestov
3808ae0d58 IRGen: Use method lookup function for resilient super method calls
Fixes <https://bugs.swift.org/browse/SR-3928>, <rdar://problem/31411193>.
2018-09-07 21:57:16 -07:00
Slava Pestov
b7449d5621 IRGen/Runtime: Method override descriptors 2018-09-04 14:46:34 -07:00