refactor(mt): pass compression job callback directly
Make ZSTDMT_createCompressionJob match the exact callback type consumed by ZSTDMT_rust_compressStreamGeneric. The callback now performs the existing opaque and end-directive casts itself, so the redundant C forwarding shim can be removed without changing scheduling, assertions, logging, or ABI behavior. Test Plan: - `cc -fsyntax-only -Werror=incompatible-pointer-types -Ilib -Ilib/common -Ilib/compress -Ilib/decompress -Ilib/dict -Ilib/legacy lib/compress/zstdmt_compress.c` -- passed. - `git diff --check` and `git diff --cached --check` -- passed. - No cargo, make, native, fuzz, or other heavy tests run per task scope.
This commit is contained in:
@@ -2712,8 +2712,10 @@ static int ZSTDMT_tryAddCompressionJob(void* opaque, unsigned jobID)
|
|||||||
return POOL_tryAdd(mtctx->factory, ZSTDMT_compressionJob, &mtctx->jobs[jobID]);
|
return POOL_tryAdd(mtctx->factory, ZSTDMT_compressionJob, &mtctx->jobs[jobID]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t ZSTDMT_createCompressionJob(ZSTDMT_CCtx* mtctx, size_t srcSize, ZSTD_EndDirective endOp)
|
static size_t ZSTDMT_createCompressionJob(void* opaque, size_t srcSize, unsigned end)
|
||||||
{
|
{
|
||||||
|
ZSTDMT_CCtx* const mtctx = (ZSTDMT_CCtx*)opaque;
|
||||||
|
ZSTD_EndDirective const endOp = (ZSTD_EndDirective)end;
|
||||||
ZSTDMT_RustCreateJobProjection const projection = {
|
ZSTDMT_RustCreateJobProjection const projection = {
|
||||||
mtctx->doneJobID,
|
mtctx->doneJobID,
|
||||||
mtctx->nextJobID,
|
mtctx->nextJobID,
|
||||||
@@ -2757,13 +2759,6 @@ static size_t ZSTDMT_createCompressionJob(ZSTDMT_CCtx* mtctx, size_t srcSize, ZS
|
|||||||
return result.returnCode;
|
return result.returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t ZSTDMT_streamCreateJob(void* opaque, size_t srcSize, unsigned end)
|
|
||||||
{
|
|
||||||
return ZSTDMT_createCompressionJob((ZSTDMT_CCtx*)opaque, srcSize,
|
|
||||||
(ZSTD_EndDirective)end);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* The Rust flush state machine receives only this synchronized scalar view.
|
/* The Rust flush state machine receives only this synchronized scalar view.
|
||||||
* The descriptor, condition variable, serial checksum state, and buffer pool
|
* The descriptor, condition variable, serial checksum state, and buffer pool
|
||||||
* remain private to C. */
|
* remain private to C. */
|
||||||
@@ -3097,7 +3092,7 @@ size_t ZSTDMT_compressStream_generic(ZSTDMT_CCtx* mtctx,
|
|||||||
ZSTDMT_rust_compressStreamGeneric(
|
ZSTDMT_rust_compressStreamGeneric(
|
||||||
&context, &inputProjection, &outputProjection, (unsigned)endOp,
|
&context, &inputProjection, &outputProjection, (unsigned)endOp,
|
||||||
mtctx, ZSTDMT_streamTryGetInputRange, ZSTDMT_streamLoadInput,
|
mtctx, ZSTDMT_streamTryGetInputRange, ZSTDMT_streamLoadInput,
|
||||||
ZSTDMT_streamCreateJob, ZSTDMT_streamFlushProduced);
|
ZSTDMT_createCompressionJob, ZSTDMT_streamFlushProduced);
|
||||||
|
|
||||||
DEBUGLOG(5, "ZSTDMT_compressStream_generic (endOp=%u, srcSize=%u)",
|
DEBUGLOG(5, "ZSTDMT_compressStream_generic (endOp=%u, srcSize=%u)",
|
||||||
(U32)endOp, (U32)(input->size - input->pos));
|
(U32)endOp, (U32)(input->size - input->pos));
|
||||||
|
|||||||
Reference in New Issue
Block a user