Skip to content

Find the globals initialiser by identity, not by name - #1485

Merged
Frotty merged 2 commits into
masterfrom
fix-globals-inliner-init-by-identity
Oct 17, 2026
Merged

Frotty merged 2 commits into
masterfrom
fix-globals-inliner-init-by-identity

Conversation

@Frotty

@Frotty Frotty commented Oct 17, 2026

Copy link
Copy Markdown
Member

GlobalsInliner took any function called initGlobals for the compiler's globals initialiser (isInInitGlobals compared the name). A user function of that name, legal in Jass and in Wurst, then had its write of the default value removed as a redundant initialisation: set mode = 0 in it no longer reset the global, so a later read saw the old value. It now compares with ImTranslator.getGlobalInitFunc().

Tests: OptimizerTests.globalsInlinerDoesNotTakeAJassInitGlobalsForTheInitialiser and globalsInlinerDoesNotTakeAWurstInitGlobalsForTheInitialiser, both red before the change (local optimisation run). OptimizerTests green locally (Windows).

GlobalsInliner took any function called initGlobals for the compiler's
globals initialiser. A user function of that name, in Jass or Wurst, had
its write of the default value removed as a redundant initialisation,
so `set mode = 0` in it no longer reset the global.
@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:36:45.466607Z 8af597a 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 de21c0a into master Oct 17, 2026
2 checks passed
@Frotty
Frotty deleted the fix-globals-inliner-init-by-identity branch October 17, 2026 17:44
@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): mode = 65536, then a user function initGlobals() which sets mode = 0. The global read 65536 afterwards before the change and 0 with it, on Jass and on Lua.

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