Commit Graph

25 Commits

Author SHA1 Message Date
Slava Pestov
b9f4e12365 SIL: Fix visibility of final method symbols in resilient classes
For resilient classes, we hide method symbols if possible, to
enforce that only resilient access patterns are used to call
and override methods.

Final methods can be referenced directly, however, but we were
incorrectly hiding them anyway if they were overrides. To consider
overrides differently here only makes sense in the non-resilient
case; in fact this was a regression from <rdar://problem/55559104>,
which fixed a bug with non-resilient classes by adding this check.

I tried to add comments and clean up the logic here a bit to be
less confusing in the future.

Fixes <rdar://problem/57864425>.
2020-01-14 18:47:35 -05:00
Slava Pestov
f33a5c099d SIL: Final methods need a subclass scope if they override something
... otherwise we compute the wrong visibility in IRGen.

Fixes <rdar://problem/55559104>.
2019-10-24 20:14:28 -04:00
Slava Pestov
083d58c228 IRGen: Remove hack giving method descriptors of open class initializers public linkage
This was done even for non-public inits because subclasses would always
override the base class's designated initializers, even if they were
inaccessible.

This is an ABI break, however in practice the only affected class
initializer was ManagedBuffer.init(_doNotCallMe:()), and we can just
make it @usableFromInline.
2019-06-01 00:08:05 -04:00
Slava Pestov
1159af50d9 Rename -enable-resilience to -enable-library-evolution and make it a driver flag
Fixes <rdar://problem/47679085>.
2019-03-14 22:24:26 -04:00
Slava Pestov
3b10ed5eaf SIL: Non-final public methods of resilient classes don't need public linkage
Part of <rdar://problem/40432647>.
2018-11-15 14:55:44 -05:00
Slava Pestov
de1ba80ffa SIL: Private methods of open resilient classes don't need to be public
Private methods of non-resilient classes can be referenced from
outside the module, but resilient classes build the vtable at
runtime so we don't need that hack there.
2018-11-07 17:35:49 -05:00
Erik Eckstein
39bb14b094 change mangling prefix from $S to $s
This is the final ABI mangling prefix

rdar://problem/38471478
2018-09-19 13:55:11 -07:00
Joe Groff
77a0923ca6 SILGen: Emit convenience initializers as allocating entry points.
And only dispatch designated inits by their allocating entry points. rdar://problem/29634243
2018-09-13 12:31:23 -07:00
Slava Pestov
101e55e03c IRGen: Constructor method descriptors for open classes inherit linkage from their class
Even if the constructor is internal or private, the method
descriptor can be referenced from another module if the
class is subclassed.
2018-09-04 14:46:34 -07:00
Saleem Abdulrasool
d746a6d1db tests: annotate dllstorage on IRGen tests
This adds the dllstorage annotations on the tests.  This first pass gets
most of the IRGen tests passing on Windows (though has dependencies on
other changes).  However, this allows for the changes to be merged more
easily as we cannot regress other platforms here.
2018-04-23 20:21:10 -07:00
Erik Eckstein
cd3d50a5d9 ABI: Change the mangling prefix from _T0 to $S 2018-01-06 13:55:59 -08:00
Huon Wilson
64ba6f0379 [SIL] Overriding final decls can behave like non-overriding ones. 2017-04-14 10:13:12 -07:00
Huon Wilson
c41319b24b [SIL] Only open classes can be subclassed externally. 2017-04-14 10:13:11 -07:00
Erik Eckstein
c4a11f4c92 tests: remove the now unused option -new-mangling-for-tests 2017-03-22 11:28:43 -07:00
Arnold Schwaighofer
39fa2f0228 Use the swift calling convention for swift functions
Use the generic type lowering algorithm described in
"docs/CallingConvention.rst#physical-lowering" to map from IRGen's explosion
type to the type expected by the ABI.

Change IRGen to use the swift calling convention (swiftcc) for native swift
functions.

Use the 'swiftself' attribute on self parameters and for closures contexts.

Use the 'swifterror' parameter for swift error parameters.

Change functions in the runtime that are called as native swift functions to use
the swift calling convention.

rdar://19978563
2017-02-14 12:17:57 -08:00
Erik Eckstein
1d3724666f tests: convert about 400 tests to the new mangling by using the -new-mangling-for-tests option
When the new mangling is enabled permanently, the option can be removed from the RUN command lines again.
2017-01-24 15:27:45 -08:00
Michael Gottesman
20dd563efb [semantic-arc] Update tests for qualified/unqualified ownership and SILGen emission of copy_value, destroy_value. 2016-10-29 20:11:09 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Jordan Rose
e4118f19c8 Port tests to 'fileprivate'.
Similar to apple/swift#3753.

Groundwork for SE-0025 ('private' and 'fileprivate').
No intended functionality change.
2016-07-25 20:20:58 -07:00
Joe Groff
8cb1175e49 IRGen: Emit public definitions with protected visibility on ELF.
This prevents the linker from trying to emit relative relocations to locally-defined public symbols into dynamic libraries, which gives ld.so heartache.
2016-02-08 13:09:27 -08:00
Joe Groff
2368ce774b Remove self types from mangling by default.
And include some supplementary mangling changes:

- Give the first generic param (depth=0, index=0) a single character mangling. Even after removing the self type from method declaration types, 'Self' still shows up very frequently in protocol requirement signatures.
- Fix the mangling of generic parameter counts to elide the count when there's only one parameter at the starting depth of the mangling.

Together these carve another 154KB out of a debug standard library. There's some awkwardness in demangled strings that I'll clean up in subsequent commits; since decl types now only mangle the number of generic params at their own depth, it's context-dependent what depths those represent, which we get wrong now. Currying markers are also wrong, but since free function currying is going away, we can mangle the partial application thunks in different ways.

Swift SVN r32896
2015-10-26 22:05:20 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
Graham Batty
83f27a8af7 Revert "Mark tests that don't pass on linux as XFAIL."
This reverts commit 2711ca86de7bf6a7885ccea24219a48a590b1e95.

Swift SVN r23577
2014-11-24 17:42:13 +00:00
Graham Batty
198402dcfe Mark tests that don't pass on linux as XFAIL.
Swift SVN r23573
2014-11-24 17:40:37 +00:00
Erik Eckstein
02d510417a Fix linkage of vtable methods.
Methods which go into a vtable must be at least as visible as their classes.
Otherwise derived classes from "outside" cannot reference such base methods in their vtables.



Swift SVN r22889
2014-10-23 12:49:27 +00:00