aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-08-14 09:30:14 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-08-14 09:37:49 +0300
commit58ef1d58d6f938f241e967ba4c66daf871a21340 (patch)
tree48238bf89c9cac13476642bcef26e0bbb8eace98 /contrib/libs
parent1ec6cf894542dbe0f1222ee6a2aacdc3bf28bcc6 (diff)
downloadydb-58ef1d58d6f938f241e967ba4c66daf871a21340.tar.gz
Intermediate changes
Diffstat (limited to 'contrib/libs')
-rw-r--r--contrib/libs/backtrace/ya.make4
-rw-r--r--contrib/libs/croaring/README.md25
-rw-r--r--contrib/libs/croaring/include/roaring/roaring_version.h6
-rw-r--r--contrib/libs/croaring/src/containers/array.c12
-rw-r--r--contrib/libs/croaring/src/containers/bitset.c7
-rw-r--r--contrib/libs/croaring/src/containers/run.c118
-rw-r--r--contrib/libs/croaring/src/isadetection.c6
-rw-r--r--contrib/libs/croaring/ya.make4
8 files changed, 128 insertions, 54 deletions
diff --git a/contrib/libs/backtrace/ya.make b/contrib/libs/backtrace/ya.make
index 10bc0fe17b..522b37557f 100644
--- a/contrib/libs/backtrace/ya.make
+++ b/contrib/libs/backtrace/ya.make
@@ -6,9 +6,9 @@ LICENSE(BSD-3-Clause)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(2024-07-18)
+VERSION(2024-07-30)
-ORIGINAL_SOURCE(https://github.com/ianlancetaylor/libbacktrace/archive/7e2b7da3d6568d2e4e78658f22e701746a48d7e1.tar.gz)
+ORIGINAL_SOURCE(https://github.com/ianlancetaylor/libbacktrace/archive/0dd27b95f9f2c11b4a89db5f185a888af912838e.tar.gz)
ADDINCL(
contrib/libs/backtrace
diff --git a/contrib/libs/croaring/README.md b/contrib/libs/croaring/README.md
index 4e8afc6469..f582d31154 100644
--- a/contrib/libs/croaring/README.md
+++ b/contrib/libs/croaring/README.md
@@ -303,6 +303,21 @@ int main(){
}
```
+By default we use:
+```C
+static roaring_memory_t global_memory_hook = {
+ .malloc = malloc,
+ .realloc = realloc,
+ .calloc = calloc,
+ .free = free,
+ .aligned_malloc = roaring_bitmap_aligned_malloc,
+ .aligned_free = roaring_bitmap_aligned_free,
+};
+```
+
+We require that the `free`/`aligned_free` functions follow the C
+convention where `free(NULL)`/`aligned_free(NULL)` have no effect.
+
# Example (C)
@@ -749,13 +764,17 @@ We have optimizations specific to AVX2 and AVX-512 in the code, and they are tur
## Usage (Using `conan`)
-You can install the library using the conan package manager:
+You can install pre-built binaries for `roaring` or build it from source using [Conan](https://conan.io/). Use the following command to install latest version:
```
-$ echo -e "[requires]\nroaring/0.3.3" > conanfile.txt
-$ conan install .
+conan install --requires="roaring/[*]" --build=missing
```
+For detailed instructions on how to use Conan, please refer to the [Conan documentation](https://docs.conan.io/2/).
+
+The `roaring` Conan recipe is kept up to date by Conan maintainers and community contributors.
+If the version is out of date, please [create an issue or pull request](https://github.com/conan-io/conan-center-index) on the ConanCenterIndex repository.
+
## Usage (Using `vcpkg` on Windows, Linux and macOS)
diff --git a/contrib/libs/croaring/include/roaring/roaring_version.h b/contrib/libs/croaring/include/roaring/roaring_version.h
index 719630048f..3f7519449e 100644
--- a/contrib/libs/croaring/include/roaring/roaring_version.h
+++ b/contrib/libs/croaring/include/roaring/roaring_version.h
@@ -2,11 +2,11 @@
// /include/roaring/roaring_version.h automatically generated by release.py, do not change by hand
#ifndef ROARING_INCLUDE_ROARING_VERSION
#define ROARING_INCLUDE_ROARING_VERSION
-#define ROARING_VERSION "4.0.0"
+#define ROARING_VERSION "4.1.1"
enum {
ROARING_VERSION_MAJOR = 4,
- ROARING_VERSION_MINOR = 0,
- ROARING_VERSION_REVISION = 0
+ ROARING_VERSION_MINOR = 1,
+ ROARING_VERSION_REVISION = 1
};
#endif // ROARING_INCLUDE_ROARING_VERSION
// clang-format on \ No newline at end of file
diff --git a/contrib/libs/croaring/src/containers/array.c b/contrib/libs/croaring/src/containers/array.c
index 0a24482a32..4b5e5bc53d 100644
--- a/contrib/libs/croaring/src/containers/array.c
+++ b/contrib/libs/croaring/src/containers/array.c
@@ -145,11 +145,8 @@ int array_container_shrink_to_fit(array_container_t *src) {
/* Free memory. */
void array_container_free(array_container_t *arr) {
- if (arr->array !=
- NULL) { // Jon Strabala reports that some tools complain otherwise
- roaring_free(arr->array);
- arr->array = NULL; // pedantic
- }
+ if (arr == NULL) return;
+ roaring_free(arr->array);
roaring_free(arr);
}
@@ -177,10 +174,7 @@ void array_container_grow(array_container_t *container, int32_t min,
(uint16_t *)roaring_realloc(array, new_capacity * sizeof(uint16_t));
if (container->array == NULL) roaring_free(array);
} else {
- // Jon Strabala reports that some tools complain otherwise
- if (array != NULL) {
- roaring_free(array);
- }
+ roaring_free(array);
container->array =
(uint16_t *)roaring_malloc(new_capacity * sizeof(uint16_t));
}
diff --git a/contrib/libs/croaring/src/containers/bitset.c b/contrib/libs/croaring/src/containers/bitset.c
index f49739594c..7b84af82ec 100644
--- a/contrib/libs/croaring/src/containers/bitset.c
+++ b/contrib/libs/croaring/src/containers/bitset.c
@@ -130,11 +130,8 @@ void bitset_container_add_from_range(bitset_container_t *bitset, uint32_t min,
/* Free memory. */
void bitset_container_free(bitset_container_t *bitset) {
- if (bitset->words !=
- NULL) { // Jon Strabala reports that some tools complain otherwise
- roaring_aligned_free(bitset->words);
- bitset->words = NULL; // pedantic
- }
+ if (bitset == NULL) return;
+ roaring_aligned_free(bitset->words);
roaring_free(bitset);
}
diff --git a/contrib/libs/croaring/src/containers/run.c b/contrib/libs/croaring/src/containers/run.c
index 0d64726434..986db6d1ac 100644
--- a/contrib/libs/croaring/src/containers/run.c
+++ b/contrib/libs/croaring/src/containers/run.c
@@ -189,11 +189,8 @@ void run_container_offset(const run_container_t *c, container_t **loc,
/* Free memory. */
void run_container_free(run_container_t *run) {
- if (run->runs !=
- NULL) { // Jon Strabala reports that some tools complain otherwise
- roaring_free(run->runs);
- run->runs = NULL; // pedantic
- }
+ if (run == NULL) return;
+ roaring_free(run->runs);
roaring_free(run);
}
@@ -211,10 +208,7 @@ void run_container_grow(run_container_t *run, int32_t min, bool copy) {
run->capacity * sizeof(rle16_t));
if (run->runs == NULL) roaring_free(oldruns);
} else {
- // Jon Strabala reports that some tools complain otherwise
- if (run->runs != NULL) {
- roaring_free(run->runs);
- }
+ roaring_free(run->runs);
run->runs = (rle16_t *)roaring_malloc(run->capacity * sizeof(rle16_t));
}
// We may have run->runs == NULL.
@@ -636,24 +630,6 @@ void run_container_andnot(const run_container_t *src_1,
}
}
-ALLOW_UNALIGNED
-int run_container_to_uint32_array(void *vout, const run_container_t *cont,
- uint32_t base) {
- int outpos = 0;
- uint32_t *out = (uint32_t *)vout;
- for (int i = 0; i < cont->n_runs; ++i) {
- uint32_t run_start = base + cont->runs[i].value;
- uint16_t le = cont->runs[i].length;
- for (int j = 0; j <= le; ++j) {
- uint32_t val = run_start + j;
- memcpy(out + outpos, &val,
- sizeof(uint32_t)); // should be compiled as a MOV on x64
- outpos++;
- }
- }
- return outpos;
-}
-
/*
* Print this container using printf (useful for debugging).
*/
@@ -1026,6 +1002,47 @@ static inline int _avx2_run_container_cardinality(const run_container_t *run) {
return sum;
}
+ALLOW_UNALIGNED
+int _avx2_run_container_to_uint32_array(void *vout, const run_container_t *cont,
+ uint32_t base) {
+ int outpos = 0;
+ uint32_t *out = (uint32_t *)vout;
+
+ for (int i = 0; i < cont->n_runs; ++i) {
+ uint32_t run_start = base + cont->runs[i].value;
+ uint16_t le = cont->runs[i].length;
+ if (le < 8) {
+ for (int j = 0; j <= le; ++j) {
+ uint32_t val = run_start + j;
+ memcpy(out + outpos, &val,
+ sizeof(uint32_t)); // should be compiled as a MOV on x64
+ outpos++;
+ }
+ } else {
+ int j = 0;
+ __m256i run_start_v = _mm256_set1_epi32(run_start);
+ // [8,8,8,8....]
+ __m256i inc = _mm256_set1_epi32(8);
+ // used for generate sequence:
+ // [0, 1, 2, 3...], [8, 9, 10,...]
+ __m256i delta = _mm256_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7);
+ for (j = 0; j + 8 <= le; j += 8) {
+ __m256i val_v = _mm256_add_epi32(run_start_v, delta);
+ _mm256_storeu_si256((__m256i *)(out + outpos), val_v);
+ delta = _mm256_add_epi32(inc, delta);
+ outpos += 8;
+ }
+ for (; j <= le; ++j) {
+ uint32_t val = run_start + j;
+ memcpy(out + outpos, &val,
+ sizeof(uint32_t)); // should be compiled as a MOV on x64
+ outpos++;
+ }
+ }
+ }
+ return outpos;
+}
+
CROARING_UNTARGET_AVX2
/* Get the cardinality of `run'. Requires an actual computation. */
@@ -1055,6 +1072,34 @@ int run_container_cardinality(const run_container_t *run) {
return _scalar_run_container_cardinality(run);
}
}
+
+int _scalar_run_container_to_uint32_array(void *vout,
+ const run_container_t *cont,
+ uint32_t base) {
+ int outpos = 0;
+ uint32_t *out = (uint32_t *)vout;
+ for (int i = 0; i < cont->n_runs; ++i) {
+ uint32_t run_start = base + cont->runs[i].value;
+ uint16_t le = cont->runs[i].length;
+ for (int j = 0; j <= le; ++j) {
+ uint32_t val = run_start + j;
+ memcpy(out + outpos, &val,
+ sizeof(uint32_t)); // should be compiled as a MOV on x64
+ outpos++;
+ }
+ }
+ return outpos;
+}
+
+int run_container_to_uint32_array(void *vout, const run_container_t *cont,
+ uint32_t base) {
+ if (croaring_hardware_support() & ROARING_SUPPORTS_AVX2) {
+ return _avx2_run_container_to_uint32_array(vout, cont, base);
+ } else {
+ return _scalar_run_container_to_uint32_array(vout, cont, base);
+ }
+}
+
#else
/* Get the cardinality of `run'. Requires an actual computation. */
@@ -1071,6 +1116,25 @@ int run_container_cardinality(const run_container_t *run) {
return sum;
}
+
+ALLOW_UNALIGNED
+int run_container_to_uint32_array(void *vout, const run_container_t *cont,
+ uint32_t base) {
+ int outpos = 0;
+ uint32_t *out = (uint32_t *)vout;
+ for (int i = 0; i < cont->n_runs; ++i) {
+ uint32_t run_start = base + cont->runs[i].value;
+ uint16_t le = cont->runs[i].length;
+ for (int j = 0; j <= le; ++j) {
+ uint32_t val = run_start + j;
+ memcpy(out + outpos, &val,
+ sizeof(uint32_t)); // should be compiled as a MOV on x64
+ outpos++;
+ }
+ }
+ return outpos;
+}
+
#endif
#ifdef __cplusplus
diff --git a/contrib/libs/croaring/src/isadetection.c b/contrib/libs/croaring/src/isadetection.c
index d7904149ba..4cc43197c7 100644
--- a/contrib/libs/croaring/src/isadetection.c
+++ b/contrib/libs/croaring/src/isadetection.c
@@ -48,15 +48,15 @@ POSSIBILITY OF SUCH DAMAGE.
#include <stdint.h>
#include <stdlib.h>
-// Binaries produced by Visual Studio with solely AVX2 routines
+// Binaries produced by Visual Studio 19.38 with solely AVX2 routines
// can compile to AVX-512 thus causing crashes on non-AVX-512 systems.
// This appears to affect VS 17.8 and 17.9. We disable AVX-512 and AVX2
// on these systems. It seems that ClangCL is not affected.
// https://github.com/RoaringBitmap/CRoaring/pull/603
#ifndef __clang__
-#if _MSC_VER >= 1938
+#if _MSC_VER == 1938
#define ROARING_DISABLE_AVX 1
-#endif // _MSC_VER >= 1938
+#endif // _MSC_VER == 1938
#endif // __clang__
// We need portability.h to be included first, see
diff --git a/contrib/libs/croaring/ya.make b/contrib/libs/croaring/ya.make
index 359cb7d137..f6a661c0b7 100644
--- a/contrib/libs/croaring/ya.make
+++ b/contrib/libs/croaring/ya.make
@@ -10,9 +10,9 @@ LICENSE(
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(4.1.0)
+VERSION(4.1.1)
-ORIGINAL_SOURCE(https://github.com/RoaringBitmap/CRoaring/archive/v4.1.0.tar.gz)
+ORIGINAL_SOURCE(https://github.com/RoaringBitmap/CRoaring/archive/v4.1.1.tar.gz)
ADDINCL(
GLOBAL contrib/libs/croaring/include