Skip to content

feat(sv): specialize package classes from importing scopes - #2429

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/sv-foreign-class-specializations/specialize-pkg-classes-importing-scopes--94cfcf52
Oct 28, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/sv-foreign-class-specializations/specialize-pkg-classes-importing-scopes--94cfcf52

Conversation

@tignear

@tignear tignear commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Allow modules, packages and compilation-unit classes to request package-class
specializations that the declaring package never names. This enables the UVM
registry pattern typedef Registry#(User) type_id, including calls through
type_id::create() that construct the supplied compilation-unit class.

Bind explicit actuals in the requesting scope and defaults, inherited member
types/constants and method bodies in their declaration scopes. Reuse one
canonical specialization and package state across importing scopes, preserving
nominal type identity, equivalent defaults, constructor defaults, static class
handles and distinct per-file compilation-unit classes. Discover signatures
before binding executable bodies with the supplied classes' metadata.

Keep module-local class actuals unsupported until their identity can distinguish
module instances. This change is independent of built-in process control and
virtual-interface support. It does not remove the existing restriction on
nonconstant package declaration initializers.

Add nine portable shared cases and API regressions for native images and
serialized checkpoints. Retain all 19 observed external-simulator failures with
unchanged expectations, exact diagnostics, standard review and six standalone
probes. xezim validation uses pinned source d491f948/core a25655a4 with a
regenerated dependency lock in an isolated Nix package; no simulator or
repository lock sources are changed.

Validation:

  • All five backends: 50 foreign-specialization tests passed; class/package
    and concurrent-assertion regressions: 539 passed after syncing master.
    Package regressions: 70 passed after syncing master. Earlier full SV run: 6250 passed,
    20 ignored.
  • Analyzer/frontend unit tests on master e7ec496: 896 passed, 3 ignored.
  • NAPI/JS: 435 tests, playground 132 tests, and plugin/watch integration passed.
  • Affected-crate Clippy, formatting and retained-report/gate checks passed.
  • Nine external cases: Verilator 5 pass/4 retained failures, Icarus 9 retained
    failures, xezim 3 pass/6 retained failures. Standalone Celox probes pass in
    both two-state and four-state modes.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

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 ✅ Completed 2026-10-28T15:52:52.957771Z 3dd8e2a New commits
ℹ️ 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 chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9358325182

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@tignear
tignear force-pushed the stack/tignear/feat/sv-foreign-class-specializations/specialize-pkg-classes-importing-scopes--94cfcf52 branch from 9358325 to f1522af Compare October 28, 2026 12:50
@tignear

tignear commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Synced onto master 8c81192 (after #2322 and #2421) by the uvm session while the author session was unresponsive. Conflicts kept both sides: class resolution keeps the built-in process fallback, the specialization spelling keeps both the container form and process, shared_scope keeps the foreign base declarations and the copy-on-write extends, and the review/case files keep both sets of entries. Semantic fix: a scope without classes of its own now discovers queries as before (its in-loop class signature pass), since the per-scope class signature binding interacted with the retried scope analysis for DPI queries in generate blocks. Retained Verilator/xezim diagnostics of the foreign cases moved 15 lines with the case file. Analyzer/frontend 886 passed, full SV 6,421 passed, retained-report and gate tests pass.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1522af5a8

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@tignear
tignear force-pushed the stack/tignear/feat/sv-foreign-class-specializations/specialize-pkg-classes-importing-scopes--94cfcf52 branch from f1522af to f8f23d8 Compare October 28, 2026 13:15

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8f23d87b0

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@tignear
tignear force-pushed the stack/tignear/feat/sv-foreign-class-specializations/specialize-pkg-classes-importing-scopes--94cfcf52 branch from f8f23d8 to 23ab4b8 Compare October 28, 2026 13:59
@mergify

mergify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

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

Allow modules, packages and compilation-unit classes to request package-class
specializations that the declaring package never names. This enables the UVM
registry pattern `typedef Registry#(User) type_id`, including calls through
`type_id::create()` that construct the supplied compilation-unit class.

Bind explicit actuals in the requesting scope and defaults, inherited member
types/constants and method bodies in their declaration scopes. Reuse one
canonical specialization and package state across importing scopes, preserving
nominal type identity, equivalent defaults, constructor defaults, static class
handles and distinct per-file compilation-unit classes. Discover signatures
before binding executable bodies with the supplied classes' metadata.

Keep module-local class actuals unsupported until their identity can distinguish
module instances. This change is independent of built-in process control and
virtual-interface support. It does not remove the existing restriction on
nonconstant package declaration initializers.

Add nine portable shared cases and API regressions for native images and
serialized checkpoints. Retain all 19 observed external-simulator failures with
unchanged expectations, exact diagnostics, standard review and six standalone
probes. xezim validation uses pinned source d491f948/core a25655a4 with a
regenerated dependency lock in an isolated Nix package; no simulator or
repository lock sources are changed.

Validation:
- All five backends: 50 foreign-specialization tests passed; class/package
  and concurrent-assertion regressions: 539 passed after syncing master.
  Package regressions: 70 passed after syncing master. Earlier full SV run: 6250 passed,
  20 ignored.
- Analyzer/frontend unit tests on master e7ec496: 896 passed, 3 ignored.
- NAPI/JS: 435 tests, playground 132 tests, and plugin/watch integration passed.
- Affected-crate Clippy, formatting and retained-report/gate checks passed.
- Nine external cases: Verilator 5 pass/4 retained failures, Icarus 9 retained
  failures, xezim 3 pass/6 retained failures. Standalone Celox probes pass in
  both two-state and four-state modes.

After syncing master 8c81192 (with #2322 and #2421): a scope without
classes of its own discovers queries as before, since it has no class
signatures to bind once; resolution keeps the built-in `process` fallback and
its type spelling. Analyzer/frontend units: 886 passed, 3 ignored; full SV:
6,421 passed, 20 skipped; retained-report and gate tests pass. Retained
Verilator/xezim diagnostics of the foreign cases follow their new case lines.

Review follow-ups: a request supplies only the caller's qualified routines
(the methods of the classes its actual type arguments name), not its own
unqualified functions; an unresolved name in a package class body binding
to an importing module's function also happens without importing-scope
specializations and is tracked in #2447. A compilation-unit typedef is named
with its source file, as compilation-unit classes are, so the same enum
typedef in two files gives two specializations; a Celox-only multi-file
test covers it, since IEEE 1800-2023 3.12.1 also allows one compilation unit
for all files (Verilator rejects the duplicate typedef). Analyzer/frontend
886, full SV 6,422 passed.

Second review round: a handle chain such as `a.next.next...` resolves each
receiver once for both the instance and the static property, instead of
doubling the walk per field; and a request binds against the template its
owner package declares, not a same-named class of another package in that
source (`class::foreign_generic_template_of_the_named_package`: Verilator
and xezim pass, Icarus rejects the class). Analyzer/frontend 887, full SV
6,427 passed.

Change-Id: I94cfcf52749ba3ad9d7e7d893e795c86bc146939
@tignear

tignear commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Synced onto master ad09446 (after #2411 and #2454). Conflicts kept both sides: the docs keep this PR's specialization wording and master's removal of ref arguments from the unsupported list (#2411), and the case, retained-report and review files keep both sets of entries. Retained Verilator/xezim diagnostics of the foreign cases follow their new case lines. Analyzer/frontend 894 and full SV 6,529 passed; retained-report and gate tests pass.

@tignear
tignear force-pushed the stack/tignear/feat/sv-foreign-class-specializations/specialize-pkg-classes-importing-scopes--94cfcf52 branch from 23ab4b8 to 3dd8e2a Compare October 28, 2026 15:50
@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 28, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 28, 2026
@mergify

mergify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

✅ Merged into master as a93bed0 at 17:13 UTC

54 min in the queue, 53 min of it CI.

So far

Merge conditions: 7 of 7 met

The batch, tested on draft #2463

Condition Required by
✅ check-success = Conventional Commit title —
✅ check-success = Queue validation —
✅ any of: check-success = @github-actions/Lint & Format, check-neutral = @github-actions/Lint & Format, check-skipped = @github-actions/Lint & Format GitHub repository ruleset rule master
✅ any of: check-success = @github-actions/Rust Test & NAPI Build, check-neutral = @github-actions/Rust Test & NAPI Build, check-skipped = @github-actions/Rust Test & NAPI Build GitHub repository ruleset rule master
✅ any of: check-success = @github-actions/JS Test (Ubuntu), check-neutral = @github-actions/JS Test (Ubuntu), check-skipped = @github-actions/JS Test (Ubuntu) GitHub repository ruleset rule master
✅ any of: check-success = @github-actions/Conventional Commit title, check-neutral = @github-actions/Conventional Commit title, check-skipped = @github-actions/Conventional Commit title GitHub repository ruleset rule master
✅ any of: check-success = @github-actions/Queue validation, check-neutral = @github-actions/Queue validation, check-skipped = @github-actions/Queue validation GitHub repository ruleset rule master

Times in UTC · dashboard · how the merge queue works

@mergify
mergify Bot merged commit a93bed0 into master Oct 28, 2026
23 checks passed
@mergify
mergify Bot deleted the stack/tignear/feat/sv-foreign-class-specializations/specialize-pkg-classes-importing-scopes--94cfcf52 branch October 28, 2026 17:13
@mergify mergify Bot removed the queued Mergify queue entry label Oct 28, 2026
@github-actions github-actions Bot mentioned this pull request Oct 31, 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