Skip to content

SILGen: Fix emission of keypath getter/setter when generic signature has only concrete parameters #23467

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

Conversation

aschwaighofer
Copy link
Contributor

We used to crash when creating a function type with a generic signature
that has only concrete parameters.

…has only concrete parameters

We used to crash when creating a function type with a generic signature
that has only concrete parameters.
@aschwaighofer
Copy link
Contributor Author

@jckarter Does this fix look right?

We used to assert on the test case:

Assertion failed: (!genericSig->areAllParamsConcrete() && "If all generic parameters are concrete, SILFunctionType should " "not have a generic signature at all"), function SILFunctionType, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/AST/ASTContext.cpp, line 4010.
Stack dump:
0.	Program arguments: xctoolchain/usr/bin/swift -frontend -c -primary-file TestCrash.swift -target x86_64-apple-darwin18.5.0 -enable-objc-interop -color-diagnostics -module-name TestCrash -o /var/folders/99/mpw2m87x1nq5gplgn306y4gm0000gn/T/TestCrash-ecbdc5.o 
1.	While emitting property descriptor for 'crash' (at TestCrash.swift:5:29)
0  swift                    0x0000000105b9f815 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x0000000105b9ead5 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x0000000105b9fdf8 SignalHandler(int) + 264
3  libsystem_platform.dylib 0x00007fff766e2b5d _sigtramp + 29
4  libsystem_platform.dylib 0x0000000000003ed8 _sigtramp + 2308051864
5  libsystem_c.dylib        0x00007fff7659c6a6 abort + 127
6  libsystem_c.dylib        0x00007fff7656520d basename_r + 0
7  swift                    0x0000000102de3c1d swift::SILFunctionType::SILFunctionType(swift::GenericSignature*, swift::SILFunctionType::ExtInfo, swift::SILCoroutineKind, swift::ParameterConvention, llvm::ArrayRef<swift::SILParameterInfo>, llvm::ArrayRef<swift::SILYieldInfo>, llvm::ArrayRef<swift::SILResultInfo>, llvm::Optional<swift::SILResultInfo>, swift::ASTContext const&, swift::RecursiveTypeProperties, llvm::Optional<swift::ProtocolConformanceRef>) + 2157
8  swift                    0x0000000102de42b0 swift::SILFunctionType::get(swift::GenericSignature*, swift::SILFunctionType::ExtInfo, swift::SILCoroutineKind, swift::ParameterConvention, llvm::ArrayRef<swift::SILParameterInfo>, llvm::ArrayRef<swift::SILYieldInfo>, llvm::ArrayRef<swift::SILResultInfo>, llvm::Optional<swift::SILResultInfo>, swift::ASTContext const&, llvm::Optional<swift::ProtocolConformanceRef>) + 1024
9  swift                    0x00000001024c602f getOrCreateKeyPathGetter(swift::Lowering::SILGenModule&, swift::SILLocation, swift::AbstractStorageDecl*, swift::SubstitutionMap, swift::GenericEnvironment*, swift::ResilienceExpansion, llvm::ArrayRef<std::__1::pair<swift::CanType, swift::SILType> >, swift::CanType, swift::CanType) + 1151
10 swift                    0x00000001024c47ec swift::Lowering::SILGenModule::emitKeyPathComponentForDecl(swift::SILLocation, swift::GenericEnvironment*, swift::ResilienceExpansion, unsigned int&, bool&, swift::SubstitutionMap, swift::AbstractStorageDecl*, llvm::ArrayRef<swift::ProtocolConformanceRef>, swift::CanType, bool) + 1500
11 swift                    0x000000010245a72d swift::Lowering::SILGenModule::tryEmitPropertyDescriptor(swift::AbstractStorageDecl*) + 797
 

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@slavapestov
Copy link
Contributor

Looks good. I have a PR open that removes that precondition and cleans up some other code but it changed optimizer behavior wrt inlining. I need to revisit it.

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - d6c59cc

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test os x

@aschwaighofer aschwaighofer merged commit 35c21dd into swiftlang:master Mar 22, 2019
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