refactor(ldm): expose parameter adjustment from Rust

Move the pure LDM parameter-defaulting policy behind the original
ZSTD_ldm_adjustParameters() ABI symbol. Rust now receives the existing C
parameter structs directly, applies the same 30/8/8 build constants, and
keeps the ASAN-sensitive table-size projection in C.

Test Plan:
- `cc -fsyntax-only -Ilib -Ilib/common -Ilib/compress -Ilib/decompress -Ilib/dict -Ilib/legacy lib/compress/zstd_ldm.c` -- passed.
- `cargo +nightly fmt --manifest-path rust/Cargo.toml --all -- --check` -- passed.
- `git diff --check` and `git diff --cached --check` -- passed.
- Heavy verification intentionally deferred until the combined seam set is ready.
This commit is contained in:
2026-07-20 13:57:15 +02:00
parent b8e5932282
commit fe3587c637
2 changed files with 19 additions and 25 deletions
-11
View File
@@ -251,9 +251,6 @@ typedef char ZSTD_rust_ldm_rep_count[(ZSTD_REP_NUM == 3) ? 1 : -1];
typedef char ZSTD_rust_ldm_strategy_values_check[
(ZSTD_fast == 1 && ZSTD_dfast == 2 && ZSTD_btultra2 == 9) ? 1 : -1];
void ZSTD_rust_ldm_adjustParameters(
void* params, U32 windowLog, int strategy,
U32 hashLogMax, U32 bucketSizeLogMax, int btultra);
size_t ZSTD_rust_ldm_getTableSize(
const void* params, int enableLdm, size_t redzoneSize);
void ZSTD_rust_ldm_fillHashTable(
@@ -336,14 +333,6 @@ void ZSTD_ldm_rust_setLdmSeqStore(void* blockContext, const void* rawSeqStore)
context->ms->ldmSeqStore = (const RawSeqStore_t*)rawSeqStore;
}
void ZSTD_ldm_adjustParameters(ldmParams_t* params,
const ZSTD_compressionParameters* cParams)
{
ZSTD_rust_ldm_adjustParameters(
params, cParams->windowLog, (int)cParams->strategy,
ZSTD_HASHLOG_MAX, ZSTD_LDM_BUCKETSIZELOG_MAX, (int)ZSTD_btultra);
}
size_t ZSTD_ldm_getTableSize(ldmParams_t params)
{
#if ZSTD_ADDRESS_SANITIZER && !defined(ZSTD_ASAN_DONT_POISON_WORKSPACE)