Skip to content

Go: separate real and synthetic callables#12692

Closed
smowton wants to merge 3 commits intogithub:mainfrom
smowton:smowton/admin/go-synthetic-callables
Closed

Go: separate real and synthetic callables#12692
smowton wants to merge 3 commits intogithub:mainfrom
smowton:smowton/admin/go-synthetic-callables

Conversation

@smowton
Copy link
Contributor

@smowton smowton commented Mar 28, 2023

This means that when a function has a real body and a summary (usually because it has a real definition in source, and implements an interface that has a model), two callables are created and dispatch considers both possible paths.

This specifically overcomes the difficulty with ParameterNodes when the real callable, if any, may or may not define an SsaNode, either because the real parameter is unused or because it is anonymous. Now the synthetic callable will always have parameter nodes, while the real one may or may not depending on whether a definition is present and whether or not it names or uses its parameter.

This means that when a function has a real body and a summary (usually because it has a real definition in source, and implements an interface that has a model), two callables are created and dispatch considers both possible paths.

This specifically overcomes the difficulty with ParameterNodes when the real callable, if any, may or may not define an SsaNode, either because the real parameter is unused or because it is anonymous. Now the synthetic callable will always have parameter nodes, while the real one may or may not depending on whether a definition is present and
whether or not it names or uses its parameter.
@smowton smowton requested a review from a team as a code owner March 28, 2023 13:50
@github-actions github-actions bot added the Go label Mar 28, 2023
Copy link
Contributor

@owen-mc owen-mc left a comment

Choose a reason for hiding this comment

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

Seems plausible. Do we need tests for this? A performance evaluation? A check that it doesn't change results?

@owen-mc owen-mc changed the title Go: seperate real and synthetic callables Go: separate real and synthetic callables Mar 28, 2023
@smowton
Copy link
Contributor Author

smowton commented Mar 28, 2023

For testing purposes I've rebased #12562 on this PR

@aschackmull
Copy link
Contributor

I have not read the code changes, but the PR description sounds good to me.

@smowton
Copy link
Contributor Author

smowton commented Apr 12, 2023

Merged via #12750

@smowton smowton closed this Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments