mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
Only use amalgamated.h in generic/
This commit is contained in:
+14
-12
@@ -36,20 +36,22 @@
|
||||
|
||||
#include "simdjson/common_defs.h"
|
||||
|
||||
SIMDJSON_PUSH_DISABLE_UNUSED_WARNINGS
|
||||
// This provides the public API for simdjson.
|
||||
// DOM and ondemand are amalgamated separately, in simdjson.h
|
||||
#include "simdjson/simdjson_version.h"
|
||||
|
||||
#include "simdjson/generic/dependencies.h"
|
||||
#include "simdjson/generic/ondemand/dependencies.h"
|
||||
#include "simdjson/base.h"
|
||||
|
||||
#define SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/error.h"
|
||||
#include "simdjson/error-inl.h"
|
||||
#include "simdjson/implementation.h"
|
||||
#include "simdjson/minify.h"
|
||||
#include "simdjson/padded_string.h"
|
||||
#include "simdjson/padded_string-inl.h"
|
||||
#include "simdjson/padded_string_view.h"
|
||||
#include "simdjson/padded_string_view-inl.h"
|
||||
|
||||
#include "simdjson/amalgamated.h"
|
||||
#include "simdjson/dom/amalgamated.h"
|
||||
#include "simdjson/builtin/amalgamated.h"
|
||||
#include "simdjson/builtin/ondemand/amalgamated.h"
|
||||
|
||||
#undef SIMDJSON_AMALGAMATED
|
||||
|
||||
SIMDJSON_POP_DISABLE_UNUSED_WARNINGS
|
||||
#include "simdjson/dom.h"
|
||||
#include "simdjson/ondemand.h"
|
||||
|
||||
#endif // SIMDJSON_H
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef SIMDJSON_AMALGAMATED_H
|
||||
#define SIMDJSON_AMALGAMATED_H
|
||||
|
||||
// This provides the public API for simdjson.
|
||||
// DOM and ondemand are amalgamated separately, in simdjson.h
|
||||
#include "simdjson/simdjson_version.h"
|
||||
|
||||
#include "simdjson/base.h"
|
||||
|
||||
#include "simdjson/error.h"
|
||||
#include "simdjson/error-inl.h"
|
||||
#include "simdjson/implementation.h"
|
||||
#include "simdjson/minify.h"
|
||||
#include "simdjson/padded_string.h"
|
||||
#include "simdjson/padded_string-inl.h"
|
||||
#include "simdjson/padded_string_view.h"
|
||||
#include "simdjson/padded_string_view-inl.h"
|
||||
|
||||
#include "simdjson/internal/simdprune_tables.h" // TODO this is only for simd supporting platforms
|
||||
|
||||
#endif // SIMDJSON_AMALGAMATED_H
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef SIMDJSON_ARM64_H
|
||||
#define SIMDJSON_ARM64_H
|
||||
|
||||
#include "simdjson/arm64/begin.h"
|
||||
#include "simdjson/generic/amalgamated.h"
|
||||
#include "simdjson/arm64/end.h"
|
||||
|
||||
#endif // SIMDJSON_ARM64_H
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef SIMDJSON_ARM64_AMALGAMATED_H
|
||||
#define SIMDJSON_ARM64_AMALGAMATED_H
|
||||
|
||||
#include "simdjson/arm64/begin.h"
|
||||
#include "simdjson/generic/amalgamated.h"
|
||||
#include "simdjson/arm64/end.h"
|
||||
|
||||
#endif // SIMDJSON_ARM64_AMALGAMATED_H
|
||||
@@ -1,7 +1,9 @@
|
||||
#ifndef SIMDJSON_ARM64_BASE_H
|
||||
#define SIMDJSON_ARM64_BASE_H
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/base.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
namespace simdjson {
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef SIMDJSON_ARM64_ONDEMAND_H
|
||||
#define SIMDJSON_ARM64_ONDEMAND_H
|
||||
|
||||
#include "simdjson/arm64/begin.h"
|
||||
#include "simdjson/generic/ondemand/amalgamated.h"
|
||||
#include "simdjson/arm64/end.h"
|
||||
|
||||
#endif // SIMDJSON_ARM64_ONDEMAND_H
|
||||
@@ -2,11 +2,6 @@
|
||||
* @file Base declarations for all simdjson headers
|
||||
* @private
|
||||
*/
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#if defined(SIMDJSON_IMPLEMENTATION) && (defined(SIMDJSON_SRC_SIMDJSON_CPP) || defined(SIMDJSON_H))
|
||||
#error implementation-specific code included in simdjson.cpp or simdjson.h without amalgamating first!
|
||||
#endif
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
#ifndef SIMDJSON_BASE_H
|
||||
#define SIMDJSON_BASE_H
|
||||
|
||||
|
||||
+22
-22
@@ -1,29 +1,29 @@
|
||||
#ifndef SIMDJSON_BUILTIN_H
|
||||
#define SIMDJSON_BUILTIN_H
|
||||
|
||||
#include "simdjson/implementation_detection.h"
|
||||
|
||||
#include "simdjson/builtin/base.h"
|
||||
#include "simdjson/builtin/implementation.h"
|
||||
|
||||
namespace simdjson {
|
||||
/**
|
||||
* Represents the best statically linked simdjson implementation that can be used by the compiling
|
||||
* program.
|
||||
*
|
||||
* Detects what options the program is compiled against, and picks the minimum implementation that
|
||||
* will work on any computer that can run the program. For example, if you compile with g++
|
||||
* -march=westmere, it will pick the westmere implementation. The haswell implementation will
|
||||
* still be available, and can be selected at runtime, but the builtin implementation (and any
|
||||
* code that uses it) will use westmere.
|
||||
*/
|
||||
namespace builtin = SIMDJSON_BUILTIN_IMPLEMENTATION;
|
||||
/**
|
||||
* Function which returns a pointer to an implementation matching the "builtin" implementation.
|
||||
* The builtin implementation is the best statically linked simdjson implementation that can be used by the compiling
|
||||
* program. If you compile with g++ -march=haswell, this will return the haswell implementation.
|
||||
* It is handy to be able to check what builtin was used: builtin_implementation()->name().
|
||||
*/
|
||||
const implementation * builtin_implementation();
|
||||
} // namespace simdjson
|
||||
#include "simdjson/generic/dependencies.h"
|
||||
|
||||
#define SIMDJSON_AMALGAMATED
|
||||
|
||||
#if SIMDJSON_BUILTIN_IMPLEMENTATION_IS(arm64)
|
||||
#include "simdjson/arm64.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(fallback)
|
||||
#include "simdjson/fallback.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(haswell)
|
||||
#include "simdjson/haswell.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(icelake)
|
||||
#include "simdjson/icelake.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(ppc64)
|
||||
#include "simdjson/ppc64.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(westmere)
|
||||
#include "simdjson/westmere.h"
|
||||
#else
|
||||
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
|
||||
#endif
|
||||
|
||||
#undef SIMDJSON_AMALGAMATED
|
||||
|
||||
#endif // SIMDJSON_BUILTIN_H
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#ifndef SIMDJSON_BUILTIN_AMALGAMATED_H
|
||||
#define SIMDJSON_BUILTIN_AMALGAMATED_H
|
||||
|
||||
#include "simdjson/builtin.h"
|
||||
|
||||
#if SIMDJSON_BUILTIN_IMPLEMENTATION_IS(arm64)
|
||||
#include "simdjson/arm64/amalgamated.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(fallback)
|
||||
#include "simdjson/fallback/amalgamated.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(haswell)
|
||||
#include "simdjson/haswell/amalgamated.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(icelake)
|
||||
#include "simdjson/icelake/amalgamated.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(ppc64)
|
||||
#include "simdjson/ppc64/amalgamated.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(westmere)
|
||||
#include "simdjson/westmere/amalgamated.h"
|
||||
#else
|
||||
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
|
||||
#endif
|
||||
|
||||
#endif // SIMDJSON_BUILTIN_AMALGAMATED_H
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef SIMDJSON_BUILTIN_BASE_H
|
||||
#define SIMDJSON_BUILTIN_BASE_H
|
||||
|
||||
#include "simdjson/base.h"
|
||||
#include "simdjson/implementation_detection.h"
|
||||
|
||||
namespace simdjson {
|
||||
#if SIMDJSON_BUILTIN_IMPLEMENTATION_IS(arm64)
|
||||
namespace arm64 {}
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(fallback)
|
||||
namespace fallback {}
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(haswell)
|
||||
namespace haswell {}
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(icelake)
|
||||
namespace icelake {}
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(ppc64)
|
||||
namespace ppc64 {}
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(westmere)
|
||||
namespace westmere {}
|
||||
#else
|
||||
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Represents the best statically linked simdjson implementation that can be used by the compiling
|
||||
* program.
|
||||
*
|
||||
* Detects what options the program is compiled against, and picks the minimum implementation that
|
||||
* will work on any computer that can run the program. For example, if you compile with g++
|
||||
* -march=westmere, it will pick the westmere implementation. The haswell implementation will
|
||||
* still be available, and can be selected at runtime, but the builtin implementation (and any
|
||||
* code that uses it) will use westmere.
|
||||
*/
|
||||
namespace builtin = SIMDJSON_BUILTIN_IMPLEMENTATION;
|
||||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_BUILTIN_BASE_H
|
||||
@@ -1,17 +0,0 @@
|
||||
#include "simdjson/builtin.h"
|
||||
|
||||
#if SIMDJSON_BUILTIN_IMPLEMENTATION_IS(arm64)
|
||||
#include "simdjson/arm64/begin.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(fallback)
|
||||
#include "simdjson/fallback/begin.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(haswell)
|
||||
#include "simdjson/haswell/begin.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(icelake)
|
||||
#include "simdjson/icelake/begin.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(ppc64)
|
||||
#include "simdjson/ppc64/begin.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(westmere)
|
||||
#include "simdjson/westmere/begin.h"
|
||||
#else
|
||||
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
|
||||
#endif
|
||||
@@ -1,17 +0,0 @@
|
||||
#include "simdjson/builtin.h"
|
||||
|
||||
#if SIMDJSON_BUILTIN_IMPLEMENTATION_IS(arm64)
|
||||
#include "simdjson/arm64/end.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(fallback)
|
||||
#include "simdjson/fallback/end.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(haswell)
|
||||
#include "simdjson/haswell/end.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(icelake)
|
||||
#include "simdjson/icelake/end.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(ppc64)
|
||||
#include "simdjson/ppc64/end.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(westmere)
|
||||
#include "simdjson/westmere/end.h"
|
||||
#else
|
||||
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SIMDJSON_BUILTIN_IMPLEMENTATION_H
|
||||
#define SIMDJSON_BUILTIN_IMPLEMENTATION_H
|
||||
|
||||
#include "simdjson/implementation_detection.h"
|
||||
#include "simdjson/builtin/base.h"
|
||||
|
||||
#if SIMDJSON_BUILTIN_IMPLEMENTATION_IS(arm64)
|
||||
#include "simdjson/arm64/implementation.h"
|
||||
@@ -19,4 +19,14 @@
|
||||
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
|
||||
#endif
|
||||
|
||||
namespace simdjson {
|
||||
/**
|
||||
* Function which returns a pointer to an implementation matching the "builtin" implementation.
|
||||
* The builtin implementation is the best statically linked simdjson implementation that can be used by the compiling
|
||||
* program. If you compile with g++ -march=haswell, this will return the haswell implementation.
|
||||
* It is handy to be able to check what builtin was used: builtin_implementation()->name().
|
||||
*/
|
||||
const implementation * builtin_implementation();
|
||||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_BUILTIN_IMPLEMENTATION_H
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef SIMDJSON_BUILTIN_ONDEMAND_H
|
||||
#define SIMDJSON_BUILTIN_ONDEMAND_H
|
||||
|
||||
#include "simdjson/builtin.h"
|
||||
#include "simdjson/builtin/base.h"
|
||||
|
||||
#include "simdjson/generic/ondemand/dependencies.h"
|
||||
|
||||
#define SIMDJSON_AMALGAMATED
|
||||
|
||||
#if SIMDJSON_BUILTIN_IMPLEMENTATION_IS(arm64)
|
||||
#include "simdjson/arm64/ondemand.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(fallback)
|
||||
#include "simdjson/fallback/ondemand.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(haswell)
|
||||
#include "simdjson/haswell/ondemand.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(icelake)
|
||||
#include "simdjson/icelake/ondemand.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(ppc64)
|
||||
#include "simdjson/ppc64/ondemand.h"
|
||||
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(westmere)
|
||||
#include "simdjson/westmere/ondemand.h"
|
||||
#else
|
||||
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
|
||||
#endif
|
||||
|
||||
#undef SIMDJSON_AMALGAMATED
|
||||
|
||||
namespace simdjson {
|
||||
/**
|
||||
* @copydoc simdjson::SIMDJSON_BUILTIN_IMPLEMENTATION::ondemand
|
||||
*/
|
||||
namespace ondemand = SIMDJSON_BUILTIN_IMPLEMENTATION::ondemand;
|
||||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_BUILTIN_ONDEMAND_H
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifndef SIMDJSON_BUILTIN_ONDEMAND_AMALGAMATED_H
|
||||
#define SIMDJSON_BUILTIN_ONDEMAND_AMALGAMATED_H
|
||||
|
||||
#include "simdjson/builtin/begin.h"
|
||||
#include "simdjson/generic/ondemand/amalgamated.h"
|
||||
#include "simdjson/builtin/end.h"
|
||||
|
||||
namespace simdjson {
|
||||
/**
|
||||
* @copydoc simdjson::SIMDJSON_BUILTIN_IMPLEMENTATION::ondemand
|
||||
*/
|
||||
namespace ondemand = SIMDJSON_BUILTIN_IMPLEMENTATION::ondemand;
|
||||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_ONDEMAND_AMALGAMATED_H
|
||||
+22
-7
@@ -1,14 +1,29 @@
|
||||
#ifndef SIMDJSON_DOM_H
|
||||
#define SIMDJSON_DOM_H
|
||||
|
||||
#include "simdjson/generic/dependencies.h"
|
||||
#include "simdjson/generic/ondemand/dependencies.h"
|
||||
#include "simdjson/dom/base.h"
|
||||
#include "simdjson/dom/array.h"
|
||||
#include "simdjson/dom/document_stream.h"
|
||||
#include "simdjson/dom/document.h"
|
||||
#include "simdjson/dom/element.h"
|
||||
#include "simdjson/dom/object.h"
|
||||
#include "simdjson/dom/parser.h"
|
||||
#include "simdjson/dom/serialization.h"
|
||||
|
||||
#define SIMDJSON_AMALGAMATED
|
||||
// Deprecated API
|
||||
#include "simdjson/dom/jsonparser.h"
|
||||
#include "simdjson/dom/parsedjson.h"
|
||||
#include "simdjson/dom/parsedjson_iterator.h"
|
||||
|
||||
#include "simdjson/amalgamated.h"
|
||||
#include "simdjson/dom/amalgamated.h"
|
||||
|
||||
#undef SIMDJSON_AMALGAMATED
|
||||
// Inline functions
|
||||
#include "simdjson/dom/array-inl.h"
|
||||
#include "simdjson/dom/document_stream-inl.h"
|
||||
#include "simdjson/dom/document-inl.h"
|
||||
#include "simdjson/dom/element-inl.h"
|
||||
#include "simdjson/dom/object-inl.h"
|
||||
#include "simdjson/dom/parsedjson_iterator-inl.h"
|
||||
#include "simdjson/dom/parser-inl.h"
|
||||
#include "simdjson/internal/tape_ref-inl.h"
|
||||
#include "simdjson/dom/serialization-inl.h"
|
||||
|
||||
#endif // SIMDJSON_DOM_H
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#ifndef SIMDJSON_DOM_AMALGAMATED_H
|
||||
#define SIMDJSON_DOM_AMALGAMATED_H
|
||||
|
||||
#include "simdjson/dom/base.h"
|
||||
#include "simdjson/dom/array.h"
|
||||
#include "simdjson/dom/document_stream.h"
|
||||
#include "simdjson/dom/document.h"
|
||||
#include "simdjson/dom/element.h"
|
||||
#include "simdjson/dom/object.h"
|
||||
#include "simdjson/dom/parser.h"
|
||||
#include "simdjson/dom/serialization.h"
|
||||
|
||||
// Deprecated API
|
||||
#include "simdjson/dom/jsonparser.h"
|
||||
#include "simdjson/dom/parsedjson.h"
|
||||
#include "simdjson/dom/parsedjson_iterator.h"
|
||||
|
||||
// Inline functions
|
||||
#include "simdjson/dom/array-inl.h"
|
||||
#include "simdjson/dom/document_stream-inl.h"
|
||||
#include "simdjson/dom/document-inl.h"
|
||||
#include "simdjson/dom/element-inl.h"
|
||||
#include "simdjson/dom/object-inl.h"
|
||||
#include "simdjson/dom/parsedjson_iterator-inl.h"
|
||||
#include "simdjson/dom/parser-inl.h"
|
||||
#include "simdjson/internal/tape_ref-inl.h"
|
||||
#include "simdjson/dom/serialization-inl.h"
|
||||
|
||||
#endif // SIMDJSON_DOM_AMALGAMATED_H
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef SIMDJSON_INLINE_ARRAY_H
|
||||
#define SIMDJSON_INLINE_ARRAY_H
|
||||
|
||||
// Inline implementations go in here.
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "simdjson/dom/array.h"
|
||||
@@ -10,6 +8,8 @@
|
||||
#include "simdjson/error-inl.h"
|
||||
#include "simdjson/internal/tape_ref-inl.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace simdjson {
|
||||
|
||||
//
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
#include "simdjson/dom/document.h"
|
||||
#include "simdjson/dom/object.h"
|
||||
#include "simdjson/internal/tape_type.h"
|
||||
#include <ostream>
|
||||
|
||||
#include <ostream>
|
||||
#include <limits>
|
||||
namespace simdjson {
|
||||
|
||||
//
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef SIMDJSON_FALLBACK_H
|
||||
#define SIMDJSON_FALLBACK_H
|
||||
|
||||
#include "simdjson/fallback/begin.h"
|
||||
#include "simdjson/generic/amalgamated.h"
|
||||
#include "simdjson/fallback/end.h"
|
||||
|
||||
#endif // SIMDJSON_FALLBACK_H
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef SIMDJSON_FALLBACK_AMALGAMATED_H
|
||||
#define SIMDJSON_FALLBACK_AMALGAMATED_H
|
||||
|
||||
#include "simdjson/fallback/begin.h"
|
||||
#include "simdjson/generic/amalgamated.h"
|
||||
#include "simdjson/fallback/end.h"
|
||||
|
||||
#endif // SIMDJSON_FALLBACK_AMALGAMATED_H
|
||||
@@ -1,7 +1,9 @@
|
||||
#ifndef SIMDJSON_FALLBACK_BASE_H
|
||||
#define SIMDJSON_FALLBACK_BASE_H
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/base.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
namespace simdjson {
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SIMDJSON_FALLBACK_BITMANIPULATION_H
|
||||
#define SIMDJSON_FALLBACK_BITMANIPULATION_H
|
||||
|
||||
#include "simdjson/base.h"
|
||||
#include "simdjson/fallback/base.h"
|
||||
|
||||
namespace simdjson {
|
||||
namespace SIMDJSON_IMPLEMENTATION {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SIMDJSON_FALLBACK_NUMBERPARSING_DEFS_H
|
||||
#define SIMDJSON_FALLBACK_NUMBERPARSING_DEFS_H
|
||||
|
||||
#include "simdjson/base.h"
|
||||
#include "simdjson/fallback/base.h"
|
||||
|
||||
#ifdef JSON_TEST_NUMBERS // for unit testing
|
||||
void found_invalid_number(const uint8_t *buf);
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef SIMDJSON_FALLBACK_ONDEMAND_H
|
||||
#define SIMDJSON_FALLBACK_ONDEMAND_H
|
||||
|
||||
#include "simdjson/fallback/begin.h"
|
||||
#include "simdjson/generic/ondemand/amalgamated.h"
|
||||
#include "simdjson/fallback/end.h"
|
||||
|
||||
#endif // SIMDJSON_FALLBACK_ONDEMAND_H
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SIMDJSON_FALLBACK_STRINGPARSING_H
|
||||
#define SIMDJSON_FALLBACK_STRINGPARSING_H
|
||||
|
||||
#include "simdjson/base.h"
|
||||
#include "simdjson/fallback/base.h"
|
||||
|
||||
namespace simdjson {
|
||||
namespace SIMDJSON_IMPLEMENTATION {
|
||||
|
||||
@@ -3,10 +3,26 @@
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#define SIMDJSON_GENERIC_BASE_H
|
||||
#include "simdjson/base.h"
|
||||
// If we haven't got an implementation yet, just use the builtin one (for the editor)
|
||||
// If we haven't got an implementation yet, we're in the editor, editing a generic file! Just
|
||||
// use the most advanced one we can so the most possible stuff can be tested.
|
||||
#ifndef SIMDJSON_IMPLEMENTATION
|
||||
#include "simdjson/builtin/begin.h"
|
||||
#include "simdjson/implementation_detection.h"
|
||||
#if SIMDJSON_IMPLEMENTATION_ICELAKE
|
||||
#include "simdjson/icelake/begin.h"
|
||||
#elif SIMDJSON_IMPLEMENTATION_HASWELL
|
||||
#include "simdjson/haswell/begin.h"
|
||||
#elif SIMDJSON_IMPLEMENTATION_WESTMERE
|
||||
#include "simdjson/westmere/begin.h"
|
||||
#elif SIMDJSON_IMPLEMENTATION_ARM64
|
||||
#include "simdjson/arm64/begin.h"
|
||||
#elif SIMDJSON_IMPLEMENTATION_PPC64
|
||||
#include "simdjson/ppc64/begin.h"
|
||||
#elif SIMDJSON_IMPLEMENTATION_FALLBACK
|
||||
#include "simdjson/fallback/begin.h"
|
||||
#else
|
||||
#error "All possible implementations (including fallback) have been disabled! simdjson will not run."
|
||||
#endif
|
||||
#endif // SIMDJSON_IMPLEMENTATION
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
namespace simdjson {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_DEPENDENCIES_H)
|
||||
#if defined(SIMDJSON_AMALGAMATED) && !defined(SIMDJSON_GENERIC_ONDEMAND_DEPENDENCIES_H)
|
||||
#error simdjson/generic/ondemand/dependencies.h must be included before simdjson/generic/ondemand/amalgamated.h!
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef SIMDJSON_HASWELL_H
|
||||
#define SIMDJSON_HASWELL_H
|
||||
|
||||
#include "simdjson/haswell/begin.h"
|
||||
#include "simdjson/generic/amalgamated.h"
|
||||
#include "simdjson/haswell/end.h"
|
||||
|
||||
#endif // SIMDJSON_HASWELL_H
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef SIMDJSON_HASWELL_AMALGAMATED_H
|
||||
#define SIMDJSON_HASWELL_AMALGAMATED_H
|
||||
|
||||
#include "simdjson/haswell/begin.h"
|
||||
#include "simdjson/generic/amalgamated.h"
|
||||
#include "simdjson/haswell/end.h"
|
||||
|
||||
#endif // SIMDJSON_HASWELL_AMALGAMATED_H
|
||||
@@ -1,7 +1,9 @@
|
||||
#ifndef SIMDJSON_HASWELL_BASE_H
|
||||
#define SIMDJSON_HASWELL_BASE_H
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/base.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
// The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_HASWELL
|
||||
namespace simdjson {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#ifndef SIMDJSON_HASWELL_BITMANIPULATION_H
|
||||
#define SIMDJSON_HASWELL_BITMANIPULATION_H
|
||||
|
||||
#include "simdjson/base.h"
|
||||
#include "simdjson/haswell/base.h"
|
||||
#include "simdjson/haswell/intrinsics.h"
|
||||
#include "simdjson/haswell/bitmask.h"
|
||||
#include "simdjson/haswell/bitmanipulation.h"
|
||||
|
||||
namespace simdjson {
|
||||
namespace SIMDJSON_IMPLEMENTATION {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SIMDJSON_HASWELL_BITMASK_H
|
||||
#define SIMDJSON_HASWELL_BITMASK_H
|
||||
|
||||
#include "simdjson/base.h"
|
||||
#include "simdjson/haswell/base.h"
|
||||
#include "simdjson/haswell/intrinsics.h"
|
||||
|
||||
namespace simdjson {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "simdjson/portability.h"
|
||||
#include "simdjson/haswell/base.h"
|
||||
|
||||
#if !SIMDJSON_CAN_ALWAYS_RUN_HASWELL
|
||||
SIMDJSON_UNTARGET_REGION
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SIMDJSON_HASWELL_INTRINSICS_H
|
||||
#define SIMDJSON_HASWELL_INTRINSICS_H
|
||||
|
||||
#include "simdjson/base.h"
|
||||
#include "simdjson/haswell/base.h"
|
||||
|
||||
#if SIMDJSON_VISUAL_STUDIO
|
||||
// under clang within visual studio, this will include <x86intrin.h>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SIMDJSON_HASWELL_NUMBERPARSING_H
|
||||
#define SIMDJSON_HASWELL_NUMBERPARSING_H
|
||||
|
||||
#include "simdjson/base.h"
|
||||
#include "simdjson/haswell/base.h"
|
||||
#include "simdjson/haswell/intrinsics.h"
|
||||
|
||||
namespace simdjson {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef SIMDJSON_HASWELL_ONDEMAND_H
|
||||
#define SIMDJSON_HASWELL_ONDEMAND_H
|
||||
|
||||
#include "simdjson/haswell/begin.h"
|
||||
#include "simdjson/generic/ondemand/amalgamated.h"
|
||||
#include "simdjson/haswell/end.h"
|
||||
|
||||
#endif // SIMDJSON_HASWELL_ONDEMAND_H
|
||||
@@ -1,9 +1,13 @@
|
||||
#ifndef SIMDJSON_HASWELL_SIMD_H
|
||||
#define SIMDJSON_HASWELL_SIMD_H
|
||||
|
||||
#include "simdjson/haswell/base.h"
|
||||
#include "simdjson/haswell/intrinsics.h"
|
||||
#include "simdjson/haswell/bitmanipulation.h"
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/internal/simdprune_tables.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
namespace simdjson {
|
||||
namespace SIMDJSON_IMPLEMENTATION {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef SIMDJSON_ICELAKE_H
|
||||
#define SIMDJSON_ICELAKE_H
|
||||
|
||||
#include "simdjson/icelake/begin.h"
|
||||
#include "simdjson/generic/amalgamated.h"
|
||||
#include "simdjson/icelake/end.h"
|
||||
|
||||
#endif // SIMDJSON_ICELAKE_H
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef SIMDJSON_ICELAKE_AMALGAMATED_H
|
||||
#define SIMDJSON_ICELAKE_AMALGAMATED_H
|
||||
|
||||
#include "simdjson/icelake/begin.h"
|
||||
#include "simdjson/generic/amalgamated.h"
|
||||
#include "simdjson/icelake/end.h"
|
||||
|
||||
#endif // SIMDJSON_ICELAKE_AMALGAMATED_H
|
||||
@@ -1,7 +1,9 @@
|
||||
#ifndef SIMDJSON_ICELAKE_BASE_H
|
||||
#define SIMDJSON_ICELAKE_BASE_H
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/base.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
// The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_ICELAKE
|
||||
namespace simdjson {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "simdjson/implementation.h"
|
||||
#include "simdjson/internal/instruction_set.h"
|
||||
#include "simdjson/icelake/base.h"
|
||||
|
||||
// The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_ICELAKE
|
||||
namespace simdjson {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef SIMDJSON_ICELAKE_ONDEMAND_H
|
||||
#define SIMDJSON_ICELAKE_ONDEMAND_H
|
||||
|
||||
#include "simdjson/icelake/begin.h"
|
||||
#include "simdjson/generic/ondemand/amalgamated.h"
|
||||
#include "simdjson/icelake/end.h"
|
||||
|
||||
#endif // SIMDJSON_ICELAKE_ONDEMAND_H
|
||||
@@ -2,9 +2,10 @@
|
||||
#define SIMDJSON_ICELAKE_SIMD_H
|
||||
|
||||
#include "simdjson/icelake/bitmanipulation.h"
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/internal/simdprune_tables.h"
|
||||
|
||||
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#if __GNUC__ == 8
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
#ifndef SIMDJSON_ONDEMAND_H
|
||||
#define SIMDJSON_ONDEMAND_H
|
||||
|
||||
#include "simdjson/generic/dependencies.h"
|
||||
#include "simdjson/generic/ondemand/dependencies.h"
|
||||
#include "simdjson/builtin/ondemand.h"
|
||||
|
||||
#define SIMDJSON_AMALGAMATED
|
||||
|
||||
#include "simdjson/amalgamated.h"
|
||||
#include "simdjson/builtin/amalgamated.h"
|
||||
#include "simdjson/builtin/ondemand/amalgamated.h"
|
||||
|
||||
#undef SIMDJSON_AMALGAMATED
|
||||
namespace simdjson {
|
||||
/**
|
||||
* @copydoc simdjson::builtin::ondemand
|
||||
*/
|
||||
namespace ondemand = builtin::ondemand;
|
||||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_ONDEMAND_H
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef SIMDJSON_PPC64_H
|
||||
#define SIMDJSON_PPC64_H
|
||||
|
||||
#include "simdjson/ppc64/begin.h"
|
||||
#include "simdjson/generic/amalgamated.h"
|
||||
#include "simdjson/ppc64/end.h"
|
||||
|
||||
#endif // SIMDJSON_PPC64_H
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef SIMDJSON_PPC64_AMALGAMATED_H
|
||||
#define SIMDJSON_PPC64_AMALGAMATED_H
|
||||
|
||||
#include "simdjson/ppc64/begin.h"
|
||||
#include "simdjson/generic/amalgamated.h"
|
||||
#include "simdjson/ppc64/end.h"
|
||||
|
||||
#endif // SIMDJSON_PPC64_AMALGAMATED_H
|
||||
@@ -1,7 +1,9 @@
|
||||
#ifndef SIMDJSON_PPC64_BASE_H
|
||||
#define SIMDJSON_PPC64_BASE_H
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/base.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
namespace simdjson {
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef SIMDJSON_PPC64_ONDEMAND_H
|
||||
#define SIMDJSON_PPC64_ONDEMAND_H
|
||||
|
||||
#include "simdjson/ppc64/begin.h"
|
||||
#include "simdjson/generic/ondemand/amalgamated.h"
|
||||
#include "simdjson/ppc64/end.h"
|
||||
|
||||
#endif // SIMDJSON_PPC64_ONDEMAND_H
|
||||
@@ -1,8 +1,12 @@
|
||||
#ifndef SIMDJSON_PPC64_SIMD_H
|
||||
#define SIMDJSON_PPC64_SIMD_H
|
||||
|
||||
#include "simdjson/internal/simdprune_tables.h"
|
||||
#include "simdjson/ppc64/bitmanipulation.h"
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/internal/simdprune_tables.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace simdjson {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef SIMDJSON_WESTMERE_H
|
||||
#define SIMDJSON_WESTMERE_H
|
||||
|
||||
#include "simdjson/westmere/begin.h"
|
||||
#include "simdjson/generic/amalgamated.h"
|
||||
#include "simdjson/westmere/end.h"
|
||||
|
||||
#endif // SIMDJSON_WESTMERE_H
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef SIMDJSON_WESTMERE_AMALGAMATED_H
|
||||
#define SIMDJSON_WESTMERE_AMALGAMATED_H
|
||||
|
||||
#include "simdjson/westmere/begin.h"
|
||||
#include "simdjson/generic/amalgamated.h"
|
||||
#include "simdjson/westmere/end.h"
|
||||
|
||||
#endif // SIMDJSON_WESTMERE_AMALGAMATED_H
|
||||
@@ -1,7 +1,9 @@
|
||||
#ifndef SIMDJSON_WESTMERE_BASE_H
|
||||
#define SIMDJSON_WESTMERE_BASE_H
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/base.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
// The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_WESTMERE
|
||||
namespace simdjson {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "simdjson/portability.h"
|
||||
#include "simdjson/westmere/base.h"
|
||||
|
||||
#if !SIMDJSON_CAN_ALWAYS_RUN_WESTMERE
|
||||
SIMDJSON_UNTARGET_REGION
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef SIMDJSON_WESTMERE_ONDEMAND_H
|
||||
#define SIMDJSON_WESTMERE_ONDEMAND_H
|
||||
|
||||
#include "simdjson/westmere/begin.h"
|
||||
#include "simdjson/generic/ondemand/amalgamated.h"
|
||||
#include "simdjson/westmere/end.h"
|
||||
|
||||
#endif // SIMDJSON_WESTMERE_IMPLEMENTATION_H
|
||||
@@ -1,9 +1,12 @@
|
||||
#ifndef SIMDJSON_WESTMERE_SIMD_H
|
||||
#define SIMDJSON_WESTMERE_SIMD_H
|
||||
|
||||
#include "simdjson/internal/simdprune_tables.h"
|
||||
#include "simdjson/westmere/bitmanipulation.h"
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/internal/simdprune_tables.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
namespace simdjson {
|
||||
namespace SIMDJSON_IMPLEMENTATION {
|
||||
namespace {
|
||||
|
||||
+87
-73
@@ -46,7 +46,7 @@ class Amalgamator:
|
||||
print(f"Creating {output_path}")
|
||||
fid = open(output_path, 'w')
|
||||
print(f"/* auto-generated on {timestamp}. Do not edit! */", file=fid)
|
||||
cls(fid, roots).maybe_write_file(file, "")
|
||||
cls(fid, roots).maybe_write_file(file, "", "")
|
||||
fid.close()
|
||||
|
||||
def __init__(self, fid: TextIO, roots: List[str]):
|
||||
@@ -56,6 +56,9 @@ class Amalgamator:
|
||||
self.implementation: Optional[str] = None
|
||||
self.found_includes: List[str] = []
|
||||
self.found_generic_includes: List[tuple[str, str]] = []
|
||||
self.amalgamated_defined = False
|
||||
self.ignoring: Optional[str] = None
|
||||
self.include_stack: List[str] = []
|
||||
|
||||
def is_generic(self, filename: str):
|
||||
return (
|
||||
@@ -64,45 +67,40 @@ class Amalgamator:
|
||||
) and not filename.endswith('/dependencies.h')
|
||||
|
||||
|
||||
def should_write_file(self, filename: str):
|
||||
# These files get written out every time they are included
|
||||
if filename.endswith('/begin.h') or filename.endswith('/end.h'):
|
||||
return True
|
||||
|
||||
# These files get written out once per implementation
|
||||
elif self.is_generic(filename):
|
||||
assert self.implementation is not None
|
||||
if (filename, self.implementation) not in self.found_generic_includes:
|
||||
self.found_generic_includes.append((filename, self.implementation))
|
||||
return True
|
||||
|
||||
# Other files get written out once, period
|
||||
elif filename not in self.found_includes:
|
||||
self.found_includes.append(filename)
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def find_file_root(self, file: str):
|
||||
for root in self.roots:
|
||||
if os.path.exists(os.path.join(root, file)):
|
||||
return root
|
||||
return None
|
||||
|
||||
def maybe_write_file(self, filename: str, else_line: str):
|
||||
def maybe_write_file(self, filename: str, including_filename: str, else_line: str):
|
||||
root = self.find_file_root(filename)
|
||||
if root:
|
||||
# If we're including one of our own files, emit the contents
|
||||
if self.should_write_file(filename):
|
||||
self.write_file(filename, root)
|
||||
else:
|
||||
suffix = ""
|
||||
if self.is_generic(filename):
|
||||
suffix = f" for {self.implementation}"
|
||||
self.write(f"/* skipped duplicate {else_line}{suffix} */")
|
||||
else:
|
||||
if not root:
|
||||
# If it's an external / system include, just emit the #include
|
||||
self.write(else_line)
|
||||
return
|
||||
|
||||
# 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+|)?(/|$)', filename) and not filename.endswith('/implementation.h'):
|
||||
assert self.amalgamated_defined, f"{filename} included from {including_filename} without defining SIMDJSON_AMALGAMATED!"
|
||||
elif self.is_generic(filename):
|
||||
# Generic files may only be included from their actual implementations.
|
||||
assert re.search(r'(/|^)(arm64|fallback|generic|haswell|icelake|ppc64|westmere)(\.\w+|)?(/|$)', filename)
|
||||
# Generic files can only ever be written out once for simdjson.h and once for simdjson.cpp
|
||||
assert self.amalgamated_defined, f"{filename} included from {including_filename} without defining SIMDJSON_AMALGAMATED!"
|
||||
assert self.implementation is not None, f"generic file {filename} included from {including_filename} without defining SIMDJSON_IMPLEMENTATION!"
|
||||
assert (filename, self.implementation) not in self.found_generic_includes, f"generic file {filename} included from {including_filename} a second time for {self.implementation}!"
|
||||
self.found_generic_includes.append((filename, self.implementation))
|
||||
else:
|
||||
# Other files are only output once, and may not be included during SIMDJSON_AMALGAMATED
|
||||
assert not self.amalgamated_defined, f"{filename} included from {including_filename} while SIMDJSON_AMALGAMATED is defined!"
|
||||
if filename in self.found_includes:
|
||||
self.write(f"/* skipped duplicate {else_line} */")
|
||||
return
|
||||
self.found_includes.append(filename)
|
||||
|
||||
self.write(f"/* including {filename}: {else_line} */")
|
||||
self.write_file(filename, root)
|
||||
|
||||
def write(self, line: str):
|
||||
print(line, file=self.fid)
|
||||
@@ -112,7 +110,9 @@ class Amalgamator:
|
||||
root = self.find_file_root(filename)
|
||||
assert root
|
||||
|
||||
# self.write(f"// dofile: invoked with root={root}, filename={filename}")
|
||||
assert filename not in self.include_stack, f"Recursive include: {self.include_stack} -> {filename}"
|
||||
self.include_stack.append(filename)
|
||||
|
||||
file = os.path.join(root, filename)
|
||||
assert os.path.exists(file)
|
||||
RELFILE = os.path.relpath(file, PROJECTPATH)
|
||||
@@ -124,62 +124,75 @@ class Amalgamator:
|
||||
else:
|
||||
suffix = ""
|
||||
self.write(f"/* begin file {OSRELFILE}{suffix} */")
|
||||
includepattern = re.compile(r'^#include "(.*)"')
|
||||
redefines_simdjson_implementation = re.compile(r'^#define\s+SIMDJSON_IMPLEMENTATION\s+(.*)')
|
||||
undefines_simdjson_implementation = re.compile(r'^#undef\s+SIMDJSON_IMPLEMENTATION\s*$')
|
||||
uses_simdjson_implementation = re.compile(r'\bSIMDJSON_IMPLEMENTATION\b')
|
||||
uses_simdjson_amalgamated = re.compile(r'\bSIMDJSON_AMALGAMATED\b')
|
||||
|
||||
if filename.endswith('/builtin/begin.h'):
|
||||
assert self.implementation is None
|
||||
assert not self.builtin_implementation
|
||||
self.builtin_implementation = True
|
||||
self.implementation = "SIMDJSON_BUILTIN_IMPLEMENTATION"
|
||||
|
||||
assert self.ignoring is None
|
||||
with open(file, 'r') as fid2:
|
||||
ignoring = False
|
||||
for line in fid2:
|
||||
line = line.rstrip('\n')
|
||||
if uses_simdjson_amalgamated.search(line):
|
||||
if line == "#ifndef SIMDJSON_AMALGAMATED":
|
||||
assert not ignoring, "{file} includes two #ifndef SIMDJSON_AMALGAMATED in a row"
|
||||
ignoring = True
|
||||
elif line == "#endif // SIMDJSON_AMALGAMATED":
|
||||
assert ignoring, "{file} has #endif // SIMDJSON_AMALGAMATED without #ifndef SIMDJSON_AMALGAMATED"
|
||||
self.write(f"/* amalgamation skipped (editor-only): {line} */")
|
||||
ignoring = False
|
||||
continue
|
||||
|
||||
if ignoring:
|
||||
self.write(f"/* amalgamation skipped (editor-only): {line} */")
|
||||
# Ignore lines inside #ifndef SIMDJSON_AMALGAMATED
|
||||
if re.search(r'^#ifndef\s+SIMDJSON_AMALGAMATED\s*$', line):
|
||||
assert self.amalgamated_defined, f"{filename} uses #ifndef SIMDJSON_AMALGAMATED without a prior #define SIMDJSON_AMALGAMATED: {self.include_stack}"
|
||||
assert not self.ignoring, f"{filename} uses #ifndef SIMDJSON_AMALGAMATED twice in a row"
|
||||
self.ignoring = "editor-only"
|
||||
|
||||
# Handle ignored lines (and ending ignore blocks)
|
||||
end_ignore = re.search(r'^#endif\s*//\s*SIMDJSON_AMALGAMATED\s*$', line)
|
||||
if self.ignoring:
|
||||
self.write(f"/* amalgamation skipped ({self.ignoring}): {line} */")
|
||||
if end_ignore:
|
||||
self.ignoring = None
|
||||
continue
|
||||
assert not end_ignore, f"{filename} has #endif // SIMDJSON_AMALGAMATED without #ifndef SIMDJSON_AMALGAMATED"
|
||||
|
||||
included = includepattern.search(line)
|
||||
# Handle #include lines
|
||||
included = re.search(r'^#include "(.*)"', line)
|
||||
if included:
|
||||
includedfile = included.group(1)
|
||||
if includedfile.startswith('../'):
|
||||
includedfile = includedfile[2:]
|
||||
# we explicitly include simdjson headers, one time each (unless they are generic, in which case multiple times is fine)
|
||||
self.maybe_write_file(includedfile, line)
|
||||
elif uses_simdjson_implementation.search(line):
|
||||
# does it contain a redefinition of SIMDJSON_IMPLEMENTATION ?
|
||||
redefined = redefines_simdjson_implementation.search(line)
|
||||
if redefined:
|
||||
old_implementation = self.implementation
|
||||
self.implementation = redefined.group(1)
|
||||
if old_implementation is None:
|
||||
self.write(f"/* defining SIMDJSON_IMPLEMENTATION to \"{self.implementation}\": {line} */")
|
||||
else:
|
||||
self.write(f"/* redefining SIMDJSON_IMPLEMENTATION from \"{old_implementation}\" to \"{self.implementation}\": {line} */")
|
||||
elif undefines_simdjson_implementation.search(line):
|
||||
# Don't include #undef SIMDJSON_IMPLEMENTATION since we're handling it ourselves
|
||||
self.write(f"/* undefining SIMDJSON_IMPLEMENTATION from \"{self.implementation}\": {line} */")
|
||||
self.implementation = None
|
||||
elif filename.endswith('/implementation_detection.h'):
|
||||
self.write(line)
|
||||
self.maybe_write_file(includedfile, filename, line)
|
||||
continue
|
||||
|
||||
# Handle defining and replacing SIMDJSON_IMPLEMENTATION
|
||||
defined = re.search(r'^#define\s+SIMDJSON_IMPLEMENTATION\s+(.+)$', line)
|
||||
if defined:
|
||||
old_implementation = self.implementation
|
||||
self.implementation = defined.group(1)
|
||||
if old_implementation is None:
|
||||
self.write(f'/* defining SIMDJSON_IMPLEMENTATION to "{self.implementation}" */')
|
||||
else:
|
||||
# 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}"
|
||||
self.write(uses_simdjson_implementation.sub(self.implementation,line))
|
||||
else:
|
||||
self.write(line)
|
||||
assert not ignoring, f"{filename} ended without #endif // SIMDJSON_AMALGAMATED"
|
||||
self.write(f'/* redefining SIMDJSON_IMPLEMENTATION from "{old_implementation}" to "{self.implementation}" */')
|
||||
elif re.search(r'^#undef\s+SIMDJSON_IMPLEMENTATION\s*$', line):
|
||||
# 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 not filename.endswith('/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)
|
||||
|
||||
# Handle defining and undefining SIMDJSON_AMALGAMATED
|
||||
defined = re.search(r'^#define\s+SIMDJSON_AMALGAMATED\s*$', line)
|
||||
if defined:
|
||||
assert not self.amalgamated_defined, f"{filename} redefines SIMDJSON_AMALGAMATED"
|
||||
self.amalgamated_defined = True
|
||||
self.write(f'/* defining SIMDJSON_AMALGAMATED */')
|
||||
elif re.search(r'^#undef\s+SIMDJSON_AMALGAMATED\s*$', line):
|
||||
assert self.amalgamated_defined, f"{filename} undefines SIMDJSON_AMALGAMATED without defining it"
|
||||
self.write(f'/* undefining SIMDJSON_AMALGAMATED */')
|
||||
self.amalgamated_defined = False
|
||||
|
||||
self.write(line)
|
||||
|
||||
assert self.ignoring is None, f"{filename} ended without #endif // SIMDJSON_AMALGAMATED"
|
||||
|
||||
if self.is_generic(filename):
|
||||
suffix = f" for {self.implementation}"
|
||||
@@ -196,6 +209,7 @@ class Amalgamator:
|
||||
assert self.builtin_implementation
|
||||
self.implementation = None
|
||||
|
||||
self.include_stack.pop()
|
||||
|
||||
# Get the generation date from git, so the output is reproducible.
|
||||
# The %ci specifier gives the unambiguous ISO 8601 format, and
|
||||
|
||||
+17618
-230
File diff suppressed because it is too large
Load Diff
+66206
-1602
File diff suppressed because it is too large
Load Diff
+4
-1
@@ -1,8 +1,11 @@
|
||||
#ifndef SIMDJSON_SRC_ARM64_CPP
|
||||
#define SIMDJSON_SRC_ARM64_CPP
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/arm64/implementation.h"
|
||||
#include "simdjson/arm64/amalgamated.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
#include "simdjson/arm64.h"
|
||||
|
||||
#include "simdjson/arm64/begin.h"
|
||||
#include "generic/amalgamated.h"
|
||||
|
||||
+4
-1
@@ -1,8 +1,11 @@
|
||||
#ifndef SIMDJSON_SRC_FALLBACK_CPP
|
||||
#define SIMDJSON_SRC_FALLBACK_CPP
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/fallback/implementation.h"
|
||||
#include "simdjson/fallback/amalgamated.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
#include "simdjson/fallback.h"
|
||||
|
||||
#include "simdjson/fallback/begin.h"
|
||||
#include "generic/stage1/find_next_document_index.h"
|
||||
|
||||
@@ -6,5 +6,6 @@
|
||||
#define SIMDJSON_SRC_GENERIC_DEPENDENCIES_H
|
||||
|
||||
#include "simdjson/internal/tape_type.h"
|
||||
#include "simdjson/internal/simdprune_tables.h"
|
||||
|
||||
#endif // SIMDJSON_SRC_GENERIC_DEPENDENCIES_H
|
||||
+4
-1
@@ -1,8 +1,11 @@
|
||||
#ifndef SIMDJSON_SRC_HASWELL_CPP
|
||||
#define SIMDJSON_SRC_HASWELL_CPP
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/haswell/implementation.h"
|
||||
#include "simdjson/haswell/amalgamated.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
#include "simdjson/haswell.h"
|
||||
|
||||
#include "simdjson/haswell/begin.h"
|
||||
#include "generic/amalgamated.h"
|
||||
|
||||
+4
-1
@@ -1,8 +1,11 @@
|
||||
#ifndef SIMDJSON_SRC_ICELAKE_CPP
|
||||
#define SIMDJSON_SRC_ICELAKE_CPP
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/icelake/implementation.h"
|
||||
#include "simdjson/icelake/amalgamated.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
#include "simdjson/icelake.h"
|
||||
|
||||
// defining SIMDJSON_GENERIC_JSON_STRUCTURAL_INDEXER_CUSTOM_BIT_INDEXER allows us to provide our own bit_indexer::write
|
||||
#define SIMDJSON_GENERIC_JSON_STRUCTURAL_INDEXER_CUSTOM_BIT_INDEXER
|
||||
|
||||
+4
-7
@@ -1,8 +1,11 @@
|
||||
#ifndef SIMDJSON_SRC_PPC64_CPP
|
||||
#define SIMDJSON_SRC_PPC64_CPP
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/ppc64/implementation.h"
|
||||
#include "simdjson/ppc64/amalgamated.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
#include "simdjson/ppc64.h"
|
||||
|
||||
#include "simdjson/ppc64/begin.h"
|
||||
#include "generic/amalgamated.h"
|
||||
@@ -85,15 +88,9 @@ simdjson_inline simd8<bool> must_be_2_3_continuation(const simd8<uint8_t> prev2,
|
||||
} // namespace SIMDJSON_IMPLEMENTATION
|
||||
} // namespace simdjson
|
||||
|
||||
#include "generic/stage1/utf8_lookup4_algorithm.h"
|
||||
#include "generic/stage1/json_structural_indexer.h"
|
||||
#include "generic/stage1/utf8_validator.h"
|
||||
|
||||
//
|
||||
// Stage 2
|
||||
//
|
||||
#include "generic/stage2/stringparsing.h"
|
||||
#include "generic/stage2/tape_builder.h"
|
||||
|
||||
//
|
||||
// Implementation-specific overrides
|
||||
|
||||
+2
-2
@@ -14,10 +14,10 @@ SIMDJSON_PUSH_DISABLE_UNUSED_WARNINGS
|
||||
#include "simdjson/generic/dependencies.h"
|
||||
#include "generic/dependencies.h"
|
||||
|
||||
#define SIMDJSON_AMALGAMATED
|
||||
|
||||
#include "implementation.cpp"
|
||||
|
||||
#define SIMDJSON_AMALGAMATED
|
||||
|
||||
#if SIMDJSON_IMPLEMENTATION_ARM64
|
||||
#include "arm64.cpp"
|
||||
#endif
|
||||
|
||||
+4
-1
@@ -1,8 +1,11 @@
|
||||
#ifndef SIMDJSON_SRC_WESTMERE_CPP
|
||||
#define SIMDJSON_SRC_WESTMERE_CPP
|
||||
|
||||
#ifndef SIMDJSON_AMALGAMATED
|
||||
#include "simdjson/westmere/implementation.h"
|
||||
#include "simdjson/westmere/amalgamated.h"
|
||||
#endif // SIMDJSON_AMALGAMATED
|
||||
|
||||
#include "simdjson/westmere.h"
|
||||
|
||||
#include "simdjson/westmere/begin.h"
|
||||
#include "generic/amalgamated.h"
|
||||
|
||||
Reference in New Issue
Block a user