Skip to content

[embedded] Avoid a crash on location-less SIL functions in PerformanceDiagnostics #72819

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 2 commits into from
Apr 9, 2024

Conversation

kubamracek
Copy link
Contributor

Turns out that SILGen can generate calls to things like swift_readAtKeyPath, which end up being location-less SILFunctions. Let's avoid crashing on those in PerformanceDiagnostics. The attached test case previously failed with:

Assertion failed: (DebugScope && "no scope/location"), function getLocation, file SILFunction.h, line 1086.

rdar://125724841

@kubamracek
Copy link
Contributor Author

@swift-ci please test

if (getMethodDispatch(func) == MethodDispatch::Class) {
vtableMembers.push_back(&function);
continue;
if (function.hasLocation()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a short comment saying why there are functions with no locations and why it's okay to not check those?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add comment. We still check all functions, even those without a location -- this code here picks some functions to be checked first and last (to improve diagnostic quality). Whatever isn't matched here still goes into the others arrays.

@kubamracek
Copy link
Contributor Author

@swift-ci please test

@kubamracek
Copy link
Contributor Author

@swift-ci please test macOS platform

@kubamracek kubamracek added the embedded Embedded Swift label Apr 8, 2024
@kubamracek
Copy link
Contributor Author

@swift-ci please test macOS platform

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

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

lgtm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
embedded Embedded Swift
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants