Skip to content

Commit a8e2316

Browse files
Merge #6377: depends: update 'src/immer' to arximboldi/immer@5875f773 as c0b716f2
f18e839 build: drop symlinks in immer subtree (Kittywhiskers Van Gogh) d761111 build: fix gitian builds (Kittywhiskers Van Gogh) a9f46b3 Squashed 'src/immer/' changes from 9cb6a5a845..5875f7739a (Kittywhiskers Van Gogh) e4ee302 revert: fix gitian builds (Kittywhiskers Van Gogh) fb00300 revert: drop symlinks in immer subtree (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Dependency for #6380 #6380 will be using `std::ranges` as a replacement for [dash#4622](#4622) and currently, it will fail to compile due to the current version of `immer` (last updated two years ago in #4911) not meeting constraints ([source](https://en.cppreference.com/w/cpp/language/constraints)) set by `std::ranges` (see below). ``` ./evo/deterministicmns.h:243:16: error: no matching function for call to object of type 'const __count_if_fn' return ranges::count_if(mnMap, [](const auto& p) { return IsMNValid(*p.second); }); ^~~~~~~~~~~~~~~~ /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/ranges_algo.h:331:7: note: candidate template ignored: substitution failure [with _Range = const MnMap &, _Proj = identity, _Pred = (lambda at ./evo/deterministicmns.h:243:40)]: constraints not satisfied for alias template 'range_difference_t' [with _Range = const immer::map<uint256, std::shared_ptr<const CDeterministicMN>, CDeterministicMNList::ImmerHasher> &] operator()(_Range&& __r, _Pred __pred, _Proj __proj = {}) const ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/ranges_algo.h:316:7: note: candidate function template not viable: requires at least 3 arguments, but 2 were provided operator()(_Iter __first, _Sent __last, ^ ``` This has been resolved by updating `immer` to the latest available release, [v0.8.1](https://github.com/arximboldi/immer/releases/tag/v0.8.1). Expected subtree hash **without changes** are `a5ded361aec714bc74149909c5e1984c10ab132c4c539c63fe57362dccd95556` (see [here](#6323 (review)) for verification instructions). ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code **(note: N/A)** - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)** - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK f18e839 UdjinM6: utACK f18e839 Tree-SHA512: 99d1b577eb4cf3fcc3ebfd28f19006700f085d23ccdabe802a2aa5844e4b39314347b0c0e49a352c5fc034d6584a0109edf08fa3c0846514967f1fb16e7f127a
2 parents 444d7a9 + f18e839 commit a8e2316

File tree

154 files changed

+8822
-24491
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+8822
-24491
lines changed

src/immer/.gdbinit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Load pretty printers
2+
source tools/gdb_pretty_printers/autoload.py
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CIFuzz
2+
on: [pull_request]
3+
jobs:
4+
Fuzzing:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Build Fuzzers
8+
id: build
9+
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
10+
with:
11+
oss-fuzz-project-name: 'immer'
12+
dry-run: false
13+
language: c++
14+
- name: Run Fuzzers
15+
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
16+
with:
17+
oss-fuzz-project-name: 'immer'
18+
fuzz-seconds: 300
19+
dry-run: false
20+
language: c++
21+
- name: Upload Crash
22+
uses: actions/upload-artifact@v3
23+
if: failure() && steps.build.outcome == 'success'
24+
with:
25+
name: artifacts
26+
path: ./out/artifacts

src/immer/.github/workflows/test.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,46 @@ jobs:
77
- uses: actions/checkout@v2
88
with:
99
fetch-depth: 0 # needed for fetchGit in default.nix
10-
- uses: cachix/install-nix-action@v12
10+
- uses: cachix/install-nix-action@v20
1111
with:
1212
nix_path: nixpkgs=channel:nixos-unstable
13-
install_url: "https://releases.nixos.org/nix/nix-2.3.16/install"
14-
- uses: cachix/cachix-action@v8
13+
- uses: cachix/cachix-action@v12
1514
with:
1615
name: arximboldi
1716
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
1817
- run: nix-build
1918

19+
build-spm:
20+
runs-on: macos-latest
21+
steps:
22+
- uses: actions/checkout@v2
23+
with:
24+
submodules: true
25+
- run: swift build
26+
2027
docs:
2128
runs-on: ubuntu-latest
2229
steps:
2330
- uses: actions/checkout@v2
2431
with:
2532
submodules: true
26-
- uses: cachix/install-nix-action@v12
33+
- uses: cachix/install-nix-action@v20
2734
with:
2835
nix_path: nixpkgs=channel:nixos-unstable
29-
install_url: "https://releases.nixos.org/nix/nix-2.3.16/install"
30-
- uses: cachix/cachix-action@v8
36+
- uses: cachix/cachix-action@v12
3137
with:
3238
name: arximboldi
3339
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
3440
- run: nix-shell --run "mkdir build"
3541
- run: nix-shell --run "cd build && cmake .."
3642
- run: nix-shell --run "cd build && make docs"
3743
- uses: shimataro/ssh-key-action@v2
38-
if: github.ref == 'refs/heads/master'
44+
if: github.ref == 'refs/heads/master' && github.repository_owner == 'arximboldi'
3945
with:
4046
key: ${{ secrets.SINUSOIDES_SSH_KEY }}
4147
known_hosts: ${{ secrets.SINUSOIDES_KNOWN_HOSTS }}
4248
- run: nix-shell --run "cd build && make upload-docs"
43-
if: github.ref == 'refs/heads/master'
49+
if: github.ref == 'refs/heads/master' && github.repository_owner == 'arximboldi'
4450

4551
check:
4652
strategy:
@@ -74,7 +80,7 @@ jobs:
7480
- type: Debug
7581
toolchain: llvm-8
7682
std: 14
77-
opts: ['sanitizer']
83+
opts: ['sanitize']
7884
# benchmarks
7985
- type: Release
8086
toolchain: gnu-9
@@ -87,11 +93,10 @@ jobs:
8793
runs-on: ubuntu-latest
8894
steps:
8995
- uses: actions/checkout@v2
90-
- uses: cachix/install-nix-action@v12
96+
- uses: cachix/install-nix-action@v20
9197
with:
9298
nix_path: nixpkgs=channel:nixos-unstable
93-
install_url: "https://releases.nixos.org/nix/nix-2.3.16/install"
94-
- uses: cachix/cachix-action@v8
99+
- uses: cachix/cachix-action@v12
95100
with:
96101
name: arximboldi
97102
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
@@ -113,11 +118,11 @@ jobs:
113118
"
114119
- run: nix-shell --argstr toolchain ${{ matrix.toolchain }} --run "cd build && make check -j`nproc`"
115120
- run: nix-shell --argstr toolchain ${{ matrix.toolchain }} --run "bash <(curl -s https://codecov.io/bash)"
116-
if: ${{ contains(matrix.opts, 'coverage') }}
121+
if: contains(matrix.opts, 'coverage')
117122
- uses: shimataro/ssh-key-action@v2
118-
if: ${{ contains(matrix.opts, 'benchmark') }}
123+
if: contains(matrix.opts, 'benchmark') && github.repository_owner == 'arximboldi'
119124
with:
120125
key: ${{ secrets.SINUSOIDES_SSH_KEY }}
121126
known_hosts: ${{ secrets.SINUSOIDES_KNOWN_HOSTS }}
122127
- run: nix-shell --run "cd build && make upload-benchmark-reports"
123-
if: ${{ contains(matrix.opts, 'benchmark') }}
128+
if: contains(matrix.opts, 'benchmark') && github.repository_owner == 'arximboldi'

src/immer/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ __pycache__
2222
tools/clojure/.lein*
2323

2424
*.pyc
25+
26+
/result*
27+
28+
.build
29+
.swiftpm

src/immer/CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cmake_policy(SET CMP0048 NEW) # enable project VERSION
44
cmake_policy(SET CMP0056 NEW) # honor link flags in try_compile()
55
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
66

7-
project(immer VERSION 0.7.0)
7+
project(immer VERSION 0.8.0)
88

99
if (NOT MSVC)
1010
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-extended-offsetof -Wno-c++17-extensions -Wno-c++1z-extensions -Wno-unknown-warning-option -Wno-type-limits")
@@ -99,6 +99,14 @@ install(TARGETS immer EXPORT ImmerConfig)
9999
install(EXPORT ImmerConfig DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Immer")
100100
install(DIRECTORY immer DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
101101

102+
include(CMakePackageConfigHelpers)
103+
write_basic_package_version_file(
104+
"${CMAKE_CURRENT_BINARY_DIR}/ImmerConfigVersion.cmake"
105+
VERSION ${PROJECT_VERSION}
106+
COMPATIBILITY SameMajorVersion )
107+
108+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ImmerConfigVersion.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Immer" )
109+
102110
# development target to be used in tests, examples, benchmarks...
103111
immer_canonicalize_cmake_booleans(
104112
DISABLE_FREE_LIST
@@ -131,6 +139,8 @@ endif()
131139
if (immer_BUILD_TESTS)
132140
enable_testing()
133141

142+
find_package(Catch2 REQUIRED)
143+
134144
add_custom_target(check
135145
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
136146
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}

src/immer/Package.swift

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// swift-tools-version:5.5
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "immer",
8+
products: [
9+
// Products define the executables and libraries a package produces, and make them visible to other packages.
10+
.library(
11+
name: "immer",
12+
targets: ["immer"]),
13+
],
14+
dependencies: [
15+
// Dependencies declare other packages that this package depends on.
16+
// .package(url: /* package url */, from: "1.0.0"),
17+
],
18+
targets: [
19+
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
20+
// Targets can depend on other targets in this package, and on products in packages this package depends on.
21+
.target(
22+
name: "immer",
23+
dependencies: [],
24+
path: ".",
25+
sources: ["spm.cpp"],
26+
publicHeadersPath: ".")
27+
],
28+
cxxLanguageStandard: .cxx14
29+
)

src/immer/README.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. image:: https://github.com/arximboldi/immer/workflows/test/badge.svg
22
:target: https://github.com/arximboldi/immer/actions?query=workflow%3Atest+branch%3Amaster
3-
:alt: Github Actions Badge
3+
:alt: GitHub Actions Badge
44

55
.. image:: https://codecov.io/gh/arximboldi/immer/branch/master/graph/badge.svg
66
:target: https://codecov.io/gh/arximboldi/immer
@@ -13,7 +13,10 @@
1313

1414
.. raw:: html
1515

16-
<img width="100%" src="https://cdn.rawgit.com/arximboldi/immer/3888170d247359cc0905eed548cd46897caef0f4/doc/_static/logo-front.svg" alt="Logotype"/>
16+
<picture>
17+
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.rawgit.com/arximboldi/immer/3888170d247359cc0905eed548cd46897caef0f4/doc/_static/logo-black.svg">
18+
<img width="100%" src="https://cdn.rawgit.com/arximboldi/immer/3888170d247359cc0905eed548cd46897caef0f4/doc/_static/logo-front.svg" alt="Logotype">
19+
</picture>
1720

1821
.. include:introduction/start
1922
@@ -74,7 +77,7 @@ Example
7477
For a **complete example** check `Ewig, a simple didactic
7578
text-editor <https://github.com/arximboldi/ewig>`_ built with this
7679
library. You may also wanna check `Lager, a Redux-like library
77-
<https://github.com/arximboldi/lager>`_ for writting interactive
80+
<https://github.com/arximboldi/lager>`_ for writing interactive
7881
software in C++ using a value-oriented design.
7982

8083

src/immer/benchmark/set/erase.hpp

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
//
2+
// immer: immutable data structures for C++
3+
// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente
4+
//
5+
// This software is distributed under the Boost Software License, Version 1.0.
6+
// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt
7+
//
8+
9+
#pragma once
10+
11+
#include "benchmark/config.hpp"
12+
13+
#include <boost/container/flat_set.hpp>
14+
#include <hash_trie.hpp> // Phil Nash
15+
#include <immer/set.hpp>
16+
#include <immer/set_transient.hpp>
17+
#include <set>
18+
#include <unordered_set>
19+
20+
namespace {
21+
22+
template <typename Generator, typename Set>
23+
auto benchmark_erase_mut_std()
24+
{
25+
return [](nonius::chronometer meter) {
26+
auto n = meter.param<N>();
27+
auto g = Generator{}(n);
28+
auto v_ = [&] {
29+
auto v = Set{};
30+
for (auto i = 0u; i < n; ++i)
31+
v.insert(g[i]);
32+
return v;
33+
}();
34+
measure(meter, [&] {
35+
auto v = v_;
36+
for (auto i = 0u; i < n; ++i)
37+
v.erase(g[i]);
38+
return v;
39+
});
40+
};
41+
}
42+
43+
template <typename Generator, typename Set>
44+
auto benchmark_erase()
45+
{
46+
return [](nonius::chronometer meter) {
47+
auto n = meter.param<N>();
48+
auto g = Generator{}(n);
49+
auto v_ = [&] {
50+
auto v = Set{}.transient();
51+
for (auto i = 0u; i < n; ++i)
52+
v.insert(g[i]);
53+
return v.persistent();
54+
}();
55+
measure(meter, [&] {
56+
auto v = v_;
57+
for (auto i = 0u; i < n; ++i)
58+
v = v.erase(g[i]);
59+
return v;
60+
});
61+
};
62+
}
63+
64+
template <typename Generator, typename Set>
65+
auto benchmark_erase_move()
66+
{
67+
return [](nonius::chronometer meter) {
68+
auto n = meter.param<N>();
69+
auto g = Generator{}(n);
70+
auto v_ = [&] {
71+
auto v = Set{}.transient();
72+
for (auto i = 0u; i < n; ++i)
73+
v.insert(g[i]);
74+
return v.persistent();
75+
}();
76+
measure(meter, [&] {
77+
auto v = v_;
78+
for (auto i = 0u; i < n; ++i)
79+
v = std::move(v).erase(g[i]);
80+
return v;
81+
});
82+
};
83+
}
84+
85+
} // namespace

src/immer/benchmark/set/erase.ipp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// immer: immutable data structures for C++
3+
// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente
4+
//
5+
// This software is distributed under the Boost Software License, Version 1.0.
6+
// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt
7+
//
8+
9+
#include "erase.hpp"
10+
11+
#ifndef GENERATOR_T
12+
#error "you must define a GENERATOR_T"
13+
#endif
14+
15+
using generator__ = GENERATOR_T;
16+
using t__ = typename decltype(generator__{}(0))::value_type;
17+
18+
// clang-format off
19+
NONIUS_BENCHMARK("std::set", benchmark_erase_mut_std<generator__, std::set<t__>>())
20+
NONIUS_BENCHMARK("std::unordered_set", benchmark_erase_mut_std<generator__, std::unordered_set<t__>>())
21+
NONIUS_BENCHMARK("boost::flat_set", benchmark_erase_mut_std<generator__, boost::container::flat_set<t__>>())
22+
// Phil Nash's hash_trie seems to not include an erase operation... at least at
23+
// the version that we have included in the nix-shell here...
24+
// NONIUS_BENCHMARK("hamt::hash_trie", benchmark_erase_mut_hash_trie<generator__, hamt::hash_trie<t__>>())
25+
26+
NONIUS_BENCHMARK("immer::set/5B", benchmark_erase<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,5>>())
27+
NONIUS_BENCHMARK("immer::set/4B", benchmark_erase<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,4>>())
28+
#ifndef DISABLE_GC_BENCHMARKS
29+
NONIUS_BENCHMARK("immer::set/GC", benchmark_erase<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,gc_memory,5>>())
30+
#endif
31+
NONIUS_BENCHMARK("immer::set/UN", benchmark_erase<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,unsafe_memory,5>>())
32+
33+
NONIUS_BENCHMARK("immer::set/move/5B", benchmark_erase_move<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,5>>())
34+
NONIUS_BENCHMARK("immer::set/move/4B", benchmark_erase_move<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,def_memory,4>>())
35+
NONIUS_BENCHMARK("immer::set/move/UN", benchmark_erase_move<generator__, immer::set<t__, std::hash<t__>,std::equal_to<t__>,unsafe_memory,5>>())
36+
37+
NONIUS_BENCHMARK("immer::set/tran/5B", benchmark_erase_mut_std<generator__, immer::set_transient<t__, std::hash<t__>,std::equal_to<t__>,def_memory,5>>())
38+
NONIUS_BENCHMARK("immer::set/tran/4B", benchmark_erase_mut_std<generator__, immer::set_transient<t__, std::hash<t__>,std::equal_to<t__>,def_memory,4>>())
39+
#ifndef DISABLE_GC_BENCHMARKS
40+
NONIUS_BENCHMARK("immer::set/tran/GC", benchmark_erase_mut_std<generator__, immer::set_transient<t__, std::hash<t__>,std::equal_to<t__>,gc_memory,5>>())
41+
#endif
42+
NONIUS_BENCHMARK("immer::set/tran/UN", benchmark_erase_mut_std<generator__, immer::set_transient<t__, std::hash<t__>,std::equal_to<t__>,unsafe_memory,5>>())
43+
44+
// clang-format on

0 commit comments

Comments
 (0)