Skip to content

transpile: Use enum for current_block labels#1557

Draft
Rua wants to merge 1 commit intoimmunant:masterfrom
Rua:current_block_enum
Draft

transpile: Use enum for current_block labels#1557
Rua wants to merge 1 commit intoimmunant:masterfrom
Rua:current_block_enum

Conversation

@Rua
Copy link
Contributor

@Rua Rua commented Jan 21, 2026

The enum variants now suffice for debugging purposes, so I've removed the debug_labels command line option.

@Rua Rua marked this pull request as ready for review January 21, 2026 17:34
@Rua Rua marked this pull request as draft January 21, 2026 17:49
@Rua
Copy link
Contributor Author

Rua commented Jan 21, 2026

I notice that this is failing because transpiled code is referencing enum variants that do not exist. The code currently relies on get_current_block_labels to return all the possible labels that could be assigned to current_block, which gets them from the union of all the entries fields of all Structure::Multiple instances. As noted in #1556 I assumed that entries covers all possible jump labels, so it's worrying that this does not work.

@ahomescu
Copy link
Contributor

I'm not sure how much we'll need this once the relooper changes land; @randomPoison thoughts?

@randomPoison randomPoison self-requested a review January 22, 2026 22:15
@randomPoison
Copy link
Contributor

@ahomescu This still very much necessary! I specifically split out #1523 as work to do post-refactoring. But we will want to wait to land this until after #1558 lands.

@Rua the issue you point out in your comment will be easier to address after #1558. In the reworked relooper algorithm we now have a pass that walks the structured CFG and gathers the set of all entries that need current_block. That should make it trivial to know which entries need to be in the enum.

Copy link
Contributor

@randomPoison randomPoison left a comment

Choose a reason for hiding this comment

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

This looks good to me, thank you for putting this together 💜 After looking over the code it's not clear to me why the test is failing, the way you are gathering the set of labels seems correct. But I'm not going to dig into this now because #1558 is going to rework the relevant code anyway. Please wait until that PR lands and then rebase your changes. If things are still broken after that point I can help debug the issue 😸

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.

Generate an enum for current_block labels

3 participants