From a7aa2c5df6ced5f3c2019a825cfb08a619cf6851 Mon Sep 17 00:00:00 2001 From: Sen Huang Date: Wed, 15 Sep 2021 09:51:42 -0700 Subject: [PATCH 01/38] Fix NCountWriteBound --- lib/compress/fse_compress.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/compress/fse_compress.c b/lib/compress/fse_compress.c index faca767c5..5547b4ac0 100644 --- a/lib/compress/fse_compress.c +++ b/lib/compress/fse_compress.c @@ -221,7 +221,11 @@ size_t FSE_buildCTable_wksp(FSE_CTable* ct, ****************************************************************/ size_t FSE_NCountWriteBound(unsigned maxSymbolValue, unsigned tableLog) { - size_t const maxHeaderSize = (((maxSymbolValue+1) * tableLog) >> 3) + 3; + size_t const maxHeaderSize = (((maxSymbolValue+1) * tableLog + + 4 /* bitCount initialized at 4 */ + + 2 /* first two symbols may use one additional bit each */) / 8) + + 1 /* round up to whole nb bytes */ + + 2 /* additional two bytes for bitstream flush */; return maxSymbolValue ? maxHeaderSize : FSE_NCOUNTBOUND; /* maxSymbolValue==0 ? use default */ } From 8bf699aa59372d7c2bb4216bcf8037cab7dae51e Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Fri, 17 Sep 2021 11:42:08 -0700 Subject: [PATCH 02/38] [build] Add support for ASM files in Make + CMake * Extract out common portion of `lib/Makefile` into `lib/libzstd.mk`. Most relevantly, the way we find library files. * Use `lib/libzstd.mk` in the other Makefiles instead of repeating the same code. * Add a test `tests/test-variants.sh` that checks that the builds of `make -C programs allVariants` are correct, and run it in Actions. * Adds support for ASM files in the CMake build. The Meson build is not updated because it lists every file in zstd, and supports ASM off the bat, so the Huffman ASM commit will just add the ASM file to the list. The Visual Studios build is not updated because I'm not adding ASM support to Visual Studios yet. --- .circleci/config.yml | 13 +- .github/workflows/dev-short-tests.yml | 10 +- Makefile | 12 +- build/cmake/lib/CMakeLists.txt | 4 +- contrib/freestanding_lib/freestanding.py | 3 +- contrib/linux-kernel/test/Makefile | 8 +- contrib/pzstd/Makefile | 16 +- lib/Makefile | 207 +++++------------------ lib/compress/huf_compress.c | 5 +- lib/libzstd.mk | 185 ++++++++++++++++++++ programs/Makefile | 128 +++----------- tests/Makefile | 52 +++--- tests/fuzz/Makefile | 30 +++- tests/fuzzer.c | 2 +- tests/regression/Makefile | 1 + tests/test-variants.sh | 115 +++++++++++++ 16 files changed, 455 insertions(+), 336 deletions(-) create mode 100644 lib/libzstd.mk create mode 100755 tests/test-variants.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 035177edc..65bb3c227 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,6 +7,8 @@ jobs: # preinstalled to reduce installation time. docker: - image: fbopensource/zstd-circleci-primary:0.0.1 + # TODO: Re-enable aarch64 build: + # make aarch64build && make clean steps: - checkout - run: @@ -14,12 +16,11 @@ jobs: command: | ./tests/test-license.py cc -v; CFLAGS="-O0 -Werror -pedantic" make all && make clean - make c99build ; make clean - make c11build ; make clean - make aarch64build ; make clean - make -j regressiontest; make clean - make shortest ; make clean - make cxxtest ; make clean + make c99build && make clean + make c11build && make clean + make -j regressiontest&& make clean + make shortest && make clean + make cxxtest && make clean # the second half of the jobs are in this test short-tests-1: docker: diff --git a/.github/workflows/dev-short-tests.yml b/.github/workflows/dev-short-tests.yml index cdc9d7fe3..5d7e54b51 100644 --- a/.github/workflows/dev-short-tests.yml +++ b/.github/workflows/dev-short-tests.yml @@ -200,6 +200,15 @@ jobs: make clean && make -j all MOREFLAGS="-Werror -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS" make clean && make check MOREFLAGS="-Werror -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS" + test-variants: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: make all variants & validate + run: | + make -j -C programs allVariants MOREFLAGS=-O0 + ./tests/test-variants.sh + qemu-consistency: name: QEMU ${{ matrix.name }} @@ -263,7 +272,6 @@ jobs: run: | LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check - # This test currently fails on Github Actions specifically. # Possible reason : TTY emulation. # Note that the same test works fine locally and on travisCI. diff --git a/Makefile b/Makefile index b9265e7f8..ff49fc0d8 100644 --- a/Makefile +++ b/Makefile @@ -217,7 +217,7 @@ armbuild: clean CC=arm-linux-gnueabi-gcc CFLAGS="-Werror" $(MAKE) allzstd aarch64build: clean - CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allzstd + CC=aarch64-linux-gnu-gcc CFLAGS="-Werror -O0" $(MAKE) allzstd ppcbuild: clean CC=powerpc-linux-gnu-gcc CFLAGS="-m32 -Wno-attributes -Werror" $(MAKE) -j allzstd @@ -381,23 +381,23 @@ cmakebuild: c89build: clean $(CC) -v - CFLAGS="-std=c89 -Werror" $(MAKE) allmost # will fail, due to missing support for `long long` + CFLAGS="-std=c89 -Werror -O0" $(MAKE) allmost # will fail, due to missing support for `long long` gnu90build: clean $(CC) -v - CFLAGS="-std=gnu90 -Werror" $(MAKE) allmost + CFLAGS="-std=gnu90 -Werror -O0" $(MAKE) allmost c99build: clean $(CC) -v - CFLAGS="-std=c99 -Werror" $(MAKE) allmost + CFLAGS="-std=c99 -Werror -O0" $(MAKE) allmost gnu99build: clean $(CC) -v - CFLAGS="-std=gnu99 -Werror" $(MAKE) allmost + CFLAGS="-std=gnu99 -Werror -O0" $(MAKE) allmost c11build: clean $(CC) -v - CFLAGS="-std=c11 -Werror" $(MAKE) allmost + CFLAGS="-std=c11 -Werror -O0" $(MAKE) allmost bmix64build: clean $(CC) -v diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt index 5f756652e..d91ebe1f0 100644 --- a/build/cmake/lib/CMakeLists.txt +++ b/build/cmake/lib/CMakeLists.txt @@ -7,7 +7,7 @@ # in the COPYING file in the root directory of this source tree). # ################################################################ -project(libzstd C) +project(libzstd C ASM) set(CMAKE_INCLUDE_CURRENT_DIR TRUE) option(ZSTD_BUILD_STATIC "BUILD STATIC LIBRARIES" ON) @@ -22,7 +22,7 @@ include_directories(${LIBRARY_DIR} ${LIBRARY_DIR}/common) file(GLOB CommonSources ${LIBRARY_DIR}/common/*.c) file(GLOB CompressSources ${LIBRARY_DIR}/compress/*.c) -file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c) +file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c ${LIBRARY_DIR}/decompress/*.S) file(GLOB DictBuilderSources ${LIBRARY_DIR}/dictBuilder/*.c) set(Sources diff --git a/contrib/freestanding_lib/freestanding.py b/contrib/freestanding_lib/freestanding.py index a191f592f..cd9d63774 100755 --- a/contrib/freestanding_lib/freestanding.py +++ b/contrib/freestanding_lib/freestanding.py @@ -460,7 +460,8 @@ class Freestanding(object): print(*args, **kwargs) def _copy_file(self, lib_path): - if not (lib_path.endswith(".c") or lib_path.endswith(".h")): + suffixes = [".c", ".h", ".S"] + if not any((lib_path.endswith(suffix) for suffix in suffixes)): return if lib_path in SKIPPED_FILES: self._log(f"\tSkipping file: {lib_path}") diff --git a/contrib/linux-kernel/test/Makefile b/contrib/linux-kernel/test/Makefile index 2908839fd..dc76a5f40 100644 --- a/contrib/linux-kernel/test/Makefile +++ b/contrib/linux-kernel/test/Makefile @@ -18,9 +18,13 @@ CPPFLAGS += -DZSTD_ASAN_DONT_POISON_WORKSPACE LINUX_ZSTD_MODULE := $(wildcard $(LINUX_ZSTDLIB)/*.c) LINUX_ZSTD_COMMON := $(wildcard $(LINUX_ZSTDLIB)/common/*.c) LINUX_ZSTD_COMPRESS := $(wildcard $(LINUX_ZSTDLIB)/compress/*.c) -LINUX_ZSTD_DECOMPRESS := $(wildcard $(LINUX_ZSTDLIB)/decompress/*.c) +LINUX_ZSTD_DECOMPRESS := $(wildcard $(LINUX_ZSTDLIB)/decompress/*.c $(LINUX_ZSTDLIB)/decompress/*.S) LINUX_ZSTD_FILES := $(LINUX_ZSTD_MODULE) $(LINUX_ZSTD_COMMON) $(LINUX_ZSTD_COMPRESS) $(LINUX_ZSTD_DECOMPRESS) -LINUX_ZSTD_OBJECTS := $(LINUX_ZSTD_FILES:.c=.o) +LINUX_ZSTD_OBJECTS0 := $(LINUX_ZSTD_FILES:.c=.o) +LINUX_ZSTD_OBJECTS := $(LINUX_ZSTD_OBJECTS0:.S=.o) + +%.o: %.S + $(CC) -c $(CPPFLAGS) $(CFLAGS) $^ -o $@ liblinuxzstd.a: $(LINUX_ZSTD_OBJECTS) $(AR) $(ARFLAGS) $@ $^ diff --git a/contrib/pzstd/Makefile b/contrib/pzstd/Makefile index 25265e79a..3d930cca9 100644 --- a/contrib/pzstd/Makefile +++ b/contrib/pzstd/Makefile @@ -57,19 +57,6 @@ LD_COMMAND = $(CXX) $^ $(ALL_LDFLAGS) $(LIBS) -pthread -o $@ CC_COMMAND = $(CC) $(DEPFLAGS) $(ALL_CFLAGS) -c $< -o $@ CXX_COMMAND = $(CXX) $(DEPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@ -# Get a list of all zstd files so we rebuild the static library when we need to -ZSTDCOMMON_FILES := $(wildcard $(ZSTDDIR)/common/*.c) \ - $(wildcard $(ZSTDDIR)/common/*.h) -ZSTDCOMP_FILES := $(wildcard $(ZSTDDIR)/compress/*.c) \ - $(wildcard $(ZSTDDIR)/compress/*.h) -ZSTDDECOMP_FILES := $(wildcard $(ZSTDDIR)/decompress/*.c) \ - $(wildcard $(ZSTDDIR)/decompress/*.h) -ZSTDPROG_FILES := $(wildcard $(PROGDIR)/*.c) \ - $(wildcard $(PROGDIR)/*.h) -ZSTD_FILES := $(wildcard $(ZSTDDIR)/*.h) \ - $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) \ - $(ZSTDPROG_FILES) - # List all the pzstd source files so we can determine their dependencies PZSTD_SRCS := $(wildcard *.cpp) PZSTD_TESTS := $(wildcard test/*.cpp) @@ -189,7 +176,8 @@ roundtrip: test/RoundTripTest$(EXT) # Use the static library that zstd builds for simplicity and # so we get the compiler options correct -$(ZSTDDIR)/libzstd.a: $(ZSTD_FILES) +.PHONY: $(ZSTDDIR)/libzstd.a +$(ZSTDDIR)/libzstd.a: CFLAGS="$(ALL_CFLAGS)" LDFLAGS="$(ALL_LDFLAGS)" $(MAKE) -C $(ZSTDDIR) libzstd.a # Rules to build the tests diff --git a/lib/Makefile b/lib/Makefile index 376a6690c..9b74e708c 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -8,110 +8,13 @@ # You may select, at your option, one of the above-listed licenses. # ################################################################ -# Note: by default, the static library is built single-threaded and dynamic library is built -# multi-threaded. It is possible to force multi or single threaded builds by appending -# -mt or -nomt to the build target (like lib-mt for multi-threaded, lib-nomt for single-threaded). -.PHONY: default -default: lib-release - -# define silent mode as default (verbose mode with V=1 or VERBOSE=1) -$(V)$(VERBOSE).SILENT: - -# When cross-compiling from linux to windows, -# one might need to specify TARGET_SYSTEM as "Windows." -# Building from Fedora fails without it. -# (but Ubuntu and Debian don't need to set anything) -TARGET_SYSTEM ?= $(OS) - -# Version numbers -LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h` -LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h` -LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h` -LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT) -LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT)) -LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT)) -LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT)) -LIBVER := $(shell echo $(LIBVER_SCRIPT)) -VERSION?= $(LIBVER) -CCVER := $(shell $(CC) --version) - -# ZSTD_LIB_MINIFY is a helper variable that -# configures a bunch of other variables to space-optimized defaults. -ZSTD_LIB_MINIFY ?= 0 -ifneq ($(ZSTD_LIB_MINIFY), 0) - HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0) - ZSTD_LEGACY_SUPPORT ?= 0 - ZSTD_LIB_DEPRECATED ?= 0 - HUF_FORCE_DECOMPRESS_X1 ?= 1 - ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 1 - ZSTD_NO_INLINE ?= 1 - ZSTD_STRIP_ERROR_STRINGS ?= 1 -ifneq ($(HAVE_CC_OZ), 0) - # Some compilers (clang) support an even more space-optimized setting. - CFLAGS += -Oz -else - CFLAGS += -Os -endif - CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \ - -DDYNAMIC_BMI2=0 -DNDEBUG -else - CFLAGS += -O3 -endif - -DEBUGLEVEL ?= 0 -CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -DDEBUGLEVEL=$(DEBUGLEVEL) -ifeq ($(TARGET_SYSTEM),Windows_NT) # MinGW assumed - CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting -endif -DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ - -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ - -Wstrict-prototypes -Wundef -Wpointer-arith \ - -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ - -Wredundant-decls -Wmissing-prototypes -Wc++-compat -CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) -FLAGS = $(CPPFLAGS) $(CFLAGS) - -CPPFLAGS_DYNLIB = -DZSTD_MULTITHREAD # dynamic library build defaults to multi-threaded -LDFLAGS_DYNLIB = -pthread -CPPFLAGS_STATLIB = # static library build defaults to single-threaded - -HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0) -GREP_OPTIONS ?= -ifeq ($HAVE_COLORNEVER, 1) - GREP_OPTIONS += --color=never -endif -GREP = grep $(GREP_OPTIONS) -SED_ERE_OPT ?= -E - -ZSTDCOMMON_FILES := $(sort $(wildcard common/*.c)) -ZSTDCOMP_FILES := $(sort $(wildcard compress/*.c)) -ZSTDDECOMP_FILES := $(sort $(wildcard decompress/*.c)) -ZDICT_FILES := $(sort $(wildcard dictBuilder/*.c)) -ZDEPR_FILES := $(sort $(wildcard deprecated/*.c)) -ZSTD_FILES := $(ZSTDCOMMON_FILES) - -ifeq ($(findstring GCC,$(CCVER)),GCC) -decompress/zstd_decompress_block.o : CFLAGS+=-fno-tree-vectorize -endif - # Modules ZSTD_LIB_COMPRESSION ?= 1 ZSTD_LIB_DECOMPRESSION ?= 1 ZSTD_LIB_DICTBUILDER ?= 1 ZSTD_LIB_DEPRECATED ?= 0 -# Legacy support -ZSTD_LEGACY_SUPPORT ?= 5 -ZSTD_LEGACY_MULTITHREADED_API ?= 0 - -# Build size optimizations -HUF_FORCE_DECOMPRESS_X1 ?= 0 -HUF_FORCE_DECOMPRESS_X2 ?= 0 -ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 0 -ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG ?= 0 -ZSTD_NO_INLINE ?= 0 -ZSTD_STRIP_ERROR_STRINGS ?= 0 - +# Input variables for libzstd.mk ifeq ($(ZSTD_LIB_COMPRESSION), 0) ZSTD_LIB_DICTBUILDER = 0 ZSTD_LIB_DEPRECATED = 0 @@ -122,86 +25,46 @@ ifeq ($(ZSTD_LIB_DECOMPRESSION), 0) ZSTD_LIB_DEPRECATED = 0 endif +include libzstd.mk + +ZSTD_FILES := $(ZSTD_COMMON_FILES) $(ZSTD_LEGACY_FILES) + ifneq ($(ZSTD_LIB_COMPRESSION), 0) - ZSTD_FILES += $(ZSTDCOMP_FILES) + ZSTD_FILES += $(ZSTD_COMPRESS_FILES) endif ifneq ($(ZSTD_LIB_DECOMPRESSION), 0) - ZSTD_FILES += $(ZSTDDECOMP_FILES) + ZSTD_FILES += $(ZSTD_DECOMPRESS_FILES) endif ifneq ($(ZSTD_LIB_DEPRECATED), 0) - ZSTD_FILES += $(ZDEPR_FILES) + ZSTD_FILES += $(ZSTD_DEPRECATED_FILES) endif ifneq ($(ZSTD_LIB_DICTBUILDER), 0) - ZSTD_FILES += $(ZDICT_FILES) + ZSTD_FILES += $(ZSTD_DICTBUILDER_FILES) endif -ifneq ($(HUF_FORCE_DECOMPRESS_X1), 0) - CFLAGS += -DHUF_FORCE_DECOMPRESS_X1 -endif - -ifneq ($(HUF_FORCE_DECOMPRESS_X2), 0) - CFLAGS += -DHUF_FORCE_DECOMPRESS_X2 -endif - -ifneq ($(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT), 0) - CFLAGS += -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT -endif - -ifneq ($(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG), 0) - CFLAGS += -DZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG -endif - -ifneq ($(ZSTD_NO_INLINE), 0) - CFLAGS += -DZSTD_NO_INLINE -endif - -ifneq ($(ZSTD_STRIP_ERROR_STRINGS), 0) - CFLAGS += -DZSTD_STRIP_ERROR_STRINGS -endif - -ifneq ($(ZSTD_LEGACY_MULTITHREADED_API), 0) - CFLAGS += -DZSTD_LEGACY_MULTITHREADED_API -endif - -ifneq ($(ZSTD_LEGACY_SUPPORT), 0) -ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0) - ZSTD_FILES += $(shell ls legacy/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]') -endif -endif -CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT) - ZSTD_LOCAL_SRC := $(notdir $(ZSTD_FILES)) -ZSTD_LOCAL_OBJ := $(ZSTD_LOCAL_SRC:.c=.o) +ZSTD_LOCAL_OBJ0 := $(ZSTD_LOCAL_SRC:.c=.o) +ZSTD_LOCAL_OBJ := $(ZSTD_LOCAL_OBJ0:.S=.o) -ZSTD_SUBDIR := common compress decompress dictBuilder legacy deprecated -vpath %.c $(ZSTD_SUBDIR) +VERSION := $(ZSTD_VERSION) -UNAME := $(shell uname) +# Note: by default, the static library is built single-threaded and dynamic library is built +# multi-threaded. It is possible to force multi or single threaded builds by appending +# -mt or -nomt to the build target (like lib-mt for multi-threaded, lib-nomt for single-threaded). +.PHONY: default +default: lib-release -ifndef BUILD_DIR -ifeq ($(UNAME), Darwin) - ifeq ($(shell md5 < /dev/null > /dev/null; echo $$?), 0) - HASH ?= md5 - endif -else ifeq ($(UNAME), FreeBSD) - HASH ?= gmd5sum -else ifeq ($(UNAME), NetBSD) - HASH ?= md5 -n -else ifeq ($(UNAME), OpenBSD) - HASH ?= md5 +CPPFLAGS_DYNLIB = -DZSTD_MULTITHREAD # dynamic library build defaults to multi-threaded +LDFLAGS_DYNLIB = -pthread +CPPFLAGS_STATLIB = # static library build defaults to single-threaded + + +ifeq ($(findstring GCC,$(CCVER)),GCC) +decompress/zstd_decompress_block.o : CFLAGS+=-fno-tree-vectorize endif -HASH ?= md5sum - -HASH_DIR = conf_$(shell echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ZSTD_FILES) | $(HASH) | cut -f 1 -d " " ) -HAVE_HASH :=$(shell echo 1 | $(HASH) > /dev/null && echo 1 || echo 0) -ifeq ($(HAVE_HASH),0) - $(info warning : could not find HASH ($(HASH)), needed to differentiate builds using different flags) - BUILD_DIR := obj/generic_noconf -endif -endif # BUILD_DIR # macOS linker doesn't support -soname, and use different extension @@ -218,13 +81,6 @@ else SHARED_EXT_VER = $(SHARED_EXT).$(LIBVER) endif -SET_CACHE_DIRECTORY = \ - +$(MAKE) --no-print-directory $@ \ - BUILD_DIR=obj/$(HASH_DIR) \ - CPPFLAGS="$(CPPFLAGS)" \ - CFLAGS="$(CFLAGS)" \ - LDFLAGS="$(LDFLAGS)" - .PHONY: all all: lib @@ -233,6 +89,13 @@ all: lib .PHONY: libzstd.a # must be run every time libzstd.a: CPPFLAGS += $(CPPFLAGS_STATLIB) +SET_CACHE_DIRECTORY = \ + +$(MAKE) --no-print-directory $@ \ + BUILD_DIR=obj/$(HASH_DIR) \ + CPPFLAGS="$(CPPFLAGS)" \ + CFLAGS="$(CFLAGS)" \ + LDFLAGS="$(LDFLAGS)" + ifndef BUILD_DIR # determine BUILD_DIR from compilation flags @@ -343,6 +206,14 @@ $(ZSTD_STATLIB_DIR)/%.o : %.c $(ZSTD_STATLIB_DIR)/%.d | $(ZSTD_STATLIB_DIR) @echo CC $@ $(COMPILE.c) $(DEPFLAGS) $(ZSTD_STATLIB_DIR)/$*.d $(OUTPUT_OPTION) $< +$(ZSTD_DYNLIB_DIR)/%.o : %.S | $(ZSTD_DYNLIB_DIR) + @echo AS $@ + $(COMPILE.c) $(OUTPUT_OPTION) $< + +$(ZSTD_STATLIB_DIR)/%.o : %.S | $(ZSTD_STATLIB_DIR) + @echo AS $@ + $(COMPILE.c) $(OUTPUT_OPTION) $< + MKDIR ?= mkdir $(BUILD_DIR) $(ZSTD_DYNLIB_DIR) $(ZSTD_STATLIB_DIR): $(MKDIR) -p $@ diff --git a/lib/compress/huf_compress.c b/lib/compress/huf_compress.c index db11ab3dc..915778eb1 100644 --- a/lib/compress/huf_compress.c +++ b/lib/compress/huf_compress.c @@ -445,7 +445,7 @@ typedef struct { /* RANK_POSITION_DISTINCT_COUNT_CUTOFF == Cutoff point in HUF_sort() buckets for which we use log2 bucketing. * Strategy is to use as many buckets as possible for representing distinct * counts while using the remainder to represent all "large" counts. - * + * * To satisfy this requirement for 192 buckets, we can do the following: * Let buckets 0-166 represent distinct counts of [0, 166] * Let buckets 166 to 192 represent all remaining counts up to RANK_POSITION_MAX_COUNT_LOG using log2 bucketing. @@ -517,7 +517,7 @@ static int HUF_quickSortPartition(nodeElt arr[], int const low, int const high) } /* Classic quicksort by descending with partially iterative calls - * to reduce worst case callstack size. + * to reduce worst case callstack size. */ static void HUF_simpleQuickSort(nodeElt arr[], int low, int high) { int const kInsertionSortThreshold = 8; @@ -813,6 +813,7 @@ FORCE_INLINE_TEMPLATE void HUF_addBits(HUF_CStream_t* bitC, HUF_CElt elt, int id assert(((elt >> dirtyBits) << (dirtyBits + nbBits)) == 0); /* We didn't overwrite any bits in the bit container. */ assert(!kFast || (bitC->bitPos[idx] & 0xFF) <= HUF_BITS_IN_CONTAINER); + (void)dirtyBits; } #endif } diff --git a/lib/libzstd.mk b/lib/libzstd.mk new file mode 100644 index 000000000..45ee1ce62 --- /dev/null +++ b/lib/libzstd.mk @@ -0,0 +1,185 @@ +# ################################################################ +# Copyright (c) Yann Collet, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under both the BSD-style license (found in the +# LICENSE file in the root directory of this source tree) and the GPLv2 (found +# in the COPYING file in the root directory of this source tree). +# You may select, at your option, one of the above-listed licenses. +# ################################################################ + +################################################################## +# Input Variables +################################################################## + +# Zstd lib directory +LIBZSTD ?= ./ + +# Legacy support +ZSTD_LEGACY_SUPPORT ?= 5 +ZSTD_LEGACY_MULTITHREADED_API ?= 0 + +# Build size optimizations +HUF_FORCE_DECOMPRESS_X1 ?= 0 +HUF_FORCE_DECOMPRESS_X2 ?= 0 +ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 0 +ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG ?= 0 +ZSTD_NO_INLINE ?= 0 +ZSTD_STRIP_ERROR_STRINGS ?= 0 + +# Assembly support +ZSTD_NO_ASM ?= 0 + +################################################################## +# libzstd helpers +################################################################## + +# Make 4.3 doesn't support '\#' anymore (https://lwn.net/Articles/810071/) +NUM_SYMBOL := \# + +# define silent mode as default (verbose mode with V=1 or VERBOSE=1) +$(V)$(VERBOSE).SILENT: + +# When cross-compiling from linux to windows, +# one might need to specify TARGET_SYSTEM as "Windows." +# Building from Fedora fails without it. +# (but Ubuntu and Debian don't need to set anything) +TARGET_SYSTEM ?= $(OS) + +# Version numbers +LIBVER_SRC := $(LIBZSTD)/zstd.h +LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` +LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` +LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` +LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT) +LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT)) +LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT)) +LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT)) +LIBVER := $(shell echo $(LIBVER_SCRIPT)) +CCVER := $(shell $(CC) --version) +ZSTD_VERSION?= $(LIBVER) + +# ZSTD_LIB_MINIFY is a helper variable that +# configures a bunch of other variables to space-optimized defaults. +ZSTD_LIB_MINIFY ?= 0 +ifneq ($(ZSTD_LIB_MINIFY), 0) + HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0) + ZSTD_LEGACY_SUPPORT ?= 0 + ZSTD_LIB_DEPRECATED ?= 0 + HUF_FORCE_DECOMPRESS_X1 ?= 1 + ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT ?= 1 + ZSTD_NO_INLINE ?= 1 + ZSTD_STRIP_ERROR_STRINGS ?= 1 +ifneq ($(HAVE_CC_OZ), 0) + # Some compilers (clang) support an even more space-optimized setting. + CFLAGS += -Oz +else + CFLAGS += -Os +endif + CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \ + -DDYNAMIC_BMI2=0 -DNDEBUG +else + CFLAGS += -O3 +endif + +DEBUGLEVEL ?= 0 +CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -DDEBUGLEVEL=$(DEBUGLEVEL) +ifeq ($(TARGET_SYSTEM),Windows_NT) # MinGW assumed + CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting +endif +DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ + -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ + -Wstrict-prototypes -Wundef -Wpointer-arith \ + -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ + -Wredundant-decls -Wmissing-prototypes -Wc++-compat +CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) +LDFLAGS += $(MOREFLAGS) +FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) + +HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0) +GREP_OPTIONS ?= +ifeq ($HAVE_COLORNEVER, 1) + GREP_OPTIONS += --color=never +endif +GREP = grep $(GREP_OPTIONS) +SED_ERE_OPT ?= -E + +ZSTD_COMMON_FILES := $(sort $(wildcard $(LIBZSTD)/common/*.c)) +ZSTD_COMPRESS_FILES := $(sort $(wildcard $(LIBZSTD)/compress/*.c)) +ZSTD_DECOMPRESS_FILES := $(sort $(wildcard $(LIBZSTD)/decompress/*.c)) +ZSTD_DICTBUILDER_FILES := $(sort $(wildcard $(LIBZSTD)/dictBuilder/*.c)) +ZSTD_DEPRECATED_FILES := $(sort $(wildcard $(LIBZSTD)/deprecated/*.c)) +ZSTD_LEGACY_FILES := + +ZSTD_DECOMPRESS_AMD64_ASM_FILES := $(sort $(wildcard $(LIBZSTD)/decompress/*_amd64.S)) + +ifneq ($(ZSTD_NO_ASM), 0) + CPPFLAGS += -DHUF_DISABLE_ASM +else + # Unconditionally add the ASM files they are disabled by + # macros in the .S file. + ZSTD_DECOMPRESS_FILES += $(ZSTD_DECOMPRESS_AMD64_ASM_FILES) +endif + +ifneq ($(HUF_FORCE_DECOMPRESS_X1), 0) + CFLAGS += -DHUF_FORCE_DECOMPRESS_X1 +endif + +ifneq ($(HUF_FORCE_DECOMPRESS_X2), 0) + CFLAGS += -DHUF_FORCE_DECOMPRESS_X2 +endif + +ifneq ($(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT), 0) + CFLAGS += -DZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT +endif + +ifneq ($(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG), 0) + CFLAGS += -DZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG +endif + +ifneq ($(ZSTD_NO_INLINE), 0) + CFLAGS += -DZSTD_NO_INLINE +endif + +ifneq ($(ZSTD_STRIP_ERROR_STRINGS), 0) + CFLAGS += -DZSTD_STRIP_ERROR_STRINGS +endif + +ifneq ($(ZSTD_LEGACY_MULTITHREADED_API), 0) + CFLAGS += -DZSTD_LEGACY_MULTITHREADED_API +endif + +ifneq ($(ZSTD_LEGACY_SUPPORT), 0) +ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0) + ZSTD_LEGACY_FILES += $(shell ls $(LIBZSTD)/legacy/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]') +endif +endif +CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT) + +UNAME := $(shell uname) + +ifndef BUILD_DIR +ifeq ($(UNAME), Darwin) + ifeq ($(shell md5 < /dev/null > /dev/null; echo $$?), 0) + HASH ?= md5 + endif +else ifeq ($(UNAME), FreeBSD) + HASH ?= gmd5sum +else ifeq ($(UNAME), NetBSD) + HASH ?= md5 -n +else ifeq ($(UNAME), OpenBSD) + HASH ?= md5 +endif +HASH ?= md5sum + +HASH_DIR = conf_$(shell echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ZSTD_FILES) | $(HASH) | cut -f 1 -d " " ) +HAVE_HASH :=$(shell echo 1 | $(HASH) > /dev/null && echo 1 || echo 0) +ifeq ($(HAVE_HASH),0) + $(info warning : could not find HASH ($(HASH)), needed to differentiate builds using different flags) + BUILD_DIR := obj/generic_noconf +endif +endif # BUILD_DIR + +ZSTD_SUBDIR := $(LIBZSTD)/common $(LIBZSTD)/compress $(LIBZSTD)/decompress $(LIBZSTD)/dictBuilder $(LIBZSTD)/legacy $(LIBZSTD)/deprecated +vpath %.c $(ZSTD_SUBDIR) +vpath %.S $(ZSTD_SUBDIR) diff --git a/programs/Makefile b/programs/Makefile index ad05dbe1d..ef094fb74 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -9,7 +9,7 @@ # ########################################################################## # zstd : Command Line Utility, supporting gzip-like arguments # zstd32 : Same as zstd, but forced to compile in 32-bits mode -# zstd_nolegacy : zstd without support of decompression of legacy versions +# zstd-nolegacy : zstd without support of decompression of legacy versions # zstd-small : minimal zstd without dictionary builder and benchmark # zstd-compress : compressor-only version of zstd # zstd-decompress : decompressor-only version of zstd @@ -18,31 +18,9 @@ .PHONY: default default: zstd-release -# silent mode by default; verbose can be triggered by V=1 or VERBOSE=1 -$(V)$(VERBOSE).SILENT: +LIBZSTD := ../lib - -ZSTDDIR := ../lib - -# Version numbers -LIBVER_SRC := $(ZSTDDIR)/zstd.h -LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` -LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` -LIBVER_PATCH_SCRIPT:=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < $(LIBVER_SRC)` -LIBVER_SCRIPT:= $(LIBVER_MAJOR_SCRIPT).$(LIBVER_MINOR_SCRIPT).$(LIBVER_PATCH_SCRIPT) -LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT)) -LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT)) -LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT)) -LIBVER := $(shell echo $(LIBVER_SCRIPT)) - -ZSTD_VERSION = $(LIBVER) - -HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0) -GREP_OPTIONS ?= -ifeq ($HAVE_COLORNEVER, 1) - GREP_OPTIONS += --color=never -endif -GREP = grep $(GREP_OPTIONS) +include $(LIBZSTD)/libzstd.mk ifeq ($(shell $(CC) -v 2>&1 | $(GREP) -c "gcc version "), 1) ALIGN_LOOP = -falign-loops=32 @@ -50,78 +28,25 @@ else ALIGN_LOOP = endif -DEBUGLEVEL ?= 0 -CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -DDEBUGLEVEL=$(DEBUGLEVEL) -ifeq ($(OS),Windows_NT) # MinGW assumed - CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting -endif -CFLAGS ?= -O3 -DEBUGFLAGS+=-Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ - -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ - -Wstrict-prototypes -Wundef -Wpointer-arith \ - -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ - -Wredundant-decls -Wmissing-prototypes -Wc++-compat -CFLAGS += $(DEBUGFLAGS) -CPPFLAGS += $(MOREFLAGS) -LDFLAGS += $(MOREFLAGS) -FLAGS = $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) - -ZSTDLIB_COMMON := $(ZSTDDIR)/common -ZSTDLIB_COMPRESS := $(ZSTDDIR)/compress -ZSTDLIB_DECOMPRESS := $(ZSTDDIR)/decompress -ZDICT_DIR := $(ZSTDDIR)/dictBuilder -ZSTDLEGACY_DIR := $(ZSTDDIR)/legacy - -vpath %.c $(ZSTDLIB_COMMON) $(ZSTDLIB_COMPRESS) $(ZSTDLIB_DECOMPRESS) $(ZDICT_DIR) $(ZSTDLEGACY_DIR) - -ZSTDLIB_COMMON_C := $(wildcard $(ZSTDLIB_COMMON)/*.c) -ZSTDLIB_COMPRESS_C := $(wildcard $(ZSTDLIB_COMPRESS)/*.c) -ZSTDLIB_DECOMPRESS_C := $(wildcard $(ZSTDLIB_DECOMPRESS)/*.c) -ZSTDLIB_CORE_SRC := $(ZSTDLIB_DECOMPRESS_C) $(ZSTDLIB_COMMON_C) $(ZSTDLIB_COMPRESS_C) -ZDICT_SRC := $(wildcard $(ZDICT_DIR)/*.c) - -ZSTD_LEGACY_SUPPORT ?= 5 -ZSTDLEGACY_SRC := -ifneq ($(ZSTD_LEGACY_SUPPORT), 0) -ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0) - ZSTDLEGACY_SRC += $(shell ls $(ZSTDLEGACY_DIR)/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]') -endif -endif +ZSTDLIB_COMMON_SRC := $(sort $(ZSTD_COMMON_FILES)) +ZSTDLIB_COMPRESS_SRC := $(sort $(ZSTD_COMPRESS_FILES)) +ZSTDLIB_DECOMPRESS_SRC := $(sort $(ZSTD_DECOMPRESS_FILES)) +ZSTDLIB_CORE_SRC := $(sort $(ZSTD_DECOMPRESS_FILES) $(ZSTD_COMMON_FILES) $(ZSTD_COMPRESS_FILES)) +ZDICT_SRC := $(sort $(ZSTD_DICTBUILDER_FILES)) +ZSTDLEGACY_SRC := $(sort $(ZSTD_LEGACY_FILES)) # Sort files in alphabetical order for reproducible builds ZSTDLIB_FULL_SRC = $(sort $(ZSTDLIB_CORE_SRC) $(ZSTDLEGACY_SRC) $(ZDICT_SRC)) ZSTDLIB_LOCAL_SRC = $(notdir $(ZSTDLIB_FULL_SRC)) -ZSTDLIB_LOCAL_OBJ := $(ZSTDLIB_LOCAL_SRC:.c=.o) +ZSTDLIB_LOCAL_OBJ0 := $(ZSTDLIB_LOCAL_SRC:.c=.o) +ZSTDLIB_LOCAL_OBJ := $(ZSTDLIB_LOCAL_OBJ0:.S=.o) ZSTD_CLI_SRC := $(wildcard *.c) ZSTD_CLI_OBJ := $(ZSTD_CLI_SRC:.c=.o) ZSTD_ALL_SRC = $(ZSTDLIB_LOCAL_SRC) $(ZSTD_CLI_SRC) -ZSTD_ALL_OBJ := $(ZSTD_ALL_SRC:.c=.o) - -UNAME := $(shell uname) - -ifndef BUILD_DIR -ifeq ($(UNAME), Darwin) - ifeq ($(shell md5 < /dev/null > /dev/null; echo $$?), 0) - HASH ?= md5 - endif -else ifeq ($(UNAME), FreeBSD) - HASH ?= gmd5sum -else ifeq ($(UNAME), NetBSD) - HASH ?= md5 -n -else ifeq ($(UNAME), OpenBSD) - HASH ?= md5 -endif -HASH ?= md5sum -HAVE_HASH :=$(shell echo 1 | $(HASH) > /dev/null && echo 1 || echo 0) - -HASH_DIR = conf_$(shell echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LDLIBS) $(ZSTD_FILES) | $(HASH) | cut -f 1 -d " ") -ifeq ($(HAVE_HASH),0) - $(info warning : could not find HASH ($(HASH)), needed to differentiate builds using different flags) - BUILD_DIR := obj/generic_noconf -endif -endif # BUILD_DIR +ZSTD_ALL_OBJ0 := $(ZSTD_ALL_SRC:.c=.o) +ZSTD_ALL_OBJ := $(ZSTD_ALL_OBJ0:.S=.o) # Define *.exe as extension for Windows systems ifneq (,$(filter Windows%,$(OS))) @@ -139,9 +64,6 @@ endif VOID = /dev/null -# Make 4.3 doesn't support '\#' anymore (https://lwn.net/Articles/810071/) -NUM_SYMBOL := \# - # thread detection NO_THREAD_MSG := ==> no threads, building without multithreading support HAVE_PTHREAD := $(shell printf '$(NUM_SYMBOL)include \nint main(void) { return 0; }' > have_pthread.c && $(CC) $(FLAGS) -o have_pthread$(EXT) have_pthread.c -pthread 2> $(VOID) && rm have_pthread$(EXT) && echo 1 || echo 0; rm have_pthread.c) @@ -212,7 +134,7 @@ SET_CACHE_DIRECTORY = \ all: zstd .PHONY: allVariants -allVariants: zstd zstd-compress zstd-decompress zstd-small zstd-nolegacy zstd-dictBuilder +allVariants: zstd zstd-compress zstd-decompress zstd-small zstd-frugal zstd-nolegacy zstd-dictBuilder .PHONY: zstd # must always be run zstd : CPPFLAGS += $(THREAD_CPP) $(ZLIBCPP) $(LZMACPP) $(LZ4CPP) @@ -276,6 +198,7 @@ zstd32 : $(ZSTDLIB_FULL_SRC) $(ZSTD_CLI_SRC) ## zstd-nolegacy: same scope as zstd, with just support of legacy formats removed zstd-nolegacy : LDFLAGS += $(THREAD_LD) $(ZLIBLD) $(LZMALD) $(LZ4LD) $(DEBUGFLAGS_LD) +zstd-nolegacy : CPPFLAGS += -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=0 zstd-nolegacy : $(ZSTDLIB_CORE_SRC) $(ZDICT_SRC) $(ZSTD_CLI_OBJ) $(CC) $(FLAGS) $^ -o $@$(EXT) $(LDFLAGS) @@ -299,7 +222,7 @@ zstd-noxz : zstd ## zstd-dll: zstd executable linked to dynamic library libzstd (must have same version) .PHONY: zstd-dll -zstd-dll : LDFLAGS+= -L$(ZSTDDIR) +zstd-dll : LDFLAGS+= -L$(LIBZSTD) zstd-dll : LDLIBS += -lzstd zstd-dll : ZSTDLIB_LOCAL_SRC = xxhash.c zstd-dll : zstd @@ -323,18 +246,17 @@ zstd-pgo : ## zstd-small: minimal target, supporting only zstd compression and decompression. no bench. no legacy. no other format. zstd-small: CFLAGS = -Os -s zstd-frugal zstd-small: $(ZSTDLIB_CORE_SRC) zstdcli.c util.c timefn.c fileio.c - $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NOTRACE $^ -o $@$(EXT) + $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NOTRACE -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT) -zstd-decompress: $(ZSTDLIB_COMMON_C) $(ZSTDLIB_DECOMPRESS_C) zstdcli.c util.c timefn.c fileio.c - $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NOCOMPRESS -DZSTD_NOTRACE $^ -o $@$(EXT) +zstd-decompress: $(ZSTDLIB_COMMON_SRC) $(ZSTDLIB_DECOMPRESS_SRC) zstdcli.c util.c timefn.c fileio.c + $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NOCOMPRESS -DZSTD_NOTRACE -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT) -zstd-compress: $(ZSTDLIB_COMMON_C) $(ZSTDLIB_COMPRESS_C) zstdcli.c util.c timefn.c fileio.c - $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NODECOMPRESS -DZSTD_NOTRACE $^ -o $@$(EXT) +zstd-compress: $(ZSTDLIB_COMMON_SRC) $(ZSTDLIB_COMPRESS_SRC) zstdcli.c util.c timefn.c fileio.c + $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODICT -DZSTD_NODECOMPRESS -DZSTD_NOTRACE -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=0 $^ -o $@$(EXT) ## zstd-dictBuilder: executable supporting dictionary creation and compression (only) -zstd-dictBuilder: CPPFLAGS += -DZSTD_NOBENCH -DZSTD_NODECOMPRESS -DZSTD_NOTRACE -zstd-dictBuilder: $(ZSTDLIB_COMMON_C) $(ZSTDLIB_COMPRESS_C) $(ZDICT_SRC) zstdcli.c util.c timefn.c fileio.c dibio.c - $(CC) $(FLAGS) $^ -o $@$(EXT) +zstd-dictBuilder: $(ZSTDLIB_COMMON_SRC) $(ZSTDLIB_COMPRESS_SRC) $(ZDICT_SRC) zstdcli.c util.c timefn.c fileio.c dibio.c + $(CC) $(FLAGS) -DZSTD_NOBENCH -DZSTD_NODECOMPRESS -DZSTD_NOTRACE $^ -o $@$(EXT) zstdmt: zstd ln -sf zstd zstdmt @@ -398,6 +320,10 @@ $(BUILD_DIR)/%.o : %.c $(BUILD_DIR)/%.d | $(BUILD_DIR) @echo CC $@ $(COMPILE.c) $(DEPFLAGS) $(BUILD_DIR)/$*.d $(OUTPUT_OPTION) $< +$(BUILD_DIR)/%.o : %.S | $(BUILD_DIR) + @echo AS $@ + $(COMPILE.c) $(OUTPUT_OPTION) $< + MKDIR ?= mkdir $(BUILD_DIR): ; $(MKDIR) -p $@ diff --git a/tests/Makefile b/tests/Makefile index 85553007d..56c448340 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,4 +1,5 @@ -# ################################################################ + + # ################################################################ # Copyright (c) Yann Collet, Facebook, Inc. # All rights reserved. # @@ -19,46 +20,43 @@ # zstreamtest32: Same as zstreamtest, but forced to compile in 32-bits mode # ########################################################################## -ZSTDDIR = ../lib +LIBZSTD = ../lib + +ZSTD_LEGACY_SUPPORT ?= 0 + +DEBUGLEVEL ?= 2 +export DEBUGLEVEL # transmit value to sub-makefiles + +include $(LIBZSTD)/libzstd.mk + +ZSTDDIR = $(LIBZSTD) PRGDIR = ../programs PYTHON ?= python3 TESTARTEFACT := versionsTest -DEBUGLEVEL ?= 2 -export DEBUGLEVEL # transmit value to sub-makefiles -DEBUGFLAGS = -g -DDEBUGLEVEL=$(DEBUGLEVEL) +DEBUGFLAGS += -g -Wno-c++-compat CPPFLAGS += -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/compress \ -I$(ZSTDDIR)/dictBuilder -I$(ZSTDDIR)/deprecated -I$(PRGDIR) \ -DZSTD_WINDOW_OVERFLOW_CORRECT_FREQUENTLY=1 -ifeq ($(OS),Windows_NT) # MinGW assumed -CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting -endif -CFLAGS ?= -O3 -CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ - -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ - -Wstrict-prototypes -Wundef \ - -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ - -Wredundant-decls -Wmissing-prototypes -Wno-deprecated-declarations -CFLAGS += $(DEBUGFLAGS) -CPPFLAGS += $(MOREFLAGS) - -ZSTDCOMMON_FILES := $(ZSTDDIR)/common/*.c -ZSTDCOMP_FILES := $(ZSTDDIR)/compress/*.c -ZSTDDECOMP_FILES := $(ZSTDDIR)/decompress/*.c +ZSTDCOMMON_FILES := $(sort $(ZSTD_COMMON_FILES)) +ZSTDCOMP_FILES := $(sort $(ZSTD_COMPRESS_FILES)) +ZSTDDECOMP_FILES := $(sort $(ZSTD_DECOMPRESS_FILES)) ZSTD_FILES := $(ZSTDDECOMP_FILES) $(ZSTDCOMMON_FILES) $(ZSTDCOMP_FILES) -ZDICT_FILES := $(ZSTDDIR)/dictBuilder/*.c +ZDICT_FILES := $(sort $(ZSTD_DICTBUILDER_FILES)) ZSTD_F1 := $(wildcard $(ZSTD_FILES)) ZSTD_OBJ1 := $(subst $(ZSTDDIR)/common/,zstdm_,$(ZSTD_F1)) ZSTD_OBJ2 := $(subst $(ZSTDDIR)/compress/,zstdc_,$(ZSTD_OBJ1)) ZSTD_OBJ3 := $(subst $(ZSTDDIR)/decompress/,zstdd_,$(ZSTD_OBJ2)) -ZSTD_OBJECTS := $(ZSTD_OBJ3:.c=.o) +ZSTD_OBJ4 := $(ZSTD_OBJ3:.c=.o) +ZSTD_OBJECTS := $(ZSTD_OBJ4:.S=.o) ZSTDMT_OBJ1 := $(subst $(ZSTDDIR)/common/,zstdmt_m_,$(ZSTD_F1)) ZSTDMT_OBJ2 := $(subst $(ZSTDDIR)/compress/,zstdmt_c_,$(ZSTDMT_OBJ1)) ZSTDMT_OBJ3 := $(subst $(ZSTDDIR)/decompress/,zstdmt_d_,$(ZSTDMT_OBJ2)) -ZSTDMT_OBJECTS := $(ZSTDMT_OBJ3:.c=.o) +ZSTDMT_OBJ4 := $(ZSTDMT_OBJ3:.c=.o) +ZSTDMT_OBJECTS := $(ZSTDMT_OBJ4:.S=.o) # Define *.exe as extension for Windows systems ifneq (,$(filter Windows%,$(OS))) @@ -119,6 +117,9 @@ zstdc_%.o : $(ZSTDDIR)/compress/%.c zstdd_%.o : $(ZSTDDIR)/decompress/%.c $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ +zstdd_%.o : $(ZSTDDIR)/decompress/%.S + $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ + zstdmt%.o : CPPFLAGS += $(MULTITHREAD_CPP) zstdmt_m_%.o : $(ZSTDDIR)/common/%.c @@ -130,6 +131,9 @@ zstdmt_c_%.o : $(ZSTDDIR)/compress/%.c zstdmt_d_%.o : $(ZSTDDIR)/decompress/%.c $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ +zstdmt_d_%.o : $(ZSTDDIR)/decompress/%.S + $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ + fullbench32: CPPFLAGS += -m32 fullbench fullbench32 : CPPFLAGS += $(MULTITHREAD_CPP) -Wno-deprecated-declarations fullbench fullbench32 : LDFLAGS += $(MULTITHREAD_LD) @@ -201,7 +205,7 @@ bigdict: $(ZSTDMT_OBJECTS) $(PRGDIR)/datagen.c bigdict.c invalidDictionaries : $(ZSTD_OBJECTS) invalidDictionaries.c -legacy : CPPFLAGS += -I$(ZSTDDIR)/legacy -DZSTD_LEGACY_SUPPORT=4 +legacy : CPPFLAGS += -I$(ZSTDDIR)/legacy -UZSTD_LEGACY_SUPPORT -DZSTD_LEGACY_SUPPORT=4 legacy : $(ZSTD_FILES) $(wildcard $(ZSTDDIR)/legacy/*.c) legacy.c decodecorpus : LDLIBS += -lm diff --git a/tests/fuzz/Makefile b/tests/fuzz/Makefile index 5c54ccd77..72dbccb57 100644 --- a/tests/fuzz/Makefile +++ b/tests/fuzz/Makefile @@ -23,6 +23,12 @@ else endif CORPORA_URL_PREFIX:=https://github.com/facebook/zstd/releases/download/fuzz-corpora/ +LIBZSTD = ../../lib +DEBUGLEVEL ?= 2 +ZSTD_LEGACY_SUPPORT ?= 1 + +include $(LIBZSTD)/libzstd.mk + ZSTDDIR = ../../lib PRGDIR = ../../programs CONTRIBDIR = ../../contrib @@ -34,7 +40,7 @@ FUZZ_EXTRA_FLAGS := -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ -Wstrict-prototypes -Wundef \ -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ - -Wredundant-decls \ + -Wredundant-decls -Wno-deprecated-declarations \ -g -fno-omit-frame-pointer FUZZ_CFLAGS := $(FUZZ_EXTRA_FLAGS) $(CFLAGS) FUZZ_CXXFLAGS := $(FUZZ_EXTRA_FLAGS) -std=c++11 $(CXXFLAGS) @@ -50,11 +56,11 @@ FUZZ_SRC := $(PRGDIR)/util.c ./fuzz_helpers.c ./zstd_helpers.c ./fuzz_data_produ SEEKABLE_HEADERS = $(CONTRIBDIR)/seekable_format/zstd_seekable.h SEEKABLE_OBJS = $(CONTRIBDIR)/seekable_format/zstdseek_compress.c $(CONTRIBDIR)/seekable_format/zstdseek_decompress.c -ZSTDCOMMON_SRC := $(ZSTDDIR)/common/*.c -ZSTDCOMP_SRC := $(ZSTDDIR)/compress/*.c -ZSTDDECOMP_SRC := $(ZSTDDIR)/decompress/*.c -ZSTDDICT_SRC := $(ZSTDDIR)/dictBuilder/*.c -ZSTDLEGACY_SRC := $(ZSTDDIR)/legacy/*.c +ZSTDCOMMON_SRC := $(ZSTD_COMMON_FILES) +ZSTDCOMP_SRC := $(ZSTD_COMPRESS_FILES) +ZSTDDECOMP_SRC := $(ZSTD_DECOMPRESS_FILES) +ZSTDDICT_SRC := $(ZSTD_DICTBUILDER_FILES) +ZSTDLEGACY_SRC := $(ZSTD_LEGACY_FILES) FUZZ_SRC := \ $(FUZZ_SRC) \ $(ZSTDDECOMP_SRC) \ @@ -71,7 +77,8 @@ FUZZ_D_OBJ4 := $(subst $(ZSTDDIR)/dictBuilder/,d_lib_dictBuilder_,$(FUZZ_D_OBJ3) FUZZ_D_OBJ5 := $(subst $(ZSTDDIR)/legacy/,d_lib_legacy_,$(FUZZ_D_OBJ4)) FUZZ_D_OBJ6 := $(subst $(PRGDIR)/,d_prg_,$(FUZZ_D_OBJ5)) FUZZ_D_OBJ7 := $(subst $\./,d_fuzz_,$(FUZZ_D_OBJ6)) -FUZZ_DECOMPRESS_OBJ := $(FUZZ_D_OBJ7:.c=.o) +FUZZ_D_OBJ8 := $(FUZZ_D_OBJ7:.c=.o) +FUZZ_DECOMPRESS_OBJ := $(FUZZ_D_OBJ8:.S=.o) FUZZ_RT_OBJ1 := $(subst $(ZSTDDIR)/common/,rt_lib_common_,$(FUZZ_SRC)) FUZZ_RT_OBJ2 := $(subst $(ZSTDDIR)/compress/,rt_lib_compress_,$(FUZZ_RT_OBJ1)) @@ -80,7 +87,8 @@ FUZZ_RT_OBJ4 := $(subst $(ZSTDDIR)/dictBuilder/,rt_lib_dictBuilder_,$(FUZZ_RT_OB FUZZ_RT_OBJ5 := $(subst $(ZSTDDIR)/legacy/,rt_lib_legacy_,$(FUZZ_RT_OBJ4)) FUZZ_RT_OBJ6 := $(subst $(PRGDIR)/,rt_prg_,$(FUZZ_RT_OBJ5)) FUZZ_RT_OBJ7 := $(subst $\./,rt_fuzz_,$(FUZZ_RT_OBJ6)) -FUZZ_ROUND_TRIP_OBJ := $(FUZZ_RT_OBJ7:.c=.o) +FUZZ_RT_OBJ8 := $(FUZZ_RT_OBJ7:.c=.o) +FUZZ_ROUND_TRIP_OBJ := $(FUZZ_RT_OBJ8:.S=.o) .PHONY: default all clean cleanall @@ -117,6 +125,9 @@ rt_lib_compress_%.o: $(ZSTDDIR)/compress/%.c rt_lib_decompress_%.o: $(ZSTDDIR)/decompress/%.c $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@ +rt_lib_decompress_%.o: $(ZSTDDIR)/decompress/%.S + $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@ + rt_lib_dictBuilder_%.o: $(ZSTDDIR)/dictBuilder/%.c $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $(FUZZ_ROUND_TRIP_FLAGS) $< -c -o $@ @@ -138,6 +149,9 @@ d_lib_compress_%.o: $(ZSTDDIR)/compress/%.c d_lib_decompress_%.o: $(ZSTDDIR)/decompress/%.c $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@ +d_lib_decompress_%.o: $(ZSTDDIR)/decompress/%.S + $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@ + d_lib_dictBuilder_%.o: $(ZSTDDIR)/dictBuilder/%.c $(CC) $(FUZZ_CPPFLAGS) $(FUZZ_CFLAGS) $< -c -o $@ diff --git a/tests/fuzzer.c b/tests/fuzzer.c index ce79f53ac..c4de54247 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -1528,7 +1528,7 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "test%3i : resize context to full CCtx size : ", testNb++); staticCCtx = ZSTD_initStaticCStream(staticCCtxBuffer, staticCCtxSize); - DISPLAYLEVEL(4, "staticCCtxBuffer = %p, staticCCtx = %p , ", staticCCtxBuffer, staticCCtx); + DISPLAYLEVEL(4, "staticCCtxBuffer = %p, staticCCtx = %p , ", staticCCtxBuffer, (void*)staticCCtx); if (staticCCtx == NULL) goto _output_error; DISPLAYLEVEL(3, "OK \n"); diff --git a/tests/regression/Makefile b/tests/regression/Makefile index 3a5a64e5b..a440c6c94 100644 --- a/tests/regression/Makefile +++ b/tests/regression/Makefile @@ -46,6 +46,7 @@ result.o: result.c result.h test.o: test.c data.h config.h method.h $(CC) $(REGRESSION_CFLAGS) $(REGRESSION_CPPFLAGS) $< -c -o $@ +.PHONY: libzstd.a libzstd.a: $(MAKE) -C $(LIBDIR) libzstd.a-mt cp $(LIBDIR)/libzstd.a . diff --git a/tests/test-variants.sh b/tests/test-variants.sh new file mode 100755 index 000000000..f3a9e065b --- /dev/null +++ b/tests/test-variants.sh @@ -0,0 +1,115 @@ +#!/bin/sh +set -e +set -u +set -x + + +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) +PROG_DIR="$SCRIPT_DIR/../programs" + +ZSTD="$PROG_DIR/zstd" +ZSTD_COMPRESS="$PROG_DIR/zstd-compress" +ZSTD_DECOMPRESS="$PROG_DIR/zstd-decompress" +ZSTD_NOLEGACY="$PROG_DIR/zstd-nolegacy" +ZSTD_DICTBUILDER="$PROG_DIR/zstd-dictBuilder" +ZSTD_FRUGAL="$PROG_DIR/zstd-frugal" +ZSTD_NOMT="$PROG_DIR/zstd-nomt" + +println() { + printf '%b\n' "${*}" +} + +die() { + println "$@" 1>&2 + exit 1 +} + +symbol_present() { + (nm $1 || echo "symbol_present $@ failed") | grep $2 +} + +symbol_not_present() { + symbol_present $@ && die "Binary '$1' mistakenly contains symbol '$2'" ||: +} + +compress_not_present() { + symbol_not_present "$1" ZSTD_compress +} + +decompress_not_present() { + symbol_not_present "$1" ZSTD_decompress +} + +dict_not_present() { + symbol_not_present "$1" ZDICT_ + symbol_not_present "$1" COVER_ +} + +cliextra_not_present() { + symbol_not_present "$1" TRACE_ + symbol_not_present "$1" BMK_ +} + +legacy_not_present() { + symbol_not_present "$1" ZSTDv0 +} + +test_help() { + "$1" --help | grep -- "$2" +} + +test_no_help() { + test_help $@ && die "'$1' supports '$2' when it shouldn't" ||: +} + +extras_not_present() { + dict_not_present $@ + legacy_not_present $@ + cliextra_not_present $@ + test_no_help $@ "--train" + test_no_help $@ "-b#" +} + +test_compress() { + echo "hello" | "$1" | "$ZSTD" -t +} + +test_decompress() { + echo "hello" | "$ZSTD" | "$1" -t +} + +test_zstd() { + test_compress $@ + test_decompress $@ +} + +extras_not_present "$ZSTD_FRUGAL" +extras_not_present "$ZSTD_COMPRESS" +extras_not_present "$ZSTD_DECOMPRESS" + +compress_not_present "$ZSTD_DECOMPRESS" + +decompress_not_present "$ZSTD_COMPRESS" +decompress_not_present "$ZSTD_DICTBUILDER" + +cliextra_not_present "$ZSTD_DICTBUILDER" + +legacy_not_present "$ZSTD_DICTBUILDER" +legacy_not_present "$ZSTD_NOLEGACY" + +symbol_not_present "$ZSTD" ZSTDv01 +symbol_not_present "$ZSTD" ZSTDv02 +symbol_not_present "$ZSTD" ZSTDv03 +symbol_not_present "$ZSTD" ZSTDv04 + +test_compress "$ZSTD_COMPRESS" +test_decompress "$ZSTD_DECOMPRESS" + +test_zstd "$ZSTD_FRUGAL" +test_zstd "$ZSTD_NOLEGACY" + +test_help "$ZSTD" '-b#' +test_help "$ZSTD" --train +test_help "$ZSTD_DICTBUILDER" --train + +println "Success!" From d7542aacd99ad922dd179e729ce411c107963ab3 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Fri, 17 Sep 2021 12:58:04 -0700 Subject: [PATCH 03/38] [fuzzer] Add huf_decompress fuzzer Add a fuzzer for Huffman decompression. Fix several bugs in Huffman decompression, mostly related to `op == NULL` and pointer underflow. --- lib/decompress/huf_decompress.c | 166 +++++++++++++++++--------------- tests/fuzz/Makefile | 6 +- tests/fuzz/fuzz.py | 1 + tests/fuzz/huf_decompress.c | 64 ++++++++++++ 4 files changed, 159 insertions(+), 78 deletions(-) create mode 100644 tests/fuzz/huf_decompress.c diff --git a/lib/decompress/huf_decompress.c b/lib/decompress/huf_decompress.c index b93c9a003..f41a02bb5 100644 --- a/lib/decompress/huf_decompress.c +++ b/lib/decompress/huf_decompress.c @@ -304,11 +304,13 @@ HUF_decodeStreamX1(BYTE* p, BIT_DStream_t* const bitDPtr, BYTE* const pEnd, cons BYTE* const pStart = p; /* up to 4 symbols at a time */ - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-3)) { - HUF_DECODE_SYMBOLX1_2(p, bitDPtr); - HUF_DECODE_SYMBOLX1_1(p, bitDPtr); - HUF_DECODE_SYMBOLX1_2(p, bitDPtr); - HUF_DECODE_SYMBOLX1_0(p, bitDPtr); + if ((pEnd - p) > 3) { + while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-3)) { + HUF_DECODE_SYMBOLX1_2(p, bitDPtr); + HUF_DECODE_SYMBOLX1_1(p, bitDPtr); + HUF_DECODE_SYMBOLX1_2(p, bitDPtr); + HUF_DECODE_SYMBOLX1_0(p, bitDPtr); + } } /* [0-3] symbols remaining */ @@ -388,33 +390,36 @@ HUF_decompress4X1_usingDTable_internal_body( U32 endSignal = 1; if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */ + if (opStart4 > oend) return ERROR(corruption_detected); /* overflow */ CHECK_F( BIT_initDStream(&bitD1, istart1, length1) ); CHECK_F( BIT_initDStream(&bitD2, istart2, length2) ); CHECK_F( BIT_initDStream(&bitD3, istart3, length3) ); CHECK_F( BIT_initDStream(&bitD4, istart4, length4) ); /* up to 16 symbols per loop (4 symbols per stream) in 64-bit mode */ - for ( ; (endSignal) & (op4 < olimit) ; ) { - HUF_DECODE_SYMBOLX1_2(op1, &bitD1); - HUF_DECODE_SYMBOLX1_2(op2, &bitD2); - HUF_DECODE_SYMBOLX1_2(op3, &bitD3); - HUF_DECODE_SYMBOLX1_2(op4, &bitD4); - HUF_DECODE_SYMBOLX1_1(op1, &bitD1); - HUF_DECODE_SYMBOLX1_1(op2, &bitD2); - HUF_DECODE_SYMBOLX1_1(op3, &bitD3); - HUF_DECODE_SYMBOLX1_1(op4, &bitD4); - HUF_DECODE_SYMBOLX1_2(op1, &bitD1); - HUF_DECODE_SYMBOLX1_2(op2, &bitD2); - HUF_DECODE_SYMBOLX1_2(op3, &bitD3); - HUF_DECODE_SYMBOLX1_2(op4, &bitD4); - HUF_DECODE_SYMBOLX1_0(op1, &bitD1); - HUF_DECODE_SYMBOLX1_0(op2, &bitD2); - HUF_DECODE_SYMBOLX1_0(op3, &bitD3); - HUF_DECODE_SYMBOLX1_0(op4, &bitD4); - endSignal &= BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished; - endSignal &= BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished; - endSignal &= BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished; - endSignal &= BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished; + if ((size_t)(oend - op4) >= sizeof(size_t)) { + for ( ; (endSignal) & (op4 < olimit) ; ) { + HUF_DECODE_SYMBOLX1_2(op1, &bitD1); + HUF_DECODE_SYMBOLX1_2(op2, &bitD2); + HUF_DECODE_SYMBOLX1_2(op3, &bitD3); + HUF_DECODE_SYMBOLX1_2(op4, &bitD4); + HUF_DECODE_SYMBOLX1_1(op1, &bitD1); + HUF_DECODE_SYMBOLX1_1(op2, &bitD2); + HUF_DECODE_SYMBOLX1_1(op3, &bitD3); + HUF_DECODE_SYMBOLX1_1(op4, &bitD4); + HUF_DECODE_SYMBOLX1_2(op1, &bitD1); + HUF_DECODE_SYMBOLX1_2(op2, &bitD2); + HUF_DECODE_SYMBOLX1_2(op3, &bitD3); + HUF_DECODE_SYMBOLX1_2(op4, &bitD4); + HUF_DECODE_SYMBOLX1_0(op1, &bitD1); + HUF_DECODE_SYMBOLX1_0(op2, &bitD2); + HUF_DECODE_SYMBOLX1_0(op3, &bitD3); + HUF_DECODE_SYMBOLX1_0(op4, &bitD4); + endSignal &= BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished; + endSignal &= BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished; + endSignal &= BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished; + endSignal &= BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished; + } } /* check corruption */ @@ -753,19 +758,23 @@ HUF_decodeStreamX2(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* const pEnd, BYTE* const pStart = p; /* up to 8 symbols at a time */ - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-(sizeof(bitDPtr->bitContainer)-1))) { - HUF_DECODE_SYMBOLX2_2(p, bitDPtr); - HUF_DECODE_SYMBOLX2_1(p, bitDPtr); - HUF_DECODE_SYMBOLX2_2(p, bitDPtr); - HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + if ((size_t)(pEnd - p) >= sizeof(bitDPtr->bitContainer)) { + while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-(sizeof(bitDPtr->bitContainer)-1))) { + HUF_DECODE_SYMBOLX2_2(p, bitDPtr); + HUF_DECODE_SYMBOLX2_1(p, bitDPtr); + HUF_DECODE_SYMBOLX2_2(p, bitDPtr); + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + } } /* closer to end : up to 2 symbols at a time */ - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p <= pEnd-2)) - HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + if ((size_t)(pEnd - p) >= 2) { + while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p <= pEnd-2)) + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); - while (p <= pEnd-2) - HUF_DECODE_SYMBOLX2_0(p, bitDPtr); /* no need to reload : reached the end of DStream */ + while (p <= pEnd-2) + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); /* no need to reload : reached the end of DStream */ + } if (p < pEnd) p += HUF_decodeLastSymbolX2(p, bitDPtr, dt, dtLog); @@ -841,57 +850,60 @@ HUF_decompress4X2_usingDTable_internal_body( U32 const dtLog = dtd.tableLog; if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */ + if (opStart4 > oend) return ERROR(corruption_detected); /* overflow */ CHECK_F( BIT_initDStream(&bitD1, istart1, length1) ); CHECK_F( BIT_initDStream(&bitD2, istart2, length2) ); CHECK_F( BIT_initDStream(&bitD3, istart3, length3) ); CHECK_F( BIT_initDStream(&bitD4, istart4, length4) ); /* 16-32 symbols per loop (4-8 symbols per stream) */ - for ( ; (endSignal) & (op4 < olimit); ) { + if ((size_t)(oend - op4) >= sizeof(size_t)) { + for ( ; (endSignal) & (op4 < olimit); ) { #if defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) - HUF_DECODE_SYMBOLX2_2(op1, &bitD1); - HUF_DECODE_SYMBOLX2_1(op1, &bitD1); - HUF_DECODE_SYMBOLX2_2(op1, &bitD1); - HUF_DECODE_SYMBOLX2_0(op1, &bitD1); - HUF_DECODE_SYMBOLX2_2(op2, &bitD2); - HUF_DECODE_SYMBOLX2_1(op2, &bitD2); - HUF_DECODE_SYMBOLX2_2(op2, &bitD2); - HUF_DECODE_SYMBOLX2_0(op2, &bitD2); - endSignal &= BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished; - endSignal &= BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished; - HUF_DECODE_SYMBOLX2_2(op3, &bitD3); - HUF_DECODE_SYMBOLX2_1(op3, &bitD3); - HUF_DECODE_SYMBOLX2_2(op3, &bitD3); - HUF_DECODE_SYMBOLX2_0(op3, &bitD3); - HUF_DECODE_SYMBOLX2_2(op4, &bitD4); - HUF_DECODE_SYMBOLX2_1(op4, &bitD4); - HUF_DECODE_SYMBOLX2_2(op4, &bitD4); - HUF_DECODE_SYMBOLX2_0(op4, &bitD4); - endSignal &= BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished; - endSignal &= BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished; + HUF_DECODE_SYMBOLX2_2(op1, &bitD1); + HUF_DECODE_SYMBOLX2_1(op1, &bitD1); + HUF_DECODE_SYMBOLX2_2(op1, &bitD1); + HUF_DECODE_SYMBOLX2_0(op1, &bitD1); + HUF_DECODE_SYMBOLX2_2(op2, &bitD2); + HUF_DECODE_SYMBOLX2_1(op2, &bitD2); + HUF_DECODE_SYMBOLX2_2(op2, &bitD2); + HUF_DECODE_SYMBOLX2_0(op2, &bitD2); + endSignal &= BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished; + endSignal &= BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished; + HUF_DECODE_SYMBOLX2_2(op3, &bitD3); + HUF_DECODE_SYMBOLX2_1(op3, &bitD3); + HUF_DECODE_SYMBOLX2_2(op3, &bitD3); + HUF_DECODE_SYMBOLX2_0(op3, &bitD3); + HUF_DECODE_SYMBOLX2_2(op4, &bitD4); + HUF_DECODE_SYMBOLX2_1(op4, &bitD4); + HUF_DECODE_SYMBOLX2_2(op4, &bitD4); + HUF_DECODE_SYMBOLX2_0(op4, &bitD4); + endSignal &= BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished; + endSignal &= BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished; #else - HUF_DECODE_SYMBOLX2_2(op1, &bitD1); - HUF_DECODE_SYMBOLX2_2(op2, &bitD2); - HUF_DECODE_SYMBOLX2_2(op3, &bitD3); - HUF_DECODE_SYMBOLX2_2(op4, &bitD4); - HUF_DECODE_SYMBOLX2_1(op1, &bitD1); - HUF_DECODE_SYMBOLX2_1(op2, &bitD2); - HUF_DECODE_SYMBOLX2_1(op3, &bitD3); - HUF_DECODE_SYMBOLX2_1(op4, &bitD4); - HUF_DECODE_SYMBOLX2_2(op1, &bitD1); - HUF_DECODE_SYMBOLX2_2(op2, &bitD2); - HUF_DECODE_SYMBOLX2_2(op3, &bitD3); - HUF_DECODE_SYMBOLX2_2(op4, &bitD4); - HUF_DECODE_SYMBOLX2_0(op1, &bitD1); - HUF_DECODE_SYMBOLX2_0(op2, &bitD2); - HUF_DECODE_SYMBOLX2_0(op3, &bitD3); - HUF_DECODE_SYMBOLX2_0(op4, &bitD4); - endSignal = (U32)LIKELY( - (BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished) - & (BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished) - & (BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished) - & (BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished)); + HUF_DECODE_SYMBOLX2_2(op1, &bitD1); + HUF_DECODE_SYMBOLX2_2(op2, &bitD2); + HUF_DECODE_SYMBOLX2_2(op3, &bitD3); + HUF_DECODE_SYMBOLX2_2(op4, &bitD4); + HUF_DECODE_SYMBOLX2_1(op1, &bitD1); + HUF_DECODE_SYMBOLX2_1(op2, &bitD2); + HUF_DECODE_SYMBOLX2_1(op3, &bitD3); + HUF_DECODE_SYMBOLX2_1(op4, &bitD4); + HUF_DECODE_SYMBOLX2_2(op1, &bitD1); + HUF_DECODE_SYMBOLX2_2(op2, &bitD2); + HUF_DECODE_SYMBOLX2_2(op3, &bitD3); + HUF_DECODE_SYMBOLX2_2(op4, &bitD4); + HUF_DECODE_SYMBOLX2_0(op1, &bitD1); + HUF_DECODE_SYMBOLX2_0(op2, &bitD2); + HUF_DECODE_SYMBOLX2_0(op3, &bitD3); + HUF_DECODE_SYMBOLX2_0(op4, &bitD4); + endSignal = (U32)LIKELY( + (BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished) + & (BIT_reloadDStreamFast(&bitD2) == BIT_DStream_unfinished) + & (BIT_reloadDStreamFast(&bitD3) == BIT_DStream_unfinished) + & (BIT_reloadDStreamFast(&bitD4) == BIT_DStream_unfinished)); #endif + } } /* check corruption */ diff --git a/tests/fuzz/Makefile b/tests/fuzz/Makefile index 72dbccb57..d733f7cad 100644 --- a/tests/fuzz/Makefile +++ b/tests/fuzz/Makefile @@ -112,7 +112,8 @@ FUZZ_TARGETS := \ fse_read_ncount \ sequence_compression_api \ seekable_roundtrip \ - huf_round_trip + huf_round_trip \ + huf_decompress all: libregression.a $(FUZZ_TARGETS) @@ -218,6 +219,9 @@ seekable_roundtrip: $(FUZZ_HEADERS) $(SEEKABLE_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) $ huf_round_trip: $(FUZZ_HEADERS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_huf_round_trip.o $(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_ROUND_TRIP_OBJ) rt_fuzz_huf_round_trip.o $(LIB_FUZZING_ENGINE) -o $@ +huf_decompress: $(FUZZ_HEADERS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_huf_decompress.o + $(CXX) $(FUZZ_TARGET_FLAGS) $(FUZZ_DECOMPRESS_OBJ) d_fuzz_huf_decompress.o $(LIB_FUZZING_ENGINE) -o $@ + libregression.a: $(FUZZ_HEADERS) $(PRGDIR)/util.h $(PRGDIR)/util.c d_fuzz_regression_driver.o $(AR) $(FUZZ_ARFLAGS) $@ d_fuzz_regression_driver.o diff --git a/tests/fuzz/fuzz.py b/tests/fuzz/fuzz.py index 057a47ecb..0c56cccb2 100755 --- a/tests/fuzz/fuzz.py +++ b/tests/fuzz/fuzz.py @@ -64,6 +64,7 @@ TARGET_INFO = { 'sequence_compression_api': TargetInfo(InputType.RAW_DATA), 'seekable_roundtrip': TargetInfo(InputType.RAW_DATA), 'huf_round_trip': TargetInfo(InputType.RAW_DATA), + 'huf_decompress': TargetInfo(InputType.RAW_DATA), } TARGETS = list(TARGET_INFO.keys()) ALL_TARGETS = TARGETS + ['all'] diff --git a/tests/fuzz/huf_decompress.c b/tests/fuzz/huf_decompress.c new file mode 100644 index 000000000..7ede9ec53 --- /dev/null +++ b/tests/fuzz/huf_decompress.c @@ -0,0 +1,64 @@ +/* + * Copyright (c) Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under both the BSD-style license (found in the + * LICENSE file in the root directory of this source tree) and the GPLv2 (found + * in the COPYING file in the root directory of this source tree). + * You may select, at your option, one of the above-listed licenses. + */ + +/** + * This fuzz target performs a zstd round-trip test (compress & decompress), + * compares the result with the original, and calls abort() on corruption. + */ + +#define HUF_STATIC_LINKING_ONLY + +#include +#include +#include +#include +#include "common/cpu.h" +#include "common/huf.h" +#include "fuzz_helpers.h" +#include "fuzz_data_producer.h" + +int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size) +{ + FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(src, size); + /* Select random parameters: #streams, X1 or X2 decoding, bmi2 */ + int const streams = FUZZ_dataProducer_int32Range(producer, 0, 1); + int const symbols = FUZZ_dataProducer_int32Range(producer, 0, 1); + int const bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid()) && FUZZ_dataProducer_int32Range(producer, 0, 1); + /* Select a random cBufSize - it may be too small */ + size_t const dBufSize = FUZZ_dataProducer_uint32Range(producer, 0, 8 * size + 500); + size_t const maxTableLog = FUZZ_dataProducer_uint32Range(producer, 1, HUF_TABLELOG_MAX); + HUF_DTable* dt = (HUF_DTable*)FUZZ_malloc(HUF_DTABLE_SIZE(maxTableLog) * sizeof(HUF_DTable)); + size_t const wkspSize = HUF_WORKSPACE_SIZE; + void* wksp = FUZZ_malloc(wkspSize); + void* dBuf = FUZZ_malloc(dBufSize); + dt[0] = maxTableLog * 0x01000001; + size = FUZZ_dataProducer_remainingBytes(producer); + + if (symbols == 0) { + size_t const err = HUF_readDTableX1_wksp_bmi2(dt, src, size, wksp, wkspSize, bmi2); + if (ZSTD_isError(err)) + goto _out; + } else { + size_t const err = HUF_readDTableX2_wksp(dt, src, size, wksp, wkspSize); + if (ZSTD_isError(err)) + goto _out; + } + if (streams == 0) + HUF_decompress1X_usingDTable_bmi2(dBuf, dBufSize, src, size, dt, bmi2); + else + HUF_decompress4X_usingDTable_bmi2(dBuf, dBufSize, src, size, dt, bmi2); + +_out: + free(dt); + free(wksp); + free(dBuf); + FUZZ_dataProducer_free(producer); + return 0; +} From 4eef2088893f443b43a5343fe634c5227feb2f9c Mon Sep 17 00:00:00 2001 From: Ma Lin Date: Sun, 19 Sep 2021 09:57:06 +0800 Subject: [PATCH 04/38] add msvc2019 to build.generic.cmd --- build/VS_scripts/build.generic.cmd | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/build/VS_scripts/build.generic.cmd b/build/VS_scripts/build.generic.cmd index a7ca4d067..b24e6ed4b 100644 --- a/build/VS_scripts/build.generic.cmd +++ b/build/VS_scripts/build.generic.cmd @@ -19,10 +19,10 @@ GOTO build :display_help echo Syntax: build.generic.cmd msbuild_version msbuild_platform msbuild_configuration msbuild_toolset -echo msbuild_version: VS installed version (VS2012, VS2013, VS2015, VS2017, ...) +echo msbuild_version: VS installed version (VS2012, VS2013, VS2015, VS2017, VS2019, ...) echo msbuild_platform: Platform (x64 or Win32) echo msbuild_configuration: VS configuration (Release or Debug) -echo msbuild_toolset: Platform Toolset (v100, v110, v120, v140, v141) +echo msbuild_toolset: Platform Toolset (v100, v110, v120, v140, v141, v142, ...) EXIT /B 1 @@ -43,6 +43,16 @@ IF %msbuild_version% == VS2017 ( IF EXIST %msbuild_vs2017enterprise% SET msbuild=%msbuild_vs2017enterprise% ) +:: VS2019 +SET msbuild_vs2019community="%programfiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" +SET msbuild_vs2019professional="%programfiles(x86)%\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe" +SET msbuild_vs2019enterprise="%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" +IF %msbuild_version% == VS2019 ( + IF EXIST %msbuild_vs2019community% SET msbuild=%msbuild_vs2019community% + IF EXIST %msbuild_vs2019professional% SET msbuild=%msbuild_vs2019professional% + IF EXIST %msbuild_vs2019enterprise% SET msbuild=%msbuild_vs2019enterprise% +) + SET project="%~p0\..\VS2010\zstd.sln" SET msbuild_params=/verbosity:minimal /nologo /t:Clean,Build /p:Platform=%msbuild_platform% /p:Configuration=%msbuild_configuration% From a5f2c45528032ed20c33e0f8cd2c163a800a0017 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Fri, 17 Sep 2021 11:43:04 -0700 Subject: [PATCH 05/38] Huffman ASM --- build/meson/lib/meson.build | 1 + build/single_file_libs/zstd-in.c | 2 + build/single_file_libs/zstddeclib-in.c | 2 + contrib/linux-kernel/Makefile | 1 + contrib/linux-kernel/decompress_sources.h | 5 + contrib/linux-kernel/test/macro-test.sh | 1 + lib/common/compiler.h | 4 +- lib/common/error_private.h | 79 +++ lib/common/huf.h | 7 +- lib/common/zstd_internal.h | 120 ++-- lib/compress/huf_compress.c | 1 + lib/decompress/huf_decompress.c | 755 ++++++++++++++++++---- lib/decompress/huf_decompress_amd64.S | 561 ++++++++++++++++ lib/zstd.h | 2 +- tests/fuzz/huf_decompress.c | 2 +- 15 files changed, 1348 insertions(+), 195 deletions(-) create mode 100644 lib/decompress/huf_decompress_amd64.S diff --git a/build/meson/lib/meson.build b/build/meson/lib/meson.build index 5da538729..1f4f8c25d 100644 --- a/build/meson/lib/meson.build +++ b/build/meson/lib/meson.build @@ -37,6 +37,7 @@ libzstd_sources = [join_paths(zstd_rootdir, 'lib/common/entropy_common.c'), join_paths(zstd_rootdir, 'lib/compress/zstd_opt.c'), join_paths(zstd_rootdir, 'lib/compress/zstd_ldm.c'), join_paths(zstd_rootdir, 'lib/decompress/huf_decompress.c'), + join_paths(zstd_rootdir, 'lib/decompress/huf_decompress_amd64.S'), join_paths(zstd_rootdir, 'lib/decompress/zstd_decompress.c'), join_paths(zstd_rootdir, 'lib/decompress/zstd_decompress_block.c'), join_paths(zstd_rootdir, 'lib/decompress/zstd_ddict.c'), diff --git a/build/single_file_libs/zstd-in.c b/build/single_file_libs/zstd-in.c index 1b27953a6..f73a2e72c 100644 --- a/build/single_file_libs/zstd-in.c +++ b/build/single_file_libs/zstd-in.c @@ -43,6 +43,8 @@ #define ZSTD_MULTITHREAD #endif #define ZSTD_TRACE 0 +/* TODO: Can't amalgamate ASM function */ +#define HUF_DISABLE_ASM 1 /* Include zstd_deps.h first with all the options we need enabled. */ #define ZSTD_DEPS_NEED_MALLOC diff --git a/build/single_file_libs/zstddeclib-in.c b/build/single_file_libs/zstddeclib-in.c index 019d9c260..a5fd958e4 100644 --- a/build/single_file_libs/zstddeclib-in.c +++ b/build/single_file_libs/zstddeclib-in.c @@ -39,6 +39,8 @@ #define ZSTD_LEGACY_SUPPORT 0 #define ZSTD_STRIP_ERROR_STRINGS #define ZSTD_TRACE 0 +/* TODO: Can't amalgamate ASM function */ +#define HUF_DISABLE_ASM 1 /* Include zstd_deps.h first with all the options we need enabled. */ #define ZSTD_DEPS_NEED_MALLOC diff --git a/contrib/linux-kernel/Makefile b/contrib/linux-kernel/Makefile index c391df7c0..f85179fc4 100644 --- a/contrib/linux-kernel/Makefile +++ b/contrib/linux-kernel/Makefile @@ -35,6 +35,7 @@ libzstd: -DXXH_STATIC_LINKING_ONLY \ -DMEM_FORCE_MEMORY_ACCESS=0 \ -D__GNUC__ \ + -D__linux__=1 \ -DSTATIC_BMI2=0 \ -DZSTD_ADDRESS_SANITIZER=0 \ -DZSTD_MEMORY_SANITIZER=0 \ diff --git a/contrib/linux-kernel/decompress_sources.h b/contrib/linux-kernel/decompress_sources.h index f35bef03e..aef953c6b 100644 --- a/contrib/linux-kernel/decompress_sources.h +++ b/contrib/linux-kernel/decompress_sources.h @@ -21,6 +21,11 @@ #include "common/error_private.c" #include "common/fse_decompress.c" #include "common/zstd_common.c" +/* + * Disable the ASM Huffman implementation because we need to + * include all the sources. + */ +#define HUF_DISABLE_ASM 1 #include "decompress/huf_decompress.c" #include "decompress/zstd_ddict.c" #include "decompress/zstd_decompress.c" diff --git a/contrib/linux-kernel/test/macro-test.sh b/contrib/linux-kernel/test/macro-test.sh index c688ac03b..bde6cbb56 100755 --- a/contrib/linux-kernel/test/macro-test.sh +++ b/contrib/linux-kernel/test/macro-test.sh @@ -42,3 +42,4 @@ test_not_present "ZSTD_DLL_IMPORT" test_not_present "__ICCARM__" test_not_present "_MSC_VER" test_not_present "_WIN32" +test_not_present "__linux__" diff --git a/lib/common/compiler.h b/lib/common/compiler.h index 012ff0221..9d7d968ce 100644 --- a/lib/common/compiler.h +++ b/lib/common/compiler.h @@ -108,7 +108,7 @@ #if ((defined(__clang__) && __has_attribute(__target__)) \ || (defined(__GNUC__) \ && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))) \ - && (defined(__x86_64__) || defined(_M_X86)) \ + && (defined(__x86_64__) || defined(_M_X64)) \ && !defined(__BMI2__) # define DYNAMIC_BMI2 1 #else @@ -212,7 +212,7 @@ # elif defined(ZSTD_ARCH_ARM_NEON) # include # endif -#endif +#endif /* compat. with non-clang compilers */ #ifndef __has_builtin diff --git a/lib/common/error_private.h b/lib/common/error_private.h index 6d8b9f776..007d81066 100644 --- a/lib/common/error_private.h +++ b/lib/common/error_private.h @@ -22,6 +22,8 @@ extern "C" { * Dependencies ******************************************/ #include "../zstd_errors.h" /* enum list */ +#include "compiler.h" +#include "debug.h" #include "zstd_deps.h" /* size_t */ @@ -73,6 +75,83 @@ ERR_STATIC const char* ERR_getErrorName(size_t code) return ERR_getErrorString(ERR_getErrorCode(code)); } +/** + * Ignore: this is an internal helper. + * + * This is a helper function to help force C99-correctness during compilation. + * Under strict compilation modes, variadic macro arguments can't be empty. + * However, variadic function arguments can be. Using a function therefore lets + * us statically check that at least one (string) argument was passed, + * independent of the compilation flags. + */ +static INLINE_KEYWORD UNUSED_ATTR +void _force_has_format_string(const char *format, ...) { + (void)format; +} + +/** + * Ignore: this is an internal helper. + * + * We want to force this function invocation to be syntactically correct, but + * we don't want to force runtime evaluation of its arguments. + */ +#define _FORCE_HAS_FORMAT_STRING(...) \ + if (0) { \ + _force_has_format_string(__VA_ARGS__); \ + } + +#define ERR_QUOTE(str) #str + +/** + * Return the specified error if the condition evaluates to true. + * + * In debug modes, prints additional information. + * In order to do that (particularly, printing the conditional that failed), + * this can't just wrap RETURN_ERROR(). + */ +#define RETURN_ERROR_IF(cond, err, ...) \ + if (cond) { \ + RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s", \ + __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \ + _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ + RAWLOG(3, ": " __VA_ARGS__); \ + RAWLOG(3, "\n"); \ + return ERROR(err); \ + } + +/** + * Unconditionally return the specified error. + * + * In debug modes, prints additional information. + */ +#define RETURN_ERROR(err, ...) \ + do { \ + RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \ + __FILE__, __LINE__, ERR_QUOTE(ERROR(err))); \ + _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ + RAWLOG(3, ": " __VA_ARGS__); \ + RAWLOG(3, "\n"); \ + return ERROR(err); \ + } while(0); + +/** + * If the provided expression evaluates to an error code, returns that error code. + * + * In debug modes, prints additional information. + */ +#define FORWARD_IF_ERROR(err, ...) \ + do { \ + size_t const err_code = (err); \ + if (ERR_isError(err_code)) { \ + RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s", \ + __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \ + _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ + RAWLOG(3, ": " __VA_ARGS__); \ + RAWLOG(3, "\n"); \ + return err_code; \ + } \ + } while(0); + #if defined (__cplusplus) } #endif diff --git a/lib/common/huf.h b/lib/common/huf.h index a3ae06e4d..85518481e 100644 --- a/lib/common/huf.h +++ b/lib/common/huf.h @@ -116,11 +116,11 @@ HUF_PUBLIC_API size_t HUF_compress4X_wksp (void* dst, size_t dstCapacity, /* *** Constants *** */ -#define HUF_TABLELOG_MAX 12 /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG */ +#define HUF_TABLELOG_MAX 12 /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */ #define HUF_TABLELOG_DEFAULT 11 /* default tableLog value when none specified */ #define HUF_SYMBOLVALUE_MAX 255 -#define HUF_TABLELOG_ABSOLUTEMAX 15 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */ +#define HUF_TABLELOG_ABSOLUTEMAX 12 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */ #if (HUF_TABLELOG_MAX > HUF_TABLELOG_ABSOLUTEMAX) # error "HUF_TABLELOG_MAX is too large !" #endif @@ -353,6 +353,9 @@ size_t HUF_decompress4X_hufOnly_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t ds #ifndef HUF_FORCE_DECOMPRESS_X2 size_t HUF_readDTableX1_wksp_bmi2(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, int bmi2); #endif +#ifndef HUF_FORCE_DECOMPRESS_X1 +size_t HUF_readDTableX2_wksp_bmi2(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, int bmi2); +#endif #endif /* HUF_STATIC_LINKING_ONLY */ diff --git a/lib/common/zstd_internal.h b/lib/common/zstd_internal.h index 3134a5abc..aaf7d4665 100644 --- a/lib/common/zstd_internal.h +++ b/lib/common/zstd_internal.h @@ -58,81 +58,6 @@ extern "C" { #define MIN(a,b) ((a)<(b) ? (a) : (b)) #define MAX(a,b) ((a)>(b) ? (a) : (b)) -/** - * Ignore: this is an internal helper. - * - * This is a helper function to help force C99-correctness during compilation. - * Under strict compilation modes, variadic macro arguments can't be empty. - * However, variadic function arguments can be. Using a function therefore lets - * us statically check that at least one (string) argument was passed, - * independent of the compilation flags. - */ -static INLINE_KEYWORD UNUSED_ATTR -void _force_has_format_string(const char *format, ...) { - (void)format; -} - -/** - * Ignore: this is an internal helper. - * - * We want to force this function invocation to be syntactically correct, but - * we don't want to force runtime evaluation of its arguments. - */ -#define _FORCE_HAS_FORMAT_STRING(...) \ - if (0) { \ - _force_has_format_string(__VA_ARGS__); \ - } - -/** - * Return the specified error if the condition evaluates to true. - * - * In debug modes, prints additional information. - * In order to do that (particularly, printing the conditional that failed), - * this can't just wrap RETURN_ERROR(). - */ -#define RETURN_ERROR_IF(cond, err, ...) \ - if (cond) { \ - RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s", \ - __FILE__, __LINE__, ZSTD_QUOTE(cond), ZSTD_QUOTE(ERROR(err))); \ - _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ - RAWLOG(3, ": " __VA_ARGS__); \ - RAWLOG(3, "\n"); \ - return ERROR(err); \ - } - -/** - * Unconditionally return the specified error. - * - * In debug modes, prints additional information. - */ -#define RETURN_ERROR(err, ...) \ - do { \ - RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \ - __FILE__, __LINE__, ZSTD_QUOTE(ERROR(err))); \ - _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ - RAWLOG(3, ": " __VA_ARGS__); \ - RAWLOG(3, "\n"); \ - return ERROR(err); \ - } while(0); - -/** - * If the provided expression evaluates to an error code, returns that error code. - * - * In debug modes, prints additional information. - */ -#define FORWARD_IF_ERROR(err, ...) \ - do { \ - size_t const err_code = (err); \ - if (ERR_isError(err_code)) { \ - RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s", \ - __FILE__, __LINE__, ZSTD_QUOTE(err), ERR_getErrorName(err_code)); \ - _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \ - RAWLOG(3, ": " __VA_ARGS__); \ - RAWLOG(3, "\n"); \ - return err_code; \ - } \ - } while(0); - /*-************************************* * Common constants @@ -453,6 +378,51 @@ MEM_STATIC U32 ZSTD_highbit32(U32 val) /* compress, dictBuilder, decodeCorpus } } +/** + * Computes CTZ on a U64. + * This will be slow on 32-bit mode, and on unsupported compilers. + * If you need this function to be fast (because it is hot) expand + * support. + */ +MEM_STATIC unsigned ZSTD_countTrailingZeros(size_t val) +{ + if (MEM_64bits()) { +# if defined(_MSC_VER) && defined(_WIN64) +# if STATIC_BMI2 + return _tzcnt_u64(val); +# else + unsigned long r = 0; + return _BitScanForward64( &r, (U64)val ) ? (unsigned)(r >> 3) : 0; +# endif +# elif defined(__GNUC__) && (__GNUC__ >= 4) + return __builtin_ctzll((U64)val); +# else + static const int DeBruijnBytePos[64] = { 0, 1, 2, 7, 3, 13, 8, 19, + 4, 25, 14, 28, 9, 34, 20, 56, + 5, 17, 26, 54, 15, 41, 29, 43, + 10, 31, 38, 35, 21, 45, 49, 57, + 63, 6, 12, 18, 24, 27, 33, 55, + 16, 53, 40, 42, 30, 37, 44, 48, + 62, 11, 23, 32, 52, 39, 36, 47, + 61, 22, 51, 46, 60, 50, 59, 58 }; + return DeBruijnBytePos[((U64)((val & -(long long)val) * 0x0218A392CDABBD3FULL)) >> 58]; +# endif + } else { /* 32 bits */ +# if defined(_MSC_VER) + unsigned long r=0; + return _BitScanForward( &r, (U32)val ) ? (unsigned)(r >> 3) : 0; +# elif defined(__GNUC__) && (__GNUC__ >= 3) + return (__builtin_ctz((U32)val) >> 3); +# else + static const int DeBruijnBytePos[32] = { 0, 1, 28, 2, 29, 14, 24, 3, + 30, 22, 20, 15, 25, 17, 4, 8, + 31, 27, 13, 23, 21, 19, 16, 7, + 26, 12, 18, 6, 11, 5, 10, 9 }; + return DeBruijnBytePos[((U32)((val & -(S32)val) * 0x077CB531U)) >> 27]; +# endif + } +} + /* ZSTD_invalidateRepCodes() : * ensures next compression will not use repcodes from previous block. diff --git a/lib/compress/huf_compress.c b/lib/compress/huf_compress.c index 915778eb1..ba296da8d 100644 --- a/lib/compress/huf_compress.c +++ b/lib/compress/huf_compress.c @@ -809,6 +809,7 @@ FORCE_INLINE_TEMPLATE void HUF_addBits(HUF_CStream_t* bitC, HUF_CElt elt, int id { size_t const nbBits = HUF_getNbBits(elt); size_t const dirtyBits = nbBits == 0 ? 0 : BIT_highbit32((U32)nbBits) + 1; + (void)dirtyBits; /* Middle bits are 0. */ assert(((elt >> dirtyBits) << (dirtyBits + nbBits)) == 0); /* We didn't overwrite any bits in the bit container. */ diff --git a/lib/decompress/huf_decompress.c b/lib/decompress/huf_decompress.c index f41a02bb5..1dfa4b801 100644 --- a/lib/decompress/huf_decompress.c +++ b/lib/decompress/huf_decompress.c @@ -22,6 +22,13 @@ #define HUF_STATIC_LINKING_ONLY #include "../common/huf.h" #include "../common/error_private.h" +#include "../common/zstd_internal.h" + +/* ************************************************************** +* Constants +****************************************************************/ + +#define HUF_DECODER_FAST_TABLELOG 11 /* ************************************************************** * Macros @@ -36,6 +43,40 @@ #error "Cannot force the use of the X1 and X2 decoders at the same time!" #endif +/* Only use assembly on Linux / MacOS. + * Disable when MSAN is enabled. + */ +#if defined(__linux__) || defined(__linux) || defined(__APPLE__) +# if ZSTD_MEMORY_SANITIZER +# define HUF_ASM_SUPPORTED 0 +# else +# define HUF_ASM_SUPPORTED 1 +#endif +#else +# define HUF_ASM_SUPPORTED 0 +#endif + +/* HUF_DISABLE_ASM: Disables all ASM implementations. */ +#if !defined(HUF_DISABLE_ASM) && \ + HUF_ASM_SUPPORTED && \ + defined(__x86_64__) && (DYNAMIC_BMI2 || defined(__BMI2__)) +# define HUF_ENABLE_ASM_X86_64_BMI2 1 +#else +# define HUF_ENABLE_ASM_X86_64_BMI2 0 +#endif + +#if HUF_ENABLE_ASM_X86_64_BMI2 && DYNAMIC_BMI2 +# define HUF_ASM_X86_64_BMI2_ATTRS TARGET_ATTRIBUTE("bmi2") +#else +# define HUF_ASM_X86_64_BMI2_ATTRS +#endif + +#ifdef __cplusplus +# define HUF_EXTERN_C extern "C" +#else +# define HUF_EXTERN_C +#endif +#define HUF_ASM_DECL HUF_EXTERN_C /* ************************************************************** * Error Management @@ -107,13 +148,146 @@ static DTableDesc HUF_getDTableDesc(const HUF_DTable* table) return dtd; } +#if HUF_ENABLE_ASM_X86_64_BMI2 + +static size_t HUF_initDStream(BYTE const* ip) { + BYTE const lastByte = ip[7]; + size_t const bitsConsumed = lastByte ? 8 - BIT_highbit32(lastByte) : 0; + size_t const value = MEM_readLEST(ip) | 1; + assert(bitsConsumed <= 8); + return value << bitsConsumed; +} +typedef struct { + BYTE const* ip[4]; + BYTE* op[4]; + U64 bits[4]; + void const* dt; + BYTE const* ilimit; + BYTE* oend; + BYTE const* iend[4]; +} HUF_DecompressAsmArgs; + +/** + * Initializes args for the asm decoding loop. + * @returns 0 on success + * 1 if the fallback implementation should be used. + * Or an error code on failure. + */ +static size_t HUF_DecompressAsmArgs_init(HUF_DecompressAsmArgs* args, void* dst, size_t dstSize, void const* src, size_t srcSize, const HUF_DTable* DTable) +{ + void const* dt = DTable + 1; + U32 const dtLog = HUF_getDTableDesc(DTable).tableLog; + + const BYTE* const ilimit = (const BYTE*)src + 6 + 8; + + BYTE* const oend = (BYTE*)dst + dstSize; + + /* We're assuming x86-64 BMI2 - assure that this is the case. */ + assert(MEM_isLittleEndian() && !MEM_32bits()); + + /* strict minimum : jump table + 1 byte per stream */ + if (srcSize < 10) + return ERROR(corruption_detected); + + /* Must have at least 8 bytes per stream because we don't handle initializing smaller bit containers. + * If table log is not correct at this point, fallback to the old decoder. + * On small inputs we don't have enough data to trigger the fast loop, so use the old decoder. + */ + if (dtLog != HUF_DECODER_FAST_TABLELOG) + return 1; + + /* Read the jump table. */ + { + const BYTE* const istart = (const BYTE*)src; + size_t const length1 = MEM_readLE16(istart); + size_t const length2 = MEM_readLE16(istart+2); + size_t const length3 = MEM_readLE16(istart+4); + size_t const length4 = srcSize - (length1 + length2 + length3 + 6); + args->iend[0] = istart + 6; /* jumpTable */ + args->iend[1] = args->iend[0] + length1; + args->iend[2] = args->iend[1] + length2; + args->iend[3] = args->iend[2] + length3; + + /* HUF_initDStream() requires this, and this small of an input + * won't benefit from the ASM loop anyways. + * length1 must be >= 16 so that ip[0] >= ilimit before the loop + * starts. + */ + if (length1 < 16 || length2 < 8 || length3 < 8 || length4 < 8) + return 1; + if (length4 > srcSize) return ERROR(corruption_detected); /* overflow */ + } + /* ip[] contains the position that is currently loaded into bits[]. */ + args->ip[0] = args->iend[1] - sizeof(U64); + args->ip[1] = args->iend[2] - sizeof(U64); + args->ip[2] = args->iend[3] - sizeof(U64); + args->ip[3] = (BYTE const*)src + srcSize - sizeof(U64); + + /* op[] contains the output pointers. */ + args->op[0] = (BYTE*)dst; + args->op[1] = args->op[0] + (dstSize+3)/4; + args->op[2] = args->op[1] + (dstSize+3)/4; + args->op[3] = args->op[2] + (dstSize+3)/4; + + /* No point to call the ASM loop for tiny outputs. */ + if (args->op[3] >= oend) + return 1; + + /* bits[] is the bit container. + * It is read from the MSB down to the LSB. + * It is shifted left as it is read, and zeros are + * shifted in. After the lowest valid bit a 1 is + * set, so that CountTrailingZeros(bits[]) can be used + * to count how many bits we've consumed. + */ + args->bits[0] = HUF_initDStream(args->ip[0]); + args->bits[1] = HUF_initDStream(args->ip[1]); + args->bits[2] = HUF_initDStream(args->ip[2]); + args->bits[3] = HUF_initDStream(args->ip[3]); + + /* If ip[] >= ilimit, it is guaranteed to be safe to + * reload bits[]. It may be beyond its section, but is + * guaranteed to be valid (>= istart). + */ + args->ilimit = ilimit; + + args->oend = oend; + args->dt = dt; + + return 0; +} + +static size_t HUF_initRemainingDStream(BIT_DStream_t* bit, HUF_DecompressAsmArgs const* args, int stream, BYTE* segmentEnd) +{ + /* Validate that we haven't overwritten. */ + if (args->op[stream] > segmentEnd) + return ERROR(corruption_detected); + /* Validate that we haven't read beyond iend[]. + * Note that ip[] may be < iend[] because the MSB is + * the next bit to read, and we may have consumed 100% + * of the stream, so down to iend[i] - 8 is valid. + */ + if (args->ip[stream] < args->iend[stream] - 8) + return ERROR(corruption_detected); + + /* Construct the BIT_DStream_t. */ + bit->bitContainer = MEM_readLE64(args->ip[stream]); + bit->bitsConsumed = ZSTD_countTrailingZeros((size_t)args->bits[stream]); + bit->start = (const char*)args->iend[0]; + bit->limitPtr = bit->start + sizeof(size_t); + bit->ptr = (const char*)args->ip[stream]; + + return 0; +} +#endif + #ifndef HUF_FORCE_DECOMPRESS_X2 /*-***************************/ /* single-symbol decoding */ /*-***************************/ -typedef struct { BYTE byte; BYTE nbBits; } HUF_DEltX1; /* single-symbol decoding */ +typedef struct { BYTE nbBits; BYTE byte; } HUF_DEltX1; /* single-symbol decoding */ /** * Packs 4 HUF_DEltX1 structs into a U64. This is used to lay down 4 entries at @@ -122,14 +296,44 @@ typedef struct { BYTE byte; BYTE nbBits; } HUF_DEltX1; /* single-symbol decodi static U64 HUF_DEltX1_set4(BYTE symbol, BYTE nbBits) { U64 D4; if (MEM_isLittleEndian()) { - D4 = symbol + (nbBits << 8); - } else { D4 = (symbol << 8) + nbBits; + } else { + D4 = symbol + (nbBits << 8); } D4 *= 0x0001000100010001ULL; return D4; } +/** + * Increase the tableLog to targetTableLog and rescales the stats. + * If tableLog > targetTableLog this is a no-op. + * @returns New tableLog + */ +static U32 HUF_rescaleStats(BYTE* huffWeight, U32* rankVal, U32 nbSymbols, U32 tableLog, U32 targetTableLog) +{ + if (tableLog > targetTableLog) + return tableLog; + if (tableLog < targetTableLog) { + U32 const scale = targetTableLog - tableLog; + U32 s; + /* Increase the weight for all non-zero probability symbols by scale. */ + for (s = 0; s < nbSymbols; ++s) { + huffWeight[s] += (BYTE)((huffWeight[s] == 0) ? 0 : scale); + } + /* Update rankVal to reflect the new weights. + * All weights except 0 get moved to weight + scale. + * Weights [1, scale] are empty. + */ + for (s = targetTableLog; s > scale; --s) { + rankVal[s] = rankVal[s - scale]; + } + for (s = scale; s > 0; --s) { + rankVal[s] = 0; + } + } + return targetTableLog; +} + typedef struct { U32 rankVal[HUF_TABLELOG_ABSOLUTEMAX + 1]; U32 rankStart[HUF_TABLELOG_ABSOLUTEMAX + 1]; @@ -162,8 +366,12 @@ size_t HUF_readDTableX1_wksp_bmi2(HUF_DTable* DTable, const void* src, size_t sr iSize = HUF_readStats_wksp(wksp->huffWeight, HUF_SYMBOLVALUE_MAX + 1, wksp->rankVal, &nbSymbols, &tableLog, src, srcSize, wksp->statsWksp, sizeof(wksp->statsWksp), bmi2); if (HUF_isError(iSize)) return iSize; + /* Table header */ { DTableDesc dtd = HUF_getDTableDesc(DTable); + U32 const maxTableLog = dtd.maxTableLog + 1; + U32 const targetTableLog = MIN(maxTableLog, HUF_DECODER_FAST_TABLELOG); + tableLog = HUF_rescaleStats(wksp->huffWeight, wksp->rankVal, nbSymbols, tableLog, targetTableLog); if (tableLog > (U32)(dtd.maxTableLog+1)) return ERROR(tableLog_tooLarge); /* DTable too small, Huffman tree cannot fit in */ dtd.tableType = 0; dtd.tableLog = (BYTE)tableLog; @@ -445,6 +653,77 @@ HUF_decompress4X1_usingDTable_internal_body( } } +#if DYNAMIC_BMI2 +static TARGET_ATTRIBUTE("bmi2") +size_t HUF_decompress4X1_usingDTable_internal_bmi2(void* dst, size_t dstSize, void const* cSrc, + size_t cSrcSize, HUF_DTable const* DTable) { + return HUF_decompress4X1_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable); +} +#endif + +static +size_t HUF_decompress4X1_usingDTable_internal_default(void* dst, size_t dstSize, void const* cSrc, + size_t cSrcSize, HUF_DTable const* DTable) { + return HUF_decompress4X1_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable); +} + +#if HUF_ENABLE_ASM_X86_64_BMI2 + +HUF_ASM_DECL void HUF_decompress4X1_usingDTable_internal_bmi2_asm_loop(HUF_DecompressAsmArgs* args); + +static HUF_ASM_X86_64_BMI2_ATTRS +size_t +HUF_decompress4X1_usingDTable_internal_bmi2_asm( + void* dst, size_t dstSize, + const void* cSrc, size_t cSrcSize, + const HUF_DTable* DTable) +{ + void const* dt = DTable + 1; + const BYTE* const iend = (const BYTE*)cSrc + 6; + BYTE* const oend = (BYTE*)dst + dstSize; + HUF_DecompressAsmArgs args; + { + size_t const ret = HUF_DecompressAsmArgs_init(&args, dst, dstSize, cSrc, cSrcSize, DTable); + FORWARD_IF_ERROR(ret, "Failed to init asm args"); + if (ret != 0) + return HUF_decompress4X1_usingDTable_internal_bmi2(dst, dstSize, cSrc, cSrcSize, DTable); + } + + assert(args.ip[0] >= args.ilimit); + HUF_decompress4X1_usingDTable_internal_bmi2_asm_loop(&args); + + /* Our loop guarantees that ip[] >= ilimit and that we haven't + * overwritten any op[]. + */ + assert(args.ip[0] >= iend); + assert(args.ip[1] >= iend); + assert(args.ip[2] >= iend); + assert(args.ip[3] >= iend); + assert(args.op[3] <= oend); + (void)iend; + + /* finish bit streams one by one. */ + { + size_t const segmentSize = (dstSize+3) / 4; + BYTE* segmentEnd = (BYTE*)dst; + int i; + for (i = 0; i < 4; ++i) { + BIT_DStream_t bit; + if (segmentSize <= (size_t)(oend - segmentEnd)) + segmentEnd += segmentSize; + else + segmentEnd = oend; + FORWARD_IF_ERROR(HUF_initRemainingDStream(&bit, &args, i, segmentEnd), "corruption"); + /* Decompress and validate that we've produced exactly the expected length. */ + args.op[i] += HUF_decodeStreamX1(args.op[i], &bit, segmentEnd, (HUF_DEltX1 const*)dt, HUF_DECODER_FAST_TABLELOG); + if (args.op[i] != segmentEnd) return ERROR(corruption_detected); + } + } + + /* decoded size */ + return dstSize; +} +#endif /* HUF_ENABLE_ASM_X86_64_BMI2 */ typedef size_t (*HUF_decompress_usingDTable_t)(void *dst, size_t dstSize, const void *cSrc, @@ -452,8 +731,28 @@ typedef size_t (*HUF_decompress_usingDTable_t)(void *dst, size_t dstSize, const HUF_DTable *DTable); HUF_DGEN(HUF_decompress1X1_usingDTable_internal) -HUF_DGEN(HUF_decompress4X1_usingDTable_internal) +static size_t HUF_decompress4X1_usingDTable_internal(void* dst, size_t dstSize, void const* cSrc, + size_t cSrcSize, HUF_DTable const* DTable, int bmi2) +{ +#if DYNAMIC_BMI2 + if (bmi2) { +# if HUF_ENABLE_ASM_X86_64_BMI2 + return HUF_decompress4X1_usingDTable_internal_bmi2_asm(dst, dstSize, cSrc, cSrcSize, DTable); +# else + return HUF_decompress4X1_usingDTable_internal_bmi2(dst, dstSize, cSrc, cSrcSize, DTable); +# endif + } +#else + (void)bmi2; +#endif + +#if HUF_ENABLE_ASM_X86_64_BMI2 && defined(__BMI2__) + return HUF_decompress4X1_usingDTable_internal_bmi2_asm(dst, dstSize, cSrc, cSrcSize, DTable); +#else + return HUF_decompress4X1_usingDTable_internal_default(dst, dstSize, cSrc, cSrcSize, DTable); +#endif +} size_t HUF_decompress1X1_usingDTable( @@ -523,106 +822,226 @@ size_t HUF_decompress4X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, /* *************************/ typedef struct { U16 sequence; BYTE nbBits; BYTE length; } HUF_DEltX2; /* double-symbols decoding */ -typedef struct { BYTE symbol; BYTE weight; } sortedSymbol_t; +typedef struct { BYTE symbol; } sortedSymbol_t; typedef U32 rankValCol_t[HUF_TABLELOG_MAX + 1]; typedef rankValCol_t rankVal_t[HUF_TABLELOG_MAX]; +/** + * Constructs a HUF_DEltX2 in a U32. + */ +static U32 HUF_buildDEltX2U32(U32 symbol, U32 nbBits, U32 baseSeq, int level) +{ + U32 seq; + DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, sequence) == 0); + DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, nbBits) == 2); + DEBUG_STATIC_ASSERT(offsetof(HUF_DEltX2, length) == 3); + DEBUG_STATIC_ASSERT(sizeof(HUF_DEltX2) == sizeof(U32)); + if (MEM_isLittleEndian()) { + seq = level == 1 ? symbol : (baseSeq + (symbol << 8)); + return seq + (nbBits << 16) + ((U32)level << 24); + } else { + seq = level == 1 ? (symbol << 8) : ((baseSeq << 8) + symbol); + return (seq << 16) + (nbBits << 8) + (U32)level; + } +} + +/** + * Constructs a HUF_DEltX2. + */ +static HUF_DEltX2 HUF_buildDEltX2(U32 symbol, U32 nbBits, U32 baseSeq, int level) +{ + HUF_DEltX2 DElt; + U32 const val = HUF_buildDEltX2U32(symbol, nbBits, baseSeq, level); + DEBUG_STATIC_ASSERT(sizeof(DElt) == sizeof(val)); + ZSTD_memcpy(&DElt, &val, sizeof(val)); + return DElt; +} + +/** + * Constructs 2 HUF_DEltX2s and packs them into a U64. + */ +static U64 HUF_buildDEltX2U64(U32 symbol, U32 nbBits, U16 baseSeq, int level) +{ + U32 DElt = HUF_buildDEltX2U32(symbol, nbBits, baseSeq, level); + return (U64)DElt + ((U64)DElt << 32); +} + +/** + * Fills the DTable rank with all the symbols from [begin, end) that are each + * nbBits long. + * + * @param DTableRank The start of the rank in the DTable. + * @param begin The first symbol to fill (inclusive). + * @param end The last symbol to fill (exclusive). + * @param nbBits Each symbol is nbBits long. + * @param tableLog The table log. + * @param baseSeq If level == 1 { 0 } else { the first level symbol } + * @param level The level in the table. Must be 1 or 2. + */ +static void HUF_fillDTableX2ForWeight( + HUF_DEltX2* DTableRank, + sortedSymbol_t const* begin, sortedSymbol_t const* end, + U32 nbBits, U32 tableLog, + U16 baseSeq, int const level) +{ + U32 const length = 1U << ((tableLog - nbBits) & 0x1F /* quiet static-analyzer */); + const sortedSymbol_t* ptr; + assert(level >= 1 && level <= 2); + switch (length) { + case 1: + for (ptr = begin; ptr != end; ++ptr) { + HUF_DEltX2 const DElt = HUF_buildDEltX2(ptr->symbol, nbBits, baseSeq, level); + *DTableRank++ = DElt; + } + break; + case 2: + for (ptr = begin; ptr != end; ++ptr) { + HUF_DEltX2 const DElt = HUF_buildDEltX2(ptr->symbol, nbBits, baseSeq, level); + DTableRank[0] = DElt; + DTableRank[1] = DElt; + DTableRank += 2; + } + break; + case 4: + for (ptr = begin; ptr != end; ++ptr) { + U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level); + ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2)); + DTableRank += 4; + } + break; + case 8: + for (ptr = begin; ptr != end; ++ptr) { + U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level); + ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTableRank + 4, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTableRank + 6, &DEltX2, sizeof(DEltX2)); + DTableRank += 8; + } + break; + default: + for (ptr = begin; ptr != end; ++ptr) { + U64 const DEltX2 = HUF_buildDEltX2U64(ptr->symbol, nbBits, baseSeq, level); + HUF_DEltX2* const DTableRankEnd = DTableRank + length; + for (; DTableRank != DTableRankEnd; DTableRank += 8) { + ZSTD_memcpy(DTableRank + 0, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTableRank + 2, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTableRank + 4, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTableRank + 6, &DEltX2, sizeof(DEltX2)); + } + } + break; + } +} /* HUF_fillDTableX2Level2() : * `rankValOrigin` must be a table of at least (HUF_TABLELOG_MAX + 1) U32 */ -static void HUF_fillDTableX2Level2(HUF_DEltX2* DTable, U32 sizeLog, const U32 consumed, - const U32* rankValOrigin, const int minWeight, - const sortedSymbol_t* sortedSymbols, const U32 sortedListSize, - U32 nbBitsBaseline, U16 baseSeq, U32* wksp, size_t wkspSize) +static void HUF_fillDTableX2Level2(HUF_DEltX2* DTable, U32 targetLog, const U32 consumedBits, + const U32* rankVal, const int minWeight, const int maxWeight1, + const sortedSymbol_t* sortedSymbols, U32 const* rankStart, + U32 nbBitsBaseline, U16 baseSeq) { - HUF_DEltX2 DElt; - U32* rankVal = wksp; - - assert(wkspSize >= HUF_TABLELOG_MAX + 1); - (void)wkspSize; - /* get pre-calculated rankVal */ - ZSTD_memcpy(rankVal, rankValOrigin, sizeof(U32) * (HUF_TABLELOG_MAX + 1)); - - /* fill skipped values */ + /* Fill skipped values (all positions up to rankVal[minWeight]). + * These are positions only get a single symbol because the combined weight + * is too large. + */ if (minWeight>1) { - U32 i, skipSize = rankVal[minWeight]; - MEM_writeLE16(&(DElt.sequence), baseSeq); - DElt.nbBits = (BYTE)(consumed); - DElt.length = 1; - for (i = 0; i < skipSize; i++) - DTable[i] = DElt; + U32 const length = 1U << ((targetLog - consumedBits) & 0x1F /* quiet static-analyzer */); + U64 const DEltX2 = HUF_buildDEltX2U64(baseSeq, consumedBits, /* baseSeq */ 0, /* level */ 1); + int const skipSize = rankVal[minWeight]; + assert(length > 1); + assert((U32)skipSize < length); + switch (length) { + case 2: + assert(skipSize == 1); + ZSTD_memcpy(DTable, &DEltX2, sizeof(DEltX2)); + break; + case 4: + assert(skipSize <= 4); + ZSTD_memcpy(DTable + 0, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTable + 2, &DEltX2, sizeof(DEltX2)); + break; + default: + { + int i; + for (i = 0; i < skipSize; i += 8) { + ZSTD_memcpy(DTable + i + 0, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTable + i + 2, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTable + i + 4, &DEltX2, sizeof(DEltX2)); + ZSTD_memcpy(DTable + i + 6, &DEltX2, sizeof(DEltX2)); + } + } + } } - /* fill DTable */ - { U32 s; for (s=0; s= 1 */ - - rankVal[weight] += length; - } } + /* Fill each of the second level symbols by weight. */ + { + int w; + for (w = minWeight; w < maxWeight1; ++w) { + int const begin = rankStart[w]; + int const end = rankStart[w+1]; + U32 const nbBits = nbBitsBaseline - w; + U32 const totalBits = nbBits + consumedBits; + HUF_fillDTableX2ForWeight( + DTable + rankVal[w], + sortedSymbols + begin, sortedSymbols + end, + totalBits, targetLog, + baseSeq, /* level */ 2); + } + } } - static void HUF_fillDTableX2(HUF_DEltX2* DTable, const U32 targetLog, - const sortedSymbol_t* sortedList, const U32 sortedListSize, + const sortedSymbol_t* sortedList, const U32* rankStart, rankVal_t rankValOrigin, const U32 maxWeight, - const U32 nbBitsBaseline, U32* wksp, size_t wkspSize) + const U32 nbBitsBaseline) { - U32* rankVal = wksp; + U32* const rankVal = rankValOrigin[0]; const int scaleLog = nbBitsBaseline - targetLog; /* note : targetLog >= srcLog, hence scaleLog <= 1 */ const U32 minBits = nbBitsBaseline - maxWeight; - U32 s; + int w; + int const wEnd = (int)maxWeight + 1; - assert(wkspSize >= HUF_TABLELOG_MAX + 1); - wksp += HUF_TABLELOG_MAX + 1; - wkspSize -= HUF_TABLELOG_MAX + 1; + /* Fill DTable in order of weight. */ + for (w = 1; w < wEnd; ++w) { + int const begin = (int)rankStart[w]; + int const end = (int)rankStart[w+1]; + U32 const nbBits = nbBitsBaseline - w; - ZSTD_memcpy(rankVal, rankValOrigin, sizeof(U32) * (HUF_TABLELOG_MAX + 1)); - - /* fill DTable */ - for (s=0; s= minBits) { /* enough room for a second symbol */ - U32 sortedRank; + if (targetLog-nbBits >= minBits) { + /* Enough room for a second symbol. */ + int start = rankVal[w]; + U32 const length = 1U << ((targetLog - nbBits) & 0x1F /* quiet static-analyzer */); int minWeight = nbBits + scaleLog; + int s; if (minWeight < 1) minWeight = 1; - sortedRank = rankStart[minWeight]; - HUF_fillDTableX2Level2(DTable+start, targetLog-nbBits, nbBits, - rankValOrigin[nbBits], minWeight, - sortedList+sortedRank, sortedListSize-sortedRank, - nbBitsBaseline, symbol, wksp, wkspSize); + /* Fill the DTable for every symbol of weight w. + * These symbols get at least 1 second symbol. + */ + for (s = begin; s != end; ++s) { + HUF_fillDTableX2Level2( + DTable + start, targetLog, nbBits, + rankValOrigin[nbBits], minWeight, wEnd, + sortedList, rankStart, + nbBitsBaseline, sortedList[s].symbol); + start += length; + } } else { - HUF_DEltX2 DElt; - MEM_writeLE16(&(DElt.sequence), symbol); - DElt.nbBits = (BYTE)(nbBits); - DElt.length = 1; - { U32 const end = start + length; - U32 u; - for (u = start; u < end; u++) DTable[u] = DElt; - } } - rankVal[weight] += length; + /* Only a single symbol. */ + HUF_fillDTableX2ForWeight( + DTable + rankVal[w], + sortedList + begin, sortedList + end, + nbBits, targetLog, + /* baseSeq */ 0, /* level */ 1); + } } } typedef struct { rankValCol_t rankVal[HUF_TABLELOG_MAX]; U32 rankStats[HUF_TABLELOG_MAX + 1]; - U32 rankStart0[HUF_TABLELOG_MAX + 2]; + U32 rankStart0[HUF_TABLELOG_MAX + 3]; sortedSymbol_t sortedSymbol[HUF_SYMBOLVALUE_MAX + 1]; BYTE weightList[HUF_SYMBOLVALUE_MAX + 1]; U32 calleeWksp[HUF_READ_STATS_WORKSPACE_SIZE_U32]; @@ -632,9 +1051,16 @@ size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize) { - U32 tableLog, maxW, sizeOfSort, nbSymbols; + return HUF_readDTableX2_wksp_bmi2(DTable, src, srcSize, workSpace, wkspSize, /* bmi2 */ 0); +} + +size_t HUF_readDTableX2_wksp_bmi2(HUF_DTable* DTable, + const void* src, size_t srcSize, + void* workSpace, size_t wkspSize, int bmi2) +{ + U32 tableLog, maxW, nbSymbols; DTableDesc dtd = HUF_getDTableDesc(DTable); - U32 const maxTableLog = dtd.maxTableLog; + U32 maxTableLog = dtd.maxTableLog; size_t iSize; void* dtPtr = DTable+1; /* force compiler to avoid strict-aliasing */ HUF_DEltX2* const dt = (HUF_DEltX2*)dtPtr; @@ -652,11 +1078,12 @@ size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, if (maxTableLog > HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge); /* ZSTD_memset(weightList, 0, sizeof(weightList)); */ /* is not necessary, even though some analyzer complain ... */ - iSize = HUF_readStats_wksp(wksp->weightList, HUF_SYMBOLVALUE_MAX + 1, wksp->rankStats, &nbSymbols, &tableLog, src, srcSize, wksp->calleeWksp, sizeof(wksp->calleeWksp), /* bmi2 */ 0); + iSize = HUF_readStats_wksp(wksp->weightList, HUF_SYMBOLVALUE_MAX + 1, wksp->rankStats, &nbSymbols, &tableLog, src, srcSize, wksp->calleeWksp, sizeof(wksp->calleeWksp), bmi2); if (HUF_isError(iSize)) return iSize; /* check result */ if (tableLog > maxTableLog) return ERROR(tableLog_tooLarge); /* DTable can't fit code depth */ + if (tableLog <= HUF_DECODER_FAST_TABLELOG && maxTableLog > HUF_DECODER_FAST_TABLELOG) maxTableLog = HUF_DECODER_FAST_TABLELOG; /* find maxWeight */ for (maxW = tableLog; wksp->rankStats[maxW]==0; maxW--) {} /* necessarily finds a solution before 0 */ @@ -669,7 +1096,7 @@ size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, rankStart[w] = curr; } rankStart[0] = nextRankStart; /* put all 0w symbols at the end of sorted list*/ - sizeOfSort = nextRankStart; + rankStart[maxW+1] = nextRankStart; } /* sort symbols by weight */ @@ -678,7 +1105,6 @@ size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, U32 const w = wksp->weightList[s]; U32 const r = rankStart[w]++; wksp->sortedSymbol[r].symbol = (BYTE)s; - wksp->sortedSymbol[r].weight = (BYTE)w; } rankStart[0] = 0; /* forget 0w symbols; this is beginning of weight(1) */ } @@ -703,10 +1129,9 @@ size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, } } } } HUF_fillDTableX2(dt, maxTableLog, - wksp->sortedSymbol, sizeOfSort, + wksp->sortedSymbol, wksp->rankStart0, wksp->rankVal, maxW, - tableLog+1, - wksp->calleeWksp, sizeof(wksp->calleeWksp) / sizeof(U32)); + tableLog+1); dtd.tableLog = (BYTE)maxTableLog; dtd.tableType = 1; @@ -719,7 +1144,7 @@ FORCE_INLINE_TEMPLATE U32 HUF_decodeSymbolX2(void* op, BIT_DStream_t* DStream, const HUF_DEltX2* dt, const U32 dtLog) { size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */ - ZSTD_memcpy(op, dt+val, 2); + ZSTD_memcpy(op, &dt[val].sequence, 2); BIT_skipBits(DStream, dt[val].nbBits); return dt[val].length; } @@ -728,15 +1153,17 @@ FORCE_INLINE_TEMPLATE U32 HUF_decodeLastSymbolX2(void* op, BIT_DStream_t* DStream, const HUF_DEltX2* dt, const U32 dtLog) { size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */ - ZSTD_memcpy(op, dt+val, 1); - if (dt[val].length==1) BIT_skipBits(DStream, dt[val].nbBits); - else { + ZSTD_memcpy(op, &dt[val].sequence, 1); + if (dt[val].length==1) { + BIT_skipBits(DStream, dt[val].nbBits); + } else { if (DStream->bitsConsumed < (sizeof(DStream->bitContainer)*8)) { BIT_skipBits(DStream, dt[val].nbBits); if (DStream->bitsConsumed > (sizeof(DStream->bitContainer)*8)) /* ugly hack; works only because it's the last symbol. Note : can't easily extract nbBits from just this symbol */ DStream->bitsConsumed = (sizeof(DStream->bitContainer)*8); - } } + } + } return 1; } @@ -759,11 +1186,23 @@ HUF_decodeStreamX2(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* const pEnd, /* up to 8 symbols at a time */ if ((size_t)(pEnd - p) >= sizeof(bitDPtr->bitContainer)) { - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-(sizeof(bitDPtr->bitContainer)-1))) { - HUF_DECODE_SYMBOLX2_2(p, bitDPtr); - HUF_DECODE_SYMBOLX2_1(p, bitDPtr); - HUF_DECODE_SYMBOLX2_2(p, bitDPtr); - HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + if (dtLog <= 11 && MEM_64bits()) { + /* up to 10 symbols at a time */ + while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-9)) { + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + } + } else { + /* up to 8 symbols at a time */ + while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-(sizeof(bitDPtr->bitContainer)-1))) { + HUF_DECODE_SYMBOLX2_2(p, bitDPtr); + HUF_DECODE_SYMBOLX2_1(p, bitDPtr); + HUF_DECODE_SYMBOLX2_2(p, bitDPtr); + HUF_DECODE_SYMBOLX2_0(p, bitDPtr); + } } } @@ -808,7 +1247,6 @@ HUF_decompress1X2_usingDTable_internal_body( /* decoded size */ return dstSize; } - FORCE_INLINE_TEMPLATE size_t HUF_decompress4X2_usingDTable_internal_body( void* dst, size_t dstSize, @@ -927,8 +1365,97 @@ HUF_decompress4X2_usingDTable_internal_body( } } +#if DYNAMIC_BMI2 +static TARGET_ATTRIBUTE("bmi2") +size_t HUF_decompress4X2_usingDTable_internal_bmi2(void* dst, size_t dstSize, void const* cSrc, + size_t cSrcSize, HUF_DTable const* DTable) { + return HUF_decompress4X2_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable); +} +#endif + +static +size_t HUF_decompress4X2_usingDTable_internal_default(void* dst, size_t dstSize, void const* cSrc, + size_t cSrcSize, HUF_DTable const* DTable) { + return HUF_decompress4X2_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable); +} + +#if HUF_ENABLE_ASM_X86_64_BMI2 + +HUF_ASM_DECL void HUF_decompress4X2_usingDTable_internal_bmi2_asm_loop(HUF_DecompressAsmArgs* args); + +static HUF_ASM_X86_64_BMI2_ATTRS size_t +HUF_decompress4X2_usingDTable_internal_bmi2_asm( + void* dst, size_t dstSize, + const void* cSrc, size_t cSrcSize, + const HUF_DTable* DTable) { + void const* dt = DTable + 1; + const BYTE* const iend = (const BYTE*)cSrc + 6; + BYTE* const oend = (BYTE*)dst + dstSize; + HUF_DecompressAsmArgs args; + { + size_t const ret = HUF_DecompressAsmArgs_init(&args, dst, dstSize, cSrc, cSrcSize, DTable); + FORWARD_IF_ERROR(ret, "Failed to init asm args"); + if (ret != 0) + return HUF_decompress4X2_usingDTable_internal_bmi2(dst, dstSize, cSrc, cSrcSize, DTable); + } + + assert(args.ip[0] >= args.ilimit); + HUF_decompress4X2_usingDTable_internal_bmi2_asm_loop(&args); + + /* note : op4 already verified within main loop */ + assert(args.ip[0] >= iend); + assert(args.ip[1] >= iend); + assert(args.ip[2] >= iend); + assert(args.ip[3] >= iend); + assert(args.op[3] <= oend); + (void)iend; + + /* finish bitStreams one by one */ + { + size_t const segmentSize = (dstSize+3) / 4; + BYTE* segmentEnd = (BYTE*)dst; + int i; + for (i = 0; i < 4; ++i) { + BIT_DStream_t bit; + if (segmentSize <= (size_t)(oend - segmentEnd)) + segmentEnd += segmentSize; + else + segmentEnd = oend; + FORWARD_IF_ERROR(HUF_initRemainingDStream(&bit, &args, i, segmentEnd), "corruption"); + args.op[i] += HUF_decodeStreamX2(args.op[i], &bit, segmentEnd, (HUF_DEltX2 const*)dt, HUF_DECODER_FAST_TABLELOG); + if (args.op[i] != segmentEnd) + return ERROR(corruption_detected); + } + } + + /* decoded size */ + return dstSize; +} +#endif /* HUF_ENABLE_ASM_X86_64_BMI2 */ + +static size_t HUF_decompress4X2_usingDTable_internal(void* dst, size_t dstSize, void const* cSrc, + size_t cSrcSize, HUF_DTable const* DTable, int bmi2) +{ +#if DYNAMIC_BMI2 + if (bmi2) { +# if HUF_ENABLE_ASM_X86_64_BMI2 + return HUF_decompress4X2_usingDTable_internal_bmi2_asm(dst, dstSize, cSrc, cSrcSize, DTable); +# else + return HUF_decompress4X2_usingDTable_internal_bmi2(dst, dstSize, cSrc, cSrcSize, DTable); +# endif + } +#else + (void)bmi2; +#endif + +#if HUF_ENABLE_ASM_X86_64_BMI2 && defined(__BMI2__) + return HUF_decompress4X2_usingDTable_internal_bmi2_asm(dst, dstSize, cSrc, cSrcSize, DTable); +#else + return HUF_decompress4X2_usingDTable_internal_default(dst, dstSize, cSrc, cSrcSize, DTable); +#endif +} + HUF_DGEN(HUF_decompress1X2_usingDTable_internal) -HUF_DGEN(HUF_decompress4X2_usingDTable_internal) size_t HUF_decompress1X2_usingDTable( void* dst, size_t dstSize, @@ -1037,25 +1564,25 @@ size_t HUF_decompress4X_usingDTable(void* dst, size_t maxDstSize, #if !defined(HUF_FORCE_DECOMPRESS_X1) && !defined(HUF_FORCE_DECOMPRESS_X2) typedef struct { U32 tableTime; U32 decode256Time; } algo_time_t; -static const algo_time_t algoTime[16 /* Quantization */][3 /* single, double, quad */] = +static const algo_time_t algoTime[16 /* Quantization */][2 /* single, double */] = { /* single, double, quad */ - {{0,0}, {1,1}, {2,2}}, /* Q==0 : impossible */ - {{0,0}, {1,1}, {2,2}}, /* Q==1 : impossible */ - {{ 38,130}, {1313, 74}, {2151, 38}}, /* Q == 2 : 12-18% */ - {{ 448,128}, {1353, 74}, {2238, 41}}, /* Q == 3 : 18-25% */ - {{ 556,128}, {1353, 74}, {2238, 47}}, /* Q == 4 : 25-32% */ - {{ 714,128}, {1418, 74}, {2436, 53}}, /* Q == 5 : 32-38% */ - {{ 883,128}, {1437, 74}, {2464, 61}}, /* Q == 6 : 38-44% */ - {{ 897,128}, {1515, 75}, {2622, 68}}, /* Q == 7 : 44-50% */ - {{ 926,128}, {1613, 75}, {2730, 75}}, /* Q == 8 : 50-56% */ - {{ 947,128}, {1729, 77}, {3359, 77}}, /* Q == 9 : 56-62% */ - {{1107,128}, {2083, 81}, {4006, 84}}, /* Q ==10 : 62-69% */ - {{1177,128}, {2379, 87}, {4785, 88}}, /* Q ==11 : 69-75% */ - {{1242,128}, {2415, 93}, {5155, 84}}, /* Q ==12 : 75-81% */ - {{1349,128}, {2644,106}, {5260,106}}, /* Q ==13 : 81-87% */ - {{1455,128}, {2422,124}, {4174,124}}, /* Q ==14 : 87-93% */ - {{ 722,128}, {1891,145}, {1936,146}}, /* Q ==15 : 93-99% */ + {{0,0}, {1,1}}, /* Q==0 : impossible */ + {{0,0}, {1,1}}, /* Q==1 : impossible */ + {{ 150,216}, { 381,119}}, /* Q == 2 : 12-18% */ + {{ 170,205}, { 514,112}}, /* Q == 3 : 18-25% */ + {{ 177,199}, { 539,110}}, /* Q == 4 : 25-32% */ + {{ 197,194}, { 644,107}}, /* Q == 5 : 32-38% */ + {{ 221,192}, { 735,107}}, /* Q == 6 : 38-44% */ + {{ 256,189}, { 881,106}}, /* Q == 7 : 44-50% */ + {{ 359,188}, {1167,109}}, /* Q == 8 : 50-56% */ + {{ 582,187}, {1570,114}}, /* Q == 9 : 56-62% */ + {{ 688,187}, {1712,122}}, /* Q ==10 : 62-69% */ + {{ 825,186}, {1965,136}}, /* Q ==11 : 69-75% */ + {{ 976,185}, {2131,150}}, /* Q ==12 : 75-81% */ + {{1180,186}, {2070,175}}, /* Q ==13 : 81-87% */ + {{1377,185}, {1731,202}}, /* Q ==14 : 87-93% */ + {{1412,185}, {1695,202}}, /* Q ==15 : 93-99% */ }; #endif @@ -1082,7 +1609,7 @@ U32 HUF_selectDecoder (size_t dstSize, size_t cSrcSize) U32 const D256 = (U32)(dstSize >> 8); U32 const DTime0 = algoTime[Q][0].tableTime + (algoTime[Q][0].decode256Time * D256); U32 DTime1 = algoTime[Q][1].tableTime + (algoTime[Q][1].decode256Time * D256); - DTime1 += DTime1 >> 3; /* advantage to algorithm using less memory, to reduce cache eviction */ + DTime1 += DTime1 >> 5; /* small advantage to algorithm using less memory, to reduce cache eviction */ return DTime1 < DTime0; } #endif diff --git a/lib/decompress/huf_decompress_amd64.S b/lib/decompress/huf_decompress_amd64.S new file mode 100644 index 000000000..77a2d8560 --- /dev/null +++ b/lib/decompress/huf_decompress_amd64.S @@ -0,0 +1,561 @@ +# Calling convention: +# +# %rdi contains the first argument: HUF_DecompressAsmArgs*. +# %rbp is'nt maintained (no frame pointer). +# %rsp contains the stack pointer that grows down. +# No red-zone is assumed, only addresses >= %rsp are used. +# All register contents are preserved. +# +# TODO: Support Windows calling convention. + +#if !defined(HUF_DISABLE_ASM) && defined(__x86_64__) +.global HUF_decompress4X1_usingDTable_internal_bmi2_asm_loop +.global HUF_decompress4X2_usingDTable_internal_bmi2_asm_loop +.global _HUF_decompress4X1_usingDTable_internal_bmi2_asm_loop +.global _HUF_decompress4X2_usingDTable_internal_bmi2_asm_loop +.text + +# Sets up register mappings for clarity. +# op[], bits[], dtable & ip[0] each get their own register. +# ip[1,2,3] & olimit alias var[]. +# %rax is a scratch register. + +#define op0 rsi +#define op1 rbx +#define op2 rcx +#define op3 rdi + +#define ip0 r8 +#define ip1 r9 +#define ip2 r10 +#define ip3 r11 + +#define bits0 rbp +#define bits1 rdx +#define bits2 r12 +#define bits3 r13 +#define dtable r14 +#define olimit r15 + +# var[] aliases ip[1,2,3] & olimit +# ip[1,2,3] are saved every iteration. +# olimit is only used in compute_olimit. +#define var0 r15 +#define var1 r9 +#define var2 r10 +#define var3 r11 + +# 32-bit var registers +#define vard0 r15d +#define vard1 r9d +#define vard2 r10d +#define vard3 r11d + +# Helper macro: args if idx != 4. +#define IF_NOT_4_0(...) __VA_ARGS__ +#define IF_NOT_4_1(...) __VA_ARGS__ +#define IF_NOT_4_2(...) __VA_ARGS__ +#define IF_NOT_4_3(...) __VA_ARGS__ +#define IF_NOT_4_4(...) +#define IF_NOT_4_(idx, ...) IF_NOT_4_##idx(__VA_ARGS__) +#define IF_NOT_4(idx, ...) IF_NOT_4_(idx, __VA_ARGS__) + +# Calls X(N) for each stream 0, 1, 2, 3. +#define FOR_EACH_STREAM(X) \ + X(0); \ + X(1); \ + X(2); \ + X(3) + +# Calls X(N, idx) for each stream 0, 1, 2, 3. +#define FOR_EACH_STREAM_WITH_INDEX(X, idx) \ + X(0, idx); \ + X(1, idx); \ + X(2, idx); \ + X(3, idx) + +# Define both _HUF_* & HUF_* symbols because MacOS +# C symbols are prefixed with '_' & Linux symbols aren't. +_HUF_decompress4X1_usingDTable_internal_bmi2_asm_loop: +HUF_decompress4X1_usingDTable_internal_bmi2_asm_loop: + # Save all registers - even if they are callee saved for simplicity. + push %rax + push %rbx + push %rcx + push %rdx + push %rbp + push %rsi + push %rdi + push %r8 + push %r9 + push %r10 + push %r11 + push %r12 + push %r13 + push %r14 + push %r15 + + # Read HUF_DecompressAsmArgs* args from %rax + movq %rdi, %rax + movq 0(%rax), %ip0 + movq 8(%rax), %ip1 + movq 16(%rax), %ip2 + movq 24(%rax), %ip3 + movq 32(%rax), %op0 + movq 40(%rax), %op1 + movq 48(%rax), %op2 + movq 56(%rax), %op3 + movq 64(%rax), %bits0 + movq 72(%rax), %bits1 + movq 80(%rax), %bits2 + movq 88(%rax), %bits3 + movq 96(%rax), %dtable + push %rax # argument + push 104(%rax) # ilimit + push 112(%rax) # oend + push %olimit # olimit space + + subq $24, %rsp + +.L_4X1_compute_olimit: + # Computes how many iterations we can do savely + # %r15, %rax may be clobbered + # rbx, rdx must be saved + # op3 & ip0 mustn't be clobbered + movq %rbx, 0(%rsp) + movq %rdx, 8(%rsp) + + movq 32(%rsp), %rax # rax = oend + subq %op3, %rax # rax = oend - op3 + + # r15 = (oend - op3) / 5 + movabsq $-3689348814741910323, %rdx + mulq %rdx + movq %rdx, %r15 + shrq $2, %r15 + + movq %ip0, %rax # rax = ip0 + movq 40(%rsp), %rdx # rdx = ilimit + subq %rdx, %rax # rax = ip0 - ilimit + movq %rax, %rbx # rbx = ip0 - ilimit + + # rdx = (ip0 - ilimit) / 7 + movabsq $2635249153387078803, %rdx + mulq %rdx + subq %rdx, %rbx + shrq %rbx + addq %rbx, %rdx + shrq $2, %rdx + + # r15 = min(%rdx, %r15) + cmpq %rdx, %r15 + cmova %rdx, %r15 + + # r15 = r15 * 5 + leaq (%r15, %r15, 4), %r15 + + # olimit = op3 + r15 + addq %op3, %olimit + + movq 8(%rsp), %rdx + movq 0(%rsp), %rbx + + # If (op3 + 20 > olimit) + movq %op3, %rax # rax = op3 + addq $20, %rax # rax = op3 + 20 + cmpq %rax, %olimit # op3 + 20 > olimit + jb .L_4X1_exit + + # If (ip1 < ip0) go to exit + cmpq %ip0, %ip1 + jb .L_4X1_exit + + # If (ip2 < ip1) go to exit + cmpq %ip1, %ip2 + jb .L_4X1_exit + + # If (ip3 < ip2) go to exit + cmpq %ip2, %ip3 + jb .L_4X1_exit + +# Reads top 11 bits from bits[n] +# Loads dt[bits[n]] into var[n] +#define GET_NEXT_DELT(n) \ + movq $53, %var##n; \ + shrxq %var##n, %bits##n, %var##n; \ + movzwl (%dtable,%var##n,2),%vard##n + +# var[n] must contain the DTable entry computed with GET_NEXT_DELT +# Moves var[n] to %rax +# bits[n] <<= var[n] & 63 +# op[n][idx] = %rax >> 8 +# %ah is a way to access bits [8, 16) of %rax +#define DECODE_FROM_DELT(n, idx) \ + movq %var##n, %rax; \ + shlxq %var##n, %bits##n, %bits##n; \ + movb %ah, idx(%op##n) + +# Assumes GET_NEXT_DELT has been called. +# Calls DECODE_FROM_DELT then GET_NEXT_DELT if n < 4 +#define DECODE(n, idx) \ + DECODE_FROM_DELT(n, idx); \ + IF_NOT_4(idx, GET_NEXT_DELT(n)) + +# // ctz & nbBytes is stored in bits[n] +# // nbBits is stored in %rax +# ctz = CTZ[bits[n]] +# nbBits = ctz & 7 +# nbBytes = ctz >> 3 +# op[n] += 5 +# ip[n] -= nbBytes +# // Note: x86-64 is little-endian ==> no bswap +# bits[n] = MEM_readST(ip[n]) | 1 +# bits[n] <<= nbBits +#define RELOAD_BITS(n) \ + bsfq %bits##n, %bits##n; \ + movq %bits##n, %rax; \ + andq $7, %rax; \ + shrq $3, %bits##n; \ + leaq 5(%op##n), %op##n; \ + subq %bits##n, %ip##n; \ + movq (%ip##n), %bits##n; \ + orq $1, %bits##n; \ + shlx %rax, %bits##n, %bits##n; + + # Store clobbered variables on the stack + movq %olimit, 24(%rsp) + movq %ip1, 0(%rsp) + movq %ip2, 8(%rsp) + movq %ip3, 16(%rsp) + + # Call GET_NEXT_DELT for each stream + FOR_EACH_STREAM(GET_NEXT_DELT) + + .p2align 6 + +.L_4X1_loop_body: +# LLVM-MCA-BEGIN decode-4X1 + # Decode 5 symbols in each of the 4 streams (20 total) + # Must have called GET_NEXT_DELT for each stream + FOR_EACH_STREAM_WITH_INDEX(DECODE, 0) + FOR_EACH_STREAM_WITH_INDEX(DECODE, 1) + FOR_EACH_STREAM_WITH_INDEX(DECODE, 2) + FOR_EACH_STREAM_WITH_INDEX(DECODE, 3) + FOR_EACH_STREAM_WITH_INDEX(DECODE, 4) + + # Load ip[1,2,3] from stack (var[] aliases them) + # ip[] is needed for RELOAD_BITS + # Each will be stored back to the stack after RELOAD + movq 0(%rsp), %ip1 + movq 8(%rsp), %ip2 + movq 16(%rsp), %ip3 + + # Reload each stream & fetch the next table entry + # to prepare for the next iteration + RELOAD_BITS(0) + GET_NEXT_DELT(0) + + RELOAD_BITS(1) + movq %ip1, 0(%rsp) + GET_NEXT_DELT(1) + + RELOAD_BITS(2) + movq %ip2, 8(%rsp) + GET_NEXT_DELT(2) + + RELOAD_BITS(3) + movq %ip3, 16(%rsp) + GET_NEXT_DELT(3) + + # If op3 < olimit: continue the loop + cmp %op3, 24(%rsp) + ja .L_4X1_loop_body + + # Reload ip[1,2,3] from stack + movq 0(%rsp), %ip1 + movq 8(%rsp), %ip2 + movq 16(%rsp), %ip3 + + # Re-compute olimit + jmp .L_4X1_compute_olimit + +#undef GET_NEXT_DELT +#undef DECODE_FROM_DELT +#undef DECODE +#undef RELOAD_BITS +# LLVM-MCA-END +.L_4X1_exit: + addq $24, %rsp + + # Restore stack (oend & olimit) + pop %rax # olimit + pop %rax # oend + pop %rax # ilimit + pop %rax # arg + + # Save ip / op / bits + movq %ip0, 0(%rax) + movq %ip1, 8(%rax) + movq %ip2, 16(%rax) + movq %ip3, 24(%rax) + movq %op0, 32(%rax) + movq %op1, 40(%rax) + movq %op2, 48(%rax) + movq %op3, 56(%rax) + movq %bits0, 64(%rax) + movq %bits1, 72(%rax) + movq %bits2, 80(%rax) + movq %bits3, 88(%rax) + + # Restore registers + pop %r15 + pop %r14 + pop %r13 + pop %r12 + pop %r11 + pop %r10 + pop %r9 + pop %r8 + pop %rdi + pop %rsi + pop %rbp + pop %rdx + pop %rcx + pop %rbx + pop %rax + ret + +_HUF_decompress4X2_usingDTable_internal_bmi2_asm_loop: +HUF_decompress4X2_usingDTable_internal_bmi2_asm_loop: + # Save all registers - even if they are callee saved for simplicity. + push %rax + push %rbx + push %rcx + push %rdx + push %rbp + push %rsi + push %rdi + push %r8 + push %r9 + push %r10 + push %r11 + push %r12 + push %r13 + push %r14 + push %r15 + + movq %rdi, %rax + movq 0(%rax), %ip0 + movq 8(%rax), %ip1 + movq 16(%rax), %ip2 + movq 24(%rax), %ip3 + movq 32(%rax), %op0 + movq 40(%rax), %op1 + movq 48(%rax), %op2 + movq 56(%rax), %op3 + movq 64(%rax), %bits0 + movq 72(%rax), %bits1 + movq 80(%rax), %bits2 + movq 88(%rax), %bits3 + movq 96(%rax), %dtable + push %rax # argument + push %rax # olimit + push 104(%rax) # ilimit + + movq 112(%rax), %rax + push %rax # oend3 + + movq %op3, %rax + push %rax # oend2 + + movq %op2, %rax + push %rax # oend1 + + movq %op1, %rax + push %rax # oend0 + + # Scratch space + subq $8, %rsp + +.L_4X2_compute_olimit: + # Computes how many iterations we can do savely + # %r15, %rax may be clobbered + # rdx must be saved + # op[1,2,3,4] & ip0 mustn't be clobbered + movq %rdx, 0(%rsp) + + # We can consume up to 7 input bytes each iteration. + movq %ip0, %rax # rax = ip0 + movq 40(%rsp), %rdx # rdx = ilimit + subq %rdx, %rax # rax = ip0 - ilimit + movq %rax, %r15 # r15 = ip0 - ilimit + + # rdx = rax / 7 + movabsq $2635249153387078803, %rdx + mulq %rdx + subq %rdx, %r15 + shrq %r15 + addq %r15, %rdx + shrq $2, %rdx + + # r15 = (ip0 - ilimit) / 7 + movq %rdx, %r15 + + movabsq $-3689348814741910323, %rdx + movq 8(%rsp), %rax # rax = oend0 + subq %op0, %rax # rax = oend0 - op0 + mulq %rdx + shrq $3, %rdx # rdx = rax / 10 + + # r15 = min(%rdx, %r15) + cmpq %rdx, %r15 + cmova %rdx, %r15 + + movabsq $-3689348814741910323, %rdx + movq 16(%rsp), %rax # rax = oend1 + subq %op1, %rax # rax = oend1 - op1 + mulq %rdx + shrq $3, %rdx # rdx = rax / 10 + + # r15 = min(%rdx, %r15) + cmpq %rdx, %r15 + cmova %rdx, %r15 + + movabsq $-3689348814741910323, %rdx + movq 24(%rsp), %rax # rax = oend2 + subq %op2, %rax # rax = oend2 - op2 + mulq %rdx + shrq $3, %rdx # rdx = rax / 10 + + # r15 = min(%rdx, %r15) + cmpq %rdx, %r15 + cmova %rdx, %r15 + + movabsq $-3689348814741910323, %rdx + movq 32(%rsp), %rax # rax = oend3 + subq %op3, %rax # rax = oend3 - op3 + mulq %rdx + shrq $3, %rdx # rdx = rax / 10 + + # r15 = min(%rdx, %r15) + cmpq %rdx, %r15 + cmova %rdx, %r15 + + # olimit = op3 + 5 * r15 + movq %r15, %rax + leaq (%op3, %rax, 4), %olimit + addq %rax, %olimit + + movq 0(%rsp), %rdx + + # If (op3 + 10 > olimit) + movq %op3, %rax # rax = op3 + addq $10, %rax # rax = op3 + 10 + cmpq %rax, %olimit # op3 + 10 > olimit + jb .L_4X2_exit + + # If (ip1 < ip0) go to exit + cmpq %ip0, %ip1 + jb .L_4X2_exit + + # If (ip2 < ip1) go to exit + cmpq %ip1, %ip2 + jb .L_4X2_exit + + # If (ip3 < ip2) go to exit + cmpq %ip2, %ip3 + jb .L_4X2_exit + +#define DECODE(n, idx) \ + movq %bits##n, %rax; \ + shrq $53, %rax; \ + movzwl 0(%dtable,%rax,4),%r8d; \ + movzbl 2(%dtable,%rax,4),%r15d; \ + movzbl 3(%dtable,%rax,4),%eax; \ + movw %r8w, (%op##n); \ + shlxq %r15, %bits##n, %bits##n; \ + addq %rax, %op##n + +#define RELOAD_BITS(n) \ + bsfq %bits##n, %bits##n; \ + movq %bits##n, %rax; \ + shrq $3, %bits##n; \ + andq $7, %rax; \ + subq %bits##n, %ip##n; \ + movq (%ip##n), %bits##n; \ + orq $1, %bits##n; \ + shlxq %rax, %bits##n, %bits##n; + + + movq %olimit, 48(%rsp) + + .p2align 6 + +.L_4X2_loop_body: +# LLVM-MCA-BEGIN decode-4X2 + + # We clobber r8, so store it on the stack + movq %r8, 0(%rsp) + + # Decode 5 symbols from each of the 4 streams (20 symbols total). + FOR_EACH_STREAM_WITH_INDEX(DECODE, 0) + FOR_EACH_STREAM_WITH_INDEX(DECODE, 1) + FOR_EACH_STREAM_WITH_INDEX(DECODE, 2) + FOR_EACH_STREAM_WITH_INDEX(DECODE, 3) + FOR_EACH_STREAM_WITH_INDEX(DECODE, 4) + + # Reload r8 + movq 0(%rsp), %r8 + + FOR_EACH_STREAM(RELOAD_BITS) + + cmp %op3, 48(%rsp) + ja .L_4X2_loop_body + jmp .L_4X2_compute_olimit + +#undef DECODE +#undef RELOAD_BITS +# LLVM-MCA-END +.L_4X2_exit: + addq $8, %rsp + # Restore stack (oend & olimit) + pop %rax # oend0 + pop %rax # oend1 + pop %rax # oend2 + pop %rax # oend3 + pop %rax # ilimit + pop %rax # olimit + pop %rax # arg + + # Save ip / op / bits + movq %ip0, 0(%rax) + movq %ip1, 8(%rax) + movq %ip2, 16(%rax) + movq %ip3, 24(%rax) + movq %op0, 32(%rax) + movq %op1, 40(%rax) + movq %op2, 48(%rax) + movq %op3, 56(%rax) + movq %bits0, 64(%rax) + movq %bits1, 72(%rax) + movq %bits2, 80(%rax) + movq %bits3, 88(%rax) + + # Restore registers + pop %r15 + pop %r14 + pop %r13 + pop %r12 + pop %r11 + pop %r10 + pop %r9 + pop %r8 + pop %rdi + pop %rsi + pop %rbp + pop %rdx + pop %rcx + pop %rbx + pop %rax + ret +#endif diff --git a/lib/zstd.h b/lib/zstd.h index ebe2e04b5..90b59475a 100644 --- a/lib/zstd.h +++ b/lib/zstd.h @@ -72,7 +72,7 @@ extern "C" { /*------ Version ------*/ #define ZSTD_VERSION_MAJOR 1 #define ZSTD_VERSION_MINOR 5 -#define ZSTD_VERSION_RELEASE 0 +#define ZSTD_VERSION_RELEASE 1 #define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE) /*! ZSTD_versionNumber() : diff --git a/tests/fuzz/huf_decompress.c b/tests/fuzz/huf_decompress.c index 7ede9ec53..fea09fc93 100644 --- a/tests/fuzz/huf_decompress.c +++ b/tests/fuzz/huf_decompress.c @@ -46,7 +46,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size) if (ZSTD_isError(err)) goto _out; } else { - size_t const err = HUF_readDTableX2_wksp(dt, src, size, wksp, wkspSize); + size_t const err = HUF_readDTableX2_wksp_bmi2(dt, src, size, wksp, wkspSize, bmi2); if (ZSTD_isError(err)) goto _out; } From b5c35d7ea33b99d25ceb21057d38eca17c8dc7de Mon Sep 17 00:00:00 2001 From: senhuang42 Date: Mon, 20 Sep 2021 09:04:07 -0400 Subject: [PATCH 06/38] Use new paramSwitch enum for LCM, row matchfinder, and block splitter --- lib/compress/zstd_compress.c | 168 ++++++------ lib/compress/zstd_compress_internal.h | 18 +- lib/compress/zstd_ldm.c | 2 +- lib/compress/zstd_ldm.h | 2 +- lib/compress/zstd_opt.c | 2 +- lib/zstd.h | 53 ++-- programs/benchzstd.c | 2 +- programs/benchzstd.h | 2 +- programs/fileio.c | 6 +- programs/fileio.h | 2 +- programs/zstdcli.c | 6 +- tests/fuzz/zstd_helpers.c | 2 +- tests/fuzzer.c | 6 +- tests/regression/config.c | 8 +- tests/regression/levels.h | 2 +- tests/regression/results.csv | 372 +++++++++++++------------- 16 files changed, 329 insertions(+), 324 deletions(-) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index e68f7352a..700f4567f 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -84,10 +84,10 @@ struct ZSTD_CDict_s { ZSTD_customMem customMem; U32 dictID; int compressionLevel; /* 0 indicates that advanced API was used to select CDict params */ - ZSTD_useRowMatchFinderMode_e useRowMatchFinder; /* Indicates whether the CDict was created with params that would use - * row-based matchfinder. Unless the cdict is reloaded, we will use - * the same greedy/lazy matchfinder at compression time. - */ + ZSTD_paramSwitch_e useRowMatchFinder; /* Indicates whether the CDict was created with params that would use + * row-based matchfinder. Unless the cdict is reloaded, we will use + * the same greedy/lazy matchfinder at compression time. + */ }; /* typedef'd to ZSTD_CDict within "zstd.h" */ ZSTD_CCtx* ZSTD_createCCtx(void) @@ -226,35 +226,42 @@ static int ZSTD_rowMatchFinderSupported(const ZSTD_strategy strategy) { /* Returns true if the strategy and useRowMatchFinder mode indicate that we will use the row based matchfinder * for this compression. */ -static int ZSTD_rowMatchFinderUsed(const ZSTD_strategy strategy, const ZSTD_useRowMatchFinderMode_e mode) { - assert(mode != ZSTD_urm_auto); - return ZSTD_rowMatchFinderSupported(strategy) && (mode == ZSTD_urm_enableRowMatchFinder); +static int ZSTD_rowMatchFinderUsed(const ZSTD_strategy strategy, const ZSTD_paramSwitch_e mode) { + assert(mode != ZSTD_ps_auto); + return ZSTD_rowMatchFinderSupported(strategy) && (mode == ZSTD_ps_enable); } -/* Returns row matchfinder usage enum given an initial mode and cParams */ -static ZSTD_useRowMatchFinderMode_e ZSTD_resolveRowMatchFinderMode(ZSTD_useRowMatchFinderMode_e mode, - const ZSTD_compressionParameters* const cParams) { +/* Returns row matchfinder usage given an initial mode and cParams */ +static ZSTD_paramSwitch_e ZSTD_resolveRowMatchFinderMode(ZSTD_paramSwitch_e mode, + const ZSTD_compressionParameters* const cParams) { #if defined(ZSTD_ARCH_X86_SSE2) || defined(ZSTD_ARCH_ARM_NEON) int const kHasSIMD128 = 1; #else int const kHasSIMD128 = 0; #endif - if (mode != ZSTD_urm_auto) return mode; /* if requested enabled, but no SIMD, we still will use row matchfinder */ - mode = ZSTD_urm_disableRowMatchFinder; + if (mode != ZSTD_ps_auto) return mode; /* if requested enabled, but no SIMD, we still will use row matchfinder */ + mode = ZSTD_ps_disable; if (!ZSTD_rowMatchFinderSupported(cParams->strategy)) return mode; if (kHasSIMD128) { - if (cParams->windowLog > 14) mode = ZSTD_urm_enableRowMatchFinder; + if (cParams->windowLog > 14) mode = ZSTD_ps_enable; } else { - if (cParams->windowLog > 17) mode = ZSTD_urm_enableRowMatchFinder; + if (cParams->windowLog > 17) mode = ZSTD_ps_enable; } return mode; } +/* Returns block splitter usage (generally speaking, when using slower/stronger compression modes) */ +static ZSTD_paramSwitch_e ZSTD_resolveBlockSplitterMode(ZSTD_paramSwitch_e mode, + const ZSTD_compressionParameters* const cParams) { + if (mode != ZSTD_ps_auto) return mode; + return (cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 17) ? ZSTD_ps_enable : ZSTD_ps_disable; +} + /* Returns 1 if the arguments indicate that we should allocate a chainTable, 0 otherwise */ static int ZSTD_allocateChainTable(const ZSTD_strategy strategy, - const ZSTD_useRowMatchFinderMode_e useRowMatchFinder, + const ZSTD_paramSwitch_e useRowMatchFinder, const U32 forDDSDict) { - assert(useRowMatchFinder != ZSTD_urm_auto); + assert(useRowMatchFinder != ZSTD_ps_auto); /* We always should allocate a chaintable if we are allocating a matchstate for a DDS dictionary matchstate. * We do not allocate a chaintable if we are using ZSTD_fast, or are using the row-based matchfinder. */ @@ -269,14 +276,6 @@ static U32 ZSTD_CParams_shouldEnableLdm(const ZSTD_compressionParameters* const return cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 27; } -/* Returns 1 if compression parameters are such that we should - * enable blockSplitter (wlog >= 17, strategy >= btopt). - * Returns 0 otherwise. - */ -static U32 ZSTD_CParams_useBlockSplitter(const ZSTD_compressionParameters* const cParams) { - return cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 17; -} - static ZSTD_CCtx_params ZSTD_makeCCtxParamsFromCParams( ZSTD_compressionParameters cParams) { @@ -295,11 +294,7 @@ static ZSTD_CCtx_params ZSTD_makeCCtxParamsFromCParams( assert(cctxParams.ldmParams.hashRateLog < 32); } - if (ZSTD_CParams_useBlockSplitter(&cParams)) { - DEBUGLOG(4, "ZSTD_makeCCtxParamsFromCParams(): Including block splitting into cctx params"); - cctxParams.splitBlocks = 1; - } - + cctxParams.useBlockSplitter = ZSTD_resolveBlockSplitterMode(cctxParams.useBlockSplitter, &cParams); cctxParams.useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(cctxParams.useRowMatchFinder, &cParams); assert(!ZSTD_checkCParams(cParams)); return cctxParams; @@ -360,18 +355,14 @@ static void ZSTD_CCtxParams_init_internal(ZSTD_CCtx_params* cctxParams, ZSTD_par */ cctxParams->compressionLevel = compressionLevel; cctxParams->useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(cctxParams->useRowMatchFinder, ¶ms->cParams); - DEBUGLOG(4, "ZSTD_CCtxParams_init_internal: useRowMatchFinder=%d", cctxParams->useRowMatchFinder); + cctxParams->useBlockSplitter = ZSTD_resolveBlockSplitterMode(cctxParams->useBlockSplitter, ¶ms->cParams); + DEBUGLOG(4, "ZSTD_CCtxParams_init_internal: useRowMatchFinder=%d, useBlockSplitter=%d", cctxParams->useRowMatchFinder, cctxParams->useBlockSplitter); if (ZSTD_CParams_shouldEnableLdm(¶ms->cParams)) { /* Enable LDM by default for optimal parser and window size >= 128MB */ DEBUGLOG(4, "LDM enabled by default (window size >= 128MB, strategy >= btopt)"); cctxParams->ldmParams.enableLdm = 1; } - - if (ZSTD_CParams_useBlockSplitter(¶ms->cParams)) { - DEBUGLOG(4, "Block splitter enabled by default (window size >= 128K, strategy >= btopt)"); - cctxParams->splitBlocks = 1; - } } size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params) @@ -541,9 +532,9 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param) return bounds; case ZSTD_c_literalCompressionMode: - ZSTD_STATIC_ASSERT(ZSTD_lcm_auto < ZSTD_lcm_huffman && ZSTD_lcm_huffman < ZSTD_lcm_uncompressed); - bounds.lowerBound = ZSTD_lcm_auto; - bounds.upperBound = ZSTD_lcm_uncompressed; + ZSTD_STATIC_ASSERT(ZSTD_ps_auto < ZSTD_ps_enable && ZSTD_ps_enable < ZSTD_ps_disable); + bounds.lowerBound = (int)ZSTD_ps_auto; + bounds.upperBound = (int)ZSTD_ps_disable; return bounds; case ZSTD_c_targetCBlockSize: @@ -572,14 +563,14 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param) bounds.upperBound = 1; return bounds; - case ZSTD_c_splitBlocks: - bounds.lowerBound = 0; - bounds.upperBound = 1; + case ZSTD_c_useBlockSplitter: + bounds.lowerBound = (int)ZSTD_ps_auto; + bounds.upperBound = (int)ZSTD_ps_disable; return bounds; case ZSTD_c_useRowMatchFinder: - bounds.lowerBound = (int)ZSTD_urm_auto; - bounds.upperBound = (int)ZSTD_urm_enableRowMatchFinder; + bounds.lowerBound = (int)ZSTD_ps_auto; + bounds.upperBound = (int)ZSTD_ps_disable; return bounds; case ZSTD_c_deterministicRefPrefix: @@ -648,7 +639,7 @@ static int ZSTD_isUpdateAuthorized(ZSTD_cParameter param) case ZSTD_c_stableOutBuffer: case ZSTD_c_blockDelimiters: case ZSTD_c_validateSequences: - case ZSTD_c_splitBlocks: + case ZSTD_c_useBlockSplitter: case ZSTD_c_useRowMatchFinder: case ZSTD_c_deterministicRefPrefix: default: @@ -703,7 +694,7 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int value) case ZSTD_c_stableOutBuffer: case ZSTD_c_blockDelimiters: case ZSTD_c_validateSequences: - case ZSTD_c_splitBlocks: + case ZSTD_c_useBlockSplitter: case ZSTD_c_useRowMatchFinder: case ZSTD_c_deterministicRefPrefix: break; @@ -803,7 +794,7 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, } case ZSTD_c_literalCompressionMode : { - const ZSTD_literalCompressionMode_e lcm = (ZSTD_literalCompressionMode_e)value; + const ZSTD_paramSwitch_e lcm = (ZSTD_paramSwitch_e)value; BOUNDCHECK(ZSTD_c_literalCompressionMode, lcm); CCtxParams->literalCompressionMode = lcm; return CCtxParams->literalCompressionMode; @@ -917,14 +908,14 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, CCtxParams->validateSequences = value; return CCtxParams->validateSequences; - case ZSTD_c_splitBlocks: - BOUNDCHECK(ZSTD_c_splitBlocks, value); - CCtxParams->splitBlocks = value; - return CCtxParams->splitBlocks; + case ZSTD_c_useBlockSplitter: + BOUNDCHECK(ZSTD_c_useBlockSplitter, value); + CCtxParams->useBlockSplitter = (ZSTD_paramSwitch_e)value; + return CCtxParams->useBlockSplitter; case ZSTD_c_useRowMatchFinder: BOUNDCHECK(ZSTD_c_useRowMatchFinder, value); - CCtxParams->useRowMatchFinder = (ZSTD_useRowMatchFinderMode_e)value; + CCtxParams->useRowMatchFinder = (ZSTD_paramSwitch_e)value; return CCtxParams->useRowMatchFinder; case ZSTD_c_deterministicRefPrefix: @@ -1055,8 +1046,8 @@ size_t ZSTD_CCtxParams_getParameter( case ZSTD_c_validateSequences : *value = (int)CCtxParams->validateSequences; break; - case ZSTD_c_splitBlocks : - *value = (int)CCtxParams->splitBlocks; + case ZSTD_c_useBlockSplitter : + *value = (int)CCtxParams->useBlockSplitter; break; case ZSTD_c_useRowMatchFinder : *value = (int)CCtxParams->useRowMatchFinder; @@ -1430,7 +1421,7 @@ ZSTD_compressionParameters ZSTD_getCParamsFromCCtxParams( static size_t ZSTD_sizeof_matchState(const ZSTD_compressionParameters* const cParams, - const ZSTD_useRowMatchFinderMode_e useRowMatchFinder, + const ZSTD_paramSwitch_e useRowMatchFinder, const U32 enableDedicatedDictSearch, const U32 forCCtx) { @@ -1463,7 +1454,7 @@ ZSTD_sizeof_matchState(const ZSTD_compressionParameters* const cParams, /* tables are guaranteed to be sized in multiples of 64 bytes (or 16 uint32_t) */ ZSTD_STATIC_ASSERT(ZSTD_HASHLOG_MIN >= 4 && ZSTD_WINDOWLOG_MIN >= 4 && ZSTD_CHAINLOG_MIN >= 4); - assert(useRowMatchFinder != ZSTD_urm_auto); + assert(useRowMatchFinder != ZSTD_ps_auto); DEBUGLOG(4, "chainSize: %u - hSize: %u - h3Size: %u", (U32)chainSize, (U32)hSize, (U32)h3Size); @@ -1474,7 +1465,7 @@ static size_t ZSTD_estimateCCtxSize_usingCCtxParams_internal( const ZSTD_compressionParameters* cParams, const ldmParams_t* ldmParams, const int isStatic, - const ZSTD_useRowMatchFinderMode_e useRowMatchFinder, + const ZSTD_paramSwitch_e useRowMatchFinder, const size_t buffInSize, const size_t buffOutSize, const U64 pledgedSrcSize) @@ -1519,7 +1510,7 @@ size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params) { ZSTD_compressionParameters const cParams = ZSTD_getCParamsFromCCtxParams(params, ZSTD_CONTENTSIZE_UNKNOWN, 0, ZSTD_cpm_noAttachDict); - ZSTD_useRowMatchFinderMode_e const useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(params->useRowMatchFinder, + ZSTD_paramSwitch_e const useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(params->useRowMatchFinder, &cParams); RETURN_ERROR_IF(params->nbWorkers > 0, GENERIC, "Estimate CCtx size is supported for single-threaded compression only."); @@ -1537,9 +1528,9 @@ size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams) /* Pick bigger of not using and using row-based matchfinder for greedy and lazy strategies */ size_t noRowCCtxSize; size_t rowCCtxSize; - initialParams.useRowMatchFinder = ZSTD_urm_disableRowMatchFinder; + initialParams.useRowMatchFinder = ZSTD_ps_disable; noRowCCtxSize = ZSTD_estimateCCtxSize_usingCCtxParams(&initialParams); - initialParams.useRowMatchFinder = ZSTD_urm_enableRowMatchFinder; + initialParams.useRowMatchFinder = ZSTD_ps_enable; rowCCtxSize = ZSTD_estimateCCtxSize_usingCCtxParams(&initialParams); return MAX(noRowCCtxSize, rowCCtxSize); } else { @@ -1584,7 +1575,7 @@ size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params) size_t const outBuffSize = (params->outBufferMode == ZSTD_bm_buffered) ? ZSTD_compressBound(blockSize) + 1 : 0; - ZSTD_useRowMatchFinderMode_e const useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(params->useRowMatchFinder, ¶ms->cParams); + ZSTD_paramSwitch_e const useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(params->useRowMatchFinder, ¶ms->cParams); return ZSTD_estimateCCtxSize_usingCCtxParams_internal( &cParams, ¶ms->ldmParams, 1, useRowMatchFinder, inBuffSize, outBuffSize, @@ -1599,9 +1590,9 @@ size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams) /* Pick bigger of not using and using row-based matchfinder for greedy and lazy strategies */ size_t noRowCCtxSize; size_t rowCCtxSize; - initialParams.useRowMatchFinder = ZSTD_urm_disableRowMatchFinder; + initialParams.useRowMatchFinder = ZSTD_ps_disable; noRowCCtxSize = ZSTD_estimateCStreamSize_usingCCtxParams(&initialParams); - initialParams.useRowMatchFinder = ZSTD_urm_enableRowMatchFinder; + initialParams.useRowMatchFinder = ZSTD_ps_enable; rowCCtxSize = ZSTD_estimateCStreamSize_usingCCtxParams(&initialParams); return MAX(noRowCCtxSize, rowCCtxSize); } else { @@ -1736,7 +1727,7 @@ static size_t ZSTD_reset_matchState(ZSTD_matchState_t* ms, ZSTD_cwksp* ws, const ZSTD_compressionParameters* cParams, - const ZSTD_useRowMatchFinderMode_e useRowMatchFinder, + const ZSTD_paramSwitch_e useRowMatchFinder, const ZSTD_compResetPolicy_e crp, const ZSTD_indexResetPolicy_e forceResetIndex, const ZSTD_resetTarget_e forWho) @@ -1751,7 +1742,7 @@ ZSTD_reset_matchState(ZSTD_matchState_t* ms, size_t const h3Size = hashLog3 ? ((size_t)1) << hashLog3 : 0; DEBUGLOG(4, "reset indices : %u", forceResetIndex == ZSTDirp_reset); - assert(useRowMatchFinder != ZSTD_urm_auto); + assert(useRowMatchFinder != ZSTD_ps_auto); if (forceResetIndex == ZSTDirp_reset) { ZSTD_window_init(&ms->window); ZSTD_cwksp_mark_tables_dirty(ws); @@ -1847,8 +1838,8 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, ZSTD_buffered_policy_e const zbuff) { ZSTD_cwksp* const ws = &zc->workspace; - DEBUGLOG(4, "ZSTD_resetCCtx_internal: pledgedSrcSize=%u, wlog=%u, useRowMatchFinder=%d", - (U32)pledgedSrcSize, params->cParams.windowLog, (int)params->useRowMatchFinder); + DEBUGLOG(4, "ZSTD_resetCCtx_internal: pledgedSrcSize=%u, wlog=%u, useRowMatchFinder=%d useBlockSplitter=%d", + (U32)pledgedSrcSize, params->cParams.windowLog, (int)params->useRowMatchFinder, (int)params->useBlockSplitter); assert(!ZSTD_isError(ZSTD_checkCParams(params->cParams))); zc->isFirstBlock = 1; @@ -1859,7 +1850,8 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, zc->appliedParams = *params; params = &zc->appliedParams; - assert(params->useRowMatchFinder != ZSTD_urm_auto); + assert(params->useRowMatchFinder != ZSTD_ps_auto); + assert(params->useBlockSplitter != ZSTD_ps_auto); if (params->ldmParams.enableLdm) { /* Adjust long distance matching parameters */ ZSTD_ldm_adjustParameters(&zc->appliedParams.ldmParams, ¶ms->cParams); @@ -2138,7 +2130,7 @@ static size_t ZSTD_resetCCtx_byCopyingCDict(ZSTD_CCtx* cctx, } ZSTD_cwksp_mark_tables_dirty(&cctx->workspace); - assert(params.useRowMatchFinder != ZSTD_urm_auto); + assert(params.useRowMatchFinder != ZSTD_ps_auto); /* copy tables */ { size_t const chainSize = ZSTD_allocateChainTable(cdict_cParams->strategy, cdict->useRowMatchFinder, 0 /* DDS guaranteed disabled */) @@ -2232,8 +2224,10 @@ static size_t ZSTD_copyCCtx_internal(ZSTD_CCtx* dstCCtx, { ZSTD_CCtx_params params = dstCCtx->requestedParams; /* Copy only compression parameters related to tables. */ params.cParams = srcCCtx->appliedParams.cParams; - assert(srcCCtx->appliedParams.useRowMatchFinder != ZSTD_urm_auto); + assert(srcCCtx->appliedParams.useRowMatchFinder != ZSTD_ps_auto); + assert(srcCCtx->appliedParams.useBlockSplitter != ZSTD_ps_auto); params.useRowMatchFinder = srcCCtx->appliedParams.useRowMatchFinder; + params.useBlockSplitter = srcCCtx->appliedParams.useBlockSplitter; params.fParams = fParams; ZSTD_resetCCtx_internal(dstCCtx, ¶ms, pledgedSrcSize, /* loadedDictSize */ 0, @@ -2422,11 +2416,13 @@ static int ZSTD_useTargetCBlockSize(const ZSTD_CCtx_params* cctxParams) /* ZSTD_blockSplitterEnabled(): * Returns if block splitting param is being used * If used, compression will do best effort to split a block in order to improve compression ratio. + * At the time this function is called, the parameter must be finalized. * Returns 1 if true, 0 otherwise. */ static int ZSTD_blockSplitterEnabled(ZSTD_CCtx_params* cctxParams) { - DEBUGLOG(5, "ZSTD_blockSplitterEnabled(splitBlocks=%d)", cctxParams->splitBlocks); - return (cctxParams->splitBlocks != 0); + DEBUGLOG(5, "ZSTD_blockSplitterEnabled (useBlockSplitter=%d)", cctxParams->useBlockSplitter); + assert(cctxParams->useBlockSplitter != ZSTD_ps_auto); + return (cctxParams->useBlockSplitter == ZSTD_ps_enable); } /* Type returned by ZSTD_buildSequencesStatistics containing finalized symbol encoding types @@ -2612,7 +2608,7 @@ ZSTD_entropyCompressSeqStore_internal(seqStore_t* seqStorePtr, size_t const cSize = ZSTD_compressLiterals( &prevEntropy->huf, &nextEntropy->huf, cctxParams->cParams.strategy, - ZSTD_disableLiteralsCompression(cctxParams), + ZSTD_literalsCompressionIsDisabled(cctxParams), op, dstCapacity, literals, litSize, entropyWorkspace, entropyWkspSize, @@ -2721,7 +2717,7 @@ ZSTD_entropyCompressSeqStore(seqStore_t* seqStorePtr, /* ZSTD_selectBlockCompressor() : * Not static, but internal use only (used by long distance matcher) * assumption : strat is a valid strategy */ -ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_useRowMatchFinderMode_e useRowMatchFinder, ZSTD_dictMode_e dictMode) +ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_paramSwitch_e useRowMatchFinder, ZSTD_dictMode_e dictMode) { static const ZSTD_blockCompressor blockCompressor[4][ZSTD_STRATEGY_MAX+1] = { { ZSTD_compressBlock_fast /* default for 0 */, @@ -2786,7 +2782,7 @@ ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_useRow ZSTD_compressBlock_lazy2_dedicatedDictSearch_row } }; DEBUGLOG(4, "Selecting a row-based matchfinder"); - assert(useRowMatchFinder != ZSTD_urm_auto); + assert(useRowMatchFinder != ZSTD_ps_auto); selectedCompressor = rowBasedBlockCompressors[(int)dictMode][(int)strat - (int)ZSTD_greedy]; } else { selectedCompressor = blockCompressor[(int)dictMode][(int)strat]; @@ -3055,7 +3051,7 @@ static size_t ZSTD_buildBlockEntropyStats_literals(void* const src, size_t srcSi const ZSTD_hufCTables_t* prevHuf, ZSTD_hufCTables_t* nextHuf, ZSTD_hufCTablesMetadata_t* hufMetadata, - const int disableLiteralsCompression, + const int literalsCompressionIsDisabled, void* workspace, size_t wkspSize) { BYTE* const wkspStart = (BYTE*)workspace; @@ -3073,7 +3069,7 @@ static size_t ZSTD_buildBlockEntropyStats_literals(void* const src, size_t srcSi /* Prepare nextEntropy assuming reusing the existing table */ ZSTD_memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); - if (disableLiteralsCompression) { + if (literalsCompressionIsDisabled) { DEBUGLOG(5, "set_basic - disabled"); hufMetadata->hType = set_basic; return 0; @@ -3220,7 +3216,7 @@ size_t ZSTD_buildBlockEntropyStats(seqStore_t* seqStorePtr, ZSTD_buildBlockEntropyStats_literals(seqStorePtr->litStart, litSize, &prevEntropy->huf, &nextEntropy->huf, &entropyMetadata->hufMetadata, - ZSTD_disableLiteralsCompression(cctxParams), + ZSTD_literalsCompressionIsDisabled(cctxParams), workspace, wkspSize); FORWARD_IF_ERROR(entropyMetadata->hufMetadata.hufDesSize, "ZSTD_buildBlockEntropyStats_literals failed"); entropyMetadata->fseMetadata.fseTablesSize = @@ -3723,6 +3719,7 @@ static size_t ZSTD_compressBlock_splitBlock(ZSTD_CCtx* zc, U32 nbSeq; size_t cSize; DEBUGLOG(4, "ZSTD_compressBlock_splitBlock"); + assert(zc->appliedParams.useBlockSplitter == ZSTD_ps_enable); { const size_t bss = ZSTD_buildSeqStore(zc, src, srcSize); FORWARD_IF_ERROR(bss, "ZSTD_buildSeqStore failed"); @@ -3737,7 +3734,6 @@ static size_t ZSTD_compressBlock_splitBlock(ZSTD_CCtx* zc, nbSeq = (U32)(zc->seqStore.sequences - zc->seqStore.sequencesStart); } - assert(zc->appliedParams.splitBlocks == 1); cSize = ZSTD_compressBlock_splitBlock_internal(zc, dst, dstCapacity, src, srcSize, lastBlock, nbSeq); FORWARD_IF_ERROR(cSize, "Splitting blocks failed!"); return cSize; @@ -4252,8 +4248,8 @@ static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms, assert(ms->chainTable != NULL); ZSTD_dedicatedDictSearch_lazy_loadDictionary(ms, iend-HASH_READ_SIZE); } else { - assert(params->useRowMatchFinder != ZSTD_urm_auto); - if (params->useRowMatchFinder == ZSTD_urm_enableRowMatchFinder) { + assert(params->useRowMatchFinder != ZSTD_ps_auto); + if (params->useRowMatchFinder == ZSTD_ps_enable) { size_t const tagTableSize = ((size_t)1 << params->cParams.hashLog) * sizeof(U16); ZSTD_memset(ms->tagTable, 0, tagTableSize); ZSTD_row_update(ms, iend-HASH_READ_SIZE); @@ -4753,7 +4749,7 @@ size_t ZSTD_estimateCDictSize_advanced( + ZSTD_cwksp_alloc_size(HUF_WORKSPACE_SIZE) /* enableDedicatedDictSearch == 1 ensures that CDict estimation will not be too small * in case we are using DDS with row-hash. */ - + ZSTD_sizeof_matchState(&cParams, ZSTD_resolveRowMatchFinderMode(ZSTD_urm_auto, &cParams), + + ZSTD_sizeof_matchState(&cParams, ZSTD_resolveRowMatchFinderMode(ZSTD_ps_auto, &cParams), /* enableDedicatedDictSearch */ 1, /* forCCtx */ 0) + (dictLoadMethod == ZSTD_dlm_byRef ? 0 : ZSTD_cwksp_alloc_size(ZSTD_cwksp_align(dictSize, sizeof(void *)))); @@ -4830,7 +4826,7 @@ static size_t ZSTD_initCDict_internal( static ZSTD_CDict* ZSTD_createCDict_advanced_internal(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_compressionParameters cParams, - ZSTD_useRowMatchFinderMode_e useRowMatchFinder, + ZSTD_paramSwitch_e useRowMatchFinder, U32 enableDedicatedDictSearch, ZSTD_customMem customMem) { @@ -4985,7 +4981,7 @@ const ZSTD_CDict* ZSTD_initStaticCDict( ZSTD_dictContentType_e dictContentType, ZSTD_compressionParameters cParams) { - ZSTD_useRowMatchFinderMode_e const useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(ZSTD_urm_auto, &cParams); + ZSTD_paramSwitch_e const useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(ZSTD_ps_auto, &cParams); /* enableDedicatedDictSearch == 1 ensures matchstate is not too small in case this CDict will be used for DDS + row hash */ size_t const matchStateSize = ZSTD_sizeof_matchState(&cParams, useRowMatchFinder, /* enableDedicatedDictSearch */ 1, /* forCCtx */ 0); size_t const neededSize = ZSTD_cwksp_alloc_size(sizeof(ZSTD_CDict)) @@ -5568,11 +5564,7 @@ static size_t ZSTD_CCtx_init_compressStream2(ZSTD_CCtx* cctx, params.ldmParams.enableLdm = 1; } - if (ZSTD_CParams_useBlockSplitter(¶ms.cParams)) { - DEBUGLOG(4, "Block splitter enabled by default (window size >= 128K, strategy >= btopt)"); - params.splitBlocks = 1; - } - + params.useBlockSplitter = ZSTD_resolveBlockSplitterMode(params.useBlockSplitter, ¶ms.cParams); params.useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(params.useRowMatchFinder, ¶ms.cParams); #ifdef ZSTD_MULTITHREAD diff --git a/lib/compress/zstd_compress_internal.h b/lib/compress/zstd_compress_internal.h index c032d7d18..c168c67e7 100644 --- a/lib/compress/zstd_compress_internal.h +++ b/lib/compress/zstd_compress_internal.h @@ -179,7 +179,7 @@ typedef struct { U32 offCodeSumBasePrice; /* to compare to log2(offreq) */ ZSTD_OptPrice_e priceType; /* prices can be determined dynamically, or follow a pre-defined cost structure */ const ZSTD_entropyCTables_t* symbolCosts; /* pre-calculated dictionary statistics */ - ZSTD_literalCompressionMode_e literalCompressionMode; + ZSTD_paramSwitch_e literalCompressionMode; } optState_t; typedef struct { @@ -297,7 +297,7 @@ struct ZSTD_CCtx_params_s { * There is no guarantee that hint is close to actual source size */ ZSTD_dictAttachPref_e attachDictPref; - ZSTD_literalCompressionMode_e literalCompressionMode; + ZSTD_paramSwitch_e literalCompressionMode; /* Multithreading: used to pass parameters to mtctx */ int nbWorkers; @@ -320,10 +320,10 @@ struct ZSTD_CCtx_params_s { int validateSequences; /* Block splitting */ - int splitBlocks; + ZSTD_paramSwitch_e useBlockSplitter; /* Param for deciding whether to use row-based matchfinder */ - ZSTD_useRowMatchFinderMode_e useRowMatchFinder; + ZSTD_paramSwitch_e useRowMatchFinder; /* Always load a dictionary in ext-dict mode (not prefix mode)? */ int deterministicRefPrefix; @@ -444,7 +444,7 @@ typedef enum { typedef size_t (*ZSTD_blockCompressor) ( ZSTD_matchState_t* bs, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], void const* src, size_t srcSize); -ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_useRowMatchFinderMode_e rowMatchfinderMode, ZSTD_dictMode_e dictMode); +ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_paramSwitch_e rowMatchfinderMode, ZSTD_dictMode_e dictMode); MEM_STATIC U32 ZSTD_LLcode(U32 litLength) @@ -551,17 +551,17 @@ MEM_STATIC size_t ZSTD_minGain(size_t srcSize, ZSTD_strategy strat) return (srcSize >> minlog) + 2; } -MEM_STATIC int ZSTD_disableLiteralsCompression(const ZSTD_CCtx_params* cctxParams) +MEM_STATIC int ZSTD_literalsCompressionIsDisabled(const ZSTD_CCtx_params* cctxParams) { switch (cctxParams->literalCompressionMode) { - case ZSTD_lcm_huffman: + case ZSTD_ps_enable: return 0; - case ZSTD_lcm_uncompressed: + case ZSTD_ps_disable: return 1; default: assert(0 /* impossible: pre-validated */); /* fall-through */ - case ZSTD_lcm_auto: + case ZSTD_ps_auto: return (cctxParams->cParams.strategy == ZSTD_fast) && (cctxParams->cParams.targetLength > 0); } } diff --git a/lib/compress/zstd_ldm.c b/lib/compress/zstd_ldm.c index fa4ebeabd..c97b97a03 100644 --- a/lib/compress/zstd_ldm.c +++ b/lib/compress/zstd_ldm.c @@ -657,7 +657,7 @@ void ZSTD_ldm_skipRawSeqStoreBytes(rawSeqStore_t* rawSeqStore, size_t nbBytes) { size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore, ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - ZSTD_useRowMatchFinderMode_e useRowMatchFinder, + ZSTD_paramSwitch_e useRowMatchFinder, void const* src, size_t srcSize) { const ZSTD_compressionParameters* const cParams = &ms->cParams; diff --git a/lib/compress/zstd_ldm.h b/lib/compress/zstd_ldm.h index 393466fa9..4e68dbf52 100644 --- a/lib/compress/zstd_ldm.h +++ b/lib/compress/zstd_ldm.h @@ -66,7 +66,7 @@ size_t ZSTD_ldm_generateSequences( */ size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore, ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - ZSTD_useRowMatchFinderMode_e useRowMatchFinder, + ZSTD_paramSwitch_e useRowMatchFinder, void const* src, size_t srcSize); /** diff --git a/lib/compress/zstd_opt.c b/lib/compress/zstd_opt.c index 9b4b236c0..40c25daa1 100644 --- a/lib/compress/zstd_opt.c +++ b/lib/compress/zstd_opt.c @@ -65,7 +65,7 @@ MEM_STATIC double ZSTD_fCost(U32 price) static int ZSTD_compressedLiterals(optState_t const* const optPtr) { - return optPtr->literalCompressionMode != ZSTD_lcm_uncompressed; + return optPtr->literalCompressionMode != ZSTD_ps_disable; } static void ZSTD_setBasePrices(optState_t* optPtr, int optLevel) diff --git a/lib/zstd.h b/lib/zstd.h index ebe2e04b5..2cbb1ddf7 100644 --- a/lib/zstd.h +++ b/lib/zstd.h @@ -417,7 +417,7 @@ typedef enum { * ZSTD_c_stableOutBuffer * ZSTD_c_blockDelimiters * ZSTD_c_validateSequences - * ZSTD_c_splitBlocks + * ZSTD_c_useBlockSplitter * ZSTD_c_useRowMatchFinder * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them. * note : never ever use experimentalParam? names directly; @@ -1299,10 +1299,14 @@ typedef enum { } ZSTD_literalCompressionMode_e; typedef enum { - ZSTD_urm_auto = 0, /* Automatically determine whether or not we use row matchfinder */ - ZSTD_urm_disableRowMatchFinder = 1, /* Never use row matchfinder */ - ZSTD_urm_enableRowMatchFinder = 2 /* Always use row matchfinder when applicable */ -} ZSTD_useRowMatchFinderMode_e; + /* Note: This enum controls features which are conditionally beneficial. Zstd typically will make a final + * decision on whether or not to enable the feature (ZSTD_ps_auto), but setting the switch to ZSTD_ps_enable + * or ZSTD_ps_disable allow for a force enable/disable the feature. + */ + ZSTD_ps_auto = 0, /* Let the library automatically determine whether the feature shall be enabled */ + ZSTD_ps_enable = 1, /* Force-enable the feature */ + ZSTD_ps_disable = 2 /* Do not use the feature */ +} ZSTD_paramSwitch_e; /*************************************** * Frame size functions @@ -1729,9 +1733,15 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* pre * See the comments on that enum for an explanation of the feature. */ #define ZSTD_c_forceAttachDict ZSTD_c_experimentalParam4 -/* Controls how the literals are compressed (default is auto). - * The value must be of type ZSTD_literalCompressionMode_e. - * See ZSTD_literalCompressionMode_e enum definition for details. +/* Controlled with ZSTD_paramSwitch_e enum. + * Default is ZSTD_ps_auto. + * Set to ZSTD_ps_disable to never compress literals. + * Set to ZSTD_ps_enable to always compress literals. (Note: uncompressed literals + * may still be emitted if huffman is not beneficial to use.) + * + * By default, in ZSTD_ps_auto, the library will decide at runtime whether to use + * literals compression based on the compression parameters - specifically, + * negative compression levels do not use literal compression. */ #define ZSTD_c_literalCompressionMode ZSTD_c_experimentalParam5 @@ -1883,23 +1893,26 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* pre */ #define ZSTD_c_validateSequences ZSTD_c_experimentalParam12 -/* ZSTD_c_splitBlocks - * Default is 0 == disabled. Set to 1 to enable block splitting. +/* ZSTD_c_useBlockSplitter + * Controlled with ZSTD_paramSwitch_e enum. + * Default is ZSTD_ps_auto. + * Set to ZSTD_ps_disable to never use block splitter. + * Set to ZSTD_ps_enable to always use block splitter. * - * Will attempt to split blocks in order to improve compression ratio at the cost of speed. + * By default, in ZSTD_ps_auto, the library will decide at runtime whether to use + * block splitting based on the compression parameters. */ -#define ZSTD_c_splitBlocks ZSTD_c_experimentalParam13 +#define ZSTD_c_useBlockSplitter ZSTD_c_experimentalParam13 /* ZSTD_c_useRowMatchFinder - * Default is ZSTD_urm_auto. - * Controlled with ZSTD_useRowMatchFinderMode_e enum. + * Controlled with ZSTD_paramSwitch_e enum. + * Default is ZSTD_ps_auto. + * Set to ZSTD_ps_disable to never use row-based matchfinder. + * Set to ZSTD_ps_enable to force usage of row-based matchfinder. * - * By default, in ZSTD_urm_auto, when finalizing the compression parameters, the library - * will decide at runtime whether to use the row-based matchfinder based on support for SIMD - * instructions as well as the windowLog. - * - * Set to ZSTD_urm_disableRowMatchFinder to never use row-based matchfinder. - * Set to ZSTD_urm_enableRowMatchFinder to force usage of row-based matchfinder. + * By default, in ZSTD_ps_auto, the library will decide at runtime whether to use + * the row-based matchfinder based on support for SIMD instructions and the window log. + * Note that this only pertains to compression strategies: greedy, lazy, and lazy2 */ #define ZSTD_c_useRowMatchFinder ZSTD_c_experimentalParam14 diff --git a/programs/benchzstd.c b/programs/benchzstd.c index 5cfe624b0..09035ea45 100644 --- a/programs/benchzstd.c +++ b/programs/benchzstd.c @@ -131,7 +131,7 @@ BMK_advancedParams_t BMK_initAdvancedParams(void) { 0, /* ldmHashLog */ 0, /* ldmBuckSizeLog */ 0, /* ldmHashRateLog */ - ZSTD_lcm_auto, /* literalCompressionMode */ + ZSTD_ps_auto, /* literalCompressionMode */ 0 /* useRowMatchFinder */ }; return res; diff --git a/programs/benchzstd.h b/programs/benchzstd.h index 9b40dcc29..11ac85da7 100644 --- a/programs/benchzstd.h +++ b/programs/benchzstd.h @@ -116,7 +116,7 @@ typedef struct { int ldmHashLog; int ldmBucketSizeLog; int ldmHashRateLog; - ZSTD_literalCompressionMode_e literalCompressionMode; + ZSTD_paramSwitch_e literalCompressionMode; int useRowMatchFinder; /* use row-based matchfinder if possible */ } BMK_advancedParams_t; diff --git a/programs/fileio.c b/programs/fileio.c index 317ec87e0..db64ecb64 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -320,7 +320,7 @@ struct FIO_prefs_s { size_t targetCBlockSize; int srcSizeHint; int testMode; - ZSTD_literalCompressionMode_e literalCompressionMode; + ZSTD_paramSwitch_e literalCompressionMode; /* IO preferences */ U32 removeSrcFile; @@ -392,7 +392,7 @@ FIO_prefs_t* FIO_createPreferences(void) ret->targetCBlockSize = 0; ret->srcSizeHint = 0; ret->testMode = 0; - ret->literalCompressionMode = ZSTD_lcm_auto; + ret->literalCompressionMode = ZSTD_ps_auto; ret->excludeCompressedFiles = 0; ret->allowBlockDevices = 0; return ret; @@ -510,7 +510,7 @@ void FIO_setTestMode(FIO_prefs_t* const prefs, int testMode) { void FIO_setLiteralCompressionMode( FIO_prefs_t* const prefs, - ZSTD_literalCompressionMode_e mode) { + ZSTD_paramSwitch_e mode) { prefs->literalCompressionMode = mode; } diff --git a/programs/fileio.h b/programs/fileio.h index 9d97ec8bf..82d5bc849 100644 --- a/programs/fileio.h +++ b/programs/fileio.h @@ -100,7 +100,7 @@ void FIO_setSrcSizeHint(FIO_prefs_t* const prefs, size_t srcSizeHint); void FIO_setTestMode(FIO_prefs_t* const prefs, int testMode); void FIO_setLiteralCompressionMode( FIO_prefs_t* const prefs, - ZSTD_literalCompressionMode_e mode); + ZSTD_paramSwitch_e mode); void FIO_setProgressSetting(FIO_progressSetting_e progressSetting); void FIO_setNotificationLevel(int level); diff --git a/programs/zstdcli.c b/programs/zstdcli.c index 9178a4bef..7e4f530f8 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -804,7 +804,7 @@ int main(int argCount, const char* argv[]) #ifndef ZSTD_NOBENCH BMK_advancedParams_t benchParams = BMK_initAdvancedParams(); #endif - ZSTD_literalCompressionMode_e literalCompressionMode = ZSTD_lcm_auto; + ZSTD_paramSwitch_e literalCompressionMode = ZSTD_ps_auto; /* init */ @@ -900,8 +900,8 @@ int main(int argCount, const char* argv[]) if (!strcmp(argument, "--format=lz4")) { suffix = LZ4_EXTENSION; FIO_setCompressionType(prefs, FIO_lz4Compression); continue; } #endif if (!strcmp(argument, "--rsyncable")) { rsyncable = 1; continue; } - if (!strcmp(argument, "--compress-literals")) { literalCompressionMode = ZSTD_lcm_huffman; continue; } - if (!strcmp(argument, "--no-compress-literals")) { literalCompressionMode = ZSTD_lcm_uncompressed; continue; } + if (!strcmp(argument, "--compress-literals")) { literalCompressionMode = ZSTD_ps_enable; continue; } + if (!strcmp(argument, "--no-compress-literals")) { literalCompressionMode = ZSTD_ps_disable; continue; } if (!strcmp(argument, "--no-progress")) { FIO_setProgressSetting(FIO_ps_never); continue; } if (!strcmp(argument, "--progress")) { FIO_setProgressSetting(FIO_ps_always); continue; } if (!strcmp(argument, "--exclude-compressed")) { FIO_setExcludeCompressedFile(prefs, 1); continue; } diff --git a/tests/fuzz/zstd_helpers.c b/tests/fuzz/zstd_helpers.c index 4d889deeb..0fbf3bed7 100644 --- a/tests/fuzz/zstd_helpers.c +++ b/tests/fuzz/zstd_helpers.c @@ -96,7 +96,7 @@ void FUZZ_setRandomParameters(ZSTD_CCtx *cctx, size_t srcSize, FUZZ_dataProducer setRand(cctx, ZSTD_c_forceMaxWindow, 0, 1, producer); setRand(cctx, ZSTD_c_literalCompressionMode, 0, 2, producer); setRand(cctx, ZSTD_c_forceAttachDict, 0, 2, producer); - setRand(cctx, ZSTD_c_splitBlocks, 0, 1, producer); + setRand(cctx, ZSTD_c_useBlockSplitter, 0, 2, producer); setRand(cctx, ZSTD_c_deterministicRefPrefix, 0, 1, producer); if (FUZZ_dataProducer_uint32Range(producer, 0, 1) == 0) { setRand(cctx, ZSTD_c_srcSizeHint, ZSTD_SRCSIZEHINT_MIN, 2 * srcSize, producer); diff --git a/tests/fuzzer.c b/tests/fuzzer.c index c4de54247..9be7a38ab 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -1718,7 +1718,7 @@ static int basicUnitTests(U32 const seed, double compressibility) DISPLAYLEVEL(3, "test%3i : compress with block splitting : ", testNb++) { ZSTD_CCtx* cctx = ZSTD_createCCtx(); - CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_splitBlocks, 1) ); + CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_useBlockSplitter, ZSTD_ps_enable) ); cSize = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize); CHECK(cSize); ZSTD_freeCCtx(cctx); @@ -1732,7 +1732,7 @@ static int basicUnitTests(U32 const seed, double compressibility) CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 2) ); cSize1 = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize); CHECK(cSize1); - CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_literalCompressionMode, ZSTD_lcm_uncompressed) ); + CHECK( ZSTD_CCtx_setParameter(cctx, ZSTD_c_literalCompressionMode, ZSTD_ps_disable) ); cSize2 = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize); CHECK(cSize2); CHECK_LT(cSize1, cSize2); @@ -2019,7 +2019,7 @@ static int basicUnitTests(U32 const seed, double compressibility) ZSTD_CCtx* const cctx = ZSTD_createCCtx(); size_t nodict_cSize; ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, l); - ZSTD_CCtx_setParameter(cctx, ZSTD_c_useRowMatchFinder, ZSTD_urm_enableRowMatchFinder); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_useRowMatchFinder, ZSTD_ps_enable); nodict_cSize = ZSTD_compress2(cctx, compressedBuffer, compressedBufferSize, contentStart, contentSize); if (nodict_cSize > target_nodict_cSize[l]) { diff --git a/tests/regression/config.c b/tests/regression/config.c index 4c66dd150..57cd110c6 100644 --- a/tests/regression/config.c +++ b/tests/regression/config.c @@ -215,7 +215,7 @@ static config_t mt_ldm = { static param_value_t mt_advanced_param_values[] = { {.param = ZSTD_c_nbWorkers, .value = 2}, - {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_lcm_uncompressed}, + {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_ps_disable}, }; static config_t mt_advanced = { @@ -258,7 +258,7 @@ static config_t small_clog = { static param_value_t const uncompressed_literals_param_values[] = { {.param = ZSTD_c_compressionLevel, .value = 3}, - {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_lcm_uncompressed}, + {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_ps_disable}, }; static config_t uncompressed_literals = { @@ -269,7 +269,7 @@ static config_t uncompressed_literals = { static param_value_t const uncompressed_literals_opt_param_values[] = { {.param = ZSTD_c_compressionLevel, .value = 19}, - {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_lcm_uncompressed}, + {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_ps_disable}, }; static config_t uncompressed_literals_opt = { @@ -280,7 +280,7 @@ static config_t uncompressed_literals_opt = { static param_value_t const huffman_literals_param_values[] = { {.param = ZSTD_c_compressionLevel, .value = -1}, - {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_lcm_huffman}, + {.param = ZSTD_c_literalCompressionMode, .value = ZSTD_ps_enable}, }; static config_t huffman_literals = { diff --git a/tests/regression/levels.h b/tests/regression/levels.h index 5a933c133..e98209d80 100644 --- a/tests/regression/levels.h +++ b/tests/regression/levels.h @@ -36,7 +36,7 @@ LEVEL(3) LEVEL(4) /* ROW_LEVEL triggers the row hash (force enabled and disabled) with different * dictionary strategies, and 16/32/64 row entries based on the level/searchLog. - * 1 == disabled, 2 == enabled. + * 1 == enabled, 2 == disabled. */ ROW_LEVEL(5, 1) ROW_LEVEL(5, 2) /* 16-entry rows */ diff --git a/tests/regression/results.csv b/tests/regression/results.csv index 9909a15a0..923b4498b 100644 --- a/tests/regression/results.csv +++ b/tests/regression/results.csv @@ -235,18 +235,18 @@ silesia, level 0, advanced silesia, level 1, advanced one pass, 5309098 silesia, level 3, advanced one pass, 4849553 silesia, level 4, advanced one pass, 4786968 -silesia, level 5 row 1, advanced one pass, 4640752 -silesia, level 5 row 2, advanced one pass, 4638961 +silesia, level 5 row 1, advanced one pass, 4638961 +silesia, level 5 row 2, advanced one pass, 4640752 silesia, level 5, advanced one pass, 4638961 silesia, level 6, advanced one pass, 4605369 -silesia, level 7 row 1, advanced one pass, 4564868 -silesia, level 7 row 2, advanced one pass, 4567204 +silesia, level 7 row 1, advanced one pass, 4567204 +silesia, level 7 row 2, advanced one pass, 4564868 silesia, level 7, advanced one pass, 4567204 silesia, level 9, advanced one pass, 4543310 -silesia, level 11 row 1, advanced one pass, 4519288 -silesia, level 11 row 2, advanced one pass, 4521399 -silesia, level 12 row 1, advanced one pass, 4503116 -silesia, level 12 row 2, advanced one pass, 4505153 +silesia, level 11 row 1, advanced one pass, 4521399 +silesia, level 11 row 2, advanced one pass, 4519288 +silesia, level 12 row 1, advanced one pass, 4505153 +silesia, level 12 row 2, advanced one pass, 4503116 silesia, level 13, advanced one pass, 4493990 silesia, level 16, advanced one pass, 4359864 silesia, level 19, advanced one pass, 4296880 @@ -269,18 +269,18 @@ silesia.tar, level 0, advanced silesia.tar, level 1, advanced one pass, 5331946 silesia.tar, level 3, advanced one pass, 4861424 silesia.tar, level 4, advanced one pass, 4799632 -silesia.tar, level 5 row 1, advanced one pass, 4652862 -silesia.tar, level 5 row 2, advanced one pass, 4650202 +silesia.tar, level 5 row 1, advanced one pass, 4650202 +silesia.tar, level 5 row 2, advanced one pass, 4652862 silesia.tar, level 5, advanced one pass, 4650202 silesia.tar, level 6, advanced one pass, 4616811 -silesia.tar, level 7 row 1, advanced one pass, 4575393 -silesia.tar, level 7 row 2, advanced one pass, 4576829 +silesia.tar, level 7 row 1, advanced one pass, 4576829 +silesia.tar, level 7 row 2, advanced one pass, 4575393 silesia.tar, level 7, advanced one pass, 4576829 silesia.tar, level 9, advanced one pass, 4552584 -silesia.tar, level 11 row 1, advanced one pass, 4529461 -silesia.tar, level 11 row 2, advanced one pass, 4530256 -silesia.tar, level 12 row 1, advanced one pass, 4513604 -silesia.tar, level 12 row 2, advanced one pass, 4514568 +silesia.tar, level 11 row 1, advanced one pass, 4530256 +silesia.tar, level 11 row 2, advanced one pass, 4529461 +silesia.tar, level 12 row 1, advanced one pass, 4514568 +silesia.tar, level 12 row 2, advanced one pass, 4513604 silesia.tar, level 13, advanced one pass, 4502956 silesia.tar, level 16, advanced one pass, 4360527 silesia.tar, level 19, advanced one pass, 4267266 @@ -326,16 +326,16 @@ github, level 4 with dict dms, advanced github, level 4 with dict dds, advanced one pass, 41251 github, level 4 with dict copy, advanced one pass, 41216 github, level 4 with dict load, advanced one pass, 41159 -github, level 5 row 1, advanced one pass, 135121 -github, level 5 row 1 with dict dms, advanced one pass, 38938 -github, level 5 row 1 with dict dds, advanced one pass, 38732 -github, level 5 row 1 with dict copy, advanced one pass, 38934 -github, level 5 row 1 with dict load, advanced one pass, 40725 -github, level 5 row 2, advanced one pass, 134584 -github, level 5 row 2 with dict dms, advanced one pass, 38758 -github, level 5 row 2 with dict dds, advanced one pass, 38728 -github, level 5 row 2 with dict copy, advanced one pass, 38759 -github, level 5 row 2 with dict load, advanced one pass, 41518 +github, level 5 row 1, advanced one pass, 134584 +github, level 5 row 1 with dict dms, advanced one pass, 38758 +github, level 5 row 1 with dict dds, advanced one pass, 38728 +github, level 5 row 1 with dict copy, advanced one pass, 38759 +github, level 5 row 1 with dict load, advanced one pass, 41518 +github, level 5 row 2, advanced one pass, 135121 +github, level 5 row 2 with dict dms, advanced one pass, 38938 +github, level 5 row 2 with dict dds, advanced one pass, 38732 +github, level 5 row 2 with dict copy, advanced one pass, 38934 +github, level 5 row 2 with dict load, advanced one pass, 40725 github, level 5, advanced one pass, 135121 github, level 5 with dict, advanced one pass, 38758 github, level 5 with dict dms, advanced one pass, 38758 @@ -348,16 +348,16 @@ github, level 6 with dict dms, advanced github, level 6 with dict dds, advanced one pass, 38636 github, level 6 with dict copy, advanced one pass, 38669 github, level 6 with dict load, advanced one pass, 40695 -github, level 7 row 1, advanced one pass, 135122 -github, level 7 row 1 with dict dms, advanced one pass, 38860 -github, level 7 row 1 with dict dds, advanced one pass, 38766 -github, level 7 row 1 with dict copy, advanced one pass, 38834 -github, level 7 row 1 with dict load, advanced one pass, 40695 -github, level 7 row 2, advanced one pass, 134584 -github, level 7 row 2 with dict dms, advanced one pass, 38758 -github, level 7 row 2 with dict dds, advanced one pass, 38745 -github, level 7 row 2 with dict copy, advanced one pass, 38755 -github, level 7 row 2 with dict load, advanced one pass, 43154 +github, level 7 row 1, advanced one pass, 134584 +github, level 7 row 1 with dict dms, advanced one pass, 38758 +github, level 7 row 1 with dict dds, advanced one pass, 38745 +github, level 7 row 1 with dict copy, advanced one pass, 38755 +github, level 7 row 1 with dict load, advanced one pass, 43154 +github, level 7 row 2, advanced one pass, 135122 +github, level 7 row 2 with dict dms, advanced one pass, 38860 +github, level 7 row 2 with dict dds, advanced one pass, 38766 +github, level 7 row 2 with dict copy, advanced one pass, 38834 +github, level 7 row 2 with dict load, advanced one pass, 40695 github, level 7, advanced one pass, 135122 github, level 7 with dict, advanced one pass, 38758 github, level 7 with dict dms, advanced one pass, 38758 @@ -451,16 +451,16 @@ github.tar, level 4 with dict dms, advanced github.tar, level 4 with dict dds, advanced one pass, 37954 github.tar, level 4 with dict copy, advanced one pass, 37948 github.tar, level 4 with dict load, advanced one pass, 37927 -github.tar, level 5 row 1, advanced one pass, 38534 -github.tar, level 5 row 1 with dict dms, advanced one pass, 39365 -github.tar, level 5 row 1 with dict dds, advanced one pass, 39233 -github.tar, level 5 row 1 with dict copy, advanced one pass, 39715 -github.tar, level 5 row 1 with dict load, advanced one pass, 38019 -github.tar, level 5 row 2, advanced one pass, 38376 -github.tar, level 5 row 2 with dict dms, advanced one pass, 39024 -github.tar, level 5 row 2 with dict dds, advanced one pass, 39028 -github.tar, level 5 row 2 with dict copy, advanced one pass, 39040 -github.tar, level 5 row 2 with dict load, advanced one pass, 37600 +github.tar, level 5 row 1, advanced one pass, 38376 +github.tar, level 5 row 1 with dict dms, advanced one pass, 39024 +github.tar, level 5 row 1 with dict dds, advanced one pass, 39028 +github.tar, level 5 row 1 with dict copy, advanced one pass, 39040 +github.tar, level 5 row 1 with dict load, advanced one pass, 37600 +github.tar, level 5 row 2, advanced one pass, 38534 +github.tar, level 5 row 2 with dict dms, advanced one pass, 39365 +github.tar, level 5 row 2 with dict dds, advanced one pass, 39233 +github.tar, level 5 row 2 with dict copy, advanced one pass, 39715 +github.tar, level 5 row 2 with dict load, advanced one pass, 38019 github.tar, level 5, advanced one pass, 38376 github.tar, level 5 with dict, advanced one pass, 39040 github.tar, level 5 with dict dms, advanced one pass, 39024 @@ -473,16 +473,16 @@ github.tar, level 6 with dict dms, advanced github.tar, level 6 with dict dds, advanced one pass, 38610 github.tar, level 6 with dict copy, advanced one pass, 38622 github.tar, level 6 with dict load, advanced one pass, 37829 -github.tar, level 7 row 1, advanced one pass, 38077 -github.tar, level 7 row 1 with dict dms, advanced one pass, 38012 -github.tar, level 7 row 1 with dict dds, advanced one pass, 38014 -github.tar, level 7 row 1 with dict copy, advanced one pass, 38101 -github.tar, level 7 row 1 with dict load, advanced one pass, 37402 -github.tar, level 7 row 2, advanced one pass, 38073 -github.tar, level 7 row 2 with dict dms, advanced one pass, 37848 -github.tar, level 7 row 2 with dict dds, advanced one pass, 37869 -github.tar, level 7 row 2 with dict copy, advanced one pass, 37848 -github.tar, level 7 row 2 with dict load, advanced one pass, 37371 +github.tar, level 7 row 1, advanced one pass, 38073 +github.tar, level 7 row 1 with dict dms, advanced one pass, 37848 +github.tar, level 7 row 1 with dict dds, advanced one pass, 37869 +github.tar, level 7 row 1 with dict copy, advanced one pass, 37848 +github.tar, level 7 row 1 with dict load, advanced one pass, 37371 +github.tar, level 7 row 2, advanced one pass, 38077 +github.tar, level 7 row 2 with dict dms, advanced one pass, 38012 +github.tar, level 7 row 2 with dict dds, advanced one pass, 38014 +github.tar, level 7 row 2 with dict copy, advanced one pass, 38101 +github.tar, level 7 row 2 with dict load, advanced one pass, 37402 github.tar, level 7, advanced one pass, 38073 github.tar, level 7 with dict, advanced one pass, 37848 github.tar, level 7 with dict dms, advanced one pass, 37848 @@ -499,22 +499,22 @@ github.tar, level 11 row 1, advanced github.tar, level 11 row 1 with dict dms, advanced one pass, 36963 github.tar, level 11 row 1 with dict dds, advanced one pass, 36963 github.tar, level 11 row 1 with dict copy, advanced one pass, 36557 -github.tar, level 11 row 1 with dict load, advanced one pass, 36419 +github.tar, level 11 row 1 with dict load, advanced one pass, 36424 github.tar, level 11 row 2, advanced one pass, 36435 github.tar, level 11 row 2 with dict dms, advanced one pass, 36963 github.tar, level 11 row 2 with dict dds, advanced one pass, 36963 github.tar, level 11 row 2 with dict copy, advanced one pass, 36557 -github.tar, level 11 row 2 with dict load, advanced one pass, 36424 -github.tar, level 12 row 1, advanced one pass, 36110 +github.tar, level 11 row 2 with dict load, advanced one pass, 36419 +github.tar, level 12 row 1, advanced one pass, 36105 github.tar, level 12 row 1 with dict dms, advanced one pass, 36986 github.tar, level 12 row 1 with dict dds, advanced one pass, 36986 github.tar, level 12 row 1 with dict copy, advanced one pass, 36609 -github.tar, level 12 row 1 with dict load, advanced one pass, 36459 -github.tar, level 12 row 2, advanced one pass, 36105 +github.tar, level 12 row 1 with dict load, advanced one pass, 36460 +github.tar, level 12 row 2, advanced one pass, 36110 github.tar, level 12 row 2 with dict dms, advanced one pass, 36986 github.tar, level 12 row 2 with dict dds, advanced one pass, 36986 github.tar, level 12 row 2 with dict copy, advanced one pass, 36609 -github.tar, level 12 row 2 with dict load, advanced one pass, 36460 +github.tar, level 12 row 2 with dict load, advanced one pass, 36459 github.tar, level 13, advanced one pass, 35501 github.tar, level 13 with dict, advanced one pass, 37130 github.tar, level 13 with dict dms, advanced one pass, 37267 @@ -553,18 +553,18 @@ silesia, level 0, advanced silesia, level 1, advanced one pass small out, 5309098 silesia, level 3, advanced one pass small out, 4849553 silesia, level 4, advanced one pass small out, 4786968 -silesia, level 5 row 1, advanced one pass small out, 4640752 -silesia, level 5 row 2, advanced one pass small out, 4638961 +silesia, level 5 row 1, advanced one pass small out, 4638961 +silesia, level 5 row 2, advanced one pass small out, 4640752 silesia, level 5, advanced one pass small out, 4638961 silesia, level 6, advanced one pass small out, 4605369 -silesia, level 7 row 1, advanced one pass small out, 4564868 -silesia, level 7 row 2, advanced one pass small out, 4567204 +silesia, level 7 row 1, advanced one pass small out, 4567204 +silesia, level 7 row 2, advanced one pass small out, 4564868 silesia, level 7, advanced one pass small out, 4567204 silesia, level 9, advanced one pass small out, 4543310 -silesia, level 11 row 1, advanced one pass small out, 4519288 -silesia, level 11 row 2, advanced one pass small out, 4521399 -silesia, level 12 row 1, advanced one pass small out, 4503116 -silesia, level 12 row 2, advanced one pass small out, 4505153 +silesia, level 11 row 1, advanced one pass small out, 4521399 +silesia, level 11 row 2, advanced one pass small out, 4519288 +silesia, level 12 row 1, advanced one pass small out, 4505153 +silesia, level 12 row 2, advanced one pass small out, 4503116 silesia, level 13, advanced one pass small out, 4493990 silesia, level 16, advanced one pass small out, 4359864 silesia, level 19, advanced one pass small out, 4296880 @@ -587,18 +587,18 @@ silesia.tar, level 0, advanced silesia.tar, level 1, advanced one pass small out, 5331946 silesia.tar, level 3, advanced one pass small out, 4861424 silesia.tar, level 4, advanced one pass small out, 4799632 -silesia.tar, level 5 row 1, advanced one pass small out, 4652862 -silesia.tar, level 5 row 2, advanced one pass small out, 4650202 +silesia.tar, level 5 row 1, advanced one pass small out, 4650202 +silesia.tar, level 5 row 2, advanced one pass small out, 4652862 silesia.tar, level 5, advanced one pass small out, 4650202 silesia.tar, level 6, advanced one pass small out, 4616811 -silesia.tar, level 7 row 1, advanced one pass small out, 4575393 -silesia.tar, level 7 row 2, advanced one pass small out, 4576829 +silesia.tar, level 7 row 1, advanced one pass small out, 4576829 +silesia.tar, level 7 row 2, advanced one pass small out, 4575393 silesia.tar, level 7, advanced one pass small out, 4576829 silesia.tar, level 9, advanced one pass small out, 4552584 -silesia.tar, level 11 row 1, advanced one pass small out, 4529461 -silesia.tar, level 11 row 2, advanced one pass small out, 4530256 -silesia.tar, level 12 row 1, advanced one pass small out, 4513604 -silesia.tar, level 12 row 2, advanced one pass small out, 4514568 +silesia.tar, level 11 row 1, advanced one pass small out, 4530256 +silesia.tar, level 11 row 2, advanced one pass small out, 4529461 +silesia.tar, level 12 row 1, advanced one pass small out, 4514568 +silesia.tar, level 12 row 2, advanced one pass small out, 4513604 silesia.tar, level 13, advanced one pass small out, 4502956 silesia.tar, level 16, advanced one pass small out, 4360527 silesia.tar, level 19, advanced one pass small out, 4267266 @@ -644,16 +644,16 @@ github, level 4 with dict dms, advanced github, level 4 with dict dds, advanced one pass small out, 41251 github, level 4 with dict copy, advanced one pass small out, 41216 github, level 4 with dict load, advanced one pass small out, 41159 -github, level 5 row 1, advanced one pass small out, 135121 -github, level 5 row 1 with dict dms, advanced one pass small out, 38938 -github, level 5 row 1 with dict dds, advanced one pass small out, 38732 -github, level 5 row 1 with dict copy, advanced one pass small out, 38934 -github, level 5 row 1 with dict load, advanced one pass small out, 40725 -github, level 5 row 2, advanced one pass small out, 134584 -github, level 5 row 2 with dict dms, advanced one pass small out, 38758 -github, level 5 row 2 with dict dds, advanced one pass small out, 38728 -github, level 5 row 2 with dict copy, advanced one pass small out, 38759 -github, level 5 row 2 with dict load, advanced one pass small out, 41518 +github, level 5 row 1, advanced one pass small out, 134584 +github, level 5 row 1 with dict dms, advanced one pass small out, 38758 +github, level 5 row 1 with dict dds, advanced one pass small out, 38728 +github, level 5 row 1 with dict copy, advanced one pass small out, 38759 +github, level 5 row 1 with dict load, advanced one pass small out, 41518 +github, level 5 row 2, advanced one pass small out, 135121 +github, level 5 row 2 with dict dms, advanced one pass small out, 38938 +github, level 5 row 2 with dict dds, advanced one pass small out, 38732 +github, level 5 row 2 with dict copy, advanced one pass small out, 38934 +github, level 5 row 2 with dict load, advanced one pass small out, 40725 github, level 5, advanced one pass small out, 135121 github, level 5 with dict, advanced one pass small out, 38758 github, level 5 with dict dms, advanced one pass small out, 38758 @@ -666,16 +666,16 @@ github, level 6 with dict dms, advanced github, level 6 with dict dds, advanced one pass small out, 38636 github, level 6 with dict copy, advanced one pass small out, 38669 github, level 6 with dict load, advanced one pass small out, 40695 -github, level 7 row 1, advanced one pass small out, 135122 -github, level 7 row 1 with dict dms, advanced one pass small out, 38860 -github, level 7 row 1 with dict dds, advanced one pass small out, 38766 -github, level 7 row 1 with dict copy, advanced one pass small out, 38834 -github, level 7 row 1 with dict load, advanced one pass small out, 40695 -github, level 7 row 2, advanced one pass small out, 134584 -github, level 7 row 2 with dict dms, advanced one pass small out, 38758 -github, level 7 row 2 with dict dds, advanced one pass small out, 38745 -github, level 7 row 2 with dict copy, advanced one pass small out, 38755 -github, level 7 row 2 with dict load, advanced one pass small out, 43154 +github, level 7 row 1, advanced one pass small out, 134584 +github, level 7 row 1 with dict dms, advanced one pass small out, 38758 +github, level 7 row 1 with dict dds, advanced one pass small out, 38745 +github, level 7 row 1 with dict copy, advanced one pass small out, 38755 +github, level 7 row 1 with dict load, advanced one pass small out, 43154 +github, level 7 row 2, advanced one pass small out, 135122 +github, level 7 row 2 with dict dms, advanced one pass small out, 38860 +github, level 7 row 2 with dict dds, advanced one pass small out, 38766 +github, level 7 row 2 with dict copy, advanced one pass small out, 38834 +github, level 7 row 2 with dict load, advanced one pass small out, 40695 github, level 7, advanced one pass small out, 135122 github, level 7 with dict, advanced one pass small out, 38758 github, level 7 with dict dms, advanced one pass small out, 38758 @@ -769,16 +769,16 @@ github.tar, level 4 with dict dms, advanced github.tar, level 4 with dict dds, advanced one pass small out, 37954 github.tar, level 4 with dict copy, advanced one pass small out, 37948 github.tar, level 4 with dict load, advanced one pass small out, 37927 -github.tar, level 5 row 1, advanced one pass small out, 38534 -github.tar, level 5 row 1 with dict dms, advanced one pass small out, 39365 -github.tar, level 5 row 1 with dict dds, advanced one pass small out, 39233 -github.tar, level 5 row 1 with dict copy, advanced one pass small out, 39715 -github.tar, level 5 row 1 with dict load, advanced one pass small out, 38019 -github.tar, level 5 row 2, advanced one pass small out, 38376 -github.tar, level 5 row 2 with dict dms, advanced one pass small out, 39024 -github.tar, level 5 row 2 with dict dds, advanced one pass small out, 39028 -github.tar, level 5 row 2 with dict copy, advanced one pass small out, 39040 -github.tar, level 5 row 2 with dict load, advanced one pass small out, 37600 +github.tar, level 5 row 1, advanced one pass small out, 38376 +github.tar, level 5 row 1 with dict dms, advanced one pass small out, 39024 +github.tar, level 5 row 1 with dict dds, advanced one pass small out, 39028 +github.tar, level 5 row 1 with dict copy, advanced one pass small out, 39040 +github.tar, level 5 row 1 with dict load, advanced one pass small out, 37600 +github.tar, level 5 row 2, advanced one pass small out, 38534 +github.tar, level 5 row 2 with dict dms, advanced one pass small out, 39365 +github.tar, level 5 row 2 with dict dds, advanced one pass small out, 39233 +github.tar, level 5 row 2 with dict copy, advanced one pass small out, 39715 +github.tar, level 5 row 2 with dict load, advanced one pass small out, 38019 github.tar, level 5, advanced one pass small out, 38376 github.tar, level 5 with dict, advanced one pass small out, 39040 github.tar, level 5 with dict dms, advanced one pass small out, 39024 @@ -791,16 +791,16 @@ github.tar, level 6 with dict dms, advanced github.tar, level 6 with dict dds, advanced one pass small out, 38610 github.tar, level 6 with dict copy, advanced one pass small out, 38622 github.tar, level 6 with dict load, advanced one pass small out, 37829 -github.tar, level 7 row 1, advanced one pass small out, 38077 -github.tar, level 7 row 1 with dict dms, advanced one pass small out, 38012 -github.tar, level 7 row 1 with dict dds, advanced one pass small out, 38014 -github.tar, level 7 row 1 with dict copy, advanced one pass small out, 38101 -github.tar, level 7 row 1 with dict load, advanced one pass small out, 37402 -github.tar, level 7 row 2, advanced one pass small out, 38073 -github.tar, level 7 row 2 with dict dms, advanced one pass small out, 37848 -github.tar, level 7 row 2 with dict dds, advanced one pass small out, 37869 -github.tar, level 7 row 2 with dict copy, advanced one pass small out, 37848 -github.tar, level 7 row 2 with dict load, advanced one pass small out, 37371 +github.tar, level 7 row 1, advanced one pass small out, 38073 +github.tar, level 7 row 1 with dict dms, advanced one pass small out, 37848 +github.tar, level 7 row 1 with dict dds, advanced one pass small out, 37869 +github.tar, level 7 row 1 with dict copy, advanced one pass small out, 37848 +github.tar, level 7 row 1 with dict load, advanced one pass small out, 37371 +github.tar, level 7 row 2, advanced one pass small out, 38077 +github.tar, level 7 row 2 with dict dms, advanced one pass small out, 38012 +github.tar, level 7 row 2 with dict dds, advanced one pass small out, 38014 +github.tar, level 7 row 2 with dict copy, advanced one pass small out, 38101 +github.tar, level 7 row 2 with dict load, advanced one pass small out, 37402 github.tar, level 7, advanced one pass small out, 38073 github.tar, level 7 with dict, advanced one pass small out, 37848 github.tar, level 7 with dict dms, advanced one pass small out, 37848 @@ -817,22 +817,22 @@ github.tar, level 11 row 1, advanced github.tar, level 11 row 1 with dict dms, advanced one pass small out, 36963 github.tar, level 11 row 1 with dict dds, advanced one pass small out, 36963 github.tar, level 11 row 1 with dict copy, advanced one pass small out, 36557 -github.tar, level 11 row 1 with dict load, advanced one pass small out, 36419 +github.tar, level 11 row 1 with dict load, advanced one pass small out, 36424 github.tar, level 11 row 2, advanced one pass small out, 36435 github.tar, level 11 row 2 with dict dms, advanced one pass small out, 36963 github.tar, level 11 row 2 with dict dds, advanced one pass small out, 36963 github.tar, level 11 row 2 with dict copy, advanced one pass small out, 36557 -github.tar, level 11 row 2 with dict load, advanced one pass small out, 36424 -github.tar, level 12 row 1, advanced one pass small out, 36110 +github.tar, level 11 row 2 with dict load, advanced one pass small out, 36419 +github.tar, level 12 row 1, advanced one pass small out, 36105 github.tar, level 12 row 1 with dict dms, advanced one pass small out, 36986 github.tar, level 12 row 1 with dict dds, advanced one pass small out, 36986 github.tar, level 12 row 1 with dict copy, advanced one pass small out, 36609 -github.tar, level 12 row 1 with dict load, advanced one pass small out, 36459 -github.tar, level 12 row 2, advanced one pass small out, 36105 +github.tar, level 12 row 1 with dict load, advanced one pass small out, 36460 +github.tar, level 12 row 2, advanced one pass small out, 36110 github.tar, level 12 row 2 with dict dms, advanced one pass small out, 36986 github.tar, level 12 row 2 with dict dds, advanced one pass small out, 36986 github.tar, level 12 row 2 with dict copy, advanced one pass small out, 36609 -github.tar, level 12 row 2 with dict load, advanced one pass small out, 36460 +github.tar, level 12 row 2 with dict load, advanced one pass small out, 36459 github.tar, level 13, advanced one pass small out, 35501 github.tar, level 13 with dict, advanced one pass small out, 37130 github.tar, level 13 with dict dms, advanced one pass small out, 37267 @@ -871,18 +871,18 @@ silesia, level 0, advanced silesia, level 1, advanced streaming, 5312694 silesia, level 3, advanced streaming, 4849553 silesia, level 4, advanced streaming, 4786968 -silesia, level 5 row 1, advanced streaming, 4640752 -silesia, level 5 row 2, advanced streaming, 4638961 +silesia, level 5 row 1, advanced streaming, 4638961 +silesia, level 5 row 2, advanced streaming, 4640752 silesia, level 5, advanced streaming, 4638961 silesia, level 6, advanced streaming, 4605369 -silesia, level 7 row 1, advanced streaming, 4564868 -silesia, level 7 row 2, advanced streaming, 4567204 +silesia, level 7 row 1, advanced streaming, 4567204 +silesia, level 7 row 2, advanced streaming, 4564868 silesia, level 7, advanced streaming, 4567204 silesia, level 9, advanced streaming, 4543310 -silesia, level 11 row 1, advanced streaming, 4519288 -silesia, level 11 row 2, advanced streaming, 4521399 -silesia, level 12 row 1, advanced streaming, 4503116 -silesia, level 12 row 2, advanced streaming, 4505153 +silesia, level 11 row 1, advanced streaming, 4521399 +silesia, level 11 row 2, advanced streaming, 4519288 +silesia, level 12 row 1, advanced streaming, 4505153 +silesia, level 12 row 2, advanced streaming, 4503116 silesia, level 13, advanced streaming, 4493990 silesia, level 16, advanced streaming, 4359864 silesia, level 19, advanced streaming, 4296880 @@ -905,18 +905,18 @@ silesia.tar, level 0, advanced silesia.tar, level 1, advanced streaming, 5334890 silesia.tar, level 3, advanced streaming, 4861426 silesia.tar, level 4, advanced streaming, 4799632 -silesia.tar, level 5 row 1, advanced streaming, 4652866 -silesia.tar, level 5 row 2, advanced streaming, 4650207 +silesia.tar, level 5 row 1, advanced streaming, 4650207 +silesia.tar, level 5 row 2, advanced streaming, 4652866 silesia.tar, level 5, advanced streaming, 4650207 silesia.tar, level 6, advanced streaming, 4616816 -silesia.tar, level 7 row 1, advanced streaming, 4575394 -silesia.tar, level 7 row 2, advanced streaming, 4576831 +silesia.tar, level 7 row 1, advanced streaming, 4576831 +silesia.tar, level 7 row 2, advanced streaming, 4575394 silesia.tar, level 7, advanced streaming, 4576831 silesia.tar, level 9, advanced streaming, 4552590 -silesia.tar, level 11 row 1, advanced streaming, 4529461 -silesia.tar, level 11 row 2, advanced streaming, 4530258 -silesia.tar, level 12 row 1, advanced streaming, 4513604 -silesia.tar, level 12 row 2, advanced streaming, 4514569 +silesia.tar, level 11 row 1, advanced streaming, 4530258 +silesia.tar, level 11 row 2, advanced streaming, 4529461 +silesia.tar, level 12 row 1, advanced streaming, 4514569 +silesia.tar, level 12 row 2, advanced streaming, 4513604 silesia.tar, level 13, advanced streaming, 4502956 silesia.tar, level 16, advanced streaming, 4360527 silesia.tar, level 19, advanced streaming, 4267266 @@ -962,16 +962,16 @@ github, level 4 with dict dms, advanced github, level 4 with dict dds, advanced streaming, 41251 github, level 4 with dict copy, advanced streaming, 41216 github, level 4 with dict load, advanced streaming, 41159 -github, level 5 row 1, advanced streaming, 135121 -github, level 5 row 1 with dict dms, advanced streaming, 38938 -github, level 5 row 1 with dict dds, advanced streaming, 38732 -github, level 5 row 1 with dict copy, advanced streaming, 38934 -github, level 5 row 1 with dict load, advanced streaming, 40725 -github, level 5 row 2, advanced streaming, 134584 -github, level 5 row 2 with dict dms, advanced streaming, 38758 -github, level 5 row 2 with dict dds, advanced streaming, 38728 -github, level 5 row 2 with dict copy, advanced streaming, 38759 -github, level 5 row 2 with dict load, advanced streaming, 41518 +github, level 5 row 1, advanced streaming, 134584 +github, level 5 row 1 with dict dms, advanced streaming, 38758 +github, level 5 row 1 with dict dds, advanced streaming, 38728 +github, level 5 row 1 with dict copy, advanced streaming, 38759 +github, level 5 row 1 with dict load, advanced streaming, 41518 +github, level 5 row 2, advanced streaming, 135121 +github, level 5 row 2 with dict dms, advanced streaming, 38938 +github, level 5 row 2 with dict dds, advanced streaming, 38732 +github, level 5 row 2 with dict copy, advanced streaming, 38934 +github, level 5 row 2 with dict load, advanced streaming, 40725 github, level 5, advanced streaming, 135121 github, level 5 with dict, advanced streaming, 38758 github, level 5 with dict dms, advanced streaming, 38758 @@ -984,16 +984,16 @@ github, level 6 with dict dms, advanced github, level 6 with dict dds, advanced streaming, 38636 github, level 6 with dict copy, advanced streaming, 38669 github, level 6 with dict load, advanced streaming, 40695 -github, level 7 row 1, advanced streaming, 135122 -github, level 7 row 1 with dict dms, advanced streaming, 38860 -github, level 7 row 1 with dict dds, advanced streaming, 38766 -github, level 7 row 1 with dict copy, advanced streaming, 38834 -github, level 7 row 1 with dict load, advanced streaming, 40695 -github, level 7 row 2, advanced streaming, 134584 -github, level 7 row 2 with dict dms, advanced streaming, 38758 -github, level 7 row 2 with dict dds, advanced streaming, 38745 -github, level 7 row 2 with dict copy, advanced streaming, 38755 -github, level 7 row 2 with dict load, advanced streaming, 43154 +github, level 7 row 1, advanced streaming, 134584 +github, level 7 row 1 with dict dms, advanced streaming, 38758 +github, level 7 row 1 with dict dds, advanced streaming, 38745 +github, level 7 row 1 with dict copy, advanced streaming, 38755 +github, level 7 row 1 with dict load, advanced streaming, 43154 +github, level 7 row 2, advanced streaming, 135122 +github, level 7 row 2 with dict dms, advanced streaming, 38860 +github, level 7 row 2 with dict dds, advanced streaming, 38766 +github, level 7 row 2 with dict copy, advanced streaming, 38834 +github, level 7 row 2 with dict load, advanced streaming, 40695 github, level 7, advanced streaming, 135122 github, level 7 with dict, advanced streaming, 38758 github, level 7 with dict dms, advanced streaming, 38758 @@ -1087,16 +1087,16 @@ github.tar, level 4 with dict dms, advanced github.tar, level 4 with dict dds, advanced streaming, 37954 github.tar, level 4 with dict copy, advanced streaming, 37948 github.tar, level 4 with dict load, advanced streaming, 37927 -github.tar, level 5 row 1, advanced streaming, 38534 -github.tar, level 5 row 1 with dict dms, advanced streaming, 39365 -github.tar, level 5 row 1 with dict dds, advanced streaming, 39233 -github.tar, level 5 row 1 with dict copy, advanced streaming, 39715 -github.tar, level 5 row 1 with dict load, advanced streaming, 38019 -github.tar, level 5 row 2, advanced streaming, 38376 -github.tar, level 5 row 2 with dict dms, advanced streaming, 39024 -github.tar, level 5 row 2 with dict dds, advanced streaming, 39028 -github.tar, level 5 row 2 with dict copy, advanced streaming, 39040 -github.tar, level 5 row 2 with dict load, advanced streaming, 37600 +github.tar, level 5 row 1, advanced streaming, 38376 +github.tar, level 5 row 1 with dict dms, advanced streaming, 39024 +github.tar, level 5 row 1 with dict dds, advanced streaming, 39028 +github.tar, level 5 row 1 with dict copy, advanced streaming, 39040 +github.tar, level 5 row 1 with dict load, advanced streaming, 37600 +github.tar, level 5 row 2, advanced streaming, 38534 +github.tar, level 5 row 2 with dict dms, advanced streaming, 39365 +github.tar, level 5 row 2 with dict dds, advanced streaming, 39233 +github.tar, level 5 row 2 with dict copy, advanced streaming, 39715 +github.tar, level 5 row 2 with dict load, advanced streaming, 38019 github.tar, level 5, advanced streaming, 38376 github.tar, level 5 with dict, advanced streaming, 39040 github.tar, level 5 with dict dms, advanced streaming, 39024 @@ -1109,16 +1109,16 @@ github.tar, level 6 with dict dms, advanced github.tar, level 6 with dict dds, advanced streaming, 38610 github.tar, level 6 with dict copy, advanced streaming, 38622 github.tar, level 6 with dict load, advanced streaming, 37829 -github.tar, level 7 row 1, advanced streaming, 38077 -github.tar, level 7 row 1 with dict dms, advanced streaming, 38012 -github.tar, level 7 row 1 with dict dds, advanced streaming, 38014 -github.tar, level 7 row 1 with dict copy, advanced streaming, 38101 -github.tar, level 7 row 1 with dict load, advanced streaming, 37402 -github.tar, level 7 row 2, advanced streaming, 38073 -github.tar, level 7 row 2 with dict dms, advanced streaming, 37848 -github.tar, level 7 row 2 with dict dds, advanced streaming, 37869 -github.tar, level 7 row 2 with dict copy, advanced streaming, 37848 -github.tar, level 7 row 2 with dict load, advanced streaming, 37371 +github.tar, level 7 row 1, advanced streaming, 38073 +github.tar, level 7 row 1 with dict dms, advanced streaming, 37848 +github.tar, level 7 row 1 with dict dds, advanced streaming, 37869 +github.tar, level 7 row 1 with dict copy, advanced streaming, 37848 +github.tar, level 7 row 1 with dict load, advanced streaming, 37371 +github.tar, level 7 row 2, advanced streaming, 38077 +github.tar, level 7 row 2 with dict dms, advanced streaming, 38012 +github.tar, level 7 row 2 with dict dds, advanced streaming, 38014 +github.tar, level 7 row 2 with dict copy, advanced streaming, 38101 +github.tar, level 7 row 2 with dict load, advanced streaming, 37402 github.tar, level 7, advanced streaming, 38073 github.tar, level 7 with dict, advanced streaming, 37848 github.tar, level 7 with dict dms, advanced streaming, 37848 @@ -1135,22 +1135,22 @@ github.tar, level 11 row 1, advanced github.tar, level 11 row 1 with dict dms, advanced streaming, 36963 github.tar, level 11 row 1 with dict dds, advanced streaming, 36963 github.tar, level 11 row 1 with dict copy, advanced streaming, 36557 -github.tar, level 11 row 1 with dict load, advanced streaming, 36419 +github.tar, level 11 row 1 with dict load, advanced streaming, 36424 github.tar, level 11 row 2, advanced streaming, 36435 github.tar, level 11 row 2 with dict dms, advanced streaming, 36963 github.tar, level 11 row 2 with dict dds, advanced streaming, 36963 github.tar, level 11 row 2 with dict copy, advanced streaming, 36557 -github.tar, level 11 row 2 with dict load, advanced streaming, 36424 -github.tar, level 12 row 1, advanced streaming, 36110 +github.tar, level 11 row 2 with dict load, advanced streaming, 36419 +github.tar, level 12 row 1, advanced streaming, 36105 github.tar, level 12 row 1 with dict dms, advanced streaming, 36986 github.tar, level 12 row 1 with dict dds, advanced streaming, 36986 github.tar, level 12 row 1 with dict copy, advanced streaming, 36609 -github.tar, level 12 row 1 with dict load, advanced streaming, 36459 -github.tar, level 12 row 2, advanced streaming, 36105 +github.tar, level 12 row 1 with dict load, advanced streaming, 36460 +github.tar, level 12 row 2, advanced streaming, 36110 github.tar, level 12 row 2 with dict dms, advanced streaming, 36986 github.tar, level 12 row 2 with dict dds, advanced streaming, 36986 github.tar, level 12 row 2 with dict copy, advanced streaming, 36609 -github.tar, level 12 row 2 with dict load, advanced streaming, 36460 +github.tar, level 12 row 2 with dict load, advanced streaming, 36459 github.tar, level 13, advanced streaming, 35501 github.tar, level 13 with dict, advanced streaming, 37130 github.tar, level 13 with dict dms, advanced streaming, 37267 From 06f42c3bfd1b0d3393c7c8d7a1a53e27e167750b Mon Sep 17 00:00:00 2001 From: senhuang42 Date: Tue, 21 Sep 2021 11:56:02 -0400 Subject: [PATCH 07/38] Use new paramSwitch enum for LDM --- lib/compress/zstd_compress.c | 57 ++++++++++++--------------- lib/compress/zstd_compress_internal.h | 2 +- lib/compress/zstd_ldm.c | 4 +- lib/compress/zstdmt_compress.c | 20 +++++----- 4 files changed, 38 insertions(+), 45 deletions(-) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 700f4567f..6ca4784fd 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -272,8 +272,10 @@ static int ZSTD_allocateChainTable(const ZSTD_strategy strategy, * enable long distance matching (wlog >= 27, strategy >= btopt). * Returns 0 otherwise. */ -static U32 ZSTD_CParams_shouldEnableLdm(const ZSTD_compressionParameters* const cParams) { - return cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 27; +static ZSTD_paramSwitch_e ZSTD_resolveEnableLdm(ZSTD_paramSwitch_e mode, + const ZSTD_compressionParameters* const cParams) { + if (mode != ZSTD_ps_auto) return mode; + return (cParams->strategy >= ZSTD_btopt && cParams->windowLog >= 27) ? ZSTD_ps_enable : ZSTD_ps_disable; } static ZSTD_CCtx_params ZSTD_makeCCtxParamsFromCParams( @@ -285,15 +287,12 @@ static ZSTD_CCtx_params ZSTD_makeCCtxParamsFromCParams( cctxParams.cParams = cParams; /* Adjust advanced params according to cParams */ - if (ZSTD_CParams_shouldEnableLdm(&cParams)) { - DEBUGLOG(4, "ZSTD_makeCCtxParamsFromCParams(): Including LDM into cctx params"); - cctxParams.ldmParams.enableLdm = 1; - /* LDM is enabled by default for optimal parser and window size >= 128MB */ + cctxParams.ldmParams.enableLdm = ZSTD_resolveEnableLdm(cctxParams.ldmParams.enableLdm, &cParams); + if (cctxParams.ldmParams.enableLdm == ZSTD_ps_enable) { ZSTD_ldm_adjustParameters(&cctxParams.ldmParams, &cParams); assert(cctxParams.ldmParams.hashLog >= cctxParams.ldmParams.bucketSizeLog); assert(cctxParams.ldmParams.hashRateLog < 32); } - cctxParams.useBlockSplitter = ZSTD_resolveBlockSplitterMode(cctxParams.useBlockSplitter, &cParams); cctxParams.useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(cctxParams.useRowMatchFinder, &cParams); assert(!ZSTD_checkCParams(cParams)); @@ -356,13 +355,9 @@ static void ZSTD_CCtxParams_init_internal(ZSTD_CCtx_params* cctxParams, ZSTD_par cctxParams->compressionLevel = compressionLevel; cctxParams->useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(cctxParams->useRowMatchFinder, ¶ms->cParams); cctxParams->useBlockSplitter = ZSTD_resolveBlockSplitterMode(cctxParams->useBlockSplitter, ¶ms->cParams); - DEBUGLOG(4, "ZSTD_CCtxParams_init_internal: useRowMatchFinder=%d, useBlockSplitter=%d", cctxParams->useRowMatchFinder, cctxParams->useBlockSplitter); - - if (ZSTD_CParams_shouldEnableLdm(¶ms->cParams)) { - /* Enable LDM by default for optimal parser and window size >= 128MB */ - DEBUGLOG(4, "LDM enabled by default (window size >= 128MB, strategy >= btopt)"); - cctxParams->ldmParams.enableLdm = 1; - } + cctxParams->ldmParams.enableLdm = ZSTD_resolveEnableLdm(cctxParams->ldmParams.enableLdm, ¶ms->cParams); + DEBUGLOG(4, "ZSTD_CCtxParams_init_internal: useRowMatchFinder=%d, useBlockSplitter=%d ldm=%d", + cctxParams->useRowMatchFinder, cctxParams->useBlockSplitter, cctxParams->ldmParams.enableLdm); } size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params) @@ -849,7 +844,7 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, return CCtxParams->enableDedicatedDictSearch; case ZSTD_c_enableLongDistanceMatching : - CCtxParams->ldmParams.enableLdm = (value!=0); + CCtxParams->ldmParams.enableLdm = (ZSTD_paramSwitch_e)value; return CCtxParams->ldmParams.enableLdm; case ZSTD_c_ldmHashLog : @@ -1412,7 +1407,7 @@ ZSTD_compressionParameters ZSTD_getCParamsFromCCtxParams( srcSizeHint = CCtxParams->srcSizeHint; } cParams = ZSTD_getCParams_internal(CCtxParams->compressionLevel, srcSizeHint, dictSize, mode); - if (CCtxParams->ldmParams.enableLdm) cParams.windowLog = ZSTD_LDM_DEFAULT_WINDOW_LOG; + if (CCtxParams->ldmParams.enableLdm == ZSTD_ps_enable) cParams.windowLog = ZSTD_LDM_DEFAULT_WINDOW_LOG; ZSTD_overrideCParams(&cParams, &CCtxParams->cParams); assert(!ZSTD_checkCParams(cParams)); /* srcSizeHint == 0 means 0 */ @@ -1483,7 +1478,7 @@ static size_t ZSTD_estimateCCtxSize_usingCCtxParams_internal( size_t const ldmSpace = ZSTD_ldm_getTableSize(*ldmParams); size_t const maxNbLdmSeq = ZSTD_ldm_getMaxNbSeq(*ldmParams, blockSize); - size_t const ldmSeqSpace = ldmParams->enableLdm ? + size_t const ldmSeqSpace = ldmParams->enableLdm == ZSTD_ps_enable ? ZSTD_cwksp_aligned_alloc_size(maxNbLdmSeq * sizeof(rawSeq)) : 0; @@ -1852,7 +1847,8 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, assert(params->useRowMatchFinder != ZSTD_ps_auto); assert(params->useBlockSplitter != ZSTD_ps_auto); - if (params->ldmParams.enableLdm) { + assert(params->ldmParams.enableLdm != ZSTD_ps_auto); + if (params->ldmParams.enableLdm == ZSTD_ps_enable) { /* Adjust long distance matching parameters */ ZSTD_ldm_adjustParameters(&zc->appliedParams.ldmParams, ¶ms->cParams); assert(params->ldmParams.hashLog >= params->ldmParams.bucketSizeLog); @@ -1952,7 +1948,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, zc->outBuff = (char*)ZSTD_cwksp_reserve_buffer(ws, buffOutSize); /* ldm bucketOffsets table */ - if (params->ldmParams.enableLdm) { + if (params->ldmParams.enableLdm == ZSTD_ps_enable) { /* TODO: avoid memset? */ size_t const numBuckets = ((size_t)1) << (params->ldmParams.hashLog - @@ -1979,7 +1975,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, ZSTD_resetTarget_CCtx), ""); /* ldm hash table */ - if (params->ldmParams.enableLdm) { + if (params->ldmParams.enableLdm == ZSTD_ps_enable) { /* TODO: avoid memset? */ size_t const ldmHSize = ((size_t)1) << params->ldmParams.hashLog; zc->ldmState.hashTable = (ldmEntry_t*)ZSTD_cwksp_reserve_aligned(ws, ldmHSize * sizeof(ldmEntry_t)); @@ -2226,8 +2222,10 @@ static size_t ZSTD_copyCCtx_internal(ZSTD_CCtx* dstCCtx, params.cParams = srcCCtx->appliedParams.cParams; assert(srcCCtx->appliedParams.useRowMatchFinder != ZSTD_ps_auto); assert(srcCCtx->appliedParams.useBlockSplitter != ZSTD_ps_auto); + assert(srcCCtx->appliedParams.ldmParams.enableLdm != ZSTD_ps_auto); params.useRowMatchFinder = srcCCtx->appliedParams.useRowMatchFinder; params.useBlockSplitter = srcCCtx->appliedParams.useBlockSplitter; + params.ldmParams = srcCCtx->appliedParams.ldmParams; params.fParams = fParams; ZSTD_resetCCtx_internal(dstCCtx, ¶ms, pledgedSrcSize, /* loadedDictSize */ 0, @@ -2849,7 +2847,7 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) zc->blockState.nextCBlock->rep[i] = zc->blockState.prevCBlock->rep[i]; } if (zc->externSeqStore.pos < zc->externSeqStore.size) { - assert(!zc->appliedParams.ldmParams.enableLdm); + assert(zc->appliedParams.ldmParams.enableLdm == ZSTD_ps_disable); /* Updates ldmSeqStore.pos */ lastLLSize = ZSTD_ldm_blockCompress(&zc->externSeqStore, @@ -2858,7 +2856,7 @@ static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) zc->appliedParams.useRowMatchFinder, src, srcSize); assert(zc->externSeqStore.pos <= zc->externSeqStore.size); - } else if (zc->appliedParams.ldmParams.enableLdm) { + } else if (zc->appliedParams.ldmParams.enableLdm == ZSTD_ps_enable) { rawSeqStore_t ldmSeqStore = kNullRawSeqStore; ldmSeqStore.seq = zc->ldmSequences; @@ -4081,7 +4079,7 @@ size_t ZSTD_referenceExternalSequences(ZSTD_CCtx* cctx, rawSeq* seq, size_t nbSe { RETURN_ERROR_IF(cctx->stage != ZSTDcs_init, stage_wrong, "wrong cctx stage"); - RETURN_ERROR_IF(cctx->appliedParams.ldmParams.enableLdm, + RETURN_ERROR_IF(cctx->appliedParams.ldmParams.enableLdm == ZSTD_ps_enable, parameter_unsupported, "incompatible with ldm"); cctx->externSeqStore.seq = seq; @@ -4122,7 +4120,7 @@ static size_t ZSTD_compressContinue_internal (ZSTD_CCtx* cctx, ms->forceNonContiguous = 0; ms->nextToUpdate = ms->window.dictLimit; } - if (cctx->appliedParams.ldmParams.enableLdm) { + if (cctx->appliedParams.ldmParams.enableLdm == ZSTD_ps_enable) { ZSTD_window_update(&cctx->ldmState.window, src, srcSize, /* forceNonContiguous */ 0); } @@ -4191,7 +4189,7 @@ static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms, { const BYTE* ip = (const BYTE*) src; const BYTE* const iend = ip + srcSize; - int const loadLdmDict = params->ldmParams.enableLdm && ls != NULL; + int const loadLdmDict = params->ldmParams.enableLdm == ZSTD_ps_enable && ls != NULL; /* Assert that we the ms params match the params we're being given */ ZSTD_assertEqualCParams(params->cParams, ms->cParams); @@ -5557,14 +5555,9 @@ static size_t ZSTD_CCtx_init_compressStream2(ZSTD_CCtx* cctx, ¶ms, cctx->pledgedSrcSizePlusOne-1, dictSize, mode); } - - if (ZSTD_CParams_shouldEnableLdm(¶ms.cParams)) { - /* Enable LDM by default for optimal parser and window size >= 128MB */ - DEBUGLOG(4, "LDM enabled by default (window size >= 128MB, strategy >= btopt)"); - params.ldmParams.enableLdm = 1; - } - + params.useBlockSplitter = ZSTD_resolveBlockSplitterMode(params.useBlockSplitter, ¶ms.cParams); + params.ldmParams.enableLdm = ZSTD_resolveEnableLdm(params.ldmParams.enableLdm, ¶ms.cParams); params.useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(params.useRowMatchFinder, ¶ms.cParams); #ifdef ZSTD_MULTITHREAD diff --git a/lib/compress/zstd_compress_internal.h b/lib/compress/zstd_compress_internal.h index c168c67e7..b7772522a 100644 --- a/lib/compress/zstd_compress_internal.h +++ b/lib/compress/zstd_compress_internal.h @@ -266,7 +266,7 @@ typedef struct { } ldmState_t; typedef struct { - U32 enableLdm; /* 1 if enable long distance matching */ + ZSTD_paramSwitch_e enableLdm; /* ZSTD_ps_enable to enable LDM. ZSTD_ps_auto by default */ U32 hashLog; /* Log size of hashTable */ U32 bucketSizeLog; /* Log bucket size for collision resolution, at most 8 */ U32 minMatchLength; /* Minimum match length */ diff --git a/lib/compress/zstd_ldm.c b/lib/compress/zstd_ldm.c index c97b97a03..45eebccec 100644 --- a/lib/compress/zstd_ldm.c +++ b/lib/compress/zstd_ldm.c @@ -159,12 +159,12 @@ size_t ZSTD_ldm_getTableSize(ldmParams_t params) size_t const ldmBucketSize = ((size_t)1) << (params.hashLog - ldmBucketSizeLog); size_t const totalSize = ZSTD_cwksp_alloc_size(ldmBucketSize) + ZSTD_cwksp_alloc_size(ldmHSize * sizeof(ldmEntry_t)); - return params.enableLdm ? totalSize : 0; + return params.enableLdm == ZSTD_ps_enable ? totalSize : 0; } size_t ZSTD_ldm_getMaxNbSeq(ldmParams_t params, size_t maxChunkSize) { - return params.enableLdm ? (maxChunkSize / params.minMatchLength) : 0; + return params.enableLdm == ZSTD_ps_enable ? (maxChunkSize / params.minMatchLength) : 0; } /** ZSTD_ldm_getBucket() : diff --git a/lib/compress/zstdmt_compress.c b/lib/compress/zstdmt_compress.c index 19e8ce427..2aec41dda 100644 --- a/lib/compress/zstdmt_compress.c +++ b/lib/compress/zstdmt_compress.c @@ -467,7 +467,7 @@ ZSTDMT_serialState_reset(serialState_t* serialState, ZSTD_dictContentType_e dictContentType) { /* Adjust parameters */ - if (params.ldmParams.enableLdm) { + if (params.ldmParams.enableLdm == ZSTD_ps_enable) { DEBUGLOG(4, "LDM window size = %u KB", (1U << params.cParams.windowLog) >> 10); ZSTD_ldm_adjustParameters(¶ms.ldmParams, ¶ms.cParams); assert(params.ldmParams.hashLog >= params.ldmParams.bucketSizeLog); @@ -478,7 +478,7 @@ ZSTDMT_serialState_reset(serialState_t* serialState, serialState->nextJobID = 0; if (params.fParams.checksumFlag) XXH64_reset(&serialState->xxhState, 0); - if (params.ldmParams.enableLdm) { + if (params.ldmParams.enableLdm == ZSTD_ps_enable) { ZSTD_customMem cMem = params.customMem; unsigned const hashLog = params.ldmParams.hashLog; size_t const hashSize = ((size_t)1 << hashLog) * sizeof(ldmEntry_t); @@ -564,7 +564,7 @@ static void ZSTDMT_serialState_update(serialState_t* serialState, /* A future job may error and skip our job */ if (serialState->nextJobID == jobID) { /* It is now our turn, do any processing necessary */ - if (serialState->params.ldmParams.enableLdm) { + if (serialState->params.ldmParams.enableLdm == ZSTD_ps_enable) { size_t error; assert(seqStore.seq != NULL && seqStore.pos == 0 && seqStore.size == 0 && seqStore.capacity > 0); @@ -594,7 +594,7 @@ static void ZSTDMT_serialState_update(serialState_t* serialState, if (seqStore.size > 0) { size_t const err = ZSTD_referenceExternalSequences( jobCCtx, seqStore.seq, seqStore.size); - assert(serialState->params.ldmParams.enableLdm); + assert(serialState->params.ldmParams.enableLdm == ZSTD_ps_enable); assert(!ZSTD_isError(err)); (void)err; } @@ -672,7 +672,7 @@ static void ZSTDMT_compressionJob(void* jobDescription) if (dstBuff.start==NULL) JOB_ERROR(ERROR(memory_allocation)); job->dstBuff = dstBuff; /* this value can be read in ZSTDMT_flush, when it copies the whole job */ } - if (jobParams.ldmParams.enableLdm && rawSeqStore.seq == NULL) + if (jobParams.ldmParams.enableLdm == ZSTD_ps_enable && rawSeqStore.seq == NULL) JOB_ERROR(ERROR(memory_allocation)); /* Don't compute the checksum for chunks, since we compute it externally, @@ -680,7 +680,7 @@ static void ZSTDMT_compressionJob(void* jobDescription) */ if (job->jobID != 0) jobParams.fParams.checksumFlag = 0; /* Don't run LDM for the chunks, since we handle it externally */ - jobParams.ldmParams.enableLdm = 0; + jobParams.ldmParams.enableLdm = ZSTD_ps_disable; /* Correct nbWorkers to 0. */ jobParams.nbWorkers = 0; @@ -1144,7 +1144,7 @@ size_t ZSTDMT_toFlushNow(ZSTDMT_CCtx* mtctx) static unsigned ZSTDMT_computeTargetJobLog(const ZSTD_CCtx_params* params) { unsigned jobLog; - if (params->ldmParams.enableLdm) { + if (params->ldmParams.enableLdm == ZSTD_ps_enable) { /* In Long Range Mode, the windowLog is typically oversized. * In which case, it's preferable to determine the jobSize * based on cycleLog instead. */ @@ -1188,7 +1188,7 @@ static size_t ZSTDMT_computeOverlapSize(const ZSTD_CCtx_params* params) int const overlapRLog = 9 - ZSTDMT_overlapLog(params->overlapLog, params->cParams.strategy); int ovLog = (overlapRLog >= 8) ? 0 : (params->cParams.windowLog - overlapRLog); assert(0 <= overlapRLog && overlapRLog <= 8); - if (params->ldmParams.enableLdm) { + if (params->ldmParams.enableLdm == ZSTD_ps_enable) { /* In Long Range Mode, the windowLog is typically oversized. * In which case, it's preferable to determine the jobSize * based on chainLog instead. @@ -1275,7 +1275,7 @@ size_t ZSTDMT_initCStream_internal( ZSTDMT_setBufferSize(mtctx->bufPool, ZSTD_compressBound(mtctx->targetSectionSize)); { /* If ldm is enabled we need windowSize space. */ - size_t const windowSize = mtctx->params.ldmParams.enableLdm ? (1U << mtctx->params.cParams.windowLog) : 0; + size_t const windowSize = mtctx->params.ldmParams.enableLdm == ZSTD_ps_enable ? (1U << mtctx->params.cParams.windowLog) : 0; /* Two buffers of slack, plus extra space for the overlap * This is the minimum slack that LDM works with. One extra because * flush might waste up to targetSectionSize-1 bytes. Another extra @@ -1587,7 +1587,7 @@ static int ZSTDMT_doesOverlapWindow(buffer_t buffer, ZSTD_window_t window) static void ZSTDMT_waitForLdmComplete(ZSTDMT_CCtx* mtctx, buffer_t buffer) { - if (mtctx->params.ldmParams.enableLdm) { + if (mtctx->params.ldmParams.enableLdm == ZSTD_ps_enable) { ZSTD_pthread_mutex_t* mutex = &mtctx->serial.ldmWindowMutex; DEBUGLOG(5, "ZSTDMT_waitForLdmComplete"); DEBUGLOG(5, "source [0x%zx, 0x%zx)", From 9450876a9df0abe967dd6f0751785b2e4e5981fc Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Tue, 21 Sep 2021 16:36:33 -0700 Subject: [PATCH 08/38] [huf] Fix compilation when DYNAMIC_BMI2=0 && BMI2 is supported * Fix compilation issues pointed out in PR #2790. * Add test cases to GitHub actions that test all combinations of `DYNAMIC_BMI2` BMI2 support. --- .github/workflows/dev-short-tests.yml | 12 ++++++++++++ lib/decompress/huf_decompress.c | 20 ++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-short-tests.yml b/.github/workflows/dev-short-tests.yml index 5d7e54b51..056f5cbf1 100644 --- a/.github/workflows/dev-short-tests.yml +++ b/.github/workflows/dev-short-tests.yml @@ -200,6 +200,18 @@ jobs: make clean && make -j all MOREFLAGS="-Werror -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS" make clean && make check MOREFLAGS="-Werror -DZSTD_NO_INLINE -DZSTD_STRIP_ERROR_STRINGS" + dynamic-bmi2: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: dynamic bmi2 tests + run: | + make clean && make -j check MOREFLAGS="-O0 -Werror -mbmi2" + make clean && make -j check MOREFLAGS="-O0 -Werror -DDYNAMIC_BMI2=1" + make clean && make -j check MOREFLAGS="-O0 -Werror -DDYNAMIC_BMI2=1 -mbmi2" + make clean && make -j check MOREFLAGS="-O0 -Werror -DDYNAMIC_BMI2=0" + make clean && make -j check MOREFLAGS="-O0 -Werror -DDYNAMIC_BMI2=0 -mbmi2" + test-variants: runs-on: ubuntu-latest steps: diff --git a/lib/decompress/huf_decompress.c b/lib/decompress/huf_decompress.c index 1dfa4b801..2efca7dd5 100644 --- a/lib/decompress/huf_decompress.c +++ b/lib/decompress/huf_decompress.c @@ -78,6 +78,18 @@ #endif #define HUF_ASM_DECL HUF_EXTERN_C +#if DYNAMIC_BMI2 || (HUF_ENABLE_ASM_X86_64_BMI2 && defined(__BMI2__)) +# define HUF_NEED_BMI2_FUNCTION 1 +#else +# define HUF_NEED_BMI2_FUNCTION 0 +#endif + +#if !(HUF_ENABLE_ASM_X86_64_BMI2 && defined(__BMI2__)) +# define HUF_NEED_DEFAULT_FUNCTION 1 +#else +# define HUF_NEED_DEFAULT_FUNCTION 0 +#endif + /* ************************************************************** * Error Management ****************************************************************/ @@ -653,7 +665,7 @@ HUF_decompress4X1_usingDTable_internal_body( } } -#if DYNAMIC_BMI2 +#if HUF_NEED_BMI2_FUNCTION static TARGET_ATTRIBUTE("bmi2") size_t HUF_decompress4X1_usingDTable_internal_bmi2(void* dst, size_t dstSize, void const* cSrc, size_t cSrcSize, HUF_DTable const* DTable) { @@ -661,11 +673,13 @@ size_t HUF_decompress4X1_usingDTable_internal_bmi2(void* dst, size_t dstSize, vo } #endif +#if HUF_NEED_DEFAULT_FUNCTION static size_t HUF_decompress4X1_usingDTable_internal_default(void* dst, size_t dstSize, void const* cSrc, size_t cSrcSize, HUF_DTable const* DTable) { return HUF_decompress4X1_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable); } +#endif #if HUF_ENABLE_ASM_X86_64_BMI2 @@ -1365,7 +1379,7 @@ HUF_decompress4X2_usingDTable_internal_body( } } -#if DYNAMIC_BMI2 +#if HUF_NEED_BMI2_FUNCTION static TARGET_ATTRIBUTE("bmi2") size_t HUF_decompress4X2_usingDTable_internal_bmi2(void* dst, size_t dstSize, void const* cSrc, size_t cSrcSize, HUF_DTable const* DTable) { @@ -1373,11 +1387,13 @@ size_t HUF_decompress4X2_usingDTable_internal_bmi2(void* dst, size_t dstSize, vo } #endif +#if HUF_NEED_DEFAULT_FUNCTION static size_t HUF_decompress4X2_usingDTable_internal_default(void* dst, size_t dstSize, void const* cSrc, size_t cSrcSize, HUF_DTable const* DTable) { return HUF_decompress4X2_usingDTable_internal_body(dst, dstSize, cSrc, cSrcSize, DTable); } +#endif #if HUF_ENABLE_ASM_X86_64_BMI2 From 99b5e7b8c28875d0df998be2a4598d2358e37f23 Mon Sep 17 00:00:00 2001 From: senhuang42 Date: Wed, 22 Sep 2021 11:27:56 -0400 Subject: [PATCH 09/38] Add test case for FSE over-write --- tests/fuzzer.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/fuzzer.c b/tests/fuzzer.c index fff963176..49f671d17 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -3353,6 +3353,23 @@ static int basicUnitTests(U32 const seed, double compressibility) FSE_normalizeCount(norm, tableLog, count, nbSeq, maxSymbolValue, /* useLowProbCount */ 1); } DISPLAYLEVEL(3, "OK \n"); + + DISPLAYLEVEL(3, "test%3i : testing FSE_writeNCount() PR#2779: ", testNb++); + { + size_t const outBufSize = 9; + short const count[11] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 9, 18}; + unsigned const tableLog = 5; + unsigned const maxSymbolValue = 10; + BYTE* outBuf = (BYTE*)malloc(outBufSize*sizeof(BYTE)); + + /* Ensure that this write doesn't write out of bounds, and that + * FSE_writeNCount_generic() is *not* called with writeIsSafe == 1. + */ + FSE_writeNCount(outBuf, outBufSize, count, maxSymbolValue, tableLog); + free(outBuf); + } + DISPLAYLEVEL(3, "OK \n"); + #ifdef ZSTD_MULTITHREAD DISPLAYLEVEL(3, "test%3i : passing wrong full dict should fail on compressStream2 refPrefix ", testNb++); { ZSTD_CCtx* cctx = ZSTD_createCCtx(); From 2832bbbbdce74325215c0960ae293e27b0aa7df1 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Wed, 22 Sep 2021 14:00:20 -0700 Subject: [PATCH 10/38] emphasize usage of -r in documentation notably as a way to overcome shell expansion limitations, notably in a scenario of dictionary training. --- programs/zstd.1.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/programs/zstd.1.md b/programs/zstd.1.md index 066bcb83c..f1c4b5fcd 100644 --- a/programs/zstd.1.md +++ b/programs/zstd.1.md @@ -224,7 +224,11 @@ the last one takes effect. keep source file(s) after successful compression or decompression. This is the default behavior. * `-r`: - operate recursively on directories + operate recursively on directories. + It selects all files in the named directory and all its subdirectories. + This can be useful both to reduce command line typing, + and to circumvent shell expansion limitations, + when there are a lot of files and naming breaks the maximum size of a command line. * `--filelist FILE` read a list of files to process as content from `FILE`. Format is compatible with `ls` output, with one file per line. @@ -307,12 +311,14 @@ Compression of small files similar to the sample set will be greatly improved. The training set should contain a lot of small files (> 100), and weight typically 100x the target dictionary size (for example, 10 MB for a 100 KB dictionary). + `--train` can be combined with `-r` to indicate a directory rather than listing all the files, + which can be useful to circumvent shell expansion limits. - Supports multithreading if `zstd` is compiled with threading support. + `--train` supports multithreading if `zstd` is compiled with threading support (default). Additional parameters can be specified with `--train-fastcover`. The legacy dictionary builder can be accessed with `--train-legacy`. - The cover dictionary builder can be accessed with `--train-cover`. - Equivalent to `--train-fastcover=d=8,steps=4`. + The slower cover dictionary builder can be accessed with `--train-cover`. + Default is equivalent to `--train-fastcover=d=8,steps=4`. * `-o file`: Dictionary saved into `file` (default name: dictionary). * `--maxdict=#`: @@ -322,10 +328,10 @@ Compression of small files similar to the sample set will be greatly improved. Will generate statistics more tuned for selected compression level, resulting in a _small_ compression ratio improvement for this level. * `-B#`: - Split input files in blocks of size # (default: no split) + Split input files into blocks of size # (default: no split) * `--dictID=#`: - A dictionary ID is a locally unique ID that a decoder can use to verify it is - using the right dictionary. + A dictionary ID is a locally unique ID + that a decoder can use to verify it is using the right dictionary. By default, zstd will create a 4-bytes random number ID. It's possible to give a precise number instead. Short numbers have an advantage : an ID < 256 will only need 1 byte in the From 999f8778afda7149aa9974e9850a2b9a51a860ff Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Wed, 22 Sep 2021 14:18:24 -0700 Subject: [PATCH 11/38] updated man pages using ronn-ng --- programs/zstd.1 | 259 +++++++++----------------------------------- programs/zstdgrep.1 | 23 ---- programs/zstdless.1 | 14 --- 3 files changed, 54 insertions(+), 242 deletions(-) diff --git a/programs/zstd.1 b/programs/zstd.1 index 861f9380b..0810ec999 100644 --- a/programs/zstd.1 +++ b/programs/zstd.1 @@ -1,491 +1,340 @@ -. -.TH "ZSTD" "1" "May 2021" "zstd 1.5.0" "User Commands" -. +.TH "ZSTD" "1" "September 2021" "zstd 1.5.1" "User Commands" .SH "NAME" \fBzstd\fR \- zstd, zstdmt, unzstd, zstdcat \- Compress or decompress \.zst files -. .SH "SYNOPSIS" -\fBzstd\fR [\fIOPTIONS\fR] [\-|\fIINPUT\-FILE\fR] [\-o \fIOUTPUT\-FILE\fR] -. +.TS +allbox; +\fBzstd\fR [\fIOPTIONS\fR] [\- \fIINPUT\-FILE\fR] [\-o \fIOUTPUT\-FILE\fR] +.TE .P \fBzstdmt\fR is equivalent to \fBzstd \-T0\fR -. .P \fBunzstd\fR is equivalent to \fBzstd \-d\fR -. .P \fBzstdcat\fR is equivalent to \fBzstd \-dcf\fR -. .SH "DESCRIPTION" \fBzstd\fR is a fast lossless compression algorithm and data compression tool, with command line syntax similar to \fBgzip (1)\fR and \fBxz (1)\fR\. It is based on the \fBLZ77\fR family, with further FSE & huff0 entropy stages\. \fBzstd\fR offers highly configurable compression speed, with fast modes at > 200 MB/s per core, and strong modes nearing lzma compression ratios\. It also features a very fast decoder, with speeds > 500 MB/s per core\. -. .P \fBzstd\fR command line syntax is generally similar to gzip, but features the following differences : -. -.IP "\(bu" 4 +.IP "\[ci]" 4 Source files are preserved by default\. It\'s possible to remove them automatically by using the \fB\-\-rm\fR command\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 When compressing a single file, \fBzstd\fR displays progress notifications and result summary by default\. Use \fB\-q\fR to turn them off\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fBzstd\fR does not accept input from console, but it properly accepts \fBstdin\fR when it\'s not the console\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fBzstd\fR displays a short help page when command line is an error\. Use \fB\-q\fR to turn it off\. -. .IP "" 0 -. .P \fBzstd\fR compresses or decompresses each \fIfile\fR according to the selected operation mode\. If no \fIfiles\fR are given or \fIfile\fR is \fB\-\fR, \fBzstd\fR reads from standard input and writes the processed data to standard output\. \fBzstd\fR will refuse to write compressed data to standard output if it is a terminal : it will display an error message and skip the \fIfile\fR\. Similarly, \fBzstd\fR will refuse to read compressed data from standard input if it is a terminal\. -. .P Unless \fB\-\-stdout\fR or \fB\-o\fR is specified, \fIfiles\fR are written to a new file whose name is derived from the source \fIfile\fR name: -. -.IP "\(bu" 4 +.IP "\[ci]" 4 When compressing, the suffix \fB\.zst\fR is appended to the source filename to get the target filename\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 When decompressing, the \fB\.zst\fR suffix is removed from the source filename to get the target filename -. .IP "" 0 -. .SS "Concatenation with \.zst files" It is possible to concatenate \fB\.zst\fR files as is\. \fBzstd\fR will decompress such files as if they were a single \fB\.zst\fR file\. -. .SH "OPTIONS" -. .SS "Integer suffixes and special values" In most places where an integer argument is expected, an optional suffix is supported to easily indicate large integers\. There must be no space between the integer and the suffix\. -. .TP \fBKiB\fR -Multiply the integer by 1,024 (2^10)\. \fBKi\fR, \fBK\fR, and \fBKB\fR are accepted as synonyms for \fBKiB\fR\. -. +Multiply the integer by 1,024 (2\e^10)\. \fBKi\fR, \fBK\fR, and \fBKB\fR are accepted as synonyms for \fBKiB\fR\. .TP \fBMiB\fR -Multiply the integer by 1,048,576 (2^20)\. \fBMi\fR, \fBM\fR, and \fBMB\fR are accepted as synonyms for \fBMiB\fR\. -. +Multiply the integer by 1,048,576 (2\e^20)\. \fBMi\fR, \fBM\fR, and \fBMB\fR are accepted as synonyms for \fBMiB\fR\. .SS "Operation mode" If multiple operation mode options are given, the last one takes effect\. -. .TP \fB\-z\fR, \fB\-\-compress\fR Compress\. This is the default operation mode when no operation mode option is specified and no other operation mode is implied from the command name (for example, \fBunzstd\fR implies \fB\-\-decompress\fR)\. -. .TP \fB\-d\fR, \fB\-\-decompress\fR, \fB\-\-uncompress\fR Decompress\. -. .TP \fB\-t\fR, \fB\-\-test\fR Test the integrity of compressed \fIfiles\fR\. This option is equivalent to \fB\-\-decompress \-\-stdout\fR except that the decompressed data is discarded instead of being written to standard output\. No files are created or removed\. -. .TP \fB\-b#\fR Benchmark file(s) using compression level # -. .TP \fB\-\-train FILEs\fR Use FILEs as a training set to create a dictionary\. The training set should contain a lot of small files (> 100)\. -. .TP \fB\-l\fR, \fB\-\-list\fR Display information related to a zstd compressed file, such as size, ratio, and checksum\. Some of these fields may not be available\. This command can be augmented with the \fB\-v\fR modifier\. -. .SS "Operation modifiers" -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-#\fR: \fB#\fR compression level [1\-19] (default: 3) -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-ultra\fR: unlocks high compression levels 20+ (maximum 22), using a lot more memory\. Note that decompression will also require more memory when using these levels\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-fast[=#]\fR: switch to ultra\-fast compression levels\. If \fB=#\fR is not present, it defaults to \fB1\fR\. The higher the value, the faster the compression speed, at the cost of some compression ratio\. This setting overwrites compression level if one was set previously\. Similarly, if a compression level is set after \fB\-\-fast\fR, it overrides it\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-T#\fR, \fB\-\-threads=#\fR: Compress using \fB#\fR working threads (default: 1)\. If \fB#\fR is 0, attempt to detect and use the number of physical CPU cores\. In all cases, the nb of threads is capped to \fBZSTDMT_NBWORKERS_MAX\fR, which is either 64 in 32\-bit mode, or 256 for 64\-bit environments\. This modifier does nothing if \fBzstd\fR is compiled without multithread support\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-single\-thread\fR: Does not spawn a thread for compression, use a single thread for both I/O and compression\. In this mode, compression is serialized with I/O, which is slightly slower\. (This is different from \fB\-T1\fR, which spawns 1 compression thread in parallel of I/O)\. This mode is the only one available when multithread support is disabled\. Single\-thread mode features lower memory usage\. Final compressed result is slightly different from \fB\-T1\fR\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 +\fB\-\-auto\-threads={physical,logical} (default: physical)\fR: When using a default amount of threads via \fB\-T0\fR, choose the default based on the number of detected physical or logical cores\. +.IP "\[ci]" 4 \fB\-\-adapt[=min=#,max=#]\fR : \fBzstd\fR will dynamically adapt compression level to perceived I/O conditions\. Compression level adaptation can be observed live by using command \fB\-v\fR\. Adaptation can be constrained between supplied \fBmin\fR and \fBmax\fR levels\. The feature works when combined with multi\-threading and \fB\-\-long\fR mode\. It does not work with \fB\-\-single\-thread\fR\. It sets window size to 8 MB by default (can be changed manually, see \fBwlog\fR)\. Due to the chaotic nature of dynamic adaptation, compressed result is not reproducible\. \fInote\fR : at the time of this writing, \fB\-\-adapt\fR can remain stuck at low speed when combined with multiple worker threads (>=2)\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-long[=#]\fR: enables long distance matching with \fB#\fR \fBwindowLog\fR, if not \fB#\fR is not present it defaults to \fB27\fR\. This increases the window size (\fBwindowLog\fR) and memory usage for both the compressor and decompressor\. This setting is designed to improve the compression ratio for files with long matches at a large distance\. -. .IP Note: If \fBwindowLog\fR is set to larger than 27, \fB\-\-long=windowLog\fR or \fB\-\-memory=windowSize\fR needs to be passed to the decompressor\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-D DICT\fR: use \fBDICT\fR as Dictionary to compress or decompress FILE(s) -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-patch\-from FILE\fR: Specify the file to be used as a reference point for zstd\'s diff engine\. This is effectively dictionary compression with some convenient parameter selection, namely that windowSize > srcSize\. -. .IP Note: cannot use both this and \-D together Note: \fB\-\-long\fR mode will be automatically activated if chainLog < fileLog (fileLog being the windowLog required to cover the whole file)\. You can also manually force it\. Node: for all levels, you can use \-\-patch\-from in \-\-single\-thread mode to improve compression ratio at the cost of speed Note: for level 19, you can get increased compression ratio at the cost of speed by specifying \fB\-\-zstd=targetLength=\fR to be something large (i\.e 4096), and by setting a large \fB\-\-zstd=chainLog=\fR -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-rsyncable\fR : \fBzstd\fR will periodically synchronize the compression state to make the compressed file more rsync\-friendly\. There is a negligible impact to compression ratio, and the faster compression levels will see a small compression speed hit\. This feature does not work with \fB\-\-single\-thread\fR\. You probably don\'t want to use it with long range mode, since it will decrease the effectiveness of the synchronization points, but your milage may vary\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-C\fR, \fB\-\-[no\-]check\fR: add integrity check computed from uncompressed data (default: enabled) -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-[no\-]content\-size\fR: enable / disable whether or not the original size of the file is placed in the header of the compressed file\. The default option is \-\-content\-size (meaning that the original size will be placed in the header)\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-no\-dictID\fR: do not store dictionary ID within frame header (dictionary compression)\. The decoder will have to rely on implicit knowledge about which dictionary to use, it won\'t be able to check if it\'s correct\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-M#\fR, \fB\-\-memory=#\fR: Set a memory usage limit\. By default, Zstandard uses 128 MB for decompression as the maximum amount of memory the decompressor is allowed to use, but you can override this manually if need be in either direction (ie\. you can increase or decrease it)\. -. .IP This is also used during compression when using with \-\-patch\-from=\. In this case, this parameter overrides that maximum size allowed for a dictionary\. (128 MB)\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-stream\-size=#\fR : Sets the pledged source size of input coming from a stream\. This value must be exact, as it will be included in the produced frame header\. Incorrect stream sizes will cause an error\. This information will be used to better optimize compression parameters, resulting in better and potentially faster compression, especially for smaller source sizes\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-size\-hint=#\fR: When handling input from a stream, \fBzstd\fR must guess how large the source size will be when optimizing compression parameters\. If the stream size is relatively small, this guess may be a poor one, resulting in a higher compression ratio than expected\. This feature allows for controlling the guess when needed\. Exact guesses result in better compression ratios\. Overestimates result in slightly degraded compression ratios, while underestimates may result in significant degradation\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-o FILE\fR: save result into \fBFILE\fR -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-f\fR, \fB\-\-force\fR: disable input and output checks\. Allows overwriting existing files, input from console, output to stdout, operating on links, block devices, etc\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-c\fR, \fB\-\-stdout\fR: force write to standard output, even if it is the console -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-[no\-]sparse\fR: enable / disable sparse FS support, to make files with many zeroes smaller on disk\. Creating sparse files may save disk space and speed up decompression by reducing the amount of disk I/O\. default: enabled when output is into a file, and disabled when output is stdout\. This setting overrides default and can force sparse mode over stdout\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-rm\fR: remove source file(s) after successful compression or decompression\. If used in combination with \-o, will trigger a confirmation prompt (which can be silenced with \-f), as this is a destructive operation\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-k\fR, \fB\-\-keep\fR: keep source file(s) after successful compression or decompression\. This is the default behavior\. -. -.IP "\(bu" 4 -\fB\-r\fR: operate recursively on directories -. -.IP "\(bu" 4 +.IP "\[ci]" 4 +\fB\-r\fR: operate recursively on directories\. It selects all files in the named directory and all its subdirectories\. This can be useful both to reduce command line typing, and to circumvent shell expansion limitations, when there are a lot of files and naming breaks the maximum size of a command line\. +.IP "\[ci]" 4 \fB\-\-filelist FILE\fR read a list of files to process as content from \fBFILE\fR\. Format is compatible with \fBls\fR output, with one file per line\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-output\-dir\-flat DIR\fR: resulting files are stored into target \fBDIR\fR directory, instead of same directory as origin file\. Be aware that this command can introduce name collision issues, if multiple files, from different directories, end up having the same name\. Collision resolution ensures first file with a given name will be present in \fBDIR\fR, while in combination with \fB\-f\fR, the last file will be present instead\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-output\-dir\-mirror DIR\fR: similar to \fB\-\-output\-dir\-flat\fR, the output files are stored underneath target \fBDIR\fR directory, but this option will replicate input directory hierarchy into output \fBDIR\fR\. -. .IP If input directory contains "\.\.", the files in this directory will be ignored\. If input directory is an absolute directory (i\.e\. "/var/tmp/abc"), it will be stored into the "output\-dir/var/tmp/abc"\. If there are multiple input files or directories, name collision resolution will follow the same rules as \fB\-\-output\-dir\-flat\fR\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-format=FORMAT\fR: compress and decompress in other formats\. If compiled with support, zstd can compress to or decompress from other compression algorithm formats\. Possibly available options are \fBzstd\fR, \fBgzip\fR, \fBxz\fR, \fBlzma\fR, and \fBlz4\fR\. If no such format is provided, \fBzstd\fR is the default\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-h\fR/\fB\-H\fR, \fB\-\-help\fR: display help/long help and exit -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-V\fR, \fB\-\-version\fR: display version number and exit\. Advanced : \fB\-vV\fR also displays supported formats\. \fB\-vvV\fR also displays POSIX support\. \fB\-q\fR will only display the version number, suitable for machine reading\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-v\fR, \fB\-\-verbose\fR: verbose mode, display more information -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-q\fR, \fB\-\-quiet\fR: suppress warnings, interactivity, and notifications\. specify twice to suppress errors too\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-no\-progress\fR: do not display the progress bar, but keep all other messages\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-show\-default\-cparams\fR: Shows the default compression parameters that will be used for a particular src file\. If the provided src file is not a regular file (eg\. named pipe), the cli will just output the default parameters\. That is, the parameters that are used when the src size is unknown\. -. -.IP "\(bu" 4 +.IP "\[ci]" 4 \fB\-\-\fR: All arguments after \fB\-\-\fR are treated as files -. .IP "" 0 -. .SS "Restricted usage of Environment Variables" Using environment variables to set parameters has security implications\. Therefore, this avenue is intentionally restricted\. Only \fBZSTD_CLEVEL\fR and \fBZSTD_NBTHREADS\fR are currently supported\. They set the compression level and number of threads to use during compression, respectively\. -. .P \fBZSTD_CLEVEL\fR can be used to set the level between 1 and 19 (the "normal" range)\. If the value of \fBZSTD_CLEVEL\fR is not a valid integer, it will be ignored with a warning message\. \fBZSTD_CLEVEL\fR just replaces the default compression level (\fB3\fR)\. -. .P \fBZSTD_NBTHREADS\fR can be used to set the number of threads \fBzstd\fR will attempt to use during compression\. If the value of \fBZSTD_NBTHREADS\fR is not a valid unsigned integer, it will be ignored with a warning message\. \fBZSTD_NBTHREADS\fR has a default value of (\fB1\fR), and is capped at ZSTDMT_NBWORKERS_MAX==200\. \fBzstd\fR must be compiled with multithread support for this to have any effect\. -. .P They can both be overridden by corresponding command line arguments: \fB\-#\fR for compression level and \fB\-T#\fR for number of compression threads\. -. .SH "DICTIONARY BUILDER" \fBzstd\fR offers \fIdictionary\fR compression, which greatly improves efficiency on small files and messages\. It\'s possible to train \fBzstd\fR with a set of samples, the result of which is saved into a file called a \fBdictionary\fR\. Then during compression and decompression, reference the same dictionary, using command \fB\-D dictionaryFileName\fR\. Compression of small files similar to the sample set will be greatly improved\. -. .TP \fB\-\-train FILEs\fR -Use FILEs as training set to create a dictionary\. The training set should contain a lot of small files (> 100), and weight typically 100x the target dictionary size (for example, 10 MB for a 100 KB dictionary)\. -. +Use FILEs as training set to create a dictionary\. The training set should contain a lot of small files (> 100), and weight typically 100x the target dictionary size (for example, 10 MB for a 100 KB dictionary)\. \fB\-\-train\fR can be combined with \fB\-r\fR to indicate a directory rather than listing all the files, which can be useful to circumvent shell expansion limits\. .IP -Supports multithreading if \fBzstd\fR is compiled with threading support\. Additional parameters can be specified with \fB\-\-train\-fastcover\fR\. The legacy dictionary builder can be accessed with \fB\-\-train\-legacy\fR\. The cover dictionary builder can be accessed with \fB\-\-train\-cover\fR\. Equivalent to \fB\-\-train\-fastcover=d=8,steps=4\fR\. -. +\fB\-\-train\fR supports multithreading if \fBzstd\fR is compiled with threading support (default)\. Additional parameters can be specified with \fB\-\-train\-fastcover\fR\. The legacy dictionary builder can be accessed with \fB\-\-train\-legacy\fR\. The slower cover dictionary builder can be accessed with \fB\-\-train\-cover\fR\. Default is equivalent to \fB\-\-train\-fastcover=d=8,steps=4\fR\. .TP \fB\-o file\fR Dictionary saved into \fBfile\fR (default name: dictionary)\. -. .TP \fB\-\-maxdict=#\fR Limit dictionary to specified size (default: 112640)\. -. .TP \fB\-#\fR Use \fB#\fR compression level during training (optional)\. Will generate statistics more tuned for selected compression level, resulting in a \fIsmall\fR compression ratio improvement for this level\. -. .TP \fB\-B#\fR -Split input files in blocks of size # (default: no split) -. +Split input files into blocks of size # (default: no split) .TP \fB\-\-dictID=#\fR A dictionary ID is a locally unique ID that a decoder can use to verify it is using the right dictionary\. By default, zstd will create a 4\-bytes random number ID\. It\'s possible to give a precise number instead\. Short numbers have an advantage : an ID < 256 will only need 1 byte in the compressed frame header, and an ID < 65536 will only need 2 bytes\. This compares favorably to 4 bytes default\. However, it\'s up to the dictionary manager to not assign twice the same ID to 2 different dictionaries\. -. .TP \fB\-\-train\-cover[=k#,d=#,steps=#,split=#,shrink[=#]]\fR Select parameters for the default dictionary builder algorithm named cover\. If \fId\fR is not specified, then it tries \fId\fR = 6 and \fId\fR = 8\. If \fIk\fR is not specified, then it tries \fIsteps\fR values in the range [50, 2000]\. If \fIsteps\fR is not specified, then the default value of 40 is used\. If \fIsplit\fR is not specified or split <= 0, then the default value of 100 is used\. Requires that \fId\fR <= \fIk\fR\. If \fIshrink\fR flag is not used, then the default value for \fIshrinkDict\fR of 0 is used\. If \fIshrink\fR is not specified, then the default value for \fIshrinkDictMaxRegression\fR of 1 is used\. -. .IP Selects segments of size \fIk\fR with highest score to put in the dictionary\. The score of a segment is computed by the sum of the frequencies of all the subsegments of size \fId\fR\. Generally \fId\fR should be in the range [6, 8], occasionally up to 16, but the algorithm will run faster with d <= \fI8\fR\. Good values for \fIk\fR vary widely based on the input data, but a safe range is [2 * \fId\fR, 2000]\. If \fIsplit\fR is 100, all input samples are used for both training and testing to find optimal \fId\fR and \fIk\fR to build dictionary\. Supports multithreading if \fBzstd\fR is compiled with threading support\. Having \fIshrink\fR enabled takes a truncated dictionary of minimum size and doubles in size until compression ratio of the truncated dictionary is at most \fIshrinkDictMaxRegression%\fR worse than the compression ratio of the largest dictionary\. -. .IP Examples: -. .IP \fBzstd \-\-train\-cover FILEs\fR -. .IP \fBzstd \-\-train\-cover=k=50,d=8 FILEs\fR -. .IP \fBzstd \-\-train\-cover=d=8,steps=500 FILEs\fR -. .IP \fBzstd \-\-train\-cover=k=50 FILEs\fR -. .IP \fBzstd \-\-train\-cover=k=50,split=60 FILEs\fR -. .IP \fBzstd \-\-train\-cover=shrink FILEs\fR -. .IP \fBzstd \-\-train\-cover=shrink=2 FILEs\fR -. .TP \fB\-\-train\-fastcover[=k#,d=#,f=#,steps=#,split=#,accel=#]\fR Same as cover but with extra parameters \fIf\fR and \fIaccel\fR and different default value of split If \fIsplit\fR is not specified, then it tries \fIsplit\fR = 75\. If \fIf\fR is not specified, then it tries \fIf\fR = 20\. Requires that 0 < \fIf\fR < 32\. If \fIaccel\fR is not specified, then it tries \fIaccel\fR = 1\. Requires that 0 < \fIaccel\fR <= 10\. Requires that \fId\fR = 6 or \fId\fR = 8\. -. .IP \fIf\fR is log of size of array that keeps track of frequency of subsegments of size \fId\fR\. The subsegment is hashed to an index in the range [0,2^\fIf\fR \- 1]\. It is possible that 2 different subsegments are hashed to the same index, and they are considered as the same subsegment when computing frequency\. Using a higher \fIf\fR reduces collision but takes longer\. -. .IP Examples: -. .IP \fBzstd \-\-train\-fastcover FILEs\fR -. .IP \fBzstd \-\-train\-fastcover=d=8,f=15,accel=2 FILEs\fR -. .TP \fB\-\-train\-legacy[=selectivity=#]\fR Use legacy dictionary builder algorithm with the given dictionary \fIselectivity\fR (default: 9)\. The smaller the \fIselectivity\fR value, the denser the dictionary, improving its efficiency but reducing its possible maximum size\. \fB\-\-train\-legacy=s=#\fR is also accepted\. -. .IP Examples: -. .IP \fBzstd \-\-train\-legacy FILEs\fR -. .IP \fBzstd \-\-train\-legacy=selectivity=8 FILEs\fR -. .SH "BENCHMARK" -. .TP \fB\-b#\fR benchmark file(s) using compression level # -. .TP \fB\-e#\fR benchmark file(s) using multiple compression levels, from \fB\-b#\fR to \fB\-e#\fR (inclusive) -. .TP \fB\-i#\fR minimum evaluation time, in seconds (default: 3s), benchmark mode only -. .TP \fB\-B#\fR, \fB\-\-block\-size=#\fR cut file(s) into independent blocks of size # (default: no block) -. .TP \fB\-\-priority=rt\fR set process priority to real\-time -. .P \fBOutput Format:\fR CompressionLevel#Filename : IntputSize \-> OutputSize (CompressionRatio), CompressionSpeed, DecompressionSpeed -. .P \fBMethodology:\fR For both compression and decompression speed, the entire input is compressed/decompressed in\-memory to measure speed\. A run lasts at least 1 sec, so when files are small, they are compressed/decompressed several times per run, in order to improve measurement accuracy\. -. .SH "ADVANCED COMPRESSION OPTIONS" -. -.SS "\-B#:" -Select the size of each compression job\. This parameter is only available when multi\-threading is enabled\. Each compression job is run in parallel, so this value indirectly impacts the nb of active threads\. Default job size varies depending on compression level (generally \fB4 * windowSize\fR)\. \fB\-B#\fR makes it possible to manually select a custom size\. Note that job size must respect a minimum value which is enforced transparently\. This minimum is either 512 KB, or \fBoverlapSize\fR, whichever is largest\. Different job sizes will lead to (slightly) different compressed frames\. -. +### \-B#: Select the size of each compression job\. This parameter is only available when multi\-threading is enabled\. Each compression job is run in parallel, so this value indirectly impacts the nb of active threads\. Default job size varies depending on compression level (generally \fB4 * windowSize\fR)\. \fB\-B#\fR makes it possible to manually select a custom size\. Note that job size must respect a minimum value which is enforced transparently\. This minimum is either 512 KB, or \fBoverlapSize\fR, whichever is largest\. Different job sizes will lead to (slightly) different compressed frames\. .SS "\-\-zstd[=options]:" \fBzstd\fR provides 22 predefined compression levels\. The selected or default predefined compression level can be changed with advanced compression options\. The \fIoptions\fR are provided as a comma\-separated list\. You may specify only the options you want to change and the rest will be taken from the selected or default compression level\. The list of available \fIoptions\fR: -. .TP \fBstrategy\fR=\fIstrat\fR, \fBstrat\fR=\fIstrat\fR Specify a strategy used by a match finder\. -. .IP There are 9 strategies numbered from 1 to 9, from faster to stronger: 1=ZSTD_fast, 2=ZSTD_dfast, 3=ZSTD_greedy, 4=ZSTD_lazy, 5=ZSTD_lazy2, 6=ZSTD_btlazy2, 7=ZSTD_btopt, 8=ZSTD_btultra, 9=ZSTD_btultra2\. -. .TP \fBwindowLog\fR=\fIwlog\fR, \fBwlog\fR=\fIwlog\fR Specify the maximum number of bits for a match distance\. -. .IP The higher number of increases the chance to find a match which usually improves compression ratio\. It also increases memory requirements for the compressor and decompressor\. The minimum \fIwlog\fR is 10 (1 KiB) and the maximum is 30 (1 GiB) on 32\-bit platforms and 31 (2 GiB) on 64\-bit platforms\. -. .IP Note: If \fBwindowLog\fR is set to larger than 27, \fB\-\-long=windowLog\fR or \fB\-\-memory=windowSize\fR needs to be passed to the decompressor\. -. .TP \fBhashLog\fR=\fIhlog\fR, \fBhlog\fR=\fIhlog\fR Specify the maximum number of bits for a hash table\. -. .IP Bigger hash tables cause less collisions which usually makes compression faster, but requires more memory during compression\. -. .IP The minimum \fIhlog\fR is 6 (64 B) and the maximum is 30 (1 GiB)\. -. .TP \fBchainLog\fR=\fIclog\fR, \fBclog\fR=\fIclog\fR Specify the maximum number of bits for a hash chain or a binary tree\. -. .IP Higher numbers of bits increases the chance to find a match which usually improves compression ratio\. It also slows down compression speed and increases memory requirements for compression\. This option is ignored for the ZSTD_fast strategy\. -. .IP The minimum \fIclog\fR is 6 (64 B) and the maximum is 29 (524 Mib) on 32\-bit platforms and 30 (1 Gib) on 64\-bit platforms\. -. .TP \fBsearchLog\fR=\fIslog\fR, \fBslog\fR=\fIslog\fR Specify the maximum number of searches in a hash chain or a binary tree using logarithmic scale\. -. .IP More searches increases the chance to find a match which usually increases compression ratio but decreases compression speed\. -. .IP The minimum \fIslog\fR is 1 and the maximum is \'windowLog\' \- 1\. -. .TP \fBminMatch\fR=\fImml\fR, \fBmml\fR=\fImml\fR Specify the minimum searched length of a match in a hash table\. -. .IP Larger search lengths usually decrease compression ratio but improve decompression speed\. -. .IP The minimum \fImml\fR is 3 and the maximum is 7\. -. .TP \fBtargetLength\fR=\fItlen\fR, \fBtlen\fR=\fItlen\fR The impact of this field vary depending on selected strategy\. -. .IP For ZSTD_btopt, ZSTD_btultra and ZSTD_btultra2, it specifies the minimum match length that causes match finder to stop searching\. A larger \fBtargetLength\fR usually improves compression ratio but decreases compression speed\. t For ZSTD_fast, it triggers ultra\-fast mode when > 0\. The value represents the amount of data skipped between match sampling\. Impact is reversed : a larger \fBtargetLength\fR increases compression speed but decreases compression ratio\. -. .IP For all other strategies, this field has no impact\. -. .IP The minimum \fItlen\fR is 0 and the maximum is 128 Kib\. -. .TP \fBoverlapLog\fR=\fIovlog\fR, \fBovlog\fR=\fIovlog\fR Determine \fBoverlapSize\fR, amount of data reloaded from previous job\. This parameter is only available when multithreading is enabled\. Reloading more data improves compression ratio, but decreases speed\. -. .IP The minimum \fIovlog\fR is 0, and the maximum is 9\. 1 means "no overlap", hence completely independent jobs\. 9 means "full overlap", meaning up to \fBwindowSize\fR is reloaded from previous job\. Reducing \fIovlog\fR by 1 reduces the reloaded amount by a factor 2\. For example, 8 means "windowSize/2", and 6 means "windowSize/8"\. Value 0 is special and means "default" : \fIovlog\fR is automatically determined by \fBzstd\fR\. In which case, \fIovlog\fR will range from 6 to 9, depending on selected \fIstrat\fR\. -. .TP \fBldmHashLog\fR=\fIlhlog\fR, \fBlhlog\fR=\fIlhlog\fR Specify the maximum size for a hash table used for long distance matching\. -. .IP This option is ignored unless long distance matching is enabled\. -. .IP Bigger hash tables usually improve compression ratio at the expense of more memory during compression and a decrease in compression speed\. -. .IP The minimum \fIlhlog\fR is 6 and the maximum is 30 (default: 20)\. -. .TP \fBldmMinMatch\fR=\fIlmml\fR, \fBlmml\fR=\fIlmml\fR Specify the minimum searched length of a match for long distance matching\. -. .IP This option is ignored unless long distance matching is enabled\. -. .IP Larger/very small values usually decrease compression ratio\. -. .IP The minimum \fIlmml\fR is 4 and the maximum is 4096 (default: 64)\. -. .TP \fBldmBucketSizeLog\fR=\fIlblog\fR, \fBlblog\fR=\fIlblog\fR Specify the size of each bucket for the hash table used for long distance matching\. -. .IP This option is ignored unless long distance matching is enabled\. -. .IP Larger bucket sizes improve collision resolution but decrease compression speed\. -. .IP The minimum \fIlblog\fR is 1 and the maximum is 8 (default: 3)\. -. .TP \fBldmHashRateLog\fR=\fIlhrlog\fR, \fBlhrlog\fR=\fIlhrlog\fR Specify the frequency of inserting entries into the long distance matching hash table\. -. .IP This option is ignored unless long distance matching is enabled\. -. .IP Larger values will improve compression speed\. Deviating far from the default value will likely result in a decrease in compression ratio\. -. .IP The default value is \fBwlog \- lhlog\fR\. -. .SS "Example" The following parameters sets advanced compression options to something similar to predefined level 19 for files bigger than 256 KB: -. .P \fB\-\-zstd\fR=wlog=23,clog=23,hlog=22,slog=6,mml=3,tlen=48,strat=6 -. .SH "BUGS" Report bugs at: https://github\.com/facebook/zstd/issues -. .SH "AUTHOR" Yann Collet diff --git a/programs/zstdgrep.1 b/programs/zstdgrep.1 index bf96185b7..e69de29bb 100644 --- a/programs/zstdgrep.1 +++ b/programs/zstdgrep.1 @@ -1,23 +0,0 @@ -. -.TH "ZSTDGREP" "1" "May 2021" "zstd 1.5.0" "User Commands" -. -.SH "NAME" -\fBzstdgrep\fR \- print lines matching a pattern in zstandard\-compressed files -. -.SH "SYNOPSIS" -\fBzstdgrep\fR [\fIgrep\-flags\fR] [\-\-] \fIpattern\fR [\fIfiles\fR \.\.\.] -. -.SH "DESCRIPTION" -\fBzstdgrep\fR runs \fBgrep (1)\fR on files or stdin, if no files argument is given, after decompressing them with \fBzstdcat (1)\fR\. -. -.P -The grep\-flags and pattern arguments are passed on to \fBgrep (1)\fR\. If an \fB\-e\fR flag is found in the \fBgrep\-flags\fR, \fBzstdgrep\fR will not look for a pattern argument\. -. -.SH "EXIT STATUS" -In case of missing arguments or missing pattern, 1 will be returned, otherwise 0\. -. -.SH "SEE ALSO" -\fBzstd (1)\fR -. -.SH "AUTHORS" -Thomas Klausner \fIwiz@NetBSD\.org\fR diff --git a/programs/zstdless.1 b/programs/zstdless.1 index f08bc1921..e69de29bb 100644 --- a/programs/zstdless.1 +++ b/programs/zstdless.1 @@ -1,14 +0,0 @@ -. -.TH "ZSTDLESS" "1" "May 2021" "zstd 1.5.0" "User Commands" -. -.SH "NAME" -\fBzstdless\fR \- view zstandard\-compressed files -. -.SH "SYNOPSIS" -\fBzstdless\fR [\fIflags\fR] [\fIfile\fR \.\.\.] -. -.SH "DESCRIPTION" -\fBzstdless\fR runs \fBless (1)\fR on files or stdin, if no files argument is given, after decompressing them with \fBzstdcat (1)\fR\. -. -.SH "SEE ALSO" -\fBzstd (1)\fR From 70b36c2308441fc6448fc48a365831c7748078b9 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Wed, 22 Sep 2021 14:30:06 -0700 Subject: [PATCH 12/38] update zstdgrep doc to mention ripgrep alternative which transparently supports zstd-compressed files. --- programs/zstdgrep.1.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/programs/zstdgrep.1.md b/programs/zstdgrep.1.md index 363ad4f99..35186a4bf 100644 --- a/programs/zstdgrep.1.md +++ b/programs/zstdgrep.1.md @@ -9,10 +9,14 @@ SYNOPSIS DESCRIPTION ----------- -`zstdgrep` runs `grep (1)` on files or stdin, if no files argument is given, after decompressing them with `zstdcat (1)`. +`zstdgrep` runs `grep (1)` on files, or `stdin` if no files argument is given, after decompressing them with `zstdcat (1)`. The grep-flags and pattern arguments are passed on to `grep (1)`. If an `-e` flag is found in the `grep-flags`, `zstdgrep` will not look for a pattern argument. +Note that modern `grep` alternatives such as `ripgrep` (`rg`) support `zstd`-compressed files out of the box, +and can prove better alternatives than `zstdgrep` notably for unsupported complex pattern searches. +Note though that such alternatives may also feature some minor command line differences. + EXIT STATUS ----------- In case of missing arguments or missing pattern, 1 will be returned, otherwise 0. From 3addf2f27781e1abb32551bfdd612295147dd24d Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Wed, 22 Sep 2021 14:30:59 -0700 Subject: [PATCH 13/38] updated zstdgrep man page --- programs/zstdgrep.1 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/programs/zstdgrep.1 b/programs/zstdgrep.1 index e69de29bb..ae4da3354 100644 --- a/programs/zstdgrep.1 +++ b/programs/zstdgrep.1 @@ -0,0 +1,17 @@ +.TH "ZSTDGREP" "1" "September 2021" "zstd 1.5.1" "User Commands" +.SH "NAME" +\fBzstdgrep\fR \- print lines matching a pattern in zstandard\-compressed files +.SH "SYNOPSIS" +\fBzstdgrep\fR [\fIgrep\-flags\fR] [\-\-] \fIpattern\fR [\fIfiles\fR \|\.\|\.\|\.] +.SH "DESCRIPTION" +\fBzstdgrep\fR runs \fBgrep (1)\fR on files, or \fBstdin\fR if no files argument is given, after decompressing them with \fBzstdcat (1)\fR\. +.P +The grep\-flags and pattern arguments are passed on to \fBgrep (1)\fR\. If an \fB\-e\fR flag is found in the \fBgrep\-flags\fR, \fBzstdgrep\fR will not look for a pattern argument\. +.P +Note that modern \fBgrep\fR alternatives such as \fBripgrep\fR (\fBrg\fR) support \fBzstd\fR\-compressed files out of the box, and can prove better alternatives than \fBzstdgrep\fR notably for unsupported complex pattern searches\. Note though that such alternatives may also feature some minor command line differences\. +.SH "EXIT STATUS" +In case of missing arguments or missing pattern, 1 will be returned, otherwise 0\. +.SH "SEE ALSO" +\fBzstd (1)\fR +.SH "AUTHORS" +Thomas Klausner \fIwiz@NetBSD\.org\fR From 8150891939a7e7bc009ecf372cd0d340508c0b8a Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Wed, 22 Sep 2021 14:48:51 -0700 Subject: [PATCH 14/38] regenerated zstdless.1 --- programs/zstdless.1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/programs/zstdless.1 b/programs/zstdless.1 index e69de29bb..22354763b 100644 --- a/programs/zstdless.1 +++ b/programs/zstdless.1 @@ -0,0 +1,9 @@ +.TH "ZSTDLESS" "1" "September 2021" "zstd 1.5.1" "User Commands" +.SH "NAME" +\fBzstdless\fR \- view zstandard\-compressed files +.SH "SYNOPSIS" +\fBzstdless\fR [\fIflags\fR] [\fIfile\fR \|\.\|\.\|\.] +.SH "DESCRIPTION" +\fBzstdless\fR runs \fBless (1)\fR on files or stdin, if no files argument is given, after decompressing them with \fBzstdcat (1)\fR\. +.SH "SEE ALSO" +\fBzstd (1)\fR From 4d347a902bd717d0565f797f70b68f159767d364 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Wed, 22 Sep 2021 15:06:08 -0700 Subject: [PATCH 15/38] [contrib][linux] Fix up SPDX license identifiers Correctly identify that we are GPL v2+ or BSD 3 clause, as pointed out in issue #2663. --- contrib/linux-kernel/decompress_sources.h | 2 +- contrib/linux-kernel/linux.mk | 2 +- contrib/linux-kernel/linux_zstd.h | 2 +- contrib/linux-kernel/mem.h | 2 +- contrib/linux-kernel/zstd_compress_module.c | 2 +- contrib/linux-kernel/zstd_decompress_module.c | 2 +- contrib/linux-kernel/zstd_deps.h | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/linux-kernel/decompress_sources.h b/contrib/linux-kernel/decompress_sources.h index aef953c6b..a2aefe8f2 100644 --- a/contrib/linux-kernel/decompress_sources.h +++ b/contrib/linux-kernel/decompress_sources.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ /* * Copyright (c) Facebook, Inc. * All rights reserved. diff --git a/contrib/linux-kernel/linux.mk b/contrib/linux-kernel/linux.mk index 19485e3cc..65218ec5b 100644 --- a/contrib/linux-kernel/linux.mk +++ b/contrib/linux-kernel/linux.mk @@ -1,4 +1,4 @@ -# SPDX-License-Identifier: GPL-2.0-only +# SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause # ################################################################ # Copyright (c) Facebook, Inc. # All rights reserved. diff --git a/contrib/linux-kernel/linux_zstd.h b/contrib/linux-kernel/linux_zstd.h index 446ecabcd..113408eef 100644 --- a/contrib/linux-kernel/linux_zstd.h +++ b/contrib/linux-kernel/linux_zstd.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ /* * Copyright (c) Yann Collet, Facebook, Inc. * All rights reserved. diff --git a/contrib/linux-kernel/mem.h b/contrib/linux-kernel/mem.h index 4b5db5756..dcdd586a9 100644 --- a/contrib/linux-kernel/mem.h +++ b/contrib/linux-kernel/mem.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ /* * Copyright (c) Yann Collet, Facebook, Inc. * All rights reserved. diff --git a/contrib/linux-kernel/zstd_compress_module.c b/contrib/linux-kernel/zstd_compress_module.c index 37d08ff43..bb06206f4 100644 --- a/contrib/linux-kernel/zstd_compress_module.c +++ b/contrib/linux-kernel/zstd_compress_module.c @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause /* * Copyright (c) Facebook, Inc. * All rights reserved. diff --git a/contrib/linux-kernel/zstd_decompress_module.c b/contrib/linux-kernel/zstd_decompress_module.c index 15005cdb9..f4ed952ed 100644 --- a/contrib/linux-kernel/zstd_decompress_module.c +++ b/contrib/linux-kernel/zstd_decompress_module.c @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause /* * Copyright (c) Facebook, Inc. * All rights reserved. diff --git a/contrib/linux-kernel/zstd_deps.h b/contrib/linux-kernel/zstd_deps.h index 853b72426..7a5bf4483 100644 --- a/contrib/linux-kernel/zstd_deps.h +++ b/contrib/linux-kernel/zstd_deps.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ /* * Copyright (c) Facebook, Inc. * All rights reserved. From 162491f6015a45f3391584cf64be45304ae91869 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Wed, 22 Sep 2021 18:13:02 -0700 Subject: [PATCH 16/38] [contrib][linux] Reduce stack usage by 80 bytes Instead of calling `ZSTD_compress_advanced()` and `ZSTD_initCStream_advanced()`, which each take a `ZSTD_parameters` by value, use the new advanced API. Stack usage went from 2024 -> 1944. --- contrib/linux-kernel/zstd_compress_module.c | 44 +++++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/contrib/linux-kernel/zstd_compress_module.c b/contrib/linux-kernel/zstd_compress_module.c index bb06206f4..65548a4bb 100644 --- a/contrib/linux-kernel/zstd_compress_module.c +++ b/contrib/linux-kernel/zstd_compress_module.c @@ -17,6 +17,43 @@ #include "common/zstd_deps.h" #include "common/zstd_internal.h" +#define ZSTD_FORWARD_IF_ERR(ret) \ + do { \ + size_t const __ret = (ret); \ + if (ZSTD_isError(__ret)) \ + return __ret; \ + } while (0) + +static size_t zstd_cctx_init(zstd_cctx *cctx, const zstd_parameters *parameters, + unsigned long long pledged_src_size) +{ + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_reset( + cctx, ZSTD_reset_session_and_parameters)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setPledgedSrcSize( + cctx, pledged_src_size)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_windowLog, parameters->cParams.windowLog)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_hashLog, parameters->cParams.hashLog)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_chainLog, parameters->cParams.chainLog)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_searchLog, parameters->cParams.searchLog)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_minMatch, parameters->cParams.minMatch)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_targetLength, parameters->cParams.targetLength)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_strategy, parameters->cParams.strategy)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_contentSizeFlag, parameters->fParams.contentSizeFlag)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_checksumFlag, parameters->fParams.checksumFlag)); + ZSTD_FORWARD_IF_ERR(ZSTD_CCtx_setParameter( + cctx, ZSTD_c_dictIDFlag, !parameters->fParams.noDictIDFlag)); + return 0; +} + int zstd_min_clevel(void) { return ZSTD_minCLevel(); @@ -59,7 +96,8 @@ EXPORT_SYMBOL(zstd_init_cctx); size_t zstd_compress_cctx(zstd_cctx *cctx, void *dst, size_t dst_capacity, const void *src, size_t src_size, const zstd_parameters *parameters) { - return ZSTD_compress_advanced(cctx, dst, dst_capacity, src, src_size, NULL, 0, *parameters); + ZSTD_FORWARD_IF_ERR(zstd_cctx_init(cctx, parameters, src_size)); + return ZSTD_compress2(cctx, dst, dst_capacity, src, src_size); } EXPORT_SYMBOL(zstd_compress_cctx); @@ -73,7 +111,6 @@ zstd_cstream *zstd_init_cstream(const zstd_parameters *parameters, unsigned long long pledged_src_size, void *workspace, size_t workspace_size) { zstd_cstream *cstream; - size_t ret; if (workspace == NULL) return NULL; @@ -86,8 +123,7 @@ zstd_cstream *zstd_init_cstream(const zstd_parameters *parameters, if (pledged_src_size == 0) pledged_src_size = ZSTD_CONTENTSIZE_UNKNOWN; - ret = ZSTD_initCStream_advanced(cstream, NULL, 0, *parameters, pledged_src_size); - if (ZSTD_isError(ret)) + if (ZSTD_isError(zstd_cctx_init(cstream, parameters, pledged_src_size))) return NULL; return cstream; From 1d8143c84f287eb54879f752a4200041ed840e25 Mon Sep 17 00:00:00 2001 From: senhuang42 Date: Wed, 22 Sep 2021 11:16:46 -0400 Subject: [PATCH 17/38] Move block splitter from stack to CCtx --- contrib/linux-kernel/Makefile | 2 +- lib/compress/zstd_compress.c | 62 +++++++++++++-------------- lib/compress/zstd_compress_internal.h | 19 ++++++++ 3 files changed, 51 insertions(+), 32 deletions(-) diff --git a/contrib/linux-kernel/Makefile b/contrib/linux-kernel/Makefile index f85179fc4..c88d137f2 100644 --- a/contrib/linux-kernel/Makefile +++ b/contrib/linux-kernel/Makefile @@ -93,4 +93,4 @@ test: libzstd .PHONY: clean clean: - $(RM) -rf linux + $(RM) -rf linux test/test test/static_test diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 6ca4784fd..dc4103667 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -1506,7 +1506,7 @@ size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params) ZSTD_compressionParameters const cParams = ZSTD_getCParamsFromCCtxParams(params, ZSTD_CONTENTSIZE_UNKNOWN, 0, ZSTD_cpm_noAttachDict); ZSTD_paramSwitch_e const useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(params->useRowMatchFinder, - &cParams); + &cParams); RETURN_ERROR_IF(params->nbWorkers > 0, GENERIC, "Estimate CCtx size is supported for single-threaded compression only."); /* estimateCCtxSize is for one-shot compression. So no buffers should @@ -1987,8 +1987,8 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, zc->ldmState.loadedDictEnd = 0; } - assert(ZSTD_cwksp_estimated_space_within_bounds(ws, neededSpace, resizeWorkspace)); DEBUGLOG(3, "wksp: finished allocating, %zd bytes remain available", ZSTD_cwksp_available_space(ws)); + assert(ZSTD_cwksp_estimated_space_within_bounds(ws, neededSpace, resizeWorkspace)); zc->initialized = 1; @@ -3341,20 +3341,20 @@ static size_t ZSTD_estimateBlockSize(const BYTE* literals, size_t litSize, * * Returns the estimated compressed size of the seqStore, or a zstd error. */ -static size_t ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(seqStore_t* seqStore, const ZSTD_CCtx* zc) { - ZSTD_entropyCTablesMetadata_t entropyMetadata; +static size_t ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(seqStore_t* seqStore, ZSTD_CCtx* zc) { + ZSTD_entropyCTablesMetadata_t* entropyMetadata = &zc->blockSplitCtx.entropyMetadata; DEBUGLOG(6, "ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize()"); FORWARD_IF_ERROR(ZSTD_buildBlockEntropyStats(seqStore, &zc->blockState.prevCBlock->entropy, &zc->blockState.nextCBlock->entropy, &zc->appliedParams, - &entropyMetadata, + entropyMetadata, zc->entropyWorkspace, ENTROPY_WORKSPACE_SIZE /* statically allocated in resetCCtx */), ""); return ZSTD_estimateBlockSize(seqStore->litStart, (size_t)(seqStore->lit - seqStore->litStart), seqStore->ofCode, seqStore->llCode, seqStore->mlCode, (size_t)(seqStore->sequences - seqStore->sequencesStart), - &zc->blockState.nextCBlock->entropy, &entropyMetadata, zc->entropyWorkspace, ENTROPY_WORKSPACE_SIZE, - (int)(entropyMetadata.hufMetadata.hType == set_compressed), 1); + &zc->blockState.nextCBlock->entropy, entropyMetadata, zc->entropyWorkspace, ENTROPY_WORKSPACE_SIZE, + (int)(entropyMetadata->hufMetadata.hType == set_compressed), 1); } /* Returns literals bytes represented in a seqStore */ @@ -3553,7 +3553,6 @@ typedef struct { } seqStoreSplits; #define MIN_SEQUENCES_BLOCK_SPLITTING 300 -#define MAX_NB_SPLITS 196 /* Helper function to perform the recursive search for block splits. * Estimates the cost of seqStore prior to split, and estimates the cost of splitting the sequences in half. @@ -3564,30 +3563,31 @@ typedef struct { * In theory, this means the absolute largest recursion depth is 10 == log2(maxNbSeqInBlock/MIN_SEQUENCES_BLOCK_SPLITTING). * In practice, recursion depth usually doesn't go beyond 4. * - * Furthermore, the number of splits is capped by MAX_NB_SPLITS. At MAX_NB_SPLITS == 196 with the current existing blockSize + * Furthermore, the number of splits is capped by ZSTD_MAX_NB_BLOCK_SPLITS. At ZSTD_MAX_NB_BLOCK_SPLITS == 196 with the current existing blockSize * maximum of 128 KB, this value is actually impossible to reach. */ static void ZSTD_deriveBlockSplitsHelper(seqStoreSplits* splits, size_t startIdx, size_t endIdx, - const ZSTD_CCtx* zc, const seqStore_t* origSeqStore) { - seqStore_t fullSeqStoreChunk; - seqStore_t firstHalfSeqStore; - seqStore_t secondHalfSeqStore; + ZSTD_CCtx* zc, const seqStore_t* origSeqStore) { + seqStore_t* fullSeqStoreChunk = &zc->blockSplitCtx.fullSeqStoreChunk; + seqStore_t* firstHalfSeqStore = &zc->blockSplitCtx.firstHalfSeqStore; + seqStore_t* secondHalfSeqStore = &zc->blockSplitCtx.secondHalfSeqStore; size_t estimatedOriginalSize; size_t estimatedFirstHalfSize; size_t estimatedSecondHalfSize; size_t midIdx = (startIdx + endIdx)/2; - if (endIdx - startIdx < MIN_SEQUENCES_BLOCK_SPLITTING || splits->idx >= MAX_NB_SPLITS) { + if (endIdx - startIdx < MIN_SEQUENCES_BLOCK_SPLITTING || splits->idx >= ZSTD_MAX_NB_BLOCK_SPLITS) { DEBUGLOG(6, "ZSTD_deriveBlockSplitsHelper: Too few sequences"); return; } - ZSTD_deriveSeqStoreChunk(&fullSeqStoreChunk, origSeqStore, startIdx, endIdx); - ZSTD_deriveSeqStoreChunk(&firstHalfSeqStore, origSeqStore, startIdx, midIdx); - ZSTD_deriveSeqStoreChunk(&secondHalfSeqStore, origSeqStore, midIdx, endIdx); - estimatedOriginalSize = ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(&fullSeqStoreChunk, zc); - estimatedFirstHalfSize = ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(&firstHalfSeqStore, zc); - estimatedSecondHalfSize = ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(&secondHalfSeqStore, zc); - DEBUGLOG(5, "Estimated original block size: %zu -- First half split: %zu -- Second half split: %zu", + DEBUGLOG(4, "ZSTD_deriveBlockSplitsHelper: startIdx=%zu endIdx=%zu", startIdx, endIdx); + ZSTD_deriveSeqStoreChunk(fullSeqStoreChunk, origSeqStore, startIdx, endIdx); + ZSTD_deriveSeqStoreChunk(firstHalfSeqStore, origSeqStore, startIdx, midIdx); + ZSTD_deriveSeqStoreChunk(secondHalfSeqStore, origSeqStore, midIdx, endIdx); + estimatedOriginalSize = ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(fullSeqStoreChunk, zc); + estimatedFirstHalfSize = ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(firstHalfSeqStore, zc); + estimatedSecondHalfSize = ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(secondHalfSeqStore, zc); + DEBUGLOG(4, "Estimated original block size: %zu -- First half split: %zu -- Second half split: %zu", estimatedOriginalSize, estimatedFirstHalfSize, estimatedSecondHalfSize); if (ZSTD_isError(estimatedOriginalSize) || ZSTD_isError(estimatedFirstHalfSize) || ZSTD_isError(estimatedSecondHalfSize)) { return; @@ -3627,12 +3627,12 @@ static size_t ZSTD_compressBlock_splitBlock_internal(ZSTD_CCtx* zc, void* dst, s size_t cSize = 0; const BYTE* ip = (const BYTE*)src; BYTE* op = (BYTE*)dst; - U32 partitions[MAX_NB_SPLITS]; size_t i = 0; size_t srcBytesTotal = 0; + U32* partitions = zc->blockSplitCtx.partitions; /* size == ZSTD_MAX_NB_BLOCK_SPLITS */ + seqStore_t* nextSeqStore = &zc->blockSplitCtx.nextSeqStore; + seqStore_t* currSeqStore = &zc->blockSplitCtx.currSeqStore; size_t numSplits = ZSTD_deriveBlockSplits(zc, partitions, nbSeq); - seqStore_t nextSeqStore; - seqStore_t currSeqStore; /* If a block is split and some partitions are emitted as RLE/uncompressed, then repcode history * may become invalid. In order to reconcile potentially invalid repcodes, we keep track of two @@ -3652,7 +3652,7 @@ static size_t ZSTD_compressBlock_splitBlock_internal(ZSTD_CCtx* zc, void* dst, s repcodes_t cRep; ZSTD_memcpy(dRep.rep, zc->blockState.prevCBlock->rep, sizeof(repcodes_t)); ZSTD_memcpy(cRep.rep, zc->blockState.prevCBlock->rep, sizeof(repcodes_t)); - ZSTD_memset(&nextSeqStore, 0, sizeof(seqStore_t)); + ZSTD_memset(nextSeqStore, 0, sizeof(seqStore_t)); DEBUGLOG(4, "ZSTD_compressBlock_splitBlock_internal (dstCapacity=%u, dictLimit=%u, nextToUpdate=%u)", (unsigned)dstCapacity, (unsigned)zc->blockState.matchState.window.dictLimit, @@ -3670,36 +3670,36 @@ static size_t ZSTD_compressBlock_splitBlock_internal(ZSTD_CCtx* zc, void* dst, s return cSizeSingleBlock; } - ZSTD_deriveSeqStoreChunk(&currSeqStore, &zc->seqStore, 0, partitions[0]); + ZSTD_deriveSeqStoreChunk(currSeqStore, &zc->seqStore, 0, partitions[0]); for (i = 0; i <= numSplits; ++i) { size_t srcBytes; size_t cSizeChunk; U32 const lastPartition = (i == numSplits); U32 lastBlockEntireSrc = 0; - srcBytes = ZSTD_countSeqStoreLiteralsBytes(&currSeqStore) + ZSTD_countSeqStoreMatchBytes(&currSeqStore); + srcBytes = ZSTD_countSeqStoreLiteralsBytes(currSeqStore) + ZSTD_countSeqStoreMatchBytes(currSeqStore); srcBytesTotal += srcBytes; if (lastPartition) { /* This is the final partition, need to account for possible last literals */ srcBytes += blockSize - srcBytesTotal; lastBlockEntireSrc = lastBlock; } else { - ZSTD_deriveSeqStoreChunk(&nextSeqStore, &zc->seqStore, partitions[i], partitions[i+1]); + ZSTD_deriveSeqStoreChunk(nextSeqStore, &zc->seqStore, partitions[i], partitions[i+1]); } - cSizeChunk = ZSTD_compressSeqStore_singleBlock(zc, &currSeqStore, + cSizeChunk = ZSTD_compressSeqStore_singleBlock(zc, currSeqStore, &dRep, &cRep, op, dstCapacity, ip, srcBytes, lastBlockEntireSrc, 1 /* isPartition */); - DEBUGLOG(5, "Estimated size: %zu actual size: %zu", ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(&currSeqStore, zc), cSizeChunk); + DEBUGLOG(5, "Estimated size: %zu actual size: %zu", ZSTD_buildEntropyStatisticsAndEstimateSubBlockSize(currSeqStore, zc), cSizeChunk); FORWARD_IF_ERROR(cSizeChunk, "Compressing chunk failed!"); ip += srcBytes; op += cSizeChunk; dstCapacity -= cSizeChunk; cSize += cSizeChunk; - currSeqStore = nextSeqStore; + *currSeqStore = *nextSeqStore; assert(cSizeChunk <= ZSTD_BLOCKSIZE_MAX + ZSTD_blockHeaderSize); } /* cRep and dRep may have diverged during the compression. If so, we use the dRep repcodes diff --git a/lib/compress/zstd_compress_internal.h b/lib/compress/zstd_compress_internal.h index b7772522a..a5c2db4b9 100644 --- a/lib/compress/zstd_compress_internal.h +++ b/lib/compress/zstd_compress_internal.h @@ -345,6 +345,22 @@ typedef enum { ZSTDb_buffered } ZSTD_buffered_policy_e; +/** + * Struct that contains all elements of block splitter that should be allocated + * in a wksp. + */ +#define ZSTD_MAX_NB_BLOCK_SPLITS 196 +typedef struct { + seqStore_t fullSeqStoreChunk; + seqStore_t firstHalfSeqStore; + seqStore_t secondHalfSeqStore; + seqStore_t currSeqStore; + seqStore_t nextSeqStore; + + U32 partitions[ZSTD_MAX_NB_BLOCK_SPLITS]; + ZSTD_entropyCTablesMetadata_t entropyMetadata; +} ZSTD_blockSplitCtx; + struct ZSTD_CCtx_s { ZSTD_compressionStage_e stage; int cParamsChanged; /* == 1 if cParams(except wlog) or compression level are changed in requestedParams. Triggers transmission of new params to ZSTDMT (if available) then reset to 0. */ @@ -410,6 +426,9 @@ struct ZSTD_CCtx_s { #if ZSTD_TRACE ZSTD_TraceCtx traceCtx; #endif + + /* Workspace for block splitter */ + ZSTD_blockSplitCtx blockSplitCtx; }; typedef enum { ZSTD_dtlm_fast, ZSTD_dtlm_full } ZSTD_dictTableLoadMethod_e; From e6d62bbfe12698d67a15dd8b7628ef8f38e4b30b Mon Sep 17 00:00:00 2001 From: Alexander Lobakin Date: Tue, 21 Sep 2021 20:06:49 +0200 Subject: [PATCH 18/38] [contrib][linux] Fix build with CONFIG_WERROR Linux 5.15 introduces a new Kconfig option, CONFIG_WERROR, which forces -Werror for the entire kernel. Current in-kernel ZSTD implementation uses functions deprecated in 1.5.0, and thus fails on -Wdeprecated-declarations. Turn this particular error into warning to be able to build the kernel with CONFIG_WERROR. I'm not disabling them completely to make sure they'll be visible and [hopefully] fixed sooner or later. Signed-off-by: Alexander Lobakin --- contrib/linux-kernel/linux.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/linux-kernel/linux.mk b/contrib/linux-kernel/linux.mk index 65218ec5b..a26bd3325 100644 --- a/contrib/linux-kernel/linux.mk +++ b/contrib/linux-kernel/linux.mk @@ -12,6 +12,7 @@ obj-$(CONFIG_ZSTD_COMPRESS) += zstd_compress.o obj-$(CONFIG_ZSTD_DECOMPRESS) += zstd_decompress.o ccflags-y += -O3 +ccflags-y += -Wno-error=deprecated-declarations zstd_compress-y := \ zstd_compress_module.o \ From c45b27abe79f7e9f2b7919bab94e45d7a22c1d6a Mon Sep 17 00:00:00 2001 From: Alexander Lobakin Date: Tue, 21 Sep 2021 20:17:34 +0200 Subject: [PATCH 19/38] [contrib][linux] Add huf_decompress_amd64.o target to Makefile Commit a5f2c4552803 ("Huffman ASM") added a new ASM source file, but it wasn't added to the kernel Makefile despite that it received support for Huffman ASM according to the internal definitions. This leads to undefined references, as huf_decompress.o now calls those ASM functions. Add it to the list of sources when building inside the kernel tree. Kbuild can handle .S files just fine, so none additional rules needed. Fixes: a5f2c4552803 ("Huffman ASM") Signed-off-by: Alexander Lobakin --- contrib/linux-kernel/linux.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/linux-kernel/linux.mk b/contrib/linux-kernel/linux.mk index a26bd3325..9df9c9c6d 100644 --- a/contrib/linux-kernel/linux.mk +++ b/contrib/linux-kernel/linux.mk @@ -42,6 +42,7 @@ zstd_decompress-y := \ common/fse_decompress.o \ common/zstd_common.o \ decompress/huf_decompress.o \ + decompress/huf_decompress_amd64.o \ decompress/zstd_ddict.o \ decompress/zstd_decompress.o \ decompress/zstd_decompress_block.o \ From d8b7fc51c81756a44fb87cbebd8e018652daf730 Mon Sep 17 00:00:00 2001 From: Alexander Lobakin Date: Thu, 23 Sep 2021 16:33:24 +0200 Subject: [PATCH 20/38] [contrib][linux] Add contrib/linux-kernel/linux to .gitignore The mentioned path is being created/used by the 'import' rule for generating source files for Linux kernel. Signed-off-by: Alexander Lobakin --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ea574d747..a136ea394 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ dictionary NUL # Build artefacts +contrib/linux-kernel/linux/ projects/ bin/ .buckd/ From fa2a4d77c7a97f7beebc4f3ee268526e5e3a29c0 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Thu, 23 Sep 2021 08:27:44 -0700 Subject: [PATCH 21/38] constify MatchState* parameter when possible turns out, it's possible to constify MatchState* parameter in some parts of the binary tree algorithm, making it a pure read-only parameter, as opposed to a mutable state. This is supposed to be helpful for both maintenance and the compiler. --- lib/compress/zstd_compress_internal.h | 10 +++++----- lib/compress/zstd_lazy.c | 6 +++--- lib/compress/zstd_opt.c | 20 ++++++++------------ 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/lib/compress/zstd_compress_internal.h b/lib/compress/zstd_compress_internal.h index a5c2db4b9..3dab83255 100644 --- a/lib/compress/zstd_compress_internal.h +++ b/lib/compress/zstd_compress_internal.h @@ -1228,15 +1228,15 @@ MEM_STATIC U32 ZSTD_window_update(ZSTD_window_t* window, */ MEM_STATIC U32 ZSTD_getLowestMatchIndex(const ZSTD_matchState_t* ms, U32 curr, unsigned windowLog) { - U32 const maxDistance = 1U << windowLog; - U32 const lowestValid = ms->window.lowLimit; - U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; - U32 const isDictionary = (ms->loadedDictEnd != 0); + U32 const maxDistance = 1U << windowLog; + U32 const lowestValid = ms->window.lowLimit; + U32 const withinWindow = (curr - lowestValid > maxDistance) ? curr - maxDistance : lowestValid; + U32 const isDictionary = (ms->loadedDictEnd != 0); /* When using a dictionary the entire dictionary is valid if a single byte of the dictionary * is within the window. We invalidate the dictionary (and set loadedDictEnd to 0) when it isn't * valid for the entire block. So this check is sufficient to find the lowest valid match index. */ - U32 const matchLowest = isDictionary ? lowestValid : withinWindow; + U32 const matchLowest = isDictionary ? lowestValid : withinWindow; return matchLowest; } diff --git a/lib/compress/zstd_lazy.c b/lib/compress/zstd_lazy.c index 70319d575..ed50550f3 100644 --- a/lib/compress/zstd_lazy.c +++ b/lib/compress/zstd_lazy.c @@ -61,7 +61,7 @@ ZSTD_updateDUBT(ZSTD_matchState_t* ms, * assumption : curr >= btlow == (curr - btmask) * doesn't fail */ static void -ZSTD_insertDUBT1(ZSTD_matchState_t* ms, +ZSTD_insertDUBT1(const ZSTD_matchState_t* ms, U32 curr, const BYTE* inputEnd, U32 nbCompares, U32 btLow, const ZSTD_dictMode_e dictMode) @@ -151,7 +151,7 @@ ZSTD_insertDUBT1(ZSTD_matchState_t* ms, static size_t ZSTD_DUBT_findBetterDictMatch ( - ZSTD_matchState_t* ms, + const ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iend, size_t* offsetPtr, size_t bestLength, @@ -868,7 +868,7 @@ FORCE_INLINE_TEMPLATE size_t ZSTD_HcFindBestMatch_extDict_selectMLS ( #define ZSTD_ROW_HASH_TAG_OFFSET 16 /* byte offset of hashes in the match state's tagTable from the beginning of a row */ #define ZSTD_ROW_HASH_TAG_BITS 8 /* nb bits to use for the tag */ #define ZSTD_ROW_HASH_TAG_MASK ((1u << ZSTD_ROW_HASH_TAG_BITS) - 1) -#define ZSTD_ROW_HASH_MAX_ENTRIES 64 /* absolute maximum number of entries per row, for all configurations */ +#define ZSTD_ROW_HASH_MAX_ENTRIES 64 /* absolute maximum number of entries per row, for all configurations */ #define ZSTD_ROW_HASH_CACHE_MASK (ZSTD_ROW_HASH_CACHE_SIZE - 1) diff --git a/lib/compress/zstd_opt.c b/lib/compress/zstd_opt.c index 40c25daa1..4c765128a 100644 --- a/lib/compress/zstd_opt.c +++ b/lib/compress/zstd_opt.c @@ -366,7 +366,7 @@ MEM_STATIC U32 ZSTD_readMINMATCH(const void* memPtr, U32 length) /* Update hashTable3 up to ip (excluded) Assumption : always within prefix (i.e. not within extDict) */ -static U32 ZSTD_insertAndFindFirstIndexHash3 (ZSTD_matchState_t* ms, +static U32 ZSTD_insertAndFindFirstIndexHash3 (const ZSTD_matchState_t* ms, U32* nextToUpdate3, const BYTE* const ip) { @@ -396,7 +396,7 @@ static U32 ZSTD_insertAndFindFirstIndexHash3 (ZSTD_matchState_t* ms, * @param target The target of ZSTD_updateTree_internal() - we are filling to this position * @return : nb of positions added */ static U32 ZSTD_insertBt1( - ZSTD_matchState_t* ms, + const ZSTD_matchState_t* ms, const BYTE* const ip, const BYTE* const iend, U32 const target, U32 const mls, const int extDict) @@ -421,8 +421,8 @@ static U32 ZSTD_insertBt1( U32* smallerPtr = bt + 2*(curr&btMask); U32* largerPtr = smallerPtr + 1; U32 dummy32; /* to be nullified at the end */ - /* windowLow is based on target because we're only need positions that will be - * in the window at the end of the tree update. + /* windowLow is based on target because + * we only need positions that will be in the window at the end of the tree update. */ U32 const windowLow = ZSTD_getLowestMatchIndex(ms, target, cParams->windowLog); U32 matchEndIdx = curr+8+1; @@ -669,7 +669,7 @@ U32 ZSTD_insertBtAndGetAllMatches ( return 1; } } } /* no dictMatchState lookup: dicts don't have a populated HC3 table */ - } + } /* if (mls == 3) */ hashTable[h] = curr; /* Update Hash Table */ @@ -706,8 +706,7 @@ U32 ZSTD_insertBtAndGetAllMatches ( | (ip+matchLength == iLimit) /* equal : no way to know if inf or sup */) { if (dictMode == ZSTD_dictMatchState) nbCompares = 0; /* break should also skip searching dms */ break; /* drop, to preserve bt consistency (miss a little bit of compression) */ - } - } + } } if (match[matchLength] < ip[matchLength]) { /* match smaller than current */ @@ -752,8 +751,7 @@ U32 ZSTD_insertBtAndGetAllMatches ( if ( (matchLength > ZSTD_OPT_NUM) | (ip+matchLength == iLimit) /* equal : no way to know if inf or sup */) { break; /* drop, to guarantee consistency (miss a little bit of compression) */ - } - } + } } if (dictMatchIndex <= dmsBtLow) { break; } /* beyond tree size, stop the search */ if (match[matchLength] < ip[matchLength]) { @@ -763,9 +761,7 @@ U32 ZSTD_insertBtAndGetAllMatches ( /* match is larger than current */ commonLengthLarger = matchLength; dictMatchIndex = nextPtr[0]; - } - } - } + } } } /* if (dictMode == ZSTD_dictMatchState) */ assert(matchEndIdx > curr+8); ms->nextToUpdate = matchEndIdx - 8; /* skip repetitive patterns */ From 189e87bcbeb1aa527a82f80adfe6e356de6ab555 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Wed, 22 Sep 2021 19:56:07 -0700 Subject: [PATCH 22/38] [lib] Make lib compatible with `-Wfall-through` excepting legacy Switch to a macro `ZSTD_FALLTHROUGH;` instead of a comment. On supported compilers this uses an attribute, otherwise it becomes a comment. This is necessary to be compatible with clang's `-Wfall-through`, and gcc's `-Wfall-through=2` which don't support comments. Without this the linux build emits a bunch of warnings. Also add a test to CI to ensure that we don't regress. --- .github/workflows/dev-short-tests.yml | 12 +++++++ contrib/linux-kernel/Makefile | 1 + .../test/include/linux/compiler.h | 2 ++ lib/common/bitstream.h | 12 +++---- lib/common/compiler.h | 33 +++++++++++++++++++ lib/compress/huf_compress.c | 8 ++--- lib/compress/zstd_compress.c | 12 ++++--- lib/compress/zstd_compress_internal.h | 2 +- lib/compress/zstd_double_fast.c | 2 -- lib/decompress/zstd_decompress.c | 19 +++++++---- lib/decompress/zstd_decompress_block.c | 2 +- 11 files changed, 81 insertions(+), 24 deletions(-) diff --git a/.github/workflows/dev-short-tests.yml b/.github/workflows/dev-short-tests.yml index 056f5cbf1..df6b7ed46 100644 --- a/.github/workflows/dev-short-tests.yml +++ b/.github/workflows/dev-short-tests.yml @@ -151,6 +151,18 @@ jobs: make gcc8install CC=gcc-8 CFLAGS="-Werror" make -j all + implicit-fall-through: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: -Wimplicit-fallthrough build + run: | + make clean + CC=gcc MOREFLAGS="-Werror -Wimplicit-fallthrough=2 -O0" make -C lib -j libzstd.a ZSTD_LEGACY_SUPPORT=0 + make clean + CC=clang MOREFLAGS="-Werror -Wimplicit-fallthrough -O0" make -C lib -j libzstd.a ZSTD_LEGACY_SUPPORT=0 + + visual-2019: runs-on: windows-latest strategy: diff --git a/contrib/linux-kernel/Makefile b/contrib/linux-kernel/Makefile index f85179fc4..d6510aec7 100644 --- a/contrib/linux-kernel/Makefile +++ b/contrib/linux-kernel/Makefile @@ -51,6 +51,7 @@ libzstd: -U_WIN32 \ -RZSTDLIB_VISIBILITY= \ -RZSTDERRORLIB_VISIBILITY= \ + -RZSTD_FALLTHROUGH=fallthrough \ -DZSTD_HAVE_WEAK_SYMBOLS=0 \ -DZSTD_TRACE=0 \ -DZSTD_NO_TRACE diff --git a/contrib/linux-kernel/test/include/linux/compiler.h b/contrib/linux-kernel/test/include/linux/compiler.h index ea3422ee3..de43edb69 100644 --- a/contrib/linux-kernel/test/include/linux/compiler.h +++ b/contrib/linux-kernel/test/include/linux/compiler.h @@ -18,4 +18,6 @@ #define noinline __attribute__((noinline)) #endif +#define fallthrough __attribute__((__fallthrough__)) + #endif diff --git a/lib/common/bitstream.h b/lib/common/bitstream.h index 48aad7f3a..72b4f7fa9 100644 --- a/lib/common/bitstream.h +++ b/lib/common/bitstream.h @@ -293,22 +293,22 @@ MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, si switch(srcSize) { case 7: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16); - /* fall-through */ + ZSTD_FALLTHROUGH; case 6: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24); - /* fall-through */ + ZSTD_FALLTHROUGH; case 5: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32); - /* fall-through */ + ZSTD_FALLTHROUGH; case 4: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[3]) << 24; - /* fall-through */ + ZSTD_FALLTHROUGH; case 3: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[2]) << 16; - /* fall-through */ + ZSTD_FALLTHROUGH; case 2: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[1]) << 8; - /* fall-through */ + ZSTD_FALLTHROUGH; default: break; } diff --git a/lib/common/compiler.h b/lib/common/compiler.h index 9d7d968ce..c630dad70 100644 --- a/lib/common/compiler.h +++ b/lib/common/compiler.h @@ -224,6 +224,39 @@ # define __has_feature(x) 0 #endif +/* C-language Attributes are added in C23. */ +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201710L) && defined(__has_c_attribute) +# define ZSTD_HAS_C_ATTRIBUTE(x) __has_c_attribute(x) +#else +# define ZSTD_HAS_C_ATTRIBUTE(x) 0 +#endif + +/* Only use C++ attributes in C++. Some compilers report support for C++ + * attributes when compiling with C. + */ +#if defined(__cplusplus) && defined(__has_cpp_attribute) +# define ZSTD_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) +#else +# define ZSTD_HAS_CPP_ATTRIBUTE(x) 0 +#endif + +/* Define ZSTD_FALLTHROUGH macro for annotating switch case with the 'fallthrough' attribute. + * - C23: https://en.cppreference.com/w/c/language/attributes/fallthrough + * - CPP17: https://en.cppreference.com/w/cpp/language/attributes/fallthrough + * - Else: __attribute__((__fallthrough__)) + */ +#ifndef ZSTD_FALLTHROUGH +# if ZSTD_HAS_C_ATTRIBUTE(fallthrough) +# define ZSTD_FALLTHROUGH [[fallthrough]] +# elif ZSTD_HAS_CPP_ATTRIBUTE(fallthrough) +# define ZSTD_FALLTHROUGH [[fallthrough]] +# elif __has_attribute(__fallthrough__) +# define ZSTD_FALLTHROUGH __attribute__((__fallthrough__)) +# else +# define ZSTD_FALLTHROUGH +# endif +#endif + /* detects whether we are being compiled under msan */ #ifndef ZSTD_MEMORY_SANITIZER # if __has_feature(memory_sanitizer) diff --git a/lib/compress/huf_compress.c b/lib/compress/huf_compress.c index ba296da8d..0d2fb6eb8 100644 --- a/lib/compress/huf_compress.c +++ b/lib/compress/huf_compress.c @@ -989,12 +989,12 @@ HUF_compress1X_usingCTable_internal_body(void* dst, size_t dstSize, case 11: HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 2, /* kFastFlush */ 1, /* kLastFast */ 0); break; - case 10: - case 9: + case 10: ZSTD_FALLTHROUGH; + case 9: ZSTD_FALLTHROUGH; case 8: HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 2, /* kFastFlush */ 1, /* kLastFast */ 1); break; - case 7: + case 7: ZSTD_FALLTHROUGH; default: HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 3, /* kFastFlush */ 1, /* kLastFast */ 1); break; @@ -1016,7 +1016,7 @@ HUF_compress1X_usingCTable_internal_body(void* dst, size_t dstSize, case 7: HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 8, /* kFastFlush */ 1, /* kLastFast */ 0); break; - case 6: + case 6: ZSTD_FALLTHROUGH; default: HUF_compress1X_usingCTable_internal_body_loop(&bitC, ip, srcSize, ct, /* kUnroll */ 9, /* kFastFlush */ 1, /* kLastFast */ 1); break; diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 6ca4784fd..ad2605426 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -4023,7 +4023,9 @@ static size_t ZSTD_writeFrameHeader(void* dst, size_t dstCapacity, if (!singleSegment) op[pos++] = windowLogByte; switch(dictIDSizeCode) { - default: assert(0); /* impossible */ + default: + assert(0); /* impossible */ + ZSTD_FALLTHROUGH; case 0 : break; case 1 : op[pos] = (BYTE)(dictID); pos++; break; case 2 : MEM_writeLE16(op+pos, (U16)dictID); pos+=2; break; @@ -4031,7 +4033,9 @@ static size_t ZSTD_writeFrameHeader(void* dst, size_t dstCapacity, } switch(fcsCode) { - default: assert(0); /* impossible */ + default: + assert(0); /* impossible */ + ZSTD_FALLTHROUGH; case 0 : if (singleSegment) op[pos++] = (BYTE)(pledgedSrcSize); break; case 1 : MEM_writeLE16(op+pos, (U16)(pledgedSrcSize-256)); pos+=2; break; case 2 : MEM_writeLE32(op+pos, (U32)(pledgedSrcSize)); pos+=4; break; @@ -5435,7 +5439,7 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs, zcs->outBuffFlushedSize = 0; zcs->streamStage = zcss_flush; /* pass-through to flush stage */ } - /* fall-through */ + ZSTD_FALLTHROUGH; case zcss_flush: DEBUGLOG(5, "flush stage"); assert(zcs->appliedParams.outBufferMode == ZSTD_bm_buffered); @@ -5555,7 +5559,7 @@ static size_t ZSTD_CCtx_init_compressStream2(ZSTD_CCtx* cctx, ¶ms, cctx->pledgedSrcSizePlusOne-1, dictSize, mode); } - + params.useBlockSplitter = ZSTD_resolveBlockSplitterMode(params.useBlockSplitter, ¶ms.cParams); params.ldmParams.enableLdm = ZSTD_resolveEnableLdm(params.ldmParams.enableLdm, ¶ms.cParams); params.useRowMatchFinder = ZSTD_resolveRowMatchFinderMode(params.useRowMatchFinder, ¶ms.cParams); diff --git a/lib/compress/zstd_compress_internal.h b/lib/compress/zstd_compress_internal.h index b7772522a..64c90fe6f 100644 --- a/lib/compress/zstd_compress_internal.h +++ b/lib/compress/zstd_compress_internal.h @@ -560,7 +560,7 @@ MEM_STATIC int ZSTD_literalsCompressionIsDisabled(const ZSTD_CCtx_params* cctxPa return 1; default: assert(0 /* impossible: pre-validated */); - /* fall-through */ + ZSTD_FALLTHROUGH; case ZSTD_ps_auto: return (cctxParams->cParams.strategy == ZSTD_fast) && (cctxParams->cParams.targetLength > 0); } diff --git a/lib/compress/zstd_double_fast.c b/lib/compress/zstd_double_fast.c index b9e3c5e9f..c17367859 100644 --- a/lib/compress/zstd_double_fast.c +++ b/lib/compress/zstd_double_fast.c @@ -244,8 +244,6 @@ _search_next_long: while (((ip>anchor) & (match>prefixLowest)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */ } - /* fall-through */ - _match_found: offset_2 = offset_1; offset_1 = offset; diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c index ee707ce6c..88a5ceebb 100644 --- a/lib/decompress/zstd_decompress.c +++ b/lib/decompress/zstd_decompress.c @@ -479,7 +479,9 @@ size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, s } switch(dictIDSizeCode) { - default: assert(0); /* impossible */ + default: + assert(0); /* impossible */ + ZSTD_FALLTHROUGH; case 0 : break; case 1 : dictID = ip[pos]; pos++; break; case 2 : dictID = MEM_readLE16(ip+pos); pos+=2; break; @@ -487,7 +489,9 @@ size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, s } switch(fcsID) { - default: assert(0); /* impossible */ + default: + assert(0); /* impossible */ + ZSTD_FALLTHROUGH; case 0 : if (singleSegment) frameContentSize = ip[pos]; break; case 1 : frameContentSize = MEM_readLE16(ip+pos)+256; break; case 2 : frameContentSize = MEM_readLE32(ip+pos); break; @@ -1052,7 +1056,7 @@ static ZSTD_DDict const* ZSTD_getDDict(ZSTD_DCtx* dctx) switch (dctx->dictUses) { default: assert(0 /* Impossible */); - /* fall-through */ + ZSTD_FALLTHROUGH; case ZSTD_dont_use: ZSTD_clearDict(dctx); return NULL; @@ -1116,7 +1120,9 @@ ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx) { { default: /* should not happen */ assert(0); + ZSTD_FALLTHROUGH; case ZSTDds_getFrameHeaderSize: + ZSTD_FALLTHROUGH; case ZSTDds_decodeFrameHeader: return ZSTDnit_frameHeader; case ZSTDds_decodeBlockHeader: @@ -1128,6 +1134,7 @@ ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx) { case ZSTDds_checkChecksum: return ZSTDnit_checksum; case ZSTDds_decodeSkippableHeader: + ZSTD_FALLTHROUGH; case ZSTDds_skipFrame: return ZSTDnit_skippableFrame; } @@ -1943,7 +1950,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB zds->legacyVersion = 0; zds->hostageByte = 0; zds->expectedOutBuffer = *output; - /* fall-through */ + ZSTD_FALLTHROUGH; case zdss_loadHeader : DEBUGLOG(5, "stage zdss_loadHeader (srcSize : %u)", (U32)(iend - ip)); @@ -2081,7 +2088,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB zds->outBuffSize = neededOutBuffSize; } } } zds->streamStage = zdss_read; - /* fall-through */ + ZSTD_FALLTHROUGH; case zdss_read: DEBUGLOG(5, "stage zdss_read"); @@ -2100,7 +2107,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB } } if (ip==iend) { someMoreWork = 0; break; } /* no more input */ zds->streamStage = zdss_load; - /* fall-through */ + ZSTD_FALLTHROUGH; case zdss_load: { size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds); diff --git a/lib/decompress/zstd_decompress_block.c b/lib/decompress/zstd_decompress_block.c index 9acf2f746..169058844 100644 --- a/lib/decompress/zstd_decompress_block.c +++ b/lib/decompress/zstd_decompress_block.c @@ -90,7 +90,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, case set_repeat: DEBUGLOG(5, "set_repeat flag : re-using stats from previous compressed literals block"); RETURN_ERROR_IF(dctx->litEntropy==0, dictionary_corrupted, ""); - /* fall-through */ + ZSTD_FALLTHROUGH; case set_compressed: RETURN_ERROR_IF(srcSize < 5, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3"); From 54a888b57b53620ed8352b399d2e3000cf8b81d1 Mon Sep 17 00:00:00 2001 From: Abshar Mohammed Aslam Date: Thu, 23 Sep 2021 21:54:38 +0400 Subject: [PATCH 23/38] Fix typo --- lib/zstd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/zstd.h b/lib/zstd.h index f6376bf3d..17fec948a 100644 --- a/lib/zstd.h +++ b/lib/zstd.h @@ -932,7 +932,7 @@ ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize); * Advanced dictionary and prefix API (Requires v1.4.0+) * * This API allows dictionaries to be used with ZSTD_compress2(), - * ZSTD_compressStream2(), and ZSTD_decompress(). Dictionaries are sticky, and + * ZSTD_compressStream2(), and ZSTD_decompressDCtx(). Dictionaries are sticky, and * only reset with the context is reset with ZSTD_reset_parameters or * ZSTD_reset_session_and_parameters. Prefixes are single-use. ******************************************************************************/ From d7ef97a013b55d04121ed09a8db2457c005fee41 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Thu, 23 Sep 2021 11:48:39 -0700 Subject: [PATCH 24/38] [build] Fix oss-fuzz build with the dataflow sanitizer The dataflow sanitizer requires all code to be instrumented. We can't instrument the ASM function, so we have to disable it. --- lib/common/compiler.h | 9 +++++++++ lib/decompress/huf_decompress.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/common/compiler.h b/lib/common/compiler.h index 9d7d968ce..e5292d773 100644 --- a/lib/common/compiler.h +++ b/lib/common/compiler.h @@ -233,6 +233,15 @@ # endif #endif +/* detects whether we are being compiled undef dfsan */ +#ifndef ZSTD_DATAFLOW_SANITIZER +# if __has_feature(dataflow_sanitizer) +# define ZSTD_DATAFLOW_SANITIZER 1 +# else +# define ZSTD_DATAFLOW_SANITIZER 0 +# endif +#endif + #if ZSTD_MEMORY_SANITIZER /* Not all platforms that support msan provide sanitizers/msan_interface.h. * We therefore declare the functions we need ourselves, rather than trying to diff --git a/lib/decompress/huf_decompress.c b/lib/decompress/huf_decompress.c index 2efca7dd5..128b08019 100644 --- a/lib/decompress/huf_decompress.c +++ b/lib/decompress/huf_decompress.c @@ -47,7 +47,7 @@ * Disable when MSAN is enabled. */ #if defined(__linux__) || defined(__linux) || defined(__APPLE__) -# if ZSTD_MEMORY_SANITIZER +# if ZSTD_MEMORY_SANITIZER || ZSTD_DATAFLOW_SANITIZER # define HUF_ASM_SUPPORTED 0 # else # define HUF_ASM_SUPPORTED 1 From b10085d97dc9f2acaab776503eb151ee59f7d48c Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Fri, 24 Sep 2021 14:46:45 -0700 Subject: [PATCH 25/38] [contrib][linux-kernel] Add standard warnings and -Werror to CI Test the kernel build with the standard warnings enabled so that we don't miss issues like fixed in PR #2802. Stacked on top of PR #2802 so CI passes, so it includes the fix. But, I won't merge until it is merged, so @solbjorn gets the credit for the fix. --- contrib/linux-kernel/Makefile | 10 +++- .../linux-kernel/test/include/asm/unaligned.h | 1 + .../linux-kernel/test/include/linux/xxhash.h | 9 ++- contrib/linux-kernel/test/static_test.c | 12 ++-- contrib/linux-kernel/test/test.c | 60 ++++++++++--------- lib/decompress/huf_decompress.c | 4 +- 6 files changed, 57 insertions(+), 39 deletions(-) diff --git a/contrib/linux-kernel/Makefile b/contrib/linux-kernel/Makefile index d4a7e6c69..f79de6792 100644 --- a/contrib/linux-kernel/Makefile +++ b/contrib/linux-kernel/Makefile @@ -39,6 +39,7 @@ libzstd: -DSTATIC_BMI2=0 \ -DZSTD_ADDRESS_SANITIZER=0 \ -DZSTD_MEMORY_SANITIZER=0 \ + -DZSTD_DATAFLOW_SANITIZER=0 \ -DZSTD_COMPRESS_HEAPMODE=1 \ -UZSTD_NO_INLINE \ -UNO_PREFETCH \ @@ -88,9 +89,16 @@ import-upstream: rm $(LINUX)/lib/zstd/common/xxhash.* rm $(LINUX)/lib/zstd/compress/zstdmt_* +DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ + -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \ + -Wstrict-prototypes -Wundef -Wpointer-arith \ + -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ + -Wredundant-decls -Wmissing-prototypes -Wc++-compat \ + -Wimplicit-fallthrough + .PHONY: test test: libzstd - $(MAKE) -C test run-test CFLAGS="-O3 $(CFLAGS)" -j + $(MAKE) -C test run-test CFLAGS="-O3 $(CFLAGS) $(DEBUGFLAGS) -Werror" -j .PHONY: clean clean: diff --git a/contrib/linux-kernel/test/include/asm/unaligned.h b/contrib/linux-kernel/test/include/asm/unaligned.h index 02c2d74f3..86ec4ca38 100644 --- a/contrib/linux-kernel/test/include/asm/unaligned.h +++ b/contrib/linux-kernel/test/include/asm/unaligned.h @@ -20,6 +20,7 @@ static unsigned _isLittleEndian(void) { const union { uint32_t u; uint8_t c[4]; } one = { 1 }; assert(_IS_LITTLE_ENDIAN == one.c[0]); + (void)one; return _IS_LITTLE_ENDIAN; } diff --git a/contrib/linux-kernel/test/include/linux/xxhash.h b/contrib/linux-kernel/test/include/linux/xxhash.h index 0a43bb275..7e92a706e 100644 --- a/contrib/linux-kernel/test/include/linux/xxhash.h +++ b/contrib/linux-kernel/test/include/linux/xxhash.h @@ -124,11 +124,10 @@ XXH_API uint64_t xxh64(const void *input, size_t length, uint64_t seed); static inline unsigned long xxhash(const void *input, size_t length, uint64_t seed) { -#if BITS_PER_LONG == 64 - return xxh64(input, length, seed); -#else - return xxh32(input, length, seed); -#endif + if (sizeof(size_t) == 8) + return xxh64(input, length, seed); + else + return xxh32(input, length, seed); } /*-**************************** diff --git a/contrib/linux-kernel/test/static_test.c b/contrib/linux-kernel/test/static_test.c index 50c594c77..d2b8b5a32 100644 --- a/contrib/linux-kernel/test/static_test.c +++ b/contrib/linux-kernel/test/static_test.c @@ -28,17 +28,19 @@ static const char kEmptyZstdFrame[] = { 0x28, 0xb5, 0x2f, 0xfd, 0x24, 0x00, 0x01, 0x00, 0x00, 0x99, 0xe9, 0xd8, 0x51 }; -static void test_decompress_unzstd() { +static void test_decompress_unzstd(void) { fprintf(stderr, "Testing decompress unzstd... "); { size_t const wkspSize = zstd_dctx_workspace_bound(); void* wksp = malloc(wkspSize); - CONTROL(wksp != NULL); ZSTD_DCtx* dctx = zstd_init_dctx(wksp, wkspSize); + CONTROL(wksp != NULL); CONTROL(dctx != NULL); - size_t const dSize = zstd_decompress_dctx(dctx, NULL, 0, kEmptyZstdFrame, sizeof(kEmptyZstdFrame)); - CONTROL(!zstd_is_error(dSize)); - CONTROL(dSize == 0); + { + size_t const dSize = zstd_decompress_dctx(dctx, NULL, 0, kEmptyZstdFrame, sizeof(kEmptyZstdFrame)); + CONTROL(!zstd_is_error(dSize)); + CONTROL(dSize == 0); + } free(wksp); } fprintf(stderr, "Ok\n"); diff --git a/contrib/linux-kernel/test/test.c b/contrib/linux-kernel/test/test.c index 9064be793..6cd1730bb 100644 --- a/contrib/linux-kernel/test/test.c +++ b/contrib/linux-kernel/test/test.c @@ -30,15 +30,15 @@ typedef struct { size_t compSize; } test_data_t; -test_data_t create_test_data(void) { +static test_data_t create_test_data(void) { test_data_t data; data.dataSize = 128 * 1024; - data.data = malloc(data.dataSize); + data.data = (char*)malloc(data.dataSize); CONTROL(data.data != NULL); - data.data2 = malloc(data.dataSize); + data.data2 = (char*)malloc(data.dataSize); CONTROL(data.data2 != NULL); data.compSize = zstd_compress_bound(data.dataSize); - data.comp = malloc(data.compSize); + data.comp = (char*)malloc(data.compSize); CONTROL(data.comp != NULL); memset(data.data, 0, data.dataSize); return data; @@ -54,26 +54,27 @@ static void free_test_data(test_data_t const *data) { #define MAX(a, b) ((a) > (b) ? (a) : (b)) static void test_btrfs(test_data_t const *data) { - fprintf(stderr, "testing btrfs use cases... "); size_t const size = MIN(data->dataSize, 128 * 1024); + fprintf(stderr, "testing btrfs use cases... "); for (int level = -1; level < 16; ++level) { zstd_parameters params = zstd_get_params(level, size); - CONTROL(params.cParams.windowLog <= 17); size_t const workspaceSize = MAX(zstd_cstream_workspace_bound(¶ms.cParams), zstd_dstream_workspace_bound(size)); void *workspace = malloc(workspaceSize); - CONTROL(workspace != NULL); char const *ip = data->data; char const *iend = ip + size; char *op = data->comp; char *oend = op + data->compSize; + + CONTROL(params.cParams.windowLog <= 17); + CONTROL(workspace != NULL); { zstd_cstream *cctx = zstd_init_cstream(¶ms, size, workspace, workspaceSize); - CONTROL(cctx != NULL); zstd_out_buffer out = {NULL, 0, 0}; zstd_in_buffer in = {NULL, 0, 0}; + CONTROL(cctx != NULL); for (;;) { if (in.pos == in.size) { in.src = ip; @@ -108,9 +109,9 @@ static void test_btrfs(test_data_t const *data) { oend = op + size; { zstd_dstream *dctx = zstd_init_dstream(1ULL << params.cParams.windowLog, workspace, workspaceSize); - CONTROL(dctx != NULL); zstd_out_buffer out = {NULL, 0, 0}; zstd_in_buffer in = {NULL, 0, 0}; + CONTROL(dctx != NULL); for (;;) { if (in.pos == in.size) { in.src = ip; @@ -125,15 +126,16 @@ static void test_btrfs(test_data_t const *data) { out.pos = 0; op += out.size; } - - size_t const ret = zstd_decompress_stream(dctx, &out, &in); - CONTROL(!zstd_is_error(ret)); - if (ret == 0) { - break; + { + size_t const ret = zstd_decompress_stream(dctx, &out, &in); + CONTROL(!zstd_is_error(ret)); + if (ret == 0) { + break; + } } } } - CONTROL(op - data->data2 == data->dataSize); + CONTROL((size_t)(op - data->data2) == data->dataSize); CONTROL(!memcmp(data->data, data->data2, data->dataSize)); free(workspace); } @@ -141,14 +143,14 @@ static void test_btrfs(test_data_t const *data) { } static void test_decompress_unzstd(test_data_t const *data) { - fprintf(stderr, "Testing decompress unzstd... "); size_t cSize; + fprintf(stderr, "Testing decompress unzstd... "); { zstd_parameters params = zstd_get_params(19, 0); size_t const wkspSize = zstd_cctx_workspace_bound(¶ms.cParams); void* wksp = malloc(wkspSize); - CONTROL(wksp != NULL); zstd_cctx* cctx = zstd_init_cctx(wksp, wkspSize); + CONTROL(wksp != NULL); CONTROL(cctx != NULL); cSize = zstd_compress_cctx(cctx, data->comp, data->compSize, data->data, data->dataSize, ¶ms); CONTROL(!zstd_is_error(cSize)); @@ -157,19 +159,21 @@ static void test_decompress_unzstd(test_data_t const *data) { { size_t const wkspSize = zstd_dctx_workspace_bound(); void* wksp = malloc(wkspSize); - CONTROL(wksp != NULL); zstd_dctx* dctx = zstd_init_dctx(wksp, wkspSize); + CONTROL(wksp != NULL); CONTROL(dctx != NULL); - size_t const dSize = zstd_decompress_dctx(dctx, data->data2, data->dataSize, data->comp, cSize); - CONTROL(!zstd_is_error(dSize)); - CONTROL(dSize == data->dataSize); + { + size_t const dSize = zstd_decompress_dctx(dctx, data->data2, data->dataSize, data->comp, cSize); + CONTROL(!zstd_is_error(dSize)); + CONTROL(dSize == data->dataSize); + } CONTROL(!memcmp(data->data, data->data2, data->dataSize)); free(wksp); } fprintf(stderr, "Ok\n"); } -static void test_f2fs() { +static void test_f2fs(void) { fprintf(stderr, "testing f2fs uses... "); CONTROL(zstd_min_clevel() < 0); CONTROL(zstd_max_clevel() == 22); @@ -182,7 +186,7 @@ static void __attribute__((noinline)) use(void *x) { asm volatile("" : "+r"(x)); } -static void __attribute__((noinline)) set_stack() { +static void __attribute__((noinline)) set_stack(void) { char stack[8192]; g_stack = stack; @@ -190,14 +194,16 @@ static void __attribute__((noinline)) set_stack() { use(g_stack); } -static void __attribute__((noinline)) check_stack() { +static void __attribute__((noinline)) check_stack(void) { size_t cleanStack = 0; while (cleanStack < 8192 && g_stack[cleanStack] == 0x33) { ++cleanStack; } - size_t const stackSize = 8192 - cleanStack; - fprintf(stderr, "Maximum stack size: %zu\n", stackSize); - CONTROL(stackSize <= 2048 + 512); + { + size_t const stackSize = 8192 - cleanStack; + fprintf(stderr, "Maximum stack size: %zu\n", stackSize); + CONTROL(stackSize <= 2048 + 512); + } } static void test_stack_usage(test_data_t const *data) { diff --git a/lib/decompress/huf_decompress.c b/lib/decompress/huf_decompress.c index 128b08019..1a77139ee 100644 --- a/lib/decompress/huf_decompress.c +++ b/lib/decompress/huf_decompress.c @@ -47,7 +47,9 @@ * Disable when MSAN is enabled. */ #if defined(__linux__) || defined(__linux) || defined(__APPLE__) -# if ZSTD_MEMORY_SANITIZER || ZSTD_DATAFLOW_SANITIZER +# if ZSTD_MEMORY_SANITIZER +# define HUF_ASM_SUPPORTED 0 +# elif ZSTD_DATAFLOW_SANITIZER # define HUF_ASM_SUPPORTED 0 # else # define HUF_ASM_SUPPORTED 1 From 71526e6f296c4d31b21ba93862698405809ba2c6 Mon Sep 17 00:00:00 2001 From: Alexander Lobakin Date: Fri, 24 Sep 2021 21:50:37 +0200 Subject: [PATCH 26/38] [contrib][linux] Fix -Wundef inside Linux kernel tree Commit d7ef97a013b5 ("[build] Fix oss-fuzz build with the dataflow sanitizer") broke build inside Linux-kernel after 'import', as it no longer can conditionally remove ZSTD_MEMORY_SANITIZER definition from the #if DEF_A || DEF_B block. This emits -Wundef warning which can be treated as error. Split this preprocessor condition into two separate conditions to fix this. Fixes: d7ef97a013b5 ("[build] Fix oss-fuzz build with the dataflow sanitizer") Signed-off-by: Alexander Lobakin --- lib/decompress/huf_decompress.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/decompress/huf_decompress.c b/lib/decompress/huf_decompress.c index 128b08019..9f711f39e 100644 --- a/lib/decompress/huf_decompress.c +++ b/lib/decompress/huf_decompress.c @@ -47,11 +47,13 @@ * Disable when MSAN is enabled. */ #if defined(__linux__) || defined(__linux) || defined(__APPLE__) -# if ZSTD_MEMORY_SANITIZER || ZSTD_DATAFLOW_SANITIZER +# if ZSTD_MEMORY_SANITIZER +# define HUF_ASM_SUPPORTED 0 +# elif ZSTD_DATAFLOW_SANITIZER # define HUF_ASM_SUPPORTED 0 # else # define HUF_ASM_SUPPORTED 1 -#endif +# endif #else # define HUF_ASM_SUPPORTED 0 #endif From 02296cac8293bdc68cd39f998dbba05a301461f3 Mon Sep 17 00:00:00 2001 From: Norbert Lange Date: Sat, 25 Sep 2021 01:19:11 +0200 Subject: [PATCH 27/38] decompress: conditionally remove legacy members from context Remove the then unneeded variables from the struct, and all accesses to them. --- lib/decompress/zstd_decompress.c | 4 ++++ lib/decompress/zstd_decompress_internal.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c index 88a5ceebb..bcf36b911 100644 --- a/lib/decompress/zstd_decompress.c +++ b/lib/decompress/zstd_decompress.c @@ -255,8 +255,10 @@ static void ZSTD_initDCtx_internal(ZSTD_DCtx* dctx) dctx->inBuffSize = 0; dctx->outBuffSize = 0; dctx->streamStage = zdss_init; +#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) dctx->legacyContext = NULL; dctx->previousLegacyVersion = 0; +#endif dctx->noForwardProgress = 0; dctx->oversizedDuration = 0; dctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid()); @@ -1947,7 +1949,9 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB DEBUGLOG(5, "stage zdss_init => transparent reset "); zds->streamStage = zdss_loadHeader; zds->lhSize = zds->inPos = zds->outStart = zds->outEnd = 0; +#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) zds->legacyVersion = 0; +#endif zds->hostageByte = 0; zds->expectedOutBuffer = *output; ZSTD_FALLTHROUGH; diff --git a/lib/decompress/zstd_decompress_internal.h b/lib/decompress/zstd_decompress_internal.h index ebda0c903..cb43539ad 100644 --- a/lib/decompress/zstd_decompress_internal.h +++ b/lib/decompress/zstd_decompress_internal.h @@ -158,9 +158,11 @@ struct ZSTD_DCtx_s size_t outStart; size_t outEnd; size_t lhSize; +#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) void* legacyContext; U32 previousLegacyVersion; U32 legacyVersion; +#endif U32 hostageByte; int noForwardProgress; ZSTD_bufferMode_e outBufferMode; From 0d455406950cbd5c2ab737e0a9d03a5d86c8e603 Mon Sep 17 00:00:00 2001 From: Norbert Lange Date: Sun, 26 Sep 2021 11:14:35 +0200 Subject: [PATCH 28/38] decompress: conditionally remove bmi2 from context Use an helper function, which will just return 0 in case the feature is disabled. Allows constant propagation and removal of dead code. --- lib/decompress/zstd_decompress.c | 4 +++- lib/decompress/zstd_decompress_block.c | 18 +++++++++--------- lib/decompress/zstd_decompress_internal.h | 10 ++++++++++ tests/fullbench.c | 2 +- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c index bcf36b911..377c87d26 100644 --- a/lib/decompress/zstd_decompress.c +++ b/lib/decompress/zstd_decompress.c @@ -261,7 +261,9 @@ static void ZSTD_initDCtx_internal(ZSTD_DCtx* dctx) #endif dctx->noForwardProgress = 0; dctx->oversizedDuration = 0; - dctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid()); +#if DYNAMIC_BMI2 + dctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid()) +#endif dctx->ddictSet = NULL; ZSTD_DCtx_resetParameters(dctx); #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION diff --git a/lib/decompress/zstd_decompress_block.c b/lib/decompress/zstd_decompress_block.c index 169058844..054e62526 100644 --- a/lib/decompress/zstd_decompress_block.c +++ b/lib/decompress/zstd_decompress_block.c @@ -133,11 +133,11 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, if (singleStream) { hufSuccess = HUF_decompress1X_usingDTable_bmi2( dctx->litBuffer, litSize, istart+lhSize, litCSize, - dctx->HUFptr, dctx->bmi2); + dctx->HUFptr, ZSTD_DCtx_get_bmi2(dctx)); } else { hufSuccess = HUF_decompress4X_usingDTable_bmi2( dctx->litBuffer, litSize, istart+lhSize, litCSize, - dctx->HUFptr, dctx->bmi2); + dctx->HUFptr, ZSTD_DCtx_get_bmi2(dctx)); } } else { if (singleStream) { @@ -150,13 +150,13 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, hufSuccess = HUF_decompress1X1_DCtx_wksp_bmi2( dctx->entropy.hufTable, dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->workspace, - sizeof(dctx->workspace), dctx->bmi2); + sizeof(dctx->workspace), ZSTD_DCtx_get_bmi2(dctx)); #endif } else { hufSuccess = HUF_decompress4X_hufOnly_wksp_bmi2( dctx->entropy.hufTable, dctx->litBuffer, litSize, istart+lhSize, litCSize, dctx->workspace, - sizeof(dctx->workspace), dctx->bmi2); + sizeof(dctx->workspace), ZSTD_DCtx_get_bmi2(dctx)); } } @@ -620,7 +620,7 @@ size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr, LL_defaultDTable, dctx->fseEntropy, dctx->ddictIsCold, nbSeq, dctx->workspace, sizeof(dctx->workspace), - dctx->bmi2); + ZSTD_DCtx_get_bmi2(dctx)); RETURN_ERROR_IF(ZSTD_isError(llhSize), corruption_detected, "ZSTD_buildSeqTable failed"); ip += llhSize; } @@ -632,7 +632,7 @@ size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr, OF_defaultDTable, dctx->fseEntropy, dctx->ddictIsCold, nbSeq, dctx->workspace, sizeof(dctx->workspace), - dctx->bmi2); + ZSTD_DCtx_get_bmi2(dctx)); RETURN_ERROR_IF(ZSTD_isError(ofhSize), corruption_detected, "ZSTD_buildSeqTable failed"); ip += ofhSize; } @@ -644,7 +644,7 @@ size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr, ML_defaultDTable, dctx->fseEntropy, dctx->ddictIsCold, nbSeq, dctx->workspace, sizeof(dctx->workspace), - dctx->bmi2); + ZSTD_DCtx_get_bmi2(dctx)); RETURN_ERROR_IF(ZSTD_isError(mlhSize), corruption_detected, "ZSTD_buildSeqTable failed"); ip += mlhSize; } @@ -1379,7 +1379,7 @@ ZSTD_decompressSequences(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, { DEBUGLOG(5, "ZSTD_decompressSequences"); #if DYNAMIC_BMI2 - if (dctx->bmi2) { + if (ZSTD_DCtx_get_bmi2(dctx)) { return ZSTD_decompressSequences_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); } #endif @@ -1403,7 +1403,7 @@ ZSTD_decompressSequencesLong(ZSTD_DCtx* dctx, { DEBUGLOG(5, "ZSTD_decompressSequencesLong"); #if DYNAMIC_BMI2 - if (dctx->bmi2) { + if (ZSTD_DCtx_get_bmi2(dctx)) { return ZSTD_decompressSequencesLong_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset, frame); } #endif diff --git a/lib/decompress/zstd_decompress_internal.h b/lib/decompress/zstd_decompress_internal.h index cb43539ad..2a15bd874 100644 --- a/lib/decompress/zstd_decompress_internal.h +++ b/lib/decompress/zstd_decompress_internal.h @@ -136,7 +136,9 @@ struct ZSTD_DCtx_s size_t litSize; size_t rleSize; size_t staticSize; +#if DYNAMIC_BMI2 != 0 int bmi2; /* == 1 if the CPU supports BMI2 and 0 otherwise. CPU support is determined dynamically once per context lifetime. */ +#endif /* dictionary */ ZSTD_DDict* ddictLocal; @@ -185,6 +187,14 @@ struct ZSTD_DCtx_s #endif }; /* typedef'd to ZSTD_DCtx within "zstd.h" */ +MEM_STATIC int ZSTD_DCtx_get_bmi2(const struct ZSTD_DCtx_s *dctx) { +#if DYNAMIC_BMI2 != 0 + return dctx->bmi2; +#else + (void)dctx; + return 0; +#endif +} /*-******************************************************* * Shared internal functions diff --git a/tests/fullbench.c b/tests/fullbench.c index a71117e09..dc20b837b 100644 --- a/tests/fullbench.c +++ b/tests/fullbench.c @@ -177,7 +177,7 @@ FORCE_NOINLINE size_t ZSTD_decodeLiteralsHeader(ZSTD_DCtx* dctx, void const* src dctx->entropy.hufTable, istart+lhSize, litCSize, dctx->workspace, sizeof(dctx->workspace), - dctx->bmi2); + ZSTD_DCtx_get_bmi2(dctx)); #else return HUF_readDTableX2_wksp( dctx->entropy.hufTable, From 6763f403318034372b8d52de73a23066d04ec750 Mon Sep 17 00:00:00 2001 From: Norbert Lange Date: Sun, 26 Sep 2021 10:59:05 +0200 Subject: [PATCH 29/38] zstd_decompress: use a helper function for context create Multiple ZSTD_createDCtx* functions call other (public) ZSTD_createDCtx* functions, this makes it harder for humans and compilers to throw out code that is not used. This farms out the logic into a static function, if a program only uses a single ZSTD_createDCtx variant, all others can be easily dropped and the remaining implementation can be specialized. --- lib/decompress/zstd_decompress.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c index 377c87d26..4a4b3f72a 100644 --- a/lib/decompress/zstd_decompress.c +++ b/lib/decompress/zstd_decompress.c @@ -262,7 +262,7 @@ static void ZSTD_initDCtx_internal(ZSTD_DCtx* dctx) dctx->noForwardProgress = 0; dctx->oversizedDuration = 0; #if DYNAMIC_BMI2 - dctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid()) + dctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid()); #endif dctx->ddictSet = NULL; ZSTD_DCtx_resetParameters(dctx); @@ -284,8 +284,7 @@ ZSTD_DCtx* ZSTD_initStaticDCtx(void *workspace, size_t workspaceSize) return dctx; } -ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem) -{ +static ZSTD_DCtx* ZSTD_createDCtx_internal(ZSTD_customMem customMem) { if ((!customMem.customAlloc) ^ (!customMem.customFree)) return NULL; { ZSTD_DCtx* const dctx = (ZSTD_DCtx*)ZSTD_customMalloc(sizeof(*dctx), customMem); @@ -296,10 +295,15 @@ ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem) } } +ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem) +{ + return ZSTD_createDCtx_internal(customMem); +} + ZSTD_DCtx* ZSTD_createDCtx(void) { DEBUGLOG(3, "ZSTD_createDCtx"); - return ZSTD_createDCtx_advanced(ZSTD_defaultCMem); + return ZSTD_createDCtx_internal(ZSTD_defaultCMem); } static void ZSTD_clearDict(ZSTD_DCtx* dctx) @@ -1082,7 +1086,7 @@ size_t ZSTD_decompress(void* dst, size_t dstCapacity, const void* src, size_t sr { #if defined(ZSTD_HEAPMODE) && (ZSTD_HEAPMODE>=1) size_t regenSize; - ZSTD_DCtx* const dctx = ZSTD_createDCtx(); + ZSTD_DCtx* const dctx = ZSTD_createDCtx_internal(ZSTD_defaultCMem); RETURN_ERROR_IF(dctx==NULL, memory_allocation, "NULL pointer!"); regenSize = ZSTD_decompressDCtx(dctx, dst, dstCapacity, src, srcSize); ZSTD_freeDCtx(dctx); @@ -1547,7 +1551,7 @@ size_t ZSTD_decompress_usingDDict(ZSTD_DCtx* dctx, ZSTD_DStream* ZSTD_createDStream(void) { DEBUGLOG(3, "ZSTD_createDStream"); - return ZSTD_createDStream_advanced(ZSTD_defaultCMem); + return ZSTD_createDCtx_internal(ZSTD_defaultCMem); } ZSTD_DStream* ZSTD_initStaticDStream(void *workspace, size_t workspaceSize) @@ -1557,7 +1561,7 @@ ZSTD_DStream* ZSTD_initStaticDStream(void *workspace, size_t workspaceSize) ZSTD_DStream* ZSTD_createDStream_advanced(ZSTD_customMem customMem) { - return ZSTD_createDCtx_advanced(customMem); + return ZSTD_createDCtx_internal(customMem); } size_t ZSTD_freeDStream(ZSTD_DStream* zds) From 70a80b6be8d88c7a2cda611e0fcd8c2a8096c3b8 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Sun, 26 Sep 2021 06:48:52 -0700 Subject: [PATCH 30/38] minor : makes the "stable" property of Zstandard format more prominent --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b2ab80998..09683a66f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ __Zstandard__, or `zstd` as short version, is a fast lossless compression algori targeting real-time compression scenarios at zlib-level and better compression ratios. It's backed by a very fast entropy stage, provided by [Huff0 and FSE library](https://github.com/Cyan4973/FiniteStateEntropy). -The project is provided as an open-source dual [BSD](LICENSE) and [GPLv2](COPYING) licensed **C** library, +Zstandard's format is stable and documented in RFC8878. Several independent implementations are already available. +This repository represents the reference implementation, provided as an open-source dual [BSD](LICENSE) and [GPLv2](COPYING) licensed **C** library, and a command line utility producing and decoding `.zst`, `.gz`, `.xz` and `.lz4` files. Should your project require another programming language, a list of known ports and bindings is provided on [Zstandard homepage](http://www.zstd.net/#other-languages). From ecb2daeaa98bbe1774162f7a3f8185029d493588 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Sun, 26 Sep 2021 06:58:10 -0700 Subject: [PATCH 31/38] added link to RFC --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 09683a66f..44cce47ee 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ __Zstandard__, or `zstd` as short version, is a fast lossless compression algori targeting real-time compression scenarios at zlib-level and better compression ratios. It's backed by a very fast entropy stage, provided by [Huff0 and FSE library](https://github.com/Cyan4973/FiniteStateEntropy). -Zstandard's format is stable and documented in RFC8878. Several independent implementations are already available. +Zstandard's format is stable and documented in [RFC8878](https://datatracker.ietf.org/doc/html/rfc8878). Multiple independent implementations are already available. This repository represents the reference implementation, provided as an open-source dual [BSD](LICENSE) and [GPLv2](COPYING) licensed **C** library, and a command line utility producing and decoding `.zst`, `.gz`, `.xz` and `.lz4` files. Should your project require another programming language, From 2ed14c2476a59a105a13fc05e6127122c07e6caa Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Sun, 26 Sep 2021 08:44:18 -0700 Subject: [PATCH 32/38] minor : fix comment provide correct reasons to include zstd_internal.h --- lib/decompress/zstd_decompress_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/decompress/zstd_decompress_internal.h b/lib/decompress/zstd_decompress_internal.h index ebda0c903..0b1bf426f 100644 --- a/lib/decompress/zstd_decompress_internal.h +++ b/lib/decompress/zstd_decompress_internal.h @@ -20,7 +20,7 @@ * Dependencies *********************************************************/ #include "../common/mem.h" /* BYTE, U16, U32 */ -#include "../common/zstd_internal.h" /* ZSTD_seqSymbol */ +#include "../common/zstd_internal.h" /* constants : MaxLL, MaxML, MaxOff, LLFSELog, etc. */ From a07ddb47f7d43529dde4922786516f7ec14754cb Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Mon, 27 Sep 2021 13:56:07 -0700 Subject: [PATCH 33/38] [huf] Fix OSS-Fuzz assert PR #2784 introduced a bug in the decompressor that caused some valid inputs to fail to decompress. The bitstream isn't reloaded after the 4X* loop if the number of elements remaining is small enough, causing us to read more bits than are available in the bitcontainer. This was caught by the MSAN fuzzer in OSS-Fuzz because the assembly implementation isn't used in the MSAN build. Credit to OSS-Fuzz. --- lib/decompress/huf_decompress.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/decompress/huf_decompress.c b/lib/decompress/huf_decompress.c index 128b08019..7529034ef 100644 --- a/lib/decompress/huf_decompress.c +++ b/lib/decompress/huf_decompress.c @@ -531,6 +531,8 @@ HUF_decodeStreamX1(BYTE* p, BIT_DStream_t* const bitDPtr, BYTE* const pEnd, cons HUF_DECODE_SYMBOLX1_2(p, bitDPtr); HUF_DECODE_SYMBOLX1_0(p, bitDPtr); } + } else { + BIT_reloadDStream(bitDPtr); } /* [0-3] symbols remaining */ @@ -1218,6 +1220,8 @@ HUF_decodeStreamX2(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* const pEnd, HUF_DECODE_SYMBOLX2_0(p, bitDPtr); } } + } else { + BIT_reloadDStream(bitDPtr); } /* closer to end : up to 2 symbols at a time */ From b8fd6bf30cd0c25b660b95aac7aacad55c03dc9a Mon Sep 17 00:00:00 2001 From: Sen Huang Date: Wed, 18 Aug 2021 06:52:17 -0700 Subject: [PATCH 34/38] Skip most long matches in lazy hash table update --- lib/compress/zstd_lazy.c | 17 +- tests/regression/results.csv | 1580 +++++++++++++++++----------------- 2 files changed, 804 insertions(+), 793 deletions(-) diff --git a/lib/compress/zstd_lazy.c b/lib/compress/zstd_lazy.c index ed50550f3..e9ee6ebd4 100644 --- a/lib/compress/zstd_lazy.c +++ b/lib/compress/zstd_lazy.c @@ -971,7 +971,7 @@ FORCE_INLINE_TEMPLATE void ZSTD_row_prefetch(U32 const* hashTable, U16 const* ta * Fill up the hash cache starting at idx, prefetching up to ZSTD_ROW_HASH_CACHE_SIZE entries, * but not beyond iLimit. */ -static void ZSTD_row_fillHashCache(ZSTD_matchState_t* ms, const BYTE* base, +FORCE_INLINE_TEMPLATE void ZSTD_row_fillHashCache(ZSTD_matchState_t* ms, const BYTE* base, U32 const rowLog, U32 const mls, U32 idx, const BYTE* const iLimit) { @@ -1022,9 +1022,20 @@ FORCE_INLINE_TEMPLATE void ZSTD_row_update_internal(ZSTD_matchState_t* ms, const U32* const hashTable = ms->hashTable; U16* const tagTable = ms->tagTable; U32 const hashLog = ms->rowHashLog; + U32 idx = ms->nextToUpdate; const BYTE* const base = ms->window.base; const U32 target = (U32)(ip - base); - U32 idx = ms->nextToUpdate; + const U32 kMaxPositionsToUpdate = 256; + + assert(target >= idx); + if (useCache) { + /* Only skip positions when using hash cache, i.e. + if we are loading a dict, don't skip anything */ + if (UNLIKELY(target - idx > kMaxPositionsToUpdate)) { + idx = target - kMaxPositionsToUpdate; + ZSTD_row_fillHashCache(ms, base, rowLog, mls, idx, ip+1); + } + } DEBUGLOG(6, "ZSTD_row_update_internal(): nextToUpdate=%u, current=%u", idx, target); for (; idx < target; ++idx) { @@ -1037,7 +1048,7 @@ FORCE_INLINE_TEMPLATE void ZSTD_row_update_internal(ZSTD_matchState_t* ms, const U32 const pos = ZSTD_row_nextIndex(tagRow, rowMask); assert(hash == ZSTD_hashPtr(base + idx, hashLog + ZSTD_ROW_HASH_TAG_BITS, mls)); - ((BYTE*)tagRow)[pos + ZSTD_ROW_HASH_TAG_OFFSET] = hash & ZSTD_ROW_HASH_TAG_MASK; + tagRow[pos + ZSTD_ROW_HASH_TAG_OFFSET] = hash & ZSTD_ROW_HASH_TAG_MASK; row[pos] = idx; } ms->nextToUpdate = target; diff --git a/tests/regression/results.csv b/tests/regression/results.csv index 923b4498b..66be6cb5b 100644 --- a/tests/regression/results.csv +++ b/tests/regression/results.csv @@ -1,72 +1,72 @@ Data, Config, Method, Total compressed size -silesia.tar, level -5, compress simple, 7359401 -silesia.tar, level -3, compress simple, 6901672 -silesia.tar, level -1, compress simple, 6182241 -silesia.tar, level 0, compress simple, 4861424 -silesia.tar, level 1, compress simple, 5331946 -silesia.tar, level 3, compress simple, 4861424 +silesia.tar, level -5, compress simple, 6738593 +silesia.tar, level -3, compress simple, 6446372 +silesia.tar, level -1, compress simple, 6186042 +silesia.tar, level 0, compress simple, 4861423 +silesia.tar, level 1, compress simple, 5334885 +silesia.tar, level 3, compress simple, 4861423 silesia.tar, level 4, compress simple, 4799632 -silesia.tar, level 5, compress simple, 4650202 -silesia.tar, level 6, compress simple, 4616811 -silesia.tar, level 7, compress simple, 4576829 -silesia.tar, level 9, compress simple, 4552584 -silesia.tar, level 13, compress simple, 4502956 -silesia.tar, level 16, compress simple, 4360527 -silesia.tar, level 19, compress simple, 4267266 -silesia.tar, uncompressed literals, compress simple, 4861424 -silesia.tar, uncompressed literals optimal, compress simple, 4267266 -silesia.tar, huffman literals, compress simple, 6182241 -github.tar, level -5, compress simple, 66914 -github.tar, level -3, compress simple, 52127 -github.tar, level -1, compress simple, 42560 +silesia.tar, level 5, compress simple, 4650387 +silesia.tar, level 6, compress simple, 4617089 +silesia.tar, level 7, compress simple, 4576951 +silesia.tar, level 9, compress simple, 4552638 +silesia.tar, level 13, compress simple, 4491768 +silesia.tar, level 16, compress simple, 4356834 +silesia.tar, level 19, compress simple, 4264388 +silesia.tar, uncompressed literals, compress simple, 4861423 +silesia.tar, uncompressed literals optimal, compress simple, 4264388 +silesia.tar, huffman literals, compress simple, 6186042 +github.tar, level -5, compress simple, 46856 +github.tar, level -3, compress simple, 43754 +github.tar, level -1, compress simple, 42490 github.tar, level 0, compress simple, 38441 -github.tar, level 1, compress simple, 39200 +github.tar, level 1, compress simple, 39265 github.tar, level 3, compress simple, 38441 github.tar, level 4, compress simple, 38467 -github.tar, level 5, compress simple, 38376 -github.tar, level 6, compress simple, 38610 -github.tar, level 7, compress simple, 38073 -github.tar, level 9, compress simple, 36767 -github.tar, level 13, compress simple, 35501 -github.tar, level 16, compress simple, 40471 -github.tar, level 19, compress simple, 32134 +github.tar, level 5, compress simple, 38394 +github.tar, level 6, compress simple, 38669 +github.tar, level 7, compress simple, 38153 +github.tar, level 9, compress simple, 36768 +github.tar, level 13, compress simple, 35621 +github.tar, level 16, compress simple, 40255 +github.tar, level 19, compress simple, 32837 github.tar, uncompressed literals, compress simple, 38441 -github.tar, uncompressed literals optimal, compress simple, 32134 -github.tar, huffman literals, compress simple, 42560 -silesia, level -5, compress cctx, 7354675 -silesia, level -3, compress cctx, 6902374 -silesia, level -1, compress cctx, 6177565 -silesia, level 0, compress cctx, 4849553 -silesia, level 1, compress cctx, 5309098 -silesia, level 3, compress cctx, 4849553 -silesia, level 4, compress cctx, 4786968 -silesia, level 5, compress cctx, 4638961 -silesia, level 6, compress cctx, 4605369 -silesia, level 7, compress cctx, 4567204 -silesia, level 9, compress cctx, 4543310 -silesia, level 13, compress cctx, 4493990 -silesia, level 16, compress cctx, 4359864 -silesia, level 19, compress cctx, 4296880 -silesia, long distance mode, compress cctx, 4849553 -silesia, multithreaded, compress cctx, 4849553 -silesia, multithreaded long distance mode, compress cctx, 4849553 +github.tar, uncompressed literals optimal, compress simple, 32837 +github.tar, huffman literals, compress simple, 42490 +silesia, level -5, compress cctx, 6737607 +silesia, level -3, compress cctx, 6444677 +silesia, level -1, compress cctx, 6178460 +silesia, level 0, compress cctx, 4849551 +silesia, level 1, compress cctx, 5313202 +silesia, level 3, compress cctx, 4849551 +silesia, level 4, compress cctx, 4786969 +silesia, level 5, compress cctx, 4639132 +silesia, level 6, compress cctx, 4605629 +silesia, level 7, compress cctx, 4567307 +silesia, level 9, compress cctx, 4543330 +silesia, level 13, compress cctx, 4482131 +silesia, level 16, compress cctx, 4360251 +silesia, level 19, compress cctx, 4283236 +silesia, long distance mode, compress cctx, 4849551 +silesia, multithreaded, compress cctx, 4849551 +silesia, multithreaded long distance mode, compress cctx, 4849551 silesia, small window log, compress cctx, 7084179 silesia, small hash log, compress cctx, 6526141 -silesia, small chain log, compress cctx, 4912197 -silesia, explicit params, compress cctx, 4794481 -silesia, uncompressed literals, compress cctx, 4849553 -silesia, uncompressed literals optimal, compress cctx, 4296880 -silesia, huffman literals, compress cctx, 6177565 -silesia, multithreaded with advanced params, compress cctx, 4849553 -github, level -5, compress cctx, 232315 +silesia, small chain log, compress cctx, 4912199 +silesia, explicit params, compress cctx, 4794917 +silesia, uncompressed literals, compress cctx, 4849551 +silesia, uncompressed literals optimal, compress cctx, 4283236 +silesia, huffman literals, compress cctx, 6178460 +silesia, multithreaded with advanced params, compress cctx, 4849551 +github, level -5, compress cctx, 205285 github, level -5 with dict, compress cctx, 47294 -github, level -3, compress cctx, 220760 +github, level -3, compress cctx, 190643 github, level -3 with dict, compress cctx, 48047 -github, level -1, compress cctx, 175468 +github, level -1, compress cctx, 175568 github, level -1 with dict, compress cctx, 43527 github, level 0, compress cctx, 136335 github, level 0 with dict, compress cctx, 41534 -github, level 1, compress cctx, 142365 +github, level 1, compress cctx, 142465 github, level 1 with dict, compress cctx, 42157 github, level 3, compress cctx, 136335 github, level 3 with dict, compress cctx, 41534 @@ -95,68 +95,68 @@ github, small chain log, compress github, explicit params, compress cctx, 140932 github, uncompressed literals, compress cctx, 136335 github, uncompressed literals optimal, compress cctx, 134064 -github, huffman literals, compress cctx, 175468 +github, huffman literals, compress cctx, 175568 github, multithreaded with advanced params, compress cctx, 141102 -silesia, level -5, zstdcli, 7354723 -silesia, level -3, zstdcli, 6902422 -silesia, level -1, zstdcli, 6177613 -silesia, level 0, zstdcli, 4849601 -silesia, level 1, zstdcli, 5309146 -silesia, level 3, zstdcli, 4849601 -silesia, level 4, zstdcli, 4787016 -silesia, level 5, zstdcli, 4639009 -silesia, level 6, zstdcli, 4605417 -silesia, level 7, zstdcli, 4567252 -silesia, level 9, zstdcli, 4543358 -silesia, level 13, zstdcli, 4494038 -silesia, level 16, zstdcli, 4359912 -silesia, level 19, zstdcli, 4296928 +silesia, level -5, zstdcli, 6737655 +silesia, level -3, zstdcli, 6444725 +silesia, level -1, zstdcli, 6178508 +silesia, level 0, zstdcli, 4849599 +silesia, level 1, zstdcli, 5313250 +silesia, level 3, zstdcli, 4849599 +silesia, level 4, zstdcli, 4787017 +silesia, level 5, zstdcli, 4639180 +silesia, level 6, zstdcli, 4605677 +silesia, level 7, zstdcli, 4567355 +silesia, level 9, zstdcli, 4543378 +silesia, level 13, zstdcli, 4482179 +silesia, level 16, zstdcli, 4360299 +silesia, level 19, zstdcli, 4283284 silesia, long distance mode, zstdcli, 4840807 -silesia, multithreaded, zstdcli, 4849601 +silesia, multithreaded, zstdcli, 4849599 silesia, multithreaded long distance mode, zstdcli, 4840807 silesia, small window log, zstdcli, 7095967 silesia, small hash log, zstdcli, 6526189 -silesia, small chain log, zstdcli, 4912245 -silesia, explicit params, zstdcli, 4795856 +silesia, small chain log, zstdcli, 4912247 +silesia, explicit params, zstdcli, 4796282 silesia, uncompressed literals, zstdcli, 5128030 -silesia, uncompressed literals optimal, zstdcli, 4319566 -silesia, huffman literals, zstdcli, 5326394 +silesia, uncompressed literals optimal, zstdcli, 4317944 +silesia, huffman literals, zstdcli, 5326317 silesia, multithreaded with advanced params, zstdcli, 5128030 -silesia.tar, level -5, zstdcli, 7363866 -silesia.tar, level -3, zstdcli, 6902158 -silesia.tar, level -1, zstdcli, 6182939 -silesia.tar, level 0, zstdcli, 4861512 -silesia.tar, level 1, zstdcli, 5333183 -silesia.tar, level 3, zstdcli, 4861512 -silesia.tar, level 4, zstdcli, 4800528 -silesia.tar, level 5, zstdcli, 4651160 -silesia.tar, level 6, zstdcli, 4618402 -silesia.tar, level 7, zstdcli, 4578884 -silesia.tar, level 9, zstdcli, 4553499 -silesia.tar, level 13, zstdcli, 4502960 -silesia.tar, level 16, zstdcli, 4360531 -silesia.tar, level 19, zstdcli, 4267270 -silesia.tar, no source size, zstdcli, 4861508 +silesia.tar, level -5, zstdcli, 6738934 +silesia.tar, level -3, zstdcli, 6448419 +silesia.tar, level -1, zstdcli, 6186912 +silesia.tar, level 0, zstdcli, 4861511 +silesia.tar, level 1, zstdcli, 5336318 +silesia.tar, level 3, zstdcli, 4861511 +silesia.tar, level 4, zstdcli, 4800529 +silesia.tar, level 5, zstdcli, 4651342 +silesia.tar, level 6, zstdcli, 4618674 +silesia.tar, level 7, zstdcli, 4579009 +silesia.tar, level 9, zstdcli, 4553551 +silesia.tar, level 13, zstdcli, 4491772 +silesia.tar, level 16, zstdcli, 4356838 +silesia.tar, level 19, zstdcli, 4264392 +silesia.tar, no source size, zstdcli, 4861507 silesia.tar, long distance mode, zstdcli, 4853225 -silesia.tar, multithreaded, zstdcli, 4861512 +silesia.tar, multithreaded, zstdcli, 4861511 silesia.tar, multithreaded long distance mode, zstdcli, 4853225 silesia.tar, small window log, zstdcli, 7101576 -silesia.tar, small hash log, zstdcli, 6529289 -silesia.tar, small chain log, zstdcli, 4917022 -silesia.tar, explicit params, zstdcli, 4821274 +silesia.tar, small hash log, zstdcli, 6529286 +silesia.tar, small chain log, zstdcli, 4917020 +silesia.tar, explicit params, zstdcli, 4821593 silesia.tar, uncompressed literals, zstdcli, 5129559 -silesia.tar, uncompressed literals optimal, zstdcli, 4310145 -silesia.tar, huffman literals, zstdcli, 5344915 +silesia.tar, uncompressed literals optimal, zstdcli, 4307404 +silesia.tar, huffman literals, zstdcli, 5347610 silesia.tar, multithreaded with advanced params, zstdcli, 5129559 -github, level -5, zstdcli, 234315 +github, level -5, zstdcli, 207285 github, level -5 with dict, zstdcli, 48718 -github, level -3, zstdcli, 222760 +github, level -3, zstdcli, 192643 github, level -3 with dict, zstdcli, 47395 -github, level -1, zstdcli, 177468 +github, level -1, zstdcli, 177568 github, level -1 with dict, zstdcli, 45170 github, level 0, zstdcli, 138335 github, level 0 with dict, zstdcli, 43148 -github, level 1, zstdcli, 144365 +github, level 1, zstdcli, 144465 github, level 1 with dict, zstdcli, 43682 github, level 3, zstdcli, 138335 github, level 3 with dict, zstdcli, 43148 @@ -185,36 +185,36 @@ github, small chain log, zstdcli, github, explicit params, zstdcli, 136197 github, uncompressed literals, zstdcli, 167915 github, uncompressed literals optimal, zstdcli, 159227 -github, huffman literals, zstdcli, 144365 +github, huffman literals, zstdcli, 144465 github, multithreaded with advanced params, zstdcli, 167915 -github.tar, level -5, zstdcli, 66918 -github.tar, level -5 with dict, zstdcli, 51529 -github.tar, level -3, zstdcli, 52131 -github.tar, level -3 with dict, zstdcli, 44246 -github.tar, level -1, zstdcli, 42564 -github.tar, level -1 with dict, zstdcli, 41140 +github.tar, level -5, zstdcli, 46860 +github.tar, level -5 with dict, zstdcli, 44575 +github.tar, level -3, zstdcli, 43758 +github.tar, level -3 with dict, zstdcli, 41451 +github.tar, level -1, zstdcli, 42494 +github.tar, level -1 with dict, zstdcli, 41135 github.tar, level 0, zstdcli, 38445 github.tar, level 0 with dict, zstdcli, 37999 -github.tar, level 1, zstdcli, 39204 -github.tar, level 1 with dict, zstdcli, 38288 +github.tar, level 1, zstdcli, 39269 +github.tar, level 1 with dict, zstdcli, 38284 github.tar, level 3, zstdcli, 38445 github.tar, level 3 with dict, zstdcli, 37999 github.tar, level 4, zstdcli, 38471 github.tar, level 4 with dict, zstdcli, 37952 -github.tar, level 5, zstdcli, 38380 -github.tar, level 5 with dict, zstdcli, 39032 -github.tar, level 6, zstdcli, 38614 -github.tar, level 6 with dict, zstdcli, 38614 -github.tar, level 7, zstdcli, 38077 -github.tar, level 7 with dict, zstdcli, 37873 -github.tar, level 9, zstdcli, 36771 -github.tar, level 9 with dict, zstdcli, 36623 -github.tar, level 13, zstdcli, 35505 -github.tar, level 13 with dict, zstdcli, 37134 -github.tar, level 16, zstdcli, 40475 -github.tar, level 16 with dict, zstdcli, 33382 -github.tar, level 19, zstdcli, 32138 -github.tar, level 19 with dict, zstdcli, 32713 +github.tar, level 5, zstdcli, 38398 +github.tar, level 5 with dict, zstdcli, 39048 +github.tar, level 6, zstdcli, 38673 +github.tar, level 6 with dict, zstdcli, 38660 +github.tar, level 7, zstdcli, 38157 +github.tar, level 7 with dict, zstdcli, 37914 +github.tar, level 9, zstdcli, 36772 +github.tar, level 9 with dict, zstdcli, 36650 +github.tar, level 13, zstdcli, 35625 +github.tar, level 13 with dict, zstdcli, 38730 +github.tar, level 16, zstdcli, 40259 +github.tar, level 16 with dict, zstdcli, 33643 +github.tar, level 19, zstdcli, 32841 +github.tar, level 19 with dict, zstdcli, 32899 github.tar, no source size, zstdcli, 38442 github.tar, no source size with dict, zstdcli, 38004 github.tar, long distance mode, zstdcli, 39730 @@ -223,84 +223,84 @@ github.tar, multithreaded long distance mode, zstdcli, github.tar, small window log, zstdcli, 198544 github.tar, small hash log, zstdcli, 129874 github.tar, small chain log, zstdcli, 41673 -github.tar, explicit params, zstdcli, 41227 +github.tar, explicit params, zstdcli, 41350 github.tar, uncompressed literals, zstdcli, 41126 -github.tar, uncompressed literals optimal, zstdcli, 35401 -github.tar, huffman literals, zstdcli, 38857 +github.tar, uncompressed literals optimal, zstdcli, 35392 +github.tar, huffman literals, zstdcli, 38781 github.tar, multithreaded with advanced params, zstdcli, 41126 -silesia, level -5, advanced one pass, 7354675 -silesia, level -3, advanced one pass, 6902374 -silesia, level -1, advanced one pass, 6177565 -silesia, level 0, advanced one pass, 4849553 -silesia, level 1, advanced one pass, 5309098 -silesia, level 3, advanced one pass, 4849553 -silesia, level 4, advanced one pass, 4786968 -silesia, level 5 row 1, advanced one pass, 4638961 -silesia, level 5 row 2, advanced one pass, 4640752 -silesia, level 5, advanced one pass, 4638961 -silesia, level 6, advanced one pass, 4605369 -silesia, level 7 row 1, advanced one pass, 4567204 -silesia, level 7 row 2, advanced one pass, 4564868 -silesia, level 7, advanced one pass, 4567204 -silesia, level 9, advanced one pass, 4543310 -silesia, level 11 row 1, advanced one pass, 4521399 -silesia, level 11 row 2, advanced one pass, 4519288 -silesia, level 12 row 1, advanced one pass, 4505153 -silesia, level 12 row 2, advanced one pass, 4503116 -silesia, level 13, advanced one pass, 4493990 -silesia, level 16, advanced one pass, 4359864 -silesia, level 19, advanced one pass, 4296880 -silesia, no source size, advanced one pass, 4849553 -silesia, long distance mode, advanced one pass, 4840737 -silesia, multithreaded, advanced one pass, 4849553 +silesia, level -5, advanced one pass, 6737607 +silesia, level -3, advanced one pass, 6444677 +silesia, level -1, advanced one pass, 6178460 +silesia, level 0, advanced one pass, 4849551 +silesia, level 1, advanced one pass, 5313202 +silesia, level 3, advanced one pass, 4849551 +silesia, level 4, advanced one pass, 4786969 +silesia, level 5 row 1, advanced one pass, 4640753 +silesia, level 5 row 2, advanced one pass, 4639132 +silesia, level 5, advanced one pass, 4639132 +silesia, level 6, advanced one pass, 4605629 +silesia, level 7 row 1, advanced one pass, 4564870 +silesia, level 7 row 2, advanced one pass, 4567307 +silesia, level 7, advanced one pass, 4567307 +silesia, level 9, advanced one pass, 4543330 +silesia, level 11 row 1, advanced one pass, 4519288 +silesia, level 11 row 2, advanced one pass, 4521524 +silesia, level 12 row 1, advanced one pass, 4503117 +silesia, level 12 row 2, advanced one pass, 4505093 +silesia, level 13, advanced one pass, 4482131 +silesia, level 16, advanced one pass, 4360251 +silesia, level 19, advanced one pass, 4283236 +silesia, no source size, advanced one pass, 4849551 +silesia, long distance mode, advanced one pass, 4840738 +silesia, multithreaded, advanced one pass, 4849551 silesia, multithreaded long distance mode, advanced one pass, 4840759 silesia, small window log, advanced one pass, 7095919 silesia, small hash log, advanced one pass, 6526141 -silesia, small chain log, advanced one pass, 4912197 -silesia, explicit params, advanced one pass, 4795856 +silesia, small chain log, advanced one pass, 4912199 +silesia, explicit params, advanced one pass, 4796282 silesia, uncompressed literals, advanced one pass, 5127982 -silesia, uncompressed literals optimal, advanced one pass, 4319518 -silesia, huffman literals, advanced one pass, 5326346 +silesia, uncompressed literals optimal, advanced one pass, 4317896 +silesia, huffman literals, advanced one pass, 5326269 silesia, multithreaded with advanced params, advanced one pass, 5127982 -silesia.tar, level -5, advanced one pass, 7359401 -silesia.tar, level -3, advanced one pass, 6901672 -silesia.tar, level -1, advanced one pass, 6182241 -silesia.tar, level 0, advanced one pass, 4861424 -silesia.tar, level 1, advanced one pass, 5331946 -silesia.tar, level 3, advanced one pass, 4861424 +silesia.tar, level -5, advanced one pass, 6738593 +silesia.tar, level -3, advanced one pass, 6446372 +silesia.tar, level -1, advanced one pass, 6186042 +silesia.tar, level 0, advanced one pass, 4861423 +silesia.tar, level 1, advanced one pass, 5334885 +silesia.tar, level 3, advanced one pass, 4861423 silesia.tar, level 4, advanced one pass, 4799632 -silesia.tar, level 5 row 1, advanced one pass, 4650202 -silesia.tar, level 5 row 2, advanced one pass, 4652862 -silesia.tar, level 5, advanced one pass, 4650202 -silesia.tar, level 6, advanced one pass, 4616811 -silesia.tar, level 7 row 1, advanced one pass, 4576829 -silesia.tar, level 7 row 2, advanced one pass, 4575393 -silesia.tar, level 7, advanced one pass, 4576829 -silesia.tar, level 9, advanced one pass, 4552584 -silesia.tar, level 11 row 1, advanced one pass, 4530256 -silesia.tar, level 11 row 2, advanced one pass, 4529461 -silesia.tar, level 12 row 1, advanced one pass, 4514568 -silesia.tar, level 12 row 2, advanced one pass, 4513604 -silesia.tar, level 13, advanced one pass, 4502956 -silesia.tar, level 16, advanced one pass, 4360527 -silesia.tar, level 19, advanced one pass, 4267266 -silesia.tar, no source size, advanced one pass, 4861424 -silesia.tar, long distance mode, advanced one pass, 4847752 -silesia.tar, multithreaded, advanced one pass, 4861508 +silesia.tar, level 5 row 1, advanced one pass, 4652862 +silesia.tar, level 5 row 2, advanced one pass, 4650387 +silesia.tar, level 5, advanced one pass, 4650387 +silesia.tar, level 6, advanced one pass, 4617089 +silesia.tar, level 7 row 1, advanced one pass, 4575392 +silesia.tar, level 7 row 2, advanced one pass, 4576951 +silesia.tar, level 7, advanced one pass, 4576951 +silesia.tar, level 9, advanced one pass, 4552638 +silesia.tar, level 11 row 1, advanced one pass, 4529458 +silesia.tar, level 11 row 2, advanced one pass, 4530416 +silesia.tar, level 12 row 1, advanced one pass, 4513603 +silesia.tar, level 12 row 2, advanced one pass, 4514499 +silesia.tar, level 13, advanced one pass, 4491768 +silesia.tar, level 16, advanced one pass, 4356834 +silesia.tar, level 19, advanced one pass, 4264388 +silesia.tar, no source size, advanced one pass, 4861423 +silesia.tar, long distance mode, advanced one pass, 4847753 +silesia.tar, multithreaded, advanced one pass, 4861507 silesia.tar, multithreaded long distance mode, advanced one pass, 4853221 silesia.tar, small window log, advanced one pass, 7101530 -silesia.tar, small hash log, advanced one pass, 6529231 -silesia.tar, small chain log, advanced one pass, 4917041 -silesia.tar, explicit params, advanced one pass, 4807381 +silesia.tar, small hash log, advanced one pass, 6529228 +silesia.tar, small chain log, advanced one pass, 4917039 +silesia.tar, explicit params, advanced one pass, 4807675 silesia.tar, uncompressed literals, advanced one pass, 5129458 -silesia.tar, uncompressed literals optimal, advanced one pass, 4310141 -silesia.tar, huffman literals, advanced one pass, 5344545 +silesia.tar, uncompressed literals optimal, advanced one pass, 4307400 +silesia.tar, huffman literals, advanced one pass, 5347335 silesia.tar, multithreaded with advanced params, advanced one pass, 5129555 -github, level -5, advanced one pass, 232315 +github, level -5, advanced one pass, 205285 github, level -5 with dict, advanced one pass, 46718 -github, level -3, advanced one pass, 220760 +github, level -3, advanced one pass, 190643 github, level -3 with dict, advanced one pass, 45395 -github, level -1, advanced one pass, 175468 +github, level -1, advanced one pass, 175568 github, level -1 with dict, advanced one pass, 43170 github, level 0, advanced one pass, 136335 github, level 0 with dict, advanced one pass, 41148 @@ -308,7 +308,7 @@ github, level 0 with dict dms, advanced github, level 0 with dict dds, advanced one pass, 41148 github, level 0 with dict copy, advanced one pass, 41124 github, level 0 with dict load, advanced one pass, 42252 -github, level 1, advanced one pass, 142365 +github, level 1, advanced one pass, 142465 github, level 1 with dict, advanced one pass, 41682 github, level 1 with dict dms, advanced one pass, 41682 github, level 1 with dict dds, advanced one pass, 41682 @@ -326,16 +326,16 @@ github, level 4 with dict dms, advanced github, level 4 with dict dds, advanced one pass, 41251 github, level 4 with dict copy, advanced one pass, 41216 github, level 4 with dict load, advanced one pass, 41159 -github, level 5 row 1, advanced one pass, 134584 -github, level 5 row 1 with dict dms, advanced one pass, 38758 -github, level 5 row 1 with dict dds, advanced one pass, 38728 -github, level 5 row 1 with dict copy, advanced one pass, 38759 -github, level 5 row 1 with dict load, advanced one pass, 41518 -github, level 5 row 2, advanced one pass, 135121 -github, level 5 row 2 with dict dms, advanced one pass, 38938 -github, level 5 row 2 with dict dds, advanced one pass, 38732 -github, level 5 row 2 with dict copy, advanced one pass, 38934 -github, level 5 row 2 with dict load, advanced one pass, 40725 +github, level 5 row 1, advanced one pass, 135121 +github, level 5 row 1 with dict dms, advanced one pass, 38938 +github, level 5 row 1 with dict dds, advanced one pass, 38732 +github, level 5 row 1 with dict copy, advanced one pass, 38934 +github, level 5 row 1 with dict load, advanced one pass, 40725 +github, level 5 row 2, advanced one pass, 134584 +github, level 5 row 2 with dict dms, advanced one pass, 38758 +github, level 5 row 2 with dict dds, advanced one pass, 38728 +github, level 5 row 2 with dict copy, advanced one pass, 38759 +github, level 5 row 2 with dict load, advanced one pass, 41518 github, level 5, advanced one pass, 135121 github, level 5 with dict, advanced one pass, 38758 github, level 5 with dict dms, advanced one pass, 38758 @@ -348,16 +348,16 @@ github, level 6 with dict dms, advanced github, level 6 with dict dds, advanced one pass, 38636 github, level 6 with dict copy, advanced one pass, 38669 github, level 6 with dict load, advanced one pass, 40695 -github, level 7 row 1, advanced one pass, 134584 -github, level 7 row 1 with dict dms, advanced one pass, 38758 -github, level 7 row 1 with dict dds, advanced one pass, 38745 -github, level 7 row 1 with dict copy, advanced one pass, 38755 -github, level 7 row 1 with dict load, advanced one pass, 43154 -github, level 7 row 2, advanced one pass, 135122 -github, level 7 row 2 with dict dms, advanced one pass, 38860 -github, level 7 row 2 with dict dds, advanced one pass, 38766 -github, level 7 row 2 with dict copy, advanced one pass, 38834 -github, level 7 row 2 with dict load, advanced one pass, 40695 +github, level 7 row 1, advanced one pass, 135122 +github, level 7 row 1 with dict dms, advanced one pass, 38860 +github, level 7 row 1 with dict dds, advanced one pass, 38766 +github, level 7 row 1 with dict copy, advanced one pass, 38834 +github, level 7 row 1 with dict load, advanced one pass, 40695 +github, level 7 row 2, advanced one pass, 134584 +github, level 7 row 2 with dict dms, advanced one pass, 38758 +github, level 7 row 2 with dict dds, advanced one pass, 38745 +github, level 7 row 2 with dict copy, advanced one pass, 38755 +github, level 7 row 2 with dict load, advanced one pass, 43154 github, level 7, advanced one pass, 135122 github, level 7 with dict, advanced one pass, 38758 github, level 7 with dict dms, advanced one pass, 38758 @@ -419,26 +419,26 @@ github, small chain log, advanced github, explicit params, advanced one pass, 137727 github, uncompressed literals, advanced one pass, 165915 github, uncompressed literals optimal, advanced one pass, 157227 -github, huffman literals, advanced one pass, 142365 +github, huffman literals, advanced one pass, 142465 github, multithreaded with advanced params, advanced one pass, 165915 -github.tar, level -5, advanced one pass, 66914 -github.tar, level -5 with dict, advanced one pass, 51525 -github.tar, level -3, advanced one pass, 52127 -github.tar, level -3 with dict, advanced one pass, 44242 -github.tar, level -1, advanced one pass, 42560 -github.tar, level -1 with dict, advanced one pass, 41136 +github.tar, level -5, advanced one pass, 46856 +github.tar, level -5 with dict, advanced one pass, 44571 +github.tar, level -3, advanced one pass, 43754 +github.tar, level -3 with dict, advanced one pass, 41447 +github.tar, level -1, advanced one pass, 42490 +github.tar, level -1 with dict, advanced one pass, 41131 github.tar, level 0, advanced one pass, 38441 github.tar, level 0 with dict, advanced one pass, 37995 github.tar, level 0 with dict dms, advanced one pass, 38003 github.tar, level 0 with dict dds, advanced one pass, 38003 github.tar, level 0 with dict copy, advanced one pass, 37995 github.tar, level 0 with dict load, advanced one pass, 37956 -github.tar, level 1, advanced one pass, 39200 -github.tar, level 1 with dict, advanced one pass, 38284 -github.tar, level 1 with dict dms, advanced one pass, 38294 -github.tar, level 1 with dict dds, advanced one pass, 38294 -github.tar, level 1 with dict copy, advanced one pass, 38284 -github.tar, level 1 with dict load, advanced one pass, 38724 +github.tar, level 1, advanced one pass, 39265 +github.tar, level 1 with dict, advanced one pass, 38280 +github.tar, level 1 with dict dms, advanced one pass, 38290 +github.tar, level 1 with dict dds, advanced one pass, 38290 +github.tar, level 1 with dict copy, advanced one pass, 38280 +github.tar, level 1 with dict load, advanced one pass, 38729 github.tar, level 3, advanced one pass, 38441 github.tar, level 3 with dict, advanced one pass, 37995 github.tar, level 3 with dict dms, advanced one pass, 38003 @@ -451,88 +451,88 @@ github.tar, level 4 with dict dms, advanced github.tar, level 4 with dict dds, advanced one pass, 37954 github.tar, level 4 with dict copy, advanced one pass, 37948 github.tar, level 4 with dict load, advanced one pass, 37927 -github.tar, level 5 row 1, advanced one pass, 38376 -github.tar, level 5 row 1 with dict dms, advanced one pass, 39024 -github.tar, level 5 row 1 with dict dds, advanced one pass, 39028 -github.tar, level 5 row 1 with dict copy, advanced one pass, 39040 -github.tar, level 5 row 1 with dict load, advanced one pass, 37600 -github.tar, level 5 row 2, advanced one pass, 38534 -github.tar, level 5 row 2 with dict dms, advanced one pass, 39365 -github.tar, level 5 row 2 with dict dds, advanced one pass, 39233 -github.tar, level 5 row 2 with dict copy, advanced one pass, 39715 -github.tar, level 5 row 2 with dict load, advanced one pass, 38019 -github.tar, level 5, advanced one pass, 38376 -github.tar, level 5 with dict, advanced one pass, 39040 -github.tar, level 5 with dict dms, advanced one pass, 39024 -github.tar, level 5 with dict dds, advanced one pass, 39028 -github.tar, level 5 with dict copy, advanced one pass, 39040 -github.tar, level 5 with dict load, advanced one pass, 37600 -github.tar, level 6, advanced one pass, 38610 -github.tar, level 6 with dict, advanced one pass, 38622 -github.tar, level 6 with dict dms, advanced one pass, 38608 -github.tar, level 6 with dict dds, advanced one pass, 38610 -github.tar, level 6 with dict copy, advanced one pass, 38622 -github.tar, level 6 with dict load, advanced one pass, 37829 -github.tar, level 7 row 1, advanced one pass, 38073 -github.tar, level 7 row 1 with dict dms, advanced one pass, 37848 -github.tar, level 7 row 1 with dict dds, advanced one pass, 37869 -github.tar, level 7 row 1 with dict copy, advanced one pass, 37848 -github.tar, level 7 row 1 with dict load, advanced one pass, 37371 -github.tar, level 7 row 2, advanced one pass, 38077 -github.tar, level 7 row 2 with dict dms, advanced one pass, 38012 -github.tar, level 7 row 2 with dict dds, advanced one pass, 38014 -github.tar, level 7 row 2 with dict copy, advanced one pass, 38101 -github.tar, level 7 row 2 with dict load, advanced one pass, 37402 -github.tar, level 7, advanced one pass, 38073 -github.tar, level 7 with dict, advanced one pass, 37848 -github.tar, level 7 with dict dms, advanced one pass, 37848 -github.tar, level 7 with dict dds, advanced one pass, 37869 -github.tar, level 7 with dict copy, advanced one pass, 37848 -github.tar, level 7 with dict load, advanced one pass, 37371 -github.tar, level 9, advanced one pass, 36767 -github.tar, level 9 with dict, advanced one pass, 36457 -github.tar, level 9 with dict dms, advanced one pass, 36549 -github.tar, level 9 with dict dds, advanced one pass, 36619 -github.tar, level 9 with dict copy, advanced one pass, 36457 -github.tar, level 9 with dict load, advanced one pass, 36352 +github.tar, level 5 row 1, advanced one pass, 38534 +github.tar, level 5 row 1 with dict dms, advanced one pass, 39365 +github.tar, level 5 row 1 with dict dds, advanced one pass, 39233 +github.tar, level 5 row 1 with dict copy, advanced one pass, 39715 +github.tar, level 5 row 1 with dict load, advanced one pass, 38019 +github.tar, level 5 row 2, advanced one pass, 38394 +github.tar, level 5 row 2 with dict dms, advanced one pass, 39048 +github.tar, level 5 row 2 with dict dds, advanced one pass, 39044 +github.tar, level 5 row 2 with dict copy, advanced one pass, 39074 +github.tar, level 5 row 2 with dict load, advanced one pass, 37665 +github.tar, level 5, advanced one pass, 38394 +github.tar, level 5 with dict, advanced one pass, 39074 +github.tar, level 5 with dict dms, advanced one pass, 39048 +github.tar, level 5 with dict dds, advanced one pass, 39044 +github.tar, level 5 with dict copy, advanced one pass, 39074 +github.tar, level 5 with dict load, advanced one pass, 37665 +github.tar, level 6, advanced one pass, 38669 +github.tar, level 6 with dict, advanced one pass, 38660 +github.tar, level 6 with dict dms, advanced one pass, 38654 +github.tar, level 6 with dict dds, advanced one pass, 38656 +github.tar, level 6 with dict copy, advanced one pass, 38660 +github.tar, level 6 with dict load, advanced one pass, 37889 +github.tar, level 7 row 1, advanced one pass, 38077 +github.tar, level 7 row 1 with dict dms, advanced one pass, 38012 +github.tar, level 7 row 1 with dict dds, advanced one pass, 38014 +github.tar, level 7 row 1 with dict copy, advanced one pass, 38101 +github.tar, level 7 row 1 with dict load, advanced one pass, 37402 +github.tar, level 7 row 2, advanced one pass, 38153 +github.tar, level 7 row 2 with dict dms, advanced one pass, 37888 +github.tar, level 7 row 2 with dict dds, advanced one pass, 37910 +github.tar, level 7 row 2 with dict copy, advanced one pass, 37892 +github.tar, level 7 row 2 with dict load, advanced one pass, 37457 +github.tar, level 7, advanced one pass, 38153 +github.tar, level 7 with dict, advanced one pass, 37892 +github.tar, level 7 with dict dms, advanced one pass, 37888 +github.tar, level 7 with dict dds, advanced one pass, 37910 +github.tar, level 7 with dict copy, advanced one pass, 37892 +github.tar, level 7 with dict load, advanced one pass, 37457 +github.tar, level 9, advanced one pass, 36768 +github.tar, level 9 with dict, advanced one pass, 36510 +github.tar, level 9 with dict dms, advanced one pass, 36584 +github.tar, level 9 with dict dds, advanced one pass, 36646 +github.tar, level 9 with dict copy, advanced one pass, 36510 +github.tar, level 9 with dict load, advanced one pass, 36383 github.tar, level 11 row 1, advanced one pass, 36435 github.tar, level 11 row 1 with dict dms, advanced one pass, 36963 github.tar, level 11 row 1 with dict dds, advanced one pass, 36963 github.tar, level 11 row 1 with dict copy, advanced one pass, 36557 -github.tar, level 11 row 1 with dict load, advanced one pass, 36424 -github.tar, level 11 row 2, advanced one pass, 36435 +github.tar, level 11 row 1 with dict load, advanced one pass, 36419 +github.tar, level 11 row 2, advanced one pass, 36412 github.tar, level 11 row 2 with dict dms, advanced one pass, 36963 github.tar, level 11 row 2 with dict dds, advanced one pass, 36963 github.tar, level 11 row 2 with dict copy, advanced one pass, 36557 -github.tar, level 11 row 2 with dict load, advanced one pass, 36419 -github.tar, level 12 row 1, advanced one pass, 36105 +github.tar, level 11 row 2 with dict load, advanced one pass, 36439 +github.tar, level 12 row 1, advanced one pass, 36110 github.tar, level 12 row 1 with dict dms, advanced one pass, 36986 github.tar, level 12 row 1 with dict dds, advanced one pass, 36986 github.tar, level 12 row 1 with dict copy, advanced one pass, 36609 -github.tar, level 12 row 1 with dict load, advanced one pass, 36460 -github.tar, level 12 row 2, advanced one pass, 36110 +github.tar, level 12 row 1 with dict load, advanced one pass, 36459 +github.tar, level 12 row 2, advanced one pass, 36062 github.tar, level 12 row 2 with dict dms, advanced one pass, 36986 github.tar, level 12 row 2 with dict dds, advanced one pass, 36986 github.tar, level 12 row 2 with dict copy, advanced one pass, 36609 -github.tar, level 12 row 2 with dict load, advanced one pass, 36459 -github.tar, level 13, advanced one pass, 35501 -github.tar, level 13 with dict, advanced one pass, 37130 -github.tar, level 13 with dict dms, advanced one pass, 37267 -github.tar, level 13 with dict dds, advanced one pass, 37267 -github.tar, level 13 with dict copy, advanced one pass, 37130 -github.tar, level 13 with dict load, advanced one pass, 36010 -github.tar, level 16, advanced one pass, 40471 -github.tar, level 16 with dict, advanced one pass, 33378 -github.tar, level 16 with dict dms, advanced one pass, 33213 -github.tar, level 16 with dict dds, advanced one pass, 33213 -github.tar, level 16 with dict copy, advanced one pass, 33378 -github.tar, level 16 with dict load, advanced one pass, 39081 -github.tar, level 19, advanced one pass, 32134 -github.tar, level 19 with dict, advanced one pass, 32709 -github.tar, level 19 with dict dms, advanced one pass, 32553 -github.tar, level 19 with dict dds, advanced one pass, 32553 -github.tar, level 19 with dict copy, advanced one pass, 32709 -github.tar, level 19 with dict load, advanced one pass, 32474 +github.tar, level 12 row 2 with dict load, advanced one pass, 36392 +github.tar, level 13, advanced one pass, 35621 +github.tar, level 13 with dict, advanced one pass, 38726 +github.tar, level 13 with dict dms, advanced one pass, 38903 +github.tar, level 13 with dict dds, advanced one pass, 38903 +github.tar, level 13 with dict copy, advanced one pass, 38726 +github.tar, level 13 with dict load, advanced one pass, 36372 +github.tar, level 16, advanced one pass, 40255 +github.tar, level 16 with dict, advanced one pass, 33639 +github.tar, level 16 with dict dms, advanced one pass, 33544 +github.tar, level 16 with dict dds, advanced one pass, 33544 +github.tar, level 16 with dict copy, advanced one pass, 33639 +github.tar, level 16 with dict load, advanced one pass, 39353 +github.tar, level 19, advanced one pass, 32837 +github.tar, level 19 with dict, advanced one pass, 32895 +github.tar, level 19 with dict dms, advanced one pass, 32672 +github.tar, level 19 with dict dds, advanced one pass, 32672 +github.tar, level 19 with dict copy, advanced one pass, 32895 +github.tar, level 19 with dict load, advanced one pass, 32676 github.tar, no source size, advanced one pass, 38441 github.tar, no source size with dict, advanced one pass, 37995 github.tar, long distance mode, advanced one pass, 39757 @@ -541,84 +541,84 @@ github.tar, multithreaded long distance mode, advanced github.tar, small window log, advanced one pass, 198540 github.tar, small hash log, advanced one pass, 129870 github.tar, small chain log, advanced one pass, 41669 -github.tar, explicit params, advanced one pass, 41227 +github.tar, explicit params, advanced one pass, 41350 github.tar, uncompressed literals, advanced one pass, 41122 -github.tar, uncompressed literals optimal, advanced one pass, 35397 -github.tar, huffman literals, advanced one pass, 38853 +github.tar, uncompressed literals optimal, advanced one pass, 35388 +github.tar, huffman literals, advanced one pass, 38777 github.tar, multithreaded with advanced params, advanced one pass, 41122 -silesia, level -5, advanced one pass small out, 7354675 -silesia, level -3, advanced one pass small out, 6902374 -silesia, level -1, advanced one pass small out, 6177565 -silesia, level 0, advanced one pass small out, 4849553 -silesia, level 1, advanced one pass small out, 5309098 -silesia, level 3, advanced one pass small out, 4849553 -silesia, level 4, advanced one pass small out, 4786968 -silesia, level 5 row 1, advanced one pass small out, 4638961 -silesia, level 5 row 2, advanced one pass small out, 4640752 -silesia, level 5, advanced one pass small out, 4638961 -silesia, level 6, advanced one pass small out, 4605369 -silesia, level 7 row 1, advanced one pass small out, 4567204 -silesia, level 7 row 2, advanced one pass small out, 4564868 -silesia, level 7, advanced one pass small out, 4567204 -silesia, level 9, advanced one pass small out, 4543310 -silesia, level 11 row 1, advanced one pass small out, 4521399 -silesia, level 11 row 2, advanced one pass small out, 4519288 -silesia, level 12 row 1, advanced one pass small out, 4505153 -silesia, level 12 row 2, advanced one pass small out, 4503116 -silesia, level 13, advanced one pass small out, 4493990 -silesia, level 16, advanced one pass small out, 4359864 -silesia, level 19, advanced one pass small out, 4296880 -silesia, no source size, advanced one pass small out, 4849553 -silesia, long distance mode, advanced one pass small out, 4840737 -silesia, multithreaded, advanced one pass small out, 4849553 +silesia, level -5, advanced one pass small out, 6737607 +silesia, level -3, advanced one pass small out, 6444677 +silesia, level -1, advanced one pass small out, 6178460 +silesia, level 0, advanced one pass small out, 4849551 +silesia, level 1, advanced one pass small out, 5313202 +silesia, level 3, advanced one pass small out, 4849551 +silesia, level 4, advanced one pass small out, 4786969 +silesia, level 5 row 1, advanced one pass small out, 4640753 +silesia, level 5 row 2, advanced one pass small out, 4639132 +silesia, level 5, advanced one pass small out, 4639132 +silesia, level 6, advanced one pass small out, 4605629 +silesia, level 7 row 1, advanced one pass small out, 4564870 +silesia, level 7 row 2, advanced one pass small out, 4567307 +silesia, level 7, advanced one pass small out, 4567307 +silesia, level 9, advanced one pass small out, 4543330 +silesia, level 11 row 1, advanced one pass small out, 4519288 +silesia, level 11 row 2, advanced one pass small out, 4521524 +silesia, level 12 row 1, advanced one pass small out, 4503117 +silesia, level 12 row 2, advanced one pass small out, 4505093 +silesia, level 13, advanced one pass small out, 4482131 +silesia, level 16, advanced one pass small out, 4360251 +silesia, level 19, advanced one pass small out, 4283236 +silesia, no source size, advanced one pass small out, 4849551 +silesia, long distance mode, advanced one pass small out, 4840738 +silesia, multithreaded, advanced one pass small out, 4849551 silesia, multithreaded long distance mode, advanced one pass small out, 4840759 silesia, small window log, advanced one pass small out, 7095919 silesia, small hash log, advanced one pass small out, 6526141 -silesia, small chain log, advanced one pass small out, 4912197 -silesia, explicit params, advanced one pass small out, 4795856 +silesia, small chain log, advanced one pass small out, 4912199 +silesia, explicit params, advanced one pass small out, 4796282 silesia, uncompressed literals, advanced one pass small out, 5127982 -silesia, uncompressed literals optimal, advanced one pass small out, 4319518 -silesia, huffman literals, advanced one pass small out, 5326346 +silesia, uncompressed literals optimal, advanced one pass small out, 4317896 +silesia, huffman literals, advanced one pass small out, 5326269 silesia, multithreaded with advanced params, advanced one pass small out, 5127982 -silesia.tar, level -5, advanced one pass small out, 7359401 -silesia.tar, level -3, advanced one pass small out, 6901672 -silesia.tar, level -1, advanced one pass small out, 6182241 -silesia.tar, level 0, advanced one pass small out, 4861424 -silesia.tar, level 1, advanced one pass small out, 5331946 -silesia.tar, level 3, advanced one pass small out, 4861424 +silesia.tar, level -5, advanced one pass small out, 6738593 +silesia.tar, level -3, advanced one pass small out, 6446372 +silesia.tar, level -1, advanced one pass small out, 6186042 +silesia.tar, level 0, advanced one pass small out, 4861423 +silesia.tar, level 1, advanced one pass small out, 5334885 +silesia.tar, level 3, advanced one pass small out, 4861423 silesia.tar, level 4, advanced one pass small out, 4799632 -silesia.tar, level 5 row 1, advanced one pass small out, 4650202 -silesia.tar, level 5 row 2, advanced one pass small out, 4652862 -silesia.tar, level 5, advanced one pass small out, 4650202 -silesia.tar, level 6, advanced one pass small out, 4616811 -silesia.tar, level 7 row 1, advanced one pass small out, 4576829 -silesia.tar, level 7 row 2, advanced one pass small out, 4575393 -silesia.tar, level 7, advanced one pass small out, 4576829 -silesia.tar, level 9, advanced one pass small out, 4552584 -silesia.tar, level 11 row 1, advanced one pass small out, 4530256 -silesia.tar, level 11 row 2, advanced one pass small out, 4529461 -silesia.tar, level 12 row 1, advanced one pass small out, 4514568 -silesia.tar, level 12 row 2, advanced one pass small out, 4513604 -silesia.tar, level 13, advanced one pass small out, 4502956 -silesia.tar, level 16, advanced one pass small out, 4360527 -silesia.tar, level 19, advanced one pass small out, 4267266 -silesia.tar, no source size, advanced one pass small out, 4861424 -silesia.tar, long distance mode, advanced one pass small out, 4847752 -silesia.tar, multithreaded, advanced one pass small out, 4861508 +silesia.tar, level 5 row 1, advanced one pass small out, 4652862 +silesia.tar, level 5 row 2, advanced one pass small out, 4650387 +silesia.tar, level 5, advanced one pass small out, 4650387 +silesia.tar, level 6, advanced one pass small out, 4617089 +silesia.tar, level 7 row 1, advanced one pass small out, 4575392 +silesia.tar, level 7 row 2, advanced one pass small out, 4576951 +silesia.tar, level 7, advanced one pass small out, 4576951 +silesia.tar, level 9, advanced one pass small out, 4552638 +silesia.tar, level 11 row 1, advanced one pass small out, 4529458 +silesia.tar, level 11 row 2, advanced one pass small out, 4530416 +silesia.tar, level 12 row 1, advanced one pass small out, 4513603 +silesia.tar, level 12 row 2, advanced one pass small out, 4514499 +silesia.tar, level 13, advanced one pass small out, 4491768 +silesia.tar, level 16, advanced one pass small out, 4356834 +silesia.tar, level 19, advanced one pass small out, 4264388 +silesia.tar, no source size, advanced one pass small out, 4861423 +silesia.tar, long distance mode, advanced one pass small out, 4847753 +silesia.tar, multithreaded, advanced one pass small out, 4861507 silesia.tar, multithreaded long distance mode, advanced one pass small out, 4853221 silesia.tar, small window log, advanced one pass small out, 7101530 -silesia.tar, small hash log, advanced one pass small out, 6529231 -silesia.tar, small chain log, advanced one pass small out, 4917041 -silesia.tar, explicit params, advanced one pass small out, 4807381 +silesia.tar, small hash log, advanced one pass small out, 6529228 +silesia.tar, small chain log, advanced one pass small out, 4917039 +silesia.tar, explicit params, advanced one pass small out, 4807675 silesia.tar, uncompressed literals, advanced one pass small out, 5129458 -silesia.tar, uncompressed literals optimal, advanced one pass small out, 4310141 -silesia.tar, huffman literals, advanced one pass small out, 5344545 +silesia.tar, uncompressed literals optimal, advanced one pass small out, 4307400 +silesia.tar, huffman literals, advanced one pass small out, 5347335 silesia.tar, multithreaded with advanced params, advanced one pass small out, 5129555 -github, level -5, advanced one pass small out, 232315 +github, level -5, advanced one pass small out, 205285 github, level -5 with dict, advanced one pass small out, 46718 -github, level -3, advanced one pass small out, 220760 +github, level -3, advanced one pass small out, 190643 github, level -3 with dict, advanced one pass small out, 45395 -github, level -1, advanced one pass small out, 175468 +github, level -1, advanced one pass small out, 175568 github, level -1 with dict, advanced one pass small out, 43170 github, level 0, advanced one pass small out, 136335 github, level 0 with dict, advanced one pass small out, 41148 @@ -626,7 +626,7 @@ github, level 0 with dict dms, advanced github, level 0 with dict dds, advanced one pass small out, 41148 github, level 0 with dict copy, advanced one pass small out, 41124 github, level 0 with dict load, advanced one pass small out, 42252 -github, level 1, advanced one pass small out, 142365 +github, level 1, advanced one pass small out, 142465 github, level 1 with dict, advanced one pass small out, 41682 github, level 1 with dict dms, advanced one pass small out, 41682 github, level 1 with dict dds, advanced one pass small out, 41682 @@ -644,16 +644,16 @@ github, level 4 with dict dms, advanced github, level 4 with dict dds, advanced one pass small out, 41251 github, level 4 with dict copy, advanced one pass small out, 41216 github, level 4 with dict load, advanced one pass small out, 41159 -github, level 5 row 1, advanced one pass small out, 134584 -github, level 5 row 1 with dict dms, advanced one pass small out, 38758 -github, level 5 row 1 with dict dds, advanced one pass small out, 38728 -github, level 5 row 1 with dict copy, advanced one pass small out, 38759 -github, level 5 row 1 with dict load, advanced one pass small out, 41518 -github, level 5 row 2, advanced one pass small out, 135121 -github, level 5 row 2 with dict dms, advanced one pass small out, 38938 -github, level 5 row 2 with dict dds, advanced one pass small out, 38732 -github, level 5 row 2 with dict copy, advanced one pass small out, 38934 -github, level 5 row 2 with dict load, advanced one pass small out, 40725 +github, level 5 row 1, advanced one pass small out, 135121 +github, level 5 row 1 with dict dms, advanced one pass small out, 38938 +github, level 5 row 1 with dict dds, advanced one pass small out, 38732 +github, level 5 row 1 with dict copy, advanced one pass small out, 38934 +github, level 5 row 1 with dict load, advanced one pass small out, 40725 +github, level 5 row 2, advanced one pass small out, 134584 +github, level 5 row 2 with dict dms, advanced one pass small out, 38758 +github, level 5 row 2 with dict dds, advanced one pass small out, 38728 +github, level 5 row 2 with dict copy, advanced one pass small out, 38759 +github, level 5 row 2 with dict load, advanced one pass small out, 41518 github, level 5, advanced one pass small out, 135121 github, level 5 with dict, advanced one pass small out, 38758 github, level 5 with dict dms, advanced one pass small out, 38758 @@ -666,16 +666,16 @@ github, level 6 with dict dms, advanced github, level 6 with dict dds, advanced one pass small out, 38636 github, level 6 with dict copy, advanced one pass small out, 38669 github, level 6 with dict load, advanced one pass small out, 40695 -github, level 7 row 1, advanced one pass small out, 134584 -github, level 7 row 1 with dict dms, advanced one pass small out, 38758 -github, level 7 row 1 with dict dds, advanced one pass small out, 38745 -github, level 7 row 1 with dict copy, advanced one pass small out, 38755 -github, level 7 row 1 with dict load, advanced one pass small out, 43154 -github, level 7 row 2, advanced one pass small out, 135122 -github, level 7 row 2 with dict dms, advanced one pass small out, 38860 -github, level 7 row 2 with dict dds, advanced one pass small out, 38766 -github, level 7 row 2 with dict copy, advanced one pass small out, 38834 -github, level 7 row 2 with dict load, advanced one pass small out, 40695 +github, level 7 row 1, advanced one pass small out, 135122 +github, level 7 row 1 with dict dms, advanced one pass small out, 38860 +github, level 7 row 1 with dict dds, advanced one pass small out, 38766 +github, level 7 row 1 with dict copy, advanced one pass small out, 38834 +github, level 7 row 1 with dict load, advanced one pass small out, 40695 +github, level 7 row 2, advanced one pass small out, 134584 +github, level 7 row 2 with dict dms, advanced one pass small out, 38758 +github, level 7 row 2 with dict dds, advanced one pass small out, 38745 +github, level 7 row 2 with dict copy, advanced one pass small out, 38755 +github, level 7 row 2 with dict load, advanced one pass small out, 43154 github, level 7, advanced one pass small out, 135122 github, level 7 with dict, advanced one pass small out, 38758 github, level 7 with dict dms, advanced one pass small out, 38758 @@ -737,26 +737,26 @@ github, small chain log, advanced github, explicit params, advanced one pass small out, 137727 github, uncompressed literals, advanced one pass small out, 165915 github, uncompressed literals optimal, advanced one pass small out, 157227 -github, huffman literals, advanced one pass small out, 142365 +github, huffman literals, advanced one pass small out, 142465 github, multithreaded with advanced params, advanced one pass small out, 165915 -github.tar, level -5, advanced one pass small out, 66914 -github.tar, level -5 with dict, advanced one pass small out, 51525 -github.tar, level -3, advanced one pass small out, 52127 -github.tar, level -3 with dict, advanced one pass small out, 44242 -github.tar, level -1, advanced one pass small out, 42560 -github.tar, level -1 with dict, advanced one pass small out, 41136 +github.tar, level -5, advanced one pass small out, 46856 +github.tar, level -5 with dict, advanced one pass small out, 44571 +github.tar, level -3, advanced one pass small out, 43754 +github.tar, level -3 with dict, advanced one pass small out, 41447 +github.tar, level -1, advanced one pass small out, 42490 +github.tar, level -1 with dict, advanced one pass small out, 41131 github.tar, level 0, advanced one pass small out, 38441 github.tar, level 0 with dict, advanced one pass small out, 37995 github.tar, level 0 with dict dms, advanced one pass small out, 38003 github.tar, level 0 with dict dds, advanced one pass small out, 38003 github.tar, level 0 with dict copy, advanced one pass small out, 37995 github.tar, level 0 with dict load, advanced one pass small out, 37956 -github.tar, level 1, advanced one pass small out, 39200 -github.tar, level 1 with dict, advanced one pass small out, 38284 -github.tar, level 1 with dict dms, advanced one pass small out, 38294 -github.tar, level 1 with dict dds, advanced one pass small out, 38294 -github.tar, level 1 with dict copy, advanced one pass small out, 38284 -github.tar, level 1 with dict load, advanced one pass small out, 38724 +github.tar, level 1, advanced one pass small out, 39265 +github.tar, level 1 with dict, advanced one pass small out, 38280 +github.tar, level 1 with dict dms, advanced one pass small out, 38290 +github.tar, level 1 with dict dds, advanced one pass small out, 38290 +github.tar, level 1 with dict copy, advanced one pass small out, 38280 +github.tar, level 1 with dict load, advanced one pass small out, 38729 github.tar, level 3, advanced one pass small out, 38441 github.tar, level 3 with dict, advanced one pass small out, 37995 github.tar, level 3 with dict dms, advanced one pass small out, 38003 @@ -769,88 +769,88 @@ github.tar, level 4 with dict dms, advanced github.tar, level 4 with dict dds, advanced one pass small out, 37954 github.tar, level 4 with dict copy, advanced one pass small out, 37948 github.tar, level 4 with dict load, advanced one pass small out, 37927 -github.tar, level 5 row 1, advanced one pass small out, 38376 -github.tar, level 5 row 1 with dict dms, advanced one pass small out, 39024 -github.tar, level 5 row 1 with dict dds, advanced one pass small out, 39028 -github.tar, level 5 row 1 with dict copy, advanced one pass small out, 39040 -github.tar, level 5 row 1 with dict load, advanced one pass small out, 37600 -github.tar, level 5 row 2, advanced one pass small out, 38534 -github.tar, level 5 row 2 with dict dms, advanced one pass small out, 39365 -github.tar, level 5 row 2 with dict dds, advanced one pass small out, 39233 -github.tar, level 5 row 2 with dict copy, advanced one pass small out, 39715 -github.tar, level 5 row 2 with dict load, advanced one pass small out, 38019 -github.tar, level 5, advanced one pass small out, 38376 -github.tar, level 5 with dict, advanced one pass small out, 39040 -github.tar, level 5 with dict dms, advanced one pass small out, 39024 -github.tar, level 5 with dict dds, advanced one pass small out, 39028 -github.tar, level 5 with dict copy, advanced one pass small out, 39040 -github.tar, level 5 with dict load, advanced one pass small out, 37600 -github.tar, level 6, advanced one pass small out, 38610 -github.tar, level 6 with dict, advanced one pass small out, 38622 -github.tar, level 6 with dict dms, advanced one pass small out, 38608 -github.tar, level 6 with dict dds, advanced one pass small out, 38610 -github.tar, level 6 with dict copy, advanced one pass small out, 38622 -github.tar, level 6 with dict load, advanced one pass small out, 37829 -github.tar, level 7 row 1, advanced one pass small out, 38073 -github.tar, level 7 row 1 with dict dms, advanced one pass small out, 37848 -github.tar, level 7 row 1 with dict dds, advanced one pass small out, 37869 -github.tar, level 7 row 1 with dict copy, advanced one pass small out, 37848 -github.tar, level 7 row 1 with dict load, advanced one pass small out, 37371 -github.tar, level 7 row 2, advanced one pass small out, 38077 -github.tar, level 7 row 2 with dict dms, advanced one pass small out, 38012 -github.tar, level 7 row 2 with dict dds, advanced one pass small out, 38014 -github.tar, level 7 row 2 with dict copy, advanced one pass small out, 38101 -github.tar, level 7 row 2 with dict load, advanced one pass small out, 37402 -github.tar, level 7, advanced one pass small out, 38073 -github.tar, level 7 with dict, advanced one pass small out, 37848 -github.tar, level 7 with dict dms, advanced one pass small out, 37848 -github.tar, level 7 with dict dds, advanced one pass small out, 37869 -github.tar, level 7 with dict copy, advanced one pass small out, 37848 -github.tar, level 7 with dict load, advanced one pass small out, 37371 -github.tar, level 9, advanced one pass small out, 36767 -github.tar, level 9 with dict, advanced one pass small out, 36457 -github.tar, level 9 with dict dms, advanced one pass small out, 36549 -github.tar, level 9 with dict dds, advanced one pass small out, 36619 -github.tar, level 9 with dict copy, advanced one pass small out, 36457 -github.tar, level 9 with dict load, advanced one pass small out, 36352 +github.tar, level 5 row 1, advanced one pass small out, 38534 +github.tar, level 5 row 1 with dict dms, advanced one pass small out, 39365 +github.tar, level 5 row 1 with dict dds, advanced one pass small out, 39233 +github.tar, level 5 row 1 with dict copy, advanced one pass small out, 39715 +github.tar, level 5 row 1 with dict load, advanced one pass small out, 38019 +github.tar, level 5 row 2, advanced one pass small out, 38394 +github.tar, level 5 row 2 with dict dms, advanced one pass small out, 39048 +github.tar, level 5 row 2 with dict dds, advanced one pass small out, 39044 +github.tar, level 5 row 2 with dict copy, advanced one pass small out, 39074 +github.tar, level 5 row 2 with dict load, advanced one pass small out, 37665 +github.tar, level 5, advanced one pass small out, 38394 +github.tar, level 5 with dict, advanced one pass small out, 39074 +github.tar, level 5 with dict dms, advanced one pass small out, 39048 +github.tar, level 5 with dict dds, advanced one pass small out, 39044 +github.tar, level 5 with dict copy, advanced one pass small out, 39074 +github.tar, level 5 with dict load, advanced one pass small out, 37665 +github.tar, level 6, advanced one pass small out, 38669 +github.tar, level 6 with dict, advanced one pass small out, 38660 +github.tar, level 6 with dict dms, advanced one pass small out, 38654 +github.tar, level 6 with dict dds, advanced one pass small out, 38656 +github.tar, level 6 with dict copy, advanced one pass small out, 38660 +github.tar, level 6 with dict load, advanced one pass small out, 37889 +github.tar, level 7 row 1, advanced one pass small out, 38077 +github.tar, level 7 row 1 with dict dms, advanced one pass small out, 38012 +github.tar, level 7 row 1 with dict dds, advanced one pass small out, 38014 +github.tar, level 7 row 1 with dict copy, advanced one pass small out, 38101 +github.tar, level 7 row 1 with dict load, advanced one pass small out, 37402 +github.tar, level 7 row 2, advanced one pass small out, 38153 +github.tar, level 7 row 2 with dict dms, advanced one pass small out, 37888 +github.tar, level 7 row 2 with dict dds, advanced one pass small out, 37910 +github.tar, level 7 row 2 with dict copy, advanced one pass small out, 37892 +github.tar, level 7 row 2 with dict load, advanced one pass small out, 37457 +github.tar, level 7, advanced one pass small out, 38153 +github.tar, level 7 with dict, advanced one pass small out, 37892 +github.tar, level 7 with dict dms, advanced one pass small out, 37888 +github.tar, level 7 with dict dds, advanced one pass small out, 37910 +github.tar, level 7 with dict copy, advanced one pass small out, 37892 +github.tar, level 7 with dict load, advanced one pass small out, 37457 +github.tar, level 9, advanced one pass small out, 36768 +github.tar, level 9 with dict, advanced one pass small out, 36510 +github.tar, level 9 with dict dms, advanced one pass small out, 36584 +github.tar, level 9 with dict dds, advanced one pass small out, 36646 +github.tar, level 9 with dict copy, advanced one pass small out, 36510 +github.tar, level 9 with dict load, advanced one pass small out, 36383 github.tar, level 11 row 1, advanced one pass small out, 36435 github.tar, level 11 row 1 with dict dms, advanced one pass small out, 36963 github.tar, level 11 row 1 with dict dds, advanced one pass small out, 36963 github.tar, level 11 row 1 with dict copy, advanced one pass small out, 36557 -github.tar, level 11 row 1 with dict load, advanced one pass small out, 36424 -github.tar, level 11 row 2, advanced one pass small out, 36435 +github.tar, level 11 row 1 with dict load, advanced one pass small out, 36419 +github.tar, level 11 row 2, advanced one pass small out, 36412 github.tar, level 11 row 2 with dict dms, advanced one pass small out, 36963 github.tar, level 11 row 2 with dict dds, advanced one pass small out, 36963 github.tar, level 11 row 2 with dict copy, advanced one pass small out, 36557 -github.tar, level 11 row 2 with dict load, advanced one pass small out, 36419 -github.tar, level 12 row 1, advanced one pass small out, 36105 +github.tar, level 11 row 2 with dict load, advanced one pass small out, 36439 +github.tar, level 12 row 1, advanced one pass small out, 36110 github.tar, level 12 row 1 with dict dms, advanced one pass small out, 36986 github.tar, level 12 row 1 with dict dds, advanced one pass small out, 36986 github.tar, level 12 row 1 with dict copy, advanced one pass small out, 36609 -github.tar, level 12 row 1 with dict load, advanced one pass small out, 36460 -github.tar, level 12 row 2, advanced one pass small out, 36110 +github.tar, level 12 row 1 with dict load, advanced one pass small out, 36459 +github.tar, level 12 row 2, advanced one pass small out, 36062 github.tar, level 12 row 2 with dict dms, advanced one pass small out, 36986 github.tar, level 12 row 2 with dict dds, advanced one pass small out, 36986 github.tar, level 12 row 2 with dict copy, advanced one pass small out, 36609 -github.tar, level 12 row 2 with dict load, advanced one pass small out, 36459 -github.tar, level 13, advanced one pass small out, 35501 -github.tar, level 13 with dict, advanced one pass small out, 37130 -github.tar, level 13 with dict dms, advanced one pass small out, 37267 -github.tar, level 13 with dict dds, advanced one pass small out, 37267 -github.tar, level 13 with dict copy, advanced one pass small out, 37130 -github.tar, level 13 with dict load, advanced one pass small out, 36010 -github.tar, level 16, advanced one pass small out, 40471 -github.tar, level 16 with dict, advanced one pass small out, 33378 -github.tar, level 16 with dict dms, advanced one pass small out, 33213 -github.tar, level 16 with dict dds, advanced one pass small out, 33213 -github.tar, level 16 with dict copy, advanced one pass small out, 33378 -github.tar, level 16 with dict load, advanced one pass small out, 39081 -github.tar, level 19, advanced one pass small out, 32134 -github.tar, level 19 with dict, advanced one pass small out, 32709 -github.tar, level 19 with dict dms, advanced one pass small out, 32553 -github.tar, level 19 with dict dds, advanced one pass small out, 32553 -github.tar, level 19 with dict copy, advanced one pass small out, 32709 -github.tar, level 19 with dict load, advanced one pass small out, 32474 +github.tar, level 12 row 2 with dict load, advanced one pass small out, 36392 +github.tar, level 13, advanced one pass small out, 35621 +github.tar, level 13 with dict, advanced one pass small out, 38726 +github.tar, level 13 with dict dms, advanced one pass small out, 38903 +github.tar, level 13 with dict dds, advanced one pass small out, 38903 +github.tar, level 13 with dict copy, advanced one pass small out, 38726 +github.tar, level 13 with dict load, advanced one pass small out, 36372 +github.tar, level 16, advanced one pass small out, 40255 +github.tar, level 16 with dict, advanced one pass small out, 33639 +github.tar, level 16 with dict dms, advanced one pass small out, 33544 +github.tar, level 16 with dict dds, advanced one pass small out, 33544 +github.tar, level 16 with dict copy, advanced one pass small out, 33639 +github.tar, level 16 with dict load, advanced one pass small out, 39353 +github.tar, level 19, advanced one pass small out, 32837 +github.tar, level 19 with dict, advanced one pass small out, 32895 +github.tar, level 19 with dict dms, advanced one pass small out, 32672 +github.tar, level 19 with dict dds, advanced one pass small out, 32672 +github.tar, level 19 with dict copy, advanced one pass small out, 32895 +github.tar, level 19 with dict load, advanced one pass small out, 32676 github.tar, no source size, advanced one pass small out, 38441 github.tar, no source size with dict, advanced one pass small out, 37995 github.tar, long distance mode, advanced one pass small out, 39757 @@ -859,84 +859,84 @@ github.tar, multithreaded long distance mode, advanced github.tar, small window log, advanced one pass small out, 198540 github.tar, small hash log, advanced one pass small out, 129870 github.tar, small chain log, advanced one pass small out, 41669 -github.tar, explicit params, advanced one pass small out, 41227 +github.tar, explicit params, advanced one pass small out, 41350 github.tar, uncompressed literals, advanced one pass small out, 41122 -github.tar, uncompressed literals optimal, advanced one pass small out, 35397 -github.tar, huffman literals, advanced one pass small out, 38853 +github.tar, uncompressed literals optimal, advanced one pass small out, 35388 +github.tar, huffman literals, advanced one pass small out, 38777 github.tar, multithreaded with advanced params, advanced one pass small out, 41122 -silesia, level -5, advanced streaming, 7292053 -silesia, level -3, advanced streaming, 6867875 -silesia, level -1, advanced streaming, 6183923 -silesia, level 0, advanced streaming, 4849553 -silesia, level 1, advanced streaming, 5312694 -silesia, level 3, advanced streaming, 4849553 -silesia, level 4, advanced streaming, 4786968 -silesia, level 5 row 1, advanced streaming, 4638961 -silesia, level 5 row 2, advanced streaming, 4640752 -silesia, level 5, advanced streaming, 4638961 -silesia, level 6, advanced streaming, 4605369 -silesia, level 7 row 1, advanced streaming, 4567204 -silesia, level 7 row 2, advanced streaming, 4564868 -silesia, level 7, advanced streaming, 4567204 -silesia, level 9, advanced streaming, 4543310 -silesia, level 11 row 1, advanced streaming, 4521399 -silesia, level 11 row 2, advanced streaming, 4519288 -silesia, level 12 row 1, advanced streaming, 4505153 -silesia, level 12 row 2, advanced streaming, 4503116 -silesia, level 13, advanced streaming, 4493990 -silesia, level 16, advanced streaming, 4359864 -silesia, level 19, advanced streaming, 4296880 -silesia, no source size, advanced streaming, 4849517 -silesia, long distance mode, advanced streaming, 4840737 -silesia, multithreaded, advanced streaming, 4849553 +silesia, level -5, advanced streaming, 6882505 +silesia, level -3, advanced streaming, 6568376 +silesia, level -1, advanced streaming, 6183403 +silesia, level 0, advanced streaming, 4849551 +silesia, level 1, advanced streaming, 5314161 +silesia, level 3, advanced streaming, 4849551 +silesia, level 4, advanced streaming, 4786969 +silesia, level 5 row 1, advanced streaming, 4640753 +silesia, level 5 row 2, advanced streaming, 4639132 +silesia, level 5, advanced streaming, 4639132 +silesia, level 6, advanced streaming, 4605629 +silesia, level 7 row 1, advanced streaming, 4564870 +silesia, level 7 row 2, advanced streaming, 4567307 +silesia, level 7, advanced streaming, 4567307 +silesia, level 9, advanced streaming, 4543330 +silesia, level 11 row 1, advanced streaming, 4519288 +silesia, level 11 row 2, advanced streaming, 4521524 +silesia, level 12 row 1, advanced streaming, 4503117 +silesia, level 12 row 2, advanced streaming, 4505093 +silesia, level 13, advanced streaming, 4482131 +silesia, level 16, advanced streaming, 4360251 +silesia, level 19, advanced streaming, 4283236 +silesia, no source size, advanced streaming, 4849515 +silesia, long distance mode, advanced streaming, 4840738 +silesia, multithreaded, advanced streaming, 4849551 silesia, multithreaded long distance mode, advanced streaming, 4840759 silesia, small window log, advanced streaming, 7112062 silesia, small hash log, advanced streaming, 6526141 -silesia, small chain log, advanced streaming, 4912197 -silesia, explicit params, advanced streaming, 4795883 +silesia, small chain log, advanced streaming, 4912199 +silesia, explicit params, advanced streaming, 4796309 silesia, uncompressed literals, advanced streaming, 5127982 -silesia, uncompressed literals optimal, advanced streaming, 4319518 -silesia, huffman literals, advanced streaming, 5332234 +silesia, uncompressed literals optimal, advanced streaming, 4317896 +silesia, huffman literals, advanced streaming, 5331171 silesia, multithreaded with advanced params, advanced streaming, 5127982 -silesia.tar, level -5, advanced streaming, 7260007 -silesia.tar, level -3, advanced streaming, 6845151 -silesia.tar, level -1, advanced streaming, 6187938 -silesia.tar, level 0, advanced streaming, 4861426 -silesia.tar, level 1, advanced streaming, 5334890 -silesia.tar, level 3, advanced streaming, 4861426 +silesia.tar, level -5, advanced streaming, 6982759 +silesia.tar, level -3, advanced streaming, 6641283 +silesia.tar, level -1, advanced streaming, 6190795 +silesia.tar, level 0, advanced streaming, 4861425 +silesia.tar, level 1, advanced streaming, 5336941 +silesia.tar, level 3, advanced streaming, 4861425 silesia.tar, level 4, advanced streaming, 4799632 -silesia.tar, level 5 row 1, advanced streaming, 4650207 -silesia.tar, level 5 row 2, advanced streaming, 4652866 -silesia.tar, level 5, advanced streaming, 4650207 -silesia.tar, level 6, advanced streaming, 4616816 -silesia.tar, level 7 row 1, advanced streaming, 4576831 -silesia.tar, level 7 row 2, advanced streaming, 4575394 -silesia.tar, level 7, advanced streaming, 4576831 -silesia.tar, level 9, advanced streaming, 4552590 -silesia.tar, level 11 row 1, advanced streaming, 4530258 -silesia.tar, level 11 row 2, advanced streaming, 4529461 -silesia.tar, level 12 row 1, advanced streaming, 4514569 -silesia.tar, level 12 row 2, advanced streaming, 4513604 -silesia.tar, level 13, advanced streaming, 4502956 -silesia.tar, level 16, advanced streaming, 4360527 -silesia.tar, level 19, advanced streaming, 4267266 -silesia.tar, no source size, advanced streaming, 4861422 -silesia.tar, long distance mode, advanced streaming, 4847752 -silesia.tar, multithreaded, advanced streaming, 4861508 +silesia.tar, level 5 row 1, advanced streaming, 4652866 +silesia.tar, level 5 row 2, advanced streaming, 4650392 +silesia.tar, level 5, advanced streaming, 4650392 +silesia.tar, level 6, advanced streaming, 4617097 +silesia.tar, level 7 row 1, advanced streaming, 4575393 +silesia.tar, level 7 row 2, advanced streaming, 4576953 +silesia.tar, level 7, advanced streaming, 4576953 +silesia.tar, level 9, advanced streaming, 4552646 +silesia.tar, level 11 row 1, advanced streaming, 4529458 +silesia.tar, level 11 row 2, advanced streaming, 4530417 +silesia.tar, level 12 row 1, advanced streaming, 4513603 +silesia.tar, level 12 row 2, advanced streaming, 4514500 +silesia.tar, level 13, advanced streaming, 4491769 +silesia.tar, level 16, advanced streaming, 4356834 +silesia.tar, level 19, advanced streaming, 4264388 +silesia.tar, no source size, advanced streaming, 4861421 +silesia.tar, long distance mode, advanced streaming, 4847753 +silesia.tar, multithreaded, advanced streaming, 4861507 silesia.tar, multithreaded long distance mode, advanced streaming, 4853221 silesia.tar, small window log, advanced streaming, 7118769 -silesia.tar, small hash log, advanced streaming, 6529234 -silesia.tar, small chain log, advanced streaming, 4917021 -silesia.tar, explicit params, advanced streaming, 4807401 +silesia.tar, small hash log, advanced streaming, 6529231 +silesia.tar, small chain log, advanced streaming, 4917019 +silesia.tar, explicit params, advanced streaming, 4807688 silesia.tar, uncompressed literals, advanced streaming, 5129461 -silesia.tar, uncompressed literals optimal, advanced streaming, 4310141 -silesia.tar, huffman literals, advanced streaming, 5350519 +silesia.tar, uncompressed literals optimal, advanced streaming, 4307400 +silesia.tar, huffman literals, advanced streaming, 5352360 silesia.tar, multithreaded with advanced params, advanced streaming, 5129555 -github, level -5, advanced streaming, 232315 +github, level -5, advanced streaming, 205285 github, level -5 with dict, advanced streaming, 46718 -github, level -3, advanced streaming, 220760 +github, level -3, advanced streaming, 190643 github, level -3 with dict, advanced streaming, 45395 -github, level -1, advanced streaming, 175468 +github, level -1, advanced streaming, 175568 github, level -1 with dict, advanced streaming, 43170 github, level 0, advanced streaming, 136335 github, level 0 with dict, advanced streaming, 41148 @@ -944,7 +944,7 @@ github, level 0 with dict dms, advanced github, level 0 with dict dds, advanced streaming, 41148 github, level 0 with dict copy, advanced streaming, 41124 github, level 0 with dict load, advanced streaming, 42252 -github, level 1, advanced streaming, 142365 +github, level 1, advanced streaming, 142465 github, level 1 with dict, advanced streaming, 41682 github, level 1 with dict dms, advanced streaming, 41682 github, level 1 with dict dds, advanced streaming, 41682 @@ -962,16 +962,16 @@ github, level 4 with dict dms, advanced github, level 4 with dict dds, advanced streaming, 41251 github, level 4 with dict copy, advanced streaming, 41216 github, level 4 with dict load, advanced streaming, 41159 -github, level 5 row 1, advanced streaming, 134584 -github, level 5 row 1 with dict dms, advanced streaming, 38758 -github, level 5 row 1 with dict dds, advanced streaming, 38728 -github, level 5 row 1 with dict copy, advanced streaming, 38759 -github, level 5 row 1 with dict load, advanced streaming, 41518 -github, level 5 row 2, advanced streaming, 135121 -github, level 5 row 2 with dict dms, advanced streaming, 38938 -github, level 5 row 2 with dict dds, advanced streaming, 38732 -github, level 5 row 2 with dict copy, advanced streaming, 38934 -github, level 5 row 2 with dict load, advanced streaming, 40725 +github, level 5 row 1, advanced streaming, 135121 +github, level 5 row 1 with dict dms, advanced streaming, 38938 +github, level 5 row 1 with dict dds, advanced streaming, 38732 +github, level 5 row 1 with dict copy, advanced streaming, 38934 +github, level 5 row 1 with dict load, advanced streaming, 40725 +github, level 5 row 2, advanced streaming, 134584 +github, level 5 row 2 with dict dms, advanced streaming, 38758 +github, level 5 row 2 with dict dds, advanced streaming, 38728 +github, level 5 row 2 with dict copy, advanced streaming, 38759 +github, level 5 row 2 with dict load, advanced streaming, 41518 github, level 5, advanced streaming, 135121 github, level 5 with dict, advanced streaming, 38758 github, level 5 with dict dms, advanced streaming, 38758 @@ -984,16 +984,16 @@ github, level 6 with dict dms, advanced github, level 6 with dict dds, advanced streaming, 38636 github, level 6 with dict copy, advanced streaming, 38669 github, level 6 with dict load, advanced streaming, 40695 -github, level 7 row 1, advanced streaming, 134584 -github, level 7 row 1 with dict dms, advanced streaming, 38758 -github, level 7 row 1 with dict dds, advanced streaming, 38745 -github, level 7 row 1 with dict copy, advanced streaming, 38755 -github, level 7 row 1 with dict load, advanced streaming, 43154 -github, level 7 row 2, advanced streaming, 135122 -github, level 7 row 2 with dict dms, advanced streaming, 38860 -github, level 7 row 2 with dict dds, advanced streaming, 38766 -github, level 7 row 2 with dict copy, advanced streaming, 38834 -github, level 7 row 2 with dict load, advanced streaming, 40695 +github, level 7 row 1, advanced streaming, 135122 +github, level 7 row 1 with dict dms, advanced streaming, 38860 +github, level 7 row 1 with dict dds, advanced streaming, 38766 +github, level 7 row 1 with dict copy, advanced streaming, 38834 +github, level 7 row 1 with dict load, advanced streaming, 40695 +github, level 7 row 2, advanced streaming, 134584 +github, level 7 row 2 with dict dms, advanced streaming, 38758 +github, level 7 row 2 with dict dds, advanced streaming, 38745 +github, level 7 row 2 with dict copy, advanced streaming, 38755 +github, level 7 row 2 with dict load, advanced streaming, 43154 github, level 7, advanced streaming, 135122 github, level 7 with dict, advanced streaming, 38758 github, level 7 with dict dms, advanced streaming, 38758 @@ -1055,26 +1055,26 @@ github, small chain log, advanced github, explicit params, advanced streaming, 137727 github, uncompressed literals, advanced streaming, 165915 github, uncompressed literals optimal, advanced streaming, 157227 -github, huffman literals, advanced streaming, 142365 +github, huffman literals, advanced streaming, 142465 github, multithreaded with advanced params, advanced streaming, 165915 -github.tar, level -5, advanced streaming, 64132 -github.tar, level -5 with dict, advanced streaming, 48642 -github.tar, level -3, advanced streaming, 50964 -github.tar, level -3 with dict, advanced streaming, 42750 -github.tar, level -1, advanced streaming, 42536 -github.tar, level -1 with dict, advanced streaming, 41198 +github.tar, level -5, advanced streaming, 46747 +github.tar, level -5 with dict, advanced streaming, 44440 +github.tar, level -3, advanced streaming, 43537 +github.tar, level -3 with dict, advanced streaming, 41112 +github.tar, level -1, advanced streaming, 42465 +github.tar, level -1 with dict, advanced streaming, 41196 github.tar, level 0, advanced streaming, 38441 github.tar, level 0 with dict, advanced streaming, 37995 github.tar, level 0 with dict dms, advanced streaming, 38003 github.tar, level 0 with dict dds, advanced streaming, 38003 github.tar, level 0 with dict copy, advanced streaming, 37995 github.tar, level 0 with dict load, advanced streaming, 37956 -github.tar, level 1, advanced streaming, 39270 -github.tar, level 1 with dict, advanced streaming, 38316 -github.tar, level 1 with dict dms, advanced streaming, 38326 -github.tar, level 1 with dict dds, advanced streaming, 38326 -github.tar, level 1 with dict copy, advanced streaming, 38316 -github.tar, level 1 with dict load, advanced streaming, 38761 +github.tar, level 1, advanced streaming, 39342 +github.tar, level 1 with dict, advanced streaming, 38293 +github.tar, level 1 with dict dms, advanced streaming, 38303 +github.tar, level 1 with dict dds, advanced streaming, 38303 +github.tar, level 1 with dict copy, advanced streaming, 38293 +github.tar, level 1 with dict load, advanced streaming, 38766 github.tar, level 3, advanced streaming, 38441 github.tar, level 3 with dict, advanced streaming, 37995 github.tar, level 3 with dict dms, advanced streaming, 38003 @@ -1087,88 +1087,88 @@ github.tar, level 4 with dict dms, advanced github.tar, level 4 with dict dds, advanced streaming, 37954 github.tar, level 4 with dict copy, advanced streaming, 37948 github.tar, level 4 with dict load, advanced streaming, 37927 -github.tar, level 5 row 1, advanced streaming, 38376 -github.tar, level 5 row 1 with dict dms, advanced streaming, 39024 -github.tar, level 5 row 1 with dict dds, advanced streaming, 39028 -github.tar, level 5 row 1 with dict copy, advanced streaming, 39040 -github.tar, level 5 row 1 with dict load, advanced streaming, 37600 -github.tar, level 5 row 2, advanced streaming, 38534 -github.tar, level 5 row 2 with dict dms, advanced streaming, 39365 -github.tar, level 5 row 2 with dict dds, advanced streaming, 39233 -github.tar, level 5 row 2 with dict copy, advanced streaming, 39715 -github.tar, level 5 row 2 with dict load, advanced streaming, 38019 -github.tar, level 5, advanced streaming, 38376 -github.tar, level 5 with dict, advanced streaming, 39040 -github.tar, level 5 with dict dms, advanced streaming, 39024 -github.tar, level 5 with dict dds, advanced streaming, 39028 -github.tar, level 5 with dict copy, advanced streaming, 39040 -github.tar, level 5 with dict load, advanced streaming, 37600 -github.tar, level 6, advanced streaming, 38610 -github.tar, level 6 with dict, advanced streaming, 38622 -github.tar, level 6 with dict dms, advanced streaming, 38608 -github.tar, level 6 with dict dds, advanced streaming, 38610 -github.tar, level 6 with dict copy, advanced streaming, 38622 -github.tar, level 6 with dict load, advanced streaming, 37829 -github.tar, level 7 row 1, advanced streaming, 38073 -github.tar, level 7 row 1 with dict dms, advanced streaming, 37848 -github.tar, level 7 row 1 with dict dds, advanced streaming, 37869 -github.tar, level 7 row 1 with dict copy, advanced streaming, 37848 -github.tar, level 7 row 1 with dict load, advanced streaming, 37371 -github.tar, level 7 row 2, advanced streaming, 38077 -github.tar, level 7 row 2 with dict dms, advanced streaming, 38012 -github.tar, level 7 row 2 with dict dds, advanced streaming, 38014 -github.tar, level 7 row 2 with dict copy, advanced streaming, 38101 -github.tar, level 7 row 2 with dict load, advanced streaming, 37402 -github.tar, level 7, advanced streaming, 38073 -github.tar, level 7 with dict, advanced streaming, 37848 -github.tar, level 7 with dict dms, advanced streaming, 37848 -github.tar, level 7 with dict dds, advanced streaming, 37869 -github.tar, level 7 with dict copy, advanced streaming, 37848 -github.tar, level 7 with dict load, advanced streaming, 37371 -github.tar, level 9, advanced streaming, 36767 -github.tar, level 9 with dict, advanced streaming, 36457 -github.tar, level 9 with dict dms, advanced streaming, 36549 -github.tar, level 9 with dict dds, advanced streaming, 36619 -github.tar, level 9 with dict copy, advanced streaming, 36457 -github.tar, level 9 with dict load, advanced streaming, 36352 +github.tar, level 5 row 1, advanced streaming, 38534 +github.tar, level 5 row 1 with dict dms, advanced streaming, 39365 +github.tar, level 5 row 1 with dict dds, advanced streaming, 39233 +github.tar, level 5 row 1 with dict copy, advanced streaming, 39715 +github.tar, level 5 row 1 with dict load, advanced streaming, 38019 +github.tar, level 5 row 2, advanced streaming, 38394 +github.tar, level 5 row 2 with dict dms, advanced streaming, 39048 +github.tar, level 5 row 2 with dict dds, advanced streaming, 39044 +github.tar, level 5 row 2 with dict copy, advanced streaming, 39074 +github.tar, level 5 row 2 with dict load, advanced streaming, 37665 +github.tar, level 5, advanced streaming, 38394 +github.tar, level 5 with dict, advanced streaming, 39074 +github.tar, level 5 with dict dms, advanced streaming, 39048 +github.tar, level 5 with dict dds, advanced streaming, 39044 +github.tar, level 5 with dict copy, advanced streaming, 39074 +github.tar, level 5 with dict load, advanced streaming, 37665 +github.tar, level 6, advanced streaming, 38669 +github.tar, level 6 with dict, advanced streaming, 38660 +github.tar, level 6 with dict dms, advanced streaming, 38654 +github.tar, level 6 with dict dds, advanced streaming, 38656 +github.tar, level 6 with dict copy, advanced streaming, 38660 +github.tar, level 6 with dict load, advanced streaming, 37889 +github.tar, level 7 row 1, advanced streaming, 38077 +github.tar, level 7 row 1 with dict dms, advanced streaming, 38012 +github.tar, level 7 row 1 with dict dds, advanced streaming, 38014 +github.tar, level 7 row 1 with dict copy, advanced streaming, 38101 +github.tar, level 7 row 1 with dict load, advanced streaming, 37402 +github.tar, level 7 row 2, advanced streaming, 38153 +github.tar, level 7 row 2 with dict dms, advanced streaming, 37888 +github.tar, level 7 row 2 with dict dds, advanced streaming, 37910 +github.tar, level 7 row 2 with dict copy, advanced streaming, 37892 +github.tar, level 7 row 2 with dict load, advanced streaming, 37457 +github.tar, level 7, advanced streaming, 38153 +github.tar, level 7 with dict, advanced streaming, 37892 +github.tar, level 7 with dict dms, advanced streaming, 37888 +github.tar, level 7 with dict dds, advanced streaming, 37910 +github.tar, level 7 with dict copy, advanced streaming, 37892 +github.tar, level 7 with dict load, advanced streaming, 37457 +github.tar, level 9, advanced streaming, 36768 +github.tar, level 9 with dict, advanced streaming, 36510 +github.tar, level 9 with dict dms, advanced streaming, 36584 +github.tar, level 9 with dict dds, advanced streaming, 36646 +github.tar, level 9 with dict copy, advanced streaming, 36510 +github.tar, level 9 with dict load, advanced streaming, 36383 github.tar, level 11 row 1, advanced streaming, 36435 github.tar, level 11 row 1 with dict dms, advanced streaming, 36963 github.tar, level 11 row 1 with dict dds, advanced streaming, 36963 github.tar, level 11 row 1 with dict copy, advanced streaming, 36557 -github.tar, level 11 row 1 with dict load, advanced streaming, 36424 -github.tar, level 11 row 2, advanced streaming, 36435 +github.tar, level 11 row 1 with dict load, advanced streaming, 36419 +github.tar, level 11 row 2, advanced streaming, 36412 github.tar, level 11 row 2 with dict dms, advanced streaming, 36963 github.tar, level 11 row 2 with dict dds, advanced streaming, 36963 github.tar, level 11 row 2 with dict copy, advanced streaming, 36557 -github.tar, level 11 row 2 with dict load, advanced streaming, 36419 -github.tar, level 12 row 1, advanced streaming, 36105 +github.tar, level 11 row 2 with dict load, advanced streaming, 36439 +github.tar, level 12 row 1, advanced streaming, 36110 github.tar, level 12 row 1 with dict dms, advanced streaming, 36986 github.tar, level 12 row 1 with dict dds, advanced streaming, 36986 github.tar, level 12 row 1 with dict copy, advanced streaming, 36609 -github.tar, level 12 row 1 with dict load, advanced streaming, 36460 -github.tar, level 12 row 2, advanced streaming, 36110 +github.tar, level 12 row 1 with dict load, advanced streaming, 36459 +github.tar, level 12 row 2, advanced streaming, 36062 github.tar, level 12 row 2 with dict dms, advanced streaming, 36986 github.tar, level 12 row 2 with dict dds, advanced streaming, 36986 github.tar, level 12 row 2 with dict copy, advanced streaming, 36609 -github.tar, level 12 row 2 with dict load, advanced streaming, 36459 -github.tar, level 13, advanced streaming, 35501 -github.tar, level 13 with dict, advanced streaming, 37130 -github.tar, level 13 with dict dms, advanced streaming, 37267 -github.tar, level 13 with dict dds, advanced streaming, 37267 -github.tar, level 13 with dict copy, advanced streaming, 37130 -github.tar, level 13 with dict load, advanced streaming, 36010 -github.tar, level 16, advanced streaming, 40471 -github.tar, level 16 with dict, advanced streaming, 33378 -github.tar, level 16 with dict dms, advanced streaming, 33213 -github.tar, level 16 with dict dds, advanced streaming, 33213 -github.tar, level 16 with dict copy, advanced streaming, 33378 -github.tar, level 16 with dict load, advanced streaming, 39081 -github.tar, level 19, advanced streaming, 32134 -github.tar, level 19 with dict, advanced streaming, 32709 -github.tar, level 19 with dict dms, advanced streaming, 32553 -github.tar, level 19 with dict dds, advanced streaming, 32553 -github.tar, level 19 with dict copy, advanced streaming, 32709 -github.tar, level 19 with dict load, advanced streaming, 32474 +github.tar, level 12 row 2 with dict load, advanced streaming, 36392 +github.tar, level 13, advanced streaming, 35621 +github.tar, level 13 with dict, advanced streaming, 38726 +github.tar, level 13 with dict dms, advanced streaming, 38903 +github.tar, level 13 with dict dds, advanced streaming, 38903 +github.tar, level 13 with dict copy, advanced streaming, 38726 +github.tar, level 13 with dict load, advanced streaming, 36372 +github.tar, level 16, advanced streaming, 40255 +github.tar, level 16 with dict, advanced streaming, 33639 +github.tar, level 16 with dict dms, advanced streaming, 33544 +github.tar, level 16 with dict dds, advanced streaming, 33544 +github.tar, level 16 with dict copy, advanced streaming, 33639 +github.tar, level 16 with dict load, advanced streaming, 39353 +github.tar, level 19, advanced streaming, 32837 +github.tar, level 19 with dict, advanced streaming, 32895 +github.tar, level 19 with dict dms, advanced streaming, 32672 +github.tar, level 19 with dict dds, advanced streaming, 32672 +github.tar, level 19 with dict copy, advanced streaming, 32895 +github.tar, level 19 with dict load, advanced streaming, 32676 github.tar, no source size, advanced streaming, 38438 github.tar, no source size with dict, advanced streaming, 38000 github.tar, long distance mode, advanced streaming, 39757 @@ -1177,56 +1177,56 @@ github.tar, multithreaded long distance mode, advanced github.tar, small window log, advanced streaming, 199558 github.tar, small hash log, advanced streaming, 129870 github.tar, small chain log, advanced streaming, 41669 -github.tar, explicit params, advanced streaming, 41227 +github.tar, explicit params, advanced streaming, 41351 github.tar, uncompressed literals, advanced streaming, 41122 -github.tar, uncompressed literals optimal, advanced streaming, 35397 -github.tar, huffman literals, advanced streaming, 38874 +github.tar, uncompressed literals optimal, advanced streaming, 35388 +github.tar, huffman literals, advanced streaming, 38800 github.tar, multithreaded with advanced params, advanced streaming, 41122 -silesia, level -5, old streaming, 7292053 -silesia, level -3, old streaming, 6867875 -silesia, level -1, old streaming, 6183923 -silesia, level 0, old streaming, 4849553 -silesia, level 1, old streaming, 5312694 -silesia, level 3, old streaming, 4849553 -silesia, level 4, old streaming, 4786968 -silesia, level 5, old streaming, 4638961 -silesia, level 6, old streaming, 4605369 -silesia, level 7, old streaming, 4567204 -silesia, level 9, old streaming, 4543310 -silesia, level 13, old streaming, 4493990 -silesia, level 16, old streaming, 4359864 -silesia, level 19, old streaming, 4296880 -silesia, no source size, old streaming, 4849517 -silesia, uncompressed literals, old streaming, 4849553 -silesia, uncompressed literals optimal, old streaming, 4296880 -silesia, huffman literals, old streaming, 6183923 -silesia.tar, level -5, old streaming, 7260007 -silesia.tar, level -3, old streaming, 6845151 -silesia.tar, level -1, old streaming, 6187938 -silesia.tar, level 0, old streaming, 4861426 -silesia.tar, level 1, old streaming, 5334890 -silesia.tar, level 3, old streaming, 4861426 +silesia, level -5, old streaming, 6882505 +silesia, level -3, old streaming, 6568376 +silesia, level -1, old streaming, 6183403 +silesia, level 0, old streaming, 4849551 +silesia, level 1, old streaming, 5314161 +silesia, level 3, old streaming, 4849551 +silesia, level 4, old streaming, 4786969 +silesia, level 5, old streaming, 4639132 +silesia, level 6, old streaming, 4605629 +silesia, level 7, old streaming, 4567307 +silesia, level 9, old streaming, 4543330 +silesia, level 13, old streaming, 4482131 +silesia, level 16, old streaming, 4360251 +silesia, level 19, old streaming, 4283236 +silesia, no source size, old streaming, 4849515 +silesia, uncompressed literals, old streaming, 4849551 +silesia, uncompressed literals optimal, old streaming, 4283236 +silesia, huffman literals, old streaming, 6183403 +silesia.tar, level -5, old streaming, 6982759 +silesia.tar, level -3, old streaming, 6641283 +silesia.tar, level -1, old streaming, 6190795 +silesia.tar, level 0, old streaming, 4861425 +silesia.tar, level 1, old streaming, 5336941 +silesia.tar, level 3, old streaming, 4861425 silesia.tar, level 4, old streaming, 4799632 -silesia.tar, level 5, old streaming, 4650207 -silesia.tar, level 6, old streaming, 4616816 -silesia.tar, level 7, old streaming, 4576831 -silesia.tar, level 9, old streaming, 4552590 -silesia.tar, level 13, old streaming, 4502956 -silesia.tar, level 16, old streaming, 4360527 -silesia.tar, level 19, old streaming, 4267266 -silesia.tar, no source size, old streaming, 4861422 -silesia.tar, uncompressed literals, old streaming, 4861426 -silesia.tar, uncompressed literals optimal, old streaming, 4267266 -silesia.tar, huffman literals, old streaming, 6187938 -github, level -5, old streaming, 232315 +silesia.tar, level 5, old streaming, 4650392 +silesia.tar, level 6, old streaming, 4617097 +silesia.tar, level 7, old streaming, 4576953 +silesia.tar, level 9, old streaming, 4552646 +silesia.tar, level 13, old streaming, 4491769 +silesia.tar, level 16, old streaming, 4356834 +silesia.tar, level 19, old streaming, 4264388 +silesia.tar, no source size, old streaming, 4861421 +silesia.tar, uncompressed literals, old streaming, 4861425 +silesia.tar, uncompressed literals optimal, old streaming, 4264388 +silesia.tar, huffman literals, old streaming, 6190795 +github, level -5, old streaming, 205285 github, level -5 with dict, old streaming, 46718 -github, level -3, old streaming, 220760 +github, level -3, old streaming, 190643 github, level -3 with dict, old streaming, 45395 -github, level -1, old streaming, 175468 +github, level -1, old streaming, 175568 github, level -1 with dict, old streaming, 43170 github, level 0, old streaming, 136335 github, level 0 with dict, old streaming, 41148 -github, level 1, old streaming, 142365 +github, level 1, old streaming, 142465 github, level 1 with dict, old streaming, 41682 github, level 3, old streaming, 136335 github, level 3 with dict, old streaming, 41148 @@ -1250,101 +1250,101 @@ github, no source size, old stre github, no source size with dict, old streaming, 40654 github, uncompressed literals, old streaming, 136335 github, uncompressed literals optimal, old streaming, 134064 -github, huffman literals, old streaming, 175468 -github.tar, level -5, old streaming, 64132 -github.tar, level -5 with dict, old streaming, 48642 -github.tar, level -3, old streaming, 50964 -github.tar, level -3 with dict, old streaming, 42750 -github.tar, level -1, old streaming, 42536 -github.tar, level -1 with dict, old streaming, 41198 +github, huffman literals, old streaming, 175568 +github.tar, level -5, old streaming, 46747 +github.tar, level -5 with dict, old streaming, 44440 +github.tar, level -3, old streaming, 43537 +github.tar, level -3 with dict, old streaming, 41112 +github.tar, level -1, old streaming, 42465 +github.tar, level -1 with dict, old streaming, 41196 github.tar, level 0, old streaming, 38441 github.tar, level 0 with dict, old streaming, 37995 -github.tar, level 1, old streaming, 39270 -github.tar, level 1 with dict, old streaming, 38316 +github.tar, level 1, old streaming, 39342 +github.tar, level 1 with dict, old streaming, 38293 github.tar, level 3, old streaming, 38441 github.tar, level 3 with dict, old streaming, 37995 github.tar, level 4, old streaming, 38467 github.tar, level 4 with dict, old streaming, 37948 -github.tar, level 5, old streaming, 38376 -github.tar, level 5 with dict, old streaming, 39040 -github.tar, level 6, old streaming, 38610 -github.tar, level 6 with dict, old streaming, 38622 -github.tar, level 7, old streaming, 38073 -github.tar, level 7 with dict, old streaming, 37848 -github.tar, level 9, old streaming, 36767 -github.tar, level 9 with dict, old streaming, 36457 -github.tar, level 13, old streaming, 35501 -github.tar, level 13 with dict, old streaming, 37130 -github.tar, level 16, old streaming, 40471 -github.tar, level 16 with dict, old streaming, 33378 -github.tar, level 19, old streaming, 32134 -github.tar, level 19 with dict, old streaming, 32709 +github.tar, level 5, old streaming, 38394 +github.tar, level 5 with dict, old streaming, 39074 +github.tar, level 6, old streaming, 38669 +github.tar, level 6 with dict, old streaming, 38660 +github.tar, level 7, old streaming, 38153 +github.tar, level 7 with dict, old streaming, 37892 +github.tar, level 9, old streaming, 36768 +github.tar, level 9 with dict, old streaming, 36510 +github.tar, level 13, old streaming, 35621 +github.tar, level 13 with dict, old streaming, 38726 +github.tar, level 16, old streaming, 40255 +github.tar, level 16 with dict, old streaming, 33639 +github.tar, level 19, old streaming, 32837 +github.tar, level 19 with dict, old streaming, 32895 github.tar, no source size, old streaming, 38438 github.tar, no source size with dict, old streaming, 38000 github.tar, uncompressed literals, old streaming, 38441 -github.tar, uncompressed literals optimal, old streaming, 32134 -github.tar, huffman literals, old streaming, 42536 -silesia, level -5, old streaming advanced, 7292053 -silesia, level -3, old streaming advanced, 6867875 -silesia, level -1, old streaming advanced, 6183923 -silesia, level 0, old streaming advanced, 4849553 -silesia, level 1, old streaming advanced, 5312694 -silesia, level 3, old streaming advanced, 4849553 -silesia, level 4, old streaming advanced, 4786968 -silesia, level 5, old streaming advanced, 4638961 -silesia, level 6, old streaming advanced, 4605369 -silesia, level 7, old streaming advanced, 4567204 -silesia, level 9, old streaming advanced, 4543310 -silesia, level 13, old streaming advanced, 4493990 -silesia, level 16, old streaming advanced, 4359864 -silesia, level 19, old streaming advanced, 4296880 -silesia, no source size, old streaming advanced, 4849517 -silesia, long distance mode, old streaming advanced, 4849553 -silesia, multithreaded, old streaming advanced, 4849553 -silesia, multithreaded long distance mode, old streaming advanced, 4849553 +github.tar, uncompressed literals optimal, old streaming, 32837 +github.tar, huffman literals, old streaming, 42465 +silesia, level -5, old streaming advanced, 6882505 +silesia, level -3, old streaming advanced, 6568376 +silesia, level -1, old streaming advanced, 6183403 +silesia, level 0, old streaming advanced, 4849551 +silesia, level 1, old streaming advanced, 5314161 +silesia, level 3, old streaming advanced, 4849551 +silesia, level 4, old streaming advanced, 4786969 +silesia, level 5, old streaming advanced, 4639132 +silesia, level 6, old streaming advanced, 4605629 +silesia, level 7, old streaming advanced, 4567307 +silesia, level 9, old streaming advanced, 4543330 +silesia, level 13, old streaming advanced, 4482131 +silesia, level 16, old streaming advanced, 4360251 +silesia, level 19, old streaming advanced, 4283236 +silesia, no source size, old streaming advanced, 4849515 +silesia, long distance mode, old streaming advanced, 4849551 +silesia, multithreaded, old streaming advanced, 4849551 +silesia, multithreaded long distance mode, old streaming advanced, 4849551 silesia, small window log, old streaming advanced, 7112062 silesia, small hash log, old streaming advanced, 6526141 -silesia, small chain log, old streaming advanced, 4912197 -silesia, explicit params, old streaming advanced, 4795883 -silesia, uncompressed literals, old streaming advanced, 4849553 -silesia, uncompressed literals optimal, old streaming advanced, 4296880 -silesia, huffman literals, old streaming advanced, 6183923 -silesia, multithreaded with advanced params, old streaming advanced, 4849553 -silesia.tar, level -5, old streaming advanced, 7260007 -silesia.tar, level -3, old streaming advanced, 6845151 -silesia.tar, level -1, old streaming advanced, 6187938 -silesia.tar, level 0, old streaming advanced, 4861426 -silesia.tar, level 1, old streaming advanced, 5334890 -silesia.tar, level 3, old streaming advanced, 4861426 +silesia, small chain log, old streaming advanced, 4912199 +silesia, explicit params, old streaming advanced, 4796309 +silesia, uncompressed literals, old streaming advanced, 4849551 +silesia, uncompressed literals optimal, old streaming advanced, 4283236 +silesia, huffman literals, old streaming advanced, 6183403 +silesia, multithreaded with advanced params, old streaming advanced, 4849551 +silesia.tar, level -5, old streaming advanced, 6982759 +silesia.tar, level -3, old streaming advanced, 6641283 +silesia.tar, level -1, old streaming advanced, 6190795 +silesia.tar, level 0, old streaming advanced, 4861425 +silesia.tar, level 1, old streaming advanced, 5336941 +silesia.tar, level 3, old streaming advanced, 4861425 silesia.tar, level 4, old streaming advanced, 4799632 -silesia.tar, level 5, old streaming advanced, 4650207 -silesia.tar, level 6, old streaming advanced, 4616816 -silesia.tar, level 7, old streaming advanced, 4576831 -silesia.tar, level 9, old streaming advanced, 4552590 -silesia.tar, level 13, old streaming advanced, 4502956 -silesia.tar, level 16, old streaming advanced, 4360527 -silesia.tar, level 19, old streaming advanced, 4267266 -silesia.tar, no source size, old streaming advanced, 4861422 -silesia.tar, long distance mode, old streaming advanced, 4861426 -silesia.tar, multithreaded, old streaming advanced, 4861426 -silesia.tar, multithreaded long distance mode, old streaming advanced, 4861426 +silesia.tar, level 5, old streaming advanced, 4650392 +silesia.tar, level 6, old streaming advanced, 4617097 +silesia.tar, level 7, old streaming advanced, 4576953 +silesia.tar, level 9, old streaming advanced, 4552646 +silesia.tar, level 13, old streaming advanced, 4491769 +silesia.tar, level 16, old streaming advanced, 4356834 +silesia.tar, level 19, old streaming advanced, 4264388 +silesia.tar, no source size, old streaming advanced, 4861421 +silesia.tar, long distance mode, old streaming advanced, 4861425 +silesia.tar, multithreaded, old streaming advanced, 4861425 +silesia.tar, multithreaded long distance mode, old streaming advanced, 4861425 silesia.tar, small window log, old streaming advanced, 7118772 -silesia.tar, small hash log, old streaming advanced, 6529234 -silesia.tar, small chain log, old streaming advanced, 4917021 -silesia.tar, explicit params, old streaming advanced, 4807401 -silesia.tar, uncompressed literals, old streaming advanced, 4861426 -silesia.tar, uncompressed literals optimal, old streaming advanced, 4267266 -silesia.tar, huffman literals, old streaming advanced, 6187938 -silesia.tar, multithreaded with advanced params, old streaming advanced, 4861426 -github, level -5, old streaming advanced, 241214 +silesia.tar, small hash log, old streaming advanced, 6529231 +silesia.tar, small chain log, old streaming advanced, 4917019 +silesia.tar, explicit params, old streaming advanced, 4807688 +silesia.tar, uncompressed literals, old streaming advanced, 4861425 +silesia.tar, uncompressed literals optimal, old streaming advanced, 4264388 +silesia.tar, huffman literals, old streaming advanced, 6190795 +silesia.tar, multithreaded with advanced params, old streaming advanced, 4861425 +github, level -5, old streaming advanced, 216734 github, level -5 with dict, old streaming advanced, 49562 -github, level -3, old streaming advanced, 222937 +github, level -3, old streaming advanced, 192160 github, level -3 with dict, old streaming advanced, 44956 -github, level -1, old streaming advanced, 181107 +github, level -1, old streaming advanced, 181108 github, level -1 with dict, old streaming advanced, 42383 github, level 0, old streaming advanced, 141104 github, level 0 with dict, old streaming advanced, 41113 -github, level 1, old streaming advanced, 143693 +github, level 1, old streaming advanced, 143692 github, level 1 with dict, old streaming advanced, 42430 github, level 3, old streaming advanced, 141104 github, level 3 with dict, old streaming advanced, 41113 @@ -1359,7 +1359,7 @@ github, level 7 with dict, old stre github, level 9, old streaming advanced, 138676 github, level 9 with dict, old streaming advanced, 38981 github, level 13, old streaming advanced, 138676 -github, level 13 with dict, old streaming advanced, 39721 +github, level 13 with dict, old streaming advanced, 39731 github, level 16, old streaming advanced, 138676 github, level 16 with dict, old streaming advanced, 40789 github, level 19, old streaming advanced, 134064 @@ -1375,36 +1375,36 @@ github, small chain log, old stre github, explicit params, old streaming advanced, 140937 github, uncompressed literals, old streaming advanced, 141104 github, uncompressed literals optimal, old streaming advanced, 134064 -github, huffman literals, old streaming advanced, 181107 +github, huffman literals, old streaming advanced, 181108 github, multithreaded with advanced params, old streaming advanced, 141104 -github.tar, level -5, old streaming advanced, 64132 -github.tar, level -5 with dict, old streaming advanced, 48982 -github.tar, level -3, old streaming advanced, 50964 -github.tar, level -3 with dict, old streaming advanced, 43357 -github.tar, level -1, old streaming advanced, 42536 -github.tar, level -1 with dict, old streaming advanced, 41494 +github.tar, level -5, old streaming advanced, 46747 +github.tar, level -5 with dict, old streaming advanced, 44824 +github.tar, level -3, old streaming advanced, 43537 +github.tar, level -3 with dict, old streaming advanced, 41800 +github.tar, level -1, old streaming advanced, 42465 +github.tar, level -1 with dict, old streaming advanced, 41471 github.tar, level 0, old streaming advanced, 38441 github.tar, level 0 with dict, old streaming advanced, 38013 -github.tar, level 1, old streaming advanced, 39270 -github.tar, level 1 with dict, old streaming advanced, 38934 +github.tar, level 1, old streaming advanced, 39342 +github.tar, level 1 with dict, old streaming advanced, 38940 github.tar, level 3, old streaming advanced, 38441 github.tar, level 3 with dict, old streaming advanced, 38013 github.tar, level 4, old streaming advanced, 38467 github.tar, level 4 with dict, old streaming advanced, 38063 -github.tar, level 5, old streaming advanced, 38376 -github.tar, level 5 with dict, old streaming advanced, 37677 -github.tar, level 6, old streaming advanced, 38610 -github.tar, level 6 with dict, old streaming advanced, 37786 -github.tar, level 7, old streaming advanced, 38073 -github.tar, level 7 with dict, old streaming advanced, 37322 -github.tar, level 9, old streaming advanced, 36767 -github.tar, level 9 with dict, old streaming advanced, 36233 -github.tar, level 13, old streaming advanced, 35501 -github.tar, level 13 with dict, old streaming advanced, 35807 -github.tar, level 16, old streaming advanced, 40471 -github.tar, level 16 with dict, old streaming advanced, 38578 -github.tar, level 19, old streaming advanced, 32134 -github.tar, level 19 with dict, old streaming advanced, 32702 +github.tar, level 5, old streaming advanced, 38394 +github.tar, level 5 with dict, old streaming advanced, 37763 +github.tar, level 6, old streaming advanced, 38669 +github.tar, level 6 with dict, old streaming advanced, 37851 +github.tar, level 7, old streaming advanced, 38153 +github.tar, level 7 with dict, old streaming advanced, 37406 +github.tar, level 9, old streaming advanced, 36768 +github.tar, level 9 with dict, old streaming advanced, 36304 +github.tar, level 13, old streaming advanced, 35621 +github.tar, level 13 with dict, old streaming advanced, 36035 +github.tar, level 16, old streaming advanced, 40255 +github.tar, level 16 with dict, old streaming advanced, 38736 +github.tar, level 19, old streaming advanced, 32837 +github.tar, level 19 with dict, old streaming advanced, 32876 github.tar, no source size, old streaming advanced, 38438 github.tar, no source size with dict, old streaming advanced, 38015 github.tar, long distance mode, old streaming advanced, 38441 @@ -1413,10 +1413,10 @@ github.tar, multithreaded long distance mode, old stre github.tar, small window log, old streaming advanced, 199561 github.tar, small hash log, old streaming advanced, 129870 github.tar, small chain log, old streaming advanced, 41669 -github.tar, explicit params, old streaming advanced, 41227 +github.tar, explicit params, old streaming advanced, 41351 github.tar, uncompressed literals, old streaming advanced, 38441 -github.tar, uncompressed literals optimal, old streaming advanced, 32134 -github.tar, huffman literals, old streaming advanced, 42536 +github.tar, uncompressed literals optimal, old streaming advanced, 32837 +github.tar, huffman literals, old streaming advanced, 42465 github.tar, multithreaded with advanced params, old streaming advanced, 38441 github, level -5 with dict, old streaming cdict, 46718 github, level -3 with dict, old streaming cdict, 45395 @@ -1433,20 +1433,20 @@ github, level 13 with dict, old stre github, level 16 with dict, old streaming cdict, 37577 github, level 19 with dict, old streaming cdict, 37576 github, no source size with dict, old streaming cdict, 40654 -github.tar, level -5 with dict, old streaming cdict, 49146 -github.tar, level -3 with dict, old streaming cdict, 43468 -github.tar, level -1 with dict, old streaming cdict, 41662 +github.tar, level -5 with dict, old streaming cdict, 45018 +github.tar, level -3 with dict, old streaming cdict, 41886 +github.tar, level -1 with dict, old streaming cdict, 41636 github.tar, level 0 with dict, old streaming cdict, 37956 -github.tar, level 1 with dict, old streaming cdict, 38761 +github.tar, level 1 with dict, old streaming cdict, 38766 github.tar, level 3 with dict, old streaming cdict, 37956 github.tar, level 4 with dict, old streaming cdict, 37927 -github.tar, level 5 with dict, old streaming cdict, 37600 -github.tar, level 6 with dict, old streaming cdict, 37829 -github.tar, level 7 with dict, old streaming cdict, 37371 -github.tar, level 9 with dict, old streaming cdict, 36352 -github.tar, level 13 with dict, old streaming cdict, 36010 -github.tar, level 16 with dict, old streaming cdict, 39081 -github.tar, level 19 with dict, old streaming cdict, 32474 +github.tar, level 5 with dict, old streaming cdict, 37665 +github.tar, level 6 with dict, old streaming cdict, 37889 +github.tar, level 7 with dict, old streaming cdict, 37457 +github.tar, level 9 with dict, old streaming cdict, 36383 +github.tar, level 13 with dict, old streaming cdict, 36372 +github.tar, level 16 with dict, old streaming cdict, 39353 +github.tar, level 19 with dict, old streaming cdict, 32676 github.tar, no source size with dict, old streaming cdict, 38000 github, level -5 with dict, old streaming advanced cdict, 49562 github, level -3 with dict, old streaming advanced cdict, 44956 @@ -1459,7 +1459,7 @@ github, level 5 with dict, old stre github, level 6 with dict, old streaming advanced cdict, 39363 github, level 7 with dict, old streaming advanced cdict, 38924 github, level 9 with dict, old streaming advanced cdict, 38981 -github, level 13 with dict, old streaming advanced cdict, 39721 +github, level 13 with dict, old streaming advanced cdict, 39731 github, level 16 with dict, old streaming advanced cdict, 40789 github, level 19 with dict, old streaming advanced cdict, 37576 github, no source size with dict, old streaming advanced cdict, 40608 @@ -1470,11 +1470,11 @@ github.tar, level 0 with dict, old stre github.tar, level 1 with dict, old streaming advanced cdict, 39002 github.tar, level 3 with dict, old streaming advanced cdict, 38013 github.tar, level 4 with dict, old streaming advanced cdict, 38063 -github.tar, level 5 with dict, old streaming advanced cdict, 37677 -github.tar, level 6 with dict, old streaming advanced cdict, 37786 -github.tar, level 7 with dict, old streaming advanced cdict, 37322 -github.tar, level 9 with dict, old streaming advanced cdict, 36233 -github.tar, level 13 with dict, old streaming advanced cdict, 35807 -github.tar, level 16 with dict, old streaming advanced cdict, 38578 -github.tar, level 19 with dict, old streaming advanced cdict, 32702 +github.tar, level 5 with dict, old streaming advanced cdict, 37763 +github.tar, level 6 with dict, old streaming advanced cdict, 37851 +github.tar, level 7 with dict, old streaming advanced cdict, 37406 +github.tar, level 9 with dict, old streaming advanced cdict, 36304 +github.tar, level 13 with dict, old streaming advanced cdict, 36035 +github.tar, level 16 with dict, old streaming advanced cdict, 38736 +github.tar, level 19 with dict, old streaming advanced cdict, 32876 github.tar, no source size with dict, old streaming advanced cdict, 38015 From ccdcbf46214186db78779290f025158bb1eee627 Mon Sep 17 00:00:00 2001 From: Sen Huang Date: Thu, 23 Sep 2021 07:08:56 -0700 Subject: [PATCH 35/38] Try beginning and end of match --- lib/compress/zstd_lazy.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/compress/zstd_lazy.c b/lib/compress/zstd_lazy.c index e9ee6ebd4..c94a663be 100644 --- a/lib/compress/zstd_lazy.c +++ b/lib/compress/zstd_lazy.c @@ -1025,14 +1025,29 @@ FORCE_INLINE_TEMPLATE void ZSTD_row_update_internal(ZSTD_matchState_t* ms, const U32 idx = ms->nextToUpdate; const BYTE* const base = ms->window.base; const U32 target = (U32)(ip - base); - const U32 kMaxPositionsToUpdate = 256; + const U32 kMaxPositionsToUpdate = 128; assert(target >= idx); if (useCache) { /* Only skip positions when using hash cache, i.e. - if we are loading a dict, don't skip anything */ + * if we are loading a dict, don't skip anything. + */ if (UNLIKELY(target - idx > kMaxPositionsToUpdate)) { - idx = target - kMaxPositionsToUpdate; + U32 const bound = idx + 3*kMaxPositionsToUpdate/4; + for (; idx < bound; ++idx) { + U32 const hash = useCache ? ZSTD_row_nextCachedHash(ms->hashCache, hashTable, tagTable, base, idx, hashLog, rowLog, mls) + : (U32)ZSTD_hashPtr(base + idx, hashLog + ZSTD_ROW_HASH_TAG_BITS, mls); + U32 const relRow = (hash >> ZSTD_ROW_HASH_TAG_BITS) << rowLog; + U32* const row = hashTable + relRow; + BYTE* tagRow = (BYTE*)(tagTable + relRow); /* Though tagTable is laid out as a table of U16, each tag is only 1 byte. + Explicit cast allows us to get exact desired position within each row */ + U32 const pos = ZSTD_row_nextIndex(tagRow, rowMask); + + assert(hash == ZSTD_hashPtr(base + idx, hashLog + ZSTD_ROW_HASH_TAG_BITS, mls)); + tagRow[pos + ZSTD_ROW_HASH_TAG_OFFSET] = hash & ZSTD_ROW_HASH_TAG_MASK; + row[pos] = idx; + } + idx = target - kMaxPositionsToUpdate/4; ZSTD_row_fillHashCache(ms, base, rowLog, mls, idx, ip+1); } } From 4b7f45cb04d624d5ae2cc5bbaf234fe450ad8c09 Mon Sep 17 00:00:00 2001 From: Sen Huang Date: Tue, 28 Sep 2021 07:48:56 -0700 Subject: [PATCH 36/38] Pull hot loop into its own function --- lib/compress/zstd_lazy.c | 86 +++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/lib/compress/zstd_lazy.c b/lib/compress/zstd_lazy.c index c94a663be..c76fa840f 100644 --- a/lib/compress/zstd_lazy.c +++ b/lib/compress/zstd_lazy.c @@ -1011,61 +1011,65 @@ FORCE_INLINE_TEMPLATE U32 ZSTD_row_nextCachedHash(U32* cache, U32 const* hashTab } } -/* ZSTD_row_update_internal(): - * Inserts the byte at ip into the appropriate position in the hash table. - * Determines the relative row, and the position within the {16, 32} entry row to insert at. +/* ZSTD_row_update_internalImpl(): + * Updates the hash table with positions starting from updateStartIdx until updateEndIdx. */ -FORCE_INLINE_TEMPLATE void ZSTD_row_update_internal(ZSTD_matchState_t* ms, const BYTE* ip, - U32 const mls, U32 const rowLog, - U32 const rowMask, U32 const useCache) +FORCE_INLINE_TEMPLATE void ZSTD_row_update_internalImpl(ZSTD_matchState_t* ms, + U32 updateStartIdx, U32 const updateEndIdx, + U32 const mls, U32 const rowLog, + U32 const rowMask, U32 const useCache) { U32* const hashTable = ms->hashTable; U16* const tagTable = ms->tagTable; U32 const hashLog = ms->rowHashLog; - U32 idx = ms->nextToUpdate; const BYTE* const base = ms->window.base; - const U32 target = (U32)(ip - base); - const U32 kMaxPositionsToUpdate = 128; - assert(target >= idx); - if (useCache) { - /* Only skip positions when using hash cache, i.e. - * if we are loading a dict, don't skip anything. - */ - if (UNLIKELY(target - idx > kMaxPositionsToUpdate)) { - U32 const bound = idx + 3*kMaxPositionsToUpdate/4; - for (; idx < bound; ++idx) { - U32 const hash = useCache ? ZSTD_row_nextCachedHash(ms->hashCache, hashTable, tagTable, base, idx, hashLog, rowLog, mls) - : (U32)ZSTD_hashPtr(base + idx, hashLog + ZSTD_ROW_HASH_TAG_BITS, mls); - U32 const relRow = (hash >> ZSTD_ROW_HASH_TAG_BITS) << rowLog; - U32* const row = hashTable + relRow; - BYTE* tagRow = (BYTE*)(tagTable + relRow); /* Though tagTable is laid out as a table of U16, each tag is only 1 byte. - Explicit cast allows us to get exact desired position within each row */ - U32 const pos = ZSTD_row_nextIndex(tagRow, rowMask); - - assert(hash == ZSTD_hashPtr(base + idx, hashLog + ZSTD_ROW_HASH_TAG_BITS, mls)); - tagRow[pos + ZSTD_ROW_HASH_TAG_OFFSET] = hash & ZSTD_ROW_HASH_TAG_MASK; - row[pos] = idx; - } - idx = target - kMaxPositionsToUpdate/4; - ZSTD_row_fillHashCache(ms, base, rowLog, mls, idx, ip+1); - } - } - - DEBUGLOG(6, "ZSTD_row_update_internal(): nextToUpdate=%u, current=%u", idx, target); - for (; idx < target; ++idx) { - U32 const hash = useCache ? ZSTD_row_nextCachedHash(ms->hashCache, hashTable, tagTable, base, idx, hashLog, rowLog, mls) - : (U32)ZSTD_hashPtr(base + idx, hashLog + ZSTD_ROW_HASH_TAG_BITS, mls); + DEBUGLOG(6, "ZSTD_row_update_internalImpl(): updateStartIdx=%u, updateEndIdx=%u", updateStartIdx, updateEndIdx); + for (; updateStartIdx < updateEndIdx; ++updateStartIdx) { + U32 const hash = useCache ? ZSTD_row_nextCachedHash(ms->hashCache, hashTable, tagTable, base, updateStartIdx, hashLog, rowLog, mls) + : (U32)ZSTD_hashPtr(base + updateStartIdx, hashLog + ZSTD_ROW_HASH_TAG_BITS, mls); U32 const relRow = (hash >> ZSTD_ROW_HASH_TAG_BITS) << rowLog; U32* const row = hashTable + relRow; BYTE* tagRow = (BYTE*)(tagTable + relRow); /* Though tagTable is laid out as a table of U16, each tag is only 1 byte. Explicit cast allows us to get exact desired position within each row */ U32 const pos = ZSTD_row_nextIndex(tagRow, rowMask); - assert(hash == ZSTD_hashPtr(base + idx, hashLog + ZSTD_ROW_HASH_TAG_BITS, mls)); - tagRow[pos + ZSTD_ROW_HASH_TAG_OFFSET] = hash & ZSTD_ROW_HASH_TAG_MASK; - row[pos] = idx; + assert(hash == ZSTD_hashPtr(base + updateStartIdx, hashLog + ZSTD_ROW_HASH_TAG_BITS, mls)); + ((BYTE*)tagRow)[pos + ZSTD_ROW_HASH_TAG_OFFSET] = hash & ZSTD_ROW_HASH_TAG_MASK; + row[pos] = updateStartIdx; } +} + +/* ZSTD_row_update_internal(): + * Inserts the byte at ip into the appropriate position in the hash table, and updates ms->nextToUpdate. + * Skips sections of long matches as is necessary. + */ +FORCE_INLINE_TEMPLATE void ZSTD_row_update_internal(ZSTD_matchState_t* ms, const BYTE* ip, + U32 const mls, U32 const rowLog, + U32 const rowMask, U32 const useCache) +{ + U32 idx = ms->nextToUpdate; + const BYTE* const base = ms->window.base; + const U32 target = (U32)(ip - base); + const U32 kSkipThreshold = 384; + const U32 kMaxMatchStartPositionsToUpdate = 96; + const U32 kMaxMatchEndPositionsToUpdate = 32; + + if (useCache) { + /* Only skip positions when using hash cache, i.e. + * if we are loading a dict, don't skip anything. + * If we decide to skip, then we only update a set number + * of positions at the beginning and end of the match. + */ + if (UNLIKELY(target - idx > kSkipThreshold)) { + U32 const bound = idx + kMaxMatchStartPositionsToUpdate; + ZSTD_row_update_internalImpl(ms, idx, bound, mls, rowLog, rowMask, useCache); + idx = target - kMaxMatchEndPositionsToUpdate; + ZSTD_row_fillHashCache(ms, base, rowLog, mls, idx, ip+1); + } + } + assert(target >= idx); + ZSTD_row_update_internalImpl(ms, idx, target, mls, rowLog, rowMask, useCache); ms->nextToUpdate = target; } From 93603673718d6063a86d483e9d09ac2fdf8ca00d Mon Sep 17 00:00:00 2001 From: Sen Huang Date: Tue, 28 Sep 2021 08:29:11 -0700 Subject: [PATCH 37/38] Update regression test --- tests/regression/results.csv | 1586 +++++++++++++++++----------------- 1 file changed, 793 insertions(+), 793 deletions(-) diff --git a/tests/regression/results.csv b/tests/regression/results.csv index 66be6cb5b..2538728c8 100644 --- a/tests/regression/results.csv +++ b/tests/regression/results.csv @@ -1,72 +1,72 @@ Data, Config, Method, Total compressed size -silesia.tar, level -5, compress simple, 6738593 -silesia.tar, level -3, compress simple, 6446372 -silesia.tar, level -1, compress simple, 6186042 -silesia.tar, level 0, compress simple, 4861423 -silesia.tar, level 1, compress simple, 5334885 -silesia.tar, level 3, compress simple, 4861423 +silesia.tar, level -5, compress simple, 7359401 +silesia.tar, level -3, compress simple, 6901672 +silesia.tar, level -1, compress simple, 6182241 +silesia.tar, level 0, compress simple, 4861424 +silesia.tar, level 1, compress simple, 5331946 +silesia.tar, level 3, compress simple, 4861424 silesia.tar, level 4, compress simple, 4799632 -silesia.tar, level 5, compress simple, 4650387 -silesia.tar, level 6, compress simple, 4617089 -silesia.tar, level 7, compress simple, 4576951 -silesia.tar, level 9, compress simple, 4552638 -silesia.tar, level 13, compress simple, 4491768 -silesia.tar, level 16, compress simple, 4356834 -silesia.tar, level 19, compress simple, 4264388 -silesia.tar, uncompressed literals, compress simple, 4861423 -silesia.tar, uncompressed literals optimal, compress simple, 4264388 -silesia.tar, huffman literals, compress simple, 6186042 -github.tar, level -5, compress simple, 46856 -github.tar, level -3, compress simple, 43754 -github.tar, level -1, compress simple, 42490 +silesia.tar, level 5, compress simple, 4649987 +silesia.tar, level 6, compress simple, 4616797 +silesia.tar, level 7, compress simple, 4576661 +silesia.tar, level 9, compress simple, 4552381 +silesia.tar, level 13, compress simple, 4502956 +silesia.tar, level 16, compress simple, 4360527 +silesia.tar, level 19, compress simple, 4267266 +silesia.tar, uncompressed literals, compress simple, 4861424 +silesia.tar, uncompressed literals optimal, compress simple, 4267266 +silesia.tar, huffman literals, compress simple, 6182241 +github.tar, level -5, compress simple, 66914 +github.tar, level -3, compress simple, 52127 +github.tar, level -1, compress simple, 42560 github.tar, level 0, compress simple, 38441 -github.tar, level 1, compress simple, 39265 +github.tar, level 1, compress simple, 39200 github.tar, level 3, compress simple, 38441 github.tar, level 4, compress simple, 38467 -github.tar, level 5, compress simple, 38394 -github.tar, level 6, compress simple, 38669 -github.tar, level 7, compress simple, 38153 -github.tar, level 9, compress simple, 36768 -github.tar, level 13, compress simple, 35621 -github.tar, level 16, compress simple, 40255 -github.tar, level 19, compress simple, 32837 +github.tar, level 5, compress simple, 38366 +github.tar, level 6, compress simple, 38648 +github.tar, level 7, compress simple, 38110 +github.tar, level 9, compress simple, 36760 +github.tar, level 13, compress simple, 35501 +github.tar, level 16, compress simple, 40471 +github.tar, level 19, compress simple, 32134 github.tar, uncompressed literals, compress simple, 38441 -github.tar, uncompressed literals optimal, compress simple, 32837 -github.tar, huffman literals, compress simple, 42490 -silesia, level -5, compress cctx, 6737607 -silesia, level -3, compress cctx, 6444677 -silesia, level -1, compress cctx, 6178460 -silesia, level 0, compress cctx, 4849551 -silesia, level 1, compress cctx, 5313202 -silesia, level 3, compress cctx, 4849551 -silesia, level 4, compress cctx, 4786969 -silesia, level 5, compress cctx, 4639132 -silesia, level 6, compress cctx, 4605629 -silesia, level 7, compress cctx, 4567307 -silesia, level 9, compress cctx, 4543330 -silesia, level 13, compress cctx, 4482131 -silesia, level 16, compress cctx, 4360251 -silesia, level 19, compress cctx, 4283236 -silesia, long distance mode, compress cctx, 4849551 -silesia, multithreaded, compress cctx, 4849551 -silesia, multithreaded long distance mode, compress cctx, 4849551 +github.tar, uncompressed literals optimal, compress simple, 32134 +github.tar, huffman literals, compress simple, 42560 +silesia, level -5, compress cctx, 7354675 +silesia, level -3, compress cctx, 6902374 +silesia, level -1, compress cctx, 6177565 +silesia, level 0, compress cctx, 4849553 +silesia, level 1, compress cctx, 5309098 +silesia, level 3, compress cctx, 4849553 +silesia, level 4, compress cctx, 4786968 +silesia, level 5, compress cctx, 4638691 +silesia, level 6, compress cctx, 4605296 +silesia, level 7, compress cctx, 4566984 +silesia, level 9, compress cctx, 4543018 +silesia, level 13, compress cctx, 4493990 +silesia, level 16, compress cctx, 4359864 +silesia, level 19, compress cctx, 4296880 +silesia, long distance mode, compress cctx, 4849553 +silesia, multithreaded, compress cctx, 4849553 +silesia, multithreaded long distance mode, compress cctx, 4849553 silesia, small window log, compress cctx, 7084179 silesia, small hash log, compress cctx, 6526141 -silesia, small chain log, compress cctx, 4912199 -silesia, explicit params, compress cctx, 4794917 -silesia, uncompressed literals, compress cctx, 4849551 -silesia, uncompressed literals optimal, compress cctx, 4283236 -silesia, huffman literals, compress cctx, 6178460 -silesia, multithreaded with advanced params, compress cctx, 4849551 -github, level -5, compress cctx, 205285 +silesia, small chain log, compress cctx, 4912197 +silesia, explicit params, compress cctx, 4794052 +silesia, uncompressed literals, compress cctx, 4849553 +silesia, uncompressed literals optimal, compress cctx, 4296880 +silesia, huffman literals, compress cctx, 6177565 +silesia, multithreaded with advanced params, compress cctx, 4849553 +github, level -5, compress cctx, 232315 github, level -5 with dict, compress cctx, 47294 -github, level -3, compress cctx, 190643 +github, level -3, compress cctx, 220760 github, level -3 with dict, compress cctx, 48047 -github, level -1, compress cctx, 175568 +github, level -1, compress cctx, 175468 github, level -1 with dict, compress cctx, 43527 github, level 0, compress cctx, 136335 github, level 0 with dict, compress cctx, 41534 -github, level 1, compress cctx, 142465 +github, level 1, compress cctx, 142365 github, level 1 with dict, compress cctx, 42157 github, level 3, compress cctx, 136335 github, level 3 with dict, compress cctx, 41534 @@ -95,68 +95,68 @@ github, small chain log, compress github, explicit params, compress cctx, 140932 github, uncompressed literals, compress cctx, 136335 github, uncompressed literals optimal, compress cctx, 134064 -github, huffman literals, compress cctx, 175568 +github, huffman literals, compress cctx, 175468 github, multithreaded with advanced params, compress cctx, 141102 -silesia, level -5, zstdcli, 6737655 -silesia, level -3, zstdcli, 6444725 -silesia, level -1, zstdcli, 6178508 -silesia, level 0, zstdcli, 4849599 -silesia, level 1, zstdcli, 5313250 -silesia, level 3, zstdcli, 4849599 -silesia, level 4, zstdcli, 4787017 -silesia, level 5, zstdcli, 4639180 -silesia, level 6, zstdcli, 4605677 -silesia, level 7, zstdcli, 4567355 -silesia, level 9, zstdcli, 4543378 -silesia, level 13, zstdcli, 4482179 -silesia, level 16, zstdcli, 4360299 -silesia, level 19, zstdcli, 4283284 +silesia, level -5, zstdcli, 7354723 +silesia, level -3, zstdcli, 6902422 +silesia, level -1, zstdcli, 6177613 +silesia, level 0, zstdcli, 4849601 +silesia, level 1, zstdcli, 5309146 +silesia, level 3, zstdcli, 4849601 +silesia, level 4, zstdcli, 4787016 +silesia, level 5, zstdcli, 4638739 +silesia, level 6, zstdcli, 4605344 +silesia, level 7, zstdcli, 4567032 +silesia, level 9, zstdcli, 4543066 +silesia, level 13, zstdcli, 4494038 +silesia, level 16, zstdcli, 4359912 +silesia, level 19, zstdcli, 4296928 silesia, long distance mode, zstdcli, 4840807 -silesia, multithreaded, zstdcli, 4849599 +silesia, multithreaded, zstdcli, 4849601 silesia, multithreaded long distance mode, zstdcli, 4840807 silesia, small window log, zstdcli, 7095967 silesia, small hash log, zstdcli, 6526189 -silesia, small chain log, zstdcli, 4912247 -silesia, explicit params, zstdcli, 4796282 +silesia, small chain log, zstdcli, 4912245 +silesia, explicit params, zstdcli, 4795432 silesia, uncompressed literals, zstdcli, 5128030 -silesia, uncompressed literals optimal, zstdcli, 4317944 -silesia, huffman literals, zstdcli, 5326317 +silesia, uncompressed literals optimal, zstdcli, 4319566 +silesia, huffman literals, zstdcli, 5326394 silesia, multithreaded with advanced params, zstdcli, 5128030 -silesia.tar, level -5, zstdcli, 6738934 -silesia.tar, level -3, zstdcli, 6448419 -silesia.tar, level -1, zstdcli, 6186912 -silesia.tar, level 0, zstdcli, 4861511 -silesia.tar, level 1, zstdcli, 5336318 -silesia.tar, level 3, zstdcli, 4861511 -silesia.tar, level 4, zstdcli, 4800529 -silesia.tar, level 5, zstdcli, 4651342 -silesia.tar, level 6, zstdcli, 4618674 -silesia.tar, level 7, zstdcli, 4579009 -silesia.tar, level 9, zstdcli, 4553551 -silesia.tar, level 13, zstdcli, 4491772 -silesia.tar, level 16, zstdcli, 4356838 -silesia.tar, level 19, zstdcli, 4264392 -silesia.tar, no source size, zstdcli, 4861507 +silesia.tar, level -5, zstdcli, 7363866 +silesia.tar, level -3, zstdcli, 6902158 +silesia.tar, level -1, zstdcli, 6182939 +silesia.tar, level 0, zstdcli, 4861512 +silesia.tar, level 1, zstdcli, 5333183 +silesia.tar, level 3, zstdcli, 4861512 +silesia.tar, level 4, zstdcli, 4800528 +silesia.tar, level 5, zstdcli, 4650946 +silesia.tar, level 6, zstdcli, 4618390 +silesia.tar, level 7, zstdcli, 4578719 +silesia.tar, level 9, zstdcli, 4553299 +silesia.tar, level 13, zstdcli, 4502960 +silesia.tar, level 16, zstdcli, 4360531 +silesia.tar, level 19, zstdcli, 4267270 +silesia.tar, no source size, zstdcli, 4861508 silesia.tar, long distance mode, zstdcli, 4853225 -silesia.tar, multithreaded, zstdcli, 4861511 +silesia.tar, multithreaded, zstdcli, 4861512 silesia.tar, multithreaded long distance mode, zstdcli, 4853225 silesia.tar, small window log, zstdcli, 7101576 -silesia.tar, small hash log, zstdcli, 6529286 -silesia.tar, small chain log, zstdcli, 4917020 -silesia.tar, explicit params, zstdcli, 4821593 +silesia.tar, small hash log, zstdcli, 6529289 +silesia.tar, small chain log, zstdcli, 4917022 +silesia.tar, explicit params, zstdcli, 4820713 silesia.tar, uncompressed literals, zstdcli, 5129559 -silesia.tar, uncompressed literals optimal, zstdcli, 4307404 -silesia.tar, huffman literals, zstdcli, 5347610 +silesia.tar, uncompressed literals optimal, zstdcli, 4310145 +silesia.tar, huffman literals, zstdcli, 5344915 silesia.tar, multithreaded with advanced params, zstdcli, 5129559 -github, level -5, zstdcli, 207285 +github, level -5, zstdcli, 234315 github, level -5 with dict, zstdcli, 48718 -github, level -3, zstdcli, 192643 +github, level -3, zstdcli, 222760 github, level -3 with dict, zstdcli, 47395 -github, level -1, zstdcli, 177568 +github, level -1, zstdcli, 177468 github, level -1 with dict, zstdcli, 45170 github, level 0, zstdcli, 138335 github, level 0 with dict, zstdcli, 43148 -github, level 1, zstdcli, 144465 +github, level 1, zstdcli, 144365 github, level 1 with dict, zstdcli, 43682 github, level 3, zstdcli, 138335 github, level 3 with dict, zstdcli, 43148 @@ -185,36 +185,36 @@ github, small chain log, zstdcli, github, explicit params, zstdcli, 136197 github, uncompressed literals, zstdcli, 167915 github, uncompressed literals optimal, zstdcli, 159227 -github, huffman literals, zstdcli, 144465 +github, huffman literals, zstdcli, 144365 github, multithreaded with advanced params, zstdcli, 167915 -github.tar, level -5, zstdcli, 46860 -github.tar, level -5 with dict, zstdcli, 44575 -github.tar, level -3, zstdcli, 43758 -github.tar, level -3 with dict, zstdcli, 41451 -github.tar, level -1, zstdcli, 42494 -github.tar, level -1 with dict, zstdcli, 41135 +github.tar, level -5, zstdcli, 66918 +github.tar, level -5 with dict, zstdcli, 51529 +github.tar, level -3, zstdcli, 52131 +github.tar, level -3 with dict, zstdcli, 44246 +github.tar, level -1, zstdcli, 42564 +github.tar, level -1 with dict, zstdcli, 41140 github.tar, level 0, zstdcli, 38445 github.tar, level 0 with dict, zstdcli, 37999 -github.tar, level 1, zstdcli, 39269 -github.tar, level 1 with dict, zstdcli, 38284 +github.tar, level 1, zstdcli, 39204 +github.tar, level 1 with dict, zstdcli, 38288 github.tar, level 3, zstdcli, 38445 github.tar, level 3 with dict, zstdcli, 37999 github.tar, level 4, zstdcli, 38471 github.tar, level 4 with dict, zstdcli, 37952 -github.tar, level 5, zstdcli, 38398 -github.tar, level 5 with dict, zstdcli, 39048 -github.tar, level 6, zstdcli, 38673 -github.tar, level 6 with dict, zstdcli, 38660 -github.tar, level 7, zstdcli, 38157 -github.tar, level 7 with dict, zstdcli, 37914 -github.tar, level 9, zstdcli, 36772 -github.tar, level 9 with dict, zstdcli, 36650 -github.tar, level 13, zstdcli, 35625 -github.tar, level 13 with dict, zstdcli, 38730 -github.tar, level 16, zstdcli, 40259 -github.tar, level 16 with dict, zstdcli, 33643 -github.tar, level 19, zstdcli, 32841 -github.tar, level 19 with dict, zstdcli, 32899 +github.tar, level 5, zstdcli, 38370 +github.tar, level 5 with dict, zstdcli, 39071 +github.tar, level 6, zstdcli, 38652 +github.tar, level 6 with dict, zstdcli, 38638 +github.tar, level 7, zstdcli, 38114 +github.tar, level 7 with dict, zstdcli, 37886 +github.tar, level 9, zstdcli, 36764 +github.tar, level 9 with dict, zstdcli, 36632 +github.tar, level 13, zstdcli, 35505 +github.tar, level 13 with dict, zstdcli, 37134 +github.tar, level 16, zstdcli, 40475 +github.tar, level 16 with dict, zstdcli, 33382 +github.tar, level 19, zstdcli, 32138 +github.tar, level 19 with dict, zstdcli, 32713 github.tar, no source size, zstdcli, 38442 github.tar, no source size with dict, zstdcli, 38004 github.tar, long distance mode, zstdcli, 39730 @@ -223,84 +223,84 @@ github.tar, multithreaded long distance mode, zstdcli, github.tar, small window log, zstdcli, 198544 github.tar, small hash log, zstdcli, 129874 github.tar, small chain log, zstdcli, 41673 -github.tar, explicit params, zstdcli, 41350 +github.tar, explicit params, zstdcli, 41385 github.tar, uncompressed literals, zstdcli, 41126 -github.tar, uncompressed literals optimal, zstdcli, 35392 -github.tar, huffman literals, zstdcli, 38781 +github.tar, uncompressed literals optimal, zstdcli, 35401 +github.tar, huffman literals, zstdcli, 38857 github.tar, multithreaded with advanced params, zstdcli, 41126 -silesia, level -5, advanced one pass, 6737607 -silesia, level -3, advanced one pass, 6444677 -silesia, level -1, advanced one pass, 6178460 -silesia, level 0, advanced one pass, 4849551 -silesia, level 1, advanced one pass, 5313202 -silesia, level 3, advanced one pass, 4849551 -silesia, level 4, advanced one pass, 4786969 -silesia, level 5 row 1, advanced one pass, 4640753 -silesia, level 5 row 2, advanced one pass, 4639132 -silesia, level 5, advanced one pass, 4639132 -silesia, level 6, advanced one pass, 4605629 -silesia, level 7 row 1, advanced one pass, 4564870 -silesia, level 7 row 2, advanced one pass, 4567307 -silesia, level 7, advanced one pass, 4567307 -silesia, level 9, advanced one pass, 4543330 -silesia, level 11 row 1, advanced one pass, 4519288 -silesia, level 11 row 2, advanced one pass, 4521524 -silesia, level 12 row 1, advanced one pass, 4503117 -silesia, level 12 row 2, advanced one pass, 4505093 -silesia, level 13, advanced one pass, 4482131 -silesia, level 16, advanced one pass, 4360251 -silesia, level 19, advanced one pass, 4283236 -silesia, no source size, advanced one pass, 4849551 -silesia, long distance mode, advanced one pass, 4840738 -silesia, multithreaded, advanced one pass, 4849551 +silesia, level -5, advanced one pass, 7354675 +silesia, level -3, advanced one pass, 6902374 +silesia, level -1, advanced one pass, 6177565 +silesia, level 0, advanced one pass, 4849553 +silesia, level 1, advanced one pass, 5309098 +silesia, level 3, advanced one pass, 4849553 +silesia, level 4, advanced one pass, 4786968 +silesia, level 5 row 1, advanced one pass, 4638691 +silesia, level 5 row 2, advanced one pass, 4640752 +silesia, level 5, advanced one pass, 4638691 +silesia, level 6, advanced one pass, 4605296 +silesia, level 7 row 1, advanced one pass, 4566984 +silesia, level 7 row 2, advanced one pass, 4564868 +silesia, level 7, advanced one pass, 4566984 +silesia, level 9, advanced one pass, 4543018 +silesia, level 11 row 1, advanced one pass, 4521323 +silesia, level 11 row 2, advanced one pass, 4519288 +silesia, level 12 row 1, advanced one pass, 4505046 +silesia, level 12 row 2, advanced one pass, 4503116 +silesia, level 13, advanced one pass, 4493990 +silesia, level 16, advanced one pass, 4359864 +silesia, level 19, advanced one pass, 4296880 +silesia, no source size, advanced one pass, 4849553 +silesia, long distance mode, advanced one pass, 4840737 +silesia, multithreaded, advanced one pass, 4849553 silesia, multithreaded long distance mode, advanced one pass, 4840759 silesia, small window log, advanced one pass, 7095919 silesia, small hash log, advanced one pass, 6526141 -silesia, small chain log, advanced one pass, 4912199 -silesia, explicit params, advanced one pass, 4796282 +silesia, small chain log, advanced one pass, 4912197 +silesia, explicit params, advanced one pass, 4795432 silesia, uncompressed literals, advanced one pass, 5127982 -silesia, uncompressed literals optimal, advanced one pass, 4317896 -silesia, huffman literals, advanced one pass, 5326269 +silesia, uncompressed literals optimal, advanced one pass, 4319518 +silesia, huffman literals, advanced one pass, 5326346 silesia, multithreaded with advanced params, advanced one pass, 5127982 -silesia.tar, level -5, advanced one pass, 6738593 -silesia.tar, level -3, advanced one pass, 6446372 -silesia.tar, level -1, advanced one pass, 6186042 -silesia.tar, level 0, advanced one pass, 4861423 -silesia.tar, level 1, advanced one pass, 5334885 -silesia.tar, level 3, advanced one pass, 4861423 +silesia.tar, level -5, advanced one pass, 7359401 +silesia.tar, level -3, advanced one pass, 6901672 +silesia.tar, level -1, advanced one pass, 6182241 +silesia.tar, level 0, advanced one pass, 4861424 +silesia.tar, level 1, advanced one pass, 5331946 +silesia.tar, level 3, advanced one pass, 4861424 silesia.tar, level 4, advanced one pass, 4799632 -silesia.tar, level 5 row 1, advanced one pass, 4652862 -silesia.tar, level 5 row 2, advanced one pass, 4650387 -silesia.tar, level 5, advanced one pass, 4650387 -silesia.tar, level 6, advanced one pass, 4617089 -silesia.tar, level 7 row 1, advanced one pass, 4575392 -silesia.tar, level 7 row 2, advanced one pass, 4576951 -silesia.tar, level 7, advanced one pass, 4576951 -silesia.tar, level 9, advanced one pass, 4552638 -silesia.tar, level 11 row 1, advanced one pass, 4529458 -silesia.tar, level 11 row 2, advanced one pass, 4530416 -silesia.tar, level 12 row 1, advanced one pass, 4513603 -silesia.tar, level 12 row 2, advanced one pass, 4514499 -silesia.tar, level 13, advanced one pass, 4491768 -silesia.tar, level 16, advanced one pass, 4356834 -silesia.tar, level 19, advanced one pass, 4264388 -silesia.tar, no source size, advanced one pass, 4861423 -silesia.tar, long distance mode, advanced one pass, 4847753 -silesia.tar, multithreaded, advanced one pass, 4861507 +silesia.tar, level 5 row 1, advanced one pass, 4649987 +silesia.tar, level 5 row 2, advanced one pass, 4652862 +silesia.tar, level 5, advanced one pass, 4649987 +silesia.tar, level 6, advanced one pass, 4616797 +silesia.tar, level 7 row 1, advanced one pass, 4576661 +silesia.tar, level 7 row 2, advanced one pass, 4575393 +silesia.tar, level 7, advanced one pass, 4576661 +silesia.tar, level 9, advanced one pass, 4552381 +silesia.tar, level 11 row 1, advanced one pass, 4530241 +silesia.tar, level 11 row 2, advanced one pass, 4529461 +silesia.tar, level 12 row 1, advanced one pass, 4514432 +silesia.tar, level 12 row 2, advanced one pass, 4513604 +silesia.tar, level 13, advanced one pass, 4502956 +silesia.tar, level 16, advanced one pass, 4360527 +silesia.tar, level 19, advanced one pass, 4267266 +silesia.tar, no source size, advanced one pass, 4861424 +silesia.tar, long distance mode, advanced one pass, 4847752 +silesia.tar, multithreaded, advanced one pass, 4861508 silesia.tar, multithreaded long distance mode, advanced one pass, 4853221 silesia.tar, small window log, advanced one pass, 7101530 -silesia.tar, small hash log, advanced one pass, 6529228 -silesia.tar, small chain log, advanced one pass, 4917039 -silesia.tar, explicit params, advanced one pass, 4807675 +silesia.tar, small hash log, advanced one pass, 6529231 +silesia.tar, small chain log, advanced one pass, 4917041 +silesia.tar, explicit params, advanced one pass, 4806855 silesia.tar, uncompressed literals, advanced one pass, 5129458 -silesia.tar, uncompressed literals optimal, advanced one pass, 4307400 -silesia.tar, huffman literals, advanced one pass, 5347335 +silesia.tar, uncompressed literals optimal, advanced one pass, 4310141 +silesia.tar, huffman literals, advanced one pass, 5344545 silesia.tar, multithreaded with advanced params, advanced one pass, 5129555 -github, level -5, advanced one pass, 205285 +github, level -5, advanced one pass, 232315 github, level -5 with dict, advanced one pass, 46718 -github, level -3, advanced one pass, 190643 +github, level -3, advanced one pass, 220760 github, level -3 with dict, advanced one pass, 45395 -github, level -1, advanced one pass, 175568 +github, level -1, advanced one pass, 175468 github, level -1 with dict, advanced one pass, 43170 github, level 0, advanced one pass, 136335 github, level 0 with dict, advanced one pass, 41148 @@ -308,7 +308,7 @@ github, level 0 with dict dms, advanced github, level 0 with dict dds, advanced one pass, 41148 github, level 0 with dict copy, advanced one pass, 41124 github, level 0 with dict load, advanced one pass, 42252 -github, level 1, advanced one pass, 142465 +github, level 1, advanced one pass, 142365 github, level 1 with dict, advanced one pass, 41682 github, level 1 with dict dms, advanced one pass, 41682 github, level 1 with dict dds, advanced one pass, 41682 @@ -326,16 +326,16 @@ github, level 4 with dict dms, advanced github, level 4 with dict dds, advanced one pass, 41251 github, level 4 with dict copy, advanced one pass, 41216 github, level 4 with dict load, advanced one pass, 41159 -github, level 5 row 1, advanced one pass, 135121 -github, level 5 row 1 with dict dms, advanced one pass, 38938 -github, level 5 row 1 with dict dds, advanced one pass, 38732 -github, level 5 row 1 with dict copy, advanced one pass, 38934 -github, level 5 row 1 with dict load, advanced one pass, 40725 -github, level 5 row 2, advanced one pass, 134584 -github, level 5 row 2 with dict dms, advanced one pass, 38758 -github, level 5 row 2 with dict dds, advanced one pass, 38728 -github, level 5 row 2 with dict copy, advanced one pass, 38759 -github, level 5 row 2 with dict load, advanced one pass, 41518 +github, level 5 row 1, advanced one pass, 134584 +github, level 5 row 1 with dict dms, advanced one pass, 38758 +github, level 5 row 1 with dict dds, advanced one pass, 38728 +github, level 5 row 1 with dict copy, advanced one pass, 38759 +github, level 5 row 1 with dict load, advanced one pass, 41518 +github, level 5 row 2, advanced one pass, 135121 +github, level 5 row 2 with dict dms, advanced one pass, 38938 +github, level 5 row 2 with dict dds, advanced one pass, 38732 +github, level 5 row 2 with dict copy, advanced one pass, 38934 +github, level 5 row 2 with dict load, advanced one pass, 40725 github, level 5, advanced one pass, 135121 github, level 5 with dict, advanced one pass, 38758 github, level 5 with dict dms, advanced one pass, 38758 @@ -348,16 +348,16 @@ github, level 6 with dict dms, advanced github, level 6 with dict dds, advanced one pass, 38636 github, level 6 with dict copy, advanced one pass, 38669 github, level 6 with dict load, advanced one pass, 40695 -github, level 7 row 1, advanced one pass, 135122 -github, level 7 row 1 with dict dms, advanced one pass, 38860 -github, level 7 row 1 with dict dds, advanced one pass, 38766 -github, level 7 row 1 with dict copy, advanced one pass, 38834 -github, level 7 row 1 with dict load, advanced one pass, 40695 -github, level 7 row 2, advanced one pass, 134584 -github, level 7 row 2 with dict dms, advanced one pass, 38758 -github, level 7 row 2 with dict dds, advanced one pass, 38745 -github, level 7 row 2 with dict copy, advanced one pass, 38755 -github, level 7 row 2 with dict load, advanced one pass, 43154 +github, level 7 row 1, advanced one pass, 134584 +github, level 7 row 1 with dict dms, advanced one pass, 38758 +github, level 7 row 1 with dict dds, advanced one pass, 38745 +github, level 7 row 1 with dict copy, advanced one pass, 38755 +github, level 7 row 1 with dict load, advanced one pass, 43154 +github, level 7 row 2, advanced one pass, 135122 +github, level 7 row 2 with dict dms, advanced one pass, 38860 +github, level 7 row 2 with dict dds, advanced one pass, 38766 +github, level 7 row 2 with dict copy, advanced one pass, 38834 +github, level 7 row 2 with dict load, advanced one pass, 40695 github, level 7, advanced one pass, 135122 github, level 7 with dict, advanced one pass, 38758 github, level 7 with dict dms, advanced one pass, 38758 @@ -419,26 +419,26 @@ github, small chain log, advanced github, explicit params, advanced one pass, 137727 github, uncompressed literals, advanced one pass, 165915 github, uncompressed literals optimal, advanced one pass, 157227 -github, huffman literals, advanced one pass, 142465 +github, huffman literals, advanced one pass, 142365 github, multithreaded with advanced params, advanced one pass, 165915 -github.tar, level -5, advanced one pass, 46856 -github.tar, level -5 with dict, advanced one pass, 44571 -github.tar, level -3, advanced one pass, 43754 -github.tar, level -3 with dict, advanced one pass, 41447 -github.tar, level -1, advanced one pass, 42490 -github.tar, level -1 with dict, advanced one pass, 41131 +github.tar, level -5, advanced one pass, 66914 +github.tar, level -5 with dict, advanced one pass, 51525 +github.tar, level -3, advanced one pass, 52127 +github.tar, level -3 with dict, advanced one pass, 44242 +github.tar, level -1, advanced one pass, 42560 +github.tar, level -1 with dict, advanced one pass, 41136 github.tar, level 0, advanced one pass, 38441 github.tar, level 0 with dict, advanced one pass, 37995 github.tar, level 0 with dict dms, advanced one pass, 38003 github.tar, level 0 with dict dds, advanced one pass, 38003 github.tar, level 0 with dict copy, advanced one pass, 37995 github.tar, level 0 with dict load, advanced one pass, 37956 -github.tar, level 1, advanced one pass, 39265 -github.tar, level 1 with dict, advanced one pass, 38280 -github.tar, level 1 with dict dms, advanced one pass, 38290 -github.tar, level 1 with dict dds, advanced one pass, 38290 -github.tar, level 1 with dict copy, advanced one pass, 38280 -github.tar, level 1 with dict load, advanced one pass, 38729 +github.tar, level 1, advanced one pass, 39200 +github.tar, level 1 with dict, advanced one pass, 38284 +github.tar, level 1 with dict dms, advanced one pass, 38294 +github.tar, level 1 with dict dds, advanced one pass, 38294 +github.tar, level 1 with dict copy, advanced one pass, 38284 +github.tar, level 1 with dict load, advanced one pass, 38724 github.tar, level 3, advanced one pass, 38441 github.tar, level 3 with dict, advanced one pass, 37995 github.tar, level 3 with dict dms, advanced one pass, 38003 @@ -451,88 +451,88 @@ github.tar, level 4 with dict dms, advanced github.tar, level 4 with dict dds, advanced one pass, 37954 github.tar, level 4 with dict copy, advanced one pass, 37948 github.tar, level 4 with dict load, advanced one pass, 37927 -github.tar, level 5 row 1, advanced one pass, 38534 -github.tar, level 5 row 1 with dict dms, advanced one pass, 39365 -github.tar, level 5 row 1 with dict dds, advanced one pass, 39233 -github.tar, level 5 row 1 with dict copy, advanced one pass, 39715 -github.tar, level 5 row 1 with dict load, advanced one pass, 38019 -github.tar, level 5 row 2, advanced one pass, 38394 -github.tar, level 5 row 2 with dict dms, advanced one pass, 39048 -github.tar, level 5 row 2 with dict dds, advanced one pass, 39044 -github.tar, level 5 row 2 with dict copy, advanced one pass, 39074 -github.tar, level 5 row 2 with dict load, advanced one pass, 37665 -github.tar, level 5, advanced one pass, 38394 -github.tar, level 5 with dict, advanced one pass, 39074 -github.tar, level 5 with dict dms, advanced one pass, 39048 -github.tar, level 5 with dict dds, advanced one pass, 39044 -github.tar, level 5 with dict copy, advanced one pass, 39074 -github.tar, level 5 with dict load, advanced one pass, 37665 -github.tar, level 6, advanced one pass, 38669 -github.tar, level 6 with dict, advanced one pass, 38660 -github.tar, level 6 with dict dms, advanced one pass, 38654 -github.tar, level 6 with dict dds, advanced one pass, 38656 -github.tar, level 6 with dict copy, advanced one pass, 38660 -github.tar, level 6 with dict load, advanced one pass, 37889 -github.tar, level 7 row 1, advanced one pass, 38077 -github.tar, level 7 row 1 with dict dms, advanced one pass, 38012 -github.tar, level 7 row 1 with dict dds, advanced one pass, 38014 -github.tar, level 7 row 1 with dict copy, advanced one pass, 38101 -github.tar, level 7 row 1 with dict load, advanced one pass, 37402 -github.tar, level 7 row 2, advanced one pass, 38153 -github.tar, level 7 row 2 with dict dms, advanced one pass, 37888 -github.tar, level 7 row 2 with dict dds, advanced one pass, 37910 -github.tar, level 7 row 2 with dict copy, advanced one pass, 37892 -github.tar, level 7 row 2 with dict load, advanced one pass, 37457 -github.tar, level 7, advanced one pass, 38153 -github.tar, level 7 with dict, advanced one pass, 37892 -github.tar, level 7 with dict dms, advanced one pass, 37888 -github.tar, level 7 with dict dds, advanced one pass, 37910 -github.tar, level 7 with dict copy, advanced one pass, 37892 -github.tar, level 7 with dict load, advanced one pass, 37457 -github.tar, level 9, advanced one pass, 36768 -github.tar, level 9 with dict, advanced one pass, 36510 -github.tar, level 9 with dict dms, advanced one pass, 36584 -github.tar, level 9 with dict dds, advanced one pass, 36646 -github.tar, level 9 with dict copy, advanced one pass, 36510 -github.tar, level 9 with dict load, advanced one pass, 36383 -github.tar, level 11 row 1, advanced one pass, 36435 +github.tar, level 5 row 1, advanced one pass, 38366 +github.tar, level 5 row 1 with dict dms, advanced one pass, 39059 +github.tar, level 5 row 1 with dict dds, advanced one pass, 39067 +github.tar, level 5 row 1 with dict copy, advanced one pass, 39082 +github.tar, level 5 row 1 with dict load, advanced one pass, 37656 +github.tar, level 5 row 2, advanced one pass, 38534 +github.tar, level 5 row 2 with dict dms, advanced one pass, 39365 +github.tar, level 5 row 2 with dict dds, advanced one pass, 39233 +github.tar, level 5 row 2 with dict copy, advanced one pass, 39715 +github.tar, level 5 row 2 with dict load, advanced one pass, 38019 +github.tar, level 5, advanced one pass, 38366 +github.tar, level 5 with dict, advanced one pass, 39082 +github.tar, level 5 with dict dms, advanced one pass, 39059 +github.tar, level 5 with dict dds, advanced one pass, 39067 +github.tar, level 5 with dict copy, advanced one pass, 39082 +github.tar, level 5 with dict load, advanced one pass, 37656 +github.tar, level 6, advanced one pass, 38648 +github.tar, level 6 with dict, advanced one pass, 38656 +github.tar, level 6 with dict dms, advanced one pass, 38636 +github.tar, level 6 with dict dds, advanced one pass, 38634 +github.tar, level 6 with dict copy, advanced one pass, 38656 +github.tar, level 6 with dict load, advanced one pass, 37865 +github.tar, level 7 row 1, advanced one pass, 38110 +github.tar, level 7 row 1 with dict dms, advanced one pass, 37858 +github.tar, level 7 row 1 with dict dds, advanced one pass, 37882 +github.tar, level 7 row 1 with dict copy, advanced one pass, 37865 +github.tar, level 7 row 1 with dict load, advanced one pass, 37436 +github.tar, level 7 row 2, advanced one pass, 38077 +github.tar, level 7 row 2 with dict dms, advanced one pass, 38012 +github.tar, level 7 row 2 with dict dds, advanced one pass, 38014 +github.tar, level 7 row 2 with dict copy, advanced one pass, 38101 +github.tar, level 7 row 2 with dict load, advanced one pass, 37402 +github.tar, level 7, advanced one pass, 38110 +github.tar, level 7 with dict, advanced one pass, 37865 +github.tar, level 7 with dict dms, advanced one pass, 37858 +github.tar, level 7 with dict dds, advanced one pass, 37882 +github.tar, level 7 with dict copy, advanced one pass, 37865 +github.tar, level 7 with dict load, advanced one pass, 37436 +github.tar, level 9, advanced one pass, 36760 +github.tar, level 9 with dict, advanced one pass, 36484 +github.tar, level 9 with dict dms, advanced one pass, 36567 +github.tar, level 9 with dict dds, advanced one pass, 36628 +github.tar, level 9 with dict copy, advanced one pass, 36484 +github.tar, level 9 with dict load, advanced one pass, 36401 +github.tar, level 11 row 1, advanced one pass, 36452 github.tar, level 11 row 1 with dict dms, advanced one pass, 36963 github.tar, level 11 row 1 with dict dds, advanced one pass, 36963 github.tar, level 11 row 1 with dict copy, advanced one pass, 36557 -github.tar, level 11 row 1 with dict load, advanced one pass, 36419 -github.tar, level 11 row 2, advanced one pass, 36412 +github.tar, level 11 row 1 with dict load, advanced one pass, 36455 +github.tar, level 11 row 2, advanced one pass, 36435 github.tar, level 11 row 2 with dict dms, advanced one pass, 36963 github.tar, level 11 row 2 with dict dds, advanced one pass, 36963 github.tar, level 11 row 2 with dict copy, advanced one pass, 36557 -github.tar, level 11 row 2 with dict load, advanced one pass, 36439 -github.tar, level 12 row 1, advanced one pass, 36110 +github.tar, level 11 row 2 with dict load, advanced one pass, 36419 +github.tar, level 12 row 1, advanced one pass, 36081 github.tar, level 12 row 1 with dict dms, advanced one pass, 36986 github.tar, level 12 row 1 with dict dds, advanced one pass, 36986 github.tar, level 12 row 1 with dict copy, advanced one pass, 36609 -github.tar, level 12 row 1 with dict load, advanced one pass, 36459 -github.tar, level 12 row 2, advanced one pass, 36062 +github.tar, level 12 row 1 with dict load, advanced one pass, 36434 +github.tar, level 12 row 2, advanced one pass, 36110 github.tar, level 12 row 2 with dict dms, advanced one pass, 36986 github.tar, level 12 row 2 with dict dds, advanced one pass, 36986 github.tar, level 12 row 2 with dict copy, advanced one pass, 36609 -github.tar, level 12 row 2 with dict load, advanced one pass, 36392 -github.tar, level 13, advanced one pass, 35621 -github.tar, level 13 with dict, advanced one pass, 38726 -github.tar, level 13 with dict dms, advanced one pass, 38903 -github.tar, level 13 with dict dds, advanced one pass, 38903 -github.tar, level 13 with dict copy, advanced one pass, 38726 -github.tar, level 13 with dict load, advanced one pass, 36372 -github.tar, level 16, advanced one pass, 40255 -github.tar, level 16 with dict, advanced one pass, 33639 -github.tar, level 16 with dict dms, advanced one pass, 33544 -github.tar, level 16 with dict dds, advanced one pass, 33544 -github.tar, level 16 with dict copy, advanced one pass, 33639 -github.tar, level 16 with dict load, advanced one pass, 39353 -github.tar, level 19, advanced one pass, 32837 -github.tar, level 19 with dict, advanced one pass, 32895 -github.tar, level 19 with dict dms, advanced one pass, 32672 -github.tar, level 19 with dict dds, advanced one pass, 32672 -github.tar, level 19 with dict copy, advanced one pass, 32895 -github.tar, level 19 with dict load, advanced one pass, 32676 +github.tar, level 12 row 2 with dict load, advanced one pass, 36459 +github.tar, level 13, advanced one pass, 35501 +github.tar, level 13 with dict, advanced one pass, 37130 +github.tar, level 13 with dict dms, advanced one pass, 37267 +github.tar, level 13 with dict dds, advanced one pass, 37267 +github.tar, level 13 with dict copy, advanced one pass, 37130 +github.tar, level 13 with dict load, advanced one pass, 36010 +github.tar, level 16, advanced one pass, 40471 +github.tar, level 16 with dict, advanced one pass, 33378 +github.tar, level 16 with dict dms, advanced one pass, 33213 +github.tar, level 16 with dict dds, advanced one pass, 33213 +github.tar, level 16 with dict copy, advanced one pass, 33378 +github.tar, level 16 with dict load, advanced one pass, 39081 +github.tar, level 19, advanced one pass, 32134 +github.tar, level 19 with dict, advanced one pass, 32709 +github.tar, level 19 with dict dms, advanced one pass, 32553 +github.tar, level 19 with dict dds, advanced one pass, 32553 +github.tar, level 19 with dict copy, advanced one pass, 32709 +github.tar, level 19 with dict load, advanced one pass, 32474 github.tar, no source size, advanced one pass, 38441 github.tar, no source size with dict, advanced one pass, 37995 github.tar, long distance mode, advanced one pass, 39757 @@ -541,84 +541,84 @@ github.tar, multithreaded long distance mode, advanced github.tar, small window log, advanced one pass, 198540 github.tar, small hash log, advanced one pass, 129870 github.tar, small chain log, advanced one pass, 41669 -github.tar, explicit params, advanced one pass, 41350 +github.tar, explicit params, advanced one pass, 41385 github.tar, uncompressed literals, advanced one pass, 41122 -github.tar, uncompressed literals optimal, advanced one pass, 35388 -github.tar, huffman literals, advanced one pass, 38777 +github.tar, uncompressed literals optimal, advanced one pass, 35397 +github.tar, huffman literals, advanced one pass, 38853 github.tar, multithreaded with advanced params, advanced one pass, 41122 -silesia, level -5, advanced one pass small out, 6737607 -silesia, level -3, advanced one pass small out, 6444677 -silesia, level -1, advanced one pass small out, 6178460 -silesia, level 0, advanced one pass small out, 4849551 -silesia, level 1, advanced one pass small out, 5313202 -silesia, level 3, advanced one pass small out, 4849551 -silesia, level 4, advanced one pass small out, 4786969 -silesia, level 5 row 1, advanced one pass small out, 4640753 -silesia, level 5 row 2, advanced one pass small out, 4639132 -silesia, level 5, advanced one pass small out, 4639132 -silesia, level 6, advanced one pass small out, 4605629 -silesia, level 7 row 1, advanced one pass small out, 4564870 -silesia, level 7 row 2, advanced one pass small out, 4567307 -silesia, level 7, advanced one pass small out, 4567307 -silesia, level 9, advanced one pass small out, 4543330 -silesia, level 11 row 1, advanced one pass small out, 4519288 -silesia, level 11 row 2, advanced one pass small out, 4521524 -silesia, level 12 row 1, advanced one pass small out, 4503117 -silesia, level 12 row 2, advanced one pass small out, 4505093 -silesia, level 13, advanced one pass small out, 4482131 -silesia, level 16, advanced one pass small out, 4360251 -silesia, level 19, advanced one pass small out, 4283236 -silesia, no source size, advanced one pass small out, 4849551 -silesia, long distance mode, advanced one pass small out, 4840738 -silesia, multithreaded, advanced one pass small out, 4849551 +silesia, level -5, advanced one pass small out, 7354675 +silesia, level -3, advanced one pass small out, 6902374 +silesia, level -1, advanced one pass small out, 6177565 +silesia, level 0, advanced one pass small out, 4849553 +silesia, level 1, advanced one pass small out, 5309098 +silesia, level 3, advanced one pass small out, 4849553 +silesia, level 4, advanced one pass small out, 4786968 +silesia, level 5 row 1, advanced one pass small out, 4638691 +silesia, level 5 row 2, advanced one pass small out, 4640752 +silesia, level 5, advanced one pass small out, 4638691 +silesia, level 6, advanced one pass small out, 4605296 +silesia, level 7 row 1, advanced one pass small out, 4566984 +silesia, level 7 row 2, advanced one pass small out, 4564868 +silesia, level 7, advanced one pass small out, 4566984 +silesia, level 9, advanced one pass small out, 4543018 +silesia, level 11 row 1, advanced one pass small out, 4521323 +silesia, level 11 row 2, advanced one pass small out, 4519288 +silesia, level 12 row 1, advanced one pass small out, 4505046 +silesia, level 12 row 2, advanced one pass small out, 4503116 +silesia, level 13, advanced one pass small out, 4493990 +silesia, level 16, advanced one pass small out, 4359864 +silesia, level 19, advanced one pass small out, 4296880 +silesia, no source size, advanced one pass small out, 4849553 +silesia, long distance mode, advanced one pass small out, 4840737 +silesia, multithreaded, advanced one pass small out, 4849553 silesia, multithreaded long distance mode, advanced one pass small out, 4840759 silesia, small window log, advanced one pass small out, 7095919 silesia, small hash log, advanced one pass small out, 6526141 -silesia, small chain log, advanced one pass small out, 4912199 -silesia, explicit params, advanced one pass small out, 4796282 +silesia, small chain log, advanced one pass small out, 4912197 +silesia, explicit params, advanced one pass small out, 4795432 silesia, uncompressed literals, advanced one pass small out, 5127982 -silesia, uncompressed literals optimal, advanced one pass small out, 4317896 -silesia, huffman literals, advanced one pass small out, 5326269 +silesia, uncompressed literals optimal, advanced one pass small out, 4319518 +silesia, huffman literals, advanced one pass small out, 5326346 silesia, multithreaded with advanced params, advanced one pass small out, 5127982 -silesia.tar, level -5, advanced one pass small out, 6738593 -silesia.tar, level -3, advanced one pass small out, 6446372 -silesia.tar, level -1, advanced one pass small out, 6186042 -silesia.tar, level 0, advanced one pass small out, 4861423 -silesia.tar, level 1, advanced one pass small out, 5334885 -silesia.tar, level 3, advanced one pass small out, 4861423 +silesia.tar, level -5, advanced one pass small out, 7359401 +silesia.tar, level -3, advanced one pass small out, 6901672 +silesia.tar, level -1, advanced one pass small out, 6182241 +silesia.tar, level 0, advanced one pass small out, 4861424 +silesia.tar, level 1, advanced one pass small out, 5331946 +silesia.tar, level 3, advanced one pass small out, 4861424 silesia.tar, level 4, advanced one pass small out, 4799632 -silesia.tar, level 5 row 1, advanced one pass small out, 4652862 -silesia.tar, level 5 row 2, advanced one pass small out, 4650387 -silesia.tar, level 5, advanced one pass small out, 4650387 -silesia.tar, level 6, advanced one pass small out, 4617089 -silesia.tar, level 7 row 1, advanced one pass small out, 4575392 -silesia.tar, level 7 row 2, advanced one pass small out, 4576951 -silesia.tar, level 7, advanced one pass small out, 4576951 -silesia.tar, level 9, advanced one pass small out, 4552638 -silesia.tar, level 11 row 1, advanced one pass small out, 4529458 -silesia.tar, level 11 row 2, advanced one pass small out, 4530416 -silesia.tar, level 12 row 1, advanced one pass small out, 4513603 -silesia.tar, level 12 row 2, advanced one pass small out, 4514499 -silesia.tar, level 13, advanced one pass small out, 4491768 -silesia.tar, level 16, advanced one pass small out, 4356834 -silesia.tar, level 19, advanced one pass small out, 4264388 -silesia.tar, no source size, advanced one pass small out, 4861423 -silesia.tar, long distance mode, advanced one pass small out, 4847753 -silesia.tar, multithreaded, advanced one pass small out, 4861507 +silesia.tar, level 5 row 1, advanced one pass small out, 4649987 +silesia.tar, level 5 row 2, advanced one pass small out, 4652862 +silesia.tar, level 5, advanced one pass small out, 4649987 +silesia.tar, level 6, advanced one pass small out, 4616797 +silesia.tar, level 7 row 1, advanced one pass small out, 4576661 +silesia.tar, level 7 row 2, advanced one pass small out, 4575393 +silesia.tar, level 7, advanced one pass small out, 4576661 +silesia.tar, level 9, advanced one pass small out, 4552381 +silesia.tar, level 11 row 1, advanced one pass small out, 4530241 +silesia.tar, level 11 row 2, advanced one pass small out, 4529461 +silesia.tar, level 12 row 1, advanced one pass small out, 4514432 +silesia.tar, level 12 row 2, advanced one pass small out, 4513604 +silesia.tar, level 13, advanced one pass small out, 4502956 +silesia.tar, level 16, advanced one pass small out, 4360527 +silesia.tar, level 19, advanced one pass small out, 4267266 +silesia.tar, no source size, advanced one pass small out, 4861424 +silesia.tar, long distance mode, advanced one pass small out, 4847752 +silesia.tar, multithreaded, advanced one pass small out, 4861508 silesia.tar, multithreaded long distance mode, advanced one pass small out, 4853221 silesia.tar, small window log, advanced one pass small out, 7101530 -silesia.tar, small hash log, advanced one pass small out, 6529228 -silesia.tar, small chain log, advanced one pass small out, 4917039 -silesia.tar, explicit params, advanced one pass small out, 4807675 +silesia.tar, small hash log, advanced one pass small out, 6529231 +silesia.tar, small chain log, advanced one pass small out, 4917041 +silesia.tar, explicit params, advanced one pass small out, 4806855 silesia.tar, uncompressed literals, advanced one pass small out, 5129458 -silesia.tar, uncompressed literals optimal, advanced one pass small out, 4307400 -silesia.tar, huffman literals, advanced one pass small out, 5347335 +silesia.tar, uncompressed literals optimal, advanced one pass small out, 4310141 +silesia.tar, huffman literals, advanced one pass small out, 5344545 silesia.tar, multithreaded with advanced params, advanced one pass small out, 5129555 -github, level -5, advanced one pass small out, 205285 +github, level -5, advanced one pass small out, 232315 github, level -5 with dict, advanced one pass small out, 46718 -github, level -3, advanced one pass small out, 190643 +github, level -3, advanced one pass small out, 220760 github, level -3 with dict, advanced one pass small out, 45395 -github, level -1, advanced one pass small out, 175568 +github, level -1, advanced one pass small out, 175468 github, level -1 with dict, advanced one pass small out, 43170 github, level 0, advanced one pass small out, 136335 github, level 0 with dict, advanced one pass small out, 41148 @@ -626,7 +626,7 @@ github, level 0 with dict dms, advanced github, level 0 with dict dds, advanced one pass small out, 41148 github, level 0 with dict copy, advanced one pass small out, 41124 github, level 0 with dict load, advanced one pass small out, 42252 -github, level 1, advanced one pass small out, 142465 +github, level 1, advanced one pass small out, 142365 github, level 1 with dict, advanced one pass small out, 41682 github, level 1 with dict dms, advanced one pass small out, 41682 github, level 1 with dict dds, advanced one pass small out, 41682 @@ -644,16 +644,16 @@ github, level 4 with dict dms, advanced github, level 4 with dict dds, advanced one pass small out, 41251 github, level 4 with dict copy, advanced one pass small out, 41216 github, level 4 with dict load, advanced one pass small out, 41159 -github, level 5 row 1, advanced one pass small out, 135121 -github, level 5 row 1 with dict dms, advanced one pass small out, 38938 -github, level 5 row 1 with dict dds, advanced one pass small out, 38732 -github, level 5 row 1 with dict copy, advanced one pass small out, 38934 -github, level 5 row 1 with dict load, advanced one pass small out, 40725 -github, level 5 row 2, advanced one pass small out, 134584 -github, level 5 row 2 with dict dms, advanced one pass small out, 38758 -github, level 5 row 2 with dict dds, advanced one pass small out, 38728 -github, level 5 row 2 with dict copy, advanced one pass small out, 38759 -github, level 5 row 2 with dict load, advanced one pass small out, 41518 +github, level 5 row 1, advanced one pass small out, 134584 +github, level 5 row 1 with dict dms, advanced one pass small out, 38758 +github, level 5 row 1 with dict dds, advanced one pass small out, 38728 +github, level 5 row 1 with dict copy, advanced one pass small out, 38759 +github, level 5 row 1 with dict load, advanced one pass small out, 41518 +github, level 5 row 2, advanced one pass small out, 135121 +github, level 5 row 2 with dict dms, advanced one pass small out, 38938 +github, level 5 row 2 with dict dds, advanced one pass small out, 38732 +github, level 5 row 2 with dict copy, advanced one pass small out, 38934 +github, level 5 row 2 with dict load, advanced one pass small out, 40725 github, level 5, advanced one pass small out, 135121 github, level 5 with dict, advanced one pass small out, 38758 github, level 5 with dict dms, advanced one pass small out, 38758 @@ -666,16 +666,16 @@ github, level 6 with dict dms, advanced github, level 6 with dict dds, advanced one pass small out, 38636 github, level 6 with dict copy, advanced one pass small out, 38669 github, level 6 with dict load, advanced one pass small out, 40695 -github, level 7 row 1, advanced one pass small out, 135122 -github, level 7 row 1 with dict dms, advanced one pass small out, 38860 -github, level 7 row 1 with dict dds, advanced one pass small out, 38766 -github, level 7 row 1 with dict copy, advanced one pass small out, 38834 -github, level 7 row 1 with dict load, advanced one pass small out, 40695 -github, level 7 row 2, advanced one pass small out, 134584 -github, level 7 row 2 with dict dms, advanced one pass small out, 38758 -github, level 7 row 2 with dict dds, advanced one pass small out, 38745 -github, level 7 row 2 with dict copy, advanced one pass small out, 38755 -github, level 7 row 2 with dict load, advanced one pass small out, 43154 +github, level 7 row 1, advanced one pass small out, 134584 +github, level 7 row 1 with dict dms, advanced one pass small out, 38758 +github, level 7 row 1 with dict dds, advanced one pass small out, 38745 +github, level 7 row 1 with dict copy, advanced one pass small out, 38755 +github, level 7 row 1 with dict load, advanced one pass small out, 43154 +github, level 7 row 2, advanced one pass small out, 135122 +github, level 7 row 2 with dict dms, advanced one pass small out, 38860 +github, level 7 row 2 with dict dds, advanced one pass small out, 38766 +github, level 7 row 2 with dict copy, advanced one pass small out, 38834 +github, level 7 row 2 with dict load, advanced one pass small out, 40695 github, level 7, advanced one pass small out, 135122 github, level 7 with dict, advanced one pass small out, 38758 github, level 7 with dict dms, advanced one pass small out, 38758 @@ -737,26 +737,26 @@ github, small chain log, advanced github, explicit params, advanced one pass small out, 137727 github, uncompressed literals, advanced one pass small out, 165915 github, uncompressed literals optimal, advanced one pass small out, 157227 -github, huffman literals, advanced one pass small out, 142465 +github, huffman literals, advanced one pass small out, 142365 github, multithreaded with advanced params, advanced one pass small out, 165915 -github.tar, level -5, advanced one pass small out, 46856 -github.tar, level -5 with dict, advanced one pass small out, 44571 -github.tar, level -3, advanced one pass small out, 43754 -github.tar, level -3 with dict, advanced one pass small out, 41447 -github.tar, level -1, advanced one pass small out, 42490 -github.tar, level -1 with dict, advanced one pass small out, 41131 +github.tar, level -5, advanced one pass small out, 66914 +github.tar, level -5 with dict, advanced one pass small out, 51525 +github.tar, level -3, advanced one pass small out, 52127 +github.tar, level -3 with dict, advanced one pass small out, 44242 +github.tar, level -1, advanced one pass small out, 42560 +github.tar, level -1 with dict, advanced one pass small out, 41136 github.tar, level 0, advanced one pass small out, 38441 github.tar, level 0 with dict, advanced one pass small out, 37995 github.tar, level 0 with dict dms, advanced one pass small out, 38003 github.tar, level 0 with dict dds, advanced one pass small out, 38003 github.tar, level 0 with dict copy, advanced one pass small out, 37995 github.tar, level 0 with dict load, advanced one pass small out, 37956 -github.tar, level 1, advanced one pass small out, 39265 -github.tar, level 1 with dict, advanced one pass small out, 38280 -github.tar, level 1 with dict dms, advanced one pass small out, 38290 -github.tar, level 1 with dict dds, advanced one pass small out, 38290 -github.tar, level 1 with dict copy, advanced one pass small out, 38280 -github.tar, level 1 with dict load, advanced one pass small out, 38729 +github.tar, level 1, advanced one pass small out, 39200 +github.tar, level 1 with dict, advanced one pass small out, 38284 +github.tar, level 1 with dict dms, advanced one pass small out, 38294 +github.tar, level 1 with dict dds, advanced one pass small out, 38294 +github.tar, level 1 with dict copy, advanced one pass small out, 38284 +github.tar, level 1 with dict load, advanced one pass small out, 38724 github.tar, level 3, advanced one pass small out, 38441 github.tar, level 3 with dict, advanced one pass small out, 37995 github.tar, level 3 with dict dms, advanced one pass small out, 38003 @@ -769,88 +769,88 @@ github.tar, level 4 with dict dms, advanced github.tar, level 4 with dict dds, advanced one pass small out, 37954 github.tar, level 4 with dict copy, advanced one pass small out, 37948 github.tar, level 4 with dict load, advanced one pass small out, 37927 -github.tar, level 5 row 1, advanced one pass small out, 38534 -github.tar, level 5 row 1 with dict dms, advanced one pass small out, 39365 -github.tar, level 5 row 1 with dict dds, advanced one pass small out, 39233 -github.tar, level 5 row 1 with dict copy, advanced one pass small out, 39715 -github.tar, level 5 row 1 with dict load, advanced one pass small out, 38019 -github.tar, level 5 row 2, advanced one pass small out, 38394 -github.tar, level 5 row 2 with dict dms, advanced one pass small out, 39048 -github.tar, level 5 row 2 with dict dds, advanced one pass small out, 39044 -github.tar, level 5 row 2 with dict copy, advanced one pass small out, 39074 -github.tar, level 5 row 2 with dict load, advanced one pass small out, 37665 -github.tar, level 5, advanced one pass small out, 38394 -github.tar, level 5 with dict, advanced one pass small out, 39074 -github.tar, level 5 with dict dms, advanced one pass small out, 39048 -github.tar, level 5 with dict dds, advanced one pass small out, 39044 -github.tar, level 5 with dict copy, advanced one pass small out, 39074 -github.tar, level 5 with dict load, advanced one pass small out, 37665 -github.tar, level 6, advanced one pass small out, 38669 -github.tar, level 6 with dict, advanced one pass small out, 38660 -github.tar, level 6 with dict dms, advanced one pass small out, 38654 -github.tar, level 6 with dict dds, advanced one pass small out, 38656 -github.tar, level 6 with dict copy, advanced one pass small out, 38660 -github.tar, level 6 with dict load, advanced one pass small out, 37889 -github.tar, level 7 row 1, advanced one pass small out, 38077 -github.tar, level 7 row 1 with dict dms, advanced one pass small out, 38012 -github.tar, level 7 row 1 with dict dds, advanced one pass small out, 38014 -github.tar, level 7 row 1 with dict copy, advanced one pass small out, 38101 -github.tar, level 7 row 1 with dict load, advanced one pass small out, 37402 -github.tar, level 7 row 2, advanced one pass small out, 38153 -github.tar, level 7 row 2 with dict dms, advanced one pass small out, 37888 -github.tar, level 7 row 2 with dict dds, advanced one pass small out, 37910 -github.tar, level 7 row 2 with dict copy, advanced one pass small out, 37892 -github.tar, level 7 row 2 with dict load, advanced one pass small out, 37457 -github.tar, level 7, advanced one pass small out, 38153 -github.tar, level 7 with dict, advanced one pass small out, 37892 -github.tar, level 7 with dict dms, advanced one pass small out, 37888 -github.tar, level 7 with dict dds, advanced one pass small out, 37910 -github.tar, level 7 with dict copy, advanced one pass small out, 37892 -github.tar, level 7 with dict load, advanced one pass small out, 37457 -github.tar, level 9, advanced one pass small out, 36768 -github.tar, level 9 with dict, advanced one pass small out, 36510 -github.tar, level 9 with dict dms, advanced one pass small out, 36584 -github.tar, level 9 with dict dds, advanced one pass small out, 36646 -github.tar, level 9 with dict copy, advanced one pass small out, 36510 -github.tar, level 9 with dict load, advanced one pass small out, 36383 -github.tar, level 11 row 1, advanced one pass small out, 36435 +github.tar, level 5 row 1, advanced one pass small out, 38366 +github.tar, level 5 row 1 with dict dms, advanced one pass small out, 39059 +github.tar, level 5 row 1 with dict dds, advanced one pass small out, 39067 +github.tar, level 5 row 1 with dict copy, advanced one pass small out, 39082 +github.tar, level 5 row 1 with dict load, advanced one pass small out, 37656 +github.tar, level 5 row 2, advanced one pass small out, 38534 +github.tar, level 5 row 2 with dict dms, advanced one pass small out, 39365 +github.tar, level 5 row 2 with dict dds, advanced one pass small out, 39233 +github.tar, level 5 row 2 with dict copy, advanced one pass small out, 39715 +github.tar, level 5 row 2 with dict load, advanced one pass small out, 38019 +github.tar, level 5, advanced one pass small out, 38366 +github.tar, level 5 with dict, advanced one pass small out, 39082 +github.tar, level 5 with dict dms, advanced one pass small out, 39059 +github.tar, level 5 with dict dds, advanced one pass small out, 39067 +github.tar, level 5 with dict copy, advanced one pass small out, 39082 +github.tar, level 5 with dict load, advanced one pass small out, 37656 +github.tar, level 6, advanced one pass small out, 38648 +github.tar, level 6 with dict, advanced one pass small out, 38656 +github.tar, level 6 with dict dms, advanced one pass small out, 38636 +github.tar, level 6 with dict dds, advanced one pass small out, 38634 +github.tar, level 6 with dict copy, advanced one pass small out, 38656 +github.tar, level 6 with dict load, advanced one pass small out, 37865 +github.tar, level 7 row 1, advanced one pass small out, 38110 +github.tar, level 7 row 1 with dict dms, advanced one pass small out, 37858 +github.tar, level 7 row 1 with dict dds, advanced one pass small out, 37882 +github.tar, level 7 row 1 with dict copy, advanced one pass small out, 37865 +github.tar, level 7 row 1 with dict load, advanced one pass small out, 37436 +github.tar, level 7 row 2, advanced one pass small out, 38077 +github.tar, level 7 row 2 with dict dms, advanced one pass small out, 38012 +github.tar, level 7 row 2 with dict dds, advanced one pass small out, 38014 +github.tar, level 7 row 2 with dict copy, advanced one pass small out, 38101 +github.tar, level 7 row 2 with dict load, advanced one pass small out, 37402 +github.tar, level 7, advanced one pass small out, 38110 +github.tar, level 7 with dict, advanced one pass small out, 37865 +github.tar, level 7 with dict dms, advanced one pass small out, 37858 +github.tar, level 7 with dict dds, advanced one pass small out, 37882 +github.tar, level 7 with dict copy, advanced one pass small out, 37865 +github.tar, level 7 with dict load, advanced one pass small out, 37436 +github.tar, level 9, advanced one pass small out, 36760 +github.tar, level 9 with dict, advanced one pass small out, 36484 +github.tar, level 9 with dict dms, advanced one pass small out, 36567 +github.tar, level 9 with dict dds, advanced one pass small out, 36628 +github.tar, level 9 with dict copy, advanced one pass small out, 36484 +github.tar, level 9 with dict load, advanced one pass small out, 36401 +github.tar, level 11 row 1, advanced one pass small out, 36452 github.tar, level 11 row 1 with dict dms, advanced one pass small out, 36963 github.tar, level 11 row 1 with dict dds, advanced one pass small out, 36963 github.tar, level 11 row 1 with dict copy, advanced one pass small out, 36557 -github.tar, level 11 row 1 with dict load, advanced one pass small out, 36419 -github.tar, level 11 row 2, advanced one pass small out, 36412 +github.tar, level 11 row 1 with dict load, advanced one pass small out, 36455 +github.tar, level 11 row 2, advanced one pass small out, 36435 github.tar, level 11 row 2 with dict dms, advanced one pass small out, 36963 github.tar, level 11 row 2 with dict dds, advanced one pass small out, 36963 github.tar, level 11 row 2 with dict copy, advanced one pass small out, 36557 -github.tar, level 11 row 2 with dict load, advanced one pass small out, 36439 -github.tar, level 12 row 1, advanced one pass small out, 36110 +github.tar, level 11 row 2 with dict load, advanced one pass small out, 36419 +github.tar, level 12 row 1, advanced one pass small out, 36081 github.tar, level 12 row 1 with dict dms, advanced one pass small out, 36986 github.tar, level 12 row 1 with dict dds, advanced one pass small out, 36986 github.tar, level 12 row 1 with dict copy, advanced one pass small out, 36609 -github.tar, level 12 row 1 with dict load, advanced one pass small out, 36459 -github.tar, level 12 row 2, advanced one pass small out, 36062 +github.tar, level 12 row 1 with dict load, advanced one pass small out, 36434 +github.tar, level 12 row 2, advanced one pass small out, 36110 github.tar, level 12 row 2 with dict dms, advanced one pass small out, 36986 github.tar, level 12 row 2 with dict dds, advanced one pass small out, 36986 github.tar, level 12 row 2 with dict copy, advanced one pass small out, 36609 -github.tar, level 12 row 2 with dict load, advanced one pass small out, 36392 -github.tar, level 13, advanced one pass small out, 35621 -github.tar, level 13 with dict, advanced one pass small out, 38726 -github.tar, level 13 with dict dms, advanced one pass small out, 38903 -github.tar, level 13 with dict dds, advanced one pass small out, 38903 -github.tar, level 13 with dict copy, advanced one pass small out, 38726 -github.tar, level 13 with dict load, advanced one pass small out, 36372 -github.tar, level 16, advanced one pass small out, 40255 -github.tar, level 16 with dict, advanced one pass small out, 33639 -github.tar, level 16 with dict dms, advanced one pass small out, 33544 -github.tar, level 16 with dict dds, advanced one pass small out, 33544 -github.tar, level 16 with dict copy, advanced one pass small out, 33639 -github.tar, level 16 with dict load, advanced one pass small out, 39353 -github.tar, level 19, advanced one pass small out, 32837 -github.tar, level 19 with dict, advanced one pass small out, 32895 -github.tar, level 19 with dict dms, advanced one pass small out, 32672 -github.tar, level 19 with dict dds, advanced one pass small out, 32672 -github.tar, level 19 with dict copy, advanced one pass small out, 32895 -github.tar, level 19 with dict load, advanced one pass small out, 32676 +github.tar, level 12 row 2 with dict load, advanced one pass small out, 36459 +github.tar, level 13, advanced one pass small out, 35501 +github.tar, level 13 with dict, advanced one pass small out, 37130 +github.tar, level 13 with dict dms, advanced one pass small out, 37267 +github.tar, level 13 with dict dds, advanced one pass small out, 37267 +github.tar, level 13 with dict copy, advanced one pass small out, 37130 +github.tar, level 13 with dict load, advanced one pass small out, 36010 +github.tar, level 16, advanced one pass small out, 40471 +github.tar, level 16 with dict, advanced one pass small out, 33378 +github.tar, level 16 with dict dms, advanced one pass small out, 33213 +github.tar, level 16 with dict dds, advanced one pass small out, 33213 +github.tar, level 16 with dict copy, advanced one pass small out, 33378 +github.tar, level 16 with dict load, advanced one pass small out, 39081 +github.tar, level 19, advanced one pass small out, 32134 +github.tar, level 19 with dict, advanced one pass small out, 32709 +github.tar, level 19 with dict dms, advanced one pass small out, 32553 +github.tar, level 19 with dict dds, advanced one pass small out, 32553 +github.tar, level 19 with dict copy, advanced one pass small out, 32709 +github.tar, level 19 with dict load, advanced one pass small out, 32474 github.tar, no source size, advanced one pass small out, 38441 github.tar, no source size with dict, advanced one pass small out, 37995 github.tar, long distance mode, advanced one pass small out, 39757 @@ -859,84 +859,84 @@ github.tar, multithreaded long distance mode, advanced github.tar, small window log, advanced one pass small out, 198540 github.tar, small hash log, advanced one pass small out, 129870 github.tar, small chain log, advanced one pass small out, 41669 -github.tar, explicit params, advanced one pass small out, 41350 +github.tar, explicit params, advanced one pass small out, 41385 github.tar, uncompressed literals, advanced one pass small out, 41122 -github.tar, uncompressed literals optimal, advanced one pass small out, 35388 -github.tar, huffman literals, advanced one pass small out, 38777 +github.tar, uncompressed literals optimal, advanced one pass small out, 35397 +github.tar, huffman literals, advanced one pass small out, 38853 github.tar, multithreaded with advanced params, advanced one pass small out, 41122 -silesia, level -5, advanced streaming, 6882505 -silesia, level -3, advanced streaming, 6568376 -silesia, level -1, advanced streaming, 6183403 -silesia, level 0, advanced streaming, 4849551 -silesia, level 1, advanced streaming, 5314161 -silesia, level 3, advanced streaming, 4849551 -silesia, level 4, advanced streaming, 4786969 -silesia, level 5 row 1, advanced streaming, 4640753 -silesia, level 5 row 2, advanced streaming, 4639132 -silesia, level 5, advanced streaming, 4639132 -silesia, level 6, advanced streaming, 4605629 -silesia, level 7 row 1, advanced streaming, 4564870 -silesia, level 7 row 2, advanced streaming, 4567307 -silesia, level 7, advanced streaming, 4567307 -silesia, level 9, advanced streaming, 4543330 -silesia, level 11 row 1, advanced streaming, 4519288 -silesia, level 11 row 2, advanced streaming, 4521524 -silesia, level 12 row 1, advanced streaming, 4503117 -silesia, level 12 row 2, advanced streaming, 4505093 -silesia, level 13, advanced streaming, 4482131 -silesia, level 16, advanced streaming, 4360251 -silesia, level 19, advanced streaming, 4283236 -silesia, no source size, advanced streaming, 4849515 -silesia, long distance mode, advanced streaming, 4840738 -silesia, multithreaded, advanced streaming, 4849551 +silesia, level -5, advanced streaming, 7292053 +silesia, level -3, advanced streaming, 6867875 +silesia, level -1, advanced streaming, 6183923 +silesia, level 0, advanced streaming, 4849553 +silesia, level 1, advanced streaming, 5312694 +silesia, level 3, advanced streaming, 4849553 +silesia, level 4, advanced streaming, 4786968 +silesia, level 5 row 1, advanced streaming, 4638691 +silesia, level 5 row 2, advanced streaming, 4640752 +silesia, level 5, advanced streaming, 4638691 +silesia, level 6, advanced streaming, 4605296 +silesia, level 7 row 1, advanced streaming, 4566984 +silesia, level 7 row 2, advanced streaming, 4564868 +silesia, level 7, advanced streaming, 4566984 +silesia, level 9, advanced streaming, 4543018 +silesia, level 11 row 1, advanced streaming, 4521323 +silesia, level 11 row 2, advanced streaming, 4519288 +silesia, level 12 row 1, advanced streaming, 4505046 +silesia, level 12 row 2, advanced streaming, 4503116 +silesia, level 13, advanced streaming, 4493990 +silesia, level 16, advanced streaming, 4359864 +silesia, level 19, advanced streaming, 4296880 +silesia, no source size, advanced streaming, 4849517 +silesia, long distance mode, advanced streaming, 4840737 +silesia, multithreaded, advanced streaming, 4849553 silesia, multithreaded long distance mode, advanced streaming, 4840759 silesia, small window log, advanced streaming, 7112062 silesia, small hash log, advanced streaming, 6526141 -silesia, small chain log, advanced streaming, 4912199 -silesia, explicit params, advanced streaming, 4796309 +silesia, small chain log, advanced streaming, 4912197 +silesia, explicit params, advanced streaming, 4795452 silesia, uncompressed literals, advanced streaming, 5127982 -silesia, uncompressed literals optimal, advanced streaming, 4317896 -silesia, huffman literals, advanced streaming, 5331171 +silesia, uncompressed literals optimal, advanced streaming, 4319518 +silesia, huffman literals, advanced streaming, 5332234 silesia, multithreaded with advanced params, advanced streaming, 5127982 -silesia.tar, level -5, advanced streaming, 6982759 -silesia.tar, level -3, advanced streaming, 6641283 -silesia.tar, level -1, advanced streaming, 6190795 -silesia.tar, level 0, advanced streaming, 4861425 -silesia.tar, level 1, advanced streaming, 5336941 -silesia.tar, level 3, advanced streaming, 4861425 +silesia.tar, level -5, advanced streaming, 7260007 +silesia.tar, level -3, advanced streaming, 6845151 +silesia.tar, level -1, advanced streaming, 6187938 +silesia.tar, level 0, advanced streaming, 4861426 +silesia.tar, level 1, advanced streaming, 5334890 +silesia.tar, level 3, advanced streaming, 4861426 silesia.tar, level 4, advanced streaming, 4799632 -silesia.tar, level 5 row 1, advanced streaming, 4652866 -silesia.tar, level 5 row 2, advanced streaming, 4650392 -silesia.tar, level 5, advanced streaming, 4650392 -silesia.tar, level 6, advanced streaming, 4617097 -silesia.tar, level 7 row 1, advanced streaming, 4575393 -silesia.tar, level 7 row 2, advanced streaming, 4576953 -silesia.tar, level 7, advanced streaming, 4576953 -silesia.tar, level 9, advanced streaming, 4552646 -silesia.tar, level 11 row 1, advanced streaming, 4529458 -silesia.tar, level 11 row 2, advanced streaming, 4530417 -silesia.tar, level 12 row 1, advanced streaming, 4513603 -silesia.tar, level 12 row 2, advanced streaming, 4514500 -silesia.tar, level 13, advanced streaming, 4491769 -silesia.tar, level 16, advanced streaming, 4356834 -silesia.tar, level 19, advanced streaming, 4264388 -silesia.tar, no source size, advanced streaming, 4861421 -silesia.tar, long distance mode, advanced streaming, 4847753 -silesia.tar, multithreaded, advanced streaming, 4861507 +silesia.tar, level 5 row 1, advanced streaming, 4649992 +silesia.tar, level 5 row 2, advanced streaming, 4652866 +silesia.tar, level 5, advanced streaming, 4649992 +silesia.tar, level 6, advanced streaming, 4616803 +silesia.tar, level 7 row 1, advanced streaming, 4576664 +silesia.tar, level 7 row 2, advanced streaming, 4575394 +silesia.tar, level 7, advanced streaming, 4576664 +silesia.tar, level 9, advanced streaming, 4552386 +silesia.tar, level 11 row 1, advanced streaming, 4530243 +silesia.tar, level 11 row 2, advanced streaming, 4529461 +silesia.tar, level 12 row 1, advanced streaming, 4514433 +silesia.tar, level 12 row 2, advanced streaming, 4513604 +silesia.tar, level 13, advanced streaming, 4502956 +silesia.tar, level 16, advanced streaming, 4360527 +silesia.tar, level 19, advanced streaming, 4267266 +silesia.tar, no source size, advanced streaming, 4861422 +silesia.tar, long distance mode, advanced streaming, 4847752 +silesia.tar, multithreaded, advanced streaming, 4861508 silesia.tar, multithreaded long distance mode, advanced streaming, 4853221 silesia.tar, small window log, advanced streaming, 7118769 -silesia.tar, small hash log, advanced streaming, 6529231 -silesia.tar, small chain log, advanced streaming, 4917019 -silesia.tar, explicit params, advanced streaming, 4807688 +silesia.tar, small hash log, advanced streaming, 6529234 +silesia.tar, small chain log, advanced streaming, 4917021 +silesia.tar, explicit params, advanced streaming, 4806873 silesia.tar, uncompressed literals, advanced streaming, 5129461 -silesia.tar, uncompressed literals optimal, advanced streaming, 4307400 -silesia.tar, huffman literals, advanced streaming, 5352360 +silesia.tar, uncompressed literals optimal, advanced streaming, 4310141 +silesia.tar, huffman literals, advanced streaming, 5350519 silesia.tar, multithreaded with advanced params, advanced streaming, 5129555 -github, level -5, advanced streaming, 205285 +github, level -5, advanced streaming, 232315 github, level -5 with dict, advanced streaming, 46718 -github, level -3, advanced streaming, 190643 +github, level -3, advanced streaming, 220760 github, level -3 with dict, advanced streaming, 45395 -github, level -1, advanced streaming, 175568 +github, level -1, advanced streaming, 175468 github, level -1 with dict, advanced streaming, 43170 github, level 0, advanced streaming, 136335 github, level 0 with dict, advanced streaming, 41148 @@ -944,7 +944,7 @@ github, level 0 with dict dms, advanced github, level 0 with dict dds, advanced streaming, 41148 github, level 0 with dict copy, advanced streaming, 41124 github, level 0 with dict load, advanced streaming, 42252 -github, level 1, advanced streaming, 142465 +github, level 1, advanced streaming, 142365 github, level 1 with dict, advanced streaming, 41682 github, level 1 with dict dms, advanced streaming, 41682 github, level 1 with dict dds, advanced streaming, 41682 @@ -962,16 +962,16 @@ github, level 4 with dict dms, advanced github, level 4 with dict dds, advanced streaming, 41251 github, level 4 with dict copy, advanced streaming, 41216 github, level 4 with dict load, advanced streaming, 41159 -github, level 5 row 1, advanced streaming, 135121 -github, level 5 row 1 with dict dms, advanced streaming, 38938 -github, level 5 row 1 with dict dds, advanced streaming, 38732 -github, level 5 row 1 with dict copy, advanced streaming, 38934 -github, level 5 row 1 with dict load, advanced streaming, 40725 -github, level 5 row 2, advanced streaming, 134584 -github, level 5 row 2 with dict dms, advanced streaming, 38758 -github, level 5 row 2 with dict dds, advanced streaming, 38728 -github, level 5 row 2 with dict copy, advanced streaming, 38759 -github, level 5 row 2 with dict load, advanced streaming, 41518 +github, level 5 row 1, advanced streaming, 134584 +github, level 5 row 1 with dict dms, advanced streaming, 38758 +github, level 5 row 1 with dict dds, advanced streaming, 38728 +github, level 5 row 1 with dict copy, advanced streaming, 38759 +github, level 5 row 1 with dict load, advanced streaming, 41518 +github, level 5 row 2, advanced streaming, 135121 +github, level 5 row 2 with dict dms, advanced streaming, 38938 +github, level 5 row 2 with dict dds, advanced streaming, 38732 +github, level 5 row 2 with dict copy, advanced streaming, 38934 +github, level 5 row 2 with dict load, advanced streaming, 40725 github, level 5, advanced streaming, 135121 github, level 5 with dict, advanced streaming, 38758 github, level 5 with dict dms, advanced streaming, 38758 @@ -984,16 +984,16 @@ github, level 6 with dict dms, advanced github, level 6 with dict dds, advanced streaming, 38636 github, level 6 with dict copy, advanced streaming, 38669 github, level 6 with dict load, advanced streaming, 40695 -github, level 7 row 1, advanced streaming, 135122 -github, level 7 row 1 with dict dms, advanced streaming, 38860 -github, level 7 row 1 with dict dds, advanced streaming, 38766 -github, level 7 row 1 with dict copy, advanced streaming, 38834 -github, level 7 row 1 with dict load, advanced streaming, 40695 -github, level 7 row 2, advanced streaming, 134584 -github, level 7 row 2 with dict dms, advanced streaming, 38758 -github, level 7 row 2 with dict dds, advanced streaming, 38745 -github, level 7 row 2 with dict copy, advanced streaming, 38755 -github, level 7 row 2 with dict load, advanced streaming, 43154 +github, level 7 row 1, advanced streaming, 134584 +github, level 7 row 1 with dict dms, advanced streaming, 38758 +github, level 7 row 1 with dict dds, advanced streaming, 38745 +github, level 7 row 1 with dict copy, advanced streaming, 38755 +github, level 7 row 1 with dict load, advanced streaming, 43154 +github, level 7 row 2, advanced streaming, 135122 +github, level 7 row 2 with dict dms, advanced streaming, 38860 +github, level 7 row 2 with dict dds, advanced streaming, 38766 +github, level 7 row 2 with dict copy, advanced streaming, 38834 +github, level 7 row 2 with dict load, advanced streaming, 40695 github, level 7, advanced streaming, 135122 github, level 7 with dict, advanced streaming, 38758 github, level 7 with dict dms, advanced streaming, 38758 @@ -1055,26 +1055,26 @@ github, small chain log, advanced github, explicit params, advanced streaming, 137727 github, uncompressed literals, advanced streaming, 165915 github, uncompressed literals optimal, advanced streaming, 157227 -github, huffman literals, advanced streaming, 142465 +github, huffman literals, advanced streaming, 142365 github, multithreaded with advanced params, advanced streaming, 165915 -github.tar, level -5, advanced streaming, 46747 -github.tar, level -5 with dict, advanced streaming, 44440 -github.tar, level -3, advanced streaming, 43537 -github.tar, level -3 with dict, advanced streaming, 41112 -github.tar, level -1, advanced streaming, 42465 -github.tar, level -1 with dict, advanced streaming, 41196 +github.tar, level -5, advanced streaming, 64132 +github.tar, level -5 with dict, advanced streaming, 48642 +github.tar, level -3, advanced streaming, 50964 +github.tar, level -3 with dict, advanced streaming, 42750 +github.tar, level -1, advanced streaming, 42536 +github.tar, level -1 with dict, advanced streaming, 41198 github.tar, level 0, advanced streaming, 38441 github.tar, level 0 with dict, advanced streaming, 37995 github.tar, level 0 with dict dms, advanced streaming, 38003 github.tar, level 0 with dict dds, advanced streaming, 38003 github.tar, level 0 with dict copy, advanced streaming, 37995 github.tar, level 0 with dict load, advanced streaming, 37956 -github.tar, level 1, advanced streaming, 39342 -github.tar, level 1 with dict, advanced streaming, 38293 -github.tar, level 1 with dict dms, advanced streaming, 38303 -github.tar, level 1 with dict dds, advanced streaming, 38303 -github.tar, level 1 with dict copy, advanced streaming, 38293 -github.tar, level 1 with dict load, advanced streaming, 38766 +github.tar, level 1, advanced streaming, 39270 +github.tar, level 1 with dict, advanced streaming, 38316 +github.tar, level 1 with dict dms, advanced streaming, 38326 +github.tar, level 1 with dict dds, advanced streaming, 38326 +github.tar, level 1 with dict copy, advanced streaming, 38316 +github.tar, level 1 with dict load, advanced streaming, 38761 github.tar, level 3, advanced streaming, 38441 github.tar, level 3 with dict, advanced streaming, 37995 github.tar, level 3 with dict dms, advanced streaming, 38003 @@ -1087,88 +1087,88 @@ github.tar, level 4 with dict dms, advanced github.tar, level 4 with dict dds, advanced streaming, 37954 github.tar, level 4 with dict copy, advanced streaming, 37948 github.tar, level 4 with dict load, advanced streaming, 37927 -github.tar, level 5 row 1, advanced streaming, 38534 -github.tar, level 5 row 1 with dict dms, advanced streaming, 39365 -github.tar, level 5 row 1 with dict dds, advanced streaming, 39233 -github.tar, level 5 row 1 with dict copy, advanced streaming, 39715 -github.tar, level 5 row 1 with dict load, advanced streaming, 38019 -github.tar, level 5 row 2, advanced streaming, 38394 -github.tar, level 5 row 2 with dict dms, advanced streaming, 39048 -github.tar, level 5 row 2 with dict dds, advanced streaming, 39044 -github.tar, level 5 row 2 with dict copy, advanced streaming, 39074 -github.tar, level 5 row 2 with dict load, advanced streaming, 37665 -github.tar, level 5, advanced streaming, 38394 -github.tar, level 5 with dict, advanced streaming, 39074 -github.tar, level 5 with dict dms, advanced streaming, 39048 -github.tar, level 5 with dict dds, advanced streaming, 39044 -github.tar, level 5 with dict copy, advanced streaming, 39074 -github.tar, level 5 with dict load, advanced streaming, 37665 -github.tar, level 6, advanced streaming, 38669 -github.tar, level 6 with dict, advanced streaming, 38660 -github.tar, level 6 with dict dms, advanced streaming, 38654 -github.tar, level 6 with dict dds, advanced streaming, 38656 -github.tar, level 6 with dict copy, advanced streaming, 38660 -github.tar, level 6 with dict load, advanced streaming, 37889 -github.tar, level 7 row 1, advanced streaming, 38077 -github.tar, level 7 row 1 with dict dms, advanced streaming, 38012 -github.tar, level 7 row 1 with dict dds, advanced streaming, 38014 -github.tar, level 7 row 1 with dict copy, advanced streaming, 38101 -github.tar, level 7 row 1 with dict load, advanced streaming, 37402 -github.tar, level 7 row 2, advanced streaming, 38153 -github.tar, level 7 row 2 with dict dms, advanced streaming, 37888 -github.tar, level 7 row 2 with dict dds, advanced streaming, 37910 -github.tar, level 7 row 2 with dict copy, advanced streaming, 37892 -github.tar, level 7 row 2 with dict load, advanced streaming, 37457 -github.tar, level 7, advanced streaming, 38153 -github.tar, level 7 with dict, advanced streaming, 37892 -github.tar, level 7 with dict dms, advanced streaming, 37888 -github.tar, level 7 with dict dds, advanced streaming, 37910 -github.tar, level 7 with dict copy, advanced streaming, 37892 -github.tar, level 7 with dict load, advanced streaming, 37457 -github.tar, level 9, advanced streaming, 36768 -github.tar, level 9 with dict, advanced streaming, 36510 -github.tar, level 9 with dict dms, advanced streaming, 36584 -github.tar, level 9 with dict dds, advanced streaming, 36646 -github.tar, level 9 with dict copy, advanced streaming, 36510 -github.tar, level 9 with dict load, advanced streaming, 36383 -github.tar, level 11 row 1, advanced streaming, 36435 +github.tar, level 5 row 1, advanced streaming, 38366 +github.tar, level 5 row 1 with dict dms, advanced streaming, 39059 +github.tar, level 5 row 1 with dict dds, advanced streaming, 39067 +github.tar, level 5 row 1 with dict copy, advanced streaming, 39082 +github.tar, level 5 row 1 with dict load, advanced streaming, 37656 +github.tar, level 5 row 2, advanced streaming, 38534 +github.tar, level 5 row 2 with dict dms, advanced streaming, 39365 +github.tar, level 5 row 2 with dict dds, advanced streaming, 39233 +github.tar, level 5 row 2 with dict copy, advanced streaming, 39715 +github.tar, level 5 row 2 with dict load, advanced streaming, 38019 +github.tar, level 5, advanced streaming, 38366 +github.tar, level 5 with dict, advanced streaming, 39082 +github.tar, level 5 with dict dms, advanced streaming, 39059 +github.tar, level 5 with dict dds, advanced streaming, 39067 +github.tar, level 5 with dict copy, advanced streaming, 39082 +github.tar, level 5 with dict load, advanced streaming, 37656 +github.tar, level 6, advanced streaming, 38648 +github.tar, level 6 with dict, advanced streaming, 38656 +github.tar, level 6 with dict dms, advanced streaming, 38636 +github.tar, level 6 with dict dds, advanced streaming, 38634 +github.tar, level 6 with dict copy, advanced streaming, 38656 +github.tar, level 6 with dict load, advanced streaming, 37865 +github.tar, level 7 row 1, advanced streaming, 38110 +github.tar, level 7 row 1 with dict dms, advanced streaming, 37858 +github.tar, level 7 row 1 with dict dds, advanced streaming, 37882 +github.tar, level 7 row 1 with dict copy, advanced streaming, 37865 +github.tar, level 7 row 1 with dict load, advanced streaming, 37436 +github.tar, level 7 row 2, advanced streaming, 38077 +github.tar, level 7 row 2 with dict dms, advanced streaming, 38012 +github.tar, level 7 row 2 with dict dds, advanced streaming, 38014 +github.tar, level 7 row 2 with dict copy, advanced streaming, 38101 +github.tar, level 7 row 2 with dict load, advanced streaming, 37402 +github.tar, level 7, advanced streaming, 38110 +github.tar, level 7 with dict, advanced streaming, 37865 +github.tar, level 7 with dict dms, advanced streaming, 37858 +github.tar, level 7 with dict dds, advanced streaming, 37882 +github.tar, level 7 with dict copy, advanced streaming, 37865 +github.tar, level 7 with dict load, advanced streaming, 37436 +github.tar, level 9, advanced streaming, 36760 +github.tar, level 9 with dict, advanced streaming, 36484 +github.tar, level 9 with dict dms, advanced streaming, 36567 +github.tar, level 9 with dict dds, advanced streaming, 36628 +github.tar, level 9 with dict copy, advanced streaming, 36484 +github.tar, level 9 with dict load, advanced streaming, 36401 +github.tar, level 11 row 1, advanced streaming, 36452 github.tar, level 11 row 1 with dict dms, advanced streaming, 36963 github.tar, level 11 row 1 with dict dds, advanced streaming, 36963 github.tar, level 11 row 1 with dict copy, advanced streaming, 36557 -github.tar, level 11 row 1 with dict load, advanced streaming, 36419 -github.tar, level 11 row 2, advanced streaming, 36412 +github.tar, level 11 row 1 with dict load, advanced streaming, 36455 +github.tar, level 11 row 2, advanced streaming, 36435 github.tar, level 11 row 2 with dict dms, advanced streaming, 36963 github.tar, level 11 row 2 with dict dds, advanced streaming, 36963 github.tar, level 11 row 2 with dict copy, advanced streaming, 36557 -github.tar, level 11 row 2 with dict load, advanced streaming, 36439 -github.tar, level 12 row 1, advanced streaming, 36110 +github.tar, level 11 row 2 with dict load, advanced streaming, 36419 +github.tar, level 12 row 1, advanced streaming, 36081 github.tar, level 12 row 1 with dict dms, advanced streaming, 36986 github.tar, level 12 row 1 with dict dds, advanced streaming, 36986 github.tar, level 12 row 1 with dict copy, advanced streaming, 36609 -github.tar, level 12 row 1 with dict load, advanced streaming, 36459 -github.tar, level 12 row 2, advanced streaming, 36062 +github.tar, level 12 row 1 with dict load, advanced streaming, 36434 +github.tar, level 12 row 2, advanced streaming, 36110 github.tar, level 12 row 2 with dict dms, advanced streaming, 36986 github.tar, level 12 row 2 with dict dds, advanced streaming, 36986 github.tar, level 12 row 2 with dict copy, advanced streaming, 36609 -github.tar, level 12 row 2 with dict load, advanced streaming, 36392 -github.tar, level 13, advanced streaming, 35621 -github.tar, level 13 with dict, advanced streaming, 38726 -github.tar, level 13 with dict dms, advanced streaming, 38903 -github.tar, level 13 with dict dds, advanced streaming, 38903 -github.tar, level 13 with dict copy, advanced streaming, 38726 -github.tar, level 13 with dict load, advanced streaming, 36372 -github.tar, level 16, advanced streaming, 40255 -github.tar, level 16 with dict, advanced streaming, 33639 -github.tar, level 16 with dict dms, advanced streaming, 33544 -github.tar, level 16 with dict dds, advanced streaming, 33544 -github.tar, level 16 with dict copy, advanced streaming, 33639 -github.tar, level 16 with dict load, advanced streaming, 39353 -github.tar, level 19, advanced streaming, 32837 -github.tar, level 19 with dict, advanced streaming, 32895 -github.tar, level 19 with dict dms, advanced streaming, 32672 -github.tar, level 19 with dict dds, advanced streaming, 32672 -github.tar, level 19 with dict copy, advanced streaming, 32895 -github.tar, level 19 with dict load, advanced streaming, 32676 +github.tar, level 12 row 2 with dict load, advanced streaming, 36459 +github.tar, level 13, advanced streaming, 35501 +github.tar, level 13 with dict, advanced streaming, 37130 +github.tar, level 13 with dict dms, advanced streaming, 37267 +github.tar, level 13 with dict dds, advanced streaming, 37267 +github.tar, level 13 with dict copy, advanced streaming, 37130 +github.tar, level 13 with dict load, advanced streaming, 36010 +github.tar, level 16, advanced streaming, 40471 +github.tar, level 16 with dict, advanced streaming, 33378 +github.tar, level 16 with dict dms, advanced streaming, 33213 +github.tar, level 16 with dict dds, advanced streaming, 33213 +github.tar, level 16 with dict copy, advanced streaming, 33378 +github.tar, level 16 with dict load, advanced streaming, 39081 +github.tar, level 19, advanced streaming, 32134 +github.tar, level 19 with dict, advanced streaming, 32709 +github.tar, level 19 with dict dms, advanced streaming, 32553 +github.tar, level 19 with dict dds, advanced streaming, 32553 +github.tar, level 19 with dict copy, advanced streaming, 32709 +github.tar, level 19 with dict load, advanced streaming, 32474 github.tar, no source size, advanced streaming, 38438 github.tar, no source size with dict, advanced streaming, 38000 github.tar, long distance mode, advanced streaming, 39757 @@ -1177,56 +1177,56 @@ github.tar, multithreaded long distance mode, advanced github.tar, small window log, advanced streaming, 199558 github.tar, small hash log, advanced streaming, 129870 github.tar, small chain log, advanced streaming, 41669 -github.tar, explicit params, advanced streaming, 41351 +github.tar, explicit params, advanced streaming, 41385 github.tar, uncompressed literals, advanced streaming, 41122 -github.tar, uncompressed literals optimal, advanced streaming, 35388 -github.tar, huffman literals, advanced streaming, 38800 +github.tar, uncompressed literals optimal, advanced streaming, 35397 +github.tar, huffman literals, advanced streaming, 38874 github.tar, multithreaded with advanced params, advanced streaming, 41122 -silesia, level -5, old streaming, 6882505 -silesia, level -3, old streaming, 6568376 -silesia, level -1, old streaming, 6183403 -silesia, level 0, old streaming, 4849551 -silesia, level 1, old streaming, 5314161 -silesia, level 3, old streaming, 4849551 -silesia, level 4, old streaming, 4786969 -silesia, level 5, old streaming, 4639132 -silesia, level 6, old streaming, 4605629 -silesia, level 7, old streaming, 4567307 -silesia, level 9, old streaming, 4543330 -silesia, level 13, old streaming, 4482131 -silesia, level 16, old streaming, 4360251 -silesia, level 19, old streaming, 4283236 -silesia, no source size, old streaming, 4849515 -silesia, uncompressed literals, old streaming, 4849551 -silesia, uncompressed literals optimal, old streaming, 4283236 -silesia, huffman literals, old streaming, 6183403 -silesia.tar, level -5, old streaming, 6982759 -silesia.tar, level -3, old streaming, 6641283 -silesia.tar, level -1, old streaming, 6190795 -silesia.tar, level 0, old streaming, 4861425 -silesia.tar, level 1, old streaming, 5336941 -silesia.tar, level 3, old streaming, 4861425 +silesia, level -5, old streaming, 7292053 +silesia, level -3, old streaming, 6867875 +silesia, level -1, old streaming, 6183923 +silesia, level 0, old streaming, 4849553 +silesia, level 1, old streaming, 5312694 +silesia, level 3, old streaming, 4849553 +silesia, level 4, old streaming, 4786968 +silesia, level 5, old streaming, 4638691 +silesia, level 6, old streaming, 4605296 +silesia, level 7, old streaming, 4566984 +silesia, level 9, old streaming, 4543018 +silesia, level 13, old streaming, 4493990 +silesia, level 16, old streaming, 4359864 +silesia, level 19, old streaming, 4296880 +silesia, no source size, old streaming, 4849517 +silesia, uncompressed literals, old streaming, 4849553 +silesia, uncompressed literals optimal, old streaming, 4296880 +silesia, huffman literals, old streaming, 6183923 +silesia.tar, level -5, old streaming, 7260007 +silesia.tar, level -3, old streaming, 6845151 +silesia.tar, level -1, old streaming, 6187938 +silesia.tar, level 0, old streaming, 4861426 +silesia.tar, level 1, old streaming, 5334890 +silesia.tar, level 3, old streaming, 4861426 silesia.tar, level 4, old streaming, 4799632 -silesia.tar, level 5, old streaming, 4650392 -silesia.tar, level 6, old streaming, 4617097 -silesia.tar, level 7, old streaming, 4576953 -silesia.tar, level 9, old streaming, 4552646 -silesia.tar, level 13, old streaming, 4491769 -silesia.tar, level 16, old streaming, 4356834 -silesia.tar, level 19, old streaming, 4264388 -silesia.tar, no source size, old streaming, 4861421 -silesia.tar, uncompressed literals, old streaming, 4861425 -silesia.tar, uncompressed literals optimal, old streaming, 4264388 -silesia.tar, huffman literals, old streaming, 6190795 -github, level -5, old streaming, 205285 +silesia.tar, level 5, old streaming, 4649992 +silesia.tar, level 6, old streaming, 4616803 +silesia.tar, level 7, old streaming, 4576664 +silesia.tar, level 9, old streaming, 4552386 +silesia.tar, level 13, old streaming, 4502956 +silesia.tar, level 16, old streaming, 4360527 +silesia.tar, level 19, old streaming, 4267266 +silesia.tar, no source size, old streaming, 4861422 +silesia.tar, uncompressed literals, old streaming, 4861426 +silesia.tar, uncompressed literals optimal, old streaming, 4267266 +silesia.tar, huffman literals, old streaming, 6187938 +github, level -5, old streaming, 232315 github, level -5 with dict, old streaming, 46718 -github, level -3, old streaming, 190643 +github, level -3, old streaming, 220760 github, level -3 with dict, old streaming, 45395 -github, level -1, old streaming, 175568 +github, level -1, old streaming, 175468 github, level -1 with dict, old streaming, 43170 github, level 0, old streaming, 136335 github, level 0 with dict, old streaming, 41148 -github, level 1, old streaming, 142465 +github, level 1, old streaming, 142365 github, level 1 with dict, old streaming, 41682 github, level 3, old streaming, 136335 github, level 3 with dict, old streaming, 41148 @@ -1250,101 +1250,101 @@ github, no source size, old stre github, no source size with dict, old streaming, 40654 github, uncompressed literals, old streaming, 136335 github, uncompressed literals optimal, old streaming, 134064 -github, huffman literals, old streaming, 175568 -github.tar, level -5, old streaming, 46747 -github.tar, level -5 with dict, old streaming, 44440 -github.tar, level -3, old streaming, 43537 -github.tar, level -3 with dict, old streaming, 41112 -github.tar, level -1, old streaming, 42465 -github.tar, level -1 with dict, old streaming, 41196 +github, huffman literals, old streaming, 175468 +github.tar, level -5, old streaming, 64132 +github.tar, level -5 with dict, old streaming, 48642 +github.tar, level -3, old streaming, 50964 +github.tar, level -3 with dict, old streaming, 42750 +github.tar, level -1, old streaming, 42536 +github.tar, level -1 with dict, old streaming, 41198 github.tar, level 0, old streaming, 38441 github.tar, level 0 with dict, old streaming, 37995 -github.tar, level 1, old streaming, 39342 -github.tar, level 1 with dict, old streaming, 38293 +github.tar, level 1, old streaming, 39270 +github.tar, level 1 with dict, old streaming, 38316 github.tar, level 3, old streaming, 38441 github.tar, level 3 with dict, old streaming, 37995 github.tar, level 4, old streaming, 38467 github.tar, level 4 with dict, old streaming, 37948 -github.tar, level 5, old streaming, 38394 -github.tar, level 5 with dict, old streaming, 39074 -github.tar, level 6, old streaming, 38669 -github.tar, level 6 with dict, old streaming, 38660 -github.tar, level 7, old streaming, 38153 -github.tar, level 7 with dict, old streaming, 37892 -github.tar, level 9, old streaming, 36768 -github.tar, level 9 with dict, old streaming, 36510 -github.tar, level 13, old streaming, 35621 -github.tar, level 13 with dict, old streaming, 38726 -github.tar, level 16, old streaming, 40255 -github.tar, level 16 with dict, old streaming, 33639 -github.tar, level 19, old streaming, 32837 -github.tar, level 19 with dict, old streaming, 32895 +github.tar, level 5, old streaming, 38366 +github.tar, level 5 with dict, old streaming, 39082 +github.tar, level 6, old streaming, 38648 +github.tar, level 6 with dict, old streaming, 38656 +github.tar, level 7, old streaming, 38110 +github.tar, level 7 with dict, old streaming, 37865 +github.tar, level 9, old streaming, 36760 +github.tar, level 9 with dict, old streaming, 36484 +github.tar, level 13, old streaming, 35501 +github.tar, level 13 with dict, old streaming, 37130 +github.tar, level 16, old streaming, 40471 +github.tar, level 16 with dict, old streaming, 33378 +github.tar, level 19, old streaming, 32134 +github.tar, level 19 with dict, old streaming, 32709 github.tar, no source size, old streaming, 38438 github.tar, no source size with dict, old streaming, 38000 github.tar, uncompressed literals, old streaming, 38441 -github.tar, uncompressed literals optimal, old streaming, 32837 -github.tar, huffman literals, old streaming, 42465 -silesia, level -5, old streaming advanced, 6882505 -silesia, level -3, old streaming advanced, 6568376 -silesia, level -1, old streaming advanced, 6183403 -silesia, level 0, old streaming advanced, 4849551 -silesia, level 1, old streaming advanced, 5314161 -silesia, level 3, old streaming advanced, 4849551 -silesia, level 4, old streaming advanced, 4786969 -silesia, level 5, old streaming advanced, 4639132 -silesia, level 6, old streaming advanced, 4605629 -silesia, level 7, old streaming advanced, 4567307 -silesia, level 9, old streaming advanced, 4543330 -silesia, level 13, old streaming advanced, 4482131 -silesia, level 16, old streaming advanced, 4360251 -silesia, level 19, old streaming advanced, 4283236 -silesia, no source size, old streaming advanced, 4849515 -silesia, long distance mode, old streaming advanced, 4849551 -silesia, multithreaded, old streaming advanced, 4849551 -silesia, multithreaded long distance mode, old streaming advanced, 4849551 +github.tar, uncompressed literals optimal, old streaming, 32134 +github.tar, huffman literals, old streaming, 42536 +silesia, level -5, old streaming advanced, 7292053 +silesia, level -3, old streaming advanced, 6867875 +silesia, level -1, old streaming advanced, 6183923 +silesia, level 0, old streaming advanced, 4849553 +silesia, level 1, old streaming advanced, 5312694 +silesia, level 3, old streaming advanced, 4849553 +silesia, level 4, old streaming advanced, 4786968 +silesia, level 5, old streaming advanced, 4638691 +silesia, level 6, old streaming advanced, 4605296 +silesia, level 7, old streaming advanced, 4566984 +silesia, level 9, old streaming advanced, 4543018 +silesia, level 13, old streaming advanced, 4493990 +silesia, level 16, old streaming advanced, 4359864 +silesia, level 19, old streaming advanced, 4296880 +silesia, no source size, old streaming advanced, 4849517 +silesia, long distance mode, old streaming advanced, 4849553 +silesia, multithreaded, old streaming advanced, 4849553 +silesia, multithreaded long distance mode, old streaming advanced, 4849553 silesia, small window log, old streaming advanced, 7112062 silesia, small hash log, old streaming advanced, 6526141 -silesia, small chain log, old streaming advanced, 4912199 -silesia, explicit params, old streaming advanced, 4796309 -silesia, uncompressed literals, old streaming advanced, 4849551 -silesia, uncompressed literals optimal, old streaming advanced, 4283236 -silesia, huffman literals, old streaming advanced, 6183403 -silesia, multithreaded with advanced params, old streaming advanced, 4849551 -silesia.tar, level -5, old streaming advanced, 6982759 -silesia.tar, level -3, old streaming advanced, 6641283 -silesia.tar, level -1, old streaming advanced, 6190795 -silesia.tar, level 0, old streaming advanced, 4861425 -silesia.tar, level 1, old streaming advanced, 5336941 -silesia.tar, level 3, old streaming advanced, 4861425 +silesia, small chain log, old streaming advanced, 4912197 +silesia, explicit params, old streaming advanced, 4795452 +silesia, uncompressed literals, old streaming advanced, 4849553 +silesia, uncompressed literals optimal, old streaming advanced, 4296880 +silesia, huffman literals, old streaming advanced, 6183923 +silesia, multithreaded with advanced params, old streaming advanced, 4849553 +silesia.tar, level -5, old streaming advanced, 7260007 +silesia.tar, level -3, old streaming advanced, 6845151 +silesia.tar, level -1, old streaming advanced, 6187938 +silesia.tar, level 0, old streaming advanced, 4861426 +silesia.tar, level 1, old streaming advanced, 5334890 +silesia.tar, level 3, old streaming advanced, 4861426 silesia.tar, level 4, old streaming advanced, 4799632 -silesia.tar, level 5, old streaming advanced, 4650392 -silesia.tar, level 6, old streaming advanced, 4617097 -silesia.tar, level 7, old streaming advanced, 4576953 -silesia.tar, level 9, old streaming advanced, 4552646 -silesia.tar, level 13, old streaming advanced, 4491769 -silesia.tar, level 16, old streaming advanced, 4356834 -silesia.tar, level 19, old streaming advanced, 4264388 -silesia.tar, no source size, old streaming advanced, 4861421 -silesia.tar, long distance mode, old streaming advanced, 4861425 -silesia.tar, multithreaded, old streaming advanced, 4861425 -silesia.tar, multithreaded long distance mode, old streaming advanced, 4861425 +silesia.tar, level 5, old streaming advanced, 4649992 +silesia.tar, level 6, old streaming advanced, 4616803 +silesia.tar, level 7, old streaming advanced, 4576664 +silesia.tar, level 9, old streaming advanced, 4552386 +silesia.tar, level 13, old streaming advanced, 4502956 +silesia.tar, level 16, old streaming advanced, 4360527 +silesia.tar, level 19, old streaming advanced, 4267266 +silesia.tar, no source size, old streaming advanced, 4861422 +silesia.tar, long distance mode, old streaming advanced, 4861426 +silesia.tar, multithreaded, old streaming advanced, 4861426 +silesia.tar, multithreaded long distance mode, old streaming advanced, 4861426 silesia.tar, small window log, old streaming advanced, 7118772 -silesia.tar, small hash log, old streaming advanced, 6529231 -silesia.tar, small chain log, old streaming advanced, 4917019 -silesia.tar, explicit params, old streaming advanced, 4807688 -silesia.tar, uncompressed literals, old streaming advanced, 4861425 -silesia.tar, uncompressed literals optimal, old streaming advanced, 4264388 -silesia.tar, huffman literals, old streaming advanced, 6190795 -silesia.tar, multithreaded with advanced params, old streaming advanced, 4861425 -github, level -5, old streaming advanced, 216734 +silesia.tar, small hash log, old streaming advanced, 6529234 +silesia.tar, small chain log, old streaming advanced, 4917021 +silesia.tar, explicit params, old streaming advanced, 4806873 +silesia.tar, uncompressed literals, old streaming advanced, 4861426 +silesia.tar, uncompressed literals optimal, old streaming advanced, 4267266 +silesia.tar, huffman literals, old streaming advanced, 6187938 +silesia.tar, multithreaded with advanced params, old streaming advanced, 4861426 +github, level -5, old streaming advanced, 241214 github, level -5 with dict, old streaming advanced, 49562 -github, level -3, old streaming advanced, 192160 +github, level -3, old streaming advanced, 222937 github, level -3 with dict, old streaming advanced, 44956 -github, level -1, old streaming advanced, 181108 +github, level -1, old streaming advanced, 181107 github, level -1 with dict, old streaming advanced, 42383 github, level 0, old streaming advanced, 141104 github, level 0 with dict, old streaming advanced, 41113 -github, level 1, old streaming advanced, 143692 +github, level 1, old streaming advanced, 143693 github, level 1 with dict, old streaming advanced, 42430 github, level 3, old streaming advanced, 141104 github, level 3 with dict, old streaming advanced, 41113 @@ -1359,7 +1359,7 @@ github, level 7 with dict, old stre github, level 9, old streaming advanced, 138676 github, level 9 with dict, old streaming advanced, 38981 github, level 13, old streaming advanced, 138676 -github, level 13 with dict, old streaming advanced, 39731 +github, level 13 with dict, old streaming advanced, 39721 github, level 16, old streaming advanced, 138676 github, level 16 with dict, old streaming advanced, 40789 github, level 19, old streaming advanced, 134064 @@ -1375,36 +1375,36 @@ github, small chain log, old stre github, explicit params, old streaming advanced, 140937 github, uncompressed literals, old streaming advanced, 141104 github, uncompressed literals optimal, old streaming advanced, 134064 -github, huffman literals, old streaming advanced, 181108 +github, huffman literals, old streaming advanced, 181107 github, multithreaded with advanced params, old streaming advanced, 141104 -github.tar, level -5, old streaming advanced, 46747 -github.tar, level -5 with dict, old streaming advanced, 44824 -github.tar, level -3, old streaming advanced, 43537 -github.tar, level -3 with dict, old streaming advanced, 41800 -github.tar, level -1, old streaming advanced, 42465 -github.tar, level -1 with dict, old streaming advanced, 41471 +github.tar, level -5, old streaming advanced, 64132 +github.tar, level -5 with dict, old streaming advanced, 48982 +github.tar, level -3, old streaming advanced, 50964 +github.tar, level -3 with dict, old streaming advanced, 43357 +github.tar, level -1, old streaming advanced, 42536 +github.tar, level -1 with dict, old streaming advanced, 41494 github.tar, level 0, old streaming advanced, 38441 github.tar, level 0 with dict, old streaming advanced, 38013 -github.tar, level 1, old streaming advanced, 39342 -github.tar, level 1 with dict, old streaming advanced, 38940 +github.tar, level 1, old streaming advanced, 39270 +github.tar, level 1 with dict, old streaming advanced, 38934 github.tar, level 3, old streaming advanced, 38441 github.tar, level 3 with dict, old streaming advanced, 38013 github.tar, level 4, old streaming advanced, 38467 github.tar, level 4 with dict, old streaming advanced, 38063 -github.tar, level 5, old streaming advanced, 38394 -github.tar, level 5 with dict, old streaming advanced, 37763 -github.tar, level 6, old streaming advanced, 38669 -github.tar, level 6 with dict, old streaming advanced, 37851 -github.tar, level 7, old streaming advanced, 38153 -github.tar, level 7 with dict, old streaming advanced, 37406 -github.tar, level 9, old streaming advanced, 36768 -github.tar, level 9 with dict, old streaming advanced, 36304 -github.tar, level 13, old streaming advanced, 35621 -github.tar, level 13 with dict, old streaming advanced, 36035 -github.tar, level 16, old streaming advanced, 40255 -github.tar, level 16 with dict, old streaming advanced, 38736 -github.tar, level 19, old streaming advanced, 32837 -github.tar, level 19 with dict, old streaming advanced, 32876 +github.tar, level 5, old streaming advanced, 38366 +github.tar, level 5 with dict, old streaming advanced, 37728 +github.tar, level 6, old streaming advanced, 38648 +github.tar, level 6 with dict, old streaming advanced, 37820 +github.tar, level 7, old streaming advanced, 38110 +github.tar, level 7 with dict, old streaming advanced, 37387 +github.tar, level 9, old streaming advanced, 36760 +github.tar, level 9 with dict, old streaming advanced, 36312 +github.tar, level 13, old streaming advanced, 35501 +github.tar, level 13 with dict, old streaming advanced, 35807 +github.tar, level 16, old streaming advanced, 40471 +github.tar, level 16 with dict, old streaming advanced, 38578 +github.tar, level 19, old streaming advanced, 32134 +github.tar, level 19 with dict, old streaming advanced, 32702 github.tar, no source size, old streaming advanced, 38438 github.tar, no source size with dict, old streaming advanced, 38015 github.tar, long distance mode, old streaming advanced, 38441 @@ -1413,10 +1413,10 @@ github.tar, multithreaded long distance mode, old stre github.tar, small window log, old streaming advanced, 199561 github.tar, small hash log, old streaming advanced, 129870 github.tar, small chain log, old streaming advanced, 41669 -github.tar, explicit params, old streaming advanced, 41351 +github.tar, explicit params, old streaming advanced, 41385 github.tar, uncompressed literals, old streaming advanced, 38441 -github.tar, uncompressed literals optimal, old streaming advanced, 32837 -github.tar, huffman literals, old streaming advanced, 42465 +github.tar, uncompressed literals optimal, old streaming advanced, 32134 +github.tar, huffman literals, old streaming advanced, 42536 github.tar, multithreaded with advanced params, old streaming advanced, 38441 github, level -5 with dict, old streaming cdict, 46718 github, level -3 with dict, old streaming cdict, 45395 @@ -1433,20 +1433,20 @@ github, level 13 with dict, old stre github, level 16 with dict, old streaming cdict, 37577 github, level 19 with dict, old streaming cdict, 37576 github, no source size with dict, old streaming cdict, 40654 -github.tar, level -5 with dict, old streaming cdict, 45018 -github.tar, level -3 with dict, old streaming cdict, 41886 -github.tar, level -1 with dict, old streaming cdict, 41636 +github.tar, level -5 with dict, old streaming cdict, 49146 +github.tar, level -3 with dict, old streaming cdict, 43468 +github.tar, level -1 with dict, old streaming cdict, 41662 github.tar, level 0 with dict, old streaming cdict, 37956 -github.tar, level 1 with dict, old streaming cdict, 38766 +github.tar, level 1 with dict, old streaming cdict, 38761 github.tar, level 3 with dict, old streaming cdict, 37956 github.tar, level 4 with dict, old streaming cdict, 37927 -github.tar, level 5 with dict, old streaming cdict, 37665 -github.tar, level 6 with dict, old streaming cdict, 37889 -github.tar, level 7 with dict, old streaming cdict, 37457 -github.tar, level 9 with dict, old streaming cdict, 36383 -github.tar, level 13 with dict, old streaming cdict, 36372 -github.tar, level 16 with dict, old streaming cdict, 39353 -github.tar, level 19 with dict, old streaming cdict, 32676 +github.tar, level 5 with dict, old streaming cdict, 37656 +github.tar, level 6 with dict, old streaming cdict, 37865 +github.tar, level 7 with dict, old streaming cdict, 37436 +github.tar, level 9 with dict, old streaming cdict, 36401 +github.tar, level 13 with dict, old streaming cdict, 36010 +github.tar, level 16 with dict, old streaming cdict, 39081 +github.tar, level 19 with dict, old streaming cdict, 32474 github.tar, no source size with dict, old streaming cdict, 38000 github, level -5 with dict, old streaming advanced cdict, 49562 github, level -3 with dict, old streaming advanced cdict, 44956 @@ -1459,7 +1459,7 @@ github, level 5 with dict, old stre github, level 6 with dict, old streaming advanced cdict, 39363 github, level 7 with dict, old streaming advanced cdict, 38924 github, level 9 with dict, old streaming advanced cdict, 38981 -github, level 13 with dict, old streaming advanced cdict, 39731 +github, level 13 with dict, old streaming advanced cdict, 39721 github, level 16 with dict, old streaming advanced cdict, 40789 github, level 19 with dict, old streaming advanced cdict, 37576 github, no source size with dict, old streaming advanced cdict, 40608 @@ -1470,11 +1470,11 @@ github.tar, level 0 with dict, old stre github.tar, level 1 with dict, old streaming advanced cdict, 39002 github.tar, level 3 with dict, old streaming advanced cdict, 38013 github.tar, level 4 with dict, old streaming advanced cdict, 38063 -github.tar, level 5 with dict, old streaming advanced cdict, 37763 -github.tar, level 6 with dict, old streaming advanced cdict, 37851 -github.tar, level 7 with dict, old streaming advanced cdict, 37406 -github.tar, level 9 with dict, old streaming advanced cdict, 36304 -github.tar, level 13 with dict, old streaming advanced cdict, 36035 -github.tar, level 16 with dict, old streaming advanced cdict, 38736 -github.tar, level 19 with dict, old streaming advanced cdict, 32876 +github.tar, level 5 with dict, old streaming advanced cdict, 37728 +github.tar, level 6 with dict, old streaming advanced cdict, 37820 +github.tar, level 7 with dict, old streaming advanced cdict, 37387 +github.tar, level 9 with dict, old streaming advanced cdict, 36312 +github.tar, level 13 with dict, old streaming advanced cdict, 35807 +github.tar, level 16 with dict, old streaming advanced cdict, 38578 +github.tar, level 19 with dict, old streaming advanced cdict, 32702 github.tar, no source size with dict, old streaming advanced cdict, 38015 From abc1a91fe2ef62b2b29ad487d3ffb66db7e30105 Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Wed, 29 Sep 2021 07:09:08 +0200 Subject: [PATCH 38/38] add missing BUNDLE DESTINATION fixes build on iOS --- build/cmake/lib/CMakeLists.txt | 1 + build/cmake/programs/CMakeLists.txt | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/build/cmake/lib/CMakeLists.txt b/build/cmake/lib/CMakeLists.txt index d91ebe1f0..a9bff58e5 100644 --- a/build/cmake/lib/CMakeLists.txt +++ b/build/cmake/lib/CMakeLists.txt @@ -168,6 +168,7 @@ install(TARGETS ${library_targets} ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}" ) # uninstall target diff --git a/build/cmake/programs/CMakeLists.txt b/build/cmake/programs/CMakeLists.txt index f1d127746..490030783 100644 --- a/build/cmake/programs/CMakeLists.txt +++ b/build/cmake/programs/CMakeLists.txt @@ -37,7 +37,9 @@ target_link_libraries(zstd ${PROGRAMS_ZSTD_LINK_TARGET}) if (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)") target_link_libraries(zstd rt) endif () -install(TARGETS zstd RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +install(TARGETS zstd + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}") if (UNIX) add_custom_target(zstdcat ALL ${CMAKE_COMMAND} -E create_symlink zstd zstdcat DEPENDS zstd COMMENT "Creating zstdcat symlink")