Commit Graph

4604 Commits

Author SHA1 Message Date
John McCall
3c5de5fa0a Preserve type canonicality better in several places and
idiomatize some uses of SILType::getSwiftRValueType().
2017-03-14 14:59:43 -04:00
swift-ci
a262d88ef7 Merge remote-tracking branch 'origin/master' into master-next 2017-03-14 10:28:51 -07:00
John McCall
897f5ab7c5 Restore CanType-based micro-optimizations.
This reverts commit 5036806e5a.
However, it preserves a pair of changes to the SIL optimizer
relating to walking through optional types.
2017-03-14 11:38:11 -04:00
swift-ci
8d1dd08efe Merge remote-tracking branch 'origin/master' into master-next 2017-03-14 08:08:43 -07:00
John McCall
22382f7e15 Reimplement associated conformance IRGen using Doug's conformance
access path work.

Having done so, simplify archetype TypeInfos by removing a now-
unnecessary layer of abstraction.
2017-03-14 03:48:10 -04:00
John McCall
5b4c2cfc1c Minor improvements to MetadataPath for base conformances. 2017-03-14 03:21:51 -04:00
John McCall
dbf2be4cb2 Give operation costs a proper type instead of using unsigned. NFC. 2017-03-14 03:21:50 -04:00
John McCall
2077abaca3 Fix a couple of dump() methods to add newlines. 2017-03-14 03:21:50 -04:00
swift-ci
456b9a5ee8 Merge remote-tracking branch 'origin/master' into master-next 2017-03-13 12:08:42 -07:00
Slava Pestov
5036806e5a AST: Remove some unnecessary getCanonicalType() calls 2017-03-13 02:24:36 -07:00
swift-ci
34a5016eaf Merge remote-tracking branch 'origin/master' into master-next 2017-03-12 23:08:41 -07:00
Slava Pestov
162b2d252e AST: Include gardening to minimize dependencies on Expr.h
A lot of files transitively include Expr.h, because it was
included from SILInstruction.h, SILLocation.h and SILDeclRef.h.

However in reality most of these files don't do anything
with Exprs, especially not anything in IRGen or the SILOptimizer.

Now we're down to 171 files in the frontend which depend on
Expr.h, which is still a lot but much better than before.
2017-03-12 22:26:56 -07:00
swift-ci
6c8d813427 Merge remote-tracking branch 'origin/master' into master-next 2017-03-10 14:28:41 -08:00
Erik Eckstein
41c17a5b0c IRGen: emit type metadata and (value) witness tables lazily.
This gives big code size wins for unused types and also for types, which are never used in a generic context.
Also it reduces the amount of symbols in the symbol table.
The size wins heavily depend on the project. I have seen binary size reductions from 0 to 20% on real world projects.

rdar://problem/30119960
2017-03-10 12:50:43 -08:00
swift-ci
80d04d27b3 Merge remote-tracking branch 'origin/master' into master-next 2017-03-10 06:08:41 -08:00
Arnold Schwaighofer
80732ead34 Non-witness implementations of init_existential_addr, deinit_existential_addr, open_existential_addr, copy_addr, destory_addr
For the boxed existential variant.
2017-03-09 17:22:35 -08:00
Arnold Schwaighofer
52102587fc Add a function to allocate a box for out-line existential value buffer 2017-03-09 17:22:35 -08:00
swift-ci
0fc0388325 Merge remote-tracking branch 'origin/master' into master-next 2017-03-09 16:48:41 -08:00
Erik Eckstein
5e80555c9b demangler: put the demangler into a separate library
Previously it was part of swiftBasic.

The demangler library does not depend on llvm (except some header-only utilities like StringRef). Putting it into its own library makes sure that no llvm stuff will be linked into clients which use the demangler library.

This change also contains other refactoring, like moving demangler code into different files. This makes it easier to remove the old demangler from the runtime library when we switch to the new symbol mangling.

Also in this commit: remove some unused API functions from the demangler Context.

fixes rdar://problem/30503344
2017-03-09 13:42:43 -08:00
Bob Wilson
21ddc5c087 Update uses of DIBuilder.createPointerType to match LLVM r297320.
This function has a new argument to specify a DWARFAddressSpace value.
There is a default value but since it was not added as the last argument,
Swift needs to update calls that specify the optional pointer type name
argument.
2017-03-09 09:37:15 -08:00
swift-ci
ea32a01911 Merge remote-tracking branch 'origin/master' into master-next 2017-03-09 06:48:43 -08:00
Joe Groff
99ea154151 Merge pull request #7965 from jckarter/invariant-load
Add a `loadInvariant` builtin.
2017-03-09 06:39:42 -08:00
Joe Groff
39ecc53a25 Add a loadInvariant builtin.
Lowers to an invariant load in LLVM; probably useful for SIL too at some point too, but NFC at that level yet.
2017-03-08 21:02:03 -08:00
swift-ci
1417507260 Merge remote-tracking branch 'origin/master' into master-next 2017-03-08 14:28:43 -08:00
Slava Pestov
30f5254cb2 IRGen: Kill uncurryLevel some more 2017-03-08 13:54:31 -08:00
swift-ci
3fb1859256 Merge remote-tracking branch 'origin/master' into master-next 2017-03-07 20:08:49 -08:00
Joe Shajrawi
33b0cf653f Rename unconditional_checked_cast_opaque to unconditional_checked_cast_value 2017-03-07 18:53:52 -08:00
swift-ci
6d361deb26 Merge remote-tracking branch 'origin/master' into master-next 2017-03-07 08:28:51 -08:00
Devin Coughlin
8026026df3 Merge pull request #7925 from devincoughlin/sil_tsan_inout_access_builtin
SIL: Add SIL builtin for Thread Sanitizer inout accesses
2017-03-07 08:10:00 -08:00
swift-ci
3458984e82 Merge remote-tracking branch 'origin/master' into master-next 2017-03-06 19:48:51 -08:00
Devin Coughlin
6ac36df1e7 SIL: Add SIL builtin for Thread Sanitizer inout accesses
...and IRGen it into a call to __tsan_write1 in compiler-rt. This is
preparatory work for a later patch that will add an experimental
option to treat Swift inout accesses as TSan writes.
2017-03-06 19:13:50 -08:00
Joe Shajrawi
ca77872ba8 Merge CheckedCastValueBranch with new master 2017-03-06 17:32:09 -08:00
Joe Shajrawi
1f626304f1 Add support for conditional checked cast instruction for opaque value types + SILGen support for it 2017-03-06 16:35:27 -08:00
swift-ci
b395c3223c Merge remote-tracking branch 'origin/master' into master-next 2017-03-06 13:48:50 -08:00
John McCall
2e4d154e71 Remove Swift's own ConstantBuilder, since it is no longer used. NFC. 2017-03-06 15:15:50 -05:00
John McCall
f0cc98a71e Adopt ConstantInitBuilder in reflection metadata emission. NFC. 2017-03-06 15:15:49 -05:00
John McCall
d61d966451 Use ConstantInitBuilder in most kinds of metadata emission.
This is NFC in intent, but I had to restructure the code to emit more
of the lists "inline", which means I inevitably altered some IRGen
emission patterns in ways that are visible to tests:

- GenClass emits property/ivar/whatever descriptors in a somewhat
  different order.

- An ext method type list is now emitted as just an array, not a struct
  containing only that array.

- Protocol descriptors are no longer emitted as packed structs.

I was sorely tempted to stop using packed structs for all the metadata
emission, but didn't really want to update that many tests in one go.
2017-03-06 14:18:47 -05:00
John McCall
ec667cae55 Adopt ConstantInitBuilder in a few places. 2017-03-06 14:18:47 -05:00
swift-ci
5a485dc655 Merge remote-tracking branch 'origin/master' into master-next 2017-03-04 18:08:41 -08:00
Slava Pestov
776d4cb2b6 IRGen: Fix debug info emission bug with inlining of generics
Always use the VarDecl's parent DC to map the type into context,
instead of the DC of the SILFunction, because the latter might
have the wrong generic signature.

Fixes <rdar://problem/30786168>.
2017-03-04 17:36:48 -08:00
swift-ci
a539eb90e5 Merge remote-tracking branch 'origin/master' into master-next 2017-03-02 18:08:49 -08:00
Michael Gottesman
cfb5893663 [silgen] Fix destroying destructor to use proper ownership with its @owned return value.
rdar://29791263
2017-03-02 17:17:17 -08:00
swift-ci
c5e30a67ff Merge remote-tracking branch 'origin/master' into master-next 2017-03-01 23:08:51 -08:00
John McCall
fe7915d09e Rework a number of SIL and IRGen witness-table abstractions
to correctly handle generalized protocol requirements.

The major missing pieces here are that the conformance search
algorithms in both the AST (type substitution) and IRGen
(witness table reference emission) need to be rewritten to
back-track requirement sources, and the AST needs to actually
represent this stuff in NormalProtocolConformances instead
of just doing ???.

The new generality isn't tested yet; I'm looking into that,
but I wanted to get the abstractions in place first.
2017-03-02 01:34:13 -05:00
swift-ci
a82328f86f Merge remote-tracking branch 'origin/master' into master-next 2017-03-01 19:08:41 -08:00
Michael Gottesman
4bc12aedbd [sil] Add end_lifetime.
This is the lifetime ending variant of fix_lifetime. It is a lie to the
ownership verifier that a value is being consumed along a path. Its intention is
to be used to allow for the static verification of ownership in deallocating
deinits which for compatibility with objective-c have weird ownership behavior.
See the commit merged with this commit for more information.
2017-03-01 18:30:23 -08:00
swift-ci
1c9bf4cf4e Merge remote-tracking branch 'origin/master' into master-next 2017-02-28 22:08:52 -08:00
Slava Pestov
ab6f7c4a21 IRGen: Cache concrete witness tables using the local metadata mechanism
Fixes <rdar://problem/30765842>.
2017-02-28 18:15:23 -08:00
swift-ci
eb7c3e9b05 Merge remote-tracking branch 'origin/master' into master-next 2017-02-27 20:48:40 -08:00
Slava Pestov
0611d663b8 SIL: Remove SILType::getSwiftType() 2017-02-27 20:01:35 -08:00