Skip to content

Conversation

DougGregor
Copy link
Member

It is possible for the SIL optimizers, IRGen, etc. to request information
from the AST that only the type checker can provide, but the type checker
is typically torn down after the “type checking” phase. This can lead to
various crashes late in the compilation cycle.

Keep the type checker instance around as long as the ASTContext is alive
or until someone asks for it to be destroyed.

Fixes SR-285 / rdar://problem/23677338.

Doing this relies on type checker state getting wiped out in between SIL
declarations, which is odd.
It is possible for the SIL optimizers, IRGen, etc. to request information
from the AST that only the type checker can provide, but the type checker
is typically torn down after the “type checking” phase. This can lead to
various crashes late in the compilation cycle.

Keep the type checker instance around as long as the ASTContext is alive
or until someone asks for it to be destroyed.

Fixes SR-285 / rdar://problem/23677338.
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@DougGregor
Copy link
Member Author

@swift-ci please smoke test compiler performance

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 599e07e

@swift-ci
Copy link
Contributor

Build comment file:

Summary for master smoketest

Unexpected test results, excluded stats for Kingfisher, ReactiveCocoa

Regressions found (see below)

Debug

debug 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 182,643,279,658 182,728,161,393 84,881,735 0.05%
LLVM.NumLLVMBytesOutput 9,495,152 9,495,152 0 0.0%
time.swift-driver.wall 23.4s 23.4s 15.5ms 0.07%

debug 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 4,559 4,559 0 0.0%
AST.NumLoadedModules 1,578 1,578 0 0.0%
AST.NumTotalClangImportedEntities 17,921 17,921 0 0.0%
AST.NumUsedConformances 1,352 1,352 0 0.0%
IRModule.NumIRBasicBlocks 32,527 32,527 0 0.0%
IRModule.NumIRFunctions 16,460 16,460 0 0.0%
IRModule.NumIRGlobals 14,145 14,145 0 0.0%
IRModule.NumIRInsts 443,820 443,820 0 0.0%
IRModule.NumIRValueSymbols 29,340 29,340 0 0.0%
LLVM.NumLLVMBytesOutput 9,495,152 9,495,152 0 0.0%
SILModule.NumSILGenFunctions 7,843 7,843 0 0.0%
SILModule.NumSILOptFunctions 10,695 10,695 0 0.0%
Sema.NumConformancesDeserialized 23,229 23,229 0 0.0%
Sema.NumConstraintScopes 70,308 70,308 0 0.0%
Sema.NumDeclsDeserialized 229,254 229,254 0 0.0%
Sema.NumDeclsValidated 16,641 16,641 0 0.0%
Sema.NumFunctionsTypechecked 6,090 6,090 0 0.0%
Sema.NumGenericSignatureBuilders 7,320 7,391 71 0.97%
Sema.NumLazyGenericEnvironments 52,371 52,371 0 0.0%
Sema.NumLazyGenericEnvironmentsLoaded 2,363 2,363 0 0.0%
Sema.NumLazyIterableDeclContexts 43,925 43,925 0 0.0%
Sema.NumTypesDeserialized 100,312 100,312 0 0.0%
Sema.NumTypesValidated 14,185 14,185 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 222,304,333,122 222,299,961,234 -4,371,888 -0.0%
LLVM.NumLLVMBytesOutput 10,617,520 10,617,512 -8 -0.0%
time.swift-driver.wall 41.2s 41.1s -145.2ms -0.35%

release detailed

Regressed (1)
name old new delta delta_pct
Sema.NumGenericSignatureBuilders 2,025 2,079 54 2.67% ⛔
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (22)
name old new delta delta_pct
AST.NumImportedExternalDefinitions 1,111 1,111 0 0.0%
AST.NumLoadedModules 105 105 0 0.0%
AST.NumTotalClangImportedEntities 4,574 4,574 0 0.0%
AST.NumUsedConformances 1,354 1,354 0 0.0%
IRModule.NumIRBasicBlocks 34,490 34,490 0 0.0%
IRModule.NumIRFunctions 15,010 15,010 0 0.0%
IRModule.NumIRGlobals 13,678 13,678 0 0.0%
IRModule.NumIRInsts 333,002 333,002 0 0.0%
IRModule.NumIRValueSymbols 27,634 27,634 0 0.0%
LLVM.NumLLVMBytesOutput 10,617,520 10,617,512 -8 -0.0%
SILModule.NumSILGenFunctions 6,076 6,076 0 0.0%
SILModule.NumSILOptFunctions 9,042 9,042 0 0.0%
Sema.NumConformancesDeserialized 15,090 15,090 0 0.0%
Sema.NumConstraintScopes 69,604 69,419 -185 -0.27%
Sema.NumDeclsDeserialized 45,610 45,610 0 0.0%
Sema.NumDeclsValidated 10,362 10,362 0 0.0%
Sema.NumFunctionsTypechecked 4,162 4,162 0 0.0%
Sema.NumLazyGenericEnvironments 10,068 10,068 0 0.0%
Sema.NumLazyGenericEnvironmentsLoaded 201 201 0 0.0%
Sema.NumLazyIterableDeclContexts 5,826 5,826 0 0.0%
Sema.NumTypesDeserialized 26,691 26,691 0 0.0%
Sema.NumTypesValidated 7,103 7,103 0 0.0%

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

1 similar comment
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor merged commit a9315e9 into swiftlang:master Oct 11, 2018
@DougGregor DougGregor deleted the immortal-type-checker branch October 11, 2018 04:38
@gottesmm
Copy link
Contributor

+1!

slavapestov added a commit to slavapestov/swift that referenced this pull request Dec 4, 2018
I believe this was fixed by swiftlang#19825,
but this specific case with bitfield accessors is tricky so let's
test it explicity.
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