Skip to content

Switch back to the old mangling for ObjC runtime names. #9359

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 5 commits into from
May 9, 2017

Conversation

eeckstein
Copy link
Contributor

Explanation: This gives us backward compatibility for existing NSKeyedArchives for all kind of classes: private, non-top-level, generic classes.

Scope: This is a change which is needed to prevent user data loss.

Issue: rdar://problem/32027951

Risk: Low. We used those runtime names also in the swift 3.1 compiler

Testing: There is a test case in this PR for swift CI

@eeckstein
Copy link
Contributor Author

@swift-ci Please test

}

void Remangler::mangleProtocolListWithClass(Node *node) {
Out << "<procotol-list-with-class>";
Copy link
Contributor

Choose a reason for hiding this comment

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

This means if you have a GenericClass<P & C>, we're going to mangle it with an invalid mangling containing "procotol-list-with-class" (sic)?

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, that must be fixed

}

void Remangler::mangleProtocolListWithAnyObject(Node *node) {
Out << "<procotol-list-with-any-object>";
Copy link
Contributor

Choose a reason for hiding this comment

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

This will cause problems down the line also, when master is merged into 4.0 branch next time, and the user has a generic objc class with a generic parameter set to AnyObject.

@slavapestov
Copy link
Contributor

It sounds like we'll have to invent new "old-style" manglings for any new mangling nodes that were added after the new mangling became the default. Gross.

@eeckstein
Copy link
Contributor Author

Only for nodes which are created in stdlib/public/runtime/Demangle.cpp

@slavapestov
Copy link
Contributor

Right, but that includes the two node kinds I pointed out above. Until we do that, do you mind adding asserts to the new node kind cases, instead of returning bogus strings, so we can be sure that nobody will accidentally mangle those in the meantime?

@eeckstein
Copy link
Contributor Author

sure

@eeckstein eeckstein force-pushed the old-objc-rtnames branch from f849037 to 3c66c07 Compare May 8, 2017 19:28
@eeckstein
Copy link
Contributor Author

@swift-ci Please test

@eeckstein eeckstein requested a review from slavapestov May 8, 2017 19:30
@swift-ci
Copy link
Contributor

swift-ci commented May 8, 2017

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - f8490375f3fd336310ce1f0c53836a9d3a5fb847
Test requested by - @eeckstein

@eeckstein
Copy link
Contributor Author

@slavapestov I fixed the mangling of those 2 nodes. Can you please review the PR for swift-4.0?

@swift-ci
Copy link
Contributor

swift-ci commented May 8, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - f8490375f3fd336310ce1f0c53836a9d3a5fb847
Test requested by - @eeckstein

Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

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

LGTM but you might want to fix AnyObject mangling to match the old behavior also.


void Remangler::mangleProtocolListWithAnyObject(Node *node) {
Out << "Xl";
mangleProtocolListWithoutPrefix(node->getChild(0));
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, but this is still wrong

@eeckstein
Copy link
Contributor Author

@slavapestov This is the fix (on master): #9410

eeckstein added 5 commits May 9, 2017 08:05
To be backward compatible to existing archives created by the NSKeyedArchiver
…ted at runtime.

To be backward compatible to existing archives created by the NSKeyedArchiver for generic classes
Check that we can read an archive which was produced with the swift 3.1 compiler
@eeckstein eeckstein force-pushed the old-objc-rtnames branch from 90009e4 to d56d897 Compare May 9, 2017 15:05
@eeckstein
Copy link
Contributor Author

@slavapestov I updated this PR with the fix for AnyObject

@eeckstein
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented May 9, 2017

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 3c66c07e2a85d4c970af85f37bc9f4341dec600a
Test requested by - @eeckstein

@swift-ci
Copy link
Contributor

swift-ci commented May 9, 2017

Build failed
Jenkins build - Swift Test Linux Platform
Git Commit - 3c66c07e2a85d4c970af85f37bc9f4341dec600a
Test requested by - @eeckstein

@eeckstein eeckstein merged commit ab80e95 into swiftlang:swift-4.0-branch May 9, 2017
@eeckstein eeckstein deleted the old-objc-rtnames branch May 9, 2017 19:16
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