feat(decompress): reuse canonical Dctx view for DDict
Remove the C-only DDict offset globals and route production ZSTD_copyDDictParameters() through the existing C-produced DCtx view. This keeps the private decoder layout and optional fuzzing fields owned by the canonical projection while preserving the DDict entropy, prefix, window, and checksum state updates. Keep the synthetic offset writer test-only so the Rust unit tests remain independently linkable. Test Plan: - ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo check --manifest-path rust/cli/Cargo.toml --all-targets - ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo test --manifest-path rust/cli/Cargo.toml --all-targets (207 passed) - ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo clippy --manifest-path rust/cli/Cargo.toml --all-targets -- -D warnings - ulimit -v 41943040; CARGO_BUILD_JOBS=1 make -j1 - ulimit -v 41943040; CARGO_BUILD_JOBS=1 make -j1 -C tests test - git diff --check
This commit is contained in:
@@ -2,32 +2,7 @@
|
||||
* ZSTD_DDict implementation moved to rust/src/zstd_ddict.rs.
|
||||
*
|
||||
* Keep this translation unit in the original source list so the C build keeps
|
||||
* the same header configuration while the Rust static library provides the
|
||||
* exported symbols. The metadata below is deliberately compiled with the C
|
||||
* decoder's exact conditional layout: Rust uses it to fill the opaque DCtx
|
||||
* fields without duplicating optional C layout choices such as DYNAMIC_BMI2.
|
||||
* the same source topology while the Rust static library provides the
|
||||
* exported symbols. DDict parameter copying uses the canonical C-produced
|
||||
* ZSTD_rustDctxView, so this file no longer publishes private DCtx offsets.
|
||||
*/
|
||||
#define ZSTD_STATIC_LINKING_ONLY
|
||||
#include "zstd_decompress_internal.h"
|
||||
#include "zstd_ddict.h"
|
||||
|
||||
const size_t ZSTD_rust_ddict_llt_ptr_offset = offsetof(struct ZSTD_DCtx_s, LLTptr);
|
||||
const size_t ZSTD_rust_ddict_mlt_ptr_offset = offsetof(struct ZSTD_DCtx_s, MLTptr);
|
||||
const size_t ZSTD_rust_ddict_oft_ptr_offset = offsetof(struct ZSTD_DCtx_s, OFTptr);
|
||||
const size_t ZSTD_rust_ddict_huf_ptr_offset = offsetof(struct ZSTD_DCtx_s, HUFptr);
|
||||
const size_t ZSTD_rust_ddict_entropy_rep_offset = offsetof(struct ZSTD_DCtx_s, entropy.rep);
|
||||
const size_t ZSTD_rust_ddict_previous_dst_end_offset = offsetof(struct ZSTD_DCtx_s, previousDstEnd);
|
||||
const size_t ZSTD_rust_ddict_prefix_start_offset = offsetof(struct ZSTD_DCtx_s, prefixStart);
|
||||
const size_t ZSTD_rust_ddict_virtual_start_offset = offsetof(struct ZSTD_DCtx_s, virtualStart);
|
||||
const size_t ZSTD_rust_ddict_dict_end_offset = offsetof(struct ZSTD_DCtx_s, dictEnd);
|
||||
const size_t ZSTD_rust_ddict_lit_entropy_offset = offsetof(struct ZSTD_DCtx_s, litEntropy);
|
||||
const size_t ZSTD_rust_ddict_fse_entropy_offset = offsetof(struct ZSTD_DCtx_s, fseEntropy);
|
||||
const size_t ZSTD_rust_ddict_dict_id_offset = offsetof(struct ZSTD_DCtx_s, dictID);
|
||||
|
||||
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
const size_t ZSTD_rust_ddict_fuzz_begin_offset = offsetof(struct ZSTD_DCtx_s, dictContentBeginForFuzzing);
|
||||
const size_t ZSTD_rust_ddict_fuzz_end_offset = offsetof(struct ZSTD_DCtx_s, dictContentEndForFuzzing);
|
||||
#else
|
||||
const size_t ZSTD_rust_ddict_fuzz_begin_offset = (size_t)-1;
|
||||
const size_t ZSTD_rust_ddict_fuzz_end_offset = (size_t)-1;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user