Skip to content

refactor(#1997): 2.2 Plan decides every toolchain requirement key - #2012

Open
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
refactor/1997-plan-owns-requirements
Open

devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
refactor/1997-plan-owns-requirements

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Render recorded five toolchain requirement keys itself, while README §1's Ownership table gives toolchain requirements to 2.2 Plan. Render now reports only which form it emitted. EmissionPlan decides every key, and the banner and the per-file result read the plan alone. Option (a) on #1997.

Changes

  • EmissionPlan.ts, IEmissionPlan.ts, IEmissionFacts.ts: the new decideFormRequirements fills plan.formRequirements. It decides:
    • the baseline from cppMode
    • cpp-designated-initializer and cpp-compound-literal, in C++ mode only
    • atomic-ldrex-cmsis, attributed to its sites
    • overflow-panic-hosted-libc, from debugMode and the clamp helpers. These are the same two facts generateOverflowHelpers reads to emit the panic helpers.
    • EmissionPlan.requirements(plan) returns these keys plus the planned blocks' keys.
  • CodeGenWalker.ts, HelperGenerator.ts, AtomicGenerator.ts, TGeneratorEffect.ts, CodeGenerator.ts, TranspileState.ts:
    • All six ToolchainRequirements.record calls are gone.
    • The two initializer sites now set emittedDesignatedInitializer / emittedCompoundLiteral. They set them in both modes, since the mode is the plan's question.
    • The atomic requires effect is replaced by { type: "ldrex-strex-loop" }, which notes only its site.
    • getToolchainRequirements() returns EmissionPlan.requirements(this.state.emissionPlan()).
  • ToolchainRequirements.ts: record, collect and the recorded map are deleted, so only the per-request sites remain. The holder list in passes-hold-no-mutable-state.test.ts drops from four entries to three.
  • Docs: the README instrumentation/ bullet and the ledger paragraph, plus the comments in Transpiler.ts and RequirementSites that described Render's records.

Testing

  • New unit tests in EmissionPlan.test.ts pin each key, and each has a control (the same form costs nothing in C, and the panic key needs debug mode). ToolchainRequirements.test.ts loses the record/collect cases.
  • Generated output is unchanged on tests/issue-502, tests/atomic, tests/issue-522 and tests/bit-indexing. CI runs the full suite.
  • Mutations, each run against a control that should stay green:
    • Dropping cpp-compound-literal: tests/issue-502 had 2 failures, and tests/bit-indexing stayed green.
    • Making the atomic-ldrex-cmsis branch unreachable: tests/atomic had 8 failures, and tests/issue-502 stayed green.
    • Making the panic key ignore debugMode: the unit test failed.

Related Issues

Closes #1997. Part of #1313.

devin-ai-integration Bot and others added 2 commits October 11, 2026 22:21
Render reported five keys itself (mode baseline, the two C++ initializer
forms, debug overflow helpers, LDREX/STREX atomics), against README §1's
Ownership table, which gives toolchain requirements to 2.2. Render now
reports only the form it emitted (emittedDesignatedInitializer,
emittedCompoundLiteral, an ldrex-strex-loop site); EmissionPlan decides each
key into formRequirements, and getToolchainRequirements reads the plan alone.
ToolchainRequirements.record, collect and the recorded map are deleted.

Co-Authored-By: Joshua Austill <jlaustill@gmail.com>
Prettier moved ToolchainRequirements.deferred from line 50 to 49 after the
holder list was measured; the code it points at is unchanged.

Co-Authored-By: Joshua Austill <jlaustill@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: PR Review

Development

Successfully merging this pull request may close these issues.

2.3 Render authors five toolchain-requirement keys that README §1 gives to 2.2 Plan alone; #1996 deletes the only comment that marked it 'not yet'

0 participants