Commit Graph
11137 Commits
Author SHA1 Message Date
ddidderr 65afd94867 fix(build): rebuild C outputs on HUF mode changes
Mode-specific Rust archives exposed the test makefiles' flat C-object cache:
switching from default to forced HUF mode could relink stale default C objects
with a newly built forced Rust archive. That hybrid has incompatible decoder
table expectations and can corrupt dictionary decompression.

Track each makefile's effective HUF mode with an empty archive stamp. It is a
safe normal linker prerequisite, and every mode transition advances its mtime
so cached C objects and direct-source binaries rebuild while unchanged modes
remain incremental.

Test Plan:
- cargo clippy; cargo clippy --benches; cargo clippy --tests
- cargo +nightly fmt, then repeat the Clippy checks
- cargo test --all-targets
- Default -> forced-X1 -> default fuzzer builds without -B, each running
  ./fuzzer -s5346 -i1 --no-big-tests
- Equivalent zstd-small default/forced/default rebuild and --version checks

Refs: rust/README.md
Fixes: d89ebb31
2026-07-10 21:08:14 +02:00
ddidderr 27932113fd feat(rust): port Huffman decompression
Move Huffman decoding-table construction and X1/X2 single- and four-stream
decoding into Rust. The original C translation unit is now a declaration shim,
so unchanged C callers and tests resolve the public decoder ABI from the Rust
archive.

The portable implementation preserves the C workspace and error contracts,
retains the existing assembly-only internal fast loops, and mirrors the C
32-bit decode cadence so X2 writes remain within its required output window.
Forced X1/X2 modes follow the matching archive configuration from the build
integration.

Test Plan:
- cargo clippy; cargo clippy --benches; cargo clippy --tests
- cargo +nightly fmt, then repeat the Clippy checks
- cargo test --all-targets for default, forced X1, and forced X2 modes
- cargo build and cargo test for i686-unknown-linux-gnu in all three modes
- Strict normal, X1, and X2 C shim compilation
- Original fuzzer and fullbench compatibility targets

Refs: rust/README.md
Depends-on: d89ebb31
2026-07-10 20:48:51 +02:00
ddidderr d89ebb31e3 build(rust): select archives by target and HUF mode
Derive the Rust static-library configuration from the effective C HUF decoder
flags and place each mode in its own Cargo target directory. This prevents a
forced X1/X2 C build from silently reusing the default Rust archive.

The test and program makefiles now also build and link an i686 Rust archive
for their 32-bit targets, including zstd32. zstd-small retains its existing
default configuration while preserving an explicitly requested HUF mode.

Test Plan:
- cargo clippy; cargo clippy --benches; cargo clippy --tests
- cargo +nightly fmt, then repeat the Clippy checks
- cargo test --all-targets for default, forced X1, and forced X2 modes
- cargo build --release --target i686-unknown-linux-gnu for each mode
- make -n checks for default, forced, direct -D, and 32-bit test/CLI targets

Refs: rust/README.md
2026-07-10 20:46:23 +02:00
ddidderr 58a50db413 test(rust): make entropy tests portable to 32-bit
Use an explicitly 64-bit literal before narrowing it in the common-byte test,
and derive the FSE compression-bound expectation from `size_of::<usize>()`.
The tests now exercise the same public contracts on 32-bit and 64-bit targets
instead of embedding a 64-bit-only compile-time assumption.

Test Plan:
- cargo clippy; cargo clippy --benches; cargo clippy --tests
- cargo +nightly fmt, then repeat the Clippy checks
- cargo test --target i686-unknown-linux-gnu --lib
- cargo test --target i686-unknown-linux-gnu --lib --features \
  huf-force-decompress-x1
- cargo test --target i686-unknown-linux-gnu --lib --features \
  huf-force-decompress-x2

Refs: rust/README.md
2026-07-10 20:44:02 +02:00
ddidderr 5f9d607ddd feat(rust): port FSE compression primitives
Move FSE normalization, count-header writing, compression-table construction,
and stream encoding from C to Rust. The original C source remains as a
header-only shim, preserving the public header configuration while native
consumers receive the Rust archive exports.

This completes both codec directions for FSE in the migration crate and lets
the unchanged C compatibility tests exercise the Rust encoder implementation.

Test Plan:
- cargo clippy; cargo clippy --benches; cargo clippy --tests
- cargo +nightly fmt, then repeat the Clippy checks
- cargo test --all-targets
- cargo build --release
- Compile the C shim with strict warnings enabled
- 1,000-case pristine-C differential for tables, headers, and payloads
- ./tests/fuzzer -v -T10s
- ./tests/decodecorpus -t -T5

Refs: rust/README.md
2026-07-10 20:32:18 +02:00
ddidderr ebc43676b7 build(rust): rebuild the archive for C test and CLI links
Make Rust sources normal prerequisites of native C test executables and CLI
builds. A changed Rust module now rebuilds libzstd_rs.a and relinks the target,
instead of relying on a manually prepared archive that can silently be stale.

The archive is linked after C objects, allowing migrated C shims to resolve
their Rust ABI symbols while remaining compatible with the existing makefile
flows. The migration guide now documents this behavior.

Test Plan:
- make -B -C tests fuzzer
- ./tests/fuzzer -i1 --no-big-tests
- make -B -C programs zstd
- ./programs/zstd --version

Refs: rust/README.md
2026-07-10 20:11:42 +02:00
ddidderr 57106c5c32 chore(rust): ignore Cargo target artifacts
Keep local Rust build outputs out of the migration diff. The static archive is
rebuilt by the validation workflow and must not be tracked as source.

Test Plan:
- git check-ignore -v rust/target

Refs: rust/README.md
2026-07-10 20:07:17 +02:00
ddidderr 158cd680d9 feat(rust): port histogram counting primitives
Move byte histogram counting into Rust for FSE and Huffman compression callers.
The implementation preserves the C workspace contract, checked alphabet path,
fast path, empty-input behavior, and C ABI while the original C source becomes
a header-only compatibility shim.

Focused tests cover count accumulation, invalid alphabets, workspace failures,
and striped large inputs. Higher-level compression remains C for now.

Test Plan:
- cargo fmt --check
- cargo test --all-targets
- cargo clippy --all-targets -- -D warnings
- cargo build --release
- make -C tests fuzzer
- ./tests/fuzzer -i1 --no-big-tests
- compile hist.c with -Werror and -Wredundant-decls

Refs: rust/README.md
2026-07-10 20:06:25 +02:00
ddidderr 26b5e202ee feat(rust): port worker pool and pthread wrappers
Replace the common worker pool and debug pthread wrappers with ABI-compatible
Rust implementations. The pool preserves bounded-queue, resize, drain-on-free,
custom-allocator, and no-thread behavior while C supplies only the build-time
multithreading configuration bit.

This moves runtime support without changing C tests or public headers. Codec
and CLI implementations remain C while their dependencies are migrated.

Test Plan:
- cargo fmt --check
- cargo test --all-targets
- cargo clippy --all-targets -- -D warnings
- cargo build --release
- make -C tests poolTests
- ./tests/poolTests
- compile pool and threading shims with -Werror in MT and no-thread modes

Refs: rust/README.md
2026-07-10 20:05:35 +02:00
ddidderr a0f2b2a14c feat(rust): port FSE entropy decoding
Move FSE normalized-count parsing, Huffman statistics decoding, FSE table
construction, and FSE stream decompression into Rust. The C source files now
only retain the headers needed by the existing build configuration.

The implementation keeps the public C ABI and verifies C-generated balanced,
skewed, and Huffman-statistics streams. Compression and the higher-level frame
decoder remain C for now.

Test Plan:
- cargo fmt --check
- cargo test --all-targets
- cargo clippy --all-targets -- -D warnings
- cargo build --release
- compile both C shims with -Werror and -Wredundant-decls

Refs: rust/README.md
2026-07-10 20:04:26 +02:00
ddidderr 554a30da41 fix(rust): remove redundant common shim declarations
The common C shims include headers that already declare every Rust-exported
symbol. Remove duplicate declarations so strict C builds do not report
redundant declarations or macro-expanded aliases.

The shims remain intentionally declaration-only; Rust still owns the exported
implementation.

Test Plan:
- compile debug.c with -Wall -Wextra -Werror
- compile error_private.c with -Wall -Wextra -Werror
- compile zstd_common.c with -Wall -Wextra -Werror

Refs: rust/README.md
2026-07-10 20:03:34 +02:00
ddidderr 089f8e5b4d feat(rust): add common primitive compatibility layer
Introduce the Rust static library and move the shared byte, bitstream, CPU,
error, xxHash, debug, and public-common implementations into it. Thin C shims
preserve the existing header-driven C build while original tests link the Rust
archive.

This establishes the ABI-safe foundation for later codec and CLI ports;
entropy coding, runtime support, codecs, dictionaries, and the CLI remain C.
The top-down migration map documents that boundary and its validation path.

Test Plan:
- cargo fmt --check
- cargo test --all-targets
- cargo clippy --all-targets -- -D warnings
- cargo build --release

Refs: rust/README.md
2026-07-10 20:02:17 +02:00
Yann ColletandGitHub f8745da6ff Merge pull request #4298 from facebook/dev
v1.5.7
v1.5.7
2025-02-18 16:04:24 -08:00
Yann ColletandGitHub ea027ab21c Merge pull request #4299 from facebook/ga_harden
Improved Github Actions scorecards
2025-02-18 15:26:29 -08:00
Yann Collet b14d76d888 pinned dependency hash 2025-02-18 14:53:31 -08:00
Yann Collet 5c465fcabe harden github actions script Android NDK Build 2025-02-18 14:50:03 -08:00
Yann ColletandGitHub 99a12e6f72 Merge pull request #4297 from facebook/changelog157
update changelog for v1.5.7
2025-02-18 14:35:24 -08:00
Yann Collet c26bde119b update changelog for v1.5.7 2025-02-18 13:59:24 -08:00
Yann ColletandGitHub 22c39b9891 Merge pull request #4274 from luau-project/intel-compilers
CI: enable Intel LLVM C compiler (icx) check
2025-02-13 20:21:35 -08:00
Yann ColletandGitHub beccbc6f74 Merge pull request #4293 from facebook/rip-ubuntu20
Fixed CI
2025-02-13 20:21:10 -08:00
Yann Collet 2a58b04752 disabled BTI test
this test seems impossible on Ubuntu-24
2025-02-11 13:20:15 -08:00
Yann Collet 85c39b78cf faster aarch64 test execution 2025-02-11 13:11:29 -08:00
Yann Collet 0b8119f0ad minor arm64 test script clarification 2025-02-11 12:58:35 -08:00
Yann Collet b73e06b83e updated FreeBSD VM to 14.2
14.1 seems no longer supported by gcloud
2025-02-11 12:52:59 -08:00
Yann Collet 2b7c661ad2 update arm64 test
for ubuntu-24
2025-02-11 12:41:38 -08:00
Yann Collet 75bcae1272 removing x32 tests
this ABI is no longer supported by Ubuntu,
and there is a wider consensus that this ABI is on the way out,
with more and more distributions dropping it,
and lingering questions about support of x32 in the kernel.
2025-02-11 11:37:18 -08:00
Yann Collet fc1baf3463 move qemu tests to ubuntu24 2025-02-11 09:57:18 -08:00
Yann Collet 815ca8c678 ubuntu 20 is being deprecated
change ubuntu20 tests to use more modern ubuntu variants
2025-02-11 09:19:08 -08:00
Yann ColletandGitHub d84d70bd04 Merge pull request #4288 from facebook/stronger_patchfrom
Improve compression ratio of the --patch-from mode
2025-02-10 12:09:16 -08:00
Yann Collet d2c562b803 update hrlog comment 2025-02-10 10:48:56 -08:00
Yann Collet 67fad95f79 derive hashratelog from hashlog when only hashlog is set 2025-02-10 10:46:37 -08:00
Yann ColletandYann Collet 339bca6606 update ldm compression results 2025-02-10 10:46:37 -08:00
Yann ColletandYann Collet 09d7e34ed8 adjust mml 2025-02-10 10:46:37 -08:00
Yann ColletandYann Collet d5e4698267 fix boundary condition 2025-02-10 10:46:37 -08:00
Yann ColletandYann Collet 72406b71c3 update hrlog rule to favor compression ratio a bit more at low levels 2025-02-10 10:46:37 -08:00
Yann ColletandYann Collet 7c5b6002c9 update results from the --long mode 2025-02-10 10:46:37 -08:00
Yann ColletandYann Collet bf218c142a updated LDM documentation 2025-02-10 10:46:37 -08:00
Yann ColletandYann Collet f26cc54f37 dynamic bucket sizes 2025-02-10 10:46:37 -08:00
Yann ColletandYann Collet 4609a40b89 dynamically adjust hratelog and ldmml based on strategy 2025-02-10 10:46:37 -08:00
Yann ColletandGitHub 5b8575adaa Merge pull request #4289 from facebook/autoultra
--ultra automatically triggered with --long and --patch-from
2025-02-10 10:38:28 -08:00
Yann ColletandGitHub e3a9351402 Merge pull request #4290 from facebook/lmax
--max command
2025-02-10 10:38:00 -08:00
Yann ColletandGitHub 071a4a0904 Merge pull request #4291 from facebook/dependabot/github_actions/github/codeql-action-3.28.9
Bump github/codeql-action from 3.28.1 to 3.28.9
2025-02-09 23:45:47 -08:00
Yann Collet 613901b6d3 modifies command echoing for macos / linux compatibility 2025-02-09 23:41:32 -08:00
Yann Collet 468e1453a5 disable --max in 32-bit mode 2025-02-09 23:16:14 -08:00
Yann Collet 1603cbe83e update test for 32-bit mode
--max doesn't work in 32-bit mode, due to address space limitation
2025-02-09 23:02:14 -08:00
dependabot[bot]andGitHub 7a2fce5a1f Bump github/codeql-action from 3.28.1 to 3.28.9
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.1 to 3.28.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/b6a472f63d85b9c78a3ac5e89422239fc15e9b3c...9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-10 05:36:44 +00:00
Yann Collet f86024ccd2 reinforce man page warning
32-bit is unsuitable for --max
2025-02-09 17:25:35 -08:00
Yann Collet 39d1d82fa8 adjusted mml heuristic 2025-02-09 17:24:12 -08:00
Yann Collet 41b7193757 added --max to test suite 2025-02-09 12:26:36 -08:00
Yann Collet 8ae1330708 add man entry for --max 2025-02-09 11:51:25 -08:00