Skip to content

[sema] Add the ability for VarDecls to have parent VarDecls and wire up the VarDecl linked list #23378

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

Merged

Conversation

gottesmm
Copy link
Contributor

This will enable @akyrtzi and @nathawes to change refactoring/edit-all in scope to use this functionality so that when I add CaseBodyVarDecls refactoring doesn't break and we still have the improved IDE experience.

rdar://problem/47467128

@gottesmm gottesmm requested a review from akyrtzi March 18, 2019 07:12
@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

@swift-ci test compiler performance

@swift-ci
Copy link
Contributor

Summary for master full

Unexpected test results, excluded stats for ProcedureKit, Tagged, Wordy, Deferred, CoreStore

Regressions found (see below)

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 26,845,080,231,038 27,041,694,250,837 196,614,019,799 0.73%
LLVM.NumLLVMBytesOutput 964,208,624 964,210,258 1,634 0.0%
time.swift-driver.wall 2552.7s 2560.8s 8.1s 0.32%

debug-batch detailed

Regressed (3)
name old new delta delta_pct
AST.NumASTBytesAllocated 65,161,689,554 66,294,894,010 1,133,204,456 1.74% ⛔
Sema.OverriddenDeclsRequest 7,288,834 7,438,503 149,669 2.05% ⛔
Sema.USRGenerationRequest 12,161,049 12,440,576 279,527 2.3% ⛔
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (96)
name old new delta delta_pct
AST.NumDecls 80,388 80,388 0 0.0%
AST.NumDependencies 204,303 204,299 -4 -0.0%
AST.NumImportedExternalDefinitions 1,084,910 1,084,910 0 0.0%
AST.NumInfixOperators 30,900 30,900 0 0.0%
AST.NumLinkLibraries 0 0 0 0.0%
AST.NumLoadedModules 243,405 243,405 0 0.0%
AST.NumLocalTypeDecls 108 108 0 0.0%
AST.NumObjCMethods 9,687 9,687 0 0.0%
AST.NumPostfixOperators 18 18 0 0.0%
AST.NumPrecedenceGroups 14,446 14,446 0 0.0%
AST.NumPrefixOperators 70 70 0 0.0%
AST.NumReferencedDynamicNames 91 91 0 0.0%
AST.NumReferencedMemberNames 3,491,615 3,491,615 0 0.0%
AST.NumReferencedTopLevelNames 269,687 269,687 0 0.0%
AST.NumSourceBuffers 330,950 330,950 0 0.0%
AST.NumSourceLines 2,419,104 2,419,104 0 0.0%
AST.NumSourceLinesPerSecond 2,158,900 2,156,276 -2,624 -0.12%
AST.NumTotalClangImportedEntities 4,102,965 4,107,320 4,355 0.11%
AST.NumUsedConformances 225,744 225,744 0 0.0%
Driver.ChildrenMaxRSS 105,608,175,616 105,410,533,376 -197,642,240 -0.19%
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 16,141 16,141 0 0.0%
Driver.NumDriverJobsSkipped 0 0 0 0.0%
Driver.NumDriverPipePolls 161,329 162,893 1,564 0.97%
Driver.NumDriverPipeReads 177,335 178,729 1,394 0.79%
Driver.NumProcessFailures 0 0 0 0.0%
Frontend.MaxMallocUsage 680,654,011,136 684,531,992,800 3,877,981,664 0.57%
Frontend.NumInstructionsExecuted 26,845,080,231,038 27,041,694,250,837 196,614,019,799 0.73%
Frontend.NumProcessFailures 0 0 0 0.0%
IRModule.NumIRAliases 107,127 107,127 0 0.0%
IRModule.NumIRBasicBlocks 3,823,507 3,823,507 0 0.0%
IRModule.NumIRComdatSymbols 0 0 0 0.0%
IRModule.NumIRFunctions 1,790,242 1,790,242 0 0.0%
IRModule.NumIRGlobals 1,848,694 1,848,694 0 0.0%
IRModule.NumIRIFuncs 0 0 0 0.0%
IRModule.NumIRInsts 46,890,851 46,890,851 0 0.0%
IRModule.NumIRNamedMetaData 78,122 78,122 0 0.0%
IRModule.NumIRValueSymbols 3,282,973 3,282,973 0 0.0%
LLVM.NumLLVMBytesOutput 964,208,624 964,210,258 1,634 0.0%
Parse.NumFunctionsParsed 141,858 141,858 0 0.0%
Parse.NumIterableDeclContextParsed 1,000,666 1,000,666 0 0.0%
SILModule.NumSILGenDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILGenFunctions 925,652 925,652 0 0.0%
SILModule.NumSILGenGlobalVariables 37,118 37,118 0 0.0%
SILModule.NumSILGenVtables 10,668 10,668 0 0.0%
SILModule.NumSILGenWitnessTables 39,057 39,057 0 0.0%
SILModule.NumSILOptDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILOptFunctions 1,311,433 1,311,433 0 0.0%
SILModule.NumSILOptGlobalVariables 37,865 37,865 0 0.0%
SILModule.NumSILOptVtables 17,156 17,156 0 0.0%
SILModule.NumSILOptWitnessTables 85,971 85,971 0 0.0%
Sema.AccessLevelRequest 2,317,657 2,322,852 5,195 0.22%
Sema.DefaultAndMaxAccessLevelRequest 54,319 54,319 0 0.0%
Sema.DefaultTypeRequest 315,699 315,699 0 0.0%
Sema.EnumRawTypeRequest 16,934 16,934 0 0.0%
Sema.ExtendedNominalRequest 3,689,965 3,701,429 11,464 0.31%
Sema.InheritedDeclsReferencedRequest 4,397,283 4,404,132 6,849 0.16%
Sema.InheritedTypeRequest 527,873 528,049 176 0.03%
Sema.IsDynamicRequest 1,820,123 1,820,123 0 0.0%
Sema.IsObjCRequest 1,553,512 1,555,515 2,003 0.13%
Sema.MangleLocalTypeDeclRequest 216 216 0 0.0%
Sema.NamedLazyMemberLoadFailureCount 18,842 18,805 -37 -0.2%
Sema.NamedLazyMemberLoadSuccessCount 17,302,453 17,306,923 4,470 0.03%
Sema.NominalTypeLookupDirectCount 28,873,905 28,922,990 49,085 0.17%
Sema.NumConformancesDeserialized 6,426,802 6,476,139 49,337 0.77%
Sema.NumConstraintScopes 14,715,065 14,721,673 6,608 0.04%
Sema.NumConstraintsConsideredForEdgeContraction 38,454,398 38,454,973 575 0.0%
Sema.NumDeclsDeserialized 47,215,897 47,573,741 357,844 0.76%
Sema.NumDeclsFinalized 1,634,523 1,634,523 0 0.0%
Sema.NumDeclsTypechecked 890,758 890,758 0 0.0%
Sema.NumDeclsValidated 1,934,302 1,934,359 57 0.0%
Sema.NumFunctionsTypechecked 942,937 942,937 0 0.0%
Sema.NumGenericSignatureBuilders 1,130,997 1,136,192 5,195 0.46%
Sema.NumLazyGenericEnvironments 9,494,419 9,573,590 79,171 0.83%
Sema.NumLazyGenericEnvironmentsLoaded 194,674 194,706 32 0.02%
Sema.NumLazyIterableDeclContexts 6,634,032 6,647,732 13,700 0.21%
Sema.NumLeafScopes 9,642,302 9,648,084 5,782 0.06%
Sema.NumTypesDeserialized 15,917,299 15,990,928 73,629 0.46%
Sema.NumTypesValidated 1,310,165 1,310,227 62 0.0%
Sema.NumUnloadedLazyIterableDeclContexts 4,384,706 4,374,177 -10,529 -0.24%
Sema.RequirementRequest 62,131 62,142 11 0.02%
Sema.SelfBoundsFromWhereClauseRequest 6,183,521 6,199,347 15,826 0.26%
Sema.SetterAccessLevelRequest 136,606 136,606 0 0.0%
Sema.SuperclassDeclRequest 66,774 66,858 84 0.13%
Sema.SuperclassTypeRequest 30,680 30,680 0 0.0%
Sema.TypeDeclsFromWhereClauseRequest 29,871 29,871 0 0.0%
Sema.UnderlyingTypeDeclsReferencedRequest 193,992 194,441 449 0.23%

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 25,595,284,696,394 25,603,050,798,840 7,766,102,446 0.03%
LLVM.NumLLVMBytesOutput 785,393,508 785,392,280 -1,228 -0.0%
time.swift-driver.wall 4583.9s 4582.7s -1.1s -0.02%

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 214,665 214,665 0 0.0%
AST.NumLoadedModules 16,334 16,334 0 0.0%
AST.NumTotalClangImportedEntities 729,870 729,870 0 0.0%
AST.NumUsedConformances 226,707 226,707 0 0.0%
IRModule.NumIRBasicBlocks 3,233,344 3,233,344 0 0.0%
IRModule.NumIRFunctions 1,491,690 1,491,690 0 0.0%
IRModule.NumIRGlobals 1,629,515 1,629,515 0 0.0%
IRModule.NumIRInsts 29,474,351 29,474,351 0 0.0%
IRModule.NumIRValueSymbols 2,908,733 2,908,733 0 0.0%
LLVM.NumLLVMBytesOutput 785,393,508 785,392,280 -1,228 -0.0%
SILModule.NumSILGenFunctions 649,405 649,405 0 0.0%
SILModule.NumSILOptFunctions 883,157 883,157 0 0.0%
Sema.NumConformancesDeserialized 2,207,967 2,207,967 0 0.0%
Sema.NumConstraintScopes 13,080,935 13,080,935 0 0.0%
Sema.NumDeclsDeserialized 5,959,238 5,959,238 0 0.0%
Sema.NumDeclsValidated 1,031,871 1,031,871 0 0.0%
Sema.NumFunctionsTypechecked 426,107 426,107 0 0.0%
Sema.NumGenericSignatureBuilders 188,939 188,939 0 0.0%
Sema.NumLazyGenericEnvironments 1,232,035 1,232,035 0 0.0%
Sema.NumLazyGenericEnvironmentsLoaded 20,965 20,965 0 0.0%
Sema.NumLazyIterableDeclContexts 758,183 758,183 0 0.0%
Sema.NumTypesDeserialized 3,156,763 3,156,763 0 0.0%
Sema.NumTypesValidated 613,443 613,443 0 0.0%

@gottesmm gottesmm requested a review from nathawes March 18, 2019 18:32
Copy link
Contributor

@nathawes nathawes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I only noticed a couple of really trivial things going through, so feel free to leave them for later.

… a different var decl.

I did not wire anything up to it.

This is in preparation for fixing issues around SILGenPattern fallthrough
emission and bad rename/edit all in scope of case stmt var decls. Specifically,
I am going to ensure that we can get from any VarDecl in the following to any
other VarDecl:

switch x {
case .a(let v1, let v2), .b(let v1, let v2):
  ...
  fallthrough
case .c(let v1, let v2), .d(let v1, let v2):
  ...
}

This will be done by:

1. Pointing the var decls in .d at the corresponding var decls in .c.
2. Pointing the var decls in .c at the corresponding var decls in .b.
3. Pointing the var decls in .b at the corresponding var decls in .a.
4. Pointing the var decls in .a at the case stmt. Recognizing that we are asking
for the next VarDecl, but have a case stmt, we check if we have a fallthrough
case stmt (which I am going to add in a subsequent commit). If so, follow down
the fallthrough case stmts until you find a fallthrough case stmt that doesn't
fallthrough itself and then return the corresponding var decl in the last case
label item in that var decl (in the above .d).

I also put in some asserts to make sure that we never try to vend a parent value
that is a nullptr.

rdar://47467128
This is in preparation for fixing issues around SILGenPattern fallthrough
emission and bad rename/edit all in scope of case stmt var decls. Specifically,
I am going to ensure that we can get from any VarDecl in the following to any
other VarDecl:

switch x {
case .a(let v1, let v2), .b(let v1, let v2):
  ...
  fallthrough
case .c(let v1, let v2), .d(let v1, let v2):
  ...
}

This will be done by:

1. Pointing the var decls in .d at the corresponding var decls in .c.
2. Pointing the var decls in .c at the corresponding var decls in .b.
3. Pointing the var decls in .b at the corresponding var decls in .a.
4. Pointing the var decls in .a at the case stmt. Recognizing that we are asking
for the next VarDecl, but have a case stmt, we check if we have a fallthrough
case stmt. If so, follow down the fallthrough case stmts until you find a
fallthrough case stmt that doesn't fallthrough itself and then return the
corresponding var decl in the last case label item in that var decl (in the
above .d).

In a subsequent commit I am going to add case body var decls. The only change as
a result of that is that I will insert them into the VarDecl double linked list
after the last case var decl of each case stmt.
@gottesmm gottesmm force-pushed the pr-5d07f093c8b0891046d822d507c526e7ec6cfc1d branch from 2008cad to b1a7b48 Compare March 18, 2019 21:13
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

3 similar comments
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@swift-ci swift-ci merged commit 611534c into swiftlang:master Mar 18, 2019
@gottesmm gottesmm deleted the pr-5d07f093c8b0891046d822d507c526e7ec6cfc1d branch March 19, 2019 01:02
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.

3 participants