Skip to content

feat(sv)!: support unconstrained class randomization - #1767

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/sv-class-randomize/support-unconstrained-class-randomization--f4e53d32
Oct 23, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/sv-class-randomize/support-unconstrained-class-randomization--f4e53d32

Conversation

@tignear

@tignear tignear commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Calling object.randomize() randomizes 2-state, non-enum integral rand properties up to 64 bits and returns signed int success. Invoke pre_randomize and post_randomize around updates, preserve non-rand properties, and support srandom(seed) with independent per-object random streams seeded by the creating process.

Register constructor seeding as a process RNG consumer before computing FF state targets, so checkpoint/restore replays object seeds from edge-triggered processes. Reject invalid receivers before hooks, random draws or property writes: a null or mismatched runtime class records a runtime fault and returns failure without those side effects.

Retain rand/randc and constraint metadata so unsupported randomization is rejected explicitly. Constraints, randc, static random properties, randomize argument lists, non-integral random properties and inheritance remain outside this first subset. Preserve master's static properties, constructor chaining, virtual methods and interface classes when integrating this subset.

Differential scheduler checks compare live class objects, including RNG state and future object allocation handles, so divergent random draws are detected before a subsequent property update.

Add portable shared cases, backend and rejection regressions, and English/Japanese reference documentation. Record Icarus 13.0's missing randomize/srandom methods with original compile diagnostics and exact case exclusions.

Validation on master d7bb5a3:

  • Reproduced the constructor checkpoint mismatch and rejected-receiver property mutation on all four applicable backend variants before their fixes.
  • Class integration tests: 110 passed, including checkpoint replay, null receiver hooks and base-handle mutation guards.
  • Existing urandom integration tests: 81 passed.
  • Syntax, analyzer, heap and SV frontend unit tests: 931 passed, 3 existing ignores.
  • Retained-report consistency tests: 3 passed.
  • NAPI debug build and JS tests: 432 passed across 15 files.
  • Formatting, diff checks and Clippy for the four changed implementation crates and SystemVerilog integration target.
  • Shared executable cases and external adapters are unchanged from their earlier validation: Verilator randomize filter passed 4 cases; Icarus rejected the two class cases for unsupported methods, recorded as limitations rather than passes.

Additional P2 validation: heap tests (16), differential scheduler tests (5), and class integration tests in differential mode (110) pass. New tests reproduce RNG-only and object-content comparison omissions before the fix. Heap and Celox Clippy, formatting and diff checks pass.

BREAKING CHANGE: Public SystemVerilog syntax structs gain constraint/randc metadata, and ObjectOp and heap Fault gain enum variants. Downstream struct literals and exhaustive matches must be updated.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 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-23T11:42:46.632671Z ea71f96 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: 20f2212e3f

ℹ️ 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-class-randomize/support-unconstrained-class-randomization--f4e53d32 branch from 20f2212 to d18dd9d Compare October 22, 2026 20:40
@tignear

tignear commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial 20f2212 2026-10-22 20:38 UTC
2 content 20f2212 → d18dd9d Fix CI retained-report validation: add the two reviewed Icarus class randomization exclusions to the retained class report. Reproduced the failure locally; all three retained_reports tests now pass. 2026-10-22 20:38 UTC
3 content d18dd9d → 97c87d2 2026-10-22 21:59 UTC
4 content 97c87d2 → d0001c2 Resolve conflicts with master d7bb5a3 while preserving new class features. Fix P1 constructor RNG checkpoint persistence and P2 invalid-receiver side effects, with reproductions before fixes and re… 2026-10-23 00:05 UTC
5 content d0001c2 → da2f9e7 Address P2 differential heap comparison: compare object properties, RNG state and future allocation handles. Reproduced omissions before fixing; heap tests 16, differential scheduler tests 5, differe… 2026-10-23 00:46 UTC
6 content da2f9e7 → 4b459d1 Rebase on current master to resolve interface-class and class-cast integration conflicts before publishing the dependent randomization controls PR. 2026-10-23 01:31 UTC
7 content 4b459d1 → f301ea0 Resolve conflicts with current master while preserving class randomization and upstream changes. 2026-10-23 05:49 UTC
8 content f301ea0 → ea71f96 Refresh against current master and preserve both upstream and randomization changes in newly conflicting files.

Adapt the object-RNG differential regression to the new ShadowCheck constructor,…
2026-10-23 11:36 UTC

@tignear
tignear force-pushed the stack/tignear/feat/sv-class-randomize/support-unconstrained-class-randomization--f4e53d32 branch from d18dd9d to 97c87d2 Compare October 22, 2026 22:01

@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: 97c87d2bdc

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

self.heap_call(ops::encode(ops::OBJECT_NEW, u64::from(*class)), &[size]);
// Object seeding consumes the creating process's RNG once,
// before the constructor body (IEEE 1800-2023 18.14.3).
let seed = self.urandom(None)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Register constructor seeding as an FF state target

When new executes in an edge-triggered process, this reaches urandom_state() only while exec_block lowers the body, but Ff::lower_process has already frozen its target ranges and Ff::scan skips all Callee::Object calls. The hidden process RNG therefore remains in working scratch instead of being committed to stable state; for example, after creating an object, checkpointing, creating another, and restoring, the next object's seed continues from the post-checkpoint scratch value rather than replaying the saved stream. Have the scan recognize ObjectOp::New as a process-RNG consumer before FF targets are computed.

Useful? React with 👍 / 👎.

@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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

@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-class-randomize/support-unconstrained-class-randomization--f4e53d32 branch from 97c87d2 to d0001c2 Compare October 23, 2026 00:06

@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: d0001c2e15

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

Comment thread crates/celox-heap/src/objects.rs Resolved
@tignear
tignear force-pushed the stack/tignear/feat/sv-class-randomize/support-unconstrained-class-randomization--f4e53d32 branch 2 times, most recently from da2f9e7 to 4b459d1 Compare October 23, 2026 01:32
@tignear

tignear commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 feat(sv)!: support unconstrained class randomization #1767 👈
2 feat(sv)!: support inherited randomization and rand_mode #1787

@mergify mergify Bot added the queued Mergify queue entry label Oct 23, 2026
@mergify

mergify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-23 02:25 UTC · Rule: changes · triggered by rule Queue explicitly requested merges
  • 🚫 Left the queue — 2026-10-23 03:40 UTC · at 4b459d15014069d2f60f8bfc54cbaa70c2b3e69c

This pull request spent 1 hour 15 minutes 58 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 #1776, #1783 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 23, 2026
@tignear
tignear force-pushed the stack/tignear/feat/sv-class-randomize/support-unconstrained-class-randomization--f4e53d32 branch from 4b459d1 to f301ea0 Compare October 23, 2026 05:49
@mergify mergify Bot removed the dequeued Mergify stopped this queue entry; investigate before retrying label Oct 23, 2026
Calling object.randomize() randomizes 2-state, non-enum integral rand properties up to 64 bits and returns signed int success. Invoke pre_randomize and post_randomize around updates, preserve non-rand properties, and support srandom(seed) with independent per-object random streams seeded by the creating process.

Register constructor seeding as a process RNG consumer before computing FF state targets, so checkpoint/restore replays object seeds from edge-triggered processes. Reject invalid receivers before hooks, random draws or property writes: a null or mismatched runtime class records a runtime fault and returns failure without those side effects.

Retain rand/randc and constraint metadata so unsupported randomization is rejected explicitly. Constraints, randc, static random properties, randomize argument lists, non-integral random properties and inheritance remain outside this first subset. Preserve master's static properties, constructor chaining, virtual methods and interface classes when integrating this subset.

Differential scheduler checks compare live class objects, including RNG state and future object allocation handles, so divergent random draws are detected before a subsequent property update.

Add portable shared cases, backend and rejection regressions, and English/Japanese reference documentation. Record Icarus 13.0's missing randomize/srandom methods with original compile diagnostics and exact case exclusions.

Validation on master d7bb5a3:
- Reproduced the constructor checkpoint mismatch and rejected-receiver property mutation on all four applicable backend variants before their fixes.
- Class integration tests: 110 passed, including checkpoint replay, null receiver hooks and base-handle mutation guards.
- Existing urandom integration tests: 81 passed.
- Syntax, analyzer, heap and SV frontend unit tests: 931 passed, 3 existing ignores.
- Retained-report consistency tests: 3 passed.
- NAPI debug build and JS tests: 432 passed across 15 files.
- Formatting, diff checks and Clippy for the four changed implementation crates and SystemVerilog integration target.
- Shared executable cases and external adapters are unchanged from their earlier validation: Verilator randomize filter passed 4 cases; Icarus rejected the two class cases for unsupported methods, recorded as limitations rather than passes.

Additional P2 validation: heap tests (16), differential scheduler tests (5), and class integration tests in differential mode (110) pass. New tests reproduce RNG-only and object-content comparison omissions before the fix. Heap and Celox Clippy, formatting and diff checks pass.

BREAKING CHANGE: Public SystemVerilog syntax structs gain constraint/randc metadata, and ObjectOp and heap Fault gain enum variants. Downstream struct literals and exhaustive matches must be updated.

Change-Id: If4e53d32f02e495546c1154f9f0aad3897e71e9b
@tignear
tignear force-pushed the stack/tignear/feat/sv-class-randomize/support-unconstrained-class-randomization--f4e53d32 branch from f301ea0 to ea71f96 Compare October 23, 2026 11:38
@mergify mergify Bot added the queued Mergify queue entry label Oct 23, 2026
@mergify

mergify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-23 12:25 UTC · Rule: changes · triggered by rule Queue explicitly requested merges
  • ✅ Checks passed · on draft merge queue: checking #1767 on master (5eea1b3) #1827
  • ✅ Merged — 2026-10-23 13:38 UTC · at a5ed7470b2f3e3091d8ad8a581132b8db0874595 · merge

This pull request spent 1 hour 13 minutes 8 seconds in the queue, including 1 hour 11 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 a5ed747 into master Oct 23, 2026
30 checks passed
@mergify
mergify Bot deleted the stack/tignear/feat/sv-class-randomize/support-unconstrained-class-randomization--f4e53d32 branch October 23, 2026 13:38
@mergify mergify Bot removed the queued Mergify queue entry label Oct 23, 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