feat(compress): move overflow correction policy into Rust

Move the overflow-correction branch and ordering into the Rust rewrite while
keeping the C-owned window correction, workspace table markers, index reducer,
and dictionary fields behind callbacks. Rust now preserves the original
need-correction fast path, dirty/reduce/clean ordering, saturating
nextToUpdate adjustment, and dictionary invalidation. Add focused callback
ordering and safe-window tests.

Test Plan:
- ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo fmt --manifest-path rust/Cargo.toml -- --check
- ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo test --manifest-path rust/Cargo.toml overflow_correction -- --nocapture
- ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo test --manifest-path rust/Cargo.toml
- ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings
- ulimit -v 41943040 make -B -C programs -j1 zstd
- ulimit -v 41943040 make -C tests -j1 test-zstream ZSTREAM_TESTTIME=-T1s
This commit is contained in:
2026-07-19 19:30:20 +02:00
parent 9c298999ac
commit 1cb3efd0af
3 changed files with 312 additions and 18 deletions
+4 -2
View File
@@ -53,7 +53,9 @@ zstd ABI:
owns the single-threaded buffered/stable stream state machine, including
direct versus buffered output, pending-output draining, and frame reset
policy. The external-sequence-and-literals block loop and public sequence
conversion are Rust-owned as well; C retains only CCtx-facing adapters.
conversion are Rust-owned as well; Rust also owns overflow-correction
branch/order while C retains the private window, workspace, and index
callbacks and only CCtx-facing adapters.
- `zstd_compress_frame` serializes frame headers, skippable frames, and the
last empty block; it takes scalar frame parameters so the C-owned
`ZSTD_CCtx_params` layout never crosses the language boundary.
@@ -152,7 +154,7 @@ single-threaded stream initialization and the buffered/stable stream state
machine, MT stream initialization, MT outer scheduling and flush policy, MT
compression-job stage sequencing and error flow, MT frame-progression job
aggregation, frame-block preparation ordering, MT serial turn/skip and
LDM/checksum sequencing, public sequence-API
LDM/checksum sequencing, overflow-correction policy/order, public sequence-API
orchestration, sequence-store and block policy, external-producer invocation
and success-path validation, external-sequence-store reset,
external-sequence/literals block loop, optional-format decompression loops,