Skip to content

Only collapse dispatch guards which call the error function - #1486

Merged
Frotty merged 2 commits into
masterfrom
fix-dispatch-dedup-error-func-only
Oct 17, 2026
Merged

Frotty merged 2 commits into
masterfrom
fix-dispatch-dedup-error-func-only

Conversation

@Frotty

@Frotty Frotty commented Oct 17, 2026

Copy link
Copy Markdown
Member

DispatchCheckDeduplicator drops the second of two identical dispatch guards (if typeId[x] == 0 / if x == 0 / error(...) else error(...)), which is sound because the error call does not return. It accepted any call with one string literal argument as that call, so user code of the same shape, in a Jass unit or in Wurst, lost its second block although the function it calls returns and has effects. A guard now only qualifies when the call is the compiler's error function (ImTranslator.getErrorFuncIfPresent(), which does not create one).

Tests: ClassesTests.guardShapedUserCodeIsNotDeduped (Wurst) and guardShapedJassCodeIsNotDeduped (Jass unit), both red before the change. repeatedCallsOnSameReceiverAreNotDispatchCachedYet still asserts a single guard after inlining for real dispatch. ClassesTests and OptimizerTests green locally (Windows).

DispatchCheckDeduplicator dropped the second of two identical guards
because the error call inside does not return. It took any call with
one string argument for that call, so user code of the same shape, in
Jass or Wurst, lost its second block although the function it calls
returns and has effects.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T16:42:10.985343Z cd6e797 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Frotty
Frotty merged commit 6b35080 into master Oct 17, 2026
2 checks passed
@Frotty

Frotty commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

Measured on the 3.0.0 client, with a map built by master before and after this change (-inline -localOptimizations): two guard-shaped blocks of user code calling a function which counts. On Jass the count was 1 before the change and 2 with it; on Lua it was 2 in both builds.

@Frotty
Frotty deleted the fix-dispatch-dedup-error-func-only branch November 25, 2026 08:54
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.

1 participant