Disallow including headers from implementation files

This commit is contained in:
John Keiser
2023-07-20 10:01:22 -07:00
parent 4dec6ed5a7
commit bb54946b78
93 changed files with 5775 additions and 29057 deletions
+21 -1
View File
@@ -1,5 +1,7 @@
CompileFlags:
CompilationDatabase: build
Add:
- -Wundefined-inline
Diagnostics:
Suppress:
- misc-unused-alias-decls
@@ -16,10 +18,28 @@ If:
CompileFlags:
Add:
- -Wno-unneeded-internal-declaration
- -Wno-undefined-inline # TODO fix and remove these violations
- -Wno-undefined-internal # TODO fix and remove these violations
- -Wno-unused-function
- -Wno-unused-const-variable
Diagnostics:
Suppress:
- pp_including_mainfile_in_preamble
---
# Amalgamated files that require or partly define an implementation
If:
PathMatch:
- .*/(arm64|fallback|haswell|icelake|ppc64|westmere)/begin.h
- .*/generic/.*
Diagnostics:
Suppress:
- pragma_attribute_no_pop_eof
---
# clang has a bad time detecting the push/pop together in src/ for some reason
If:
PathMatch:
- include/simdjson/.*/end.h
- src/(arm64|fallback|haswell|icelake|ppc64|westmere).cpp
Diagnostics:
Suppress:
- pragma_attribute_no_pop_eof
- pragma_attribute_stack_mismatch
-7
View File
@@ -23,11 +23,4 @@ template <typename T> struct simd8x64;
} // namespace arm64
} // namespace simdjson
#ifndef SIMDJSON_AMALGAMATED
// If we're editing one of the files in this directory, begin the implementation!
#ifndef SIMDJSON_IMPLEMENTATION
#include "simdjson/arm64/begin.h"
#endif
#endif // SIMDJSON_AMALGAMATED
#endif // SIMDJSON_ARM64_BASE_H
+4 -2
View File
@@ -1,11 +1,13 @@
#ifndef SIMDJSON_ARM64_BITMANIPULATION_H
#define SIMDJSON_ARM64_BITMANIPULATION_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/arm64/base.h"
#include "simdjson/arm64/intrinsics.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace arm64 {
namespace {
// We sometimes call trailing_zero on inputs that are zero,
@@ -98,7 +100,7 @@ simdjson_inline bool add_overflow(uint64_t value1, uint64_t value2, uint64_t *re
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace arm64
} // namespace simdjson
#endif // SIMDJSON_ARM64_BITMANIPULATION_H
+3 -1
View File
@@ -1,10 +1,12 @@
#ifndef SIMDJSON_ARM64_BITMASK_H
#define SIMDJSON_ARM64_BITMASK_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/arm64/base.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace arm64 {
namespace {
//
+4
View File
@@ -1 +1,5 @@
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/arm64/base.h"
#endif // SIMDJSON_AMALGAMATED
#undef SIMDJSON_IMPLEMENTATION
+1
View File
@@ -2,6 +2,7 @@
#define SIMDJSON_ARM64_IMPLEMENTATION_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/base.h"
#include "simdjson/implementation.h"
#include "simdjson/internal/instruction_set.h"
#endif // SIMDJSON_AMALGAMATED
+4 -2
View File
@@ -1,12 +1,14 @@
#ifndef SIMDJSON_ARM64_INTRINSICS_H
#define SIMDJSON_ARM64_INTRINSICS_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/arm64/base.h"
#endif // SIMDJSON_AMALGAMATED
// This should be the correct header whether
// you use visual studio or other compilers.
#include <arm_neon.h>
#include "simdjson/arm64/base.h"
static_assert(sizeof(uint8x16_t) <= simdjson::SIMDJSON_PADDING, "insufficient padding for arm64");
#endif // SIMDJSON_ARM64_INTRINSICS_H
+7 -8
View File
@@ -1,22 +1,21 @@
#ifndef SIMDJSON_ARM64_NUMBERPARSING_DEFS_H
#define SIMDJSON_ARM64_NUMBERPARSING_DEFS_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/arm64/base.h"
#include "simdjson/arm64/intrinsics.h"
#include "simdjson/internal/numberparsing_tables.h"
#endif // SIMDJSON_AMALGAMATED
#include <cstring>
#if _M_ARM64
// __umulh requires intrin.h
#include <intrin.h>
#endif // _M_ARM64
#include <cstring>
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/internal/numberparsing_tables.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace arm64 {
namespace numberparsing {
// we don't have SSE, so let us use a scalar function
@@ -49,7 +48,7 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t
}
} // namespace numberparsing
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace arm64
} // namespace simdjson
#define SIMDJSON_SWAR_NUMBER_PARSING 1
+3 -4
View File
@@ -1,15 +1,14 @@
#ifndef SIMDJSON_ARM64_SIMD_H
#define SIMDJSON_ARM64_SIMD_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/arm64/base.h"
#include "simdjson/arm64/bitmanipulation.h"
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/internal/simdprune_tables.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace arm64 {
namespace {
namespace simd {
@@ -528,7 +527,7 @@ simdjson_inline int8x16_t make_int8x16_t(int8_t x1, int8_t x2, int8_t x3, int
} // namespace simd
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace arm64
} // namespace simdjson
#endif // SIMDJSON_ARM64_SIMD_H
+4 -2
View File
@@ -1,12 +1,14 @@
#ifndef SIMDJSON_ARM64_STRINGPARSING_DEFS_H
#define SIMDJSON_ARM64_STRINGPARSING_DEFS_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/arm64/base.h"
#include "simdjson/arm64/simd.h"
#include "simdjson/arm64/bitmanipulation.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace arm64 {
namespace {
using namespace simd;
@@ -45,7 +47,7 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace arm64
} // namespace simdjson
#endif // SIMDJSON_ARM64_STRINGPARSING_DEFS_H
+3 -1
View File
@@ -5,10 +5,12 @@
#include "simdjson/dom/base.h"
#include "simdjson/dom/document.h"
#include "simdjson/dom/element.h"
#include "simdjson/dom/element-inl.h"
#include "simdjson/internal/tape_ref-inl.h"
#include "simdjson/internal/jsonformatutils.h"
#include <cstring>
namespace simdjson {
namespace dom {
+4
View File
@@ -7,8 +7,12 @@
#include "simdjson/dom/object.h"
#include "simdjson/internal/tape_type.h"
#include "simdjson/dom/object-inl.h"
#include "simdjson/error-inl.h"
#include <ostream>
#include <limits>
namespace simdjson {
//
+2
View File
@@ -7,6 +7,8 @@
#include "simdjson/dom/parser.h"
#include "simdjson/dom/element.h"
#include "simdjson/dom/parser-inl.h"
namespace simdjson {
//
+5
View File
@@ -5,6 +5,11 @@
#include "simdjson/dom/object.h"
#include "simdjson/dom/document.h"
#include "simdjson/dom/element-inl.h"
#include "simdjson/error-inl.h"
#include <cstring>
namespace simdjson {
//
@@ -3,10 +3,15 @@
#include "simdjson/dom/base.h"
#include "simdjson/dom/parsedjson_iterator.h"
#include "simdjson/internal/tape_ref-inl.h"
#include "simdjson/internal/jsonformatutils.h"
#include <ostream>
#include "simdjson/dom/parser-inl.h"
#include "simdjson/internal/tape_ref-inl.h"
#include <cstring>
#include <iterator>
#include <limits>
#include <ostream>
#ifndef SIMDJSON_DISABLE_DEPRECATED_API
+1
View File
@@ -8,6 +8,7 @@
#include "simdjson/error-inl.h"
#include "simdjson/padded_string-inl.h"
#include "simdjson/dom/document_stream-inl.h"
#include "simdjson/dom/element-inl.h"
#include <climits>
+42 -2
View File
@@ -7,6 +7,12 @@
#include "simdjson/dom/parser.h"
#include "simdjson/internal/tape_type.h"
#include "simdjson/dom/array-inl.h"
#include "simdjson/dom/object-inl.h"
#include "simdjson/internal/tape_ref-inl.h"
#include <cstring>
namespace simdjson {
namespace dom {
inline bool parser::print_json(std::ostream &os) const noexcept {
@@ -17,12 +23,46 @@ inline bool parser::print_json(std::ostream &os) const noexcept {
os << answer;
return true;
}
inline std::ostream& operator<<(std::ostream& out, simdjson::dom::element value) {
simdjson::internal::string_builder<> sb;
sb.append(value);
return (out << sb.str());
}
#if SIMDJSON_EXCEPTIONS
inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result<simdjson::dom::element> x) {
if (x.error()) { throw simdjson::simdjson_error(x.error()); }
return (out << x.value());
}
#endif
inline std::ostream& operator<<(std::ostream& out, simdjson::dom::array value) {
simdjson::internal::string_builder<> sb;
sb.append(value);
return (out << sb.str());
}
#if SIMDJSON_EXCEPTIONS
inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result<simdjson::dom::array> x) {
if (x.error()) { throw simdjson::simdjson_error(x.error()); }
return (out << x.value());
}
#endif
inline std::ostream& operator<<(std::ostream& out, simdjson::dom::object value) {
simdjson::internal::string_builder<> sb;
sb.append(value);
return (out << sb.str());
}
#if SIMDJSON_EXCEPTIONS
inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result<simdjson::dom::object> x) {
if (x.error()) { throw simdjson::simdjson_error(x.error()); }
return (out << x.value());
}
#endif
} // namespace dom
/***
* Number utility functions
**/
namespace {
/**@private
* Escape sequence like \b or \u0001
+6 -27
View File
@@ -146,16 +146,9 @@ namespace dom {
* @param value The element.
* @throw if there is an error with the underlying output stream. simdjson itself will not throw.
*/
inline std::ostream& operator<<(std::ostream& out, simdjson::dom::element value) {
simdjson::internal::string_builder<> sb;
sb.append(value);
return (out << sb.str());
}
inline std::ostream& operator<<(std::ostream& out, simdjson::dom::element value);
#if SIMDJSON_EXCEPTIONS
inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result<simdjson::dom::element> x) {
if (x.error()) { throw simdjson::simdjson_error(x.error()); }
return (out << x.value());
}
inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result<simdjson::dom::element> x);
#endif
/**
* Print JSON to an output stream.
@@ -164,16 +157,9 @@ inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result<sim
* @param value The array.
* @throw if there is an error with the underlying output stream. simdjson itself will not throw.
*/
inline std::ostream& operator<<(std::ostream& out, simdjson::dom::array value) {
simdjson::internal::string_builder<> sb;
sb.append(value);
return (out << sb.str());
}
inline std::ostream& operator<<(std::ostream& out, simdjson::dom::array value);
#if SIMDJSON_EXCEPTIONS
inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result<simdjson::dom::array> x) {
if (x.error()) { throw simdjson::simdjson_error(x.error()); }
return (out << x.value());
}
inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result<simdjson::dom::array> x);
#endif
/**
* Print JSON to an output stream.
@@ -182,16 +168,9 @@ inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result<sim
* @param value The object.
* @throw if there is an error with the underlying output stream. simdjson itself will not throw.
*/
inline std::ostream& operator<<(std::ostream& out, simdjson::dom::object value) {
simdjson::internal::string_builder<> sb;
sb.append(value);
return (out << sb.str());
}
inline std::ostream& operator<<(std::ostream& out, simdjson::dom::object value);
#if SIMDJSON_EXCEPTIONS
inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result<simdjson::dom::object> x) {
if (x.error()) { throw simdjson::simdjson_error(x.error()); }
return (out << x.value());
}
inline std::ostream& operator<<(std::ostream& out, simdjson::simdjson_result<simdjson::dom::object> x);
#endif
} // namespace dom
+2 -2
View File
@@ -1,10 +1,10 @@
#ifndef SIMDJSON_ERROR_INL_H
#define SIMDJSON_ERROR_INL_H
#include <iostream>
#include "simdjson/error.h"
#include <iostream>
namespace simdjson {
namespace internal {
// We store the error code so we can validate the error message is associated with the right code
+1
View File
@@ -2,6 +2,7 @@
#define SIMDJSON_ERROR_H
#include "simdjson/base.h"
#include <string>
namespace simdjson {
-7
View File
@@ -16,11 +16,4 @@ class implementation;
} // namespace fallback
} // namespace simdjson
#ifndef SIMDJSON_AMALGAMATED
// If we're editing one of the files in this directory, begin the implementation!
#ifndef SIMDJSON_IMPLEMENTATION
#include "simdjson/fallback/begin.h"
#endif
#endif // SIMDJSON_AMALGAMATED
#endif // SIMDJSON_FALLBACK_BASE_H
+4 -2
View File
@@ -1,10 +1,12 @@
#ifndef SIMDJSON_FALLBACK_BITMANIPULATION_H
#define SIMDJSON_FALLBACK_BITMANIPULATION_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/fallback/base.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace fallback {
namespace {
#if defined(_MSC_VER) && !defined(_M_ARM64) && !defined(_M_X64)
@@ -40,7 +42,7 @@ simdjson_inline int leading_zeroes(uint64_t input_num) {
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace fallback
} // namespace simdjson
#endif // SIMDJSON_FALLBACK_BITMANIPULATION_H
+4
View File
@@ -1 +1,5 @@
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/fallback/base.h"
#endif // SIMDJSON_AMALGAMATED
#undef SIMDJSON_IMPLEMENTATION
@@ -2,6 +2,7 @@
#define SIMDJSON_FALLBACK_IMPLEMENTATION_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/fallback/base.h"
#include "simdjson/implementation.h"
#endif // SIMDJSON_AMALGAMATED
@@ -1,12 +1,13 @@
#ifndef SIMDJSON_FALLBACK_NUMBERPARSING_DEFS_H
#define SIMDJSON_FALLBACK_NUMBERPARSING_DEFS_H
#include "simdjson/fallback/base.h"
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/fallback/base.h"
#include "simdjson/internal/numberparsing_tables.h"
#endif // SIMDJSON_AMALGAMATED
#include <cstring>
#ifdef JSON_TEST_NUMBERS // for unit testing
void found_invalid_number(const uint8_t *buf);
void found_integer(int64_t result, const uint8_t *buf);
@@ -15,7 +16,7 @@ void found_float(double result, const uint8_t *buf);
#endif
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace fallback {
namespace numberparsing {
// credit: https://johnnylee-sde.github.io/Fast-numeric-string-to-int/
@@ -71,7 +72,7 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t
}
} // namespace numberparsing
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace fallback
} // namespace simdjson
#define SIMDJSON_SWAR_NUMBER_PARSING 1
@@ -1,10 +1,12 @@
#ifndef SIMDJSON_FALLBACK_STRINGPARSING_DEFS_H
#define SIMDJSON_FALLBACK_STRINGPARSING_DEFS_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/fallback/base.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace fallback {
namespace {
// Holds backslashes and quotes locations.
@@ -28,7 +30,7 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace fallback
} // namespace simdjson
#endif // SIMDJSON_FALLBACK_STRINGPARSING_DEFS_H
+2
View File
@@ -6,6 +6,8 @@
#include "simdjson/generic/jsoncharutils.h"
#endif // SIMDJSON_AMALGAMATED
#include <cstring>
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace {
+1
View File
@@ -10,6 +10,7 @@
// Otherwise, amalgamation will fail.
#include "simdjson/base.h"
#include "simdjson/implementation.h"
#include "simdjson/implementation_detection.h"
#include "simdjson/internal/instruction_set.h"
#include "simdjson/internal/dom_parser_implementation.h"
#include "simdjson/internal/jsoncharutils_tables.h"
+1
View File
@@ -9,6 +9,7 @@
#include <limits>
#include <ostream>
#include <cstring>
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
@@ -8,6 +8,9 @@
#include "simdjson/generic/ondemand/value_iterator.h"
#endif // SIMDJSON_AMALGAMATED
#include <memory>
#include <cstring>
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace ondemand {
@@ -6,6 +6,8 @@
#include "simdjson/generic/implementation_simdjson_result_base.h"
#endif // SIMDJSON_AMALGAMATED
#include <memory>
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace ondemand {
-7
View File
@@ -24,11 +24,4 @@ template <typename T> struct simd8x64;
} // namespace haswell
} // namespace simdjson
#ifndef SIMDJSON_AMALGAMATED
// If we're editing one of the files in this directory, begin the implementation!
#ifndef SIMDJSON_IMPLEMENTATION
#include "simdjson/haswell/begin.h"
#endif
#endif // SIMDJSON_AMALGAMATED
#endif // SIMDJSON_HASWELL_BASE_H
+1
View File
@@ -1,4 +1,5 @@
#define SIMDJSON_IMPLEMENTATION haswell
#include "simdjson/haswell/base.h"
#include "simdjson/haswell/intrinsics.h"
+4 -2
View File
@@ -1,12 +1,14 @@
#ifndef SIMDJSON_HASWELL_BITMANIPULATION_H
#define SIMDJSON_HASWELL_BITMANIPULATION_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/haswell/base.h"
#include "simdjson/haswell/intrinsics.h"
#include "simdjson/haswell/bitmask.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace haswell {
namespace {
// We sometimes call trailing_zero on inputs that are zero,
@@ -63,7 +65,7 @@ simdjson_inline bool add_overflow(uint64_t value1, uint64_t value2,
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace haswell
} // namespace simdjson
#endif // SIMDJSON_HASWELL_BITMANIPULATION_H
+4 -2
View File
@@ -1,11 +1,13 @@
#ifndef SIMDJSON_HASWELL_BITMASK_H
#define SIMDJSON_HASWELL_BITMASK_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/haswell/base.h"
#include "simdjson/haswell/intrinsics.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace haswell {
namespace {
//
@@ -22,7 +24,7 @@ simdjson_inline uint64_t prefix_xor(const uint64_t bitmask) {
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace haswell
} // namespace simdjson
#endif // SIMDJSON_HASWELL_BITMASK_H
+2
View File
@@ -1,4 +1,6 @@
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/haswell/base.h"
#endif // SIMDJSON_AMALGAMATED
#if !SIMDJSON_CAN_ALWAYS_RUN_HASWELL
SIMDJSON_UNTARGET_REGION
@@ -2,6 +2,7 @@
#define SIMDJSON_HASWELL_IMPLEMENTATION_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/haswell/base.h"
#include "simdjson/implementation.h"
#include "simdjson/internal/instruction_set.h"
#endif // SIMDJSON_AMALGAMATED
+2
View File
@@ -1,7 +1,9 @@
#ifndef SIMDJSON_HASWELL_INTRINSICS_H
#define SIMDJSON_HASWELL_INTRINSICS_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/haswell/base.h"
#endif // SIMDJSON_AMALGAMATED
#if SIMDJSON_VISUAL_STUDIO
// under clang within visual studio, this will include <x86intrin.h>
@@ -1,15 +1,17 @@
#ifndef SIMDJSON_HASWELL_NUMBERPARSING_DEFS_H
#define SIMDJSON_HASWELL_NUMBERPARSING_DEFS_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/haswell/base.h"
#include "simdjson/haswell/intrinsics.h"
#endif // SIMDJSON_AMALGAMATED
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/internal/numberparsing_tables.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace haswell {
namespace numberparsing {
/** @private */
@@ -51,7 +53,7 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t
}
} // namespace numberparsing
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace haswell
} // namespace simdjson
#define SIMDJSON_SWAR_NUMBER_PARSING 1
+4 -4
View File
@@ -1,15 +1,15 @@
#ifndef SIMDJSON_HASWELL_SIMD_H
#define SIMDJSON_HASWELL_SIMD_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/haswell/base.h"
#include "simdjson/haswell/intrinsics.h"
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/haswell/bitmanipulation.h"
#include "simdjson/internal/simdprune_tables.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace haswell {
namespace {
namespace simd {
@@ -366,7 +366,7 @@ namespace simd {
} // namespace simd
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace haswell
} // namespace simdjson
#endif // SIMDJSON_HASWELL_SIMD_H
@@ -1,11 +1,14 @@
#ifndef SIMDJSON_HASWELL_STRINGPARSING_DEFS_H
#define SIMDJSON_HASWELL_STRINGPARSING_DEFS_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/haswell/base.h"
#include "simdjson/haswell/simd.h"
#include "simdjson/haswell/bitmanipulation.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace haswell {
namespace {
using namespace simd;
@@ -39,7 +42,7 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace haswell
} // namespace simdjson
#endif // SIMDJSON_HASWELL_STRINGPARSING_DEFS_H
-7
View File
@@ -17,11 +17,4 @@ class implementation;
} // namespace icelake
} // namespace simdjson
#ifndef SIMDJSON_AMALGAMATED
// If we're editing one of the files in this directory, begin the implementation!
#ifndef SIMDJSON_IMPLEMENTATION
#include "simdjson/icelake/begin.h"
#endif
#endif // SIMDJSON_AMALGAMATED
#endif // SIMDJSON_ICELAKE_BASE_H
+4 -2
View File
@@ -1,11 +1,13 @@
#ifndef SIMDJSON_ICELAKE_BITMANIPULATION_H
#define SIMDJSON_ICELAKE_BITMANIPULATION_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/icelake/base.h"
#include "simdjson/icelake/intrinsics.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace icelake {
namespace {
// We sometimes call trailing_zero on inputs that are zero,
@@ -62,7 +64,7 @@ simdjson_inline bool add_overflow(uint64_t value1, uint64_t value2,
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace icelake
} // namespace simdjson
#endif // SIMDJSON_ICELAKE_BITMANIPULATION_H
+5 -2
View File
@@ -1,10 +1,13 @@
#ifndef SIMDJSON_ICELAKE_BITMASK_H
#define SIMDJSON_ICELAKE_BITMASK_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/icelake/base.h"
#include "simdjson/icelake/intrinsics.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace icelake {
namespace {
//
@@ -21,7 +24,7 @@ simdjson_inline uint64_t prefix_xor(const uint64_t bitmask) {
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace icelake
} // namespace simdjson
#endif // SIMDJSON_ICELAKE_BITMASK_H
+2
View File
@@ -1,4 +1,6 @@
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/icelake/base.h"
#endif // SIMDJSON_AMALGAMATED
#if !SIMDJSON_CAN_ALWAYS_RUN_ICELAKE
SIMDJSON_UNTARGET_REGION
@@ -2,6 +2,7 @@
#define SIMDJSON_ICELAKE_IMPLEMENTATION_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/icelake/base.h"
#include "simdjson/implementation.h"
#include "simdjson/internal/instruction_set.h"
#endif // SIMDJSON_AMALGAMATED
+2
View File
@@ -1,7 +1,9 @@
#ifndef SIMDJSON_ICELAKE_INTRINSICS_H
#define SIMDJSON_ICELAKE_INTRINSICS_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/icelake/base.h"
#endif // SIMDJSON_AMALGAMATED
#if SIMDJSON_VISUAL_STUDIO
// under clang within visual studio, this will include <x86intrin.h>
@@ -1,15 +1,14 @@
#ifndef SIMDJSON_ICELAKE_NUMBERPARSING_DEFS_H
#define SIMDJSON_ICELAKE_NUMBERPARSING_DEFS_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/icelake/base.h"
#include "simdjson/icelake/intrinsics.h"
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/internal/numberparsing_tables.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace icelake {
namespace numberparsing {
static simdjson_inline uint32_t parse_eight_digits_unrolled(const uint8_t *chars) {
@@ -50,7 +49,7 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t
}
} // namespace numberparsing
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace icelake
} // namespace simdjson
#define SIMDJSON_SWAR_NUMBER_PARSING 1
+5 -5
View File
@@ -1,10 +1,10 @@
#ifndef SIMDJSON_ICELAKE_SIMD_H
#define SIMDJSON_ICELAKE_SIMD_H
#include "simdjson/icelake/base.h"
#include "simdjson/icelake/bitmanipulation.h"
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/icelake/base.h"
#include "simdjson/icelake/intrinsics.h"
#include "simdjson/icelake/bitmanipulation.h"
#include "simdjson/internal/simdprune_tables.h"
#endif // SIMDJSON_AMALGAMATED
@@ -33,7 +33,7 @@ inline __m512i _mm512_set_epi8(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, u
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace icelake {
namespace {
namespace simd {
@@ -366,7 +366,7 @@ namespace simd {
} // namespace simd
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace icelake
} // namespace simdjson
#endif // SIMDJSON_ICELAKE_SIMD_H
@@ -1,11 +1,14 @@
#ifndef SIMDJSON_ICELAKE_STRINGPARSING_DEFS_H
#define SIMDJSON_ICELAKE_STRINGPARSING_DEFS_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/icelake/base.h"
#include "simdjson/icelake/simd.h"
#include "simdjson/icelake/bitmanipulation.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace icelake {
namespace {
using namespace simd;
@@ -39,7 +42,7 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace icelake
} // namespace simdjson
#endif // SIMDJSON_ICELAKE_STRINGPARSING_DEFS_H
+2
View File
@@ -5,6 +5,8 @@
#include "simdjson/internal/tape_ref.h"
#include "simdjson/internal/tape_type.h"
#include <cstring>
namespace simdjson {
namespace internal {
+2
View File
@@ -4,6 +4,8 @@
#include "simdjson/base.h"
#include "simdjson/padded_string.h"
#include "simdjson/padded_string-inl.h"
namespace simdjson {
#if SIMDJSON_EXCEPTIONS
+7
View File
@@ -4,6 +4,9 @@
#include "simdjson/padded_string.h"
#include "simdjson/padded_string_view.h"
#include "simdjson/error-inl.h"
#include "simdjson/padded_string_view-inl.h"
#include <climits>
namespace simdjson {
@@ -167,4 +170,8 @@ inline simdjson_result<padded_string> padded_string::load(std::string_view filen
} // namespace simdjson
inline simdjson::padded_string operator "" _padded(const char *str, size_t len) {
return simdjson::padded_string(str, len);
}
#endif // SIMDJSON_PADDED_STRING_INL_H
+5 -5
View File
@@ -1,9 +1,11 @@
#ifndef SIMDJSON_PADDED_STRING_H
#define SIMDJSON_PADDED_STRING_H
#include "simdjson/portability.h"
#include "simdjson/base.h" // for SIMDJSON_PADDING
#include "simdjson/base.h"
#include "simdjson/error.h"
#include "simdjson/error-inl.h"
#include <cstring>
#include <memory>
#include <string>
@@ -147,9 +149,7 @@ inline std::ostream& operator<<(std::ostream& out, simdjson_result<padded_string
} // namespace simdjson
// This is deliberately outside of simdjson so that people get it without having to use the namespace
inline simdjson::padded_string operator "" _padded(const char *str, size_t len) {
return simdjson::padded_string(str, len);
}
inline simdjson::padded_string operator "" _padded(const char *str, size_t len);
namespace simdjson {
namespace internal {
@@ -3,6 +3,8 @@
#include "simdjson/padded_string_view.h"
#include "simdjson/error-inl.h"
namespace simdjson {
inline padded_string_view::padded_string_view(const char* s, size_t len, size_t capacity) noexcept
@@ -29,6 +31,11 @@ inline size_t padded_string_view::capacity() const noexcept { return _capacity;
inline size_t padded_string_view::padding() const noexcept { return capacity() - length(); }
#if SIMDJSON_EXCEPTIONS
inline std::ostream& operator<<(std::ostream& out, simdjson_result<padded_string_view> &s) noexcept(false) { return out << s.value(); }
#endif
} // namespace simdjson
#endif // SIMDJSON_PADDED_STRING_VIEW_INL_H
+1 -1
View File
@@ -69,7 +69,7 @@ public:
* underlying output stream, that error will be propagated (simdjson_error will not be
* thrown).
*/
inline std::ostream& operator<<(std::ostream& out, simdjson_result<padded_string_view> &s) noexcept(false) { return out << s.value(); }
inline std::ostream& operator<<(std::ostream& out, simdjson_result<padded_string_view> &s) noexcept(false);
#endif
} // namespace simdjson
-7
View File
@@ -23,11 +23,4 @@ template <typename T> struct simd8x64;
} // namespace ppc64
} // namespace simdjson
#ifndef SIMDJSON_AMALGAMATED
// If we're editing one of the files in this directory, begin the implementation!
#ifndef SIMDJSON_IMPLEMENTATION
#include "simdjson/ppc64/begin.h"
#endif
#endif // SIMDJSON_AMALGAMATED
#endif // SIMDJSON_PPC64_BASE_H
+4 -2
View File
@@ -1,10 +1,12 @@
#ifndef SIMDJSON_PPC64_BITMANIPULATION_H
#define SIMDJSON_PPC64_BITMANIPULATION_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/ppc64/base.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace ppc64 {
namespace {
// We sometimes call trailing_zero on inputs that are zero,
@@ -70,7 +72,7 @@ simdjson_inline bool add_overflow(uint64_t value1, uint64_t value2,
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace ppc64
} // namespace simdjson
#endif // SIMDJSON_PPC64_BITMANIPULATION_H
+4 -2
View File
@@ -1,10 +1,12 @@
#ifndef SIMDJSON_PPC64_BITMASK_H
#define SIMDJSON_PPC64_BITMASK_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/ppc64/base.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace ppc64 {
namespace {
//
@@ -38,7 +40,7 @@ simdjson_inline uint64_t prefix_xor(uint64_t bitmask) {
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace ppc64
} // namespace simdjson
#endif
+4
View File
@@ -1 +1,5 @@
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/ppc64/base.h"
#endif // SIMDJSON_AMALGAMATED
#undef SIMDJSON_IMPLEMENTATION
+1
View File
@@ -2,6 +2,7 @@
#define SIMDJSON_PPC64_IMPLEMENTATION_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/ppc64/base.h"
#include "simdjson/implementation.h"
#include "simdjson/internal/instruction_set.h"
#endif // SIMDJSON_AMALGAMATED
+2
View File
@@ -1,7 +1,9 @@
#ifndef SIMDJSON_PPC64_INTRINSICS_H
#define SIMDJSON_PPC64_INTRINSICS_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/ppc64/base.h"
#endif // SIMDJSON_AMALGAMATED
// This should be the correct header whether
// you use visual studio or other compilers.
+5 -6
View File
@@ -1,8 +1,11 @@
#ifndef SIMDJSON_PPC64_NUMBERPARSING_DEFS_H
#define SIMDJSON_PPC64_NUMBERPARSING_DEFS_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/ppc64/base.h"
#include "simdjson/ppc64/intrinsics.h"
#include "simdjson/internal/numberparsing_tables.h"
#endif // SIMDJSON_AMALGAMATED
#include <cstring>
@@ -12,12 +15,8 @@
#include <sys/endian.h>
#endif
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/internal/numberparsing_tables.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace ppc64 {
namespace numberparsing {
// we don't have appropriate instructions, so let us use a scalar function
@@ -58,7 +57,7 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t
}
} // namespace numberparsing
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace ppc64
} // namespace simdjson
#define SIMDJSON_SWAR_NUMBER_PARSING 1
+3 -4
View File
@@ -1,17 +1,16 @@
#ifndef SIMDJSON_PPC64_SIMD_H
#define SIMDJSON_PPC64_SIMD_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/ppc64/base.h"
#include "simdjson/ppc64/bitmanipulation.h"
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/internal/simdprune_tables.h"
#endif // SIMDJSON_AMALGAMATED
#include <type_traits>
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace ppc64 {
namespace {
namespace simd {
@@ -467,7 +466,7 @@ template <typename T> struct simd8x64 {
} // namespace simd
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace ppc64
} // namespace simdjson
#endif // SIMDJSON_PPC64_SIMD_INPUT_H
+5 -2
View File
@@ -1,11 +1,14 @@
#ifndef SIMDJSON_PPC64_STRINGPARSING_DEFS_H
#define SIMDJSON_PPC64_STRINGPARSING_DEFS_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/ppc64/base.h"
#include "simdjson/ppc64/bitmanipulation.h"
#include "simdjson/ppc64/simd.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace ppc64 {
namespace {
using namespace simd;
@@ -56,7 +59,7 @@ backslash_and_quote::copy_and_find(const uint8_t *src, uint8_t *dst) {
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace ppc64
} // namespace simdjson
#endif // SIMDJSON_PPC64_STRINGPARSING_DEFS_H
+2 -7
View File
@@ -16,19 +16,14 @@ class implementation;
namespace {
namespace simd {
template <typename T> struct simd8;
template <typename T> struct simd8x64;
} // namespace simd
} // unnamed namespace
} // namespace westmere
} // namespace simdjson
#ifndef SIMDJSON_AMALGAMATED
// If we're editing one of the files in this directory, begin the implementation!
#ifndef SIMDJSON_IMPLEMENTATION
#include "simdjson/westmere/begin.h"
#endif
#endif // SIMDJSON_AMALGAMATED
#endif // SIMDJSON_WESTMERE_BASE_H
+5 -2
View File
@@ -1,10 +1,13 @@
#ifndef SIMDJSON_WESTMERE_BITMANIPULATION_H
#define SIMDJSON_WESTMERE_BITMANIPULATION_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/westmere/base.h"
#include "simdjson/westmere/intrinsics.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace westmere {
namespace {
// We sometimes call trailing_zero on inputs that are zero,
@@ -70,7 +73,7 @@ simdjson_inline bool add_overflow(uint64_t value1, uint64_t value2,
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace westmere
} // namespace simdjson
#endif // SIMDJSON_WESTMERE_BITMANIPULATION_H
+5 -2
View File
@@ -1,10 +1,13 @@
#ifndef SIMDJSON_WESTMERE_BITMASK_H
#define SIMDJSON_WESTMERE_BITMASK_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/westmere/base.h"
#include "simdjson/westmere/intrinsics.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace westmere {
namespace {
//
@@ -21,7 +24,7 @@ simdjson_inline uint64_t prefix_xor(const uint64_t bitmask) {
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace westmere
} // namespace simdjson
#endif // SIMDJSON_WESTMERE_BITMASK_H
+2
View File
@@ -1,4 +1,6 @@
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/westmere/base.h"
#endif // SIMDJSON_AMALGAMATED
#if !SIMDJSON_CAN_ALWAYS_RUN_WESTMERE
SIMDJSON_UNTARGET_REGION
@@ -2,6 +2,7 @@
#define SIMDJSON_WESTMERE_IMPLEMENTATION_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/westmere/base.h"
#include "simdjson/implementation.h"
#include "simdjson/internal/instruction_set.h"
#endif // SIMDJSON_AMALGAMATED
+2
View File
@@ -1,7 +1,9 @@
#ifndef SIMDJSON_WESTMERE_INTRINSICS_H
#define SIMDJSON_WESTMERE_INTRINSICS_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/westmere/base.h"
#endif // SIMDJSON_AMALGAMATED
#if SIMDJSON_VISUAL_STUDIO
// under clang within visual studio, this will include <x86intrin.h>
@@ -9,7 +9,7 @@
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace westmere {
namespace numberparsing {
/** @private */
@@ -51,7 +51,7 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t
}
} // namespace numberparsing
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace westmere
} // namespace simdjson
#define SIMDJSON_SWAR_NUMBER_PARSING 1
+3 -4
View File
@@ -1,15 +1,14 @@
#ifndef SIMDJSON_WESTMERE_SIMD_H
#define SIMDJSON_WESTMERE_SIMD_H
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/westmere/base.h"
#include "simdjson/westmere/bitmanipulation.h"
#ifndef SIMDJSON_AMALGAMATED
#include "simdjson/internal/simdprune_tables.h"
#endif // SIMDJSON_AMALGAMATED
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace westmere {
namespace {
namespace simd {
@@ -333,7 +332,7 @@ namespace simd {
} // namespace simd
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace westmere
} // namespace simdjson
#endif // SIMDJSON_WESTMERE_SIMD_INPUT_H
@@ -5,7 +5,7 @@
#include "simdjson/westmere/simd.h"
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace westmere {
namespace {
using namespace simd;
@@ -41,7 +41,7 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace westmere
} // namespace simdjson
#endif // SIMDJSON_WESTMERE_STRINGPARSING_DEFS_H
+230 -114
View File
@@ -10,7 +10,7 @@ import os
import re
import shutil
import datetime
from typing import Dict, Iterable, List, Optional, Set, TextIO
from typing import Dict, Iterable, List, Literal, Optional, Protocol, Set, TextIO, Union, cast
if sys.version_info < (3, 0):
sys.stdout.write("Sorry, requires Python 3.x or better\n")
@@ -36,91 +36,232 @@ if "AMALGAMATE_OUTPUT_PATH" not in os.environ:
else:
AMALGAMATE_OUTPUT_PATH = os.environ["AMALGAMATE_OUTPUT_PATH"]
BUILTIN_BEGIN_H = "include/simdjson/builtin/begin.h"
BUILTIN_END_H = "include/simdjson/builtin/end.h"
IMPLEMENTATION_DETECTION_H = "include/simdjson/implementation_detection.h"
RelativeRoot = Literal['src','include']
RELATIVE_ROOTS: List[RelativeRoot] = ['src', 'include' ]
Implementation = Literal['arm64', 'fallback', 'haswell', 'icelake', 'ppc64', 'westmere']
IMPLEMENTATIONS: List[Implementation] = [ 'arm64', 'fallback', 'haswell', 'icelake', 'ppc64', 'westmere' ]
GENERIC_INCLUDE = "simdjson/generic"
GENERIC_SRC = "generic"
BUILTIN = "simdjson/builtin"
BUILTIN_BEGIN_H = f"{BUILTIN}/begin.h"
BUILTIN_END_H = f"{BUILTIN}/end.h"
IMPLEMENTATION_DETECTION_H = "simdjson/implementation_detection.h"
def any_match(patterns: Iterable[str], string: str):
return any([re.match(pattern, string) for pattern in patterns])
class SimdjsonFile:
def __init__(self, repository: 'SimdjsonRepository', root: RelativeRoot, include_path: str):
self.repository = repository
self.root = root
self.include_path = include_path
self.includes: List[SimdjsonFile] = []
self.included_from: Set[SimdjsonFile] = set()
self.editor_only_includes: List[SimdjsonFile] = []
self.editor_only_included_from: Set[SimdjsonFile] = set()
self.processed: Optional[bool] = None
class DirectoryDependencies:
def __init__(self, dependencies_file: str, amalgamated_dependencies: List[str]):
self.dependencies_file = dependencies_file
# Dependencies from {directory}/dependencies.h
self.amalgamated_dependencies = amalgamated_dependencies
# filename -> editor-only dependencies
self.extra_dependencies = set(amalgamated_dependencies)
def __str__(self):
return self.include_path
def __repr__(self):
return self.include_path
@property
def project_relative_path(self):
return f"{self.root}/{self.include_path}"
@property
def absolute_path(self):
return os.path.join(self.repository.project_path, self.root, self.include_path)
@property
def is_generic(self):
return self.include_path.startswith('generic/') or self.include_path.startswith('simdjson/generic/')
@property
def include_dir(self):
return os.path.dirname(self.include_path)
@property
def filename(self):
return os.path.basename(self.include_path)
@property
def implementation(self) -> Optional[Implementation]:
match = re.search(f'(^|/)({"|".join(IMPLEMENTATIONS)})', self.include_path)
if match:
return cast(Implementation, str(match.group(2)))
@property
def free_dependency_file(self):
if self.is_free_dependency_file:
return None
if self.implementation:
# src/arm64.cpp, etc. -> generic/dependencies.h
if self.include_dir == '':
return self.repository["generic/dependencies.h"]
# simdjson/arm64/ondemand.h
if self.filename == 'ondemand.h':
return self.repository["simdjson/generic/ondemand/dependencies.h"]
# simdjson/arm64.h, simdjson/arm64/*.h
else:
return self.repository["simdjson/generic/dependencies.h"]
if self.include_path.startswith('generic/') or self.include_path.startswith('simdjson/generic/'):
return self.repository[f"{self.include_dir}/dependencies.h"]
return None
@property
def is_amalgamator(self):
if self.implementation:
return self.root == 'src' or self.include_dir == 'simdjson' or self.filename == 'ondemand.h' or self.filename == 'implementation.h'
else:
return self.filename == 'amalgamated.h'
# The file that is authorized to include this file in amalgamation. If this is blank, it's
# generally because it *is* an amalgamator file.
@property
def amalgamator_file(self):
# generic/dependencies.h and things like amd64.h must not be in dependencies
if self.is_free_dependency_file or self.is_amalgamator or self.implementation:
return None
# generic/*.h -> generic/amalgamated.h
# generic/stage1/*.h -> generic/stage1/amalgamated.h
# simdjson/generic/*.h -> simdjson/generic/amalgamated.h
# simdjson/generic/ondemand/*.h -> simdjson/generic/ondemand/amalgamated.h
if self.is_generic:
return self.repository[f"{self.include_dir}/amalgamated.h"]
return None
@property
def is_free_dependency(self):
return self.free_dependency_file is None
@property
def is_amalgamated(self):
return not self.is_free_dependency
@property
def is_free_dependency_file(self):
return self.filename == 'dependencies.h'
def add_include(self, include: 'SimdjsonFile'):
# If there's a place we have to put dependencies, figure out if this is valid to include
if self.is_free_dependency:
assert include.is_free_dependency or include.is_amalgamator, f"{self} cannot include {include} because it is an amalgamated file."
else:
assert not include.is_free_dependency, f"{self} cannot include {include} without #ifndef SIMDJSON_AMALGAMATED."
# TODO make sure we only include amalgamated files that are guaranteed to be included with us (or before us)
# if include.amalgamator_file:
# assert include.amalgamator_file == self, f"{self} cannot include {include}: it should be included from {include.amalgamator_file} instead."
self.includes.append(include)
include.included_from.add(self)
def add_editor_only_include(self, include: 'SimdjsonFile'):
assert self.is_amalgamated, f"Cannot use #ifndef SIMDJSON_AMALGAMATED in {self} because it is not an amalgamated file."
if include.is_free_dependency:
assert self.free_dependency_file, f"{self} cannot include {include} without #ifndef SIMDJSON_AMALGAMATED."
# TODO make sure we only include amalgamated files that are guaranteed to be included with us (or before us)
# elif include.amalgamator_file:
# assert self.is_amalgamated_before(self.amalgamator_file), f"{self} cannot include {include}: it should be included from {include.amalgamator_file} instead."
self.editor_only_includes.append(include)
include.editor_only_included_from.add(self)
def validate_free_dependency_file(self):
if self.is_free_dependency_file:
extra_include_set = set(self.includes)
for file in self.repository:
if file.free_dependency_file == self:
for editor_only_include in file.editor_only_includes:
if editor_only_include.is_free_dependency:
assert editor_only_include in self.includes, f"{file} includes {editor_only_include}, but it is not included from {self}. It must be added to {self}."
if editor_only_include in extra_include_set:
extra_include_set.remove(editor_only_include)
assert len(extra_include_set) == 0, f"{self} unnecessarily includes {extra_include_set}. They are not included in the corresponding amalgamated files."
class SimdjsonRepository:
def __init__(self, project_path: str, relative_roots: List[RelativeRoot]):
self.project_path = project_path
self.relative_roots = relative_roots
self.files: Dict[str, SimdjsonFile] = {}
def validate_free_dependency_files(self):
for file in self:
file.validate_free_dependency_file()
def __len__(self):
return len(self.files)
def __contains__(self, include_path: Union[str,SimdjsonFile]):
if isinstance(include_path, SimdjsonFile):
return include_path.include_path in self.files
else:
return include_path in self.files
def __getitem__(self, include_path: str):
if include_path not in self.files:
self.files[include_path] = SimdjsonFile(self, self._included_filename_root(include_path), include_path)
return self.files[include_path]
def __iter__(self):
return iter(self.files.values())
def _included_filename_root(self, filename: str):
result = None
for relative_root in self.relative_roots:
if os.path.exists(os.path.join(self.project_path, relative_root, filename)):
assert result is None, "{file} exists in both {result} and {root}!"
result = relative_root
assert result, f"{filename} not found in {self.relative_roots}"
return result
def add_editor_only_dependency(self, file: str, included_file: str):
dir = os.path.dirname(file)
# Exclude the base.h hack to include begin.h and implementation_selection.h
if file.endswith('/base.h') and (included_file.endswith('/begin.h') or included_file == IMPLEMENTATION_DETECTION_H):
return
# Includes of generic files don't need to be in dependencies (they need to be in amalgamated.h, really, though we're not checking that):
if included_file.startswith('include/simdjson/generic/') or included_file.startswith('src/generic/'):
return
assert included_file in self.amalgamated_dependencies, f"{included_file} is included in {file} but not in {self.dependencies_file} (which has {self.amalgamated_dependencies})!"
if included_file in self.extra_dependencies:
self.extra_dependencies.remove(included_file)
class Amalgamator:
@classmethod
def amalgamate(cls, output_path: str, file: str, roots: List[str], timestamp: str):
def amalgamate(cls, output_path: str, file: str, roots: List[RelativeRoot], timestamp: str):
print(f"Creating {output_path}")
fid = open(output_path, 'w')
print(f"/* auto-generated on {timestamp}. Do not edit! */", file=fid)
amalgamator = cls(fid, roots)
amalgamator.maybe_write_file(file, "", "")
amalgamator.validate_dependencies()
amalgamator = cls(fid, SimdjsonRepository(PROJECTPATH, roots))
amalgamator.maybe_write_file(amalgamator.repository[file], None, "")
amalgamator.repository.validate_free_dependency_files()
fid.close()
def __init__(self, fid: TextIO, roots: List[str]):
def __init__(self, fid: TextIO, repository: SimdjsonRepository):
self.fid = fid
self.roots = roots
self.repository = repository
self.builtin_implementation = False
self.implementation: Optional[str] = None
self.found_includes: List[str] = []
self.found_generic_includes: List[tuple[str, str]] = []
self.found_includes: Set[SimdjsonFile] = set()
self.found_includes_per_amalgamation: Set[SimdjsonFile] = set()
self.found_generic_includes: List[tuple[SimdjsonFile, str]] = []
self.amalgamated_defined = False
self.editor_only_region = False
self.include_stack: List[str] = []
self.dependencies: Dict[str, DirectoryDependencies] = {}
self.include_stack: List[SimdjsonFile] = []
def is_generic(self, file: str):
return (
file.startswith('include/simdjson/generic/') or
file.startswith('src/generic/')
) and not file.endswith('/dependencies.h')
def find_file_root(self, filename: str):
result = None
for root in self.roots:
if os.path.exists(os.path.join(root, filename)):
assert result is None, "{file} exists in both {result} and {root}!"
result = root
return result
def maybe_write_file(self, file: str, including_file: str, else_line: str):
# These files get written out every time they are included, and must be included during SIMDJSON_AMALGAMATED
if re.search(r'(/|^)(arm64|fallback|haswell|icelake|ppc64|westmere)(\.\w+|)?(/|$)', file):
assert self.amalgamated_defined, f"{file} included from {including_file} without defining SIMDJSON_AMALGAMATED!"
elif self.is_generic(file):
# Generic files may only be included from their actual implementations.
assert re.search(r'(/|^)(arm64|fallback|generic|haswell|icelake|ppc64|westmere)(\.\w+|)?(/|$)', file)
# Generic files can only ever be written out once for simdjson.h and once for simdjson.cpp
assert self.amalgamated_defined, f"{file} included from {including_file} without defining SIMDJSON_AMALGAMATED!"
assert self.implementation is not None, f"generic file {file} included from {including_file} without defining SIMDJSON_IMPLEMENTATION!"
assert (file, self.implementation) not in self.found_generic_includes, f"generic file {file} included from {including_file} a second time for {self.implementation}!"
self.found_generic_includes.append((file, self.implementation))
def maybe_write_file(self, file: SimdjsonFile, including_file: Optional[SimdjsonFile], else_line: str):
if file.is_amalgamated:
if file.is_generic:
# Generic files get written out once per implementation in a well-defined order
assert (file, self.implementation) not in self.found_generic_includes, f"generic file {file} included from {including_file} a second time for {self.implementation}!"
assert self.implementation, file
self.found_generic_includes.append((file, self.implementation))
else:
# Other amalgamated files, on the other hand, may only be included once per *amalgamation*
if file not in self.found_includes_per_amalgamation:
self.found_includes_per_amalgamation.add(file)
else:
# Other files are only output once, and may not be included during SIMDJSON_AMALGAMATED
assert not self.amalgamated_defined, f"{file} included from {including_file} while SIMDJSON_AMALGAMATED is defined!"
if file in self.found_includes:
self.write(f"/* skipped duplicate {else_line} */")
return
self.found_includes.append(file)
self.found_includes.add(file)
self.write(f"/* including {self.file_to_str(file)}: {else_line} */")
self.write_file(file)
@@ -128,49 +269,35 @@ class Amalgamator:
def write(self, line: str):
print(line, file=self.fid)
def absolute_file_path(self, filename: str):
root = self.find_file_root(filename)
assert root
file = os.path.join(root, filename)
assert os.path.exists(file)
# Windows use \ as a directory separator, but we do not want that:
return file.replace('\\', '/')
def project_relative_file(self, filename: str):
file = os.path.relpath(self.absolute_file_path(filename), PROJECTPATH)
# Windows use \ as a directory separator, but we do not want that:
return file.replace('\\','/')
def file_to_str(self, file: str):
if self.is_generic(file):
assert self.implementation
def file_to_str(self, file: SimdjsonFile):
if file.is_generic and file.is_amalgamated:
assert self.implementation, file
return f"{file} for {self.implementation}"
return file
def write_file(self, file: str):
def write_file(self, file: SimdjsonFile):
# Detect cyclic dependencies
assert file not in self.include_stack, f"Cyclic include: {self.include_stack} -> {file}"
self.include_stack.append(file)
dir = os.path.dirname(file)
dependencies: List[str] = []
file.processed = False
self.write(f"/* begin file {self.file_to_str(file)} */")
if file == BUILTIN_BEGIN_H:
assert self.implementation is None
assert not self.builtin_implementation
assert self.implementation is None, self.implementation
assert not self.builtin_implementation, self.builtin_implementation
self.builtin_implementation = True
self.implementation = "SIMDJSON_BUILTIN_IMPLEMENTATION"
assert not self.editor_only_region
with open(os.path.join(PROJECTPATH, file), 'r') as fid2:
with open(file.absolute_path, 'r') as fid2:
for line in fid2:
line = line.rstrip('\n')
# Ignore lines inside #ifndef SIMDJSON_AMALGAMATED
if re.search(r'^#ifndef\s+SIMDJSON_AMALGAMATED\s*$', line):
assert file.is_amalgamated, f"{file} uses #ifndef SIMDJSON_AMALGAMATED but is not an amalgamated file!"
assert self.amalgamated_defined, f"{file} uses #ifndef SIMDJSON_AMALGAMATED without a prior #define SIMDJSON_AMALGAMATED: {self.include_stack}"
assert not self.editor_only_region, f"{file} uses #ifndef SIMDJSON_AMALGAMATED twice in a row"
self.editor_only_region = True
@@ -180,31 +307,22 @@ class Amalgamator:
if self.editor_only_region:
self.write(f"/* amalgamation skipped (editor-only): {line} */")
# Includes in here are "local includes" which must be added to dependencies.h but not processed.
# Add the editor-only include so we can check dependencies.h for completeness later
included = re.search(r'^#include "([^"]*)"', line)
if included:
included_file = self.project_relative_file(included.group(1))
if file.startswith('include/simdjson/generic/') or file.startswith('src/generic/'):
generic_dir = dir
elif dir == 'src' or dir == 'include':
generic_dir = f"{dir}/generic"
else:
generic_dir = f"{os.path.dirname(dir)}/generic"
assert generic_dir in self.dependencies, f"{file} included before {generic_dir}/dependencies.h: {self.include_stack}!"
# Track all local dependencies so we can check at the end
self.dependencies[generic_dir].add_editor_only_dependency(file, included_file)
file.add_editor_only_include(self.repository[included.group(1)])
if end_ignore:
self.editor_only_region = False
continue
assert not end_ignore, f"{file} has #endif // SIMDJSON_AMALGAMATED without #ifndef SIMDJSON_AMALGAMATED"
# Handle #include lines
included = re.search(r'^#include "([^"]*)"', line)
if included:
included_file = self.project_relative_file(included.group(1))
dependencies.append(included_file)
# we explicitly include simdjson headers, one time each (unless they are generic, in which case multiple times is fine)
included_file = self.repository[included.group(1)]
file.add_include(included_file)
self.maybe_write_file(included_file, file, line)
continue
@@ -221,7 +339,7 @@ class Amalgamator:
# Don't include #undef SIMDJSON_IMPLEMENTATION since we're handling it ourselves
self.write(f'/* undefining SIMDJSON_IMPLEMENTATION from "{self.implementation}" */')
self.implementation = None
elif re.search(r'\bSIMDJSON_IMPLEMENTATION\b', line) and file != IMPLEMENTATION_DETECTION_H:
elif re.search(r'\bSIMDJSON_IMPLEMENTATION\b', line) and file.include_path != IMPLEMENTATION_DETECTION_H:
# copy the line, with SIMDJSON_IMPLEMENTATION replace to what it is currently defined to
assert self.implementation, f"Use of SIMDJSON_IMPLEMENTATION while not defined in {file}: {line}"
line = re.sub(r'\bSIMDJSON_IMPLEMENTATION\b',self.implementation,line)
@@ -229,10 +347,13 @@ class Amalgamator:
# Handle defining and undefining SIMDJSON_AMALGAMATED
defined = re.search(r'^#define\s+SIMDJSON_AMALGAMATED\s*$', line)
if defined:
assert not file.is_amalgamated, "SIMDJSON_AMALGAMATED defined in amalgamated file {file}! Not allowed."
assert not self.amalgamated_defined, f"{file} redefines SIMDJSON_AMALGAMATED"
self.amalgamated_defined = True
self.found_includes_per_amalgamation.clear()
self.write(f'/* defining SIMDJSON_AMALGAMATED */')
elif re.search(r'^#undef\s+SIMDJSON_AMALGAMATED\s*$', line):
assert not file.is_amalgamated, "SIMDJSON_AMALGAMATED undefined in amalgamated file {file}! Not allowed."
assert self.amalgamated_defined, f"{file} undefines SIMDJSON_AMALGAMATED without defining it"
self.write(f'/* undefining SIMDJSON_AMALGAMATED */')
self.amalgamated_defined = False
@@ -243,24 +364,19 @@ class Amalgamator:
self.write(f"/* end file {self.file_to_str(file)} */")
if file == 'include/simdjson/builtin/begin.h':
if file.include_path == BUILTIN_BEGIN_H:
# begin.h redefined SIMDJSON_IMPLEMENTATION multiple times
assert self.builtin_implementation
self.implementation = "SIMDJSON_BUILTIN_IMPLEMENTATION"
elif file == 'include/simdjson/builtin/end.h':
elif file.include_path == BUILTIN_END_H:
assert self.implementation is None
assert self.builtin_implementation
self.implementation = None
file.processed = True
self.include_stack.pop()
if file.endswith('/dependencies.h'):
self.dependencies[dir] = DirectoryDependencies(file, dependencies)
def validate_dependencies(self):
for dependencies in self.dependencies.values():
assert len(dependencies.extra_dependencies) == 0, f"{dependencies.dependencies_file} includes unnecessary files not included in {os.path.dirname(dependencies.dependencies_file)}/*.h: {dependencies.extra_dependencies}"
# Get the generation date from git, so the output is reproducible.
# The %ci specifier gives the unambiguous ISO 8601 format, and
# does not change with locale and timezone at time of generation.
@@ -282,8 +398,8 @@ AMAL_C = os.path.join(AMALGAMATE_OUTPUT_PATH, "simdjson.cpp")
DEMOCPP = os.path.join(AMALGAMATE_OUTPUT_PATH, "amalgamate_demo.cpp")
README = os.path.join(AMALGAMATE_OUTPUT_PATH, "README.md")
Amalgamator.amalgamate(AMAL_H, "include/simdjson.h", [AMALGAMATE_INCLUDE_PATH], timestamp)
Amalgamator.amalgamate(AMAL_C, "src/simdjson.cpp", [AMALGAMATE_SOURCE_PATH, AMALGAMATE_INCLUDE_PATH], timestamp)
Amalgamator.amalgamate(AMAL_H, "simdjson.h", ['include'], timestamp)
Amalgamator.amalgamate(AMAL_C, "simdjson.cpp", ['src', 'include'], timestamp)
# copy the README and DEMOCPP
if SCRIPTPATH != AMALGAMATE_OUTPUT_PATH:
+2174 -13885
View File
File diff suppressed because it is too large Load Diff
+3021 -14871
View File
File diff suppressed because it is too large Load Diff
+8 -4
View File
@@ -1,6 +1,10 @@
#ifndef SIMDJSON_SRC_ARM64_CPP
#define SIMDJSON_SRC_ARM64_CPP
#ifndef SIMDJSON_AMALGAMATED
#include "base.h"
#endif // SIMDJSON_AMALGAMATED
#include "simdjson/arm64.h"
#include "simdjson/arm64/implementation.h"
@@ -13,7 +17,7 @@
// Stage 1
//
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace arm64 {
simdjson_warn_unused error_code implementation::create_dom_parser_implementation(
size_t capacity,
@@ -111,7 +115,7 @@ simdjson_inline simd8<bool> must_be_2_3_continuation(const simd8<uint8_t> prev2,
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace arm64
} // namespace simdjson
//
@@ -122,7 +126,7 @@ simdjson_inline simd8<bool> must_be_2_3_continuation(const simd8<uint8_t> prev2,
// Implementation-specific overrides
//
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace arm64 {
namespace {
namespace stage1 {
@@ -172,7 +176,7 @@ simdjson_warn_unused error_code dom_parser_implementation::parse(const uint8_t *
return stage2(_doc);
}
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace arm64
} // namespace simdjson
#include "simdjson/arm64/end.h"
+6
View File
@@ -0,0 +1,6 @@
#ifndef SIMDJSON_SRC_BASE_H
#define SIMDJSON_SRC_BASE_H
#include "simdjson/base.h"
#endif // SIMDJSON_SRC_BASE_H
+8 -4
View File
@@ -1,6 +1,10 @@
#ifndef SIMDJSON_SRC_FALLBACK_CPP
#define SIMDJSON_SRC_FALLBACK_CPP
#ifndef SIMDJSON_AMALGAMATED
#include "base.h"
#endif // SIMDJSON_AMALGAMATED
#include "simdjson/fallback.h"
#include "simdjson/fallback/implementation.h"
@@ -17,7 +21,7 @@
//
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace fallback {
simdjson_warn_unused error_code implementation::create_dom_parser_implementation(
size_t capacity,
@@ -366,7 +370,7 @@ simdjson_warn_unused bool implementation::validate_utf8(const char *buf, size_t
return true;
}
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace fallback
} // namespace simdjson
//
@@ -374,7 +378,7 @@ simdjson_warn_unused bool implementation::validate_utf8(const char *buf, size_t
//
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace fallback {
simdjson_warn_unused error_code dom_parser_implementation::stage2(dom::document &_doc) noexcept {
return stage2::tape_builder::parse_document<false>(*this, _doc);
@@ -398,7 +402,7 @@ simdjson_warn_unused error_code dom_parser_implementation::parse(const uint8_t *
return stage2(_doc);
}
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace fallback
} // namespace simdjson
#include "simdjson/fallback/end.h"
+3
View File
@@ -1,6 +1,9 @@
#ifndef SIMDJSON_SRC_FROM_CHARS_CPP
#define SIMDJSON_SRC_FROM_CHARS_CPP
#include "base.h"
#include <cstdint>
#include <cstring>
#include <limits>
+1
View File
@@ -2,6 +2,7 @@
#ifndef SIMDJSON_AMALGAMATED
#define SIMDJSON_SRC_GENERIC_BASE_H
#include "base.h"
#include "simdjson/generic/base.h"
#endif // SIMDJSON_AMALGAMATED
+2
View File
@@ -5,4 +5,6 @@
#ifndef SIMDJSON_SRC_GENERIC_DEPENDENCIES_H
#define SIMDJSON_SRC_GENERIC_DEPENDENCIES_H
#include "base.h"
#endif // SIMDJSON_SRC_GENERIC_DEPENDENCIES_H
+2
View File
@@ -5,6 +5,8 @@
#include "generic/stage1/base.h"
#endif // SIMDJSON_AMALGAMATED
#include <cstring>
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace {
+3
View File
@@ -5,6 +5,9 @@
#include "generic/stage2/base.h"
#endif // SIMDJSON_AMALGAMATED
#include <cstring>
// This is for an internal-only stage 2 specific logger.
// Set LOG_ENABLED = true to log what stage 2 is doing!
namespace simdjson {
+2
View File
@@ -6,6 +6,8 @@
#include "simdjson/internal/tape_type.h"
#endif // SIMDJSON_AMALGAMATED
#include <cstring>
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace {
+4
View File
@@ -1,6 +1,10 @@
#ifndef SIMDJSON_SRC_HASWELL_CPP
#define SIMDJSON_SRC_HASWELL_CPP
#ifndef SIMDJSON_AMALGAMATED
#include "base.h"
#endif // SIMDJSON_AMALGAMATED
#include "simdjson/haswell.h"
#include "simdjson/haswell/implementation.h"
+9 -5
View File
@@ -1,6 +1,10 @@
#ifndef SIMDJSON_SRC_ICELAKE_CPP
#define SIMDJSON_SRC_ICELAKE_CPP
#ifndef SIMDJSON_AMALGAMATED
#include "base.h"
#endif // SIMDJSON_AMALGAMATED
#include "simdjson/icelake.h"
#include "simdjson/icelake/implementation.h"
@@ -19,7 +23,7 @@
//
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace icelake {
simdjson_warn_unused error_code implementation::create_dom_parser_implementation(
size_t capacity,
@@ -111,7 +115,7 @@ simdjson_inline simd8<bool> must_be_2_3_continuation(const simd8<uint8_t> prev2,
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace icelake
} // namespace simdjson
/**
@@ -122,7 +126,7 @@ simdjson_inline simd8<bool> must_be_2_3_continuation(const simd8<uint8_t> prev2,
// Under GCC 12, the intrinsic _mm512_extracti32x4_epi32 may generate 'maybe uninitialized'.
// as a workaround, we disable warnings within the following function.
SIMDJSON_PUSH_DISABLE_ALL_WARNINGS
namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { namespace { namespace stage1 {
namespace simdjson { namespace icelake { namespace { namespace stage1 {
simdjson_inline void bit_indexer::write(uint32_t idx, uint64_t bits) {
// In some instances, the next branch is expensive because it is mispredicted.
// Unfortunately, in other cases,
@@ -166,7 +170,7 @@ SIMDJSON_POP_DISABLE_WARNINGS
// Implementation-specific overrides
//
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace icelake {
namespace {
namespace stage1 {
@@ -214,7 +218,7 @@ simdjson_warn_unused error_code dom_parser_implementation::parse(const uint8_t *
return stage2(_doc);
}
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace icelake
} // namespace simdjson
#include "simdjson/icelake/end.h"
+2
View File
@@ -1,9 +1,11 @@
#ifndef SIMDJSON_SRC_IMPLEMENTATION_CPP
#define SIMDJSON_SRC_IMPLEMENTATION_CPP
#include "base.h"
#include "generic/dependencies.h"
#include "simdjson/implementation.h"
#include "simdjson/internal/isadetection.h"
#include <initializer_list>
namespace simdjson {
+8 -4
View File
@@ -1,6 +1,10 @@
#ifndef SIMDJSON_SRC_PPC64_CPP
#define SIMDJSON_SRC_PPC64_CPP
#ifndef SIMDJSON_AMALGAMATED
#include "base.h"
#endif // SIMDJSON_AMALGAMATED
#include "simdjson/ppc64.h"
#include "simdjson/ppc64/implementation.h"
@@ -13,7 +17,7 @@
// Stage 1
//
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace ppc64 {
simdjson_warn_unused error_code implementation::create_dom_parser_implementation(
size_t capacity,
@@ -82,7 +86,7 @@ simdjson_inline simd8<bool> must_be_2_3_continuation(const simd8<uint8_t> prev2,
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace ppc64
} // namespace simdjson
//
@@ -93,7 +97,7 @@ simdjson_inline simd8<bool> must_be_2_3_continuation(const simd8<uint8_t> prev2,
// Implementation-specific overrides
//
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace ppc64 {
namespace {
namespace stage1 {
@@ -143,7 +147,7 @@ simdjson_warn_unused error_code dom_parser_implementation::parse(const uint8_t *
return stage2(_doc);
}
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace ppc64
} // namespace simdjson
#include "simdjson/ppc64/end.h"
+1 -1
View File
@@ -1,6 +1,6 @@
#define SIMDJSON_SRC_SIMDJSON_CPP
#include "simdjson/common_defs.h"
#include "base.h"
SIMDJSON_PUSH_DISABLE_UNUSED_WARNINGS
+2
View File
@@ -1,6 +1,8 @@
#ifndef SIMDJSON_SRC_TO_CHARS_CPP
#define SIMDJSON_SRC_TO_CHARS_CPP
#include "base.h"
#include <cstring>
#include <cstdint>
#include <array>
+8 -4
View File
@@ -1,6 +1,10 @@
#ifndef SIMDJSON_SRC_WESTMERE_CPP
#define SIMDJSON_SRC_WESTMERE_CPP
#ifndef SIMDJSON_AMALGAMATED
#include "base.h"
#endif // SIMDJSON_AMALGAMATED
#include "simdjson/westmere.h"
#include "simdjson/westmere/implementation.h"
@@ -14,7 +18,7 @@
//
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace westmere {
simdjson_warn_unused error_code implementation::create_dom_parser_implementation(
size_t capacity,
@@ -113,7 +117,7 @@ simdjson_inline simd8<bool> must_be_2_3_continuation(const simd8<uint8_t> prev2,
}
} // unnamed namespace
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace westmere
} // namespace simdjson
//
@@ -125,7 +129,7 @@ simdjson_inline simd8<bool> must_be_2_3_continuation(const simd8<uint8_t> prev2,
//
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {
namespace westmere {
namespace {
namespace stage1 {
@@ -173,7 +177,7 @@ simdjson_warn_unused error_code dom_parser_implementation::parse(const uint8_t *
return stage2(_doc);
}
} // namespace SIMDJSON_IMPLEMENTATION
} // namespace westmere
} // namespace simdjson
#include "simdjson/westmere/end.h"