multi_compress 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -3
- data/GET_STARTED.md +3 -3
- data/README.md +75 -66
- data/THIRD_PARTY_NOTICES.md +24 -0
- data/ext/multi_compress/brotli_dec_static_init.c +3 -0
- data/ext/multi_compress/brotli_enc_static_init.c +3 -0
- data/ext/multi_compress/extconf.rb +22 -1
- data/ext/multi_compress/vendor/.vendored +2 -2
- data/ext/multi_compress/vendor/brotli/LICENSE +19 -0
- data/ext/multi_compress/vendor/brotli/c/common/constants.c +7 -7
- data/ext/multi_compress/vendor/brotli/c/common/constants.h +2 -5
- data/ext/multi_compress/vendor/brotli/c/common/context.c +2 -2
- data/ext/multi_compress/vendor/brotli/c/common/context.h +1 -2
- data/ext/multi_compress/vendor/brotli/c/common/dictionary.c +4 -5856
- data/ext/multi_compress/vendor/brotli/c/common/dictionary.h +1 -2
- data/ext/multi_compress/vendor/brotli/c/common/dictionary_inc.h +5847 -0
- data/ext/multi_compress/vendor/brotli/c/common/platform.c +0 -4
- data/ext/multi_compress/vendor/brotli/c/common/platform.h +182 -43
- data/ext/multi_compress/vendor/brotli/c/common/shared_dictionary.c +3 -7
- data/ext/multi_compress/vendor/brotli/c/common/shared_dictionary_internal.h +1 -1
- data/ext/multi_compress/vendor/brotli/c/common/static_init.h +56 -0
- data/ext/multi_compress/vendor/brotli/c/common/transform.c +6 -4
- data/ext/multi_compress/vendor/brotli/c/common/transform.h +1 -2
- data/ext/multi_compress/vendor/brotli/c/common/version.h +3 -3
- data/ext/multi_compress/vendor/brotli/c/dec/bit_reader.c +2 -3
- data/ext/multi_compress/vendor/brotli/c/dec/bit_reader.h +0 -4
- data/ext/multi_compress/vendor/brotli/c/dec/decode.c +128 -39
- data/ext/multi_compress/vendor/brotli/c/dec/huffman.c +2 -5
- data/ext/multi_compress/vendor/brotli/c/dec/huffman.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/dec/prefix.c +67 -0
- data/ext/multi_compress/vendor/brotli/c/dec/prefix.h +18 -708
- data/ext/multi_compress/vendor/brotli/c/dec/prefix_inc.h +707 -0
- data/ext/multi_compress/vendor/brotli/c/dec/state.c +18 -15
- data/ext/multi_compress/vendor/brotli/c/dec/state.h +2 -6
- data/ext/multi_compress/vendor/brotli/c/dec/static_init.c +53 -0
- data/ext/multi_compress/vendor/brotli/c/dec/static_init.h +30 -0
- data/ext/multi_compress/vendor/brotli/c/enc/backward_references.c +32 -8
- data/ext/multi_compress/vendor/brotli/c/enc/backward_references.h +1 -5
- data/ext/multi_compress/vendor/brotli/c/enc/backward_references_hq.c +15 -15
- data/ext/multi_compress/vendor/brotli/c/enc/backward_references_hq.h +1 -5
- data/ext/multi_compress/vendor/brotli/c/enc/bit_cost.c +28 -4
- data/ext/multi_compress/vendor/brotli/c/enc/bit_cost.h +8 -40
- data/ext/multi_compress/vendor/brotli/c/enc/bit_cost_inc.h +1 -1
- data/ext/multi_compress/vendor/brotli/c/enc/block_splitter.c +9 -12
- data/ext/multi_compress/vendor/brotli/c/enc/block_splitter.h +0 -3
- data/ext/multi_compress/vendor/brotli/c/enc/block_splitter_inc.h +14 -8
- data/ext/multi_compress/vendor/brotli/c/enc/brotli_bit_stream.c +10 -9
- data/ext/multi_compress/vendor/brotli/c/enc/brotli_bit_stream.h +0 -6
- data/ext/multi_compress/vendor/brotli/c/enc/cluster.c +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/cluster.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/command.c +1 -1
- data/ext/multi_compress/vendor/brotli/c/enc/command.h +8 -10
- data/ext/multi_compress/vendor/brotli/c/enc/compound_dictionary.c +3 -5
- data/ext/multi_compress/vendor/brotli/c/enc/compound_dictionary.h +1 -4
- data/ext/multi_compress/vendor/brotli/c/enc/compress_fragment.c +3 -13
- data/ext/multi_compress/vendor/brotli/c/enc/compress_fragment.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/compress_fragment_two_pass.c +5 -15
- data/ext/multi_compress/vendor/brotli/c/enc/compress_fragment_two_pass.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/dictionary_hash.c +127 -1830
- data/ext/multi_compress/vendor/brotli/c/enc/dictionary_hash.h +23 -3
- data/ext/multi_compress/vendor/brotli/c/enc/dictionary_hash_inc.h +1829 -0
- data/ext/multi_compress/vendor/brotli/c/enc/encode.c +77 -52
- data/ext/multi_compress/vendor/brotli/c/enc/encoder_dict.c +9 -7
- data/ext/multi_compress/vendor/brotli/c/enc/encoder_dict.h +2 -4
- data/ext/multi_compress/vendor/brotli/c/enc/entropy_encode.c +3 -6
- data/ext/multi_compress/vendor/brotli/c/enc/entropy_encode.h +2 -4
- data/ext/multi_compress/vendor/brotli/c/enc/entropy_encode_static.h +18 -12
- data/ext/multi_compress/vendor/brotli/c/enc/fast_log.c +1 -1
- data/ext/multi_compress/vendor/brotli/c/enc/fast_log.h +2 -3
- data/ext/multi_compress/vendor/brotli/c/enc/find_match_length.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/hash.h +38 -31
- data/ext/multi_compress/vendor/brotli/c/enc/hash_base.h +38 -0
- data/ext/multi_compress/vendor/brotli/c/enc/hash_forgetful_chain_inc.h +11 -1
- data/ext/multi_compress/vendor/brotli/c/enc/hash_longest_match64_inc.h +24 -7
- data/ext/multi_compress/vendor/brotli/c/enc/hash_longest_match64_simd_inc.h +304 -0
- data/ext/multi_compress/vendor/brotli/c/enc/hash_longest_match_inc.h +30 -11
- data/ext/multi_compress/vendor/brotli/c/enc/hash_longest_match_quickly_inc.h +4 -0
- data/ext/multi_compress/vendor/brotli/c/enc/hash_longest_match_simd_inc.h +278 -0
- data/ext/multi_compress/vendor/brotli/c/enc/histogram.c +1 -0
- data/ext/multi_compress/vendor/brotli/c/enc/histogram.h +0 -4
- data/ext/multi_compress/vendor/brotli/c/enc/literal_cost.c +4 -6
- data/ext/multi_compress/vendor/brotli/c/enc/literal_cost.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/matching_tag_mask.h +69 -0
- data/ext/multi_compress/vendor/brotli/c/enc/memory.c +0 -5
- data/ext/multi_compress/vendor/brotli/c/enc/memory.h +0 -4
- data/ext/multi_compress/vendor/brotli/c/enc/metablock.c +7 -9
- data/ext/multi_compress/vendor/brotli/c/enc/metablock.h +3 -3
- data/ext/multi_compress/vendor/brotli/c/enc/metablock_inc.h +4 -4
- data/ext/multi_compress/vendor/brotli/c/enc/params.h +0 -1
- data/ext/multi_compress/vendor/brotli/c/enc/prefix.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/quality.h +17 -10
- data/ext/multi_compress/vendor/brotli/c/enc/ringbuffer.h +1 -4
- data/ext/multi_compress/vendor/brotli/c/enc/state.h +2 -2
- data/ext/multi_compress/vendor/brotli/c/enc/static_dict.c +5 -11
- data/ext/multi_compress/vendor/brotli/c/enc/static_dict.h +1 -3
- data/ext/multi_compress/vendor/brotli/c/enc/static_dict_lut.c +224 -0
- data/ext/multi_compress/vendor/brotli/c/enc/static_dict_lut.h +20 -5837
- data/ext/multi_compress/vendor/brotli/c/enc/static_dict_lut_inc.h +5830 -0
- data/ext/multi_compress/vendor/brotli/c/enc/static_init.c +59 -0
- data/ext/multi_compress/vendor/brotli/c/enc/static_init.h +30 -0
- data/ext/multi_compress/vendor/brotli/c/enc/static_init_lazy.cc +26 -0
- data/ext/multi_compress/vendor/brotli/c/enc/utf8_util.c +1 -1
- data/ext/multi_compress/vendor/brotli/c/enc/utf8_util.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/enc/write_bits.h +0 -2
- data/ext/multi_compress/vendor/brotli/c/include/brotli/decode.h +1 -1
- data/ext/multi_compress/vendor/brotli/c/include/brotli/encode.h +5 -1
- data/ext/multi_compress/vendor/brotli/c/include/brotli/port.h +4 -7
- data/ext/multi_compress/vendor/brotli/c/include/brotli/types.h +2 -2
- data/ext/multi_compress/vendor/lz4/LICENSE +12 -0
- data/ext/multi_compress/vendor/zstd/COPYING +339 -0
- data/ext/multi_compress/vendor/zstd/LICENSE +30 -0
- data/ext/multi_compress/vendor/zstd/lib/Makefile +67 -35
- data/ext/multi_compress/vendor/zstd/lib/README.md +33 -2
- data/ext/multi_compress/vendor/zstd/lib/common/allocations.h +55 -0
- data/ext/multi_compress/vendor/zstd/lib/common/bits.h +205 -0
- data/ext/multi_compress/vendor/zstd/lib/common/bitstream.h +84 -108
- data/ext/multi_compress/vendor/zstd/lib/common/compiler.h +170 -41
- data/ext/multi_compress/vendor/zstd/lib/common/cpu.h +37 -1
- data/ext/multi_compress/vendor/zstd/lib/common/debug.c +7 -1
- data/ext/multi_compress/vendor/zstd/lib/common/debug.h +21 -21
- data/ext/multi_compress/vendor/zstd/lib/common/entropy_common.c +12 -40
- data/ext/multi_compress/vendor/zstd/lib/common/error_private.c +10 -2
- data/ext/multi_compress/vendor/zstd/lib/common/error_private.h +46 -47
- data/ext/multi_compress/vendor/zstd/lib/common/fse.h +8 -100
- data/ext/multi_compress/vendor/zstd/lib/common/fse_decompress.c +28 -116
- data/ext/multi_compress/vendor/zstd/lib/common/huf.h +79 -166
- data/ext/multi_compress/vendor/zstd/lib/common/mem.h +46 -66
- data/ext/multi_compress/vendor/zstd/lib/common/pool.c +27 -11
- data/ext/multi_compress/vendor/zstd/lib/common/pool.h +8 -11
- data/ext/multi_compress/vendor/zstd/lib/common/portability_macros.h +45 -11
- data/ext/multi_compress/vendor/zstd/lib/common/threading.c +74 -14
- data/ext/multi_compress/vendor/zstd/lib/common/threading.h +5 -18
- data/ext/multi_compress/vendor/zstd/lib/common/xxhash.c +5 -11
- data/ext/multi_compress/vendor/zstd/lib/common/xxhash.h +2411 -1003
- data/ext/multi_compress/vendor/zstd/lib/common/zstd_common.c +1 -36
- data/ext/multi_compress/vendor/zstd/lib/common/zstd_deps.h +13 -1
- data/ext/multi_compress/vendor/zstd/lib/common/zstd_internal.h +13 -182
- data/ext/multi_compress/vendor/zstd/lib/common/zstd_trace.h +6 -13
- data/ext/multi_compress/vendor/zstd/lib/compress/clevels.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/compress/fse_compress.c +15 -131
- data/ext/multi_compress/vendor/zstd/lib/compress/hist.c +11 -1
- data/ext/multi_compress/vendor/zstd/lib/compress/hist.h +8 -1
- data/ext/multi_compress/vendor/zstd/lib/compress/huf_compress.c +283 -189
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress.c +2419 -903
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_internal.h +423 -245
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_literals.c +116 -40
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_literals.h +16 -8
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_sequences.c +10 -10
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_sequences.h +8 -7
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_superblock.c +254 -139
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_compress_superblock.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_cwksp.h +184 -95
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_double_fast.c +163 -81
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_double_fast.h +18 -14
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_fast.c +507 -197
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_fast.h +7 -14
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_lazy.c +579 -484
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_lazy.h +133 -65
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_ldm.c +61 -40
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_ldm.h +7 -15
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_ldm_geartab.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_opt.c +352 -218
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_opt.h +37 -21
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_preSplit.c +238 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstd_preSplit.h +33 -0
- data/ext/multi_compress/vendor/zstd/lib/compress/zstdmt_compress.c +239 -175
- data/ext/multi_compress/vendor/zstd/lib/compress/zstdmt_compress.h +5 -16
- data/ext/multi_compress/vendor/zstd/lib/decompress/huf_decompress.c +543 -488
- data/ext/multi_compress/vendor/zstd/lib/decompress/huf_decompress_amd64.S +78 -61
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_ddict.c +4 -4
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_ddict.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress.c +295 -115
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress_block.c +430 -293
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress_block.h +7 -2
- data/ext/multi_compress/vendor/zstd/lib/decompress/zstd_decompress_internal.h +11 -7
- data/ext/multi_compress/vendor/zstd/lib/deprecated/zbuff.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/deprecated/zbuff_common.c +1 -1
- data/ext/multi_compress/vendor/zstd/lib/deprecated/zbuff_compress.c +1 -1
- data/ext/multi_compress/vendor/zstd/lib/deprecated/zbuff_decompress.c +3 -1
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/cover.c +95 -46
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/cover.h +3 -9
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/divsufsort.h +0 -10
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/fastcover.c +4 -4
- data/ext/multi_compress/vendor/zstd/lib/dictBuilder/zdict.c +25 -97
- data/ext/multi_compress/vendor/zstd/lib/dll/example/Makefile +1 -1
- data/ext/multi_compress/vendor/zstd/lib/dll/example/README.md +1 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_legacy.h +38 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v01.c +19 -50
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v01.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v02.c +27 -80
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v02.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v03.c +28 -83
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v03.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v04.c +25 -74
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v04.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v05.c +31 -76
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v05.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v06.c +44 -88
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v06.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v07.c +33 -84
- data/ext/multi_compress/vendor/zstd/lib/legacy/zstd_v07.h +1 -1
- data/ext/multi_compress/vendor/zstd/lib/libzstd.mk +65 -33
- data/ext/multi_compress/vendor/zstd/lib/libzstd.pc.in +5 -5
- data/ext/multi_compress/vendor/zstd/lib/module.modulemap +13 -3
- data/ext/multi_compress/vendor/zstd/lib/zdict.h +65 -36
- data/ext/multi_compress/vendor/zstd/lib/zstd.h +890 -267
- data/ext/multi_compress/vendor/zstd/lib/zstd_errors.h +28 -16
- data/lib/multi_compress/version.rb +1 -1
- metadata +29 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
|
@@ -11,10 +11,6 @@
|
|
|
11
11
|
#ifndef POOL_H
|
|
12
12
|
#define POOL_H
|
|
13
13
|
|
|
14
|
-
#if defined (__cplusplus)
|
|
15
|
-
extern "C" {
|
|
16
|
-
#endif
|
|
17
|
-
|
|
18
14
|
|
|
19
15
|
#include "zstd_deps.h"
|
|
20
16
|
#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_customMem */
|
|
@@ -38,10 +34,16 @@ POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize,
|
|
|
38
34
|
*/
|
|
39
35
|
void POOL_free(POOL_ctx* ctx);
|
|
40
36
|
|
|
37
|
+
|
|
38
|
+
/*! POOL_joinJobs() :
|
|
39
|
+
* Waits for all queued jobs to finish executing.
|
|
40
|
+
*/
|
|
41
|
+
void POOL_joinJobs(POOL_ctx* ctx);
|
|
42
|
+
|
|
41
43
|
/*! POOL_resize() :
|
|
42
44
|
* Expands or shrinks pool's number of threads.
|
|
43
45
|
* This is more efficient than releasing + creating a new context,
|
|
44
|
-
* since it tries to preserve and
|
|
46
|
+
* since it tries to preserve and reuse existing threads.
|
|
45
47
|
* `numThreads` must be at least 1.
|
|
46
48
|
* @return : 0 when resize was successful,
|
|
47
49
|
* !0 (typically 1) if there is an error.
|
|
@@ -76,9 +78,4 @@ void POOL_add(POOL_ctx* ctx, POOL_function function, void* opaque);
|
|
|
76
78
|
*/
|
|
77
79
|
int POOL_tryAdd(POOL_ctx* ctx, POOL_function function, void* opaque);
|
|
78
80
|
|
|
79
|
-
|
|
80
|
-
#if defined (__cplusplus)
|
|
81
|
-
}
|
|
82
|
-
#endif
|
|
83
|
-
|
|
84
81
|
#endif
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#define ZSTD_PORTABILITY_MACROS_H
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* This header file contains macro
|
|
15
|
+
* This header file contains macro definitions to support portability.
|
|
16
16
|
* This header is shared between C and ASM code, so it MUST only
|
|
17
17
|
* contain macro definitions. It MUST not contain any C code.
|
|
18
18
|
*
|
|
@@ -68,30 +68,45 @@
|
|
|
68
68
|
/* Mark the internal assembly functions as hidden */
|
|
69
69
|
#ifdef __ELF__
|
|
70
70
|
# define ZSTD_HIDE_ASM_FUNCTION(func) .hidden func
|
|
71
|
+
#elif defined(__APPLE__)
|
|
72
|
+
# define ZSTD_HIDE_ASM_FUNCTION(func) .private_extern func
|
|
71
73
|
#else
|
|
72
74
|
# define ZSTD_HIDE_ASM_FUNCTION(func)
|
|
73
75
|
#endif
|
|
74
76
|
|
|
77
|
+
/* Compile time determination of BMI2 support */
|
|
78
|
+
#ifndef STATIC_BMI2
|
|
79
|
+
# if defined(__BMI2__)
|
|
80
|
+
# define STATIC_BMI2 1
|
|
81
|
+
# elif defined(_MSC_VER) && defined(__AVX2__)
|
|
82
|
+
# define STATIC_BMI2 1 /* MSVC does not have a BMI2 specific flag, but every CPU that supports AVX2 also supports BMI2 */
|
|
83
|
+
# endif
|
|
84
|
+
#endif
|
|
85
|
+
|
|
86
|
+
#ifndef STATIC_BMI2
|
|
87
|
+
# define STATIC_BMI2 0
|
|
88
|
+
#endif
|
|
89
|
+
|
|
75
90
|
/* Enable runtime BMI2 dispatch based on the CPU.
|
|
76
91
|
* Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default.
|
|
77
92
|
*/
|
|
78
93
|
#ifndef DYNAMIC_BMI2
|
|
79
|
-
|
|
94
|
+
# if ((defined(__clang__) && __has_attribute(__target__)) \
|
|
80
95
|
|| (defined(__GNUC__) \
|
|
81
96
|
&& (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))) \
|
|
82
|
-
&& (defined(__x86_64__) || defined(_M_X64)) \
|
|
97
|
+
&& (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)) \
|
|
83
98
|
&& !defined(__BMI2__)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
99
|
+
# define DYNAMIC_BMI2 1
|
|
100
|
+
# else
|
|
101
|
+
# define DYNAMIC_BMI2 0
|
|
102
|
+
# endif
|
|
88
103
|
#endif
|
|
89
104
|
|
|
90
105
|
/**
|
|
91
|
-
* Only enable assembly for
|
|
106
|
+
* Only enable assembly for GNU C compatible compilers,
|
|
92
107
|
* because other platforms may not support GAS assembly syntax.
|
|
93
108
|
*
|
|
94
|
-
* Only enable assembly for Linux / MacOS, other platforms may
|
|
109
|
+
* Only enable assembly for Linux / MacOS / Win32, other platforms may
|
|
95
110
|
* work, but they haven't been tested. This could likely be
|
|
96
111
|
* extended to BSD systems.
|
|
97
112
|
*
|
|
@@ -99,7 +114,7 @@
|
|
|
99
114
|
* 100% of code to be instrumented to work.
|
|
100
115
|
*/
|
|
101
116
|
#if defined(__GNUC__)
|
|
102
|
-
# if defined(__linux__) || defined(__linux) || defined(__APPLE__)
|
|
117
|
+
# if defined(__linux__) || defined(__linux) || defined(__APPLE__) || defined(_WIN32)
|
|
103
118
|
# if ZSTD_MEMORY_SANITIZER
|
|
104
119
|
# define ZSTD_ASM_SUPPORTED 0
|
|
105
120
|
# elif ZSTD_DATAFLOW_SANITIZER
|
|
@@ -134,4 +149,23 @@
|
|
|
134
149
|
# define ZSTD_ENABLE_ASM_X86_64_BMI2 0
|
|
135
150
|
#endif
|
|
136
151
|
|
|
152
|
+
/*
|
|
153
|
+
* For x86 ELF targets, add .note.gnu.property section for Intel CET in
|
|
154
|
+
* assembly sources when CET is enabled.
|
|
155
|
+
*
|
|
156
|
+
* Additionally, any function that may be called indirectly must begin
|
|
157
|
+
* with ZSTD_CET_ENDBRANCH.
|
|
158
|
+
*/
|
|
159
|
+
#if defined(__ELF__) && (defined(__x86_64__) || defined(__i386__)) \
|
|
160
|
+
&& defined(__has_include)
|
|
161
|
+
# if __has_include(<cet.h>)
|
|
162
|
+
# include <cet.h>
|
|
163
|
+
# define ZSTD_CET_ENDBRANCH _CET_ENDBR
|
|
164
|
+
# endif
|
|
165
|
+
#endif
|
|
166
|
+
|
|
167
|
+
#ifndef ZSTD_CET_ENDBRANCH
|
|
168
|
+
# define ZSTD_CET_ENDBRANCH
|
|
169
|
+
#endif
|
|
170
|
+
|
|
137
171
|
#endif /* ZSTD_PORTABILITY_MACROS_H */
|
|
@@ -23,8 +23,7 @@ int g_ZSTD_threading_useless_symbol;
|
|
|
23
23
|
#if defined(ZSTD_MULTITHREAD) && defined(_WIN32)
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Windows minimalist Pthread Wrapper
|
|
27
|
-
* http://www.cse.wustl.edu/~schmidt/win32-cv-1.html
|
|
26
|
+
* Windows minimalist Pthread Wrapper
|
|
28
27
|
*/
|
|
29
28
|
|
|
30
29
|
|
|
@@ -35,37 +34,94 @@ int g_ZSTD_threading_useless_symbol;
|
|
|
35
34
|
|
|
36
35
|
/* === Implementation === */
|
|
37
36
|
|
|
37
|
+
typedef struct {
|
|
38
|
+
void* (*start_routine)(void*);
|
|
39
|
+
void* arg;
|
|
40
|
+
int initialized;
|
|
41
|
+
ZSTD_pthread_cond_t initialized_cond;
|
|
42
|
+
ZSTD_pthread_mutex_t initialized_mutex;
|
|
43
|
+
} ZSTD_thread_params_t;
|
|
44
|
+
|
|
38
45
|
static unsigned __stdcall worker(void *arg)
|
|
39
46
|
{
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
void* (*start_routine)(void*);
|
|
48
|
+
void* thread_arg;
|
|
49
|
+
|
|
50
|
+
/* Initialized thread_arg and start_routine and signal main thread that we don't need it
|
|
51
|
+
* to wait any longer.
|
|
52
|
+
*/
|
|
53
|
+
{
|
|
54
|
+
ZSTD_thread_params_t* thread_param = (ZSTD_thread_params_t*)arg;
|
|
55
|
+
thread_arg = thread_param->arg;
|
|
56
|
+
start_routine = thread_param->start_routine;
|
|
57
|
+
|
|
58
|
+
/* Signal main thread that we are running and do not depend on its memory anymore */
|
|
59
|
+
ZSTD_pthread_mutex_lock(&thread_param->initialized_mutex);
|
|
60
|
+
thread_param->initialized = 1;
|
|
61
|
+
ZSTD_pthread_cond_signal(&thread_param->initialized_cond);
|
|
62
|
+
ZSTD_pthread_mutex_unlock(&thread_param->initialized_mutex);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
start_routine(thread_arg);
|
|
66
|
+
|
|
42
67
|
return 0;
|
|
43
68
|
}
|
|
44
69
|
|
|
45
70
|
int ZSTD_pthread_create(ZSTD_pthread_t* thread, const void* unused,
|
|
46
71
|
void* (*start_routine) (void*), void* arg)
|
|
47
72
|
{
|
|
73
|
+
ZSTD_thread_params_t thread_param;
|
|
48
74
|
(void)unused;
|
|
49
|
-
thread->arg = arg;
|
|
50
|
-
thread->start_routine = start_routine;
|
|
51
|
-
thread->handle = (HANDLE) _beginthreadex(NULL, 0, worker, thread, 0, NULL);
|
|
52
75
|
|
|
53
|
-
if (
|
|
76
|
+
if (thread==NULL) return -1;
|
|
77
|
+
*thread = NULL;
|
|
78
|
+
|
|
79
|
+
thread_param.start_routine = start_routine;
|
|
80
|
+
thread_param.arg = arg;
|
|
81
|
+
thread_param.initialized = 0;
|
|
82
|
+
|
|
83
|
+
/* Setup thread initialization synchronization */
|
|
84
|
+
if(ZSTD_pthread_cond_init(&thread_param.initialized_cond, NULL)) {
|
|
85
|
+
/* Should never happen on Windows */
|
|
86
|
+
return -1;
|
|
87
|
+
}
|
|
88
|
+
if(ZSTD_pthread_mutex_init(&thread_param.initialized_mutex, NULL)) {
|
|
89
|
+
/* Should never happen on Windows */
|
|
90
|
+
ZSTD_pthread_cond_destroy(&thread_param.initialized_cond);
|
|
91
|
+
return -1;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Spawn thread */
|
|
95
|
+
*thread = (HANDLE)_beginthreadex(NULL, 0, worker, &thread_param, 0, NULL);
|
|
96
|
+
if (*thread==NULL) {
|
|
97
|
+
ZSTD_pthread_mutex_destroy(&thread_param.initialized_mutex);
|
|
98
|
+
ZSTD_pthread_cond_destroy(&thread_param.initialized_cond);
|
|
54
99
|
return errno;
|
|
55
|
-
|
|
56
|
-
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Wait for thread to be initialized */
|
|
103
|
+
ZSTD_pthread_mutex_lock(&thread_param.initialized_mutex);
|
|
104
|
+
while(!thread_param.initialized) {
|
|
105
|
+
ZSTD_pthread_cond_wait(&thread_param.initialized_cond, &thread_param.initialized_mutex);
|
|
106
|
+
}
|
|
107
|
+
ZSTD_pthread_mutex_unlock(&thread_param.initialized_mutex);
|
|
108
|
+
ZSTD_pthread_mutex_destroy(&thread_param.initialized_mutex);
|
|
109
|
+
ZSTD_pthread_cond_destroy(&thread_param.initialized_cond);
|
|
110
|
+
|
|
111
|
+
return 0;
|
|
57
112
|
}
|
|
58
113
|
|
|
59
|
-
int ZSTD_pthread_join(ZSTD_pthread_t thread
|
|
114
|
+
int ZSTD_pthread_join(ZSTD_pthread_t thread)
|
|
60
115
|
{
|
|
61
116
|
DWORD result;
|
|
62
117
|
|
|
63
|
-
if (!thread
|
|
118
|
+
if (!thread) return 0;
|
|
119
|
+
|
|
120
|
+
result = WaitForSingleObject(thread, INFINITE);
|
|
121
|
+
CloseHandle(thread);
|
|
64
122
|
|
|
65
|
-
result = WaitForSingleObject(thread.handle, INFINITE);
|
|
66
123
|
switch (result) {
|
|
67
124
|
case WAIT_OBJECT_0:
|
|
68
|
-
if (value_ptr) *value_ptr = thread.arg;
|
|
69
125
|
return 0;
|
|
70
126
|
case WAIT_ABANDONED:
|
|
71
127
|
return EINVAL;
|
|
@@ -83,6 +139,7 @@ int ZSTD_pthread_join(ZSTD_pthread_t thread, void **value_ptr)
|
|
|
83
139
|
|
|
84
140
|
int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t const* attr)
|
|
85
141
|
{
|
|
142
|
+
assert(mutex != NULL);
|
|
86
143
|
*mutex = (pthread_mutex_t*)ZSTD_malloc(sizeof(pthread_mutex_t));
|
|
87
144
|
if (!*mutex)
|
|
88
145
|
return 1;
|
|
@@ -91,6 +148,7 @@ int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t con
|
|
|
91
148
|
|
|
92
149
|
int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex)
|
|
93
150
|
{
|
|
151
|
+
assert(mutex != NULL);
|
|
94
152
|
if (!*mutex)
|
|
95
153
|
return 0;
|
|
96
154
|
{
|
|
@@ -102,6 +160,7 @@ int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex)
|
|
|
102
160
|
|
|
103
161
|
int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const* attr)
|
|
104
162
|
{
|
|
163
|
+
assert(cond != NULL);
|
|
105
164
|
*cond = (pthread_cond_t*)ZSTD_malloc(sizeof(pthread_cond_t));
|
|
106
165
|
if (!*cond)
|
|
107
166
|
return 1;
|
|
@@ -110,6 +169,7 @@ int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const*
|
|
|
110
169
|
|
|
111
170
|
int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond)
|
|
112
171
|
{
|
|
172
|
+
assert(cond != NULL);
|
|
113
173
|
if (!*cond)
|
|
114
174
|
return 0;
|
|
115
175
|
{
|
|
@@ -16,15 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
#include "debug.h"
|
|
18
18
|
|
|
19
|
-
#if defined (__cplusplus)
|
|
20
|
-
extern "C" {
|
|
21
|
-
#endif
|
|
22
|
-
|
|
23
19
|
#if defined(ZSTD_MULTITHREAD) && defined(_WIN32)
|
|
24
20
|
|
|
25
21
|
/**
|
|
26
|
-
* Windows minimalist Pthread Wrapper
|
|
27
|
-
* http://www.cse.wustl.edu/~schmidt/win32-cv-1.html
|
|
22
|
+
* Windows minimalist Pthread Wrapper
|
|
28
23
|
*/
|
|
29
24
|
#ifdef WINVER
|
|
30
25
|
# undef WINVER
|
|
@@ -62,22 +57,17 @@ extern "C" {
|
|
|
62
57
|
#define ZSTD_pthread_cond_broadcast(a) WakeAllConditionVariable((a))
|
|
63
58
|
|
|
64
59
|
/* ZSTD_pthread_create() and ZSTD_pthread_join() */
|
|
65
|
-
typedef
|
|
66
|
-
HANDLE handle;
|
|
67
|
-
void* (*start_routine)(void*);
|
|
68
|
-
void* arg;
|
|
69
|
-
} ZSTD_pthread_t;
|
|
60
|
+
typedef HANDLE ZSTD_pthread_t;
|
|
70
61
|
|
|
71
62
|
int ZSTD_pthread_create(ZSTD_pthread_t* thread, const void* unused,
|
|
72
63
|
void* (*start_routine) (void*), void* arg);
|
|
73
64
|
|
|
74
|
-
int ZSTD_pthread_join(ZSTD_pthread_t thread
|
|
65
|
+
int ZSTD_pthread_join(ZSTD_pthread_t thread);
|
|
75
66
|
|
|
76
67
|
/**
|
|
77
68
|
* add here more wrappers as required
|
|
78
69
|
*/
|
|
79
70
|
|
|
80
|
-
|
|
81
71
|
#elif defined(ZSTD_MULTITHREAD) /* posix assumed ; need a better detection method */
|
|
82
72
|
/* === POSIX Systems === */
|
|
83
73
|
# include <pthread.h>
|
|
@@ -99,7 +89,7 @@ int ZSTD_pthread_join(ZSTD_pthread_t thread, void** value_ptr);
|
|
|
99
89
|
|
|
100
90
|
#define ZSTD_pthread_t pthread_t
|
|
101
91
|
#define ZSTD_pthread_create(a, b, c, d) pthread_create((a), (b), (c), (d))
|
|
102
|
-
#define ZSTD_pthread_join(a
|
|
92
|
+
#define ZSTD_pthread_join(a) pthread_join((a),NULL)
|
|
103
93
|
|
|
104
94
|
#else /* DEBUGLEVEL >= 1 */
|
|
105
95
|
|
|
@@ -124,7 +114,7 @@ int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond);
|
|
|
124
114
|
|
|
125
115
|
#define ZSTD_pthread_t pthread_t
|
|
126
116
|
#define ZSTD_pthread_create(a, b, c, d) pthread_create((a), (b), (c), (d))
|
|
127
|
-
#define ZSTD_pthread_join(a
|
|
117
|
+
#define ZSTD_pthread_join(a) pthread_join((a),NULL)
|
|
128
118
|
|
|
129
119
|
#endif
|
|
130
120
|
|
|
@@ -148,8 +138,5 @@ typedef int ZSTD_pthread_cond_t;
|
|
|
148
138
|
|
|
149
139
|
#endif /* ZSTD_MULTITHREAD */
|
|
150
140
|
|
|
151
|
-
#if defined (__cplusplus)
|
|
152
|
-
}
|
|
153
|
-
#endif
|
|
154
141
|
|
|
155
142
|
#endif /* THREADING_H_938743 */
|
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* You can contact the author at :
|
|
6
|
-
* - xxHash homepage: http://www.xxhash.com
|
|
7
|
-
* - xxHash source repository : https://github.com/Cyan4973/xxHash
|
|
2
|
+
* xxHash - Extremely Fast Hash algorithm
|
|
3
|
+
* Copyright (c) Yann Collet - Meta Platforms, Inc
|
|
8
4
|
*
|
|
9
5
|
* This source code is licensed under both the BSD-style license (found in the
|
|
10
6
|
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
|
11
7
|
* in the COPYING file in the root directory of this source tree).
|
|
12
8
|
* You may select, at your option, one of the above-listed licenses.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
*/
|
|
16
10
|
|
|
17
11
|
/*
|
|
18
12
|
* xxhash.c instantiates functions defined in xxhash.h
|
|
19
13
|
*/
|
|
20
14
|
|
|
21
|
-
#define XXH_STATIC_LINKING_ONLY
|
|
22
|
-
#define XXH_IMPLEMENTATION
|
|
15
|
+
#define XXH_STATIC_LINKING_ONLY /* access advanced declarations */
|
|
16
|
+
#define XXH_IMPLEMENTATION /* access definitions */
|
|
23
17
|
|
|
24
18
|
#include "xxhash.h"
|