Skip to content

Conversation

@slavapestov
Copy link
Contributor

When a nominal type declaration from another file was referenced, Sema would validate all of its members, so that SILGen knows the stored property layout of structs, vtable layout for classes and witness table layouts for protocols. However, instead of validating all of the members of each referenced nominal type, it is safe to skip certain members. Tighten this up and add a compiler_scale test using @graydon's framework.

The other patches in this PR are just a couple of small unrelated cleanups.

Previously we were relying on the 'validate for layout' path
validating these, but that's going to change.
For all types, we can safely skip nested nominal types and
typealiases.

For a struct, we only have to look at VarDecls; methods never
affect layout.

Similarly for an enum, only EnumElementDecls matter.

For a class, we still have to look at all methods and properties.
Ideally, in non-optimized builds we would invoke virtual methods
by calling thunks, and only emit the thunks from the translation
unit containing the class. Then the layout of a class will
only be necessary if you subclass the class.

This should improve compiler scalability in multiple-frontend
mode.
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

It looks like we print generic parameters differently from
typealiases created to point to them.
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit 763b58e into swiftlang:master Jan 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant