Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AST] Ill-formed @objc protocols might have associated types. #19754

Merged
merged 3 commits into from Oct 7, 2018

Conversation

DougGregor
Copy link
Member

As an optimization, we don't even look for associated types in @objc
protocols. However, this could lead to broken invariants like "every
associated type has a witness" in ill-formed @objc protocols that do
have associated types.

Implement this optimization by checking whether the protocol has a
Clang node. Fixes rdar://problem/41425828 / SR-8094.

As an optimization, we don't even look for associated types in @objc
protocols. However, this could lead to broken invariants like "every
associated type has a witness" in ill-formed @objc protocols that do
have associated types.

Implement this optimization by checking whether the protocol has a
Clang node. Fixes rdar://problem/41425828 / SR-8094.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@slavapestov
Copy link
Member

Didn’t we add this to minimize deserialization?

@slavapestov
Copy link
Member

@swift-ci Please test compiler performance

@DougGregor
Copy link
Member Author

@slavapestov I thought it was to avoid Clang importer work, but... you are right that it would affect deserialization, too. Sounds like I have a predicate to change!

It also fixed a second existing crasher, so that's good.

…ted types

Thanks to @slavapestov for pointing this out! The optimization to avoid
looking through the members of a protocol that can’t possibly have any
associated types was for both deserialized protocols and imported
protocols, but I only supported the former in my previous change. Check
both cases and make the reasons much more obvious.

Also, that change resolved an existing compiler crasher as well.
This test case crashed at runtime in Swift 4.2, but is now fixed. Add it
so that we don't regress.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

2 similar comments
@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@swift-ci swift-ci merged commit f0447c1 into apple:master Oct 7, 2018
@DougGregor DougGregor deleted the objc-assoc-type-crash branch October 7, 2018 06:21
@swift-ci
Copy link
Collaborator

swift-ci commented Oct 7, 2018

Build comment file:

Summary for master full

Unexpected test results, excluded stats for RxSwift, Fluent, Wordy, ReactiveSwift

No regressions above thresholds

Debug-batch

debug-batch brief

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (3)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 14,435,759,514,236 14,450,274,177,283 14,514,663,047 0.1%
LLVM.NumLLVMBytesOutput 669,772,954 669,772,914 -40 -0.0%
time.swift-driver.wall 1665.7s 1672.8s 7.1s 0.43%

debug-batch detailed

Regressed (0)
name old new delta delta_pct
Improved (2)
name old new delta delta_pct
Driver.NumDriverPipePolls 206,729 201,811 -4,918 -2.38% ✅
Driver.NumDriverPipeReads 227,589 223,954 -3,635 -1.6% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (92)
name old new delta delta_pct
AST.NumASTBytesAllocated 19,660,291,580 19,660,216,684 -74,896 -0.0%
AST.NumDecls 46,276 46,276 0 0.0%
AST.NumDependencies 132,822 132,828 6 0.0%
AST.NumImportedExternalDefinitions 918,497 918,497 0 0.0%
AST.NumInfixOperators 19,744 19,744 0 0.0%
AST.NumLinkLibraries 0 0 0 0.0%
AST.NumLoadedModules 155,889 155,889 0 0.0%
AST.NumLocalTypeDecls 111 111 0 0.0%
AST.NumObjCMethods 13,059 13,059 0 0.0%
AST.NumPostfixOperators 14 14 0 0.0%
AST.NumPrecedenceGroups 9,238 9,238 0 0.0%
AST.NumPrefixOperators 61 61 0 0.0%
AST.NumReferencedDynamicNames 101 101 0 0.0%
AST.NumReferencedMemberNames 2,546,092 2,546,092 0 0.0%
AST.NumReferencedTopLevelNames 164,914 164,914 0 0.0%
AST.NumSourceBuffers 202,723 202,721 -2 -0.0%
AST.NumSourceLines 1,543,329 1,543,329 0 0.0%
AST.NumSourceLinesPerSecond 908,577 905,554 -3,023 -0.33%
AST.NumTotalClangImportedEntities 3,166,228 3,166,228 0 0.0%
AST.NumUsedConformances 145,082 145,082 0 0.0%
Driver.ChildrenMaxRSS 51,294,433,280 51,377,905,664 83,472,384 0.16%
Driver.DriverDepCascadingDynamic 0 0 0 0.0%
Driver.DriverDepCascadingExternal 0 0 0 0.0%
Driver.DriverDepCascadingMember 0 0 0 0.0%
Driver.DriverDepCascadingNominal 0 0 0 0.0%
Driver.DriverDepCascadingTopLevel 0 0 0 0.0%
Driver.DriverDepDynamic 0 0 0 0.0%
Driver.DriverDepExternal 0 0 0 0.0%
Driver.DriverDepMember 0 0 0 0.0%
Driver.DriverDepNominal 0 0 0 0.0%
Driver.DriverDepTopLevel 0 0 0 0.0%
Driver.NumDriverJobsRun 9,752 9,752 0 0.0%
Driver.NumDriverJobsSkipped 0 0 0 0.0%
Driver.NumProcessFailures 0 0 0 0.0%
Frontend.MaxMallocUsage 247,427,012,336 247,285,499,104 -141,513,232 -0.06%
Frontend.NumInstructionsExecuted 14,435,759,514,236 14,450,274,177,283 14,514,663,047 0.1%
Frontend.NumProcessFailures 0 0 0 0.0%
IRModule.NumIRAliases 74,661 74,661 0 0.0%
IRModule.NumIRBasicBlocks 2,505,654 2,505,654 0 0.0%
IRModule.NumIRComdatSymbols 0 0 0 0.0%
IRModule.NumIRFunctions 1,269,701 1,269,701 0 0.0%
IRModule.NumIRGlobals 1,474,461 1,474,461 0 0.0%
IRModule.NumIRIFuncs 0 0 0 0.0%
IRModule.NumIRInsts 27,134,336 27,134,336 0 0.0%
IRModule.NumIRNamedMetaData 47,563 47,563 0 0.0%
IRModule.NumIRValueSymbols 2,447,116 2,447,116 0 0.0%
LLVM.NumLLVMBytesOutput 669,772,954 669,772,914 -40 -0.0%
Parse.NumFunctionsParsed 1,514,438 1,514,438 0 0.0%
Parse.NumIterableDeclContextParsed 535,490 535,490 0 0.0%
SILModule.NumSILGenDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILGenFunctions 1,081,697 1,081,697 0 0.0%
SILModule.NumSILGenGlobalVariables 24,671 24,671 0 0.0%
SILModule.NumSILGenVtables 4,636 4,636 0 0.0%
SILModule.NumSILGenWitnessTables 27,520 27,520 0 0.0%
SILModule.NumSILOptDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILOptFunctions 921,798 921,798 0 0.0%
SILModule.NumSILOptGlobalVariables 25,136 25,136 0 0.0%
SILModule.NumSILOptVtables 8,850 8,850 0 0.0%
SILModule.NumSILOptWitnessTables 55,813 55,813 0 0.0%
Sema.AccessLevelRequest 1,294,909 1,294,909 0 0.0%
Sema.DefaultAndMaxAccessLevelRequest 31,175 31,175 0 0.0%
Sema.EnumRawTypeRequest 10,424 10,424 0 0.0%
Sema.ExtendedNominalRequest 1,943,883 1,943,883 0 0.0%
Sema.InheritedDeclsReferencedRequest 64,388,203 64,388,203 0 0.0%
Sema.InheritedTypeRequest 354,755 354,755 0 0.0%
Sema.IsDynamicRequest 1,192,509 1,192,509 0 0.0%
Sema.IsObjCRequest 997,887 997,887 0 0.0%
Sema.NamedLazyMemberLoadFailureCount 17,527 17,527 0 0.0%
Sema.NamedLazyMemberLoadSuccessCount 14,277,286 14,277,144 -142 -0.0%
Sema.NominalTypeLookupDirectCount 22,708,101 22,708,090 -11 -0.0%
Sema.NumConformancesDeserialized 1,983,977 1,983,977 0 0.0%
Sema.NumConstraintScopes 10,293,642 10,293,642 0 0.0%
Sema.NumConstraintsConsideredForEdgeContraction 19,310,086 19,310,086 0 0.0%
Sema.NumDeclsDeserialized 18,950,884 18,950,886 2 0.0%
Sema.NumDeclsValidated 1,202,422 1,202,422 0 0.0%
Sema.NumFunctionsTypechecked 793,598 793,598 0 0.0%
Sema.NumGenericSignatureBuilders 659,635 659,635 0 0.0%
Sema.NumLazyGenericEnvironments 4,101,780 4,101,781 1 0.0%
Sema.NumLazyGenericEnvironmentsLoaded 94,021 94,021 0 0.0%
Sema.NumLazyIterableDeclContexts 3,907,966 3,907,966 0 0.0%
Sema.NumTypesDeserialized 7,857,342 7,857,342 0 0.0%
Sema.NumTypesValidated 779,440 779,440 0 0.0%
Sema.NumUnloadedLazyIterableDeclContexts 3,151,681 3,151,680 -1 -0.0%
Sema.OverriddenDeclsRequest 1,051,487 1,051,487 0 0.0%
Sema.RequirementRequest 22,731 22,731 0 0.0%
Sema.SelfBoundsFromWhereClauseRequest 63,119 63,119 0 0.0%
Sema.SetterAccessLevelRequest 77,899 77,899 0 0.0%
Sema.SuperclassDeclRequest 53,304,903 53,304,903 0 0.0%
Sema.SuperclassTypeRequest 17,762 17,762 0 0.0%
Sema.TypeDeclsFromWhereClauseRequest 14,456 14,456 0 0.0%
Sema.USRGenerationRequest 234,958 234,958 0 0.0%
Sema.UnderlyingTypeDeclsReferencedRequest 1,791,952 1,791,952 0 0.0%

Release

release brief

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (3)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 17,878,665,015,968 17,878,148,864,419 -516,151,549 -0.0%
LLVM.NumLLVMBytesOutput 567,739,218 567,740,914 1,696 0.0%
time.swift-driver.wall 3383.5s 3383.8s 319.5ms 0.01%

release detailed

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (23)
name old new delta delta_pct
AST.NumImportedExternalDefinitions 170,137 170,137 0 0.0%
AST.NumLoadedModules 10,383 10,383 0 0.0%
AST.NumTotalClangImportedEntities 574,968 574,968 0 0.0%
AST.NumUsedConformances 148,202 148,202 0 0.0%
IRModule.NumIRBasicBlocks 2,454,613 2,454,613 0 0.0%
IRModule.NumIRFunctions 1,024,206 1,024,206 0 0.0%
IRModule.NumIRGlobals 1,145,625 1,145,625 0 0.0%
IRModule.NumIRInsts 19,813,748 19,813,748 0 0.0%
IRModule.NumIRValueSymbols 2,003,430 2,003,430 0 0.0%
LLVM.NumLLVMBytesOutput 567,739,218 567,740,914 1,696 0.0%
SILModule.NumSILGenFunctions 440,235 440,235 0 0.0%
SILModule.NumSILOptFunctions 630,729 630,729 0 0.0%
Sema.NumConformancesDeserialized 1,272,623 1,272,623 0 0.0%
Sema.NumConstraintScopes 10,041,431 10,041,431 0 0.0%
Sema.NumDeclsDeserialized 3,849,255 3,849,255 0 0.0%
Sema.NumDeclsValidated 565,369 565,369 0 0.0%
Sema.NumFunctionsTypechecked 341,855 341,855 0 0.0%
Sema.NumGenericSignatureBuilders 119,748 119,748 0 0.0%
Sema.NumLazyGenericEnvironments 811,187 811,187 0 0.0%
Sema.NumLazyGenericEnvironmentsLoaded 15,845 15,845 0 0.0%
Sema.NumLazyIterableDeclContexts 502,530 502,530 0 0.0%
Sema.NumTypesDeserialized 2,170,685 2,170,685 0 0.0%
Sema.NumTypesValidated 249,617 249,617 0 0.0%

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.

None yet

3 participants