Skip to content

Conversation

@jonmeow
Copy link
Contributor

@jonmeow jonmeow commented Nov 21, 2025

I was trying to figure out the right way to get specifics to be added to the work.

Technically, we could keep the pending_specific list; this is taking a different approach of inserting inside the work stack, which will do extra work moving entries, although typically that should be expected to be small. One challenge of pending_specifics is that if we would need to shift them to work after both Done (for immediate processing) and Retry (for processing after the current instruction is later revisited and done). That feels kind of awkward as additional tracking to do. Also, the common case is probably that there's either 0 or 1 specifics being added, so an additional vector may be significant overhead. That's why I leaned more in this direction of just inserting them in the vector of work.

@jonmeow jonmeow requested a review from a team as a code owner November 21, 2025 00:19
@jonmeow jonmeow requested review from chandlerc and removed request for a team November 21, 2025 00:19
Copy link
Contributor

@chandlerc chandlerc left a comment

Choose a reason for hiding this comment

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

Nice! The rationale makes lots of sense to me, suggested maybe even capturing some of that in code comments so its more visible.


auto ImportRefResolver::PushSpecific(SemIR::SpecificId import_id,
SemIR::SpecificId local_id) -> void {
// Insert before the current instruction.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add to this comment some of the nuance from the commit message around inserting into the middle of the work stack and why it should be fine?

Mostly thinking it could be helpful if this function shows up in a profile at some point because something weird changed, or if someone worries about the insert here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants