feat(compress): move MT buffer pool size addition to Rust
Keep buffer-pool ownership, allocation, synchronization, and the Rust pool's saturating accounting in their existing implementations. The C wrapper still handles NULL, obtains sizeof(*bufPool), and queries the Rust pool size; Rust now performs only the final size_t addition with wrapping semantics. The sequence-pool sizing alias continues to call the same C helper and therefore retains its behavior. Test Plan: - `cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression` (before and after formatting) -- passed - The same clippy command with `--benches` and `--tests` -- passed - `cargo +nightly fmt --manifest-path rust/Cargo.toml` -- passed - `cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression zstdmt_compress` -- 29 passed - `make -B -C lib -j2 lib` -- passed - `make -C tests test-rust-lib-smoke` -- passed - `tests/fuzzer -s4560 -t56 -i57 -v` -- 57 passed - `make -C tests -j2 test-zstream` -- 84 named, 7,661, and 8,090 randomized tests passed - `git diff --check` and `git diff --cached --check` -- passed The zstream build still emits the pre-existing unterminated-string warning at tests/zstreamtest.c:1899.
This commit is contained in:
@@ -106,6 +106,7 @@ ZSTDMT_RustBufferPool* ZSTDMT_rust_buffer_pool_create(unsigned maxNbBuffers,
|
||||
ZSTD_customMem cMem);
|
||||
void ZSTDMT_rust_buffer_pool_free(ZSTDMT_RustBufferPool* pool);
|
||||
size_t ZSTDMT_rust_buffer_pool_sizeof(const ZSTDMT_RustBufferPool* pool);
|
||||
size_t ZSTDMT_rust_sizeofBufferPool(size_t wrapperSize, size_t rustPoolSize);
|
||||
void ZSTDMT_rust_buffer_pool_set_size(ZSTDMT_RustBufferPool* pool, size_t bSize);
|
||||
ZSTDMT_RustBufferPool* ZSTDMT_rust_buffer_pool_expand(ZSTDMT_RustBufferPool* pool,
|
||||
unsigned maxNbBuffers);
|
||||
@@ -186,7 +187,8 @@ static ZSTDMT_bufferPool* ZSTDMT_createBufferPool(unsigned maxNbBuffers, ZSTD_cu
|
||||
static size_t ZSTDMT_sizeof_bufferPool(ZSTDMT_bufferPool* bufPool)
|
||||
{
|
||||
if (bufPool == NULL) return 0;
|
||||
return sizeof(*bufPool) + ZSTDMT_rust_buffer_pool_sizeof(bufPool->rustPool);
|
||||
return ZSTDMT_rust_sizeofBufferPool(
|
||||
sizeof(*bufPool), ZSTDMT_rust_buffer_pool_sizeof(bufPool->rustPool));
|
||||
}
|
||||
|
||||
/* ZSTDMT_setBufferSize() :
|
||||
|
||||
Reference in New Issue
Block a user