feat(compress): move CCtx metadata copies into Rust
Pass CCtx destination fields and source fields through the copyCCtx bridge, then copy dictID and dictContentSize in Rust at the original metadata-copy point. Remove the final redundant C metadata callback while preserving copy ordering, reset error handling, and block-state propagation. Add focused tests for metadata values and callback sequencing. 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:
@@ -480,7 +480,10 @@ typedef struct {
|
||||
ZSTD_rust_copyCCtxCopyTables_f copyTables;
|
||||
ZSTD_rust_copyCCtxMarkTables_f markTablesClean;
|
||||
ZSTD_rust_copyCCtxCopyState_f copyMatchState;
|
||||
ZSTD_rust_copyCCtxCopyState_f copyDictState;
|
||||
U32* destinationDictID;
|
||||
const U32* sourceDictID;
|
||||
size_t* destinationDictContentSize;
|
||||
const size_t* sourceDictContentSize;
|
||||
ZSTD_compressedBlockState_t** destinationBlockState;
|
||||
const ZSTD_compressedBlockState_t* sourceBlockState;
|
||||
int zbuff;
|
||||
@@ -523,7 +526,7 @@ typedef char ZSTD_rust_copy_cctx_internal_state_layout[
|
||||
== 3 * sizeof(void*) + sizeof(U64)
|
||||
&& offsetof(ZSTD_rust_copyCCtxInternalState, zbuff)
|
||||
== 3 * sizeof(void*) + sizeof(U64)
|
||||
+ 10 * sizeof(void*)
|
||||
+ 13 * sizeof(void*)
|
||||
&& sizeof(ZSTD_rust_copyCCtxInternalState)
|
||||
== ((offsetof(ZSTD_rust_copyCCtxInternalState, zbuff)
|
||||
+ sizeof(int) + sizeof(void*) - 1) / sizeof(void*))
|
||||
@@ -4837,15 +4840,6 @@ static void ZSTD_rust_copyCCtx_copy_match_state(
|
||||
dstMatchState->loadedDictEnd = srcMatchState->loadedDictEnd;
|
||||
}
|
||||
|
||||
static void ZSTD_rust_copyCCtx_copy_dict_state(
|
||||
void* context, const void* srcCCtx)
|
||||
{
|
||||
ZSTD_CCtx* const dst = (ZSTD_CCtx*)context;
|
||||
const ZSTD_CCtx* const src = (const ZSTD_CCtx*)srcCCtx;
|
||||
dst->dictID = src->dictID;
|
||||
dst->dictContentSize = src->dictContentSize;
|
||||
}
|
||||
|
||||
static size_t ZSTD_rust_copyCCtx_internal_callback(
|
||||
void* context, const void* srcCCtx,
|
||||
const ZSTD_frameParameters* fParams,
|
||||
@@ -4863,7 +4857,10 @@ static size_t ZSTD_rust_copyCCtx_internal_callback(
|
||||
state.copyTables = ZSTD_rust_copyCCtx_copy_tables;
|
||||
state.markTablesClean = ZSTD_rust_copyCCtx_mark_tables_clean;
|
||||
state.copyMatchState = ZSTD_rust_copyCCtx_copy_match_state;
|
||||
state.copyDictState = ZSTD_rust_copyCCtx_copy_dict_state;
|
||||
state.destinationDictID = &((ZSTD_CCtx*)context)->dictID;
|
||||
state.sourceDictID = &((const ZSTD_CCtx*)srcCCtx)->dictID;
|
||||
state.destinationDictContentSize = &((ZSTD_CCtx*)context)->dictContentSize;
|
||||
state.sourceDictContentSize = &((const ZSTD_CCtx*)srcCCtx)->dictContentSize;
|
||||
state.destinationBlockState = &((ZSTD_CCtx*)context)->blockState.prevCBlock;
|
||||
state.sourceBlockState = ((const ZSTD_CCtx*)srcCCtx)->blockState.prevCBlock;
|
||||
state.zbuff = zbuff;
|
||||
|
||||
Reference in New Issue
Block a user