Improve compiler stack binding codegen and state-template support#84
Merged
someone235 merged 48 commits intokaspanet:masterfrom Mar 26, 2026
Merged
Improve compiler stack binding codegen and state-template support#84someone235 merged 48 commits intokaspanet:masterfrom
someone235 merged 48 commits intokaspanet:masterfrom
Conversation
(cherry picked from commit 1ad4e5f)
(cherry picked from commit e6dcf0a)
(cherry picked from commit 25124ff)
(cherry picked from commit 836aca8)
(cherry picked from commit 2a1534b)
(cherry picked from commit 5a5ae1a)
(cherry picked from commit ecd0a43)
(cherry picked from commit 20dbb96)
(cherry picked from commit 63d8f91)
(cherry picked from commit 9d21b96)
(cherry picked from commit 388a9c7)
(cherry picked from commit ff91a4c)
(cherry picked from commit 69a558e)
(cherry picked from commit cfb5c9d)
Inline calls now allow mutable scalar stack locals unconditionally. The previous flag was redundant once both normal and inline compilation used the stack-local rebinding path, so this change removes enable_mutable_scalar_stack_locals from the compiler plumbing. The real fix is keeping env synchronized when a stack-bound scalar is reassigned: - after emit_update_stack_for_rebinding(...) - rewrite self-references in the new RHS against the previous semantic value - resolve the updated expression back into env That fixes inline returns reading stale values while avoiding the self-referential cycles from the naive env.insert(name, lowered_expr) approach.
someone235
requested changes
Mar 25, 2026
someone235
requested changes
Mar 26, 2026
someone235
approved these changes
Mar 26, 2026
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.
This PR extracts the compiler-side work from the
chessline without theexamples/changes.It includes:
O(1)stack-local rebinding with branch-safe reconciliationstack_bindingsmodule and unit testsIndexSet-backed stack binding tracking with stricter dense-depth invariantsvalidateOutputStateWithTemplatecompiler support and follow-up fixesOpTxInputDaaScoreexposure in the compiler/builtins surface