Skip to content

Account for exact references in indirect call effects#8807

Open
stevenfontanella wants to merge 1 commit into
mainfrom
exact-effects
Open

Account for exact references in indirect call effects#8807
stevenfontanella wants to merge 1 commit 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
self->getModule()->indirectCallEffects, callIndirect->heapType);
if (auto* effects =
find_or_null(self->getModule()->indirectCallEffects,
std::make_pair(callIndirect->heapType, Inexact));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason it's std::make_pair here but std::pair above? Does using an initializer list not work because the templates need to have more type information? Generally I prefer just using the initializer list where possible.

Comment thread src/ir/type-updating.cpp
auto newType = updater.getNew(oldType);
std::shared_ptr<const EffectAnalyzer>& targetEffects =
newTypeEffects[newType];
newTypeEffects[std::pair(newType, exactness)];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
newTypeEffects[std::pair(newType, exactness)];
newTypeEffects[{newType, exactness}];

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