diff options
Diffstat (limited to 'examples/redis-unstable/deps/jemalloc/test/include')
30 files changed, 3334 insertions, 0 deletions
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-alti.h b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-alti.h new file mode 100644 index 0000000..a1885db --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-alti.h | |||
| @@ -0,0 +1,186 @@ | |||
| 1 | /* | ||
| 2 | * This file derives from SFMT 1.3.3 | ||
| 3 | * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was | ||
| 4 | * released under the terms of the following license: | ||
| 5 | * | ||
| 6 | * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 7 | * University. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions are | ||
| 11 | * met: | ||
| 12 | * | ||
| 13 | * * Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * * Redistributions in binary form must reproduce the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer in the documentation and/or other materials provided | ||
| 18 | * with the distribution. | ||
| 19 | * * Neither the name of the Hiroshima University nor the names of | ||
| 20 | * its contributors may be used to endorse or promote products | ||
| 21 | * derived from this software without specific prior written | ||
| 22 | * permission. | ||
| 23 | * | ||
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 35 | */ | ||
| 36 | /** | ||
| 37 | * @file SFMT-alti.h | ||
| 38 | * | ||
| 39 | * @brief SIMD oriented Fast Mersenne Twister(SFMT) | ||
| 40 | * pseudorandom number generator | ||
| 41 | * | ||
| 42 | * @author Mutsuo Saito (Hiroshima University) | ||
| 43 | * @author Makoto Matsumoto (Hiroshima University) | ||
| 44 | * | ||
| 45 | * Copyright (C) 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 46 | * University. All rights reserved. | ||
| 47 | * | ||
| 48 | * The new BSD License is applied to this software. | ||
| 49 | * see LICENSE.txt | ||
| 50 | */ | ||
| 51 | |||
| 52 | #ifndef SFMT_ALTI_H | ||
| 53 | #define SFMT_ALTI_H | ||
| 54 | |||
| 55 | /** | ||
| 56 | * This function represents the recursion formula in AltiVec and BIG ENDIAN. | ||
| 57 | * @param a a 128-bit part of the interal state array | ||
| 58 | * @param b a 128-bit part of the interal state array | ||
| 59 | * @param c a 128-bit part of the interal state array | ||
| 60 | * @param d a 128-bit part of the interal state array | ||
| 61 | * @return output | ||
| 62 | */ | ||
| 63 | JEMALLOC_ALWAYS_INLINE | ||
| 64 | vector unsigned int vec_recursion(vector unsigned int a, | ||
| 65 | vector unsigned int b, | ||
| 66 | vector unsigned int c, | ||
| 67 | vector unsigned int d) { | ||
| 68 | |||
| 69 | const vector unsigned int sl1 = ALTI_SL1; | ||
| 70 | const vector unsigned int sr1 = ALTI_SR1; | ||
| 71 | #ifdef ONLY64 | ||
| 72 | const vector unsigned int mask = ALTI_MSK64; | ||
| 73 | const vector unsigned char perm_sl = ALTI_SL2_PERM64; | ||
| 74 | const vector unsigned char perm_sr = ALTI_SR2_PERM64; | ||
| 75 | #else | ||
| 76 | const vector unsigned int mask = ALTI_MSK; | ||
| 77 | const vector unsigned char perm_sl = ALTI_SL2_PERM; | ||
| 78 | const vector unsigned char perm_sr = ALTI_SR2_PERM; | ||
| 79 | #endif | ||
| 80 | vector unsigned int v, w, x, y, z; | ||
| 81 | x = vec_perm(a, (vector unsigned int)perm_sl, perm_sl); | ||
| 82 | v = a; | ||
| 83 | y = vec_sr(b, sr1); | ||
| 84 | z = vec_perm(c, (vector unsigned int)perm_sr, perm_sr); | ||
| 85 | w = vec_sl(d, sl1); | ||
| 86 | z = vec_xor(z, w); | ||
| 87 | y = vec_and(y, mask); | ||
| 88 | v = vec_xor(v, x); | ||
| 89 | z = vec_xor(z, y); | ||
| 90 | z = vec_xor(z, v); | ||
| 91 | return z; | ||
| 92 | } | ||
| 93 | |||
| 94 | /** | ||
| 95 | * This function fills the internal state array with pseudorandom | ||
| 96 | * integers. | ||
| 97 | */ | ||
| 98 | static inline void gen_rand_all(sfmt_t *ctx) { | ||
| 99 | int i; | ||
| 100 | vector unsigned int r, r1, r2; | ||
| 101 | |||
| 102 | r1 = ctx->sfmt[N - 2].s; | ||
| 103 | r2 = ctx->sfmt[N - 1].s; | ||
| 104 | for (i = 0; i < N - POS1; i++) { | ||
| 105 | r = vec_recursion(ctx->sfmt[i].s, ctx->sfmt[i + POS1].s, r1, r2); | ||
| 106 | ctx->sfmt[i].s = r; | ||
| 107 | r1 = r2; | ||
| 108 | r2 = r; | ||
| 109 | } | ||
| 110 | for (; i < N; i++) { | ||
| 111 | r = vec_recursion(ctx->sfmt[i].s, ctx->sfmt[i + POS1 - N].s, r1, r2); | ||
| 112 | ctx->sfmt[i].s = r; | ||
| 113 | r1 = r2; | ||
| 114 | r2 = r; | ||
| 115 | } | ||
| 116 | } | ||
| 117 | |||
| 118 | /** | ||
| 119 | * This function fills the user-specified array with pseudorandom | ||
| 120 | * integers. | ||
| 121 | * | ||
| 122 | * @param array an 128-bit array to be filled by pseudorandom numbers. | ||
| 123 | * @param size number of 128-bit pesudorandom numbers to be generated. | ||
| 124 | */ | ||
| 125 | static inline void gen_rand_array(sfmt_t *ctx, w128_t *array, int size) { | ||
| 126 | int i, j; | ||
| 127 | vector unsigned int r, r1, r2; | ||
| 128 | |||
| 129 | r1 = ctx->sfmt[N - 2].s; | ||
| 130 | r2 = ctx->sfmt[N - 1].s; | ||
| 131 | for (i = 0; i < N - POS1; i++) { | ||
| 132 | r = vec_recursion(ctx->sfmt[i].s, ctx->sfmt[i + POS1].s, r1, r2); | ||
| 133 | array[i].s = r; | ||
| 134 | r1 = r2; | ||
| 135 | r2 = r; | ||
| 136 | } | ||
| 137 | for (; i < N; i++) { | ||
| 138 | r = vec_recursion(ctx->sfmt[i].s, array[i + POS1 - N].s, r1, r2); | ||
| 139 | array[i].s = r; | ||
| 140 | r1 = r2; | ||
| 141 | r2 = r; | ||
| 142 | } | ||
| 143 | /* main loop */ | ||
| 144 | for (; i < size - N; i++) { | ||
| 145 | r = vec_recursion(array[i - N].s, array[i + POS1 - N].s, r1, r2); | ||
| 146 | array[i].s = r; | ||
| 147 | r1 = r2; | ||
| 148 | r2 = r; | ||
| 149 | } | ||
| 150 | for (j = 0; j < 2 * N - size; j++) { | ||
| 151 | ctx->sfmt[j].s = array[j + size - N].s; | ||
| 152 | } | ||
| 153 | for (; i < size; i++) { | ||
| 154 | r = vec_recursion(array[i - N].s, array[i + POS1 - N].s, r1, r2); | ||
| 155 | array[i].s = r; | ||
| 156 | ctx->sfmt[j++].s = r; | ||
| 157 | r1 = r2; | ||
| 158 | r2 = r; | ||
| 159 | } | ||
| 160 | } | ||
| 161 | |||
| 162 | #ifndef ONLY64 | ||
| 163 | #if defined(__APPLE__) | ||
| 164 | #define ALTI_SWAP (vector unsigned char) \ | ||
| 165 | (4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11) | ||
| 166 | #else | ||
| 167 | #define ALTI_SWAP {4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11} | ||
| 168 | #endif | ||
| 169 | /** | ||
| 170 | * This function swaps high and low 32-bit of 64-bit integers in user | ||
| 171 | * specified array. | ||
| 172 | * | ||
| 173 | * @param array an 128-bit array to be swaped. | ||
| 174 | * @param size size of 128-bit array. | ||
| 175 | */ | ||
| 176 | static inline void swap(w128_t *array, int size) { | ||
| 177 | int i; | ||
| 178 | const vector unsigned char perm = ALTI_SWAP; | ||
| 179 | |||
| 180 | for (i = 0; i < size; i++) { | ||
| 181 | array[i].s = vec_perm(array[i].s, (vector unsigned int)perm, perm); | ||
| 182 | } | ||
| 183 | } | ||
| 184 | #endif | ||
| 185 | |||
| 186 | #endif | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params.h b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params.h new file mode 100644 index 0000000..ade6622 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params.h | |||
| @@ -0,0 +1,132 @@ | |||
| 1 | /* | ||
| 2 | * This file derives from SFMT 1.3.3 | ||
| 3 | * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was | ||
| 4 | * released under the terms of the following license: | ||
| 5 | * | ||
| 6 | * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 7 | * University. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions are | ||
| 11 | * met: | ||
| 12 | * | ||
| 13 | * * Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * * Redistributions in binary form must reproduce the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer in the documentation and/or other materials provided | ||
| 18 | * with the distribution. | ||
| 19 | * * Neither the name of the Hiroshima University nor the names of | ||
| 20 | * its contributors may be used to endorse or promote products | ||
| 21 | * derived from this software without specific prior written | ||
| 22 | * permission. | ||
| 23 | * | ||
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 35 | */ | ||
| 36 | #ifndef SFMT_PARAMS_H | ||
| 37 | #define SFMT_PARAMS_H | ||
| 38 | |||
| 39 | #if !defined(MEXP) | ||
| 40 | #ifdef __GNUC__ | ||
| 41 | #warning "MEXP is not defined. I assume MEXP is 19937." | ||
| 42 | #endif | ||
| 43 | #define MEXP 19937 | ||
| 44 | #endif | ||
| 45 | /*----------------- | ||
| 46 | BASIC DEFINITIONS | ||
| 47 | -----------------*/ | ||
| 48 | /** Mersenne Exponent. The period of the sequence | ||
| 49 | * is a multiple of 2^MEXP-1. | ||
| 50 | * #define MEXP 19937 */ | ||
| 51 | /** SFMT generator has an internal state array of 128-bit integers, | ||
| 52 | * and N is its size. */ | ||
| 53 | #define N (MEXP / 128 + 1) | ||
| 54 | /** N32 is the size of internal state array when regarded as an array | ||
| 55 | * of 32-bit integers.*/ | ||
| 56 | #define N32 (N * 4) | ||
| 57 | /** N64 is the size of internal state array when regarded as an array | ||
| 58 | * of 64-bit integers.*/ | ||
| 59 | #define N64 (N * 2) | ||
| 60 | |||
| 61 | /*---------------------- | ||
| 62 | the parameters of SFMT | ||
| 63 | following definitions are in paramsXXXX.h file. | ||
| 64 | ----------------------*/ | ||
| 65 | /** the pick up position of the array. | ||
| 66 | #define POS1 122 | ||
| 67 | */ | ||
| 68 | |||
| 69 | /** the parameter of shift left as four 32-bit registers. | ||
| 70 | #define SL1 18 | ||
| 71 | */ | ||
| 72 | |||
| 73 | /** the parameter of shift left as one 128-bit register. | ||
| 74 | * The 128-bit integer is shifted by (SL2 * 8) bits. | ||
| 75 | #define SL2 1 | ||
| 76 | */ | ||
| 77 | |||
| 78 | /** the parameter of shift right as four 32-bit registers. | ||
| 79 | #define SR1 11 | ||
| 80 | */ | ||
| 81 | |||
| 82 | /** the parameter of shift right as one 128-bit register. | ||
| 83 | * The 128-bit integer is shifted by (SL2 * 8) bits. | ||
| 84 | #define SR2 1 | ||
| 85 | */ | ||
| 86 | |||
| 87 | /** A bitmask, used in the recursion. These parameters are introduced | ||
| 88 | * to break symmetry of SIMD. | ||
| 89 | #define MSK1 0xdfffffefU | ||
| 90 | #define MSK2 0xddfecb7fU | ||
| 91 | #define MSK3 0xbffaffffU | ||
| 92 | #define MSK4 0xbffffff6U | ||
| 93 | */ | ||
| 94 | |||
| 95 | /** These definitions are part of a 128-bit period certification vector. | ||
| 96 | #define PARITY1 0x00000001U | ||
| 97 | #define PARITY2 0x00000000U | ||
| 98 | #define PARITY3 0x00000000U | ||
| 99 | #define PARITY4 0xc98e126aU | ||
| 100 | */ | ||
| 101 | |||
| 102 | #if MEXP == 607 | ||
| 103 | #include "test/SFMT-params607.h" | ||
| 104 | #elif MEXP == 1279 | ||
| 105 | #include "test/SFMT-params1279.h" | ||
| 106 | #elif MEXP == 2281 | ||
| 107 | #include "test/SFMT-params2281.h" | ||
| 108 | #elif MEXP == 4253 | ||
| 109 | #include "test/SFMT-params4253.h" | ||
| 110 | #elif MEXP == 11213 | ||
| 111 | #include "test/SFMT-params11213.h" | ||
| 112 | #elif MEXP == 19937 | ||
| 113 | #include "test/SFMT-params19937.h" | ||
| 114 | #elif MEXP == 44497 | ||
| 115 | #include "test/SFMT-params44497.h" | ||
| 116 | #elif MEXP == 86243 | ||
| 117 | #include "test/SFMT-params86243.h" | ||
| 118 | #elif MEXP == 132049 | ||
| 119 | #include "test/SFMT-params132049.h" | ||
| 120 | #elif MEXP == 216091 | ||
| 121 | #include "test/SFMT-params216091.h" | ||
| 122 | #else | ||
| 123 | #ifdef __GNUC__ | ||
| 124 | #error "MEXP is not valid." | ||
| 125 | #undef MEXP | ||
| 126 | #else | ||
| 127 | #undef MEXP | ||
| 128 | #endif | ||
| 129 | |||
| 130 | #endif | ||
| 131 | |||
| 132 | #endif /* SFMT_PARAMS_H */ | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params11213.h b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params11213.h new file mode 100644 index 0000000..2994bd2 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params11213.h | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | /* | ||
| 2 | * This file derives from SFMT 1.3.3 | ||
| 3 | * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was | ||
| 4 | * released under the terms of the following license: | ||
| 5 | * | ||
| 6 | * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 7 | * University. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions are | ||
| 11 | * met: | ||
| 12 | * | ||
| 13 | * * Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * * Redistributions in binary form must reproduce the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer in the documentation and/or other materials provided | ||
| 18 | * with the distribution. | ||
| 19 | * * Neither the name of the Hiroshima University nor the names of | ||
| 20 | * its contributors may be used to endorse or promote products | ||
| 21 | * derived from this software without specific prior written | ||
| 22 | * permission. | ||
| 23 | * | ||
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 35 | */ | ||
| 36 | #ifndef SFMT_PARAMS11213_H | ||
| 37 | #define SFMT_PARAMS11213_H | ||
| 38 | |||
| 39 | #define POS1 68 | ||
| 40 | #define SL1 14 | ||
| 41 | #define SL2 3 | ||
| 42 | #define SR1 7 | ||
| 43 | #define SR2 3 | ||
| 44 | #define MSK1 0xeffff7fbU | ||
| 45 | #define MSK2 0xffffffefU | ||
| 46 | #define MSK3 0xdfdfbfffU | ||
| 47 | #define MSK4 0x7fffdbfdU | ||
| 48 | #define PARITY1 0x00000001U | ||
| 49 | #define PARITY2 0x00000000U | ||
| 50 | #define PARITY3 0xe8148000U | ||
| 51 | #define PARITY4 0xd0c7afa3U | ||
| 52 | |||
| 53 | |||
| 54 | /* PARAMETERS FOR ALTIVEC */ | ||
| 55 | #if defined(__APPLE__) /* For OSX */ | ||
| 56 | #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1) | ||
| 57 | #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1) | ||
| 58 | #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4) | ||
| 59 | #define ALTI_MSK64 \ | ||
| 60 | (vector unsigned int)(MSK2, MSK1, MSK4, MSK3) | ||
| 61 | #define ALTI_SL2_PERM \ | ||
| 62 | (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10) | ||
| 63 | #define ALTI_SL2_PERM64 \ | ||
| 64 | (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2) | ||
| 65 | #define ALTI_SR2_PERM \ | ||
| 66 | (vector unsigned char)(5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12) | ||
| 67 | #define ALTI_SR2_PERM64 \ | ||
| 68 | (vector unsigned char)(13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12) | ||
| 69 | #else /* For OTHER OSs(Linux?) */ | ||
| 70 | #define ALTI_SL1 {SL1, SL1, SL1, SL1} | ||
| 71 | #define ALTI_SR1 {SR1, SR1, SR1, SR1} | ||
| 72 | #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4} | ||
| 73 | #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3} | ||
| 74 | #define ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10} | ||
| 75 | #define ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2} | ||
| 76 | #define ALTI_SR2_PERM {5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12} | ||
| 77 | #define ALTI_SR2_PERM64 {13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12} | ||
| 78 | #endif /* For OSX */ | ||
| 79 | #define IDSTR "SFMT-11213:68-14-3-7-3:effff7fb-ffffffef-dfdfbfff-7fffdbfd" | ||
| 80 | |||
| 81 | #endif /* SFMT_PARAMS11213_H */ | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params1279.h b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params1279.h new file mode 100644 index 0000000..d7959f9 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params1279.h | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | /* | ||
| 2 | * This file derives from SFMT 1.3.3 | ||
| 3 | * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was | ||
| 4 | * released under the terms of the following license: | ||
| 5 | * | ||
| 6 | * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 7 | * University. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions are | ||
| 11 | * met: | ||
| 12 | * | ||
| 13 | * * Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * * Redistributions in binary form must reproduce the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer in the documentation and/or other materials provided | ||
| 18 | * with the distribution. | ||
| 19 | * * Neither the name of the Hiroshima University nor the names of | ||
| 20 | * its contributors may be used to endorse or promote products | ||
| 21 | * derived from this software without specific prior written | ||
| 22 | * permission. | ||
| 23 | * | ||
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 35 | */ | ||
| 36 | #ifndef SFMT_PARAMS1279_H | ||
| 37 | #define SFMT_PARAMS1279_H | ||
| 38 | |||
| 39 | #define POS1 7 | ||
| 40 | #define SL1 14 | ||
| 41 | #define SL2 3 | ||
| 42 | #define SR1 5 | ||
| 43 | #define SR2 1 | ||
| 44 | #define MSK1 0xf7fefffdU | ||
| 45 | #define MSK2 0x7fefcfffU | ||
| 46 | #define MSK3 0xaff3ef3fU | ||
| 47 | #define MSK4 0xb5ffff7fU | ||
| 48 | #define PARITY1 0x00000001U | ||
| 49 | #define PARITY2 0x00000000U | ||
| 50 | #define PARITY3 0x00000000U | ||
| 51 | #define PARITY4 0x20000000U | ||
| 52 | |||
| 53 | |||
| 54 | /* PARAMETERS FOR ALTIVEC */ | ||
| 55 | #if defined(__APPLE__) /* For OSX */ | ||
| 56 | #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1) | ||
| 57 | #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1) | ||
| 58 | #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4) | ||
| 59 | #define ALTI_MSK64 \ | ||
| 60 | (vector unsigned int)(MSK2, MSK1, MSK4, MSK3) | ||
| 61 | #define ALTI_SL2_PERM \ | ||
| 62 | (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10) | ||
| 63 | #define ALTI_SL2_PERM64 \ | ||
| 64 | (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2) | ||
| 65 | #define ALTI_SR2_PERM \ | ||
| 66 | (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14) | ||
| 67 | #define ALTI_SR2_PERM64 \ | ||
| 68 | (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14) | ||
| 69 | #else /* For OTHER OSs(Linux?) */ | ||
| 70 | #define ALTI_SL1 {SL1, SL1, SL1, SL1} | ||
| 71 | #define ALTI_SR1 {SR1, SR1, SR1, SR1} | ||
| 72 | #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4} | ||
| 73 | #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3} | ||
| 74 | #define ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10} | ||
| 75 | #define ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2} | ||
| 76 | #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14} | ||
| 77 | #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14} | ||
| 78 | #endif /* For OSX */ | ||
| 79 | #define IDSTR "SFMT-1279:7-14-3-5-1:f7fefffd-7fefcfff-aff3ef3f-b5ffff7f" | ||
| 80 | |||
| 81 | #endif /* SFMT_PARAMS1279_H */ | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params132049.h b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params132049.h new file mode 100644 index 0000000..a1dcec3 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params132049.h | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | /* | ||
| 2 | * This file derives from SFMT 1.3.3 | ||
| 3 | * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was | ||
| 4 | * released under the terms of the following license: | ||
| 5 | * | ||
| 6 | * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 7 | * University. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions are | ||
| 11 | * met: | ||
| 12 | * | ||
| 13 | * * Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * * Redistributions in binary form must reproduce the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer in the documentation and/or other materials provided | ||
| 18 | * with the distribution. | ||
| 19 | * * Neither the name of the Hiroshima University nor the names of | ||
| 20 | * its contributors may be used to endorse or promote products | ||
| 21 | * derived from this software without specific prior written | ||
| 22 | * permission. | ||
| 23 | * | ||
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 35 | */ | ||
| 36 | #ifndef SFMT_PARAMS132049_H | ||
| 37 | #define SFMT_PARAMS132049_H | ||
| 38 | |||
| 39 | #define POS1 110 | ||
| 40 | #define SL1 19 | ||
| 41 | #define SL2 1 | ||
| 42 | #define SR1 21 | ||
| 43 | #define SR2 1 | ||
| 44 | #define MSK1 0xffffbb5fU | ||
| 45 | #define MSK2 0xfb6ebf95U | ||
| 46 | #define MSK3 0xfffefffaU | ||
| 47 | #define MSK4 0xcff77fffU | ||
| 48 | #define PARITY1 0x00000001U | ||
| 49 | #define PARITY2 0x00000000U | ||
| 50 | #define PARITY3 0xcb520000U | ||
| 51 | #define PARITY4 0xc7e91c7dU | ||
| 52 | |||
| 53 | |||
| 54 | /* PARAMETERS FOR ALTIVEC */ | ||
| 55 | #if defined(__APPLE__) /* For OSX */ | ||
| 56 | #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1) | ||
| 57 | #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1) | ||
| 58 | #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4) | ||
| 59 | #define ALTI_MSK64 \ | ||
| 60 | (vector unsigned int)(MSK2, MSK1, MSK4, MSK3) | ||
| 61 | #define ALTI_SL2_PERM \ | ||
| 62 | (vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8) | ||
| 63 | #define ALTI_SL2_PERM64 \ | ||
| 64 | (vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0) | ||
| 65 | #define ALTI_SR2_PERM \ | ||
| 66 | (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14) | ||
| 67 | #define ALTI_SR2_PERM64 \ | ||
| 68 | (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14) | ||
| 69 | #else /* For OTHER OSs(Linux?) */ | ||
| 70 | #define ALTI_SL1 {SL1, SL1, SL1, SL1} | ||
| 71 | #define ALTI_SR1 {SR1, SR1, SR1, SR1} | ||
| 72 | #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4} | ||
| 73 | #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3} | ||
| 74 | #define ALTI_SL2_PERM {1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8} | ||
| 75 | #define ALTI_SL2_PERM64 {1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0} | ||
| 76 | #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14} | ||
| 77 | #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14} | ||
| 78 | #endif /* For OSX */ | ||
| 79 | #define IDSTR "SFMT-132049:110-19-1-21-1:ffffbb5f-fb6ebf95-fffefffa-cff77fff" | ||
| 80 | |||
| 81 | #endif /* SFMT_PARAMS132049_H */ | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params19937.h b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params19937.h new file mode 100644 index 0000000..fb92b4c --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params19937.h | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | /* | ||
| 2 | * This file derives from SFMT 1.3.3 | ||
| 3 | * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was | ||
| 4 | * released under the terms of the following license: | ||
| 5 | * | ||
| 6 | * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 7 | * University. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions are | ||
| 11 | * met: | ||
| 12 | * | ||
| 13 | * * Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * * Redistributions in binary form must reproduce the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer in the documentation and/or other materials provided | ||
| 18 | * with the distribution. | ||
| 19 | * * Neither the name of the Hiroshima University nor the names of | ||
| 20 | * its contributors may be used to endorse or promote products | ||
| 21 | * derived from this software without specific prior written | ||
| 22 | * permission. | ||
| 23 | * | ||
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 35 | */ | ||
| 36 | #ifndef SFMT_PARAMS19937_H | ||
| 37 | #define SFMT_PARAMS19937_H | ||
| 38 | |||
| 39 | #define POS1 122 | ||
| 40 | #define SL1 18 | ||
| 41 | #define SL2 1 | ||
| 42 | #define SR1 11 | ||
| 43 | #define SR2 1 | ||
| 44 | #define MSK1 0xdfffffefU | ||
| 45 | #define MSK2 0xddfecb7fU | ||
| 46 | #define MSK3 0xbffaffffU | ||
| 47 | #define MSK4 0xbffffff6U | ||
| 48 | #define PARITY1 0x00000001U | ||
| 49 | #define PARITY2 0x00000000U | ||
| 50 | #define PARITY3 0x00000000U | ||
| 51 | #define PARITY4 0x13c9e684U | ||
| 52 | |||
| 53 | |||
| 54 | /* PARAMETERS FOR ALTIVEC */ | ||
| 55 | #if defined(__APPLE__) /* For OSX */ | ||
| 56 | #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1) | ||
| 57 | #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1) | ||
| 58 | #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4) | ||
| 59 | #define ALTI_MSK64 \ | ||
| 60 | (vector unsigned int)(MSK2, MSK1, MSK4, MSK3) | ||
| 61 | #define ALTI_SL2_PERM \ | ||
| 62 | (vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8) | ||
| 63 | #define ALTI_SL2_PERM64 \ | ||
| 64 | (vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0) | ||
| 65 | #define ALTI_SR2_PERM \ | ||
| 66 | (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14) | ||
| 67 | #define ALTI_SR2_PERM64 \ | ||
| 68 | (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14) | ||
| 69 | #else /* For OTHER OSs(Linux?) */ | ||
| 70 | #define ALTI_SL1 {SL1, SL1, SL1, SL1} | ||
| 71 | #define ALTI_SR1 {SR1, SR1, SR1, SR1} | ||
| 72 | #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4} | ||
| 73 | #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3} | ||
| 74 | #define ALTI_SL2_PERM {1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8} | ||
| 75 | #define ALTI_SL2_PERM64 {1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0} | ||
| 76 | #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14} | ||
| 77 | #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14} | ||
| 78 | #endif /* For OSX */ | ||
| 79 | #define IDSTR "SFMT-19937:122-18-1-11-1:dfffffef-ddfecb7f-bffaffff-bffffff6" | ||
| 80 | |||
| 81 | #endif /* SFMT_PARAMS19937_H */ | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params216091.h b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params216091.h new file mode 100644 index 0000000..125ce28 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params216091.h | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | /* | ||
| 2 | * This file derives from SFMT 1.3.3 | ||
| 3 | * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was | ||
| 4 | * released under the terms of the following license: | ||
| 5 | * | ||
| 6 | * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 7 | * University. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions are | ||
| 11 | * met: | ||
| 12 | * | ||
| 13 | * * Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * * Redistributions in binary form must reproduce the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer in the documentation and/or other materials provided | ||
| 18 | * with the distribution. | ||
| 19 | * * Neither the name of the Hiroshima University nor the names of | ||
| 20 | * its contributors may be used to endorse or promote products | ||
| 21 | * derived from this software without specific prior written | ||
| 22 | * permission. | ||
| 23 | * | ||
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 35 | */ | ||
| 36 | #ifndef SFMT_PARAMS216091_H | ||
| 37 | #define SFMT_PARAMS216091_H | ||
| 38 | |||
| 39 | #define POS1 627 | ||
| 40 | #define SL1 11 | ||
| 41 | #define SL2 3 | ||
| 42 | #define SR1 10 | ||
| 43 | #define SR2 1 | ||
| 44 | #define MSK1 0xbff7bff7U | ||
| 45 | #define MSK2 0xbfffffffU | ||
| 46 | #define MSK3 0xbffffa7fU | ||
| 47 | #define MSK4 0xffddfbfbU | ||
| 48 | #define PARITY1 0xf8000001U | ||
| 49 | #define PARITY2 0x89e80709U | ||
| 50 | #define PARITY3 0x3bd2b64bU | ||
| 51 | #define PARITY4 0x0c64b1e4U | ||
| 52 | |||
| 53 | |||
| 54 | /* PARAMETERS FOR ALTIVEC */ | ||
| 55 | #if defined(__APPLE__) /* For OSX */ | ||
| 56 | #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1) | ||
| 57 | #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1) | ||
| 58 | #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4) | ||
| 59 | #define ALTI_MSK64 \ | ||
| 60 | (vector unsigned int)(MSK2, MSK1, MSK4, MSK3) | ||
| 61 | #define ALTI_SL2_PERM \ | ||
| 62 | (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10) | ||
| 63 | #define ALTI_SL2_PERM64 \ | ||
| 64 | (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2) | ||
| 65 | #define ALTI_SR2_PERM \ | ||
| 66 | (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14) | ||
| 67 | #define ALTI_SR2_PERM64 \ | ||
| 68 | (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14) | ||
| 69 | #else /* For OTHER OSs(Linux?) */ | ||
| 70 | #define ALTI_SL1 {SL1, SL1, SL1, SL1} | ||
| 71 | #define ALTI_SR1 {SR1, SR1, SR1, SR1} | ||
| 72 | #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4} | ||
| 73 | #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3} | ||
| 74 | #define ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10} | ||
| 75 | #define ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2} | ||
| 76 | #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14} | ||
| 77 | #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14} | ||
| 78 | #endif /* For OSX */ | ||
| 79 | #define IDSTR "SFMT-216091:627-11-3-10-1:bff7bff7-bfffffff-bffffa7f-ffddfbfb" | ||
| 80 | |||
| 81 | #endif /* SFMT_PARAMS216091_H */ | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params2281.h b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params2281.h new file mode 100644 index 0000000..0ef85c4 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params2281.h | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | /* | ||
| 2 | * This file derives from SFMT 1.3.3 | ||
| 3 | * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was | ||
| 4 | * released under the terms of the following license: | ||
| 5 | * | ||
| 6 | * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 7 | * University. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions are | ||
| 11 | * met: | ||
| 12 | * | ||
| 13 | * * Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * * Redistributions in binary form must reproduce the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer in the documentation and/or other materials provided | ||
| 18 | * with the distribution. | ||
| 19 | * * Neither the name of the Hiroshima University nor the names of | ||
| 20 | * its contributors may be used to endorse or promote products | ||
| 21 | * derived from this software without specific prior written | ||
| 22 | * permission. | ||
| 23 | * | ||
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 35 | */ | ||
| 36 | #ifndef SFMT_PARAMS2281_H | ||
| 37 | #define SFMT_PARAMS2281_H | ||
| 38 | |||
| 39 | #define POS1 12 | ||
| 40 | #define SL1 19 | ||
| 41 | #define SL2 1 | ||
| 42 | #define SR1 5 | ||
| 43 | #define SR2 1 | ||
| 44 | #define MSK1 0xbff7ffbfU | ||
| 45 | #define MSK2 0xfdfffffeU | ||
| 46 | #define MSK3 0xf7ffef7fU | ||
| 47 | #define MSK4 0xf2f7cbbfU | ||
| 48 | #define PARITY1 0x00000001U | ||
| 49 | #define PARITY2 0x00000000U | ||
| 50 | #define PARITY3 0x00000000U | ||
| 51 | #define PARITY4 0x41dfa600U | ||
| 52 | |||
| 53 | |||
| 54 | /* PARAMETERS FOR ALTIVEC */ | ||
| 55 | #if defined(__APPLE__) /* For OSX */ | ||
| 56 | #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1) | ||
| 57 | #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1) | ||
| 58 | #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4) | ||
| 59 | #define ALTI_MSK64 \ | ||
| 60 | (vector unsigned int)(MSK2, MSK1, MSK4, MSK3) | ||
| 61 | #define ALTI_SL2_PERM \ | ||
| 62 | (vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8) | ||
| 63 | #define ALTI_SL2_PERM64 \ | ||
| 64 | (vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0) | ||
| 65 | #define ALTI_SR2_PERM \ | ||
| 66 | (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14) | ||
| 67 | #define ALTI_SR2_PERM64 \ | ||
| 68 | (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14) | ||
| 69 | #else /* For OTHER OSs(Linux?) */ | ||
| 70 | #define ALTI_SL1 {SL1, SL1, SL1, SL1} | ||
| 71 | #define ALTI_SR1 {SR1, SR1, SR1, SR1} | ||
| 72 | #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4} | ||
| 73 | #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3} | ||
| 74 | #define ALTI_SL2_PERM {1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8} | ||
| 75 | #define ALTI_SL2_PERM64 {1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0} | ||
| 76 | #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14} | ||
| 77 | #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14} | ||
| 78 | #endif /* For OSX */ | ||
| 79 | #define IDSTR "SFMT-2281:12-19-1-5-1:bff7ffbf-fdfffffe-f7ffef7f-f2f7cbbf" | ||
| 80 | |||
| 81 | #endif /* SFMT_PARAMS2281_H */ | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params4253.h b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params4253.h new file mode 100644 index 0000000..9f07bc6 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params4253.h | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | /* | ||
| 2 | * This file derives from SFMT 1.3.3 | ||
| 3 | * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was | ||
| 4 | * released under the terms of the following license: | ||
| 5 | * | ||
| 6 | * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 7 | * University. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions are | ||
| 11 | * met: | ||
| 12 | * | ||
| 13 | * * Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * * Redistributions in binary form must reproduce the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer in the documentation and/or other materials provided | ||
| 18 | * with the distribution. | ||
| 19 | * * Neither the name of the Hiroshima University nor the names of | ||
| 20 | * its contributors may be used to endorse or promote products | ||
| 21 | * derived from this software without specific prior written | ||
| 22 | * permission. | ||
| 23 | * | ||
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 35 | */ | ||
| 36 | #ifndef SFMT_PARAMS4253_H | ||
| 37 | #define SFMT_PARAMS4253_H | ||
| 38 | |||
| 39 | #define POS1 17 | ||
| 40 | #define SL1 20 | ||
| 41 | #define SL2 1 | ||
| 42 | #define SR1 7 | ||
| 43 | #define SR2 1 | ||
| 44 | #define MSK1 0x9f7bffffU | ||
| 45 | #define MSK2 0x9fffff5fU | ||
| 46 | #define MSK3 0x3efffffbU | ||
| 47 | #define MSK4 0xfffff7bbU | ||
| 48 | #define PARITY1 0xa8000001U | ||
| 49 | #define PARITY2 0xaf5390a3U | ||
| 50 | #define PARITY3 0xb740b3f8U | ||
| 51 | #define PARITY4 0x6c11486dU | ||
| 52 | |||
| 53 | |||
| 54 | /* PARAMETERS FOR ALTIVEC */ | ||
| 55 | #if defined(__APPLE__) /* For OSX */ | ||
| 56 | #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1) | ||
| 57 | #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1) | ||
| 58 | #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4) | ||
| 59 | #define ALTI_MSK64 \ | ||
| 60 | (vector unsigned int)(MSK2, MSK1, MSK4, MSK3) | ||
| 61 | #define ALTI_SL2_PERM \ | ||
| 62 | (vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8) | ||
| 63 | #define ALTI_SL2_PERM64 \ | ||
| 64 | (vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0) | ||
| 65 | #define ALTI_SR2_PERM \ | ||
| 66 | (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14) | ||
| 67 | #define ALTI_SR2_PERM64 \ | ||
| 68 | (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14) | ||
| 69 | #else /* For OTHER OSs(Linux?) */ | ||
| 70 | #define ALTI_SL1 {SL1, SL1, SL1, SL1} | ||
| 71 | #define ALTI_SR1 {SR1, SR1, SR1, SR1} | ||
| 72 | #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4} | ||
| 73 | #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3} | ||
| 74 | #define ALTI_SL2_PERM {1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8} | ||
| 75 | #define ALTI_SL2_PERM64 {1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0} | ||
| 76 | #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14} | ||
| 77 | #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14} | ||
| 78 | #endif /* For OSX */ | ||
| 79 | #define IDSTR "SFMT-4253:17-20-1-7-1:9f7bffff-9fffff5f-3efffffb-fffff7bb" | ||
| 80 | |||
| 81 | #endif /* SFMT_PARAMS4253_H */ | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params44497.h b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params44497.h new file mode 100644 index 0000000..85598fe --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params44497.h | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | /* | ||
| 2 | * This file derives from SFMT 1.3.3 | ||
| 3 | * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was | ||
| 4 | * released under the terms of the following license: | ||
| 5 | * | ||
| 6 | * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 7 | * University. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions are | ||
| 11 | * met: | ||
| 12 | * | ||
| 13 | * * Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * * Redistributions in binary form must reproduce the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer in the documentation and/or other materials provided | ||
| 18 | * with the distribution. | ||
| 19 | * * Neither the name of the Hiroshima University nor the names of | ||
| 20 | * its contributors may be used to endorse or promote products | ||
| 21 | * derived from this software without specific prior written | ||
| 22 | * permission. | ||
| 23 | * | ||
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 35 | */ | ||
| 36 | #ifndef SFMT_PARAMS44497_H | ||
| 37 | #define SFMT_PARAMS44497_H | ||
| 38 | |||
| 39 | #define POS1 330 | ||
| 40 | #define SL1 5 | ||
| 41 | #define SL2 3 | ||
| 42 | #define SR1 9 | ||
| 43 | #define SR2 3 | ||
| 44 | #define MSK1 0xeffffffbU | ||
| 45 | #define MSK2 0xdfbebfffU | ||
| 46 | #define MSK3 0xbfbf7befU | ||
| 47 | #define MSK4 0x9ffd7bffU | ||
| 48 | #define PARITY1 0x00000001U | ||
| 49 | #define PARITY2 0x00000000U | ||
| 50 | #define PARITY3 0xa3ac4000U | ||
| 51 | #define PARITY4 0xecc1327aU | ||
| 52 | |||
| 53 | |||
| 54 | /* PARAMETERS FOR ALTIVEC */ | ||
| 55 | #if defined(__APPLE__) /* For OSX */ | ||
| 56 | #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1) | ||
| 57 | #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1) | ||
| 58 | #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4) | ||
| 59 | #define ALTI_MSK64 \ | ||
| 60 | (vector unsigned int)(MSK2, MSK1, MSK4, MSK3) | ||
| 61 | #define ALTI_SL2_PERM \ | ||
| 62 | (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10) | ||
| 63 | #define ALTI_SL2_PERM64 \ | ||
| 64 | (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2) | ||
| 65 | #define ALTI_SR2_PERM \ | ||
| 66 | (vector unsigned char)(5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12) | ||
| 67 | #define ALTI_SR2_PERM64 \ | ||
| 68 | (vector unsigned char)(13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12) | ||
| 69 | #else /* For OTHER OSs(Linux?) */ | ||
| 70 | #define ALTI_SL1 {SL1, SL1, SL1, SL1} | ||
| 71 | #define ALTI_SR1 {SR1, SR1, SR1, SR1} | ||
| 72 | #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4} | ||
| 73 | #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3} | ||
| 74 | #define ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10} | ||
| 75 | #define ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2} | ||
| 76 | #define ALTI_SR2_PERM {5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12} | ||
| 77 | #define ALTI_SR2_PERM64 {13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12} | ||
| 78 | #endif /* For OSX */ | ||
| 79 | #define IDSTR "SFMT-44497:330-5-3-9-3:effffffb-dfbebfff-bfbf7bef-9ffd7bff" | ||
| 80 | |||
| 81 | #endif /* SFMT_PARAMS44497_H */ | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params607.h b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params607.h new file mode 100644 index 0000000..bc76485 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params607.h | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | /* | ||
| 2 | * This file derives from SFMT 1.3.3 | ||
| 3 | * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was | ||
| 4 | * released under the terms of the following license: | ||
| 5 | * | ||
| 6 | * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 7 | * University. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions are | ||
| 11 | * met: | ||
| 12 | * | ||
| 13 | * * Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * * Redistributions in binary form must reproduce the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer in the documentation and/or other materials provided | ||
| 18 | * with the distribution. | ||
| 19 | * * Neither the name of the Hiroshima University nor the names of | ||
| 20 | * its contributors may be used to endorse or promote products | ||
| 21 | * derived from this software without specific prior written | ||
| 22 | * permission. | ||
| 23 | * | ||
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 35 | */ | ||
| 36 | #ifndef SFMT_PARAMS607_H | ||
| 37 | #define SFMT_PARAMS607_H | ||
| 38 | |||
| 39 | #define POS1 2 | ||
| 40 | #define SL1 15 | ||
| 41 | #define SL2 3 | ||
| 42 | #define SR1 13 | ||
| 43 | #define SR2 3 | ||
| 44 | #define MSK1 0xfdff37ffU | ||
| 45 | #define MSK2 0xef7f3f7dU | ||
| 46 | #define MSK3 0xff777b7dU | ||
| 47 | #define MSK4 0x7ff7fb2fU | ||
| 48 | #define PARITY1 0x00000001U | ||
| 49 | #define PARITY2 0x00000000U | ||
| 50 | #define PARITY3 0x00000000U | ||
| 51 | #define PARITY4 0x5986f054U | ||
| 52 | |||
| 53 | |||
| 54 | /* PARAMETERS FOR ALTIVEC */ | ||
| 55 | #if defined(__APPLE__) /* For OSX */ | ||
| 56 | #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1) | ||
| 57 | #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1) | ||
| 58 | #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4) | ||
| 59 | #define ALTI_MSK64 \ | ||
| 60 | (vector unsigned int)(MSK2, MSK1, MSK4, MSK3) | ||
| 61 | #define ALTI_SL2_PERM \ | ||
| 62 | (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10) | ||
| 63 | #define ALTI_SL2_PERM64 \ | ||
| 64 | (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2) | ||
| 65 | #define ALTI_SR2_PERM \ | ||
| 66 | (vector unsigned char)(5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12) | ||
| 67 | #define ALTI_SR2_PERM64 \ | ||
| 68 | (vector unsigned char)(13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12) | ||
| 69 | #else /* For OTHER OSs(Linux?) */ | ||
| 70 | #define ALTI_SL1 {SL1, SL1, SL1, SL1} | ||
| 71 | #define ALTI_SR1 {SR1, SR1, SR1, SR1} | ||
| 72 | #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4} | ||
| 73 | #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3} | ||
| 74 | #define ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10} | ||
| 75 | #define ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2} | ||
| 76 | #define ALTI_SR2_PERM {5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12} | ||
| 77 | #define ALTI_SR2_PERM64 {13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12} | ||
| 78 | #endif /* For OSX */ | ||
| 79 | #define IDSTR "SFMT-607:2-15-3-13-3:fdff37ff-ef7f3f7d-ff777b7d-7ff7fb2f" | ||
| 80 | |||
| 81 | #endif /* SFMT_PARAMS607_H */ | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params86243.h b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params86243.h new file mode 100644 index 0000000..5e4d783 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-params86243.h | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | /* | ||
| 2 | * This file derives from SFMT 1.3.3 | ||
| 3 | * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was | ||
| 4 | * released under the terms of the following license: | ||
| 5 | * | ||
| 6 | * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 7 | * University. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions are | ||
| 11 | * met: | ||
| 12 | * | ||
| 13 | * * Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * * Redistributions in binary form must reproduce the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer in the documentation and/or other materials provided | ||
| 18 | * with the distribution. | ||
| 19 | * * Neither the name of the Hiroshima University nor the names of | ||
| 20 | * its contributors may be used to endorse or promote products | ||
| 21 | * derived from this software without specific prior written | ||
| 22 | * permission. | ||
| 23 | * | ||
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 35 | */ | ||
| 36 | #ifndef SFMT_PARAMS86243_H | ||
| 37 | #define SFMT_PARAMS86243_H | ||
| 38 | |||
| 39 | #define POS1 366 | ||
| 40 | #define SL1 6 | ||
| 41 | #define SL2 7 | ||
| 42 | #define SR1 19 | ||
| 43 | #define SR2 1 | ||
| 44 | #define MSK1 0xfdbffbffU | ||
| 45 | #define MSK2 0xbff7ff3fU | ||
| 46 | #define MSK3 0xfd77efffU | ||
| 47 | #define MSK4 0xbf9ff3ffU | ||
| 48 | #define PARITY1 0x00000001U | ||
| 49 | #define PARITY2 0x00000000U | ||
| 50 | #define PARITY3 0x00000000U | ||
| 51 | #define PARITY4 0xe9528d85U | ||
| 52 | |||
| 53 | |||
| 54 | /* PARAMETERS FOR ALTIVEC */ | ||
| 55 | #if defined(__APPLE__) /* For OSX */ | ||
| 56 | #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1) | ||
| 57 | #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1) | ||
| 58 | #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4) | ||
| 59 | #define ALTI_MSK64 \ | ||
| 60 | (vector unsigned int)(MSK2, MSK1, MSK4, MSK3) | ||
| 61 | #define ALTI_SL2_PERM \ | ||
| 62 | (vector unsigned char)(25,25,25,25,3,25,25,25,7,0,1,2,11,4,5,6) | ||
| 63 | #define ALTI_SL2_PERM64 \ | ||
| 64 | (vector unsigned char)(7,25,25,25,25,25,25,25,15,0,1,2,3,4,5,6) | ||
| 65 | #define ALTI_SR2_PERM \ | ||
| 66 | (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14) | ||
| 67 | #define ALTI_SR2_PERM64 \ | ||
| 68 | (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14) | ||
| 69 | #else /* For OTHER OSs(Linux?) */ | ||
| 70 | #define ALTI_SL1 {SL1, SL1, SL1, SL1} | ||
| 71 | #define ALTI_SR1 {SR1, SR1, SR1, SR1} | ||
| 72 | #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4} | ||
| 73 | #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3} | ||
| 74 | #define ALTI_SL2_PERM {25,25,25,25,3,25,25,25,7,0,1,2,11,4,5,6} | ||
| 75 | #define ALTI_SL2_PERM64 {7,25,25,25,25,25,25,25,15,0,1,2,3,4,5,6} | ||
| 76 | #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14} | ||
| 77 | #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14} | ||
| 78 | #endif /* For OSX */ | ||
| 79 | #define IDSTR "SFMT-86243:366-6-7-19-1:fdbffbff-bff7ff3f-fd77efff-bf9ff3ff" | ||
| 80 | |||
| 81 | #endif /* SFMT_PARAMS86243_H */ | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-sse2.h b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-sse2.h new file mode 100644 index 0000000..169ad55 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT-sse2.h | |||
| @@ -0,0 +1,157 @@ | |||
| 1 | /* | ||
| 2 | * This file derives from SFMT 1.3.3 | ||
| 3 | * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was | ||
| 4 | * released under the terms of the following license: | ||
| 5 | * | ||
| 6 | * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 7 | * University. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions are | ||
| 11 | * met: | ||
| 12 | * | ||
| 13 | * * Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * * Redistributions in binary form must reproduce the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer in the documentation and/or other materials provided | ||
| 18 | * with the distribution. | ||
| 19 | * * Neither the name of the Hiroshima University nor the names of | ||
| 20 | * its contributors may be used to endorse or promote products | ||
| 21 | * derived from this software without specific prior written | ||
| 22 | * permission. | ||
| 23 | * | ||
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 35 | */ | ||
| 36 | /** | ||
| 37 | * @file SFMT-sse2.h | ||
| 38 | * @brief SIMD oriented Fast Mersenne Twister(SFMT) for Intel SSE2 | ||
| 39 | * | ||
| 40 | * @author Mutsuo Saito (Hiroshima University) | ||
| 41 | * @author Makoto Matsumoto (Hiroshima University) | ||
| 42 | * | ||
| 43 | * @note We assume LITTLE ENDIAN in this file | ||
| 44 | * | ||
| 45 | * Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 46 | * University. All rights reserved. | ||
| 47 | * | ||
| 48 | * The new BSD License is applied to this software, see LICENSE.txt | ||
| 49 | */ | ||
| 50 | |||
| 51 | #ifndef SFMT_SSE2_H | ||
| 52 | #define SFMT_SSE2_H | ||
| 53 | |||
| 54 | /** | ||
| 55 | * This function represents the recursion formula. | ||
| 56 | * @param a a 128-bit part of the interal state array | ||
| 57 | * @param b a 128-bit part of the interal state array | ||
| 58 | * @param c a 128-bit part of the interal state array | ||
| 59 | * @param d a 128-bit part of the interal state array | ||
| 60 | * @param mask 128-bit mask | ||
| 61 | * @return output | ||
| 62 | */ | ||
| 63 | JEMALLOC_ALWAYS_INLINE __m128i mm_recursion(__m128i *a, __m128i *b, | ||
| 64 | __m128i c, __m128i d, __m128i mask) { | ||
| 65 | __m128i v, x, y, z; | ||
| 66 | |||
| 67 | x = _mm_load_si128(a); | ||
| 68 | y = _mm_srli_epi32(*b, SR1); | ||
| 69 | z = _mm_srli_si128(c, SR2); | ||
| 70 | v = _mm_slli_epi32(d, SL1); | ||
| 71 | z = _mm_xor_si128(z, x); | ||
| 72 | z = _mm_xor_si128(z, v); | ||
| 73 | x = _mm_slli_si128(x, SL2); | ||
| 74 | y = _mm_and_si128(y, mask); | ||
| 75 | z = _mm_xor_si128(z, x); | ||
| 76 | z = _mm_xor_si128(z, y); | ||
| 77 | return z; | ||
| 78 | } | ||
| 79 | |||
| 80 | /** | ||
| 81 | * This function fills the internal state array with pseudorandom | ||
| 82 | * integers. | ||
| 83 | */ | ||
| 84 | static inline void gen_rand_all(sfmt_t *ctx) { | ||
| 85 | int i; | ||
| 86 | __m128i r, r1, r2, mask; | ||
| 87 | mask = _mm_set_epi32(MSK4, MSK3, MSK2, MSK1); | ||
| 88 | |||
| 89 | r1 = _mm_load_si128(&ctx->sfmt[N - 2].si); | ||
| 90 | r2 = _mm_load_si128(&ctx->sfmt[N - 1].si); | ||
| 91 | for (i = 0; i < N - POS1; i++) { | ||
| 92 | r = mm_recursion(&ctx->sfmt[i].si, &ctx->sfmt[i + POS1].si, r1, r2, | ||
| 93 | mask); | ||
| 94 | _mm_store_si128(&ctx->sfmt[i].si, r); | ||
| 95 | r1 = r2; | ||
| 96 | r2 = r; | ||
| 97 | } | ||
| 98 | for (; i < N; i++) { | ||
| 99 | r = mm_recursion(&ctx->sfmt[i].si, &ctx->sfmt[i + POS1 - N].si, r1, r2, | ||
| 100 | mask); | ||
| 101 | _mm_store_si128(&ctx->sfmt[i].si, r); | ||
| 102 | r1 = r2; | ||
| 103 | r2 = r; | ||
| 104 | } | ||
| 105 | } | ||
| 106 | |||
| 107 | /** | ||
| 108 | * This function fills the user-specified array with pseudorandom | ||
| 109 | * integers. | ||
| 110 | * | ||
| 111 | * @param array an 128-bit array to be filled by pseudorandom numbers. | ||
| 112 | * @param size number of 128-bit pesudorandom numbers to be generated. | ||
| 113 | */ | ||
| 114 | static inline void gen_rand_array(sfmt_t *ctx, w128_t *array, int size) { | ||
| 115 | int i, j; | ||
| 116 | __m128i r, r1, r2, mask; | ||
| 117 | mask = _mm_set_epi32(MSK4, MSK3, MSK2, MSK1); | ||
| 118 | |||
| 119 | r1 = _mm_load_si128(&ctx->sfmt[N - 2].si); | ||
| 120 | r2 = _mm_load_si128(&ctx->sfmt[N - 1].si); | ||
| 121 | for (i = 0; i < N - POS1; i++) { | ||
| 122 | r = mm_recursion(&ctx->sfmt[i].si, &ctx->sfmt[i + POS1].si, r1, r2, | ||
| 123 | mask); | ||
| 124 | _mm_store_si128(&array[i].si, r); | ||
| 125 | r1 = r2; | ||
| 126 | r2 = r; | ||
| 127 | } | ||
| 128 | for (; i < N; i++) { | ||
| 129 | r = mm_recursion(&ctx->sfmt[i].si, &array[i + POS1 - N].si, r1, r2, | ||
| 130 | mask); | ||
| 131 | _mm_store_si128(&array[i].si, r); | ||
| 132 | r1 = r2; | ||
| 133 | r2 = r; | ||
| 134 | } | ||
| 135 | /* main loop */ | ||
| 136 | for (; i < size - N; i++) { | ||
| 137 | r = mm_recursion(&array[i - N].si, &array[i + POS1 - N].si, r1, r2, | ||
| 138 | mask); | ||
| 139 | _mm_store_si128(&array[i].si, r); | ||
| 140 | r1 = r2; | ||
| 141 | r2 = r; | ||
| 142 | } | ||
| 143 | for (j = 0; j < 2 * N - size; j++) { | ||
| 144 | r = _mm_load_si128(&array[j + size - N].si); | ||
| 145 | _mm_store_si128(&ctx->sfmt[j].si, r); | ||
| 146 | } | ||
| 147 | for (; i < size; i++) { | ||
| 148 | r = mm_recursion(&array[i - N].si, &array[i + POS1 - N].si, r1, r2, | ||
| 149 | mask); | ||
| 150 | _mm_store_si128(&array[i].si, r); | ||
| 151 | _mm_store_si128(&ctx->sfmt[j++].si, r); | ||
| 152 | r1 = r2; | ||
| 153 | r2 = r; | ||
| 154 | } | ||
| 155 | } | ||
| 156 | |||
| 157 | #endif | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT.h b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT.h new file mode 100644 index 0000000..863fc55 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/SFMT.h | |||
| @@ -0,0 +1,146 @@ | |||
| 1 | /* | ||
| 2 | * This file derives from SFMT 1.3.3 | ||
| 3 | * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was | ||
| 4 | * released under the terms of the following license: | ||
| 5 | * | ||
| 6 | * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 7 | * University. All rights reserved. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions are | ||
| 11 | * met: | ||
| 12 | * | ||
| 13 | * * Redistributions of source code must retain the above copyright | ||
| 14 | * notice, this list of conditions and the following disclaimer. | ||
| 15 | * * Redistributions in binary form must reproduce the above | ||
| 16 | * copyright notice, this list of conditions and the following | ||
| 17 | * disclaimer in the documentation and/or other materials provided | ||
| 18 | * with the distribution. | ||
| 19 | * * Neither the name of the Hiroshima University nor the names of | ||
| 20 | * its contributors may be used to endorse or promote products | ||
| 21 | * derived from this software without specific prior written | ||
| 22 | * permission. | ||
| 23 | * | ||
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 28 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 29 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 30 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 35 | */ | ||
| 36 | /** | ||
| 37 | * @file SFMT.h | ||
| 38 | * | ||
| 39 | * @brief SIMD oriented Fast Mersenne Twister(SFMT) pseudorandom | ||
| 40 | * number generator | ||
| 41 | * | ||
| 42 | * @author Mutsuo Saito (Hiroshima University) | ||
| 43 | * @author Makoto Matsumoto (Hiroshima University) | ||
| 44 | * | ||
| 45 | * Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima | ||
| 46 | * University. All rights reserved. | ||
| 47 | * | ||
| 48 | * The new BSD License is applied to this software. | ||
| 49 | * see LICENSE.txt | ||
| 50 | * | ||
| 51 | * @note We assume that your system has inttypes.h. If your system | ||
| 52 | * doesn't have inttypes.h, you have to typedef uint32_t and uint64_t, | ||
| 53 | * and you have to define PRIu64 and PRIx64 in this file as follows: | ||
| 54 | * @verbatim | ||
| 55 | typedef unsigned int uint32_t | ||
| 56 | typedef unsigned long long uint64_t | ||
| 57 | #define PRIu64 "llu" | ||
| 58 | #define PRIx64 "llx" | ||
| 59 | @endverbatim | ||
| 60 | * uint32_t must be exactly 32-bit unsigned integer type (no more, no | ||
| 61 | * less), and uint64_t must be exactly 64-bit unsigned integer type. | ||
| 62 | * PRIu64 and PRIx64 are used for printf function to print 64-bit | ||
| 63 | * unsigned int and 64-bit unsigned int in hexadecimal format. | ||
| 64 | */ | ||
| 65 | |||
| 66 | #ifndef SFMT_H | ||
| 67 | #define SFMT_H | ||
| 68 | |||
| 69 | typedef struct sfmt_s sfmt_t; | ||
| 70 | |||
| 71 | uint32_t gen_rand32(sfmt_t *ctx); | ||
| 72 | uint32_t gen_rand32_range(sfmt_t *ctx, uint32_t limit); | ||
| 73 | uint64_t gen_rand64(sfmt_t *ctx); | ||
| 74 | uint64_t gen_rand64_range(sfmt_t *ctx, uint64_t limit); | ||
| 75 | void fill_array32(sfmt_t *ctx, uint32_t *array, int size); | ||
| 76 | void fill_array64(sfmt_t *ctx, uint64_t *array, int size); | ||
| 77 | sfmt_t *init_gen_rand(uint32_t seed); | ||
| 78 | sfmt_t *init_by_array(uint32_t *init_key, int key_length); | ||
| 79 | void fini_gen_rand(sfmt_t *ctx); | ||
| 80 | const char *get_idstring(void); | ||
| 81 | int get_min_array_size32(void); | ||
| 82 | int get_min_array_size64(void); | ||
| 83 | |||
| 84 | /* These real versions are due to Isaku Wada */ | ||
| 85 | /** generates a random number on [0,1]-real-interval */ | ||
| 86 | static inline double to_real1(uint32_t v) { | ||
| 87 | return v * (1.0/4294967295.0); | ||
| 88 | /* divided by 2^32-1 */ | ||
| 89 | } | ||
| 90 | |||
| 91 | /** generates a random number on [0,1]-real-interval */ | ||
| 92 | static inline double genrand_real1(sfmt_t *ctx) { | ||
| 93 | return to_real1(gen_rand32(ctx)); | ||
| 94 | } | ||
| 95 | |||
| 96 | /** generates a random number on [0,1)-real-interval */ | ||
| 97 | static inline double to_real2(uint32_t v) { | ||
| 98 | return v * (1.0/4294967296.0); | ||
| 99 | /* divided by 2^32 */ | ||
| 100 | } | ||
| 101 | |||
| 102 | /** generates a random number on [0,1)-real-interval */ | ||
| 103 | static inline double genrand_real2(sfmt_t *ctx) { | ||
| 104 | return to_real2(gen_rand32(ctx)); | ||
| 105 | } | ||
| 106 | |||
| 107 | /** generates a random number on (0,1)-real-interval */ | ||
| 108 | static inline double to_real3(uint32_t v) { | ||
| 109 | return (((double)v) + 0.5)*(1.0/4294967296.0); | ||
| 110 | /* divided by 2^32 */ | ||
| 111 | } | ||
| 112 | |||
| 113 | /** generates a random number on (0,1)-real-interval */ | ||
| 114 | static inline double genrand_real3(sfmt_t *ctx) { | ||
| 115 | return to_real3(gen_rand32(ctx)); | ||
| 116 | } | ||
| 117 | /** These real versions are due to Isaku Wada */ | ||
| 118 | |||
| 119 | /** generates a random number on [0,1) with 53-bit resolution*/ | ||
| 120 | static inline double to_res53(uint64_t v) { | ||
| 121 | return v * (1.0/18446744073709551616.0L); | ||
| 122 | } | ||
| 123 | |||
| 124 | /** generates a random number on [0,1) with 53-bit resolution from two | ||
| 125 | * 32 bit integers */ | ||
| 126 | static inline double to_res53_mix(uint32_t x, uint32_t y) { | ||
| 127 | return to_res53(x | ((uint64_t)y << 32)); | ||
| 128 | } | ||
| 129 | |||
| 130 | /** generates a random number on [0,1) with 53-bit resolution | ||
| 131 | */ | ||
| 132 | static inline double genrand_res53(sfmt_t *ctx) { | ||
| 133 | return to_res53(gen_rand64(ctx)); | ||
| 134 | } | ||
| 135 | |||
| 136 | /** generates a random number on [0,1) with 53-bit resolution | ||
| 137 | using 32bit integer. | ||
| 138 | */ | ||
| 139 | static inline double genrand_res53_mix(sfmt_t *ctx) { | ||
| 140 | uint32_t x, y; | ||
| 141 | |||
| 142 | x = gen_rand32(ctx); | ||
| 143 | y = gen_rand32(ctx); | ||
| 144 | return to_res53_mix(x, y); | ||
| 145 | } | ||
| 146 | #endif | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/arena_util.h b/examples/redis-unstable/deps/jemalloc/test/include/test/arena_util.h new file mode 100644 index 0000000..9a41dac --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/arena_util.h | |||
| @@ -0,0 +1,155 @@ | |||
| 1 | static inline unsigned | ||
| 2 | do_arena_create(ssize_t dirty_decay_ms, ssize_t muzzy_decay_ms) { | ||
| 3 | unsigned arena_ind; | ||
| 4 | size_t sz = sizeof(unsigned); | ||
| 5 | expect_d_eq(mallctl("arenas.create", (void *)&arena_ind, &sz, NULL, 0), | ||
| 6 | 0, "Unexpected mallctl() failure"); | ||
| 7 | size_t mib[3]; | ||
| 8 | size_t miblen = sizeof(mib)/sizeof(size_t); | ||
| 9 | |||
| 10 | expect_d_eq(mallctlnametomib("arena.0.dirty_decay_ms", mib, &miblen), | ||
| 11 | 0, "Unexpected mallctlnametomib() failure"); | ||
| 12 | mib[1] = (size_t)arena_ind; | ||
| 13 | expect_d_eq(mallctlbymib(mib, miblen, NULL, NULL, | ||
| 14 | (void *)&dirty_decay_ms, sizeof(dirty_decay_ms)), 0, | ||
| 15 | "Unexpected mallctlbymib() failure"); | ||
| 16 | |||
| 17 | expect_d_eq(mallctlnametomib("arena.0.muzzy_decay_ms", mib, &miblen), | ||
| 18 | 0, "Unexpected mallctlnametomib() failure"); | ||
| 19 | mib[1] = (size_t)arena_ind; | ||
| 20 | expect_d_eq(mallctlbymib(mib, miblen, NULL, NULL, | ||
| 21 | (void *)&muzzy_decay_ms, sizeof(muzzy_decay_ms)), 0, | ||
| 22 | "Unexpected mallctlbymib() failure"); | ||
| 23 | |||
| 24 | return arena_ind; | ||
| 25 | } | ||
| 26 | |||
| 27 | static inline void | ||
| 28 | do_arena_destroy(unsigned arena_ind) { | ||
| 29 | /* | ||
| 30 | * For convenience, flush tcache in case there are cached items. | ||
| 31 | * However not assert success since the tcache may be disabled. | ||
| 32 | */ | ||
| 33 | mallctl("thread.tcache.flush", NULL, NULL, NULL, 0); | ||
| 34 | |||
| 35 | size_t mib[3]; | ||
| 36 | size_t miblen = sizeof(mib)/sizeof(size_t); | ||
| 37 | expect_d_eq(mallctlnametomib("arena.0.destroy", mib, &miblen), 0, | ||
| 38 | "Unexpected mallctlnametomib() failure"); | ||
| 39 | mib[1] = (size_t)arena_ind; | ||
| 40 | expect_d_eq(mallctlbymib(mib, miblen, NULL, NULL, NULL, 0), 0, | ||
| 41 | "Unexpected mallctlbymib() failure"); | ||
| 42 | } | ||
| 43 | |||
| 44 | static inline void | ||
| 45 | do_epoch(void) { | ||
| 46 | uint64_t epoch = 1; | ||
| 47 | expect_d_eq(mallctl("epoch", NULL, NULL, (void *)&epoch, sizeof(epoch)), | ||
| 48 | 0, "Unexpected mallctl() failure"); | ||
| 49 | } | ||
| 50 | |||
| 51 | static inline void | ||
| 52 | do_purge(unsigned arena_ind) { | ||
| 53 | size_t mib[3]; | ||
| 54 | size_t miblen = sizeof(mib)/sizeof(size_t); | ||
| 55 | expect_d_eq(mallctlnametomib("arena.0.purge", mib, &miblen), 0, | ||
| 56 | "Unexpected mallctlnametomib() failure"); | ||
| 57 | mib[1] = (size_t)arena_ind; | ||
| 58 | expect_d_eq(mallctlbymib(mib, miblen, NULL, NULL, NULL, 0), 0, | ||
| 59 | "Unexpected mallctlbymib() failure"); | ||
| 60 | } | ||
| 61 | |||
| 62 | static inline void | ||
| 63 | do_decay(unsigned arena_ind) { | ||
| 64 | size_t mib[3]; | ||
| 65 | size_t miblen = sizeof(mib)/sizeof(size_t); | ||
| 66 | expect_d_eq(mallctlnametomib("arena.0.decay", mib, &miblen), 0, | ||
| 67 | "Unexpected mallctlnametomib() failure"); | ||
| 68 | mib[1] = (size_t)arena_ind; | ||
| 69 | expect_d_eq(mallctlbymib(mib, miblen, NULL, NULL, NULL, 0), 0, | ||
| 70 | "Unexpected mallctlbymib() failure"); | ||
| 71 | } | ||
| 72 | |||
| 73 | static inline uint64_t | ||
| 74 | get_arena_npurge_impl(const char *mibname, unsigned arena_ind) { | ||
| 75 | size_t mib[4]; | ||
| 76 | size_t miblen = sizeof(mib)/sizeof(size_t); | ||
| 77 | expect_d_eq(mallctlnametomib(mibname, mib, &miblen), 0, | ||
| 78 | "Unexpected mallctlnametomib() failure"); | ||
| 79 | mib[2] = (size_t)arena_ind; | ||
| 80 | uint64_t npurge = 0; | ||
| 81 | size_t sz = sizeof(npurge); | ||
| 82 | expect_d_eq(mallctlbymib(mib, miblen, (void *)&npurge, &sz, NULL, 0), | ||
| 83 | config_stats ? 0 : ENOENT, "Unexpected mallctlbymib() failure"); | ||
| 84 | return npurge; | ||
| 85 | } | ||
| 86 | |||
| 87 | static inline uint64_t | ||
| 88 | get_arena_dirty_npurge(unsigned arena_ind) { | ||
| 89 | do_epoch(); | ||
| 90 | return get_arena_npurge_impl("stats.arenas.0.dirty_npurge", arena_ind); | ||
| 91 | } | ||
| 92 | |||
| 93 | static inline uint64_t | ||
| 94 | get_arena_dirty_purged(unsigned arena_ind) { | ||
| 95 | do_epoch(); | ||
| 96 | return get_arena_npurge_impl("stats.arenas.0.dirty_purged", arena_ind); | ||
| 97 | } | ||
| 98 | |||
| 99 | static inline uint64_t | ||
| 100 | get_arena_muzzy_npurge(unsigned arena_ind) { | ||
| 101 | do_epoch(); | ||
| 102 | return get_arena_npurge_impl("stats.arenas.0.muzzy_npurge", arena_ind); | ||
| 103 | } | ||
| 104 | |||
| 105 | static inline uint64_t | ||
| 106 | get_arena_npurge(unsigned arena_ind) { | ||
| 107 | do_epoch(); | ||
| 108 | return get_arena_npurge_impl("stats.arenas.0.dirty_npurge", arena_ind) + | ||
| 109 | get_arena_npurge_impl("stats.arenas.0.muzzy_npurge", arena_ind); | ||
| 110 | } | ||
| 111 | |||
| 112 | static inline size_t | ||
| 113 | get_arena_pdirty(unsigned arena_ind) { | ||
| 114 | do_epoch(); | ||
| 115 | size_t mib[4]; | ||
| 116 | size_t miblen = sizeof(mib)/sizeof(size_t); | ||
| 117 | expect_d_eq(mallctlnametomib("stats.arenas.0.pdirty", mib, &miblen), 0, | ||
| 118 | "Unexpected mallctlnametomib() failure"); | ||
| 119 | mib[2] = (size_t)arena_ind; | ||
| 120 | size_t pdirty; | ||
| 121 | size_t sz = sizeof(pdirty); | ||
| 122 | expect_d_eq(mallctlbymib(mib, miblen, (void *)&pdirty, &sz, NULL, 0), 0, | ||
| 123 | "Unexpected mallctlbymib() failure"); | ||
| 124 | return pdirty; | ||
| 125 | } | ||
| 126 | |||
| 127 | static inline size_t | ||
| 128 | get_arena_pmuzzy(unsigned arena_ind) { | ||
| 129 | do_epoch(); | ||
| 130 | size_t mib[4]; | ||
| 131 | size_t miblen = sizeof(mib)/sizeof(size_t); | ||
| 132 | expect_d_eq(mallctlnametomib("stats.arenas.0.pmuzzy", mib, &miblen), 0, | ||
| 133 | "Unexpected mallctlnametomib() failure"); | ||
| 134 | mib[2] = (size_t)arena_ind; | ||
| 135 | size_t pmuzzy; | ||
| 136 | size_t sz = sizeof(pmuzzy); | ||
| 137 | expect_d_eq(mallctlbymib(mib, miblen, (void *)&pmuzzy, &sz, NULL, 0), 0, | ||
| 138 | "Unexpected mallctlbymib() failure"); | ||
| 139 | return pmuzzy; | ||
| 140 | } | ||
| 141 | |||
| 142 | static inline void * | ||
| 143 | do_mallocx(size_t size, int flags) { | ||
| 144 | void *p = mallocx(size, flags); | ||
| 145 | expect_ptr_not_null(p, "Unexpected mallocx() failure"); | ||
| 146 | return p; | ||
| 147 | } | ||
| 148 | |||
| 149 | static inline void | ||
| 150 | generate_dirty(unsigned arena_ind, size_t size) { | ||
| 151 | int flags = MALLOCX_ARENA(arena_ind) | MALLOCX_TCACHE_NONE; | ||
| 152 | void *p = do_mallocx(size, flags); | ||
| 153 | dallocx(p, flags); | ||
| 154 | } | ||
| 155 | |||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/bench.h b/examples/redis-unstable/deps/jemalloc/test/include/test/bench.h new file mode 100644 index 0000000..0397c94 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/bench.h | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | static inline void | ||
| 2 | time_func(timedelta_t *timer, uint64_t nwarmup, uint64_t niter, | ||
| 3 | void (*func)(void)) { | ||
| 4 | uint64_t i; | ||
| 5 | |||
| 6 | for (i = 0; i < nwarmup; i++) { | ||
| 7 | func(); | ||
| 8 | } | ||
| 9 | timer_start(timer); | ||
| 10 | for (i = 0; i < niter; i++) { | ||
| 11 | func(); | ||
| 12 | } | ||
| 13 | timer_stop(timer); | ||
| 14 | } | ||
| 15 | |||
| 16 | #define FMT_NSECS_BUF_SIZE 100 | ||
| 17 | /* Print nanoseconds / iter into the buffer "buf". */ | ||
| 18 | static inline void | ||
| 19 | fmt_nsecs(uint64_t usec, uint64_t iters, char *buf) { | ||
| 20 | uint64_t nsec = usec * 1000; | ||
| 21 | /* We'll display 3 digits after the decimal point. */ | ||
| 22 | uint64_t nsec1000 = nsec * 1000; | ||
| 23 | uint64_t nsecs_per_iter1000 = nsec1000 / iters; | ||
| 24 | uint64_t intpart = nsecs_per_iter1000 / 1000; | ||
| 25 | uint64_t fracpart = nsecs_per_iter1000 % 1000; | ||
| 26 | malloc_snprintf(buf, FMT_NSECS_BUF_SIZE, "%"FMTu64".%03"FMTu64, intpart, | ||
| 27 | fracpart); | ||
| 28 | } | ||
| 29 | |||
| 30 | static inline void | ||
| 31 | compare_funcs(uint64_t nwarmup, uint64_t niter, const char *name_a, | ||
| 32 | void (*func_a), const char *name_b, void (*func_b)) { | ||
| 33 | timedelta_t timer_a, timer_b; | ||
| 34 | char ratio_buf[6]; | ||
| 35 | void *p; | ||
| 36 | |||
| 37 | p = mallocx(1, 0); | ||
| 38 | if (p == NULL) { | ||
| 39 | test_fail("Unexpected mallocx() failure"); | ||
| 40 | return; | ||
| 41 | } | ||
| 42 | |||
| 43 | time_func(&timer_a, nwarmup, niter, func_a); | ||
| 44 | time_func(&timer_b, nwarmup, niter, func_b); | ||
| 45 | |||
| 46 | uint64_t usec_a = timer_usec(&timer_a); | ||
| 47 | char buf_a[FMT_NSECS_BUF_SIZE]; | ||
| 48 | fmt_nsecs(usec_a, niter, buf_a); | ||
| 49 | |||
| 50 | uint64_t usec_b = timer_usec(&timer_b); | ||
| 51 | char buf_b[FMT_NSECS_BUF_SIZE]; | ||
| 52 | fmt_nsecs(usec_b, niter, buf_b); | ||
| 53 | |||
| 54 | timer_ratio(&timer_a, &timer_b, ratio_buf, sizeof(ratio_buf)); | ||
| 55 | malloc_printf("%"FMTu64" iterations, %s=%"FMTu64"us (%s ns/iter), " | ||
| 56 | "%s=%"FMTu64"us (%s ns/iter), ratio=1:%s\n", | ||
| 57 | niter, name_a, usec_a, buf_a, name_b, usec_b, buf_b, ratio_buf); | ||
| 58 | |||
| 59 | dallocx(p, 0); | ||
| 60 | } | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/bgthd.h b/examples/redis-unstable/deps/jemalloc/test/include/test/bgthd.h new file mode 100644 index 0000000..4fa2395 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/bgthd.h | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | /* | ||
| 2 | * Shared utility for checking if background_thread is enabled, which affects | ||
| 3 | * the purging behavior and assumptions in some tests. | ||
| 4 | */ | ||
| 5 | |||
| 6 | static inline bool | ||
| 7 | is_background_thread_enabled(void) { | ||
| 8 | bool enabled; | ||
| 9 | size_t sz = sizeof(bool); | ||
| 10 | int ret = mallctl("background_thread", (void *)&enabled, &sz, NULL,0); | ||
| 11 | if (ret == ENOENT) { | ||
| 12 | return false; | ||
| 13 | } | ||
| 14 | assert_d_eq(ret, 0, "Unexpected mallctl error"); | ||
| 15 | |||
| 16 | return enabled; | ||
| 17 | } | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/btalloc.h b/examples/redis-unstable/deps/jemalloc/test/include/test/btalloc.h new file mode 100644 index 0000000..8f34599 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/btalloc.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* btalloc() provides a mechanism for allocating via permuted backtraces. */ | ||
| 2 | void *btalloc(size_t size, unsigned bits); | ||
| 3 | |||
| 4 | #define btalloc_n_proto(n) \ | ||
| 5 | void *btalloc_##n(size_t size, unsigned bits); | ||
| 6 | btalloc_n_proto(0) | ||
| 7 | btalloc_n_proto(1) | ||
| 8 | |||
| 9 | #define btalloc_n_gen(n) \ | ||
| 10 | void * \ | ||
| 11 | btalloc_##n(size_t size, unsigned bits) { \ | ||
| 12 | void *p; \ | ||
| 13 | \ | ||
| 14 | if (bits == 0) { \ | ||
| 15 | p = mallocx(size, 0); \ | ||
| 16 | } else { \ | ||
| 17 | switch (bits & 0x1U) { \ | ||
| 18 | case 0: \ | ||
| 19 | p = (btalloc_0(size, bits >> 1)); \ | ||
| 20 | break; \ | ||
| 21 | case 1: \ | ||
| 22 | p = (btalloc_1(size, bits >> 1)); \ | ||
| 23 | break; \ | ||
| 24 | default: not_reached(); \ | ||
| 25 | } \ | ||
| 26 | } \ | ||
| 27 | /* Intentionally sabotage tail call optimization. */ \ | ||
| 28 | expect_ptr_not_null(p, "Unexpected mallocx() failure"); \ | ||
| 29 | return p; \ | ||
| 30 | } | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/extent_hooks.h b/examples/redis-unstable/deps/jemalloc/test/include/test/extent_hooks.h new file mode 100644 index 0000000..aad0a46 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/extent_hooks.h | |||
| @@ -0,0 +1,289 @@ | |||
| 1 | /* | ||
| 2 | * Boilerplate code used for testing extent hooks via interception and | ||
| 3 | * passthrough. | ||
| 4 | */ | ||
| 5 | |||
| 6 | static void *extent_alloc_hook(extent_hooks_t *extent_hooks, void *new_addr, | ||
| 7 | size_t size, size_t alignment, bool *zero, bool *commit, | ||
| 8 | unsigned arena_ind); | ||
| 9 | static bool extent_dalloc_hook(extent_hooks_t *extent_hooks, void *addr, | ||
| 10 | size_t size, bool committed, unsigned arena_ind); | ||
| 11 | static void extent_destroy_hook(extent_hooks_t *extent_hooks, void *addr, | ||
| 12 | size_t size, bool committed, unsigned arena_ind); | ||
| 13 | static bool extent_commit_hook(extent_hooks_t *extent_hooks, void *addr, | ||
| 14 | size_t size, size_t offset, size_t length, unsigned arena_ind); | ||
| 15 | static bool extent_decommit_hook(extent_hooks_t *extent_hooks, void *addr, | ||
| 16 | size_t size, size_t offset, size_t length, unsigned arena_ind); | ||
| 17 | static bool extent_purge_lazy_hook(extent_hooks_t *extent_hooks, void *addr, | ||
| 18 | size_t size, size_t offset, size_t length, unsigned arena_ind); | ||
| 19 | static bool extent_purge_forced_hook(extent_hooks_t *extent_hooks, | ||
| 20 | void *addr, size_t size, size_t offset, size_t length, unsigned arena_ind); | ||
| 21 | static bool extent_split_hook(extent_hooks_t *extent_hooks, void *addr, | ||
| 22 | size_t size, size_t size_a, size_t size_b, bool committed, | ||
| 23 | unsigned arena_ind); | ||
| 24 | static bool extent_merge_hook(extent_hooks_t *extent_hooks, void *addr_a, | ||
| 25 | size_t size_a, void *addr_b, size_t size_b, bool committed, | ||
| 26 | unsigned arena_ind); | ||
| 27 | |||
| 28 | static extent_hooks_t *default_hooks; | ||
| 29 | static extent_hooks_t hooks = { | ||
| 30 | extent_alloc_hook, | ||
| 31 | extent_dalloc_hook, | ||
| 32 | extent_destroy_hook, | ||
| 33 | extent_commit_hook, | ||
| 34 | extent_decommit_hook, | ||
| 35 | extent_purge_lazy_hook, | ||
| 36 | extent_purge_forced_hook, | ||
| 37 | extent_split_hook, | ||
| 38 | extent_merge_hook | ||
| 39 | }; | ||
| 40 | |||
| 41 | /* Control whether hook functions pass calls through to default hooks. */ | ||
| 42 | static bool try_alloc = true; | ||
| 43 | static bool try_dalloc = true; | ||
| 44 | static bool try_destroy = true; | ||
| 45 | static bool try_commit = true; | ||
| 46 | static bool try_decommit = true; | ||
| 47 | static bool try_purge_lazy = true; | ||
| 48 | static bool try_purge_forced = true; | ||
| 49 | static bool try_split = true; | ||
| 50 | static bool try_merge = true; | ||
| 51 | |||
| 52 | /* Set to false prior to operations, then introspect after operations. */ | ||
| 53 | static bool called_alloc; | ||
| 54 | static bool called_dalloc; | ||
| 55 | static bool called_destroy; | ||
| 56 | static bool called_commit; | ||
| 57 | static bool called_decommit; | ||
| 58 | static bool called_purge_lazy; | ||
| 59 | static bool called_purge_forced; | ||
| 60 | static bool called_split; | ||
| 61 | static bool called_merge; | ||
| 62 | |||
| 63 | /* Set to false prior to operations, then introspect after operations. */ | ||
| 64 | static bool did_alloc; | ||
| 65 | static bool did_dalloc; | ||
| 66 | static bool did_destroy; | ||
| 67 | static bool did_commit; | ||
| 68 | static bool did_decommit; | ||
| 69 | static bool did_purge_lazy; | ||
| 70 | static bool did_purge_forced; | ||
| 71 | static bool did_split; | ||
| 72 | static bool did_merge; | ||
| 73 | |||
| 74 | #if 0 | ||
| 75 | # define TRACE_HOOK(fmt, ...) malloc_printf(fmt, __VA_ARGS__) | ||
| 76 | #else | ||
| 77 | # define TRACE_HOOK(fmt, ...) | ||
| 78 | #endif | ||
| 79 | |||
| 80 | static void * | ||
| 81 | extent_alloc_hook(extent_hooks_t *extent_hooks, void *new_addr, size_t size, | ||
| 82 | size_t alignment, bool *zero, bool *commit, unsigned arena_ind) { | ||
| 83 | void *ret; | ||
| 84 | |||
| 85 | TRACE_HOOK("%s(extent_hooks=%p, new_addr=%p, size=%zu, alignment=%zu, " | ||
| 86 | "*zero=%s, *commit=%s, arena_ind=%u)\n", __func__, extent_hooks, | ||
| 87 | new_addr, size, alignment, *zero ? "true" : "false", *commit ? | ||
| 88 | "true" : "false", arena_ind); | ||
| 89 | expect_ptr_eq(extent_hooks, &hooks, | ||
| 90 | "extent_hooks should be same as pointer used to set hooks"); | ||
| 91 | expect_ptr_eq(extent_hooks->alloc, extent_alloc_hook, | ||
| 92 | "Wrong hook function"); | ||
| 93 | called_alloc = true; | ||
| 94 | if (!try_alloc) { | ||
| 95 | return NULL; | ||
| 96 | } | ||
| 97 | ret = default_hooks->alloc(default_hooks, new_addr, size, alignment, | ||
| 98 | zero, commit, 0); | ||
| 99 | did_alloc = (ret != NULL); | ||
| 100 | return ret; | ||
| 101 | } | ||
| 102 | |||
| 103 | static bool | ||
| 104 | extent_dalloc_hook(extent_hooks_t *extent_hooks, void *addr, size_t size, | ||
| 105 | bool committed, unsigned arena_ind) { | ||
| 106 | bool err; | ||
| 107 | |||
| 108 | TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, committed=%s, " | ||
| 109 | "arena_ind=%u)\n", __func__, extent_hooks, addr, size, committed ? | ||
| 110 | "true" : "false", arena_ind); | ||
| 111 | expect_ptr_eq(extent_hooks, &hooks, | ||
| 112 | "extent_hooks should be same as pointer used to set hooks"); | ||
| 113 | expect_ptr_eq(extent_hooks->dalloc, extent_dalloc_hook, | ||
| 114 | "Wrong hook function"); | ||
| 115 | called_dalloc = true; | ||
| 116 | if (!try_dalloc) { | ||
| 117 | return true; | ||
| 118 | } | ||
| 119 | err = default_hooks->dalloc(default_hooks, addr, size, committed, 0); | ||
| 120 | did_dalloc = !err; | ||
| 121 | return err; | ||
| 122 | } | ||
| 123 | |||
| 124 | static void | ||
| 125 | extent_destroy_hook(extent_hooks_t *extent_hooks, void *addr, size_t size, | ||
| 126 | bool committed, unsigned arena_ind) { | ||
| 127 | TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, committed=%s, " | ||
| 128 | "arena_ind=%u)\n", __func__, extent_hooks, addr, size, committed ? | ||
| 129 | "true" : "false", arena_ind); | ||
| 130 | expect_ptr_eq(extent_hooks, &hooks, | ||
| 131 | "extent_hooks should be same as pointer used to set hooks"); | ||
| 132 | expect_ptr_eq(extent_hooks->destroy, extent_destroy_hook, | ||
| 133 | "Wrong hook function"); | ||
| 134 | called_destroy = true; | ||
| 135 | if (!try_destroy) { | ||
| 136 | return; | ||
| 137 | } | ||
| 138 | default_hooks->destroy(default_hooks, addr, size, committed, 0); | ||
| 139 | did_destroy = true; | ||
| 140 | } | ||
| 141 | |||
| 142 | static bool | ||
| 143 | extent_commit_hook(extent_hooks_t *extent_hooks, void *addr, size_t size, | ||
| 144 | size_t offset, size_t length, unsigned arena_ind) { | ||
| 145 | bool err; | ||
| 146 | |||
| 147 | TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, offset=%zu, " | ||
| 148 | "length=%zu, arena_ind=%u)\n", __func__, extent_hooks, addr, size, | ||
| 149 | offset, length, arena_ind); | ||
| 150 | expect_ptr_eq(extent_hooks, &hooks, | ||
| 151 | "extent_hooks should be same as pointer used to set hooks"); | ||
| 152 | expect_ptr_eq(extent_hooks->commit, extent_commit_hook, | ||
| 153 | "Wrong hook function"); | ||
| 154 | called_commit = true; | ||
| 155 | if (!try_commit) { | ||
| 156 | return true; | ||
| 157 | } | ||
| 158 | err = default_hooks->commit(default_hooks, addr, size, offset, length, | ||
| 159 | 0); | ||
| 160 | did_commit = !err; | ||
| 161 | return err; | ||
| 162 | } | ||
| 163 | |||
| 164 | static bool | ||
| 165 | extent_decommit_hook(extent_hooks_t *extent_hooks, void *addr, size_t size, | ||
| 166 | size_t offset, size_t length, unsigned arena_ind) { | ||
| 167 | bool err; | ||
| 168 | |||
| 169 | TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, offset=%zu, " | ||
| 170 | "length=%zu, arena_ind=%u)\n", __func__, extent_hooks, addr, size, | ||
| 171 | offset, length, arena_ind); | ||
| 172 | expect_ptr_eq(extent_hooks, &hooks, | ||
| 173 | "extent_hooks should be same as pointer used to set hooks"); | ||
| 174 | expect_ptr_eq(extent_hooks->decommit, extent_decommit_hook, | ||
| 175 | "Wrong hook function"); | ||
| 176 | called_decommit = true; | ||
| 177 | if (!try_decommit) { | ||
| 178 | return true; | ||
| 179 | } | ||
| 180 | err = default_hooks->decommit(default_hooks, addr, size, offset, length, | ||
| 181 | 0); | ||
| 182 | did_decommit = !err; | ||
| 183 | return err; | ||
| 184 | } | ||
| 185 | |||
| 186 | static bool | ||
| 187 | extent_purge_lazy_hook(extent_hooks_t *extent_hooks, void *addr, size_t size, | ||
| 188 | size_t offset, size_t length, unsigned arena_ind) { | ||
| 189 | bool err; | ||
| 190 | |||
| 191 | TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, offset=%zu, " | ||
| 192 | "length=%zu arena_ind=%u)\n", __func__, extent_hooks, addr, size, | ||
| 193 | offset, length, arena_ind); | ||
| 194 | expect_ptr_eq(extent_hooks, &hooks, | ||
| 195 | "extent_hooks should be same as pointer used to set hooks"); | ||
| 196 | expect_ptr_eq(extent_hooks->purge_lazy, extent_purge_lazy_hook, | ||
| 197 | "Wrong hook function"); | ||
| 198 | called_purge_lazy = true; | ||
| 199 | if (!try_purge_lazy) { | ||
| 200 | return true; | ||
| 201 | } | ||
| 202 | err = default_hooks->purge_lazy == NULL || | ||
| 203 | default_hooks->purge_lazy(default_hooks, addr, size, offset, length, | ||
| 204 | 0); | ||
| 205 | did_purge_lazy = !err; | ||
| 206 | return err; | ||
| 207 | } | ||
| 208 | |||
| 209 | static bool | ||
| 210 | extent_purge_forced_hook(extent_hooks_t *extent_hooks, void *addr, size_t size, | ||
| 211 | size_t offset, size_t length, unsigned arena_ind) { | ||
| 212 | bool err; | ||
| 213 | |||
| 214 | TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, offset=%zu, " | ||
| 215 | "length=%zu arena_ind=%u)\n", __func__, extent_hooks, addr, size, | ||
| 216 | offset, length, arena_ind); | ||
| 217 | expect_ptr_eq(extent_hooks, &hooks, | ||
| 218 | "extent_hooks should be same as pointer used to set hooks"); | ||
| 219 | expect_ptr_eq(extent_hooks->purge_forced, extent_purge_forced_hook, | ||
| 220 | "Wrong hook function"); | ||
| 221 | called_purge_forced = true; | ||
| 222 | if (!try_purge_forced) { | ||
| 223 | return true; | ||
| 224 | } | ||
| 225 | err = default_hooks->purge_forced == NULL || | ||
| 226 | default_hooks->purge_forced(default_hooks, addr, size, offset, | ||
| 227 | length, 0); | ||
| 228 | did_purge_forced = !err; | ||
| 229 | return err; | ||
| 230 | } | ||
| 231 | |||
| 232 | static bool | ||
| 233 | extent_split_hook(extent_hooks_t *extent_hooks, void *addr, size_t size, | ||
| 234 | size_t size_a, size_t size_b, bool committed, unsigned arena_ind) { | ||
| 235 | bool err; | ||
| 236 | |||
| 237 | TRACE_HOOK("%s(extent_hooks=%p, addr=%p, size=%zu, size_a=%zu, " | ||
| 238 | "size_b=%zu, committed=%s, arena_ind=%u)\n", __func__, extent_hooks, | ||
| 239 | addr, size, size_a, size_b, committed ? "true" : "false", | ||
| 240 | arena_ind); | ||
| 241 | expect_ptr_eq(extent_hooks, &hooks, | ||
| 242 | "extent_hooks should be same as pointer used to set hooks"); | ||
| 243 | expect_ptr_eq(extent_hooks->split, extent_split_hook, | ||
| 244 | "Wrong hook function"); | ||
| 245 | called_split = true; | ||
| 246 | if (!try_split) { | ||
| 247 | return true; | ||
| 248 | } | ||
| 249 | err = (default_hooks->split == NULL || | ||
| 250 | default_hooks->split(default_hooks, addr, size, size_a, size_b, | ||
| 251 | committed, 0)); | ||
| 252 | did_split = !err; | ||
| 253 | return err; | ||
| 254 | } | ||
| 255 | |||
| 256 | static bool | ||
| 257 | extent_merge_hook(extent_hooks_t *extent_hooks, void *addr_a, size_t size_a, | ||
| 258 | void *addr_b, size_t size_b, bool committed, unsigned arena_ind) { | ||
| 259 | bool err; | ||
| 260 | |||
| 261 | TRACE_HOOK("%s(extent_hooks=%p, addr_a=%p, size_a=%zu, addr_b=%p " | ||
| 262 | "size_b=%zu, committed=%s, arena_ind=%u)\n", __func__, extent_hooks, | ||
| 263 | addr_a, size_a, addr_b, size_b, committed ? "true" : "false", | ||
| 264 | arena_ind); | ||
| 265 | expect_ptr_eq(extent_hooks, &hooks, | ||
| 266 | "extent_hooks should be same as pointer used to set hooks"); | ||
| 267 | expect_ptr_eq(extent_hooks->merge, extent_merge_hook, | ||
| 268 | "Wrong hook function"); | ||
| 269 | expect_ptr_eq((void *)((uintptr_t)addr_a + size_a), addr_b, | ||
| 270 | "Extents not mergeable"); | ||
| 271 | called_merge = true; | ||
| 272 | if (!try_merge) { | ||
| 273 | return true; | ||
| 274 | } | ||
| 275 | err = (default_hooks->merge == NULL || | ||
| 276 | default_hooks->merge(default_hooks, addr_a, size_a, addr_b, size_b, | ||
| 277 | committed, 0)); | ||
| 278 | did_merge = !err; | ||
| 279 | return err; | ||
| 280 | } | ||
| 281 | |||
| 282 | static void | ||
| 283 | extent_hooks_prep(void) { | ||
| 284 | size_t sz; | ||
| 285 | |||
| 286 | sz = sizeof(default_hooks); | ||
| 287 | expect_d_eq(mallctl("arena.0.extent_hooks", (void *)&default_hooks, &sz, | ||
| 288 | NULL, 0), 0, "Unexpected mallctl() error"); | ||
| 289 | } | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/jemalloc_test.h.in b/examples/redis-unstable/deps/jemalloc/test/include/test/jemalloc_test.h.in new file mode 100644 index 0000000..3f8c0da --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/jemalloc_test.h.in | |||
| @@ -0,0 +1,180 @@ | |||
| 1 | #ifdef __cplusplus | ||
| 2 | extern "C" { | ||
| 3 | #endif | ||
| 4 | |||
| 5 | #include <limits.h> | ||
| 6 | #ifndef SIZE_T_MAX | ||
| 7 | # define SIZE_T_MAX SIZE_MAX | ||
| 8 | #endif | ||
| 9 | #include <stdlib.h> | ||
| 10 | #include <stdarg.h> | ||
| 11 | #include <stdbool.h> | ||
| 12 | #include <errno.h> | ||
| 13 | #include <math.h> | ||
| 14 | #include <string.h> | ||
| 15 | #ifdef _WIN32 | ||
| 16 | # include "msvc_compat/strings.h" | ||
| 17 | #endif | ||
| 18 | |||
| 19 | #ifdef _WIN32 | ||
| 20 | # include <windows.h> | ||
| 21 | # include "msvc_compat/windows_extra.h" | ||
| 22 | #else | ||
| 23 | # include <pthread.h> | ||
| 24 | #endif | ||
| 25 | |||
| 26 | #include "test/jemalloc_test_defs.h" | ||
| 27 | |||
| 28 | #if defined(JEMALLOC_OSATOMIC) | ||
| 29 | # include <libkern/OSAtomic.h> | ||
| 30 | #endif | ||
| 31 | |||
| 32 | #if defined(HAVE_ALTIVEC) && !defined(__APPLE__) | ||
| 33 | # include <altivec.h> | ||
| 34 | #endif | ||
| 35 | #ifdef HAVE_SSE2 | ||
| 36 | # include <emmintrin.h> | ||
| 37 | #endif | ||
| 38 | |||
| 39 | /******************************************************************************/ | ||
| 40 | /* | ||
| 41 | * For unit tests and analytics tests, expose all public and private interfaces. | ||
| 42 | */ | ||
| 43 | #if defined(JEMALLOC_UNIT_TEST) || defined (JEMALLOC_ANALYZE_TEST) | ||
| 44 | # define JEMALLOC_JET | ||
| 45 | # define JEMALLOC_MANGLE | ||
| 46 | # include "jemalloc/internal/jemalloc_preamble.h" | ||
| 47 | # include "jemalloc/internal/jemalloc_internal_includes.h" | ||
| 48 | |||
| 49 | /******************************************************************************/ | ||
| 50 | /* | ||
| 51 | * For integration tests, expose the public jemalloc interfaces, but only | ||
| 52 | * expose the minimum necessary internal utility code (to avoid re-implementing | ||
| 53 | * essentially identical code within the test infrastructure). | ||
| 54 | */ | ||
| 55 | #elif defined(JEMALLOC_INTEGRATION_TEST) || \ | ||
| 56 | defined(JEMALLOC_INTEGRATION_CPP_TEST) | ||
| 57 | # define JEMALLOC_MANGLE | ||
| 58 | # include "jemalloc/jemalloc@install_suffix@.h" | ||
| 59 | # include "jemalloc/internal/jemalloc_internal_defs.h" | ||
| 60 | # include "jemalloc/internal/jemalloc_internal_macros.h" | ||
| 61 | |||
| 62 | static const bool config_debug = | ||
| 63 | #ifdef JEMALLOC_DEBUG | ||
| 64 | true | ||
| 65 | #else | ||
| 66 | false | ||
| 67 | #endif | ||
| 68 | ; | ||
| 69 | |||
| 70 | # define JEMALLOC_N(n) @private_namespace@##n | ||
| 71 | # include "jemalloc/internal/private_namespace.h" | ||
| 72 | # include "jemalloc/internal/test_hooks.h" | ||
| 73 | |||
| 74 | /* Hermetic headers. */ | ||
| 75 | # include "jemalloc/internal/assert.h" | ||
| 76 | # include "jemalloc/internal/malloc_io.h" | ||
| 77 | # include "jemalloc/internal/nstime.h" | ||
| 78 | # include "jemalloc/internal/util.h" | ||
| 79 | |||
| 80 | /* Non-hermetic headers. */ | ||
| 81 | # include "jemalloc/internal/qr.h" | ||
| 82 | # include "jemalloc/internal/ql.h" | ||
| 83 | |||
| 84 | /******************************************************************************/ | ||
| 85 | /* | ||
| 86 | * For stress tests, expose the public jemalloc interfaces with name mangling | ||
| 87 | * so that they can be tested as e.g. malloc() and free(). Also expose the | ||
| 88 | * public jemalloc interfaces with jet_ prefixes, so that stress tests can use | ||
| 89 | * a separate allocator for their internal data structures. | ||
| 90 | */ | ||
| 91 | #elif defined(JEMALLOC_STRESS_TEST) | ||
| 92 | # include "jemalloc/jemalloc@install_suffix@.h" | ||
| 93 | |||
| 94 | # include "jemalloc/jemalloc_protos_jet.h" | ||
| 95 | |||
| 96 | # define JEMALLOC_JET | ||
| 97 | # include "jemalloc/internal/jemalloc_preamble.h" | ||
| 98 | # include "jemalloc/internal/jemalloc_internal_includes.h" | ||
| 99 | # include "jemalloc/internal/public_unnamespace.h" | ||
| 100 | # undef JEMALLOC_JET | ||
| 101 | |||
| 102 | # include "jemalloc/jemalloc_rename.h" | ||
| 103 | # define JEMALLOC_MANGLE | ||
| 104 | # ifdef JEMALLOC_STRESS_TESTLIB | ||
| 105 | # include "jemalloc/jemalloc_mangle_jet.h" | ||
| 106 | # else | ||
| 107 | # include "jemalloc/jemalloc_mangle.h" | ||
| 108 | # endif | ||
| 109 | |||
| 110 | /******************************************************************************/ | ||
| 111 | /* | ||
| 112 | * This header does dangerous things, the effects of which only test code | ||
| 113 | * should be subject to. | ||
| 114 | */ | ||
| 115 | #else | ||
| 116 | # error "This header cannot be included outside a testing context" | ||
| 117 | #endif | ||
| 118 | |||
| 119 | /******************************************************************************/ | ||
| 120 | /* | ||
| 121 | * Common test utilities. | ||
| 122 | */ | ||
| 123 | #include "test/btalloc.h" | ||
| 124 | #include "test/math.h" | ||
| 125 | #include "test/mtx.h" | ||
| 126 | #include "test/mq.h" | ||
| 127 | #include "test/sleep.h" | ||
| 128 | #include "test/test.h" | ||
| 129 | #include "test/timer.h" | ||
| 130 | #include "test/thd.h" | ||
| 131 | #include "test/bgthd.h" | ||
| 132 | #define MEXP 19937 | ||
| 133 | #include "test/SFMT.h" | ||
| 134 | |||
| 135 | #ifndef JEMALLOC_HAVE_MALLOC_SIZE | ||
| 136 | #define TEST_MALLOC_SIZE malloc_usable_size | ||
| 137 | #else | ||
| 138 | #define TEST_MALLOC_SIZE malloc_size | ||
| 139 | #endif | ||
| 140 | /******************************************************************************/ | ||
| 141 | /* | ||
| 142 | * Define always-enabled assertion macros, so that test assertions execute even | ||
| 143 | * if assertions are disabled in the library code. | ||
| 144 | */ | ||
| 145 | #undef assert | ||
| 146 | #undef not_reached | ||
| 147 | #undef not_implemented | ||
| 148 | #undef expect_not_implemented | ||
| 149 | |||
| 150 | #define assert(e) do { \ | ||
| 151 | if (!(e)) { \ | ||
| 152 | malloc_printf( \ | ||
| 153 | "<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \ | ||
| 154 | __FILE__, __LINE__, #e); \ | ||
| 155 | abort(); \ | ||
| 156 | } \ | ||
| 157 | } while (0) | ||
| 158 | |||
| 159 | #define not_reached() do { \ | ||
| 160 | malloc_printf( \ | ||
| 161 | "<jemalloc>: %s:%d: Unreachable code reached\n", \ | ||
| 162 | __FILE__, __LINE__); \ | ||
| 163 | abort(); \ | ||
| 164 | } while (0) | ||
| 165 | |||
| 166 | #define not_implemented() do { \ | ||
| 167 | malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \ | ||
| 168 | __FILE__, __LINE__); \ | ||
| 169 | abort(); \ | ||
| 170 | } while (0) | ||
| 171 | |||
| 172 | #define expect_not_implemented(e) do { \ | ||
| 173 | if (!(e)) { \ | ||
| 174 | not_implemented(); \ | ||
| 175 | } \ | ||
| 176 | } while (0) | ||
| 177 | |||
| 178 | #ifdef __cplusplus | ||
| 179 | } | ||
| 180 | #endif | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/jemalloc_test_defs.h.in b/examples/redis-unstable/deps/jemalloc/test/include/test/jemalloc_test_defs.h.in new file mode 100644 index 0000000..5cc8532 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/jemalloc_test_defs.h.in | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | #include "jemalloc/internal/jemalloc_internal_defs.h" | ||
| 2 | #include "jemalloc/internal/jemalloc_internal_decls.h" | ||
| 3 | |||
| 4 | /* | ||
| 5 | * For use by SFMT. configure.ac doesn't actually define HAVE_SSE2 because its | ||
| 6 | * dependencies are notoriously unportable in practice. | ||
| 7 | */ | ||
| 8 | #undef HAVE_SSE2 | ||
| 9 | #undef HAVE_ALTIVEC | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/math.h b/examples/redis-unstable/deps/jemalloc/test/include/test/math.h new file mode 100644 index 0000000..efba086 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/math.h | |||
| @@ -0,0 +1,306 @@ | |||
| 1 | /* | ||
| 2 | * Compute the natural log of Gamma(x), accurate to 10 decimal places. | ||
| 3 | * | ||
| 4 | * This implementation is based on: | ||
| 5 | * | ||
| 6 | * Pike, M.C., I.D. Hill (1966) Algorithm 291: Logarithm of Gamma function | ||
| 7 | * [S14]. Communications of the ACM 9(9):684. | ||
| 8 | */ | ||
| 9 | static inline double | ||
| 10 | ln_gamma(double x) { | ||
| 11 | double f, z; | ||
| 12 | |||
| 13 | assert(x > 0.0); | ||
| 14 | |||
| 15 | if (x < 7.0) { | ||
| 16 | f = 1.0; | ||
| 17 | z = x; | ||
| 18 | while (z < 7.0) { | ||
| 19 | f *= z; | ||
| 20 | z += 1.0; | ||
| 21 | } | ||
| 22 | x = z; | ||
| 23 | f = -log(f); | ||
| 24 | } else { | ||
| 25 | f = 0.0; | ||
| 26 | } | ||
| 27 | |||
| 28 | z = 1.0 / (x * x); | ||
| 29 | |||
| 30 | return f + (x-0.5) * log(x) - x + 0.918938533204673 + | ||
| 31 | (((-0.000595238095238 * z + 0.000793650793651) * z - | ||
| 32 | 0.002777777777778) * z + 0.083333333333333) / x; | ||
| 33 | } | ||
| 34 | |||
| 35 | /* | ||
| 36 | * Compute the incomplete Gamma ratio for [0..x], where p is the shape | ||
| 37 | * parameter, and ln_gamma_p is ln_gamma(p). | ||
| 38 | * | ||
| 39 | * This implementation is based on: | ||
| 40 | * | ||
| 41 | * Bhattacharjee, G.P. (1970) Algorithm AS 32: The incomplete Gamma integral. | ||
| 42 | * Applied Statistics 19:285-287. | ||
| 43 | */ | ||
| 44 | static inline double | ||
| 45 | i_gamma(double x, double p, double ln_gamma_p) { | ||
| 46 | double acu, factor, oflo, gin, term, rn, a, b, an, dif; | ||
| 47 | double pn[6]; | ||
| 48 | unsigned i; | ||
| 49 | |||
| 50 | assert(p > 0.0); | ||
| 51 | assert(x >= 0.0); | ||
| 52 | |||
| 53 | if (x == 0.0) { | ||
| 54 | return 0.0; | ||
| 55 | } | ||
| 56 | |||
| 57 | acu = 1.0e-10; | ||
| 58 | oflo = 1.0e30; | ||
| 59 | gin = 0.0; | ||
| 60 | factor = exp(p * log(x) - x - ln_gamma_p); | ||
| 61 | |||
| 62 | if (x <= 1.0 || x < p) { | ||
| 63 | /* Calculation by series expansion. */ | ||
| 64 | gin = 1.0; | ||
| 65 | term = 1.0; | ||
| 66 | rn = p; | ||
| 67 | |||
| 68 | while (true) { | ||
| 69 | rn += 1.0; | ||
| 70 | term *= x / rn; | ||
| 71 | gin += term; | ||
| 72 | if (term <= acu) { | ||
| 73 | gin *= factor / p; | ||
| 74 | return gin; | ||
| 75 | } | ||
| 76 | } | ||
| 77 | } else { | ||
| 78 | /* Calculation by continued fraction. */ | ||
| 79 | a = 1.0 - p; | ||
| 80 | b = a + x + 1.0; | ||
| 81 | term = 0.0; | ||
| 82 | pn[0] = 1.0; | ||
| 83 | pn[1] = x; | ||
| 84 | pn[2] = x + 1.0; | ||
| 85 | pn[3] = x * b; | ||
| 86 | gin = pn[2] / pn[3]; | ||
| 87 | |||
| 88 | while (true) { | ||
| 89 | a += 1.0; | ||
| 90 | b += 2.0; | ||
| 91 | term += 1.0; | ||
| 92 | an = a * term; | ||
| 93 | for (i = 0; i < 2; i++) { | ||
| 94 | pn[i+4] = b * pn[i+2] - an * pn[i]; | ||
| 95 | } | ||
| 96 | if (pn[5] != 0.0) { | ||
| 97 | rn = pn[4] / pn[5]; | ||
| 98 | dif = fabs(gin - rn); | ||
| 99 | if (dif <= acu && dif <= acu * rn) { | ||
| 100 | gin = 1.0 - factor * gin; | ||
| 101 | return gin; | ||
| 102 | } | ||
| 103 | gin = rn; | ||
| 104 | } | ||
| 105 | for (i = 0; i < 4; i++) { | ||
| 106 | pn[i] = pn[i+2]; | ||
| 107 | } | ||
| 108 | |||
| 109 | if (fabs(pn[4]) >= oflo) { | ||
| 110 | for (i = 0; i < 4; i++) { | ||
| 111 | pn[i] /= oflo; | ||
| 112 | } | ||
| 113 | } | ||
| 114 | } | ||
| 115 | } | ||
| 116 | } | ||
| 117 | |||
| 118 | /* | ||
| 119 | * Given a value p in [0..1] of the lower tail area of the normal distribution, | ||
| 120 | * compute the limit on the definite integral from [-inf..z] that satisfies p, | ||
| 121 | * accurate to 16 decimal places. | ||
| 122 | * | ||
| 123 | * This implementation is based on: | ||
| 124 | * | ||
| 125 | * Wichura, M.J. (1988) Algorithm AS 241: The percentage points of the normal | ||
| 126 | * distribution. Applied Statistics 37(3):477-484. | ||
| 127 | */ | ||
| 128 | static inline double | ||
| 129 | pt_norm(double p) { | ||
| 130 | double q, r, ret; | ||
| 131 | |||
| 132 | assert(p > 0.0 && p < 1.0); | ||
| 133 | |||
| 134 | q = p - 0.5; | ||
| 135 | if (fabs(q) <= 0.425) { | ||
| 136 | /* p close to 1/2. */ | ||
| 137 | r = 0.180625 - q * q; | ||
| 138 | return q * (((((((2.5090809287301226727e3 * r + | ||
| 139 | 3.3430575583588128105e4) * r + 6.7265770927008700853e4) * r | ||
| 140 | + 4.5921953931549871457e4) * r + 1.3731693765509461125e4) * | ||
| 141 | r + 1.9715909503065514427e3) * r + 1.3314166789178437745e2) | ||
| 142 | * r + 3.3871328727963666080e0) / | ||
| 143 | (((((((5.2264952788528545610e3 * r + | ||
| 144 | 2.8729085735721942674e4) * r + 3.9307895800092710610e4) * r | ||
| 145 | + 2.1213794301586595867e4) * r + 5.3941960214247511077e3) * | ||
| 146 | r + 6.8718700749205790830e2) * r + 4.2313330701600911252e1) | ||
| 147 | * r + 1.0); | ||
| 148 | } else { | ||
| 149 | if (q < 0.0) { | ||
| 150 | r = p; | ||
| 151 | } else { | ||
| 152 | r = 1.0 - p; | ||
| 153 | } | ||
| 154 | assert(r > 0.0); | ||
| 155 | |||
| 156 | r = sqrt(-log(r)); | ||
| 157 | if (r <= 5.0) { | ||
| 158 | /* p neither close to 1/2 nor 0 or 1. */ | ||
| 159 | r -= 1.6; | ||
| 160 | ret = ((((((((7.74545014278341407640e-4 * r + | ||
| 161 | 2.27238449892691845833e-2) * r + | ||
| 162 | 2.41780725177450611770e-1) * r + | ||
| 163 | 1.27045825245236838258e0) * r + | ||
| 164 | 3.64784832476320460504e0) * r + | ||
| 165 | 5.76949722146069140550e0) * r + | ||
| 166 | 4.63033784615654529590e0) * r + | ||
| 167 | 1.42343711074968357734e0) / | ||
| 168 | (((((((1.05075007164441684324e-9 * r + | ||
| 169 | 5.47593808499534494600e-4) * r + | ||
| 170 | 1.51986665636164571966e-2) | ||
| 171 | * r + 1.48103976427480074590e-1) * r + | ||
| 172 | 6.89767334985100004550e-1) * r + | ||
| 173 | 1.67638483018380384940e0) * r + | ||
| 174 | 2.05319162663775882187e0) * r + 1.0)); | ||
| 175 | } else { | ||
| 176 | /* p near 0 or 1. */ | ||
| 177 | r -= 5.0; | ||
| 178 | ret = ((((((((2.01033439929228813265e-7 * r + | ||
| 179 | 2.71155556874348757815e-5) * r + | ||
| 180 | 1.24266094738807843860e-3) * r + | ||
| 181 | 2.65321895265761230930e-2) * r + | ||
| 182 | 2.96560571828504891230e-1) * r + | ||
| 183 | 1.78482653991729133580e0) * r + | ||
| 184 | 5.46378491116411436990e0) * r + | ||
| 185 | 6.65790464350110377720e0) / | ||
| 186 | (((((((2.04426310338993978564e-15 * r + | ||
| 187 | 1.42151175831644588870e-7) * r + | ||
| 188 | 1.84631831751005468180e-5) * r + | ||
| 189 | 7.86869131145613259100e-4) * r + | ||
| 190 | 1.48753612908506148525e-2) * r + | ||
| 191 | 1.36929880922735805310e-1) * r + | ||
| 192 | 5.99832206555887937690e-1) | ||
| 193 | * r + 1.0)); | ||
| 194 | } | ||
| 195 | if (q < 0.0) { | ||
| 196 | ret = -ret; | ||
| 197 | } | ||
| 198 | return ret; | ||
| 199 | } | ||
| 200 | } | ||
| 201 | |||
| 202 | /* | ||
| 203 | * Given a value p in [0..1] of the lower tail area of the Chi^2 distribution | ||
| 204 | * with df degrees of freedom, where ln_gamma_df_2 is ln_gamma(df/2.0), compute | ||
| 205 | * the upper limit on the definite integral from [0..z] that satisfies p, | ||
| 206 | * accurate to 12 decimal places. | ||
| 207 | * | ||
| 208 | * This implementation is based on: | ||
| 209 | * | ||
| 210 | * Best, D.J., D.E. Roberts (1975) Algorithm AS 91: The percentage points of | ||
| 211 | * the Chi^2 distribution. Applied Statistics 24(3):385-388. | ||
| 212 | * | ||
| 213 | * Shea, B.L. (1991) Algorithm AS R85: A remark on AS 91: The percentage | ||
| 214 | * points of the Chi^2 distribution. Applied Statistics 40(1):233-235. | ||
| 215 | */ | ||
| 216 | static inline double | ||
| 217 | pt_chi2(double p, double df, double ln_gamma_df_2) { | ||
| 218 | double e, aa, xx, c, ch, a, q, p1, p2, t, x, b, s1, s2, s3, s4, s5, s6; | ||
| 219 | unsigned i; | ||
| 220 | |||
| 221 | assert(p >= 0.0 && p < 1.0); | ||
| 222 | assert(df > 0.0); | ||
| 223 | |||
| 224 | e = 5.0e-7; | ||
| 225 | aa = 0.6931471805; | ||
| 226 | |||
| 227 | xx = 0.5 * df; | ||
| 228 | c = xx - 1.0; | ||
| 229 | |||
| 230 | if (df < -1.24 * log(p)) { | ||
| 231 | /* Starting approximation for small Chi^2. */ | ||
| 232 | ch = pow(p * xx * exp(ln_gamma_df_2 + xx * aa), 1.0 / xx); | ||
| 233 | if (ch - e < 0.0) { | ||
| 234 | return ch; | ||
| 235 | } | ||
| 236 | } else { | ||
| 237 | if (df > 0.32) { | ||
| 238 | x = pt_norm(p); | ||
| 239 | /* | ||
| 240 | * Starting approximation using Wilson and Hilferty | ||
| 241 | * estimate. | ||
| 242 | */ | ||
| 243 | p1 = 0.222222 / df; | ||
| 244 | ch = df * pow(x * sqrt(p1) + 1.0 - p1, 3.0); | ||
| 245 | /* Starting approximation for p tending to 1. */ | ||
| 246 | if (ch > 2.2 * df + 6.0) { | ||
| 247 | ch = -2.0 * (log(1.0 - p) - c * log(0.5 * ch) + | ||
| 248 | ln_gamma_df_2); | ||
| 249 | } | ||
| 250 | } else { | ||
| 251 | ch = 0.4; | ||
| 252 | a = log(1.0 - p); | ||
| 253 | while (true) { | ||
| 254 | q = ch; | ||
| 255 | p1 = 1.0 + ch * (4.67 + ch); | ||
| 256 | p2 = ch * (6.73 + ch * (6.66 + ch)); | ||
| 257 | t = -0.5 + (4.67 + 2.0 * ch) / p1 - (6.73 + ch | ||
| 258 | * (13.32 + 3.0 * ch)) / p2; | ||
| 259 | ch -= (1.0 - exp(a + ln_gamma_df_2 + 0.5 * ch + | ||
| 260 | c * aa) * p2 / p1) / t; | ||
| 261 | if (fabs(q / ch - 1.0) - 0.01 <= 0.0) { | ||
| 262 | break; | ||
| 263 | } | ||
| 264 | } | ||
| 265 | } | ||
| 266 | } | ||
| 267 | |||
| 268 | for (i = 0; i < 20; i++) { | ||
| 269 | /* Calculation of seven-term Taylor series. */ | ||
| 270 | q = ch; | ||
| 271 | p1 = 0.5 * ch; | ||
| 272 | if (p1 < 0.0) { | ||
| 273 | return -1.0; | ||
| 274 | } | ||
| 275 | p2 = p - i_gamma(p1, xx, ln_gamma_df_2); | ||
| 276 | t = p2 * exp(xx * aa + ln_gamma_df_2 + p1 - c * log(ch)); | ||
| 277 | b = t / ch; | ||
| 278 | a = 0.5 * t - b * c; | ||
| 279 | s1 = (210.0 + a * (140.0 + a * (105.0 + a * (84.0 + a * (70.0 + | ||
| 280 | 60.0 * a))))) / 420.0; | ||
| 281 | s2 = (420.0 + a * (735.0 + a * (966.0 + a * (1141.0 + 1278.0 * | ||
| 282 | a)))) / 2520.0; | ||
| 283 | s3 = (210.0 + a * (462.0 + a * (707.0 + 932.0 * a))) / 2520.0; | ||
| 284 | s4 = (252.0 + a * (672.0 + 1182.0 * a) + c * (294.0 + a * | ||
| 285 | (889.0 + 1740.0 * a))) / 5040.0; | ||
| 286 | s5 = (84.0 + 264.0 * a + c * (175.0 + 606.0 * a)) / 2520.0; | ||
| 287 | s6 = (120.0 + c * (346.0 + 127.0 * c)) / 5040.0; | ||
| 288 | ch += t * (1.0 + 0.5 * t * s1 - b * c * (s1 - b * (s2 - b * (s3 | ||
| 289 | - b * (s4 - b * (s5 - b * s6)))))); | ||
| 290 | if (fabs(q / ch - 1.0) <= e) { | ||
| 291 | break; | ||
| 292 | } | ||
| 293 | } | ||
| 294 | |||
| 295 | return ch; | ||
| 296 | } | ||
| 297 | |||
| 298 | /* | ||
| 299 | * Given a value p in [0..1] and Gamma distribution shape and scale parameters, | ||
| 300 | * compute the upper limit on the definite integral from [0..z] that satisfies | ||
| 301 | * p. | ||
| 302 | */ | ||
| 303 | static inline double | ||
| 304 | pt_gamma(double p, double shape, double scale, double ln_gamma_shape) { | ||
| 305 | return pt_chi2(p, shape * 2.0, ln_gamma_shape) * 0.5 * scale; | ||
| 306 | } | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/mq.h b/examples/redis-unstable/deps/jemalloc/test/include/test/mq.h new file mode 100644 index 0000000..5dc6486 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/mq.h | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | #include "test/sleep.h" | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Simple templated message queue implementation that relies on only mutexes for | ||
| 5 | * synchronization (which reduces portability issues). Given the following | ||
| 6 | * setup: | ||
| 7 | * | ||
| 8 | * typedef struct mq_msg_s mq_msg_t; | ||
| 9 | * struct mq_msg_s { | ||
| 10 | * mq_msg(mq_msg_t) link; | ||
| 11 | * [message data] | ||
| 12 | * }; | ||
| 13 | * mq_gen(, mq_, mq_t, mq_msg_t, link) | ||
| 14 | * | ||
| 15 | * The API is as follows: | ||
| 16 | * | ||
| 17 | * bool mq_init(mq_t *mq); | ||
| 18 | * void mq_fini(mq_t *mq); | ||
| 19 | * unsigned mq_count(mq_t *mq); | ||
| 20 | * mq_msg_t *mq_tryget(mq_t *mq); | ||
| 21 | * mq_msg_t *mq_get(mq_t *mq); | ||
| 22 | * void mq_put(mq_t *mq, mq_msg_t *msg); | ||
| 23 | * | ||
| 24 | * The message queue linkage embedded in each message is to be treated as | ||
| 25 | * externally opaque (no need to initialize or clean up externally). mq_fini() | ||
| 26 | * does not perform any cleanup of messages, since it knows nothing of their | ||
| 27 | * payloads. | ||
| 28 | */ | ||
| 29 | #define mq_msg(a_mq_msg_type) ql_elm(a_mq_msg_type) | ||
| 30 | |||
| 31 | #define mq_gen(a_attr, a_prefix, a_mq_type, a_mq_msg_type, a_field) \ | ||
| 32 | typedef struct { \ | ||
| 33 | mtx_t lock; \ | ||
| 34 | ql_head(a_mq_msg_type) msgs; \ | ||
| 35 | unsigned count; \ | ||
| 36 | } a_mq_type; \ | ||
| 37 | a_attr bool \ | ||
| 38 | a_prefix##init(a_mq_type *mq) { \ | ||
| 39 | \ | ||
| 40 | if (mtx_init(&mq->lock)) { \ | ||
| 41 | return true; \ | ||
| 42 | } \ | ||
| 43 | ql_new(&mq->msgs); \ | ||
| 44 | mq->count = 0; \ | ||
| 45 | return false; \ | ||
| 46 | } \ | ||
| 47 | a_attr void \ | ||
| 48 | a_prefix##fini(a_mq_type *mq) { \ | ||
| 49 | mtx_fini(&mq->lock); \ | ||
| 50 | } \ | ||
| 51 | a_attr unsigned \ | ||
| 52 | a_prefix##count(a_mq_type *mq) { \ | ||
| 53 | unsigned count; \ | ||
| 54 | \ | ||
| 55 | mtx_lock(&mq->lock); \ | ||
| 56 | count = mq->count; \ | ||
| 57 | mtx_unlock(&mq->lock); \ | ||
| 58 | return count; \ | ||
| 59 | } \ | ||
| 60 | a_attr a_mq_msg_type * \ | ||
| 61 | a_prefix##tryget(a_mq_type *mq) { \ | ||
| 62 | a_mq_msg_type *msg; \ | ||
| 63 | \ | ||
| 64 | mtx_lock(&mq->lock); \ | ||
| 65 | msg = ql_first(&mq->msgs); \ | ||
| 66 | if (msg != NULL) { \ | ||
| 67 | ql_head_remove(&mq->msgs, a_mq_msg_type, a_field); \ | ||
| 68 | mq->count--; \ | ||
| 69 | } \ | ||
| 70 | mtx_unlock(&mq->lock); \ | ||
| 71 | return msg; \ | ||
| 72 | } \ | ||
| 73 | a_attr a_mq_msg_type * \ | ||
| 74 | a_prefix##get(a_mq_type *mq) { \ | ||
| 75 | a_mq_msg_type *msg; \ | ||
| 76 | unsigned ns; \ | ||
| 77 | \ | ||
| 78 | msg = a_prefix##tryget(mq); \ | ||
| 79 | if (msg != NULL) { \ | ||
| 80 | return msg; \ | ||
| 81 | } \ | ||
| 82 | \ | ||
| 83 | ns = 1; \ | ||
| 84 | while (true) { \ | ||
| 85 | sleep_ns(ns); \ | ||
| 86 | msg = a_prefix##tryget(mq); \ | ||
| 87 | if (msg != NULL) { \ | ||
| 88 | return msg; \ | ||
| 89 | } \ | ||
| 90 | if (ns < 1000*1000*1000) { \ | ||
| 91 | /* Double sleep time, up to max 1 second. */ \ | ||
| 92 | ns <<= 1; \ | ||
| 93 | if (ns > 1000*1000*1000) { \ | ||
| 94 | ns = 1000*1000*1000; \ | ||
| 95 | } \ | ||
| 96 | } \ | ||
| 97 | } \ | ||
| 98 | } \ | ||
| 99 | a_attr void \ | ||
| 100 | a_prefix##put(a_mq_type *mq, a_mq_msg_type *msg) { \ | ||
| 101 | \ | ||
| 102 | mtx_lock(&mq->lock); \ | ||
| 103 | ql_elm_new(msg, a_field); \ | ||
| 104 | ql_tail_insert(&mq->msgs, msg, a_field); \ | ||
| 105 | mq->count++; \ | ||
| 106 | mtx_unlock(&mq->lock); \ | ||
| 107 | } | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/mtx.h b/examples/redis-unstable/deps/jemalloc/test/include/test/mtx.h new file mode 100644 index 0000000..066a213 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/mtx.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* | ||
| 2 | * mtx is a slightly simplified version of malloc_mutex. This code duplication | ||
| 3 | * is unfortunate, but there are allocator bootstrapping considerations that | ||
| 4 | * would leak into the test infrastructure if malloc_mutex were used directly | ||
| 5 | * in tests. | ||
| 6 | */ | ||
| 7 | |||
| 8 | typedef struct { | ||
| 9 | #ifdef _WIN32 | ||
| 10 | CRITICAL_SECTION lock; | ||
| 11 | #elif (defined(JEMALLOC_OS_UNFAIR_LOCK)) | ||
| 12 | os_unfair_lock lock; | ||
| 13 | #else | ||
| 14 | pthread_mutex_t lock; | ||
| 15 | #endif | ||
| 16 | } mtx_t; | ||
| 17 | |||
| 18 | bool mtx_init(mtx_t *mtx); | ||
| 19 | void mtx_fini(mtx_t *mtx); | ||
| 20 | void mtx_lock(mtx_t *mtx); | ||
| 21 | void mtx_unlock(mtx_t *mtx); | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/nbits.h b/examples/redis-unstable/deps/jemalloc/test/include/test/nbits.h new file mode 100644 index 0000000..c06cf1b --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/nbits.h | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | #ifndef TEST_NBITS_H | ||
| 2 | #define TEST_NBITS_H | ||
| 3 | |||
| 4 | /* Interesting bitmap counts to test. */ | ||
| 5 | |||
| 6 | #define NBITS_TAB \ | ||
| 7 | NB( 1) \ | ||
| 8 | NB( 2) \ | ||
| 9 | NB( 3) \ | ||
| 10 | NB( 4) \ | ||
| 11 | NB( 5) \ | ||
| 12 | NB( 6) \ | ||
| 13 | NB( 7) \ | ||
| 14 | NB( 8) \ | ||
| 15 | NB( 9) \ | ||
| 16 | NB(10) \ | ||
| 17 | NB(11) \ | ||
| 18 | NB(12) \ | ||
| 19 | NB(13) \ | ||
| 20 | NB(14) \ | ||
| 21 | NB(15) \ | ||
| 22 | NB(16) \ | ||
| 23 | NB(17) \ | ||
| 24 | NB(18) \ | ||
| 25 | NB(19) \ | ||
| 26 | NB(20) \ | ||
| 27 | NB(21) \ | ||
| 28 | NB(22) \ | ||
| 29 | NB(23) \ | ||
| 30 | NB(24) \ | ||
| 31 | NB(25) \ | ||
| 32 | NB(26) \ | ||
| 33 | NB(27) \ | ||
| 34 | NB(28) \ | ||
| 35 | NB(29) \ | ||
| 36 | NB(30) \ | ||
| 37 | NB(31) \ | ||
| 38 | NB(32) \ | ||
| 39 | \ | ||
| 40 | NB(33) \ | ||
| 41 | NB(34) \ | ||
| 42 | NB(35) \ | ||
| 43 | NB(36) \ | ||
| 44 | NB(37) \ | ||
| 45 | NB(38) \ | ||
| 46 | NB(39) \ | ||
| 47 | NB(40) \ | ||
| 48 | NB(41) \ | ||
| 49 | NB(42) \ | ||
| 50 | NB(43) \ | ||
| 51 | NB(44) \ | ||
| 52 | NB(45) \ | ||
| 53 | NB(46) \ | ||
| 54 | NB(47) \ | ||
| 55 | NB(48) \ | ||
| 56 | NB(49) \ | ||
| 57 | NB(50) \ | ||
| 58 | NB(51) \ | ||
| 59 | NB(52) \ | ||
| 60 | NB(53) \ | ||
| 61 | NB(54) \ | ||
| 62 | NB(55) \ | ||
| 63 | NB(56) \ | ||
| 64 | NB(57) \ | ||
| 65 | NB(58) \ | ||
| 66 | NB(59) \ | ||
| 67 | NB(60) \ | ||
| 68 | NB(61) \ | ||
| 69 | NB(62) \ | ||
| 70 | NB(63) \ | ||
| 71 | NB(64) \ | ||
| 72 | NB(65) \ | ||
| 73 | NB(66) \ | ||
| 74 | NB(67) \ | ||
| 75 | \ | ||
| 76 | NB(126) \ | ||
| 77 | NB(127) \ | ||
| 78 | NB(128) \ | ||
| 79 | NB(129) \ | ||
| 80 | NB(130) \ | ||
| 81 | \ | ||
| 82 | NB(254) \ | ||
| 83 | NB(255) \ | ||
| 84 | NB(256) \ | ||
| 85 | NB(257) \ | ||
| 86 | NB(258) \ | ||
| 87 | \ | ||
| 88 | NB(510) \ | ||
| 89 | NB(511) \ | ||
| 90 | NB(512) \ | ||
| 91 | NB(513) \ | ||
| 92 | NB(514) \ | ||
| 93 | \ | ||
| 94 | NB(1022) \ | ||
| 95 | NB(1023) \ | ||
| 96 | NB(1024) \ | ||
| 97 | NB(1025) \ | ||
| 98 | NB(1026) \ | ||
| 99 | \ | ||
| 100 | NB(2048) \ | ||
| 101 | \ | ||
| 102 | NB(4094) \ | ||
| 103 | NB(4095) \ | ||
| 104 | NB(4096) \ | ||
| 105 | NB(4097) \ | ||
| 106 | NB(4098) \ | ||
| 107 | \ | ||
| 108 | NB(8192) \ | ||
| 109 | NB(16384) | ||
| 110 | |||
| 111 | #endif /* TEST_NBITS_H */ | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/san.h b/examples/redis-unstable/deps/jemalloc/test/include/test/san.h new file mode 100644 index 0000000..da07865 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/san.h | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #if defined(JEMALLOC_UAF_DETECTION) || defined(JEMALLOC_DEBUG) | ||
| 2 | # define TEST_SAN_UAF_ALIGN_ENABLE "lg_san_uaf_align:12" | ||
| 3 | # define TEST_SAN_UAF_ALIGN_DISABLE "lg_san_uaf_align:-1" | ||
| 4 | #else | ||
| 5 | # define TEST_SAN_UAF_ALIGN_ENABLE "" | ||
| 6 | # define TEST_SAN_UAF_ALIGN_DISABLE "" | ||
| 7 | #endif | ||
| 8 | |||
| 9 | static inline bool | ||
| 10 | extent_is_guarded(tsdn_t *tsdn, void *ptr) { | ||
| 11 | edata_t *edata = emap_edata_lookup(tsdn, &arena_emap_global, ptr); | ||
| 12 | return edata_guarded_get(edata); | ||
| 13 | } | ||
| 14 | |||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/sleep.h b/examples/redis-unstable/deps/jemalloc/test/include/test/sleep.h new file mode 100644 index 0000000..c232f63 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/sleep.h | |||
| @@ -0,0 +1 @@ | |||
| void sleep_ns(unsigned ns); | |||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/test.h b/examples/redis-unstable/deps/jemalloc/test/include/test/test.h new file mode 100644 index 0000000..d4b6591 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/test.h | |||
| @@ -0,0 +1,583 @@ | |||
| 1 | #define ASSERT_BUFSIZE 256 | ||
| 2 | |||
| 3 | #define verify_cmp(may_abort, t, a, b, cmp, neg_cmp, pri, ...) do { \ | ||
| 4 | const t a_ = (a); \ | ||
| 5 | const t b_ = (b); \ | ||
| 6 | if (!(a_ cmp b_)) { \ | ||
| 7 | char prefix[ASSERT_BUFSIZE]; \ | ||
| 8 | char message[ASSERT_BUFSIZE]; \ | ||
| 9 | malloc_snprintf(prefix, sizeof(prefix), \ | ||
| 10 | "%s:%s:%d: Failed assertion: " \ | ||
| 11 | "(%s) " #cmp " (%s) --> " \ | ||
| 12 | "%" pri " " #neg_cmp " %" pri ": ", \ | ||
| 13 | __func__, __FILE__, __LINE__, \ | ||
| 14 | #a, #b, a_, b_); \ | ||
| 15 | malloc_snprintf(message, sizeof(message), __VA_ARGS__); \ | ||
| 16 | if (may_abort) { \ | ||
| 17 | abort(); \ | ||
| 18 | } else { \ | ||
| 19 | p_test_fail(prefix, message); \ | ||
| 20 | } \ | ||
| 21 | } \ | ||
| 22 | } while (0) | ||
| 23 | |||
| 24 | #define expect_cmp(t, a, b, cmp, neg_cmp, pri, ...) verify_cmp(false, \ | ||
| 25 | t, a, b, cmp, neg_cmp, pri, __VA_ARGS__) | ||
| 26 | |||
| 27 | #define expect_ptr_eq(a, b, ...) expect_cmp(void *, a, b, ==, \ | ||
| 28 | !=, "p", __VA_ARGS__) | ||
| 29 | #define expect_ptr_ne(a, b, ...) expect_cmp(void *, a, b, !=, \ | ||
| 30 | ==, "p", __VA_ARGS__) | ||
| 31 | #define expect_ptr_null(a, ...) expect_cmp(void *, a, NULL, ==, \ | ||
| 32 | !=, "p", __VA_ARGS__) | ||
| 33 | #define expect_ptr_not_null(a, ...) expect_cmp(void *, a, NULL, !=, \ | ||
| 34 | ==, "p", __VA_ARGS__) | ||
| 35 | |||
| 36 | #define expect_c_eq(a, b, ...) expect_cmp(char, a, b, ==, !=, "c", __VA_ARGS__) | ||
| 37 | #define expect_c_ne(a, b, ...) expect_cmp(char, a, b, !=, ==, "c", __VA_ARGS__) | ||
| 38 | #define expect_c_lt(a, b, ...) expect_cmp(char, a, b, <, >=, "c", __VA_ARGS__) | ||
| 39 | #define expect_c_le(a, b, ...) expect_cmp(char, a, b, <=, >, "c", __VA_ARGS__) | ||
| 40 | #define expect_c_ge(a, b, ...) expect_cmp(char, a, b, >=, <, "c", __VA_ARGS__) | ||
| 41 | #define expect_c_gt(a, b, ...) expect_cmp(char, a, b, >, <=, "c", __VA_ARGS__) | ||
| 42 | |||
| 43 | #define expect_x_eq(a, b, ...) expect_cmp(int, a, b, ==, !=, "#x", __VA_ARGS__) | ||
| 44 | #define expect_x_ne(a, b, ...) expect_cmp(int, a, b, !=, ==, "#x", __VA_ARGS__) | ||
| 45 | #define expect_x_lt(a, b, ...) expect_cmp(int, a, b, <, >=, "#x", __VA_ARGS__) | ||
| 46 | #define expect_x_le(a, b, ...) expect_cmp(int, a, b, <=, >, "#x", __VA_ARGS__) | ||
| 47 | #define expect_x_ge(a, b, ...) expect_cmp(int, a, b, >=, <, "#x", __VA_ARGS__) | ||
| 48 | #define expect_x_gt(a, b, ...) expect_cmp(int, a, b, >, <=, "#x", __VA_ARGS__) | ||
| 49 | |||
| 50 | #define expect_d_eq(a, b, ...) expect_cmp(int, a, b, ==, !=, "d", __VA_ARGS__) | ||
| 51 | #define expect_d_ne(a, b, ...) expect_cmp(int, a, b, !=, ==, "d", __VA_ARGS__) | ||
| 52 | #define expect_d_lt(a, b, ...) expect_cmp(int, a, b, <, >=, "d", __VA_ARGS__) | ||
| 53 | #define expect_d_le(a, b, ...) expect_cmp(int, a, b, <=, >, "d", __VA_ARGS__) | ||
| 54 | #define expect_d_ge(a, b, ...) expect_cmp(int, a, b, >=, <, "d", __VA_ARGS__) | ||
| 55 | #define expect_d_gt(a, b, ...) expect_cmp(int, a, b, >, <=, "d", __VA_ARGS__) | ||
| 56 | |||
| 57 | #define expect_u_eq(a, b, ...) expect_cmp(int, a, b, ==, !=, "u", __VA_ARGS__) | ||
| 58 | #define expect_u_ne(a, b, ...) expect_cmp(int, a, b, !=, ==, "u", __VA_ARGS__) | ||
| 59 | #define expect_u_lt(a, b, ...) expect_cmp(int, a, b, <, >=, "u", __VA_ARGS__) | ||
| 60 | #define expect_u_le(a, b, ...) expect_cmp(int, a, b, <=, >, "u", __VA_ARGS__) | ||
| 61 | #define expect_u_ge(a, b, ...) expect_cmp(int, a, b, >=, <, "u", __VA_ARGS__) | ||
| 62 | #define expect_u_gt(a, b, ...) expect_cmp(int, a, b, >, <=, "u", __VA_ARGS__) | ||
| 63 | |||
| 64 | #define expect_ld_eq(a, b, ...) expect_cmp(long, a, b, ==, \ | ||
| 65 | !=, "ld", __VA_ARGS__) | ||
| 66 | #define expect_ld_ne(a, b, ...) expect_cmp(long, a, b, !=, \ | ||
| 67 | ==, "ld", __VA_ARGS__) | ||
| 68 | #define expect_ld_lt(a, b, ...) expect_cmp(long, a, b, <, \ | ||
| 69 | >=, "ld", __VA_ARGS__) | ||
| 70 | #define expect_ld_le(a, b, ...) expect_cmp(long, a, b, <=, \ | ||
| 71 | >, "ld", __VA_ARGS__) | ||
| 72 | #define expect_ld_ge(a, b, ...) expect_cmp(long, a, b, >=, \ | ||
| 73 | <, "ld", __VA_ARGS__) | ||
| 74 | #define expect_ld_gt(a, b, ...) expect_cmp(long, a, b, >, \ | ||
| 75 | <=, "ld", __VA_ARGS__) | ||
| 76 | |||
| 77 | #define expect_lu_eq(a, b, ...) expect_cmp(unsigned long, \ | ||
| 78 | a, b, ==, !=, "lu", __VA_ARGS__) | ||
| 79 | #define expect_lu_ne(a, b, ...) expect_cmp(unsigned long, \ | ||
| 80 | a, b, !=, ==, "lu", __VA_ARGS__) | ||
| 81 | #define expect_lu_lt(a, b, ...) expect_cmp(unsigned long, \ | ||
| 82 | a, b, <, >=, "lu", __VA_ARGS__) | ||
| 83 | #define expect_lu_le(a, b, ...) expect_cmp(unsigned long, \ | ||
| 84 | a, b, <=, >, "lu", __VA_ARGS__) | ||
| 85 | #define expect_lu_ge(a, b, ...) expect_cmp(unsigned long, \ | ||
| 86 | a, b, >=, <, "lu", __VA_ARGS__) | ||
| 87 | #define expect_lu_gt(a, b, ...) expect_cmp(unsigned long, \ | ||
| 88 | a, b, >, <=, "lu", __VA_ARGS__) | ||
| 89 | |||
| 90 | #define expect_qd_eq(a, b, ...) expect_cmp(long long, a, b, ==, \ | ||
| 91 | !=, "qd", __VA_ARGS__) | ||
| 92 | #define expect_qd_ne(a, b, ...) expect_cmp(long long, a, b, !=, \ | ||
| 93 | ==, "qd", __VA_ARGS__) | ||
| 94 | #define expect_qd_lt(a, b, ...) expect_cmp(long long, a, b, <, \ | ||
| 95 | >=, "qd", __VA_ARGS__) | ||
| 96 | #define expect_qd_le(a, b, ...) expect_cmp(long long, a, b, <=, \ | ||
| 97 | >, "qd", __VA_ARGS__) | ||
| 98 | #define expect_qd_ge(a, b, ...) expect_cmp(long long, a, b, >=, \ | ||
| 99 | <, "qd", __VA_ARGS__) | ||
| 100 | #define expect_qd_gt(a, b, ...) expect_cmp(long long, a, b, >, \ | ||
| 101 | <=, "qd", __VA_ARGS__) | ||
| 102 | |||
| 103 | #define expect_qu_eq(a, b, ...) expect_cmp(unsigned long long, \ | ||
| 104 | a, b, ==, !=, "qu", __VA_ARGS__) | ||
| 105 | #define expect_qu_ne(a, b, ...) expect_cmp(unsigned long long, \ | ||
| 106 | a, b, !=, ==, "qu", __VA_ARGS__) | ||
| 107 | #define expect_qu_lt(a, b, ...) expect_cmp(unsigned long long, \ | ||
| 108 | a, b, <, >=, "qu", __VA_ARGS__) | ||
| 109 | #define expect_qu_le(a, b, ...) expect_cmp(unsigned long long, \ | ||
| 110 | a, b, <=, >, "qu", __VA_ARGS__) | ||
| 111 | #define expect_qu_ge(a, b, ...) expect_cmp(unsigned long long, \ | ||
| 112 | a, b, >=, <, "qu", __VA_ARGS__) | ||
| 113 | #define expect_qu_gt(a, b, ...) expect_cmp(unsigned long long, \ | ||
| 114 | a, b, >, <=, "qu", __VA_ARGS__) | ||
| 115 | |||
| 116 | #define expect_jd_eq(a, b, ...) expect_cmp(intmax_t, a, b, ==, \ | ||
| 117 | !=, "jd", __VA_ARGS__) | ||
| 118 | #define expect_jd_ne(a, b, ...) expect_cmp(intmax_t, a, b, !=, \ | ||
| 119 | ==, "jd", __VA_ARGS__) | ||
| 120 | #define expect_jd_lt(a, b, ...) expect_cmp(intmax_t, a, b, <, \ | ||
| 121 | >=, "jd", __VA_ARGS__) | ||
| 122 | #define expect_jd_le(a, b, ...) expect_cmp(intmax_t, a, b, <=, \ | ||
| 123 | >, "jd", __VA_ARGS__) | ||
| 124 | #define expect_jd_ge(a, b, ...) expect_cmp(intmax_t, a, b, >=, \ | ||
| 125 | <, "jd", __VA_ARGS__) | ||
| 126 | #define expect_jd_gt(a, b, ...) expect_cmp(intmax_t, a, b, >, \ | ||
| 127 | <=, "jd", __VA_ARGS__) | ||
| 128 | |||
| 129 | #define expect_ju_eq(a, b, ...) expect_cmp(uintmax_t, a, b, ==, \ | ||
| 130 | !=, "ju", __VA_ARGS__) | ||
| 131 | #define expect_ju_ne(a, b, ...) expect_cmp(uintmax_t, a, b, !=, \ | ||
| 132 | ==, "ju", __VA_ARGS__) | ||
| 133 | #define expect_ju_lt(a, b, ...) expect_cmp(uintmax_t, a, b, <, \ | ||
| 134 | >=, "ju", __VA_ARGS__) | ||
| 135 | #define expect_ju_le(a, b, ...) expect_cmp(uintmax_t, a, b, <=, \ | ||
| 136 | >, "ju", __VA_ARGS__) | ||
| 137 | #define expect_ju_ge(a, b, ...) expect_cmp(uintmax_t, a, b, >=, \ | ||
| 138 | <, "ju", __VA_ARGS__) | ||
| 139 | #define expect_ju_gt(a, b, ...) expect_cmp(uintmax_t, a, b, >, \ | ||
| 140 | <=, "ju", __VA_ARGS__) | ||
| 141 | |||
| 142 | #define expect_zd_eq(a, b, ...) expect_cmp(ssize_t, a, b, ==, \ | ||
| 143 | !=, "zd", __VA_ARGS__) | ||
| 144 | #define expect_zd_ne(a, b, ...) expect_cmp(ssize_t, a, b, !=, \ | ||
| 145 | ==, "zd", __VA_ARGS__) | ||
| 146 | #define expect_zd_lt(a, b, ...) expect_cmp(ssize_t, a, b, <, \ | ||
| 147 | >=, "zd", __VA_ARGS__) | ||
| 148 | #define expect_zd_le(a, b, ...) expect_cmp(ssize_t, a, b, <=, \ | ||
| 149 | >, "zd", __VA_ARGS__) | ||
| 150 | #define expect_zd_ge(a, b, ...) expect_cmp(ssize_t, a, b, >=, \ | ||
| 151 | <, "zd", __VA_ARGS__) | ||
| 152 | #define expect_zd_gt(a, b, ...) expect_cmp(ssize_t, a, b, >, \ | ||
| 153 | <=, "zd", __VA_ARGS__) | ||
| 154 | |||
| 155 | #define expect_zu_eq(a, b, ...) expect_cmp(size_t, a, b, ==, \ | ||
| 156 | !=, "zu", __VA_ARGS__) | ||
| 157 | #define expect_zu_ne(a, b, ...) expect_cmp(size_t, a, b, !=, \ | ||
| 158 | ==, "zu", __VA_ARGS__) | ||
| 159 | #define expect_zu_lt(a, b, ...) expect_cmp(size_t, a, b, <, \ | ||
| 160 | >=, "zu", __VA_ARGS__) | ||
| 161 | #define expect_zu_le(a, b, ...) expect_cmp(size_t, a, b, <=, \ | ||
| 162 | >, "zu", __VA_ARGS__) | ||
| 163 | #define expect_zu_ge(a, b, ...) expect_cmp(size_t, a, b, >=, \ | ||
| 164 | <, "zu", __VA_ARGS__) | ||
| 165 | #define expect_zu_gt(a, b, ...) expect_cmp(size_t, a, b, >, \ | ||
| 166 | <=, "zu", __VA_ARGS__) | ||
| 167 | |||
| 168 | #define expect_d32_eq(a, b, ...) expect_cmp(int32_t, a, b, ==, \ | ||
| 169 | !=, FMTd32, __VA_ARGS__) | ||
| 170 | #define expect_d32_ne(a, b, ...) expect_cmp(int32_t, a, b, !=, \ | ||
| 171 | ==, FMTd32, __VA_ARGS__) | ||
| 172 | #define expect_d32_lt(a, b, ...) expect_cmp(int32_t, a, b, <, \ | ||
| 173 | >=, FMTd32, __VA_ARGS__) | ||
| 174 | #define expect_d32_le(a, b, ...) expect_cmp(int32_t, a, b, <=, \ | ||
| 175 | >, FMTd32, __VA_ARGS__) | ||
| 176 | #define expect_d32_ge(a, b, ...) expect_cmp(int32_t, a, b, >=, \ | ||
| 177 | <, FMTd32, __VA_ARGS__) | ||
| 178 | #define expect_d32_gt(a, b, ...) expect_cmp(int32_t, a, b, >, \ | ||
| 179 | <=, FMTd32, __VA_ARGS__) | ||
| 180 | |||
| 181 | #define expect_u32_eq(a, b, ...) expect_cmp(uint32_t, a, b, ==, \ | ||
| 182 | !=, FMTu32, __VA_ARGS__) | ||
| 183 | #define expect_u32_ne(a, b, ...) expect_cmp(uint32_t, a, b, !=, \ | ||
| 184 | ==, FMTu32, __VA_ARGS__) | ||
| 185 | #define expect_u32_lt(a, b, ...) expect_cmp(uint32_t, a, b, <, \ | ||
| 186 | >=, FMTu32, __VA_ARGS__) | ||
| 187 | #define expect_u32_le(a, b, ...) expect_cmp(uint32_t, a, b, <=, \ | ||
| 188 | >, FMTu32, __VA_ARGS__) | ||
| 189 | #define expect_u32_ge(a, b, ...) expect_cmp(uint32_t, a, b, >=, \ | ||
| 190 | <, FMTu32, __VA_ARGS__) | ||
| 191 | #define expect_u32_gt(a, b, ...) expect_cmp(uint32_t, a, b, >, \ | ||
| 192 | <=, FMTu32, __VA_ARGS__) | ||
| 193 | |||
| 194 | #define expect_d64_eq(a, b, ...) expect_cmp(int64_t, a, b, ==, \ | ||
| 195 | !=, FMTd64, __VA_ARGS__) | ||
| 196 | #define expect_d64_ne(a, b, ...) expect_cmp(int64_t, a, b, !=, \ | ||
| 197 | ==, FMTd64, __VA_ARGS__) | ||
| 198 | #define expect_d64_lt(a, b, ...) expect_cmp(int64_t, a, b, <, \ | ||
| 199 | >=, FMTd64, __VA_ARGS__) | ||
| 200 | #define expect_d64_le(a, b, ...) expect_cmp(int64_t, a, b, <=, \ | ||
| 201 | >, FMTd64, __VA_ARGS__) | ||
| 202 | #define expect_d64_ge(a, b, ...) expect_cmp(int64_t, a, b, >=, \ | ||
| 203 | <, FMTd64, __VA_ARGS__) | ||
| 204 | #define expect_d64_gt(a, b, ...) expect_cmp(int64_t, a, b, >, \ | ||
| 205 | <=, FMTd64, __VA_ARGS__) | ||
| 206 | |||
| 207 | #define expect_u64_eq(a, b, ...) expect_cmp(uint64_t, a, b, ==, \ | ||
| 208 | !=, FMTu64, __VA_ARGS__) | ||
| 209 | #define expect_u64_ne(a, b, ...) expect_cmp(uint64_t, a, b, !=, \ | ||
| 210 | ==, FMTu64, __VA_ARGS__) | ||
| 211 | #define expect_u64_lt(a, b, ...) expect_cmp(uint64_t, a, b, <, \ | ||
| 212 | >=, FMTu64, __VA_ARGS__) | ||
| 213 | #define expect_u64_le(a, b, ...) expect_cmp(uint64_t, a, b, <=, \ | ||
| 214 | >, FMTu64, __VA_ARGS__) | ||
| 215 | #define expect_u64_ge(a, b, ...) expect_cmp(uint64_t, a, b, >=, \ | ||
| 216 | <, FMTu64, __VA_ARGS__) | ||
| 217 | #define expect_u64_gt(a, b, ...) expect_cmp(uint64_t, a, b, >, \ | ||
| 218 | <=, FMTu64, __VA_ARGS__) | ||
| 219 | |||
| 220 | #define verify_b_eq(may_abort, a, b, ...) do { \ | ||
| 221 | bool a_ = (a); \ | ||
| 222 | bool b_ = (b); \ | ||
| 223 | if (!(a_ == b_)) { \ | ||
| 224 | char prefix[ASSERT_BUFSIZE]; \ | ||
| 225 | char message[ASSERT_BUFSIZE]; \ | ||
| 226 | malloc_snprintf(prefix, sizeof(prefix), \ | ||
| 227 | "%s:%s:%d: Failed assertion: " \ | ||
| 228 | "(%s) == (%s) --> %s != %s: ", \ | ||
| 229 | __func__, __FILE__, __LINE__, \ | ||
| 230 | #a, #b, a_ ? "true" : "false", \ | ||
| 231 | b_ ? "true" : "false"); \ | ||
| 232 | malloc_snprintf(message, sizeof(message), __VA_ARGS__); \ | ||
| 233 | if (may_abort) { \ | ||
| 234 | abort(); \ | ||
| 235 | } else { \ | ||
| 236 | p_test_fail(prefix, message); \ | ||
| 237 | } \ | ||
| 238 | } \ | ||
| 239 | } while (0) | ||
| 240 | |||
| 241 | #define verify_b_ne(may_abort, a, b, ...) do { \ | ||
| 242 | bool a_ = (a); \ | ||
| 243 | bool b_ = (b); \ | ||
| 244 | if (!(a_ != b_)) { \ | ||
| 245 | char prefix[ASSERT_BUFSIZE]; \ | ||
| 246 | char message[ASSERT_BUFSIZE]; \ | ||
| 247 | malloc_snprintf(prefix, sizeof(prefix), \ | ||
| 248 | "%s:%s:%d: Failed assertion: " \ | ||
| 249 | "(%s) != (%s) --> %s == %s: ", \ | ||
| 250 | __func__, __FILE__, __LINE__, \ | ||
| 251 | #a, #b, a_ ? "true" : "false", \ | ||
| 252 | b_ ? "true" : "false"); \ | ||
| 253 | malloc_snprintf(message, sizeof(message), __VA_ARGS__); \ | ||
| 254 | if (may_abort) { \ | ||
| 255 | abort(); \ | ||
| 256 | } else { \ | ||
| 257 | p_test_fail(prefix, message); \ | ||
| 258 | } \ | ||
| 259 | } \ | ||
| 260 | } while (0) | ||
| 261 | |||
| 262 | #define expect_b_eq(a, b, ...) verify_b_eq(false, a, b, __VA_ARGS__) | ||
| 263 | #define expect_b_ne(a, b, ...) verify_b_ne(false, a, b, __VA_ARGS__) | ||
| 264 | |||
| 265 | #define expect_true(a, ...) expect_b_eq(a, true, __VA_ARGS__) | ||
| 266 | #define expect_false(a, ...) expect_b_eq(a, false, __VA_ARGS__) | ||
| 267 | |||
| 268 | #define verify_str_eq(may_abort, a, b, ...) do { \ | ||
| 269 | if (strcmp((a), (b))) { \ | ||
| 270 | char prefix[ASSERT_BUFSIZE]; \ | ||
| 271 | char message[ASSERT_BUFSIZE]; \ | ||
| 272 | malloc_snprintf(prefix, sizeof(prefix), \ | ||
| 273 | "%s:%s:%d: Failed assertion: " \ | ||
| 274 | "(%s) same as (%s) --> " \ | ||
| 275 | "\"%s\" differs from \"%s\": ", \ | ||
| 276 | __func__, __FILE__, __LINE__, #a, #b, a, b); \ | ||
| 277 | malloc_snprintf(message, sizeof(message), __VA_ARGS__); \ | ||
| 278 | if (may_abort) { \ | ||
| 279 | abort(); \ | ||
| 280 | } else { \ | ||
| 281 | p_test_fail(prefix, message); \ | ||
| 282 | } \ | ||
| 283 | } \ | ||
| 284 | } while (0) | ||
| 285 | |||
| 286 | #define verify_str_ne(may_abort, a, b, ...) do { \ | ||
| 287 | if (!strcmp((a), (b))) { \ | ||
| 288 | char prefix[ASSERT_BUFSIZE]; \ | ||
| 289 | char message[ASSERT_BUFSIZE]; \ | ||
| 290 | malloc_snprintf(prefix, sizeof(prefix), \ | ||
| 291 | "%s:%s:%d: Failed assertion: " \ | ||
| 292 | "(%s) differs from (%s) --> " \ | ||
| 293 | "\"%s\" same as \"%s\": ", \ | ||
| 294 | __func__, __FILE__, __LINE__, #a, #b, a, b); \ | ||
| 295 | malloc_snprintf(message, sizeof(message), __VA_ARGS__); \ | ||
| 296 | if (may_abort) { \ | ||
| 297 | abort(); \ | ||
| 298 | } else { \ | ||
| 299 | p_test_fail(prefix, message); \ | ||
| 300 | } \ | ||
| 301 | } \ | ||
| 302 | } while (0) | ||
| 303 | |||
| 304 | #define expect_str_eq(a, b, ...) verify_str_eq(false, a, b, __VA_ARGS__) | ||
| 305 | #define expect_str_ne(a, b, ...) verify_str_ne(false, a, b, __VA_ARGS__) | ||
| 306 | |||
| 307 | #define verify_not_reached(may_abort, ...) do { \ | ||
| 308 | char prefix[ASSERT_BUFSIZE]; \ | ||
| 309 | char message[ASSERT_BUFSIZE]; \ | ||
| 310 | malloc_snprintf(prefix, sizeof(prefix), \ | ||
| 311 | "%s:%s:%d: Unreachable code reached: ", \ | ||
| 312 | __func__, __FILE__, __LINE__); \ | ||
| 313 | malloc_snprintf(message, sizeof(message), __VA_ARGS__); \ | ||
| 314 | if (may_abort) { \ | ||
| 315 | abort(); \ | ||
| 316 | } else { \ | ||
| 317 | p_test_fail(prefix, message); \ | ||
| 318 | } \ | ||
| 319 | } while (0) | ||
| 320 | |||
| 321 | #define expect_not_reached(...) verify_not_reached(false, __VA_ARGS__) | ||
| 322 | |||
| 323 | #define assert_cmp(t, a, b, cmp, neg_cmp, pri, ...) verify_cmp(true, \ | ||
| 324 | t, a, b, cmp, neg_cmp, pri, __VA_ARGS__) | ||
| 325 | |||
| 326 | #define assert_ptr_eq(a, b, ...) assert_cmp(void *, a, b, ==, \ | ||
| 327 | !=, "p", __VA_ARGS__) | ||
| 328 | #define assert_ptr_ne(a, b, ...) assert_cmp(void *, a, b, !=, \ | ||
| 329 | ==, "p", __VA_ARGS__) | ||
| 330 | #define assert_ptr_null(a, ...) assert_cmp(void *, a, NULL, ==, \ | ||
| 331 | !=, "p", __VA_ARGS__) | ||
| 332 | #define assert_ptr_not_null(a, ...) assert_cmp(void *, a, NULL, !=, \ | ||
| 333 | ==, "p", __VA_ARGS__) | ||
| 334 | |||
| 335 | #define assert_c_eq(a, b, ...) assert_cmp(char, a, b, ==, !=, "c", __VA_ARGS__) | ||
| 336 | #define assert_c_ne(a, b, ...) assert_cmp(char, a, b, !=, ==, "c", __VA_ARGS__) | ||
| 337 | #define assert_c_lt(a, b, ...) assert_cmp(char, a, b, <, >=, "c", __VA_ARGS__) | ||
| 338 | #define assert_c_le(a, b, ...) assert_cmp(char, a, b, <=, >, "c", __VA_ARGS__) | ||
| 339 | #define assert_c_ge(a, b, ...) assert_cmp(char, a, b, >=, <, "c", __VA_ARGS__) | ||
| 340 | #define assert_c_gt(a, b, ...) assert_cmp(char, a, b, >, <=, "c", __VA_ARGS__) | ||
| 341 | |||
| 342 | #define assert_x_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "#x", __VA_ARGS__) | ||
| 343 | #define assert_x_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "#x", __VA_ARGS__) | ||
| 344 | #define assert_x_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "#x", __VA_ARGS__) | ||
| 345 | #define assert_x_le(a, b, ...) assert_cmp(int, a, b, <=, >, "#x", __VA_ARGS__) | ||
| 346 | #define assert_x_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "#x", __VA_ARGS__) | ||
| 347 | #define assert_x_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "#x", __VA_ARGS__) | ||
| 348 | |||
| 349 | #define assert_d_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "d", __VA_ARGS__) | ||
| 350 | #define assert_d_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "d", __VA_ARGS__) | ||
| 351 | #define assert_d_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "d", __VA_ARGS__) | ||
| 352 | #define assert_d_le(a, b, ...) assert_cmp(int, a, b, <=, >, "d", __VA_ARGS__) | ||
| 353 | #define assert_d_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "d", __VA_ARGS__) | ||
| 354 | #define assert_d_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "d", __VA_ARGS__) | ||
| 355 | |||
| 356 | #define assert_u_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "u", __VA_ARGS__) | ||
| 357 | #define assert_u_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "u", __VA_ARGS__) | ||
| 358 | #define assert_u_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "u", __VA_ARGS__) | ||
| 359 | #define assert_u_le(a, b, ...) assert_cmp(int, a, b, <=, >, "u", __VA_ARGS__) | ||
| 360 | #define assert_u_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "u", __VA_ARGS__) | ||
| 361 | #define assert_u_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "u", __VA_ARGS__) | ||
| 362 | |||
| 363 | #define assert_ld_eq(a, b, ...) assert_cmp(long, a, b, ==, \ | ||
| 364 | !=, "ld", __VA_ARGS__) | ||
| 365 | #define assert_ld_ne(a, b, ...) assert_cmp(long, a, b, !=, \ | ||
| 366 | ==, "ld", __VA_ARGS__) | ||
| 367 | #define assert_ld_lt(a, b, ...) assert_cmp(long, a, b, <, \ | ||
| 368 | >=, "ld", __VA_ARGS__) | ||
| 369 | #define assert_ld_le(a, b, ...) assert_cmp(long, a, b, <=, \ | ||
| 370 | >, "ld", __VA_ARGS__) | ||
| 371 | #define assert_ld_ge(a, b, ...) assert_cmp(long, a, b, >=, \ | ||
| 372 | <, "ld", __VA_ARGS__) | ||
| 373 | #define assert_ld_gt(a, b, ...) assert_cmp(long, a, b, >, \ | ||
| 374 | <=, "ld", __VA_ARGS__) | ||
| 375 | |||
| 376 | #define assert_lu_eq(a, b, ...) assert_cmp(unsigned long, \ | ||
| 377 | a, b, ==, !=, "lu", __VA_ARGS__) | ||
| 378 | #define assert_lu_ne(a, b, ...) assert_cmp(unsigned long, \ | ||
| 379 | a, b, !=, ==, "lu", __VA_ARGS__) | ||
| 380 | #define assert_lu_lt(a, b, ...) assert_cmp(unsigned long, \ | ||
| 381 | a, b, <, >=, "lu", __VA_ARGS__) | ||
| 382 | #define assert_lu_le(a, b, ...) assert_cmp(unsigned long, \ | ||
| 383 | a, b, <=, >, "lu", __VA_ARGS__) | ||
| 384 | #define assert_lu_ge(a, b, ...) assert_cmp(unsigned long, \ | ||
| 385 | a, b, >=, <, "lu", __VA_ARGS__) | ||
| 386 | #define assert_lu_gt(a, b, ...) assert_cmp(unsigned long, \ | ||
| 387 | a, b, >, <=, "lu", __VA_ARGS__) | ||
| 388 | |||
| 389 | #define assert_qd_eq(a, b, ...) assert_cmp(long long, a, b, ==, \ | ||
| 390 | !=, "qd", __VA_ARGS__) | ||
| 391 | #define assert_qd_ne(a, b, ...) assert_cmp(long long, a, b, !=, \ | ||
| 392 | ==, "qd", __VA_ARGS__) | ||
| 393 | #define assert_qd_lt(a, b, ...) assert_cmp(long long, a, b, <, \ | ||
| 394 | >=, "qd", __VA_ARGS__) | ||
| 395 | #define assert_qd_le(a, b, ...) assert_cmp(long long, a, b, <=, \ | ||
| 396 | >, "qd", __VA_ARGS__) | ||
| 397 | #define assert_qd_ge(a, b, ...) assert_cmp(long long, a, b, >=, \ | ||
| 398 | <, "qd", __VA_ARGS__) | ||
| 399 | #define assert_qd_gt(a, b, ...) assert_cmp(long long, a, b, >, \ | ||
| 400 | <=, "qd", __VA_ARGS__) | ||
| 401 | |||
| 402 | #define assert_qu_eq(a, b, ...) assert_cmp(unsigned long long, \ | ||
| 403 | a, b, ==, !=, "qu", __VA_ARGS__) | ||
| 404 | #define assert_qu_ne(a, b, ...) assert_cmp(unsigned long long, \ | ||
| 405 | a, b, !=, ==, "qu", __VA_ARGS__) | ||
| 406 | #define assert_qu_lt(a, b, ...) assert_cmp(unsigned long long, \ | ||
| 407 | a, b, <, >=, "qu", __VA_ARGS__) | ||
| 408 | #define assert_qu_le(a, b, ...) assert_cmp(unsigned long long, \ | ||
| 409 | a, b, <=, >, "qu", __VA_ARGS__) | ||
| 410 | #define assert_qu_ge(a, b, ...) assert_cmp(unsigned long long, \ | ||
| 411 | a, b, >=, <, "qu", __VA_ARGS__) | ||
| 412 | #define assert_qu_gt(a, b, ...) assert_cmp(unsigned long long, \ | ||
| 413 | a, b, >, <=, "qu", __VA_ARGS__) | ||
| 414 | |||
| 415 | #define assert_jd_eq(a, b, ...) assert_cmp(intmax_t, a, b, ==, \ | ||
| 416 | !=, "jd", __VA_ARGS__) | ||
| 417 | #define assert_jd_ne(a, b, ...) assert_cmp(intmax_t, a, b, !=, \ | ||
| 418 | ==, "jd", __VA_ARGS__) | ||
| 419 | #define assert_jd_lt(a, b, ...) assert_cmp(intmax_t, a, b, <, \ | ||
| 420 | >=, "jd", __VA_ARGS__) | ||
| 421 | #define assert_jd_le(a, b, ...) assert_cmp(intmax_t, a, b, <=, \ | ||
| 422 | >, "jd", __VA_ARGS__) | ||
| 423 | #define assert_jd_ge(a, b, ...) assert_cmp(intmax_t, a, b, >=, \ | ||
| 424 | <, "jd", __VA_ARGS__) | ||
| 425 | #define assert_jd_gt(a, b, ...) assert_cmp(intmax_t, a, b, >, \ | ||
| 426 | <=, "jd", __VA_ARGS__) | ||
| 427 | |||
| 428 | #define assert_ju_eq(a, b, ...) assert_cmp(uintmax_t, a, b, ==, \ | ||
| 429 | !=, "ju", __VA_ARGS__) | ||
| 430 | #define assert_ju_ne(a, b, ...) assert_cmp(uintmax_t, a, b, !=, \ | ||
| 431 | ==, "ju", __VA_ARGS__) | ||
| 432 | #define assert_ju_lt(a, b, ...) assert_cmp(uintmax_t, a, b, <, \ | ||
| 433 | >=, "ju", __VA_ARGS__) | ||
| 434 | #define assert_ju_le(a, b, ...) assert_cmp(uintmax_t, a, b, <=, \ | ||
| 435 | >, "ju", __VA_ARGS__) | ||
| 436 | #define assert_ju_ge(a, b, ...) assert_cmp(uintmax_t, a, b, >=, \ | ||
| 437 | <, "ju", __VA_ARGS__) | ||
| 438 | #define assert_ju_gt(a, b, ...) assert_cmp(uintmax_t, a, b, >, \ | ||
| 439 | <=, "ju", __VA_ARGS__) | ||
| 440 | |||
| 441 | #define assert_zd_eq(a, b, ...) assert_cmp(ssize_t, a, b, ==, \ | ||
| 442 | !=, "zd", __VA_ARGS__) | ||
| 443 | #define assert_zd_ne(a, b, ...) assert_cmp(ssize_t, a, b, !=, \ | ||
| 444 | ==, "zd", __VA_ARGS__) | ||
| 445 | #define assert_zd_lt(a, b, ...) assert_cmp(ssize_t, a, b, <, \ | ||
| 446 | >=, "zd", __VA_ARGS__) | ||
| 447 | #define assert_zd_le(a, b, ...) assert_cmp(ssize_t, a, b, <=, \ | ||
| 448 | >, "zd", __VA_ARGS__) | ||
| 449 | #define assert_zd_ge(a, b, ...) assert_cmp(ssize_t, a, b, >=, \ | ||
| 450 | <, "zd", __VA_ARGS__) | ||
| 451 | #define assert_zd_gt(a, b, ...) assert_cmp(ssize_t, a, b, >, \ | ||
| 452 | <=, "zd", __VA_ARGS__) | ||
| 453 | |||
| 454 | #define assert_zu_eq(a, b, ...) assert_cmp(size_t, a, b, ==, \ | ||
| 455 | !=, "zu", __VA_ARGS__) | ||
| 456 | #define assert_zu_ne(a, b, ...) assert_cmp(size_t, a, b, !=, \ | ||
| 457 | ==, "zu", __VA_ARGS__) | ||
| 458 | #define assert_zu_lt(a, b, ...) assert_cmp(size_t, a, b, <, \ | ||
| 459 | >=, "zu", __VA_ARGS__) | ||
| 460 | #define assert_zu_le(a, b, ...) assert_cmp(size_t, a, b, <=, \ | ||
| 461 | >, "zu", __VA_ARGS__) | ||
| 462 | #define assert_zu_ge(a, b, ...) assert_cmp(size_t, a, b, >=, \ | ||
| 463 | <, "zu", __VA_ARGS__) | ||
| 464 | #define assert_zu_gt(a, b, ...) assert_cmp(size_t, a, b, >, \ | ||
| 465 | <=, "zu", __VA_ARGS__) | ||
| 466 | |||
| 467 | #define assert_d32_eq(a, b, ...) assert_cmp(int32_t, a, b, ==, \ | ||
| 468 | !=, FMTd32, __VA_ARGS__) | ||
| 469 | #define assert_d32_ne(a, b, ...) assert_cmp(int32_t, a, b, !=, \ | ||
| 470 | ==, FMTd32, __VA_ARGS__) | ||
| 471 | #define assert_d32_lt(a, b, ...) assert_cmp(int32_t, a, b, <, \ | ||
| 472 | >=, FMTd32, __VA_ARGS__) | ||
| 473 | #define assert_d32_le(a, b, ...) assert_cmp(int32_t, a, b, <=, \ | ||
| 474 | >, FMTd32, __VA_ARGS__) | ||
| 475 | #define assert_d32_ge(a, b, ...) assert_cmp(int32_t, a, b, >=, \ | ||
| 476 | <, FMTd32, __VA_ARGS__) | ||
| 477 | #define assert_d32_gt(a, b, ...) assert_cmp(int32_t, a, b, >, \ | ||
| 478 | <=, FMTd32, __VA_ARGS__) | ||
| 479 | |||
| 480 | #define assert_u32_eq(a, b, ...) assert_cmp(uint32_t, a, b, ==, \ | ||
| 481 | !=, FMTu32, __VA_ARGS__) | ||
| 482 | #define assert_u32_ne(a, b, ...) assert_cmp(uint32_t, a, b, !=, \ | ||
| 483 | ==, FMTu32, __VA_ARGS__) | ||
| 484 | #define assert_u32_lt(a, b, ...) assert_cmp(uint32_t, a, b, <, \ | ||
| 485 | >=, FMTu32, __VA_ARGS__) | ||
| 486 | #define assert_u32_le(a, b, ...) assert_cmp(uint32_t, a, b, <=, \ | ||
| 487 | >, FMTu32, __VA_ARGS__) | ||
| 488 | #define assert_u32_ge(a, b, ...) assert_cmp(uint32_t, a, b, >=, \ | ||
| 489 | <, FMTu32, __VA_ARGS__) | ||
| 490 | #define assert_u32_gt(a, b, ...) assert_cmp(uint32_t, a, b, >, \ | ||
| 491 | <=, FMTu32, __VA_ARGS__) | ||
| 492 | |||
| 493 | #define assert_d64_eq(a, b, ...) assert_cmp(int64_t, a, b, ==, \ | ||
| 494 | !=, FMTd64, __VA_ARGS__) | ||
| 495 | #define assert_d64_ne(a, b, ...) assert_cmp(int64_t, a, b, !=, \ | ||
| 496 | ==, FMTd64, __VA_ARGS__) | ||
| 497 | #define assert_d64_lt(a, b, ...) assert_cmp(int64_t, a, b, <, \ | ||
| 498 | >=, FMTd64, __VA_ARGS__) | ||
| 499 | #define assert_d64_le(a, b, ...) assert_cmp(int64_t, a, b, <=, \ | ||
| 500 | >, FMTd64, __VA_ARGS__) | ||
| 501 | #define assert_d64_ge(a, b, ...) assert_cmp(int64_t, a, b, >=, \ | ||
| 502 | <, FMTd64, __VA_ARGS__) | ||
| 503 | #define assert_d64_gt(a, b, ...) assert_cmp(int64_t, a, b, >, \ | ||
| 504 | <=, FMTd64, __VA_ARGS__) | ||
| 505 | |||
| 506 | #define assert_u64_eq(a, b, ...) assert_cmp(uint64_t, a, b, ==, \ | ||
| 507 | !=, FMTu64, __VA_ARGS__) | ||
| 508 | #define assert_u64_ne(a, b, ...) assert_cmp(uint64_t, a, b, !=, \ | ||
| 509 | ==, FMTu64, __VA_ARGS__) | ||
| 510 | #define assert_u64_lt(a, b, ...) assert_cmp(uint64_t, a, b, <, \ | ||
| 511 | >=, FMTu64, __VA_ARGS__) | ||
| 512 | #define assert_u64_le(a, b, ...) assert_cmp(uint64_t, a, b, <=, \ | ||
| 513 | >, FMTu64, __VA_ARGS__) | ||
| 514 | #define assert_u64_ge(a, b, ...) assert_cmp(uint64_t, a, b, >=, \ | ||
| 515 | <, FMTu64, __VA_ARGS__) | ||
| 516 | #define assert_u64_gt(a, b, ...) assert_cmp(uint64_t, a, b, >, \ | ||
| 517 | <=, FMTu64, __VA_ARGS__) | ||
| 518 | |||
| 519 | #define assert_b_eq(a, b, ...) verify_b_eq(true, a, b, __VA_ARGS__) | ||
| 520 | #define assert_b_ne(a, b, ...) verify_b_ne(true, a, b, __VA_ARGS__) | ||
| 521 | |||
| 522 | #define assert_true(a, ...) assert_b_eq(a, true, __VA_ARGS__) | ||
| 523 | #define assert_false(a, ...) assert_b_eq(a, false, __VA_ARGS__) | ||
| 524 | |||
| 525 | #define assert_str_eq(a, b, ...) verify_str_eq(true, a, b, __VA_ARGS__) | ||
| 526 | #define assert_str_ne(a, b, ...) verify_str_ne(true, a, b, __VA_ARGS__) | ||
| 527 | |||
| 528 | #define assert_not_reached(...) verify_not_reached(true, __VA_ARGS__) | ||
| 529 | |||
| 530 | /* | ||
| 531 | * If this enum changes, corresponding changes in test/test.sh.in are also | ||
| 532 | * necessary. | ||
| 533 | */ | ||
| 534 | typedef enum { | ||
| 535 | test_status_pass = 0, | ||
| 536 | test_status_skip = 1, | ||
| 537 | test_status_fail = 2, | ||
| 538 | |||
| 539 | test_status_count = 3 | ||
| 540 | } test_status_t; | ||
| 541 | |||
| 542 | typedef void (test_t)(void); | ||
| 543 | |||
| 544 | #define TEST_BEGIN(f) \ | ||
| 545 | static void \ | ||
| 546 | f(void) { \ | ||
| 547 | p_test_init(#f); | ||
| 548 | |||
| 549 | #define TEST_END \ | ||
| 550 | goto label_test_end; \ | ||
| 551 | label_test_end: \ | ||
| 552 | p_test_fini(); \ | ||
| 553 | } | ||
| 554 | |||
| 555 | #define test(...) \ | ||
| 556 | p_test(__VA_ARGS__, NULL) | ||
| 557 | |||
| 558 | #define test_no_reentrancy(...) \ | ||
| 559 | p_test_no_reentrancy(__VA_ARGS__, NULL) | ||
| 560 | |||
| 561 | #define test_no_malloc_init(...) \ | ||
| 562 | p_test_no_malloc_init(__VA_ARGS__, NULL) | ||
| 563 | |||
| 564 | #define test_skip_if(e) do { \ | ||
| 565 | if (e) { \ | ||
| 566 | test_skip("%s:%s:%d: Test skipped: (%s)", \ | ||
| 567 | __func__, __FILE__, __LINE__, #e); \ | ||
| 568 | goto label_test_end; \ | ||
| 569 | } \ | ||
| 570 | } while (0) | ||
| 571 | |||
| 572 | bool test_is_reentrant(); | ||
| 573 | |||
| 574 | void test_skip(const char *format, ...) JEMALLOC_FORMAT_PRINTF(1, 2); | ||
| 575 | void test_fail(const char *format, ...) JEMALLOC_FORMAT_PRINTF(1, 2); | ||
| 576 | |||
| 577 | /* For private use by macros. */ | ||
| 578 | test_status_t p_test(test_t *t, ...); | ||
| 579 | test_status_t p_test_no_reentrancy(test_t *t, ...); | ||
| 580 | test_status_t p_test_no_malloc_init(test_t *t, ...); | ||
| 581 | void p_test_init(const char *name); | ||
| 582 | void p_test_fini(void); | ||
| 583 | void p_test_fail(const char *prefix, const char *message); | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/thd.h b/examples/redis-unstable/deps/jemalloc/test/include/test/thd.h new file mode 100644 index 0000000..47a5126 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/thd.h | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | /* Abstraction layer for threading in tests. */ | ||
| 2 | #ifdef _WIN32 | ||
| 3 | typedef HANDLE thd_t; | ||
| 4 | #else | ||
| 5 | typedef pthread_t thd_t; | ||
| 6 | #endif | ||
| 7 | |||
| 8 | void thd_create(thd_t *thd, void *(*proc)(void *), void *arg); | ||
| 9 | void thd_join(thd_t thd, void **ret); | ||
diff --git a/examples/redis-unstable/deps/jemalloc/test/include/test/timer.h b/examples/redis-unstable/deps/jemalloc/test/include/test/timer.h new file mode 100644 index 0000000..ace6191 --- /dev/null +++ b/examples/redis-unstable/deps/jemalloc/test/include/test/timer.h | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | /* Simple timer, for use in benchmark reporting. */ | ||
| 2 | |||
| 3 | typedef struct { | ||
| 4 | nstime_t t0; | ||
| 5 | nstime_t t1; | ||
| 6 | } timedelta_t; | ||
| 7 | |||
| 8 | void timer_start(timedelta_t *timer); | ||
| 9 | void timer_stop(timedelta_t *timer); | ||
| 10 | uint64_t timer_usec(const timedelta_t *timer); | ||
| 11 | void timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen); | ||
