zstd-ruby 1.4.4.0 → 1.5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/ruby.yml +35 -0
- data/README.md +2 -2
- data/ext/zstdruby/extconf.rb +1 -0
- data/ext/zstdruby/libzstd/BUCK +5 -7
- data/ext/zstdruby/libzstd/Makefile +241 -173
- data/ext/zstdruby/libzstd/README.md +76 -18
- data/ext/zstdruby/libzstd/common/bitstream.h +75 -57
- data/ext/zstdruby/libzstd/common/compiler.h +196 -20
- data/ext/zstdruby/libzstd/common/cpu.h +1 -3
- data/ext/zstdruby/libzstd/common/debug.c +11 -31
- data/ext/zstdruby/libzstd/common/debug.h +22 -49
- data/ext/zstdruby/libzstd/common/entropy_common.c +208 -76
- data/ext/zstdruby/libzstd/common/error_private.c +3 -1
- data/ext/zstdruby/libzstd/common/error_private.h +87 -4
- data/ext/zstdruby/libzstd/common/fse.h +51 -42
- data/ext/zstdruby/libzstd/common/fse_decompress.c +149 -57
- data/ext/zstdruby/libzstd/common/huf.h +60 -54
- data/ext/zstdruby/libzstd/common/mem.h +87 -98
- data/ext/zstdruby/libzstd/common/pool.c +23 -17
- data/ext/zstdruby/libzstd/common/pool.h +3 -3
- data/ext/zstdruby/libzstd/common/portability_macros.h +131 -0
- data/ext/zstdruby/libzstd/common/threading.c +10 -8
- data/ext/zstdruby/libzstd/common/threading.h +4 -3
- data/ext/zstdruby/libzstd/common/xxhash.c +15 -873
- data/ext/zstdruby/libzstd/common/xxhash.h +5572 -191
- data/ext/zstdruby/libzstd/common/zstd_common.c +10 -10
- data/ext/zstdruby/libzstd/common/zstd_deps.h +111 -0
- data/ext/zstdruby/libzstd/common/zstd_internal.h +252 -108
- data/ext/zstdruby/libzstd/common/zstd_trace.h +163 -0
- data/ext/zstdruby/libzstd/compress/clevels.h +134 -0
- data/ext/zstdruby/libzstd/compress/fse_compress.c +105 -85
- data/ext/zstdruby/libzstd/compress/hist.c +41 -63
- data/ext/zstdruby/libzstd/compress/hist.h +13 -33
- data/ext/zstdruby/libzstd/compress/huf_compress.c +831 -259
- data/ext/zstdruby/libzstd/compress/zstd_compress.c +3213 -1007
- data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +493 -71
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.c +21 -16
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.h +4 -2
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +51 -24
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.h +10 -3
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +573 -0
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.h +32 -0
- data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +208 -81
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +315 -137
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.h +2 -2
- data/ext/zstdruby/libzstd/compress/zstd_fast.c +319 -128
- data/ext/zstdruby/libzstd/compress/zstd_fast.h +2 -2
- data/ext/zstdruby/libzstd/compress/zstd_lazy.c +1156 -171
- data/ext/zstdruby/libzstd/compress/zstd_lazy.h +59 -1
- data/ext/zstdruby/libzstd/compress/zstd_ldm.c +331 -206
- data/ext/zstdruby/libzstd/compress/zstd_ldm.h +15 -3
- data/ext/zstdruby/libzstd/compress/zstd_ldm_geartab.h +106 -0
- data/ext/zstdruby/libzstd/compress/zstd_opt.c +403 -226
- data/ext/zstdruby/libzstd/compress/zstd_opt.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +188 -453
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +32 -114
- data/ext/zstdruby/libzstd/decompress/huf_decompress.c +1065 -410
- data/ext/zstdruby/libzstd/decompress/huf_decompress_amd64.S +571 -0
- data/ext/zstdruby/libzstd/decompress/zstd_ddict.c +20 -16
- data/ext/zstdruby/libzstd/decompress/zstd_ddict.h +3 -3
- data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +691 -230
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.c +1072 -323
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.h +16 -7
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h +71 -10
- data/ext/zstdruby/libzstd/deprecated/zbuff.h +3 -3
- data/ext/zstdruby/libzstd/deprecated/zbuff_common.c +2 -2
- data/ext/zstdruby/libzstd/deprecated/zbuff_compress.c +24 -4
- data/ext/zstdruby/libzstd/deprecated/zbuff_decompress.c +1 -1
- data/ext/zstdruby/libzstd/dictBuilder/cover.c +57 -40
- data/ext/zstdruby/libzstd/dictBuilder/cover.h +20 -9
- data/ext/zstdruby/libzstd/dictBuilder/divsufsort.c +1 -1
- data/ext/zstdruby/libzstd/dictBuilder/fastcover.c +54 -35
- data/ext/zstdruby/libzstd/dictBuilder/zdict.c +151 -57
- data/ext/zstdruby/libzstd/dll/example/Makefile +2 -1
- data/ext/zstdruby/libzstd/dll/example/README.md +16 -22
- data/ext/zstdruby/libzstd/legacy/zstd_legacy.h +4 -4
- data/ext/zstdruby/libzstd/legacy/zstd_v01.c +25 -19
- data/ext/zstdruby/libzstd/legacy/zstd_v01.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v02.c +18 -14
- data/ext/zstdruby/libzstd/legacy/zstd_v02.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v03.c +18 -14
- data/ext/zstdruby/libzstd/legacy/zstd_v03.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v04.c +22 -16
- data/ext/zstdruby/libzstd/legacy/zstd_v04.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v05.c +29 -25
- data/ext/zstdruby/libzstd/legacy/zstd_v05.h +2 -2
- data/ext/zstdruby/libzstd/legacy/zstd_v06.c +29 -25
- data/ext/zstdruby/libzstd/legacy/zstd_v06.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v07.c +34 -26
- data/ext/zstdruby/libzstd/legacy/zstd_v07.h +1 -1
- data/ext/zstdruby/libzstd/libzstd.mk +185 -0
- data/ext/zstdruby/libzstd/libzstd.pc.in +4 -3
- data/ext/zstdruby/libzstd/modulemap/module.modulemap +4 -0
- data/ext/zstdruby/libzstd/{dictBuilder/zdict.h → zdict.h} +201 -31
- data/ext/zstdruby/libzstd/zstd.h +760 -234
- data/ext/zstdruby/libzstd/{common/zstd_errors.h → zstd_errors.h} +3 -1
- data/ext/zstdruby/zstdruby.c +2 -2
- data/lib/zstd-ruby/version.rb +1 -1
- metadata +20 -9
- data/.travis.yml +0 -14
@@ -0,0 +1,131 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) Facebook, Inc.
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* This source code is licensed under both the BSD-style license (found in the
|
6
|
+
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
7
|
+
* in the COPYING file in the root directory of this source tree).
|
8
|
+
* You may select, at your option, one of the above-listed licenses.
|
9
|
+
*/
|
10
|
+
|
11
|
+
#ifndef ZSTD_PORTABILITY_MACROS_H
|
12
|
+
#define ZSTD_PORTABILITY_MACROS_H
|
13
|
+
|
14
|
+
/**
|
15
|
+
* This header file contains macro defintions to support portability.
|
16
|
+
* This header is shared between C and ASM code, so it MUST only
|
17
|
+
* contain macro definitions. It MUST not contain any C code.
|
18
|
+
*
|
19
|
+
* This header ONLY defines macros to detect platforms/feature support.
|
20
|
+
*
|
21
|
+
*/
|
22
|
+
|
23
|
+
|
24
|
+
/* compat. with non-clang compilers */
|
25
|
+
#ifndef __has_attribute
|
26
|
+
#define __has_attribute(x) 0
|
27
|
+
#endif
|
28
|
+
|
29
|
+
/* compat. with non-clang compilers */
|
30
|
+
#ifndef __has_builtin
|
31
|
+
# define __has_builtin(x) 0
|
32
|
+
#endif
|
33
|
+
|
34
|
+
/* compat. with non-clang compilers */
|
35
|
+
#ifndef __has_feature
|
36
|
+
# define __has_feature(x) 0
|
37
|
+
#endif
|
38
|
+
|
39
|
+
/* detects whether we are being compiled under msan */
|
40
|
+
#ifndef ZSTD_MEMORY_SANITIZER
|
41
|
+
# if __has_feature(memory_sanitizer)
|
42
|
+
# define ZSTD_MEMORY_SANITIZER 1
|
43
|
+
# else
|
44
|
+
# define ZSTD_MEMORY_SANITIZER 0
|
45
|
+
# endif
|
46
|
+
#endif
|
47
|
+
|
48
|
+
/* detects whether we are being compiled under asan */
|
49
|
+
#ifndef ZSTD_ADDRESS_SANITIZER
|
50
|
+
# if __has_feature(address_sanitizer)
|
51
|
+
# define ZSTD_ADDRESS_SANITIZER 1
|
52
|
+
# elif defined(__SANITIZE_ADDRESS__)
|
53
|
+
# define ZSTD_ADDRESS_SANITIZER 1
|
54
|
+
# else
|
55
|
+
# define ZSTD_ADDRESS_SANITIZER 0
|
56
|
+
# endif
|
57
|
+
#endif
|
58
|
+
|
59
|
+
/* detects whether we are being compiled under dfsan */
|
60
|
+
#ifndef ZSTD_DATAFLOW_SANITIZER
|
61
|
+
# if __has_feature(dataflow_sanitizer)
|
62
|
+
# define ZSTD_DATAFLOW_SANITIZER 1
|
63
|
+
# else
|
64
|
+
# define ZSTD_DATAFLOW_SANITIZER 0
|
65
|
+
# endif
|
66
|
+
#endif
|
67
|
+
|
68
|
+
|
69
|
+
/* Enable runtime BMI2 dispatch based on the CPU.
|
70
|
+
* Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default.
|
71
|
+
*/
|
72
|
+
#ifndef DYNAMIC_BMI2
|
73
|
+
#if ((defined(__clang__) && __has_attribute(__target__)) \
|
74
|
+
|| (defined(__GNUC__) \
|
75
|
+
&& (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))) \
|
76
|
+
&& (defined(__x86_64__) || defined(_M_X64)) \
|
77
|
+
&& !defined(__BMI2__)
|
78
|
+
# define DYNAMIC_BMI2 1
|
79
|
+
#else
|
80
|
+
# define DYNAMIC_BMI2 0
|
81
|
+
#endif
|
82
|
+
#endif
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Only enable assembly for GNUC comptabile compilers,
|
86
|
+
* because other platforms may not support GAS assembly syntax.
|
87
|
+
*
|
88
|
+
* Only enable assembly for Linux / MacOS, other platforms may
|
89
|
+
* work, but they haven't been tested. This could likely be
|
90
|
+
* extended to BSD systems.
|
91
|
+
*
|
92
|
+
* Disable assembly when MSAN is enabled, because MSAN requires
|
93
|
+
* 100% of code to be instrumented to work.
|
94
|
+
*/
|
95
|
+
#if defined(__GNUC__)
|
96
|
+
# if defined(__linux__) || defined(__linux) || defined(__APPLE__)
|
97
|
+
# if ZSTD_MEMORY_SANITIZER
|
98
|
+
# define ZSTD_ASM_SUPPORTED 0
|
99
|
+
# elif ZSTD_DATAFLOW_SANITIZER
|
100
|
+
# define ZSTD_ASM_SUPPORTED 0
|
101
|
+
# else
|
102
|
+
# define ZSTD_ASM_SUPPORTED 1
|
103
|
+
# endif
|
104
|
+
# else
|
105
|
+
# define ZSTD_ASM_SUPPORTED 0
|
106
|
+
# endif
|
107
|
+
#else
|
108
|
+
# define ZSTD_ASM_SUPPORTED 0
|
109
|
+
#endif
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Determines whether we should enable assembly for x86-64
|
113
|
+
* with BMI2.
|
114
|
+
*
|
115
|
+
* Enable if all of the following conditions hold:
|
116
|
+
* - ASM hasn't been explicitly disabled by defining ZSTD_DISABLE_ASM
|
117
|
+
* - Assembly is supported
|
118
|
+
* - We are compiling for x86-64 and either:
|
119
|
+
* - DYNAMIC_BMI2 is enabled
|
120
|
+
* - BMI2 is supported at compile time
|
121
|
+
*/
|
122
|
+
#if !defined(ZSTD_DISABLE_ASM) && \
|
123
|
+
ZSTD_ASM_SUPPORTED && \
|
124
|
+
defined(__x86_64__) && \
|
125
|
+
(DYNAMIC_BMI2 || defined(__BMI2__))
|
126
|
+
# define ZSTD_ENABLE_ASM_X86_64_BMI2 1
|
127
|
+
#else
|
128
|
+
# define ZSTD_ENABLE_ASM_X86_64_BMI2 0
|
129
|
+
#endif
|
130
|
+
|
131
|
+
#endif /* ZSTD_PORTABILITY_MACROS_H */
|
@@ -2,12 +2,13 @@
|
|
2
2
|
* Copyright (c) 2016 Tino Reichardt
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
|
+
* You can contact the author at:
|
6
|
+
* - zstdmt source repository: https://github.com/mcmilk/zstdmt
|
7
|
+
*
|
5
8
|
* This source code is licensed under both the BSD-style license (found in the
|
6
9
|
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
7
10
|
* in the COPYING file in the root directory of this source tree).
|
8
|
-
*
|
9
|
-
* You can contact the author at:
|
10
|
-
* - zstdmt source repository: https://github.com/mcmilk/zstdmt
|
11
|
+
* You may select, at your option, one of the above-listed licenses.
|
11
12
|
*/
|
12
13
|
|
13
14
|
/**
|
@@ -77,11 +78,12 @@ int ZSTD_pthread_join(ZSTD_pthread_t thread, void **value_ptr)
|
|
77
78
|
|
78
79
|
#if defined(ZSTD_MULTITHREAD) && DEBUGLEVEL >= 1 && !defined(_WIN32)
|
79
80
|
|
80
|
-
#
|
81
|
+
#define ZSTD_DEPS_NEED_MALLOC
|
82
|
+
#include "zstd_deps.h"
|
81
83
|
|
82
84
|
int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t const* attr)
|
83
85
|
{
|
84
|
-
*mutex = (pthread_mutex_t*)
|
86
|
+
*mutex = (pthread_mutex_t*)ZSTD_malloc(sizeof(pthread_mutex_t));
|
85
87
|
if (!*mutex)
|
86
88
|
return 1;
|
87
89
|
return pthread_mutex_init(*mutex, attr);
|
@@ -93,14 +95,14 @@ int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex)
|
|
93
95
|
return 0;
|
94
96
|
{
|
95
97
|
int const ret = pthread_mutex_destroy(*mutex);
|
96
|
-
|
98
|
+
ZSTD_free(*mutex);
|
97
99
|
return ret;
|
98
100
|
}
|
99
101
|
}
|
100
102
|
|
101
103
|
int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const* attr)
|
102
104
|
{
|
103
|
-
*cond = (pthread_cond_t*)
|
105
|
+
*cond = (pthread_cond_t*)ZSTD_malloc(sizeof(pthread_cond_t));
|
104
106
|
if (!*cond)
|
105
107
|
return 1;
|
106
108
|
return pthread_cond_init(*cond, attr);
|
@@ -112,7 +114,7 @@ int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond)
|
|
112
114
|
return 0;
|
113
115
|
{
|
114
116
|
int const ret = pthread_cond_destroy(*cond);
|
115
|
-
|
117
|
+
ZSTD_free(*cond);
|
116
118
|
return ret;
|
117
119
|
}
|
118
120
|
}
|
@@ -2,12 +2,13 @@
|
|
2
2
|
* Copyright (c) 2016 Tino Reichardt
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
|
+
* You can contact the author at:
|
6
|
+
* - zstdmt source repository: https://github.com/mcmilk/zstdmt
|
7
|
+
*
|
5
8
|
* This source code is licensed under both the BSD-style license (found in the
|
6
9
|
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
7
10
|
* in the COPYING file in the root directory of this source tree).
|
8
|
-
*
|
9
|
-
* You can contact the author at:
|
10
|
-
* - zstdmt source repository: https://github.com/mcmilk/zstdmt
|
11
|
+
* You may select, at your option, one of the above-listed licenses.
|
11
12
|
*/
|
12
13
|
|
13
14
|
#ifndef THREADING_H_938743
|