Skip to content

[Serialization] Break up getDeclCheckedImpl into a helper class #22610

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
merged 9 commits into from
Feb 16, 2019

Conversation

jrose-apple
Copy link
Contributor

@jrose-apple jrose-apple commented Feb 14, 2019

The motivation here is to split the one big switch into many more reasonable-sized methods, which makes the file a little easier to read and should give us better backtraces. It also turned out to clean up several kinds of ad hoc local state.

No functionality change. I suggest reviewing commit by commit, and skipping the big one (just assume I got it right; I was very careful not to improve anything during that commit).

In preparation for splitting up one big switch into many small
methods. Well, medium-sized methods.

No functionality change.
...as a proof of concept. The next commit will move them /all/ out of
line.

(The intent here is to produce better backtraces when not recovering
from errors.)
...for decl attributes. Also, rename to DeclDeserializer.
And cache the ASTContext pointer for convenience.
Now we have a separate function for each serialized declaration kind!
Much cleaner, still NFC.
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test compiler performance

@davidungar
Copy link
Contributor

Great thing to do!

@swift-ci
Copy link
Contributor

Summary for master full

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

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 24,889,722,323,397 24,866,395,018,374 -23,327,305,023 -0.09%
LLVM.NumLLVMBytesOutput 987,363,728 987,368,250 4,522 0.0%
time.swift-driver.wall 2405.8s 2399.7s -6.1s -0.25%

debug-batch 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) (99)
name old new delta delta_pct
AST.NumASTBytesAllocated 58,671,402,102 58,429,646,794 -241,755,308 -0.41%
AST.NumDecls 80,370 80,370 0 0.0%
AST.NumDependencies 159,721 159,726 5 0.0%
AST.NumImportedExternalDefinitions 912,333 912,333 0 0.0%
AST.NumInfixOperators 30,936 30,936 0 0.0%
AST.NumLinkLibraries 0 0 0 0.0%
AST.NumLoadedModules 194,875 194,875 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,464 14,464 0 0.0%
AST.NumPrefixOperators 70 70 0 0.0%
AST.NumReferencedDynamicNames 91 91 0 0.0%
AST.NumReferencedMemberNames 3,491,495 3,491,495 0 0.0%
AST.NumReferencedTopLevelNames 269,721 269,721 0 0.0%
AST.NumSourceBuffers 233,560 233,560 0 0.0%
AST.NumSourceLines 2,418,773 2,418,773 0 0.0%
AST.NumSourceLinesPerSecond 2,170,625 2,170,999 374 0.02%
AST.NumTotalClangImportedEntities 3,556,240 3,551,372 -4,868 -0.14%
AST.NumUsedConformances 225,787 225,787 0 0.0%
Driver.ChildrenMaxRSS 106,263,554,048 106,502,926,336 239,372,288 0.23%
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 235,345 235,337 -8 -0.0%
Driver.NumDriverPipeReads 252,165 251,164 -1,001 -0.4%
Driver.NumProcessFailures 0 0 0 0.0%
Frontend.MaxMallocUsage 578,457,653,368 577,571,745,456 -885,907,912 -0.15%
Frontend.NumInstructionsExecuted 24,889,722,323,397 24,866,395,018,374 -23,327,305,023 -0.09%
Frontend.NumProcessFailures 0 0 0 0.0%
IRModule.NumIRAliases 107,112 107,112 0 0.0%
IRModule.NumIRBasicBlocks 3,815,650 3,815,650 0 0.0%
IRModule.NumIRComdatSymbols 0 0 0 0.0%
IRModule.NumIRFunctions 1,785,131 1,785,131 0 0.0%
IRModule.NumIRGlobals 1,843,975 1,843,975 0 0.0%
IRModule.NumIRIFuncs 0 0 0 0.0%
IRModule.NumIRInsts 45,995,702 45,995,702 0 0.0%
IRModule.NumIRNamedMetaData 78,122 78,122 0 0.0%
IRModule.NumIRValueSymbols 3,272,632 3,272,632 0 0.0%
LLVM.NumLLVMBytesOutput 987,363,728 987,368,250 4,522 0.0%
Parse.NumFunctionsParsed 141,840 141,840 0 0.0%
Parse.NumIterableDeclContextParsed 705,668 705,668 0 0.0%
SILModule.NumSILGenDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILGenFunctions 925,412 925,412 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,314,249 1,314,249 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,129,286 2,128,008 -1,278 -0.06%
Sema.DefaultAndMaxAccessLevelRequest 49,366 49,359 -7 -0.01%
Sema.DefaultTypeRequest 311,866 311,866 0 0.0%
Sema.EnumRawTypeRequest 15,028 15,028 0 0.0%
Sema.ExtendedNominalRequest 3,110,822 3,106,026 -4,796 -0.15%
Sema.InheritedDeclsReferencedRequest 3,952,412 3,936,742 -15,670 -0.4%
Sema.InheritedTypeRequest 564,111 563,751 -360 -0.06%
Sema.IsDynamicRequest 1,670,040 1,670,040 0 0.0%
Sema.IsObjCRequest 1,423,696 1,423,369 -327 -0.02%
Sema.MangleLocalTypeDeclRequest 216 216 0 0.0%
Sema.NamedLazyMemberLoadFailureCount 16,854 16,813 -41 -0.24%
Sema.NamedLazyMemberLoadSuccessCount 16,064,846 16,062,431 -2,415 -0.02%
Sema.NominalTypeLookupDirectCount 27,161,044 27,134,320 -26,724 -0.1%
Sema.NumConformancesDeserialized 6,011,470 5,986,381 -25,089 -0.42%
Sema.NumConstraintScopes 17,047,297 17,043,989 -3,308 -0.02%
Sema.NumConstraintsConsideredForEdgeContraction 54,211,244 54,210,260 -984 -0.0%
Sema.NumDeclsDeserialized 42,483,264 42,326,216 -157,048 -0.37%
Sema.NumDeclsFinalized 1,490,104 1,490,104 0 0.0%
Sema.NumDeclsTypechecked 890,820 890,820 0 0.0%
Sema.NumDeclsValidated 1,803,127 1,803,127 0 0.0%
Sema.NumFunctionsTypechecked 842,239 842,239 0 0.0%
Sema.NumGenericSignatureBuilders 991,626 989,970 -1,656 -0.17%
Sema.NumLazyGenericEnvironments 8,319,417 8,303,093 -16,324 -0.2%
Sema.NumLazyGenericEnvironmentsLoaded 188,303 188,187 -116 -0.06%
Sema.NumLazyIterableDeclContexts 5,573,902 5,566,523 -7,379 -0.13%
Sema.NumLeafScopes 11,192,565 11,189,866 -2,699 -0.02%
Sema.NumTypesDeserialized 13,938,358 13,910,219 -28,139 -0.2%
Sema.NumTypesValidated 1,220,861 1,220,861 0 0.0%
Sema.NumUnloadedLazyIterableDeclContexts 3,537,126 3,538,215 1,089 0.03%
Sema.OverriddenDeclsRequest 6,914,909 6,868,792 -46,117 -0.67%
Sema.RequirementRequest 59,771 59,771 0 0.0%
Sema.SelfBoundsFromWhereClauseRequest 5,543,269 5,522,455 -20,814 -0.38%
Sema.SetterAccessLevelRequest 125,685 125,685 0 0.0%
Sema.SuperclassDeclRequest 59,084 58,929 -155 -0.26%
Sema.SuperclassTypeRequest 28,423 28,423 0 0.0%
Sema.TypeDeclsFromWhereClauseRequest 27,880 27,873 -7 -0.03%
Sema.USRGenerationRequest 11,760,392 11,659,520 -100,872 -0.86%
Sema.UnderlyingTypeDeclsReferencedRequest 176,150 175,727 -423 -0.24%

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,764,922,891,826 25,762,895,599,618 -2,027,292,208 -0.01%
LLVM.NumLLVMBytesOutput 797,485,042 797,486,922 1,880 0.0%
time.swift-driver.wall 4070.8s 4073.6s 2.7s 0.07%

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,765 214,765 0 0.0%
AST.NumLoadedModules 16,334 16,334 0 0.0%
AST.NumTotalClangImportedEntities 730,572 730,572 0 0.0%
AST.NumUsedConformances 226,749 226,749 0 0.0%
IRModule.NumIRBasicBlocks 3,257,128 3,257,128 0 0.0%
IRModule.NumIRFunctions 1,506,634 1,506,634 0 0.0%
IRModule.NumIRGlobals 1,628,725 1,628,725 0 0.0%
IRModule.NumIRInsts 29,746,978 29,746,978 0 0.0%
IRModule.NumIRValueSymbols 2,922,283 2,922,283 0 0.0%
LLVM.NumLLVMBytesOutput 797,485,042 797,486,922 1,880 0.0%
SILModule.NumSILGenFunctions 649,195 649,195 0 0.0%
SILModule.NumSILOptFunctions 880,083 880,083 0 0.0%
Sema.NumConformancesDeserialized 2,204,843 2,204,843 0 0.0%
Sema.NumConstraintScopes 15,464,562 15,464,562 0 0.0%
Sema.NumDeclsDeserialized 5,933,062 5,933,062 0 0.0%
Sema.NumDeclsValidated 1,031,564 1,031,564 0 0.0%
Sema.NumFunctionsTypechecked 426,148 426,148 0 0.0%
Sema.NumGenericSignatureBuilders 188,574 188,574 0 0.0%
Sema.NumLazyGenericEnvironments 1,221,206 1,221,206 0 0.0%
Sema.NumLazyGenericEnvironmentsLoaded 21,364 21,364 0 0.0%
Sema.NumLazyIterableDeclContexts 750,200 750,200 0 0.0%
Sema.NumTypesDeserialized 3,131,609 3,131,609 0 0.0%
Sema.NumTypesValidated 613,297 613,297 0 0.0%

Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

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

Nice!

@jrose-apple
Copy link
Contributor Author

Checking to make sure nothing's changed in the last few days…

@swift-ci Please smoke test

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.

4 participants