Skip to content

fix(codegen): manual switch table configuration in block discovery#370

Open
Graine25 wants to merge 1 commit into
rexglue:developmentfrom
Graine25:jumptable-codegen
Open

fix(codegen): manual switch table configuration in block discovery#370
Graine25 wants to merge 1 commit into
rexglue:developmentfrom
Graine25:jumptable-codegen

Conversation

@Graine25

@Graine25 Graine25 commented Jul 8, 2026

Copy link
Copy Markdown
Member

The manually configured switch tables in the config weren't being passed into discoverBlocks() at all. The call site in phase_discover.cpp simply didn't forward ctx.Config().switchTables.

The fix adds a manualSwitchTables parameter to discoverBlocks() so that user-configured tables (from ctx.Config().switchTables) take priority over auto-detection at each bcctr address. It also adds a guard -> if (t != entryPoint && knownFunctions.contains(t)) continue; <- to prevent jump table targets that land at the start of a known function from being incorrectly imported as basic blocks of the current function (i.e., tail dispatch is now handled correctly).

@Graine25 Graine25 self-assigned this Jul 8, 2026
@Graine25 Graine25 requested a review from tomcl7 as a code owner July 8, 2026 22:05
@Graine25 Graine25 added the bug Something isn't working label Jul 8, 2026
@Graine25 Graine25 force-pushed the jumptable-codegen branch from b41628c to be7d32d Compare July 8, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant