Repository navigation
Avoid repeated member lookup during dispatch translation - #1468
Merged
Merged
Conversation
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dispatch translation already knows the method declaration, but
getClassesWithImplementationsearched for it again through general member lookup for every subclass. That lookup adapts unrelated overloads and searches enclosing scopes. Create the known declaration's link once, bind its receiver to each subclass with the existing matching routine, and retain the existing most-specific implementation selection. Empty receiver sets return immediately.On current Castle Fight sources, an oracle compared the ordered class-to-implementation results with the original algorithm for all 12,489 calls on each target, with no differences. A separate alternating run in one JVM, without concurrent builds, measured Lua AST-to-IM translation at a median 641 ms before versus 477 ms after (four pairs after discarding the first warm-up pair, about 26% lower). This is a translation-phase measurement, not an end-to-end build-time claim. Production code has no net line growth.
Validation: 703 focused tests passed with no skips across dispatch implementation, classes, interfaces, modules, both generic systems, determinism, Lua emission, closures, field iteration and language features. The new tests cover generic receiver binding, inherited versus overridden implementations, and execution of generic overloads on both targets.
git diff --checkpassed. Checks ran on Windows; Linux/macOS and the actual game remain unverified.Also records why the closed class-pruning PR #1457 and the discarded conservative prototype should not be revisited without new evidence, and removes the addressed translation lookup item from the backlog. A combined module/generic-overload fixture exposed a separate Lua root-slot failure on unmodified master; its reproduction is recorded as follow-up work in
BACKLOG.md.