feat(compress): move static CDict sizing into Rust
Route ZSTD_initStaticCDict() workspace-size calculation through the Rust CDict sizing policy, including the by-reference/by-copy, resolved row match-finder, and dedicated-search branches. Keep private layout constants at the C boundary and retain C ownership of static workspace construction and dictionary initialization. Remove the obsolete C match-state sizing adapter now that no C path calls it, avoiding a dead implementation after the sizing migration. Test Plan: - 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 -j1 - ulimit -v 41943040 && make -j1 -C tests test-zstream ZSTREAM_TESTTIME=-T2s - ulimit -v 41943040 && make -j1 -C tests test-fuzzer FUZZERTEST=-T3s FUZZER_FLAGS=--no-big-tests - ulimit -v 41943040 && cargo fmt --manifest-path rust/Cargo.toml -- --check - git diff --check
This commit is contained in:
@@ -1218,7 +1218,7 @@ pub struct ZSTD_rustMatchStateSizing {
|
||||
pub asanRedzoneSize: usize,
|
||||
}
|
||||
|
||||
/// C-only layout inputs for `ZSTD_estimateCDictSize_advanced()`.
|
||||
/// C-only layout inputs for CDict workspace-size formulas.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub struct ZSTD_rustCDictSizing {
|
||||
@@ -2689,6 +2689,29 @@ mod tests {
|
||||
},
|
||||
by_ref
|
||||
);
|
||||
|
||||
let resolved_row_match_finder = resolve_row_match_finder(ZSTD_RUST_PS_AUTO, cparams);
|
||||
let static_cdict = estimate_cdict_size_from_cparams(
|
||||
123,
|
||||
cparams,
|
||||
1,
|
||||
resolved_row_match_finder,
|
||||
true,
|
||||
sizing,
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
ZSTD_rust_params_estimateCDictWorkspaceSize(
|
||||
123,
|
||||
cparams,
|
||||
1,
|
||||
resolved_row_match_finder,
|
||||
1,
|
||||
&sizing,
|
||||
)
|
||||
},
|
||||
static_cdict
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user