Compare commits

..
Author SHA1 Message Date
dependabot[bot] f11db53d42 build(deps): bump lukka/get-cmake from 4.5.0 to 4.5.1
Bumps [lukka/get-cmake](https://github.com/lukka/get-cmake) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/lukka/get-cmake/releases)
- [Changelog](https://github.com/lukka/get-cmake/blob/main/RELEASE_PROCESS.md)
- [Commits](https://github.com/lukka/get-cmake/compare/16e8153a8b4918849d92aad131befe67a3705daa...a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4)

---
updated-dependencies:
- dependency-name: lukka/get-cmake
  dependency-version: 4.5.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-30 15:56:30 +00:00
7 changed files with 23 additions and 202 deletions

No files matched your search

+1 -1
View File
@@ -35,7 +35,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Check that the target is big-endian
run: echo | s390x-linux-gnu-g++ -dM -E - | grep -q '__BYTE_ORDER__ __ORDER_BIG_ENDIAN__'
- name: Run CMake
+18 -18
View File
@@ -25,7 +25,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Run CMake
run: cmake -S . -B build -DJSON_CI=On
- name: Build
@@ -38,7 +38,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Check that Meson and pkg-config offer the CMake options
run: make check_build_options
- name: Install Meson
@@ -92,7 +92,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Run CMake
run: cmake -S . -B build -DJSON_CI=On
- name: Build
@@ -123,7 +123,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Run CMake
run: cmake -S . -B build -DJSON_CI=On
- name: Build
@@ -142,7 +142,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Run CMake
run: cmake -S . -B build -DJSON_CI=On
- name: Build
@@ -168,7 +168,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Run CMake
run: cmake -S . -B build -DJSON_CI=On
- name: Build
@@ -244,7 +244,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Run CMake
run: CXX=g++-${{ matrix.compiler }} cmake -S . -B build -DJSON_CI=On
- name: Build
@@ -262,7 +262,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Run CMake
run: cmake -S . -B build -DJSON_CI=On
- name: Build
@@ -279,7 +279,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Disable filesystem support (std::filesystem is unusable) for clang 7 / 8 / 9 / 10
run: echo "JSON_FORCED_GLOBAL_COMPILE_OPTIONS=-DJSON_HAS_FILESYSTEM=0;-DJSON_HAS_EXPERIMENTAL_FILESYSTEM=0" >> "$GITHUB_ENV"
if: ${{ matrix.compiler == '7' || matrix.compiler == '8' || matrix.compiler == '9' || matrix.compiler == '10' }}
@@ -299,7 +299,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Run CMake
run: cmake -S . -B build -DJSON_CI=On
- name: Build
@@ -319,7 +319,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Run CMake
run: cmake -S . -B build -DJSON_CI=On
- name: Build with libc++
@@ -346,7 +346,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Run CMake
run: cmake -S . -B build -DJSON_CI=On
- name: Build
@@ -369,7 +369,7 @@ jobs:
run: apt-get update ; apt-get install -y unzip
# The module test uses `import std;`, which needs CMake 4.5 or newer.
- name: Get CMake 4.5+ and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
with:
cmakeVersion: '^4.5.0'
# Clang: the std library module is provided by libc++ (the image's libstdc++
@@ -395,7 +395,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Run CMake
run: cmake -S . -B build -DJSON_CI=On
- name: Build
@@ -412,7 +412,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Run CMake
run: cmake -S . -B build -DJSON_CI=On
- name: Build
@@ -426,7 +426,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Run CMake
run: cmake -S . -B build -DJSON_CI=On
- name: Build
@@ -446,7 +446,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Run CMake
run: cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -GNinja
- name: Build
@@ -487,7 +487,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Check that the job runs natively on arm64
run: uname -m && test "$(uname -m)" = aarch64
- name: Run CMake
+2 -2
View File
@@ -90,7 +90,7 @@ jobs:
with:
persist-credentials: false
- name: Get latest CMake and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
- name: Set extra CXX_FLAGS for latest std_version
# /wd5285 silences C5285 emitted by the bundled third-party doctest.h, which
# specializes std::tuple (newly diagnosed by the VS2026 v145 toolset)
@@ -214,7 +214,7 @@ jobs:
persist-credentials: false
# The module test uses `import std;`, which needs CMake 4.5 or newer.
- name: Get CMake 4.5+ and ninja
uses: lukka/get-cmake@16e8153a8b4918849d92aad131befe67a3705daa # v4.5.0
uses: lukka/get-cmake@a1a8216777d3cbbf5602c73b9ddd3e98257ecdc4 # v4.5.1
with:
cmakeVersion: '^4.5.0'
# CMAKE_CXX_FLAGS replaces CMake's MSVC defaults (which include /EHsc), and
+1 -16
View File
@@ -628,11 +628,7 @@ run_found:
// covers the escapes of a typical document without regrowing it
wanted = (std::max)(wanted, (std::min)((static_cast<std::size_t>(m_end - m_begin) / 4) + 16, std::size_t{4096}));
}
const std::size_t size = (std::max)(m_doc.arena.size() * 2, wanted);
// (reserved before the resize writes it, so that a large arena gets huge pages)
m_doc.arena.reserve(size);
document_data::advise_huge(m_doc.arena.data(), m_doc.arena.capacity());
m_doc.arena.resize(size);
m_doc.arena.resize((std::max)(m_doc.arena.size() * 2, wanted));
m_arena_write = m_doc.arena.data() + used;
m_arena_end = m_doc.arena.data() + m_doc.arena.size();
}
@@ -1327,17 +1323,6 @@ template<typename FloatType, bool NulIsEnd>
inline bool build(document_data& d, const char* src, std::size_t size, bool comments, bool trailing_commas, bool sentinel, bool validate_only,
parse_failure& failure)
{
#if defined(__linux__) && defined(MADV_HUGEPAGE)
if (!(validate_only && !comments && !trailing_commas))
{
// a large index is reserved here, with huge pages (see document_data::reserve_huge())
const std::size_t n = estimate_nodes(src, size);
if (NLOHMANN_VIEW_UNLIKELY(n >= document_data::huge_min_bytes() / sizeof(node)))
{
d.reserve_huge(n);
}
}
#endif
if (validate_only && !comments && !trailing_commas)
{
// accept() of plain JSON: nothing is stored. The other option sets
@@ -8,9 +8,6 @@
#pragma once
#if defined(__linux__)
#include <sys/mman.h>
#endif
#include <array> // array
#include <cstddef> // size_t
#include <cstdint> // uint8_t, uint32_t
@@ -182,52 +179,6 @@ struct document_data
NLOHMANN_VIEW_THROW(std::bad_alloc());
}
/// a large block: transparent huge pages for its 2 MiB-aligned interior, so that writing it takes one page
/// fault per 2 MiB instead of one per 4 KiB (Linux with THP in "madvise" mode, the default of many
/// distributions; a no-op otherwise)
static NLOHMANN_VIEW_NOINLINE void advise_huge_now(const void* p, std::size_t size) noexcept
{
#if defined(__linux__) && defined(MADV_HUGEPAGE)
const std::uintptr_t huge = std::uintptr_t {2} << 20u;
const auto first = (reinterpret_cast<std::uintptr_t>(p) + huge - 1) & ~(huge - 1); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
const auto last = (reinterpret_cast<std::uintptr_t>(p) + size) & ~(huge - 1); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
if (last > first)
{
static_cast<void>(::madvise(reinterpret_cast<void*>(first), last - first, MADV_HUGEPAGE)); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast,performance-no-int-to-ptr)
}
#else
static_cast<void>(p);
static_cast<void>(size);
#endif
}
/// the size from which advise_huge() asks for huge pages
static constexpr std::size_t huge_min_bytes() noexcept
{
return std::size_t{4} << 20u;
}
static NLOHMANN_VIEW_ALWAYS_INLINE void advise_huge(const void* p, std::size_t size) noexcept
{
if (NLOHMANN_VIEW_UNLIKELY(size >= huge_min_bytes()))
{
advise_huge_now(p, size);
}
}
/// reserve() for a large index, before the parse loop starts (which then finds the room it asks for): with
/// huge pages where advise_huge() gets them. Out of line and outside the parse loop, so that the loop's code
/// stays as it is.
NLOHMANN_VIEW_NOINLINE void reserve_huge(std::size_t n)
{
const node* const before = nodes;
reserve(n);
if (nodes != before)
{
advise_huge_now(nodes, node_capacity * sizeof(node));
}
}
/// make room for n nodes; keeps the first node_count nodes (throws
/// std::bad_alloc for a count that does not fit the address space,
/// instead of wrapping around in n * sizeof(node))
+1 -65
View File
@@ -102,9 +102,6 @@
#if defined(__linux__)
#include <sys/mman.h>
#endif
#include <array> // array
#include <cstddef> // size_t
#include <cstdint> // uint8_t, uint32_t
@@ -526,52 +523,6 @@ struct document_data
NLOHMANN_VIEW_THROW(std::bad_alloc());
}
/// a large block: transparent huge pages for its 2 MiB-aligned interior, so that writing it takes one page
/// fault per 2 MiB instead of one per 4 KiB (Linux with THP in "madvise" mode, the default of many
/// distributions; a no-op otherwise)
static NLOHMANN_VIEW_NOINLINE void advise_huge_now(const void* p, std::size_t size) noexcept
{
#if defined(__linux__) && defined(MADV_HUGEPAGE)
const std::uintptr_t huge = std::uintptr_t {2} << 20u;
const auto first = (reinterpret_cast<std::uintptr_t>(p) + huge - 1) & ~(huge - 1); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
const auto last = (reinterpret_cast<std::uintptr_t>(p) + size) & ~(huge - 1); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
if (last > first)
{
static_cast<void>(::madvise(reinterpret_cast<void*>(first), last - first, MADV_HUGEPAGE)); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast,performance-no-int-to-ptr)
}
#else
static_cast<void>(p);
static_cast<void>(size);
#endif
}
/// the size from which advise_huge() asks for huge pages
static constexpr std::size_t huge_min_bytes() noexcept
{
return std::size_t{4} << 20u;
}
static NLOHMANN_VIEW_ALWAYS_INLINE void advise_huge(const void* p, std::size_t size) noexcept
{
if (NLOHMANN_VIEW_UNLIKELY(size >= huge_min_bytes()))
{
advise_huge_now(p, size);
}
}
/// reserve() for a large index, before the parse loop starts (which then finds the room it asks for): with
/// huge pages where advise_huge() gets them. Out of line and outside the parse loop, so that the loop's code
/// stays as it is.
NLOHMANN_VIEW_NOINLINE void reserve_huge(std::size_t n)
{
const node* const before = nodes;
reserve(n);
if (nodes != before)
{
advise_huge_now(nodes, node_capacity * sizeof(node));
}
}
/// make room for n nodes; keeps the first node_count nodes (throws
/// std::bad_alloc for a count that does not fit the address space,
/// instead of wrapping around in n * sizeof(node))
@@ -2013,11 +1964,7 @@ run_found:
// covers the escapes of a typical document without regrowing it
wanted = (std::max)(wanted, (std::min)((static_cast<std::size_t>(m_end - m_begin) / 4) + 16, std::size_t{4096}));
}
const std::size_t size = (std::max)(m_doc.arena.size() * 2, wanted);
// (reserved before the resize writes it, so that a large arena gets huge pages)
m_doc.arena.reserve(size);
document_data::advise_huge(m_doc.arena.data(), m_doc.arena.capacity());
m_doc.arena.resize(size);
m_doc.arena.resize((std::max)(m_doc.arena.size() * 2, wanted));
m_arena_write = m_doc.arena.data() + used;
m_arena_end = m_doc.arena.data() + m_doc.arena.size();
}
@@ -2712,17 +2659,6 @@ template<typename FloatType, bool NulIsEnd>
inline bool build(document_data& d, const char* src, std::size_t size, bool comments, bool trailing_commas, bool sentinel, bool validate_only,
parse_failure& failure)
{
#if defined(__linux__) && defined(MADV_HUGEPAGE)
if (!(validate_only && !comments && !trailing_commas))
{
// a large index is reserved here, with huge pages (see document_data::reserve_huge())
const std::size_t n = estimate_nodes(src, size);
if (NLOHMANN_VIEW_UNLIKELY(n >= document_data::huge_min_bytes() / sizeof(node)))
{
d.reserve_huge(n);
}
}
#endif
if (validate_only && !comments && !trailing_commas)
{
// accept() of plain JSON: nothing is stored. The other option sets
-51
View File
@@ -598,54 +598,3 @@ TEST_CASE("json_view large objects")
CHECK(d.memory_usage() >= with_index / 2);
}
}
TEST_CASE("json_view large indexes and arenas")
{
// inputs whose index (and decoded strings) take several MiB: on Linux, these blocks are reserved before the
// parse loop and get transparent huge pages (document_data::reserve_huge(), advise_huge())
SECTION("an index of more than 4 MiB")
{
std::string text = "[";
for (int i = 0; i < 400000; ++i)
{
text += (i != 0 ? "," : "") + std::to_string(i);
}
text += ']';
json_document d = json_document::parse(text);
CHECK(d.node_count() == 400001);
CHECK(d.root().size() == 400000);
CHECK(d.root()[0].get<int>() == 0);
CHECK(d.root()[399999].get<int>() == 399999);
CHECK(json_document::accept(text));
// a reused document: a small input, then the large one again
d.read(std::string("[1,2]"));
CHECK(d.root().size() == 2);
d.read(text);
CHECK(d.root()[123456].get<int>() == 123456);
CHECK(d.root() == json::parse(text));
}
SECTION("decoded strings of more than 4 MiB")
{
// 2,000 strings of 3,000 bytes, each with escapes, so that every one is decoded into the arena
std::string s;
for (int i = 0; i < 1000; ++i)
{
s += "ab\\n";
}
std::string text = "[";
for (int i = 0; i < 2000; ++i)
{
text += (i != 0 ? ",\"" : "\"") + std::to_string(i) + s + "\"";
}
text += ']';
const json_document d = json_document::parse(text);
REQUIRE(d.root().size() == 2000);
const json expected = json::parse(text);
CHECK(d.root()[0].get<std::string>() == expected[0].get<std::string>());
CHECK(d.root()[1999].get<std::string>() == expected[1999].get<std::string>());
CHECK(d.root()[1999].get<std::string>().size() == 4 + 3000);
CHECK(d.root() == expected);
}
}