Repository navigation
Local-player analysis: build it only for the passes which use it - #1430
Conversation
The function splitter's two passes ask it only about locals, which the compile-time state has none of on real maps; the old-generics cast temporaries are merged after the last pass, where nothing reads an analysis any more. A castle fight or zombie defense Lua build makes it three times instead of five.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4b67c740c
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
The client-local analysis (
LocalPlayerContextAnalyzer) is a whole-program analysis. A Lua build of castle fight or zombie defense made it five times. Two of those five were built for passes which never use it: about a third of the analysis time on both maps.What changes
LuaOldGenericsCasts) went through the local merger with a fresh analysis, right before the Lua translation. The merger keeps a client-local value and a synchronized one in separate locals so that the analysis made before it stays true for the passes which use it afterwards (a merged local would hold both values while the analysis still answers for each). This is the last pass and nothing reads an analysis after it, so it now merges without one. Merging only renames locals, so the program does the same, and a client-local local may share its slot with a dead synchronized one.isLocalPlayerSourceis a lookup in a fixed list of natives. It is now static, so the inliner no longer builds the whole analysis to ask it.Effect
The zombie defense difference is only merging. Three functions lose one local each; every other function differs only in the numbering of names. Both scripts pass
luac -p. The CPU times come from a temporary probe around the constructor (thread CPU time, not committed); a whole build varies more than this from run to run, so no wall time is quoted. Not run in game.Tests
oldGenericsCastMergeIgnoresLocality(new,LuaBackendAuditTests): a function with a client-local integer, a synchronized one and an old-generics cast. It checks that the client-local local is reused for a synchronized value. It fails on master, where the client-local value keeps a third local.clientLocalNativeValuesAreLocalitySourcescalls the source list directly and no longer builds an analysis around it.