Repository navigation
feat(sv)!: support dynamic arrays queues and associative arrays - #2149
Conversation
|
This pull request is part of a Mergify stack:
|
40e6528 to
b139a79
Compare
Revision history
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b139a79263
ℹ️ 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".
| let handle = self.handle(&args[0])?; | ||
| let mut index_mask = zero; | ||
| let index = match op { | ||
| Size | Clear | PushFront | PopFront => zero, | ||
| PushBack => self.heap_call(code(heap::LEN), &[handle]), |
There was a problem hiding this comment.
Evaluate queue arguments before capturing the receiver contents
When an argument mutates the same queue, this captures the queue's immutable handle and append index before evaluating that argument. For example, after q = '{1, 2}; q.push_back(q.pop_front());, the inner pop updates q, but the outer push uses the old handle and length, producing '{1, 2, 1} instead of '{2, 1} and overwriting the pop's update. Evaluate the argument first, then load the current receiver handle and compute the append index before performing the outer mutation.
Useful? React with 👍 / 👎.
b139a79 to
f7c4508
Compare
## Summary
SystemVerilog declarations such as `int values[]`, `int queue[$]` and
`int lookup[string]` now bind to runtime container values. Preserve `new[]`
operands in declaration initializers and lower element accesses, value copies,
queue methods, associative traversal, equality and foreach through the heap ABI.
Track the receiver and traversal output as process writes, preserve X/Z, and keep
string and object elements reachable during collection and checkpoint restore.
The initial subset is one-dimensional containers with packed elements up to
64 bits, strings or class handles, and integral/string associative keys. The
reference guide documents unsupported forms. Shared cases cover ordinary and
bounded queues, resize/copy/default behavior, signed and string keys, string-key
foreach, invalid indices, equality and unchanged-value event waits. Celox API
tests cover serialized checkpoints and negative allocation sizes.
## Validation
- `cargo test --locked -p celox --features systemverilog,cranelift,wasm-runtime --test systemverilog`: 5,516 passed, 20 existing ignores.
- `cargo test --locked -p celox --features systemverilog,cranelift,wasm-runtime --test systemverilog containers::`: 88 passed, including 10 new nested-argument regressions.
- `cargo test --locked -p celox-sv-analyzer -p celox-sv-syntax -p celox-frontend-sv --lib`: 829 analyzer, 131 syntax and 7 frontend tests passed.
- Clippy passed for the affected frontend, syntax, analyzer, Celox and shared-suite crates with all targets and native/Cranelift/WASM features.
- NAPI rebuilt successfully; its 34 unit tests and 435 JavaScript tests passed.
- `cargo fmt --all -- --check` and `git diff --check` passed.
External verification was run with `verify-sv-verilator`, `verify-sv-icarus`
and `verify-sv-xezim` using focused `containers::` filters. The pinned xezim is
0.11.3 (flake revision `058f2bba58648452e5799d17572356ebcae7d163`). Reproduce its
16-case run with:
```sh
nix develop .#xezim -c cargo run --locked -p celox-test-suite --features xezim --bin verify-sv-xezim -- --filter containers::
```
These independent checks are not fully passing:
| Tool | Passed | Compile errors | Mismatches | Unsupported four-state cases |
| --- | ---: | ---: | ---: | ---: |
| Verilator 5.052 | 7 | 4 | 2 | 3 |
| Icarus 13.0 | 3 | 12 | 1 | 0 |
| xezim 0.11.3 | 6 | 0 | 10 | 0 |
xezim compiles all 16 cases. It independently passes signed and string
associative-key traversal, integer/string foreach, string elements across GC,
and unchanged-value event waits. The remaining assertion differences are:
| Case in `containers::` | Expected | xezim |
| --- | ---: | ---: |
| `dynamic_resize_and_copy` | `0xff` | `0xef` |
| `queue_methods` | `0xff` | `0xdf` |
| `declaration_initializers_and_locals` | `1` | `0` |
| `four_state_elements_and_indices` | `0xff` | `0xcf` |
| `bounded_queue_and_equality` | `0xff` | `0xcc` |
| `four_state_container_equality` | `0xf` | `0xd` |
| `object_elements_keep_handle_semantics` | `0xf` | `0x7` |
| `runtime_queries_and_traversal_conversion` | `0xff` | `0xd7` |
| `queue_argument_side_effects` | `0xff` | `0x38` |
| `queue_argument_four_state` | `1` | `0` |
Standalone diagnostic probes observe retained out-of-range stores, untruncated
bounded-queue assignment, zero/default mismatches for four-state missing entries,
logical array equality returning 0 with X/Z operands, `first(byte_index)` returning
1 after truncation, and `$dimensions` returning 2 for a dynamic array of class
handles. Queue-append and declaration-initializer results vary with hierarchy or
instrumentation and remain unresolved comparisons. Expectations were checked
against IEEE 1800-2023 7.4.5/Table 7-1, 7.5.1, 7.9.8, 7.10.1/7.10.5,
11.2.2/11.4.5 and 20.7.
The runtime-query fixture uses `bit [31:0]` elements so its zero-default
assertions describe a two-state type; its assertions were preserved. The revised
case passes Celox's backend matrix, while both Verilator and Icarus still reject
its narrowed traversal call or other unsupported syntax.
Verilator differs on signed associative-key traversal/foreach and rejects or
fails to generate C++ for queue `$+1`, mixed-bound queue equality, aggregate
event expressions and narrowed traversal outputs. Icarus lacks the required
associative-array support and has other compile failures; unchanged-value event
waits also differ. Four-state cases remain enabled in Celox's backend matrix.
The external-comparison failures require review before this stack is merge-ready;
no retained verification JSON or exclusion manifests were refreshed.
## P2 review correction
Evaluate container indices and element arguments before reading the receiver's
immutable heap handle and deriving the append position. For example,
`q = {1, 2}; q.push_back(q.pop_front());` now leaves `{2, 1}` and preserves
the inner mutation. The same ordering applies to front insertion, indexed
insert/delete and indexed reads. IEEE 1800-2023 7.10.2 and 13.5 describe the
queue operations and input argument passing; the tests do not depend on an
ordering between multiple side-effecting arguments.
Two portable regression cases cover integer, bounded, string and four-state
queues. All 10 backend registrations failed before the fix and pass afterward;
the complete focused container matrix passes 88 tests. Frontend unit tests,
affected-crate Clippy, formatting, the NAPI rebuild and 435 JS tests also pass.
Icarus passes both new cases; Verilator passes the ordinary case and its adapter
cannot execute the four-state case. xezim compiles both but differs on both.
An isolated xezim probe produces `{2, 2, 1}` after the nested push/pop example,
and also retains an extra element for front/insert and string variants.
External totals above combine the previously validated 14 cases with these two
new cases. Existing external discrepancies remain unresolved.
## sv-tests expectation review
Update exactly 22 retained `fail -> pass` verdicts for the new container support:
nine associative-array cases, dynamic-array `new[]` and the queue declaration
case, each in both state modes. Review the pinned upstream sources and official
logs from CI run 40323383639: eight cases execute and pass simulation assertions;
three cases pass elaboration only. Document those coverage boundaries in the
conformance README. The byte-key traversal case already truncates its key at
insertion and correctly returns 1 for its equally wide output.
Reconcile all 3,300 artifact verdicts with the updated expectations and official
runner logs: no remaining differences and no passing-case regression. The pinned
revision is unchanged; 1,201 cases pass in 2state and 1,212 in 4state. The five
runner aggregation/schema tests and `git diff --check` pass. This expectation-only
follow-up reuses the reviewed CI execution evidence; it does not rerun the full
upstream corpus locally or change simulator code, external-comparison exclusions
or retained verification JSON.
BREAKING CHANGE: the public analyzer `ObjectOp` enum gains a `Container` variant;
consumers with exhaustive matches must handle it.
Change-Id: I864df12b30e1b7154418b3017341c898742f997d
f7c4508 to
3902590
Compare
|
Queued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 31 minutes 39 seconds in the queue, including 29 minutes 54 seconds running CI. Required conditions to merge
|
Give each dynamic process execution its own deferred assertion report queue. Event/wait resumption flushes only that process; disable fork cancels live children's reports, while natural completion preserves reports across slot reuse. Keep owner context around kernel and host-request execution, including error and stop paths, without changing the backend event ring ABI. Host-owned monotonic identities stay outside core checkpoints. Core restore starts fresh ownership without withdrawing host reports; mirror copies queues and identities together. Resolve deferred string arguments consumed by the raw drain before heap replacement or collection. Failed portable loads restore the previous ownership context. Preserve conservative lost-fatal handling for ordinary multi-queue contexts while a dynamic process flush clears its loss. Mature Observed reports before Reactive program work, so a later wakeup cannot flush them; keep Final reports flushable until Postponed. Actions remain single display/severity calls. Distinguish assert/assume/cover final from actual final procedures in the shared timed-case validator. Validation: 1,112 timing tests, all 104 deferred-assertion API tests, six host ownership/raw-drain/restore units, 20 state-file API regressions, 32 suite units, four retained-report tests and nine Node report tests passed. The nine new shared cases pass 55 registered backend tests (native, native-image, native-parallel, Cranelift, Cranelift-parallel, WASM, plus an actual interpreter loop). Runtime units passed all 78 tests. Affected all-target clippy and formatting passed. Debug NAPI built and all nine tests in the timing, cascaded clock and runtime-event JS consumer files passed. Direct SystemVerilog fork semantics are verified through Rust Simulation; the JS bridge has no SV-input API. External observations remain failures, with exact reviewed records: xezim 0.11.3 has 2 passes and 7 mismatches; Verilator 5.052 has 2 passes, 3 mismatches, 3 compiler faults and 1 unsupported four-state case; Icarus 13.0 rejects all 9 with unsupported-deferred-assertion diagnostics. A standalone xezim #0 probe reproduces missing reports against IEEE 1800-2023 16.4.1/16.4.2. No exclusions or passing expectations replace these failures. Rebased onto master 9261b31 after #2146, #2149 and #2134. Preserve both function-fork and deferred-fork registrations and retained evidence. Post-sync validation passed 1,149 timing tests, 104 deferred API tests, six host units, 20 final-procedure tests, 20 state-file tests, four retained report tests and nine Node report tests, plus affected all-target clippy and formatting. Runtime ownership and Observed/Reactive logic are unchanged by conflict resolution; external fixtures and adapters are unchanged. Completes deferred assertion composition portion of #2111. Change-Id: I919ac183ed4c78ec100696954402308a01cb64ee
Give each dynamic process execution its own deferred assertion report queue. Event/wait resumption flushes only that process; disable fork cancels live children's reports, while natural completion preserves reports across slot reuse. Keep owner context around kernel and host-request execution, including error and stop paths, without changing the backend event ring ABI. Host-owned monotonic identities stay outside core checkpoints. Core restore starts fresh ownership without withdrawing host reports; mirror copies queues and identities together. Resolve deferred string arguments consumed by the raw drain before heap replacement or collection. Failed portable loads restore the previous ownership context. Preserve conservative lost-fatal handling for ordinary multi-queue contexts while a dynamic process flush clears its loss. Mature Observed reports before Reactive program work, so a later wakeup cannot flush them; keep Final reports flushable until Postponed. Actions remain single display/severity calls. Distinguish assert/assume/cover final from actual final procedures in the shared timed-case validator. Validation: 1,112 timing tests, all 104 deferred-assertion API tests, six host ownership/raw-drain/restore units, 20 state-file API regressions, 32 suite units, four retained-report tests and nine Node report tests passed. The nine new shared cases pass 55 registered backend tests (native, native-image, native-parallel, Cranelift, Cranelift-parallel, WASM, plus an actual interpreter loop). Runtime units passed all 78 tests. Affected all-target clippy and formatting passed. Debug NAPI built and all nine tests in the timing, cascaded clock and runtime-event JS consumer files passed. Direct SystemVerilog fork semantics are verified through Rust Simulation; the JS bridge has no SV-input API. External observations remain failures, with exact reviewed records: xezim 0.11.3 has 2 passes and 7 mismatches; Verilator 5.052 has 2 passes, 3 mismatches, 3 compiler faults and 1 unsupported four-state case; Icarus 13.0 rejects all 9 with unsupported-deferred-assertion diagnostics. A standalone xezim #0 probe reproduces missing reports against IEEE 1800-2023 16.4.1/16.4.2. No exclusions or passing expectations replace these failures. Rebased onto master 9261b31 after #2146, #2149 and #2134. Preserve both function-fork and deferred-fork registrations and retained evidence. Post-sync validation passed 1,149 timing tests, 104 deferred API tests, six host units, 20 final-procedure tests, 20 state-file tests, four retained report tests and nine Node report tests, plus affected all-target clippy and formatting. Runtime ownership and Observed/Reactive logic are unchanged by conflict resolution; external fixtures and adapters are unchanged. Completes deferred assertion composition portion of #2111. Latest master synchronization preserves compound-event tests and retained report entries. Revalidated 83 fork/deferred integration tests, all 104 deferred assertion API tests, 49 focused deferred tests including host units, four retained-report tests and seven report script tests. Affected-crate Clippy and formatting pass. Change-Id: I919ac183ed4c78ec100696954402308a01cb64ee
Summary
SystemVerilog declarations such as
int values[],int queue[$]andint lookup[string]now bind to runtime container values. Preservenew[]operands in declaration initializers and lower element accesses, value copies,
queue methods, associative traversal, equality and foreach through the heap ABI.
Track the receiver and traversal output as process writes, preserve X/Z, and keep
string and object elements reachable during collection and checkpoint restore.
The initial subset is one-dimensional containers with packed elements up to
64 bits, strings or class handles, and integral/string associative keys. The
reference guide documents unsupported forms. Shared cases cover ordinary and
bounded queues, resize/copy/default behavior, signed and string keys, string-key
foreach, invalid indices, equality and unchanged-value event waits. Celox API
tests cover serialized checkpoints and negative allocation sizes.
Validation
cargo test --locked -p celox --features systemverilog,cranelift,wasm-runtime --test systemverilog: 5,516 passed, 20 existing ignores.cargo test --locked -p celox --features systemverilog,cranelift,wasm-runtime --test systemverilog containers::: 88 passed, including 10 new nested-argument regressions.cargo test --locked -p celox-sv-analyzer -p celox-sv-syntax -p celox-frontend-sv --lib: 829 analyzer, 131 syntax and 7 frontend tests passed.cargo fmt --all -- --checkandgit diff --checkpassed.External verification was run with
verify-sv-verilator,verify-sv-icarusand
verify-sv-xezimusing focusedcontainers::filters. The pinned xezim is0.11.3 (flake revision
058f2bba58648452e5799d17572356ebcae7d163). Reproduce its16-case run with:
nix develop .#xezim -c cargo run --locked -p celox-test-suite --features xezim --bin verify-sv-xezim -- --filter containers::These independent checks are not fully passing:
xezim compiles all 16 cases. It independently passes signed and string
associative-key traversal, integer/string foreach, string elements across GC,
and unchanged-value event waits. The remaining assertion differences are:
containers::dynamic_resize_and_copy0xff0xefqueue_methods0xff0xdfdeclaration_initializers_and_locals10four_state_elements_and_indices0xff0xcfbounded_queue_and_equality0xff0xccfour_state_container_equality0xf0xdobject_elements_keep_handle_semantics0xf0x7runtime_queries_and_traversal_conversion0xff0xd7queue_argument_side_effects0xff0x38queue_argument_four_state10Standalone diagnostic probes observe retained out-of-range stores, untruncated
bounded-queue assignment, zero/default mismatches for four-state missing entries,
logical array equality returning 0 with X/Z operands,
first(byte_index)returning1 after truncation, and
$dimensionsreturning 2 for a dynamic array of classhandles. Queue-append and declaration-initializer results vary with hierarchy or
instrumentation and remain unresolved comparisons. Expectations were checked
against IEEE 1800-2023 7.4.5/Table 7-1, 7.5.1, 7.9.8, 7.10.1/7.10.5,
11.2.2/11.4.5 and 20.7.
The runtime-query fixture uses
bit [31:0]elements so its zero-defaultassertions describe a two-state type; its assertions were preserved. The revised
case passes Celox's backend matrix, while both Verilator and Icarus still reject
its narrowed traversal call or other unsupported syntax.
Verilator differs on signed associative-key traversal/foreach and rejects or
fails to generate C++ for queue
$+1, mixed-bound queue equality, aggregateevent expressions and narrowed traversal outputs. Icarus lacks the required
associative-array support and has other compile failures; unchanged-value event
waits also differ. Four-state cases remain enabled in Celox's backend matrix.
The external-comparison failures require review before this stack is merge-ready;
no retained verification JSON or exclusion manifests were refreshed.
P2 review correction
Evaluate container indices and element arguments before reading the receiver's
immutable heap handle and deriving the append position. For example,
q = {1, 2}; q.push_back(q.pop_front());now leaves{2, 1}and preservesthe inner mutation. The same ordering applies to front insertion, indexed
insert/delete and indexed reads. IEEE 1800-2023 7.10.2 and 13.5 describe the
queue operations and input argument passing; the tests do not depend on an
ordering between multiple side-effecting arguments.
Two portable regression cases cover integer, bounded, string and four-state
queues. All 10 backend registrations failed before the fix and pass afterward;
the complete focused container matrix passes 88 tests. Frontend unit tests,
affected-crate Clippy, formatting, the NAPI rebuild and 435 JS tests also pass.
Icarus passes both new cases; Verilator passes the ordinary case and its adapter
cannot execute the four-state case. xezim compiles both but differs on both.
An isolated xezim probe produces
{2, 2, 1}after the nested push/pop example,and also retains an extra element for front/insert and string variants.
External totals above combine the previously validated 14 cases with these two
new cases. Existing external discrepancies remain unresolved.
sv-tests expectation review
Update exactly 22 retained
fail -> passverdicts for the new container support:nine associative-array cases, dynamic-array
new[]and the queue declarationcase, each in both state modes. Review the pinned upstream sources and official
logs from CI run 40323383639: eight cases execute and pass simulation assertions;
three cases pass elaboration only. Document those coverage boundaries in the
conformance README. The byte-key traversal case already truncates its key at
insertion and correctly returns 1 for its equally wide output.
Reconcile all 3,300 artifact verdicts with the updated expectations and official
runner logs: no remaining differences and no passing-case regression. The pinned
revision is unchanged; 1,201 cases pass in 2state and 1,212 in 4state. The five
runner aggregation/schema tests and
git diff --checkpass. This expectation-onlyfollow-up reuses the reviewed CI execution evidence; it does not rerun the full
upstream corpus locally or change simulator code, external-comparison exclusions
or retained verification JSON.
BREAKING CHANGE: the public analyzer
ObjectOpenum gains aContainervariant;consumers with exhaustive matches must handle it.
Depends-On: #2148