Skip to content

Fix a couple of places in the IRGen where we still don't use interface types #7112

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 31, 2017

Conversation

swiftix
Copy link
Contributor

@swiftix swiftix commented Jan 28, 2017

No description provided.

@gottesmm
Copy link
Contributor

Tests?

@gottesmm
Copy link
Contributor

Oh sorry didn't see WIP!

@swiftix
Copy link
Contributor Author

swiftix commented Jan 28, 2017

@slavapestov Could you have a quick look? I found a couple of places in the IRGen, where we were not using interface types for deserialized things yet. I essentially replaced: obj->getType() by obj->getDeclContext()->mapTypeIntoContext(obj->getInterfaceType())

@swiftix
Copy link
Contributor Author

swiftix commented Jan 28, 2017

@gottesmm I'm not sure how to test it. It kind of happens only on deserialized types in certain cases... I need to see if I can come up with something small that can test it.

@slavapestov
Copy link
Contributor

A test that builds a module and imports it from another module would work. We absolutely need more multi-file tests since issues keep coming up again and again.

@swiftix
Copy link
Contributor Author

swiftix commented Jan 28, 2017

@slavapestov Importing from a different module is a prerequisite, but it is not enough, because this bug only happens if you try to emit the metadata for types from a different module. We normally don't do it. It discovered it only because I was doing some experiments on my local branch.

@slavapestov
Copy link
Contributor

@swiftix It's strange that we would attempt to do that. Is this with imported types? Or subclassing a class from another module?

@swiftix
Copy link
Contributor Author

swiftix commented Jan 29, 2017

@slavapestov No, we don't try to do that. My new code tries to do that, because I play with whole program optimization. I try to transitively import everything needed into the current module, perform the optimizations, dead function elimination and then emit the IR. Thus I need to emit the metadata for all the types from the stdlib that are used by the user program.

@slavapestov
Copy link
Contributor

But the stdlib already has the metadata for all those types, why are you emitting it again?

@swiftix
Copy link
Contributor Author

swiftix commented Jan 29, 2017

But the stdlib already has the metadata for all those types, why are you emitting it again?

I'm emitting this "instead", not "again"! I try to create small static executables, which are not dependent on the static stdlib, because the static stdlib is 6MB big and is essentially one huge Swift.o file. So, I'm trying to include into the user module a copy of that part of the stdlib, which is actually needed by the user program. This includes functions, types, etc. I need to emit the IR metadata just as it would be done when we compile the stdlib.

@slavapestov
Copy link
Contributor

I see.

@swiftix
Copy link
Contributor Author

swiftix commented Jan 30, 2017

@slavapestov So, OK to merge? Semantically it seems the right thing to do, or?

@swiftix
Copy link
Contributor Author

swiftix commented Jan 30, 2017

@swift-ci please smoke test

@swiftix
Copy link
Contributor Author

swiftix commented Jan 31, 2017

Discussed with @slavapestov and decided to merge.

@swiftix swiftix merged commit 5a4d827 into swiftlang:master Jan 31, 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.

3 participants