feat(decompress): move DCtx prefix copy into Rust

Move the `ZSTD_copyDCtx` prefix-copy leaf into the Rust decompression module.
Rust uses the C-projected address of `inBuff` to preserve the exact private
context cutoff, while C retains the configuration-dependent context layout
and shallow-pointer ownership semantics. Add a focused boundary test and
remove the now-unused C copy helper.

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 copy_prefix -- --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:32:48 +02:00
parent 1cb3efd0af
commit bd9ca5115d
3 changed files with 35 additions and 11 deletions
+3 -2
View File
@@ -119,8 +119,9 @@ zstd ABI:
- `zstd_decompress` owns the public decompression context, one-shot,
dictionary, parameter, and streaming state machines. Its C shim retains
the configuration-dependent context layout and platform details, plus
legacy and trace leaves; Rust owns decoder storage allocation and custom
memory dispatch.
legacy and trace leaves; Rust owns decoder storage allocation, custom
memory dispatch, and the `ZSTD_copyDCtx` prefix copy up to the projected
`inBuff` field.
- Command-line frontend
- `zstd_cli` owns the Rust parser, safety policy, and dispatch. It is built
by the separate `cli/` static-library package only for program archives,