Commit Graph

19 Commits

Author SHA1 Message Date
Nadav Rotem
9617af5956 Remove the flag -disable-func-sig-opts from a bunch of tests.
This commit removes the flag '-disable-func-sig-opts' from a bunch of tests and
fixes all of the affected tests.  This flag was introduces when the
function-signature-opt optimization was introduced and we did not port the old
tests. Now the day has come to clean all of the old tests and delete the flag.
2015-12-01 22:26:10 -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
Joe Groff
0cd5aa8c7c Change mangling for the Swift module from 'Ss' to 's'.
'Ss' appears in manglings tens of thousands of times in the standard library and is also incredibly frequent in other modules. This alone is enough to shrink the standard library by 59KB.

Swift SVN r32409
2015-10-02 22:39:44 +00:00
Mark Lacey
517723dbe9 Add -enable-sil-verify-all to sil-opt tests.
Also remove -verify from almost all of them, since only two actually
have expected diagnostic output that is tested.

Swift SVN r32198
2015-09-24 07:25:15 +00:00
Mark Lacey
08a7c2e540 Update some tests to remove -sil-inline-threshold in favor of @inline(never).
Replace the use of -sil-inline-threshold with @inline(never) on specific
functions. This is required in some cases in order to remove the generic
specialization pass and allow the inliner to do the specialization
instead (specifically the cases where the parameter is 0, which causes
us to exit the inliner immediately).

Also add public in some places to ensure that we do not toss out
functions before we even make it to the inliner (once the standalone
generic specialization pass is removed).

Swift SVN r31126
2015-08-10 21:33:13 +00:00
Joe Groff
1af4659c4a Enable interface type mangling.
Fixes rdar://problem/18034517, and addresses a number of compiler crashers due to symbol collisions in the old mangling.

Swift SVN r28383
2015-05-09 22:20:57 +00:00
Joe Groff
c0a2994564 AST: Start printing function types with @convention instead of old attributes.
And update tests to match.

Swift SVN r27262
2015-04-13 22:51:34 +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
Michael Gottesman
7e39f33f98 [mangle] Include a pass id in the mangling, just to be careful.
I am starting to reuse manglings for different passes. I want to make sure that
when we reuse functions we actually get a function created by the same pass.

Swift SVN r23924
2014-12-14 10:29:11 +00:00
Michael Gottesman
4d48d2aaae [mangle] Add initial code for SIL specializations manglings and refactor Generic Specialization mangling code to there from the pass itself.
This is apart of creating the infrastructure for creating special manglings for
all of the passes that we specialize. The main motiviations for this
infrastructure is:

1. Create an easy method with examples on how to create these manglings.
2. Support multiple specializations. This is important once we allow for partial
specialization and can already occur if we perform function signature
optimizations on specialized functions.

The overall scheme is as follows:

_TTS<MANGLINGINFO>__<FUNCNAME>

Thus if we specialize twice, the first specialization will just be treated as
the function name for the second specialization.

<MANGLINGINFO> is defined as:

_<SPECIALIZATIONKINDID>_<SPECIALIZATIONUNIQUEINFO>

Where specialization kind is an enum that specifies the specific sort of
specialization we are performing and specialization unique info is enough
information to ensure that the identity of the function is appropriately
preserved.

Swift SVN r23801
2014-12-09 02:53:05 +00:00
Michael Gottesman
f33e6306e8 [func-sig-opts] Enable func sig opts.
This currently handles owned -> guaranteed argument conversion and dead argument
elimination.

RecursiveOwnedParameter||90.0%
ClassArrayGetter|||||||||23.3%
Life|||||||||||||||||||||16.7%
Prims||||||||||||||||||||11.2%
StringWalk|||||||||||||||5.7%

The next step is to implement SROA and address -> value optimizations.

rdar://16917049

Swift SVN r23023
2014-10-30 23:22:51 +00:00
Joe Groff
3f23b82e6d SIL: Rename SILGlobalAddr to GlobalAddr.
All globals are SIL globals now.

Swift SVN r22827
2014-10-18 17:08:28 +00:00
Joe Groff
bb46f4bbd9 SIL: Remove the global_addr instruction.
It's no longer needed now that we always lower to SIL globals.

Swift SVN r22693
2014-10-12 17:19:06 +00:00
Michael Gottesman
2bb3269869 Add code to the verifier to make sure that functions with shared visibility always have bodies.
Since both shared and shared_external both lower to linkonce_odr, neither of
them can be declarations. This commit puts a check into the verifier to ensure
that this does not happen at the SIL level allowing us to catch such issues
earlier.

Swift SVN r22552
2014-10-06 23:16:51 +00:00
Erik Eckstein
c16c510167 Set SILLinkage according to visibility.
Now the SILLinkage for functions and global variables is according to the swift visibility (private, internal or public).

In addition, the fact whether a function or global variable is considered as fragile, is kept in a separate flag at SIL level.
Previously the linkage was used for this (e.g. no inlining of less visible functions to more visible functions). But it had no effect,
because everything was public anyway.

For now this isFragile-flag is set for public transparent functions and for everything if a module is compiled with -sil-serialize-all,
i.e. for the stdlib.

For details see <rdar://problem/18201785> Set SILLinkage correctly and better handling of fragile functions.

The benefits of this change are:
*) Enable to eliminate unused private and internal functions
*) It should be possible now to use private in the stdlib
*) The symbol linkage is as one would expect (previously almost all symbols were public).

More details:

Specializations from fragile functions (e.g. from the stdlib) now get linkonce_odr,default
linkage instead of linkonce_odr,hidden, i.e. they have public visibility.
The reason is: if such a function is called from another fragile function (in the same module),
then it has to be visible from a third module, in case the fragile caller is inlined but not
the specialized function.

I had to update lots of test files, because many CHECK-LABEL lines include the linkage, which has changed.

The -sil-serialize-all option is now handled at SILGen and not at the Serializer.
This means that test files in sil format which are compiled with -sil-serialize-all
must have the [fragile] attribute set for all functions and globals.

The -disable-access-control option doesn't help anymore if the accessed module is not compiled
with -sil-serialize-all, because the linker will complain about unresolved symbols.

A final note: I tried to consider all the implications of this change, but it's not a low-risk change.
If you have any comments, please let me know.



Swift SVN r22215
2014-09-23 12:33:18 +00:00
Jordan Rose
b6818046a8 Eliminate optimization levels 0-3 in favor of -Onone/-O/-Ofast.
We were already effectively doing this everywhere /except/ when building
the standard library (which used -O2), so just use the model we want going
forward.

Swift SVN r20455
2014-07-24 01:12:59 +00:00
Michael Gottesman
4ec0a81e5f Add linkage SILLinkage::SharedExternal for deserialized functions with shared linkage.
*NOTE* This linkage is different from {Public,Hidden}External in that it has no
extra semantic meaning beyond shared.

The use of this linkage is to ensure that we do not serialize deserialized
shared functions. Those shared functions can always be re-deserialized from the
original module. This prevents a whole class of bugs related to the
creation of module cross references since all references to the shared
item go straight to the original module.

<rdar://problem/17772847>

Swift SVN r20375
2014-07-23 05:04:48 +00:00
Doug Gregor
71cd9245ba Rename swift_stdlib_core -> swiftCore and swift_runtime -> swiftRuntime.
We can't use underscores in plists, so just makes the names consistent
<rdar://problem/17652418>.

Swift SVN r19954
2014-07-14 22:19:03 +00:00
Michael Gottesman
9d54b8591a [serialization] Always serialize sil with shared linkage.
Entities with shared linkage are allowed to be discarded if they are unused even
in a library context.

Previously we implemented this in the serializer, which introduced
needless complications. Now we leave that responsibility to the optimizer giving
simplicity.

Swift SVN r16150
2014-04-10 04:34:05 +00:00