feat(compress): move CCtx reset storage policy into Rust

Move the post-match-state CCtx storage reservation and publication policy into
Rust while keeping the private C workspace and context layouts behind narrow
callbacks. The Rust leaf now preserves the sequence, LDM, external-sequence,
literal, buffered-input/output, bucket, and entropy-code allocation order,
including zeroing and reset callbacks. C remains responsible for workspace
resize/layout, private field publication, allocator callbacks, and the LDM
window reset details. ABI layout assertions and fake-callback tests cover
ordinary, LDM/external-producer, and allocation-failure paths.

Test Plan:
- ulimit -v 41943040 && CARGO_BUILD_JOBS=1 cargo fmt --manifest-path rust/Cargo.toml
- ulimit -v 41943040 && CARGO_BUILD_JOBS=1 cargo test --manifest-path rust/Cargo.toml cctx_storage --lib (3 passed)
- ulimit -v 41943040 && CARGO_BUILD_JOBS=1 cargo test --manifest-path rust/Cargo.toml --lib (683 passed)
- 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 (passed; existing fileio const-cast warnings)
- ulimit -v 41943040 && make -C tests -j1 test-zstream ZSTREAM_TESTTIME=-T1s (84 tests and both short fuzz rounds passed; existing zstreamtest warning)
This commit is contained in:
2026-07-19 18:16:44 +02:00
parent 853792f2c4
commit db8c58ac97
3 changed files with 930 additions and 57 deletions
+3 -2
View File
@@ -166,8 +166,9 @@ CDict advanced private workspace construction, private static-CCtx and
static-CDict workspace construction and dictionary-content allocation/loading,
and advanced-CDict dictionary-content loading remain in C. Rust now owns
advanced-CDict custom-memory validation, workspace-size query/allocation,
allocation/create/init cleanup ordering, the CCtx workspace-size formula, and
the scalar CCtx-reset plan and match-state reset policy/order; C retains
allocation/create/init cleanup ordering, the CCtx workspace-size formula, the
scalar CCtx-reset plan, post-match-state storage reservation order, and
match-state reset policy/order; C retains
private layout-size inputs, workspace resize/layout, private field publication,
and allocator callbacks. Private CCtx reset/matchfinder/workspace operations
and codec/adaptive-policy