Commit Graph

19 Commits

Author SHA1 Message Date
Jordan Rose
66189ffac9 Convert many more classes to use llvm::TrailingObjects.
I only intend to do SIL instructions after this; I'm leaving the runtime alone.
2016-02-09 08:57:19 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
John McCall
8f30faa4c1 Include access functions for the metadata and witness tables
of associated types in protocol witness tables.

We use the global access functions when the result isn't
dependent, and a simple accessor when the result can be cheaply
recovered from the conforming metadata.  Otherwise, we add a
cache slot to a private section of the witness table, forcing
an instantiation per conformance.  Like generic type metadata,
concrete instantiations of generic conformances are memoized.

There's a fair amount of code in this patch that can't be
dynamically tested at the moment because of the widespread
reliance on recursive expansion of archetypes / dependent
types.  That's something we're now theoretically in a position
to change, and as we do so, we'll test more of this code.

This speculatively re-applies 7576a91009,
i.e. reverts commit 11ab3d537f.
We have not been able to duplicate the build failure in
independent testing; it might have been spurious or unrelated.
2015-12-29 12:14:40 -08:00
Dmitri Gribenko
11ab3d537f Revert "Include access functions for the metadata and witness tables"
This reverts commit 7576a91009.
It broke the testsuite for swift-corelibs-foundation.
2015-12-25 19:17:50 +02:00
John McCall
7576a91009 Include access functions for the metadata and witness tables
of associated types in protocol witness tables.

We use the global access functions when the result isn't
dependent, and a simple accessor when the result can be cheaply
recovered from the conforming metadata.  Otherwise, we add a
cache slot to a private section of the witness table, forcing
an instantiation per conformance.  Like generic type metadata,
concrete instantiations of generic conformances are memoized.

There's a fair amount of code in this patch that can't be
dynamically tested at the moment because of the widespread
reliance on recursive expansion of archetypes / dependent
types.  That's something we're now theoretically in a position
to change, and as we do so, we'll test more of this code.

This reverts commit 6528ec2887, i.e.
it reapplies b1e3120a28, with a fix
to unbreak release builds.
2015-12-24 20:21:17 -08:00
Sean Callanan
6528ec2887 Revert "Include access functions for the metadata and witness tables"
This reverts commit b1e3120a28.

Reverting because this patch uses WitnessTableBuilder::PI in NDEBUG code.
That field only exists when NDEBUG is not defined, but now NextCacheIndex, a
field that exists regardless, is being updated based on information from PI.

This problem means that Release builds do not work.
2015-12-23 15:42:10 -08:00
John McCall
b1e3120a28 Include access functions for the metadata and witness tables
of associated types in protocol witness tables.

We use the global access functions when the result isn't
dependent, and a simple accessor when the result can be cheaply
recovered from the conforming metadata.  Otherwise, we add a
cache slot to a private section of the witness table, forcing
an instantiation per conformance.  Like generic type metadata,
concrete instantiations of generic conformances are memoized.

There's a fair amount of code in this patch that can't be
dynamically tested at the moment because of the widespread
reliance on recursive expansion of archetypes / dependent
types.  That's something we're now theoretically in a position
to change, and as we do so, we'll test more of this code.
2015-12-23 00:37:24 -08:00
John McCall
76e324a950 Refactors leading towards the use of protocol witness table access functions.
This re-applies r32541 with a few changes to the demangling logic and associated test fixes.

Swift SVN r32553
2015-10-09 05:49:18 +00:00
Erik Eckstein
19bb23a63f Revert r32541 "Refactors leading towards the use of protocol witness table access functions."
It broke the build: 2 demangle tests failed.




Swift SVN r32552
2015-10-09 04:42:19 +00:00
John McCall
9af9b9914d Refactors leading towards the use of protocol witness table
access functions.  NFC for now.

Swift SVN r32541
2015-10-09 01:06:06 +00:00
Joe Groff
5728bf81fd IRGen: Don't lay out associated type witness table slots for protocols that don't need them.
Fix a layout discrepancy when an associated type had @objc protocol constraints, in which case WitnessTableLayout would reserve a slot for the witness table, but WitnessTableBuilder would never emit it. Also add assertions to WitnessTableBuilder that check that the witness table we're building follows the claimed WitnessTableLayout. Fixes rdar://problem/20418117.

Swift SVN r26953
2015-04-03 20:44:25 +00:00
Joe Groff
d12fb5a20b IRGen: Accept the existence of init requirements in protocols.
Make WitnessVisitor not freak out when it sees an init requirement, allowing 'init' requirements to be used in non-@objc protocols. Fixes <rdar://problem/13695680>.

Swift SVN r14744
2014-03-06 19:24:37 +00:00
Doug Gregor
1ddb34fb71 Factor generic parameters and associated types into their own decl nodes.
Previously, TypeAliasDecl was used for typealiases, generic
parameters, and assocaited types, which is hideous and the source of
much confusion. Factor the latter two out into their own decl nodes,
with a common abstract base for "type parameters", and push these
nodes throughout the frontend.

No real functionality change, but this is a step toward uniquing
polymorphic types, among other things.


Swift SVN r7345
2013-08-19 23:36:58 +00:00
Dmitri Hrybenko
d0455ca1c6 Remove unneeded llvm:: qualifier for llvm::ArrayRef
Swift SVN r7093
2013-08-09 20:05:02 +00:00
Joe Groff
239f5aee8c IRGen: Include associated types in witness table layout.
Reserve slots in protocol witness table layout to drop in associated type metadata and witnesses. To actually populate these, we'll need to move the ABI to lazy conformance-instantiation functions.

Swift SVN r6702
2013-07-29 19:03:43 +00:00
Joe Groff
7a1009fc9f IRGen: Remove value witnesses from protocol witness tables.
The value witnesses are always available through type metadata (through an extra indirection). Saving that indirection costs 16 words (and growing!) in every witness table, and when we start instantiating conformances for generic instances, would require us to instantiate practically every generic witness table. Removing the value witnesses from the protocol witness table means we will only need to instantiate witness tables when associated types are dependent on the conforming type's type variables.

This is an ABI break, but should have no user-visible functional change.

Swift SVN r6651
2013-07-26 20:55:04 +00:00
John McCall
c74ad61247 Extract functions to work with value witnesses into their own file.
Swift SVN r4924
2013-04-26 21:33:21 +00:00
John McCall
ee012c0903 Make IR-gen use canonical types as the basic type currency.
This is kindof a pain in a few places where the type system
doesn't propagate canonicality.  Also, member initializations
are always direct-initializations and so are allowed to use
explicit constructors, which is a hole in our canonicality
tracking.  But overall I like the idea of always working
with canonical types.

Swift SVN r2893
2012-09-21 07:53:08 +00:00
John McCall
85bdae402e Restructure code to permit protocols to be converted independently
of a ProtocolType.

Swift SVN r2242
2012-06-25 20:45:00 +00:00