Skip to content

Use function signatures for SILDeclRefs in witness_tables, vtables and witness_method instructions #7078

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 1 commit into from
Jan 27, 2017

Conversation

swiftix
Copy link
Contributor

@swiftix swiftix commented Jan 27, 2017

Textual SIL was sometimes ambiguous when SILDeclRefs were used, because the textual representation of SILDeclRefs was the same for functions that have the same name, but different signatures.

This patch fixes this problem.

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - a73b816ed4c352e8bf784652b118fd3e2a81030f
Test requested by - @swiftix

*this << AMI->getType();
}
void visitWitnessMethodInst(WitnessMethodInst *WMI) {
if (WMI->isVolatile())
*this << "[volatile] ";
*this << "$" << WMI->getLookupType() << ", " << WMI->getMember();
*this << "$" << WMI->getLookupType() << ", " << WMI->getMember()
<< " : " << WMI->getMember().getDecl()->getInterfaceType();
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to use custom PrintOptions too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. Good question. The tests will show.

Copy link
Contributor

Choose a reason for hiding this comment

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

They might not, if it happens not to hit this case in the stdlib either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. I could try to construct a use-case by hand using non-qualified types.

@swiftix swiftix force-pushed the wip-textual-sil-sildeclrefs branch from a73b816 to db2a5e5 Compare January 27, 2017 03:23
@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci Please test OSX

1 similar comment
@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci Please test OSX

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci please test OSX

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci please test OS X

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - a73b816ed4c352e8bf784652b118fd3e2a81030f
Test requested by - @swiftix

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - a73b816ed4c352e8bf784652b118fd3e2a81030f
Test requested by - @swiftix

@swiftix swiftix force-pushed the wip-textual-sil-sildeclrefs branch from db2a5e5 to 064b72f Compare January 27, 2017 03:32
@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci please test OS X

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - db2a5e51dd053d386f7141e69e10110a0c49eec9
Test requested by - @swiftix

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - a73b816ed4c352e8bf784652b118fd3e2a81030f
Test requested by - @swiftix

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@jrose-apple Hmm. By looking at the failing tests I got the impression that we need to use the fully qualified names only for the types coming from the stdlib.

See: https://ci.swift.org/job/swift-PR-osx/5245/consoleFull#1463937818ee1a197b-acac-4b17-83cf-a53b95139a76

If we use fully qualified names for user files, we get problems with sil-opt processing the -emit-sil output and the like, e.g. because it assumes by default "main" to be the name of the module. Of course, we could fix these tests by adding -module-name to the sil-opt command line options.

WDYT?

@swiftix swiftix force-pushed the wip-textual-sil-sildeclrefs branch from 064b72f to 4eca265 Compare January 27, 2017 06:11
@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci please test OS X

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 064b72f556c80fbe45d2ecbe145d65b576654c44
Test requested by - @swiftix

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci Please test Linux

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci please test Linux

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 4eca265662f079ac2a7d8c01bb7232638af9de41
Test requested by - @swiftix

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@jrose-apple Jordan, the failures on Linux are all like this:

sil function not found '_AnyCollectionBox':

#_AnyCollectionBox!ivardestroyer.1: _AnyCollectionBox<Element>.Type : 
_TFCs17_AnyCollectionBoxE       // _AnyCollectionBox.__ivar_destroyer

The parser tries to treat the _AnyCollectionBox.Type as a function type I guess. In any case, probably these ivar_destroyers should be handled in a special way? What is actually the type of such a destroyer function? I guess it is not really _AnyCollectionBox<Element>.Type

@jrose-apple
Copy link
Contributor

I don't know; I don't know how ivar destroyers work. @slavapestov, @jckarter?

@jrose-apple
Copy link
Contributor

@jrose-apple Hmm. By looking at the failing tests I got the impression that we need to use the fully qualified names only for the types coming from the stdlib.

That doesn't make sense. What if the file you're emitting SIL for imports some other library that defines a type with the same name? Maybe the only time it's okay to not qualify a type is when it's from the current module. You could either add a print option for that, or just print qualified types all the time.

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

That doesn't make sense. What if the file you're emitting SIL for imports some other library that defines a type with the same name? Maybe the only time it's okay to not qualify a type is when it's from the current module. You could either add a print option for that, or just print qualified types all the time.

Right. I realized it yesterday, after I asked you. I introduced some changes so that we don't use qualified types for the types from the current module. It seems to work nicely.

The last remaining issue seem to be those ivar destroyers. I need to understand what is so special about them and how to handle them properly.

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci please test Linux

1 similar comment
@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci please test Linux

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 60a2cba964f7fb90adc0563d2cf2f8367d23ef7c
Test requested by - @swiftix

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci Please smoke test Linux

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci please smoke test Linux

@gottesmm
Copy link
Contributor

@swiftix Can you do a full test for this. So that the parse stdlib tests run?

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci please smoke test OS X

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci please smoke test

@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci please smoke test OS X

1 similar comment
@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci please smoke test OS X

…d witness_method instructions.

Textual SIL was sometimes ambiguous when SILDeclRefs were used, because the textual representation of SILDeclRefs was the same for functions that have the same name, but different signatures.
@swiftix swiftix force-pushed the wip-textual-sil-sildeclrefs branch from 94fa2d7 to 8ad61d5 Compare January 27, 2017 20:16
@swiftix
Copy link
Contributor Author

swiftix commented Jan 27, 2017

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 4eca265662f079ac2a7d8c01bb7232638af9de41
Test requested by - @swiftix

@swift-ci
Copy link
Contributor

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 60a2cba964f7fb90adc0563d2cf2f8367d23ef7c
Test requested by - @swiftix

@swiftix swiftix changed the title Use function signatures for SILDeclRefs in witness_tables, vtables an… Use function signatures for SILDeclRefs in witness_tables, vtables and witness_method instructions Jan 27, 2017
@swiftix swiftix merged commit 400f338 into swiftlang:master Jan 27, 2017
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.

5 participants