Skip to content

feat(sv)!: retain static function locals and results between calls - #1737

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/sv-static-functions/retain-static-func-locals-results-calls--b7596452
Oct 22, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/sv-static-functions/retain-static-func-locals-results-calls--b7596452

Conversation

@tignear

@tignear tignear commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Static function locals, implicit results and output-only arguments now retain
observable state between calls, including real values and integral arrays.
Call sites share the storage, module instances have separate storage, and
constant function evaluation uses fresh initialized values without changing
runtime state. One-time initializers run through the existing initialization
processes; stateful initializer calls require Simulation or a native testbench.

Promote retained storage to ordinary module/package state and lower stateful
calls through the imperative path, preserving the existing optimizer and
checkpoint behavior. Keep the scratch-local proofs and existing restrictions
on task locals, nonconstant static initializers and package writers. Class
methods retain automatic lifetime; explicit and implicit constructors preserve
their object handles and constructor return behavior.

Add shared regressions for call ordering, early returns, real values, arrays,
four-state and 981-bit storage, package and instance scopes, constant calls,
and timed processes. Retain focused Verilator/Icarus disagreements and compile
limitations with standalone sources and narrow tool/case exclusions.

Validation after rebasing onto master (ce31782):

  • Full SystemVerilog backend suite: 4,001 passed, 20 existing ignored.
  • Analyzer/frontend unit tests: 795 passed, 3 existing ignored.
  • Lifetime/package consumers: 71 passed.
  • Shared suite with Verilator/Icarus features: 78 passed.
  • Focused Verilator: 10 passed, 2 reviewed exclusions, 1 four-state unsupported.
  • Focused Icarus: 9 passed, 4 reviewed exclusions.
  • cargo fmt and affected-crate/consumer Clippy checks passed.
  • Full pinned sv-tests conformance: all 2,054 case/mode verdicts match the
    reviewed expectations (525 passes in 2state and 527 in 4state).

An independently reproduced existing Wasm bug affects unaligned multiword
unpacked-array elements; the shared retained-array regression uses 64-bit
elements, and the separate 981-bit packed-storage regression passes all backends.

BREAKING CHANGE: SubroutineBase gains a persistent_locals field; consumers
constructing this public analyzer IR structure must initialize the field.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-22T07:27:23.363392Z
We couldn’t complete this review. Comment @codex review to try again.
490485b PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@tignear
tignear force-pushed the stack/tignear/feat/sv-static-functions/retain-static-func-locals-results-calls--b7596452 branch from 490485b to 0771ed2 Compare October 22, 2026 07:56
@tignear

tignear commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial 490485b 2026-10-22 07:56 UTC
2 content 490485b → 0771ed2 Accept the two reviewed sv-tests static-function elaboration improvements that caused the conformance expectation gate to fail; all 2054 CI verdicts were compared. 2026-10-22 07:56 UTC
3 content 0771ed2 → b4ad699 Resolve conflicts with the latest master while preserving static function lifetime support and the reviewed conformance expectations. 2026-10-22 12:29 UTC
4 content b4ad699 → 5b5b5a7 Resolve the renewed conflicts with master, preserving both the upstream additions and static function lifetime coverage. 2026-10-22 13:40 UTC
5 content 5b5b5a7 → bee6666 Resolve the latest master conflicts while preserving static function lifetime behavior and upstream changes. 2026-10-22 17:20 UTC

@tignear
tignear force-pushed the stack/tignear/feat/sv-static-functions/retain-static-func-locals-results-calls--b7596452 branch from 0771ed2 to b4ad699 Compare October 22, 2026 12:29
@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 22, 2026
@tignear
tignear force-pushed the stack/tignear/feat/sv-static-functions/retain-static-func-locals-results-calls--b7596452 branch from b4ad699 to 5b5b5a7 Compare October 22, 2026 13:41
@mergify mergify Bot added the queued Mergify queue entry label Oct 22, 2026
@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-22 15:41 UTC · Rule: changes · triggered by rule Queue explicitly requested merges
  • 🚫 Left the queue — 2026-10-22 16:50 UTC · at 5b5b5a7bd4e1dea468df2fea03b84669c75c367d

This pull request spent 1 hour 8 minutes 56 seconds in the queue, with no time running CI.

Reason

The pull request conflicts with the base branch

The pull request was held in the queue, conflicting with at least one of 3 pull requests ahead of it. The conflict became a base branch one after #1689 merged.

Hint

You should update or rebase your pull request.

If you want to requeue this pull request, you can post a @mergifyio queue comment.

Requeued — the merge queue status continues in this comment ↓.

@mergify mergify Bot added dequeued Mergify stopped this queue entry; investigate before retrying and removed queued Mergify queue entry labels Oct 22, 2026
Static function locals, implicit results and output-only arguments now retain
observable state between calls, including real values and integral arrays.
Call sites share the storage, module instances have separate storage, and
constant function evaluation uses fresh initialized values without changing
runtime state. One-time initializers run through the existing initialization
processes; stateful initializer calls require Simulation or a native testbench.

Promote retained storage to ordinary module/package state and lower stateful
calls through the imperative path, preserving the existing optimizer and
checkpoint behavior. Keep the scratch-local proofs and existing restrictions
on task locals, nonconstant static initializers and package writers. Class
methods retain automatic lifetime; explicit and implicit constructors preserve
their object handles and constructor return behavior.

Add shared regressions for call ordering, early returns, real values, arrays,
four-state and 981-bit storage, package and instance scopes, constant calls,
and timed processes. Retain focused Verilator/Icarus disagreements and compile
limitations with standalone sources and narrow tool/case exclusions.

Validation after rebasing onto master (ce31782):
- Full SystemVerilog backend suite: 4,001 passed, 20 existing ignored.
- Analyzer/frontend unit tests: 795 passed, 3 existing ignored.
- Lifetime/package consumers: 71 passed.
- Shared suite with Verilator/Icarus features: 78 passed.
- Focused Verilator: 10 passed, 2 reviewed exclusions, 1 four-state unsupported.
- Focused Icarus: 9 passed, 4 reviewed exclusions.
- cargo fmt and affected-crate/consumer Clippy checks passed.
- Full pinned sv-tests conformance: all 2,054 case/mode verdicts match the
  reviewed expectations (525 passes in 2state and 527 in 4state).

An independently reproduced existing Wasm bug affects unaligned multiword
unpacked-array elements; the shared retained-array regression uses 64-bit
elements, and the separate 981-bit packed-storage regression passes all backends.

BREAKING CHANGE: SubroutineBase gains a persistent_locals field; consumers
constructing this public analyzer IR structure must initialize the field.

Change-Id: Ib759645220e169de2d702db4a81aa7bb4980944d
@tignear
tignear force-pushed the stack/tignear/feat/sv-static-functions/retain-static-func-locals-results-calls--b7596452 branch from 5b5b5a7 to bee6666 Compare October 22, 2026 17:20
@mergify mergify Bot added queued Mergify queue entry and removed dequeued Mergify stopped this queue entry; investigate before retrying labels Oct 22, 2026
@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 1 hour 42 minutes 28 seconds in the queue, including 1 hour 10 minutes 18 seconds running CI.

Required conditions to merge
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Lint & Format
    • check-neutral = @github-actions/Lint & Format
    • check-skipped = @github-actions/Lint & Format
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-neutral = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-skipped = @github-actions/NAPI Build (Linux ARM64 GNU)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Windows)
    • check-neutral = @github-actions/NAPI Build (Windows)
    • check-skipped = @github-actions/NAPI Build (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Rust Test & NAPI Build
    • check-neutral = @github-actions/Rust Test & NAPI Build
    • check-skipped = @github-actions/Rust Test & NAPI Build
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Ubuntu)
    • check-neutral = @github-actions/JS Test (Ubuntu)
    • check-skipped = @github-actions/JS Test (Ubuntu)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Windows)
    • check-neutral = @github-actions/JS Test (Windows)
    • check-skipped = @github-actions/JS Test (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Conventional Commit title
    • check-neutral = @github-actions/Conventional Commit title
    • check-skipped = @github-actions/Conventional Commit title

@mergify
mergify Bot merged commit 59f9f80 into master Oct 22, 2026
31 checks passed
@mergify
mergify Bot deleted the stack/tignear/feat/sv-static-functions/retain-static-func-locals-results-calls--b7596452 branch October 22, 2026 20:23
@mergify mergify Bot removed the queued Mergify queue entry label Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-ready Request merging through Mergify after required checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant