Repository navigation
refactor(runtime): evaluate lowered payloads by expression id - #2249
Merged
Merged
Conversation
Each lowered graph carries an expression table, and each expression a lowered payload states has its id beside the tree. Conditions, objectives, feature defaults and satisfy subjects carry theirs in the model's table. The runtime evaluates the id; an id that is not in its table is an error, never a read of the tree. The tree fields stay until step 8. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…the self-model field count Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
The attributes of a region's owner and the machine's own run-to-completion value are recorded under keys that are not states of the graph, so walking its states left their expression ids unset. Co-Authored-By: jason.han <hanhuijun@gmail.com>
A default stated between the steps of a case runs as a node of the flow lowered for those steps, which read it in a table of its own rather than the one the default was interned in. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
There was a problem hiding this comment.
Devin Review found 2 findings. Devin automatically fixed all 2 findings.
Fixed by Devin (2)
- Missing IDs for machine and region expressions — Reproduced: a region owner's attribute and the machine's own run-to-completion value had id 0. The machine now interns every recorded owner, not only its states.
- Case defaults use the wrong expression table — Reproduced: the flow lowered for a case's steps had its own table while the default run as its node was interned in the body's. The flow now shares the body's table.
…ad-ids Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential/index.json
The examples provenance digest moves with the self-model file, and one ours-only element goes with it: /self-model/execution.sysml/sysx:Note#35. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…velop The merged develop measures 7,441,184 bytes gzipped against the 7,450,000 budget; the expression ids the lowered payloads carry add 13,282. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
This was referenced Nov 15, 2026
Merged
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.
What and why
No tracking issue.
Third part of the execution-owned expression migration in
docs/internals/execution-ir-design.md, after #2218 and #2225. Lowered payloads now name the expressions they state byprogram.ExprID, and the runtime evaluates the id rather than the syntax tree.lower.ExprTable.ExprTable.Internrecords an expression once per(tree, scope).ValueID,ConditionID,GuardID,TriggerExprID,BindingEnd.ExprID/IndexID,ZeroCrossing.GuardID/TerminalID, ...).Condition.ExprID,Objective.ValueID,EffectiveFeature.DefaultValueID,SatisfyAssertion.SubjectChainID.EvalContextcarries the table of the flow it evaluates; an id that is not in that table is an error (expression 0 is not in the table of its flow), never a fallback read of the tree. An expression evaluated in a scope other than the one it was interned in is lowered again in that scope through the model's memoized path.The change is additive: the tree fields stay beside the ids until the last readers move, so lazy and memoized evaluation, scopes, cleanup and error timing are unchanged.
Not in this PR:
Accept.SubsetsEvent,Channel.MessageandSubjectDecl.Valueget no id; the runtime does not evaluate them as payload expressions.Context.UnitOfand the other semantic questions the runtime still asks of a tree move in the follow-up PR stacked on this branch.exec/runtimefrom importingsyntax/astis the final step.Baselines
EffectiveFeaturegains a field, soexamples/self-model/execution.sysmlstatesfieldCount = 12and its comment is one line shorter. Any edit underexamples/changes the provenance digest of the two differentials, which were re-recorded by tool under JDK 21 ondevelopdd08d75454:examplesdigest moves; no count moves.examplesdigest, andexamples/self-model/execution.sysml.jsonours-only 186 → 185 (index totals 19152 → 19151, examples 5590 → 5589). One ours-onlysysx:Noteis lost because notes are keyed by ordinal:/self-model/execution.sysml/sysx:Note#35. Matched and pilot-only are unchanged, with no match lost or gained.developwith #2242 and #2245 is merged in and the baselines are re-recorded on top of it. This branch still overlaps #2235 inexamples/self-model/execution.sysml, where both statefieldCount = 12for a different twelfth field; whichever lands second states 13 and re-records.WebAssembly size budget
coreGzipBudgetgoes from 7,450,000 to 7,500,000 bytes. The gzipped jssysml-core.wasmmeasures 7,441,184 ondevelopdd08d75454and 7,454,466 here; the 13,282 bytes are the expression ids the payloads carry and the code that reads them.How it was verified
On the pushed head, merged with
develop97e7eedb29:go build ./...,go vet ./...,gofmt -l .,make lintgo test -count=1 ./...with the training and pilot corpora required, andgo test -C tools -count=1 ./...go test ./tests/hygiene,scripts/check-doc-ids.py,scripts/changelog.py checkmake docs-counts,make spec-compliance-check,make wasm-checkpilot-diff -checkandpilot-apijson-diff -check(JDK 21),pilot-exec-diff,pilot-xpect -checkNew tests in
internal/exec/runtime/expr_payload_ids_test.gocover graph and model table ownership, ids reaching each payload, invalid ids, evaluation in another scope, and nested table switching.Checklist
make testandmake lintpass locally (the suite was run without-race)docs/internals/execution-ir-design.md)make docs-countsrun🟢 Devin Review found nothing to fix · View findings · Follow Devin's work