Skip to content

Method dispatch cleanup #13742

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 11 commits into from
Jan 5, 2018

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Jan 5, 2018

Fixes rdar://problem/35860361, https://bugs.swift.org/browse/SR-6534.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov force-pushed the method-dispatch-cleanup branch from 45ecbcb to 51ed637 Compare January 5, 2018 02:13
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

2 similar comments
@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov slavapestov force-pushed the method-dispatch-cleanup branch from 51ed637 to a278bd2 Compare January 5, 2018 05:54
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Jan 5, 2018

Build failed
Swift Test OS X Platform
Git Sha - 5cc29b65b6d87d25becd56816d2c8e99858d306e

@swift-ci
Copy link
Contributor

swift-ci commented Jan 5, 2018

Build failed
Swift Test Linux Platform
Git Sha - 5cc29b65b6d87d25becd56816d2c8e99858d306e

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

1 similar comment
@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov slavapestov merged commit 9efe1c2 into swiftlang:master Jan 5, 2018
@MrMage
Copy link

MrMage commented Mar 21, 2018

Sorry for reviving this PR, but it appears that 45c6315 would fix a crash I'm seeing in the latest Swift 4.1 development snapshot (from both March 7th and March 20th):

Assertion failed: (!D->isDynamic()), function makeFinal, file /Users/buildnode/jenkins/workspace/oss-swift-4.1-package-osx/swift/lib/Sema/TypeCheckDecl.cpp, line 1253.
0  swift                    0x00000001080524c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x0000000108052bd6 SignalHandler(int) + 694
2  libsystem_platform.dylib 0x00007fffc6eeab3a _sigtramp + 26
3  swift                    0x0000000108ca7878 (anonymous namespace)::DarwinX86AsmBackend::getCompactUnwindRegNum(unsigned int) const::CU64BitRegs + 221170
4  libsystem_c.dylib        0x00007fffc6d6f420 abort + 129
5  libsystem_c.dylib        0x00007fffc6d36893 basename_r + 0
6  swift                    0x000000010590270d (anonymous namespace)::DeclChecker::visitFuncDecl(swift::FuncDecl*) + 7741
7  swift                    0x00000001058ec6e1 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 337
8  swift                    0x00000001058fda4b (anonymous namespace)::DeclChecker::visitClassDecl(swift::ClassDecl*) + 379
9  swift                    0x00000001058ec7ee (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 606
10 swift                    0x00000001058ec584 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 100
11 swift                    0x000000010597d844 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int) + 1604
12 swift                    0x00000001055fd0c8 swift::CompilerInstance::parseAndCheckTypes(swift::CompilerInstance::ImplicitImports const&) + 936
13 swift                    0x00000001055fc7a8 swift::CompilerInstance::performSema() + 520
14 swift                    0x0000000104b06541 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1921
15 swift                    0x0000000104b04dd0 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3376
16 swift                    0x0000000104ac4683 main + 3075
17 libdyld.dylib            0x00007fffc6cdb235 start + 1

That crash was not there with Xcode 9.2, but started occurring with Swift 4.1 nightlies. Would there be any chance of backporting this to Swift 4.1? (No idea how much else has changed, and how bad merge conflicts would be.)

@MrMage
Copy link

MrMage commented Mar 21, 2018

Never mind, I found the underlying culprit: Apparently, Swift 4.1 chokes on the dynamic (which admittedly, doesn't really make sense) in

@objc static dynamic func test() { }

Removing dynamic avoids the crash. Attached a minimal reproduction case; not sure if this is worth filing on bugs.swift.org given that it should be fixed in the development branch already. (Let me know if you think otherwise.)

Swift41DynamicCrashTest.zip

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