Skip to content

Account for exact references in indirect call effects#8807

Open
stevenfontanella wants to merge 2 commits into
mainfrom
exact-effects
Open

Account for exact references in indirect call effects#8807
stevenfontanella wants to merge 2 commits into
mainfrom
exact-effects

Conversation

@stevenfontanella
Copy link
Copy Markdown
Member

Part of #8615. Allows us to ignore effects from func subtypes when we have an indirect call to an exact reference.

@stevenfontanella stevenfontanella marked this pull request as ready for review June 5, 2026 21:25
@stevenfontanella stevenfontanella requested a review from a team as a code owner June 5, 2026 21:25
@stevenfontanella stevenfontanella requested review from tlively and removed request for a team June 5, 2026 21:25
Copy link
Copy Markdown
Member

@tlively tlively left a comment

Choose a reason for hiding this comment

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

Something I realized we're probably not handling correctly (but tell me if I'm wrong) is inexact function imports. When I import a function inexactly with type $super, take a reference to it somewhere, and then somewhere else do an indirect call to $sub, it's possible that I end up calling the import. That's because the reference to the imported function reference can be cast to $sub, and that cast might succeed depending on the function that was supplied at instantiation time.

But this is probably a pre-existing bug. I only thought about it because I was considering exactness. It probably makes sense to fix separately.

Comment thread src/ir/linear-execution.h Outdated
Comment thread src/ir/type-updating.cpp Outdated
@stevenfontanella
Copy link
Copy Markdown
Member Author

Something I realized we're probably not handling correctly (but tell me if I'm wrong) is inexact function imports. When I import a function inexactly with type $super, take a reference to it somewhere, and then somewhere else do an indirect call to $sub, it's possible that I end up calling the import. That's because the reference to the imported function reference can be cast to $sub, and that cast might succeed depending on the function that was supplied at instantiation time.

But this is probably a pre-existing bug. I only thought about it because I was considering exactness. It probably makes sense to fix separately.

I see, even in closed-world mode the import is basically acting as an alias and can redefine the function as a supertype of its real type.

Would something like #8811 be enough to fix it? This PR makes a similar mistake here, so maybe I'd try to fix this more generally before submitting this PR.

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.

2 participants