feat(cdict): move table-load policy into Rust
CDict initialization already routes content copying and dictionary insertion through the Rust orchestrator, but its private C adapter still hard-coded the full table-load method and the CDict table-fill purpose. That split left an important advanced-CDict content-loading policy hidden in the C bridge and made the callback contract less explicit. Extend the private insertion callback with the two table-loading policy values. Rust now selects the full-load and for-CDict modes after its content branch and before invoking the opaque C operation. C retains only the private CDict layout projection and forwards those selected values to the existing content loader, preserving the original insertion order and behavior. The focused initialization probes record both values in the callback and assert them for by-reference and by-copy dictionaries alongside the existing ordering and content-copy checks. Test Plan: - `rustfmt +nightly --edition 2021 --check rust/src/zstd_compress_dictionary.rs` -- passed - `ulimit -v 41943040; gcc -fsyntax-only -std=c99 -DXXH_NAMESPACE=ZSTD_ -DDEBUGLEVEL=0 -DZSTD_MULTITHREAD -DZSTD_LEGACY_SUPPORT=5 -Ilib -Ilib/common -Ilib/compress -Ilib/decompress -Ilib/dict -Ilib/deprecated lib/compress/zstd_compress.c` -- passed - `ulimit -v 41943040; clang -fsyntax-only -std=c99 -DXXH_NAMESPACE=ZSTD_ -DDEBUGLEVEL=0 -DZSTD_MULTITHREAD -DZSTD_LEGACY_SUPPORT=5 -DZSTD_NO_ASM=1 -Ilib -Ilib/common -Ilib/compress -Ilib/decompress -Ilib/dict -Ilib/deprecated lib/compress/zstd_compress.c` -- passed - `git diff --check` and `git diff --cached --check` -- passed - Cargo, make, native builds, fuzzers, and large tests were not run per task constraints
This commit is contained in:
@@ -2645,7 +2645,7 @@ typedef size_t (*ZSTD_rust_initCDictResetMatchState_f)(
|
||||
int useRowMatchFinder);
|
||||
typedef size_t (*ZSTD_rust_initCDictInsertDictionary_f)(
|
||||
void* context, const void* params, const void* dict,
|
||||
size_t dictSize, int dictContentType);
|
||||
size_t dictSize, int dictContentType, int dtlm, int tfp);
|
||||
typedef struct {
|
||||
void* callbackContext;
|
||||
void* params;
|
||||
@@ -6446,14 +6446,15 @@ static size_t ZSTD_rust_initCDict_resetMatchState(
|
||||
|
||||
static size_t ZSTD_rust_initCDict_insertDictionary(
|
||||
void* context, const void* params, const void* dict,
|
||||
size_t dictSize, int dictContentType)
|
||||
size_t dictSize, int dictContentType, int dtlm, int tfp)
|
||||
{
|
||||
ZSTD_CDict* const cdict = (ZSTD_CDict*)context;
|
||||
return ZSTD_compress_insertDictionary(
|
||||
&cdict->cBlockState, &cdict->matchState, NULL, &cdict->workspace,
|
||||
(const ZSTD_CCtx_params*)params, dict, dictSize,
|
||||
(ZSTD_dictContentType_e)dictContentType, ZSTD_dtlm_full,
|
||||
ZSTD_tfp_forCDict, cdict->entropyWorkspace);
|
||||
(ZSTD_dictContentType_e)dictContentType,
|
||||
(ZSTD_dictTableLoadMethod_e)dtlm,
|
||||
(ZSTD_tableFillPurpose_e)tfp, cdict->entropyWorkspace);
|
||||
}
|
||||
|
||||
static size_t ZSTD_rust_compressBegin_resetInternal(
|
||||
|
||||
Reference in New Issue
Block a user