diff --git a/.dockerignore b/.dockerignore index 60a69cf9..6736aa1b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,7 @@ * !.git !Makefile -!amalgamate.sh +!amalgamate.py !benchmark !dependencies !include @@ -12,4 +12,4 @@ !src !style !tests -!tools \ No newline at end of file +!tools diff --git a/HACKING.md b/HACKING.md index 1362020e..5faf53a6 100644 --- a/HACKING.md +++ b/HACKING.md @@ -67,7 +67,7 @@ Other important files and directories: * **.circleci:** Definitions for Circle CI. * **.github/workflows:** Definitions for GitHub Actions (CI). * **singleheader:** Contains generated `simdjson.h` and `simdjson.cpp` that we release. The files `singleheader/simdjson.h` and `singleheader/simdjson.cpp` should never be edited by hand. -* **singleheader/amalgamate.sh:** Generates `singleheader/simdjson.h` and `singleheader/simdjson.cpp` for release (bash script). +* **singleheader/amalgamate.py:** Generates `singleheader/simdjson.h` and `singleheader/simdjson.cpp` for release (python script). * **benchmark:** This is where we do benchmarking. Benchmarking is core to every change we make; the cardinal rule is don't regress performance without knowing exactly why, and what you're trading for it. Many of our benchmarks are microbenchmarks. We are effectively doing controlled scientific experiments for the purpose of understanding what affects our performance. So we simplify as much as possible. We try to avoid irrelevant factors such as page faults, interrupts, unnnecessary system calls. We recommend checking the performance as follows: @@ -169,12 +169,13 @@ systematically regenerated on releases. To ensure you have the latest code, you mkdir build cd build cmake .. +cmake --build . # needed, because currently dependencies do not work fully for the amalgamate target cmake --build . --target amalgamate ``` -You need to have a working bash on your system. +You need to have python3 installed on your system. -The amalgamator script is `amalgamate.sh` generates singleheader/simdjson.h by +The amalgamator script `amalgamate.py` generates singleheader/simdjson.h by reading through include/simdjson.h, copy/pasting each header file into the amalgamated file at the point it gets included (but only once per header). singleheader/simdjson.cpp is generated from src/simdjson.cpp the same way, except files under generic/ may be included and copy/pasted multiple diff --git a/singleheader/CMakeLists.txt b/singleheader/CMakeLists.txt index 0340872a..98381fef 100644 --- a/singleheader/CMakeLists.txt +++ b/singleheader/CMakeLists.txt @@ -22,15 +22,16 @@ find_program(BASH bash) # Under Windows, exectuting a bash script works, except that you cannot generally # do bash C:/path to my script. You need a "mounted" path: /mnt/c/path +find_package(Python3 COMPONENTS Interpreter) -if (BASH AND (NOT WIN32) AND SIMDJSON_BASH) +if (Python3_Interpreter_FOUND AND (NOT WIN32)) add_custom_command( OUTPUT ${SINGLEHEADER_FILES} COMMAND ${CMAKE_COMMAND} -E env AMALGAMATE_SOURCE_PATH=${PROJECT_SOURCE_DIR}/src AMALGAMATE_INPUT_PATH=${PROJECT_SOURCE_DIR}/include AMALGAMATE_OUTPUT_PATH=${CMAKE_CURRENT_BINARY_DIR} - ${BASH} ${CMAKE_CURRENT_SOURCE_DIR}/amalgamate.sh + ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/amalgamate.py # # This is the best way I could find to make amalgamation trigger whenever source files or # header files change: since the "simdjson" library has to get rebuilt when that happens, we @@ -42,7 +43,7 @@ if (BASH AND (NOT WIN32) AND SIMDJSON_BASH) # It sucks that we have to build the actual library to make it happen, but it's better than\ # nothing! # - DEPENDS amalgamate.sh simdjson + DEPENDS amalgamate.py simdjson ) ## @@ -74,7 +75,7 @@ if (BASH AND (NOT WIN32) AND SIMDJSON_BASH) else() - # We do not have bash, so we use existing amalgamated files instead of generating them ... + # We do not have python3, so we use existing amalgamated files instead of generating them ... # (Do not do this if the source and destination are the same!) if (NOT (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})) add_custom_command( @@ -148,4 +149,4 @@ if (NOT (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})) target_link_libraries(amalgamate_demo_direct_from_repository simdjson-singleheader-include-source-direct-from-repository simdjson-internal-flags) add_test(amalgamate_demo_direct_from_repository amalgamate_demo_direct_from_repository ${EXAMPLE_JSON} ${EXAMPLE_NDJSON}) -endif() \ No newline at end of file +endif() diff --git a/singleheader/amalgamate.py b/singleheader/amalgamate.py new file mode 100755 index 00000000..a4feb40d --- /dev/null +++ b/singleheader/amalgamate.py @@ -0,0 +1,152 @@ +#!/usr/bin/env python3 +# +# Creates the amalgamated source files. +# + +import sys +import os.path +import subprocess +import os +import re +import shutil + +SCRIPTPATH = os.path.dirname(os.path.abspath(sys.argv[0])) +PROJECTPATH = os.path.dirname(SCRIPTPATH) + +print(f"SCRIPTPATH={SCRIPTPATH} PROJECTPATH={PROJECTPATH}") + + +print("We are about to amalgamate all simdjson files into one source file.") +print("See https://www.sqlite.org/amalgamation.html and https://en.wikipedia.org/wiki/Single_Compilation_Unit for rationale.") +if "AMALGAMATE_SOURCE_PATH" not in os.environ: + AMALGAMATE_SOURCE_PATH = os.path.join(PROJECTPATH, "src") +else: + AMALGAMATE_SOURCE_PATH = os.environ["AMALGAMATE_SOURCE_PATH"] +if "AMALGAMATE_INCLUDE_PATH" not in os.environ: + AMALGAMATE_INCLUDE_PATH = os.path.join(PROJECTPATH, "include") +else: + AMALGAMATE_INCLUDE_PATH = os.environ["AMALGAMATE_INCLUDE_PATH"] +if "AMALGAMATE_OUTPUT_PATH" not in os.environ: + AMALGAMATE_OUTPUT_PATH = os.path.join(SCRIPTPATH) +else: + AMALGAMATE_OUTPUT_PATH = os.environ["AMALGAMATE_OUTPUT_PATH"] + +# this list excludes the "src/generic headers" +ALLCFILES = ["simdjson.cpp"] + +# order matters +ALLCHEADERS = ["simdjson.h"] + +found_includes = [] + + +def doinclude(fid, file, line): + p = os.path.join(AMALGAMATE_INCLUDE_PATH, file) + pi = os.path.join(AMALGAMATE_SOURCE_PATH, file) + + if os.path.exists(p): + # generic includes are included multiple times + if re.match('.*generic/.*.h', file): + dofile(fid, AMALGAMATE_INCLUDE_PATH, file) + # begin/end_implementation are also included multiple times + elif re.match('.*/begin.h', file): + dofile(fid, AMALGAMATE_INCLUDE_PATH, file) + elif re.match('.*/end.h', file): + dofile(fid, AMALGAMATE_INCLUDE_PATH, file) + elif file not in found_includes: + found_includes.append(file) + dofile(fid, AMALGAMATE_INCLUDE_PATH, file) + elif os.path.exists(pi): + # generic includes are included multiple times + if re.match('.*generic/.*h', file): + dofile(fid, AMALGAMATE_SOURCE_PATH, file) + elif file not in found_includes: + found_includes.append(file) + dofile(fid, AMALGAMATE_SOURCE_PATH, file) + else: + print(f"//doinclude: {file} already included: {line}") + else: + # If we don't recognize it, just emit the #include + print(line, file=fid) + + +def dofile(fid, prepath, filename): + # print(f"// dofile: invoked with prepath={prepath}, filename={filename}",file=fid) + file = os.path.join(prepath, filename) + RELFILE = os.path.relpath(file, PROJECTPATH) + # Last lines are always ignored. Files should end by an empty lines. + print(f"/* begin file {RELFILE} */", file=fid) + includepattern = re.compile('^#include "(.*)"') + with open(file, 'r') as fid2: + for line in fid2: + line = line.rstrip('\n') + s = includepattern.search(line) + if s: + includedfile = s.group(1) + # include all from simdjson.cpp except simdjson.h + if includedfile == "simdjson.h" and filename == "simdjson.cpp": + print(line, file=fid) + continue + + 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) + doinclude(fid, includedfile, line) + else: + # Otherwise we simply copy the line + print(line, file=fid) + print(f"/* end file {RELFILE} */", file=fid) + + +# 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. +# Forcing it to be UTC is difficult, because it needs to be portable +# between gnu date and busybox date. +timestamp = subprocess.run(['git', 'show', '-s', '--format=%ci', 'HEAD'], + stdout=subprocess.PIPE).stdout.decode('utf-8').strip() +print(f"timestamp is {timestamp}") + +os.makedirs(AMALGAMATE_OUTPUT_PATH, exist_ok=True) +AMAL_H = os.path.join(AMALGAMATE_OUTPUT_PATH, "simdjson.h") +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") + +print(f"Creating {AMAL_H}") +amal_h = open(AMAL_H, 'w') +print(f"/* auto-generated on {timestamp}. Do not edit! */", file=amal_h) +for h in ALLCHEADERS: + doinclude(amal_h, h, f"ERROR {h} not found") + +amal_h.close() + +print(f"Creating {AMAL_C}") +amal_c = open(AMAL_C, 'w') +print(f"/* auto-generated on {timestamp}. Do not edit! */", file=amal_c) +for c in ALLCFILES: + doinclude(amal_c, c, f"ERROR {c} not found") + +amal_c.close() + +# copy the README and DEMOCPP +if SCRIPTPATH != AMALGAMATE_OUTPUT_PATH: + shutil.copy2(os.path.join(SCRIPTPATH,"amalgamate_demo.cpp"),AMALGAMATE_OUTPUT_PATH) + shutil.copy2(os.path.join(SCRIPTPATH,"README.md"),AMALGAMATE_OUTPUT_PATH) + +print("Done with all files generation.") + +print(f"Files have been written to directory: {AMALGAMATE_OUTPUT_PATH}/") +print(subprocess.run(['ls', '-la', AMAL_C, AMAL_H, DEMOCPP, README], + stdout=subprocess.PIPE).stdout.decode('utf-8').strip()) +print("Done with all files generation.") + + +# +# Instructions to create demo +# + +print("\nGiving final instructions:") +with open(README) as r: + for line in r: + print(line) diff --git a/singleheader/amalgamate.sh b/singleheader/amalgamate.sh deleted file mode 100755 index f581dac7..00000000 --- a/singleheader/amalgamate.sh +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/env bash -######################################################################## -# Generates an "amalgamation build" for simdjson. Inspired by similar -# script used by whefs. -######################################################################## -set -e - - -SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" -PROJECTPATH="$(dirname $SCRIPTPATH)" -echo "Project at "$PROJECTPATH - -echo "We are about to amalgamate all simdjson files into one source file. " -echo "See https://www.sqlite.org/amalgamation.html and https://en.wikipedia.org/wiki/Single_Compilation_Unit for rationale. " - -if [ -z "$AMALGAMATE_SOURCE_PATH" ]; then AMALGAMATE_SOURCE_PATH="$PROJECTPATH/src"; fi -if [ -z "$AMALGAMATE_INCLUDE_PATH" ]; then AMALGAMATE_INCLUDE_PATH="$PROJECTPATH/include"; fi -if [ -z "$AMALGAMATE_OUTPUT_PATH" ]; then AMALGAMATE_OUTPUT_PATH="$SCRIPTPATH"; fi - -# this list excludes the "src/generic headers" -ALLCFILES=" -simdjson.cpp -" - -# order matters -ALLCHEADERS=" -simdjson.h -" - -found_includes=() - -for file in ${ALLCFILES}; do - test -e "$AMALGAMATE_SOURCE_PATH/$file" && continue - echo "FATAL: source file [$AMALGAMATE_SOURCE_PATH/$file] not found." - exit 127 -done - -for file in ${ALLCHEADERS}; do - test -e "$AMALGAMATE_INCLUDE_PATH/$file" && continue - echo "FATAL: source file [$AMALGAMATE_INCLUDE_PATH/$file] not found." - exit 127 -done - -function doinclude() -{ - file=$1 - line="${@:2}" - if [ -f $AMALGAMATE_INCLUDE_PATH/$file ]; then - # generic includes are included multiple times - if [[ "${file}" == *'generic/'*'.h' ]]; then - dofile $AMALGAMATE_INCLUDE_PATH $file - # begin/end_implementation are also included multiple times - elif [[ "${file}" == *'/begin.h' ]]; then - dofile $AMALGAMATE_INCLUDE_PATH $file - elif [[ "${file}" == *'/end.h' ]]; then - dofile $AMALGAMATE_INCLUDE_PATH $file - elif [[ ! " ${found_includes[@]} " =~ " ${file} " ]]; then - found_includes+=("$file") - dofile $AMALGAMATE_INCLUDE_PATH $file - fi - elif [ -f $AMALGAMATE_SOURCE_PATH/$file ]; then - # generic includes are included multiple times - if [[ "${file}" == *'generic/'*'.h' ]]; then - dofile $AMALGAMATE_SOURCE_PATH $file - elif [[ ! " ${found_includes[@]} " =~ " ${file} " ]]; then - found_includes+=("$file") - dofile $AMALGAMATE_SOURCE_PATH $file - else - echo "/* $file already included: $line */" - fi - else - # If we don't recognize it, just emit the #include - echo "$line" - fi -} - -function dofile() -{ - file="$1/$2" - RELFILE=${file#"$PROJECTPATH/"} - # Last lines are always ignored. Files should end by an empty lines. - echo "/* begin file $RELFILE */" - # echo "#line 8 \"$1\"" ## redefining the line/file is not nearly as useful as it sounds for debugging. It breaks IDEs. - while IFS= read -r line || [ -n "$line" ]; - do - if [[ "${line}" == '#include "'*'"'* ]]; then - file=$(echo $line| cut -d'"' -f 2) - # include all from simdjson.cpp except simdjson.h - if [ "${file}" == "simdjson.h" ] && [ "${2}" == "simdjson.cpp" ]; then - echo "$line" - continue - fi - - if [[ "${file}" == '../'* ]]; then - file=$(echo $file| cut -d'/' -f 2-) - fi - - # we explicitly include simdjson headers, one time each (unless they are generic, in which case multiple times is fine) - doinclude $file $line - else - # Otherwise we simply copy the line - echo "$line" - fi - done < "$file" - echo "/* end file $RELFILE */" -} - -# 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. -# Forcing it to be UTC is difficult, because it needs to be portable -# between gnu date and busybox date. -timestamp=$(git show -s --format=%ci HEAD) -mkdir -p $AMALGAMATE_OUTPUT_PATH - -AMAL_H="${AMALGAMATE_OUTPUT_PATH}/simdjson.h" -AMAL_C="${AMALGAMATE_OUTPUT_PATH}/simdjson.cpp" -DEMOCPP="${AMALGAMATE_OUTPUT_PATH}/amalgamate_demo.cpp" -README="${AMALGAMATE_OUTPUT_PATH}/README.md" - -echo "Creating ${AMAL_H}..." -echo "/* auto-generated on ${timestamp}. Do not edit! */" > ${AMAL_H} -{ - for h in ${ALLCHEADERS}; do - doinclude $h "ERROR $h not found" - done -} >> ${AMAL_H} - - -echo "Creating ${AMAL_C}..." -echo "/* auto-generated on ${timestamp}. Do not edit! */" > ${AMAL_C} -{ - for file in ${ALLCFILES}; do - dofile $AMALGAMATE_SOURCE_PATH $file - done -} >> ${AMAL_C} - -# copy amalgamate_demo.cpp and README.md only if AMALGAMATE_OUTPUT_PATH is not the same as SCRIPTPATH -if [ ! ${SCRIPTPATH} -ef ${AMALGAMATE_OUTPUT_PATH} ]; then - cp -f "${SCRIPTPATH}/amalgamate_demo.cpp" "${DEMOCPP}" - cp -f "${SCRIPTPATH}/README.md" "${README}" -fi - -echo "Done with all files generation." - -echo "Files have been written to directory: ${AMALGAMATE_OUTPUT_PATH}/" -ls -la ${AMAL_C} ${AMAL_H} ${DEMOCPP} ${README} - -# -# Instructions to create demo -# -echo "" -echo "Giving final instructions:" - -cat ${README} - -lowercase(){ - echo "$1" | tr 'A-Z' 'a-z' -} - -OS=`lowercase \`uname\`` diff --git a/singleheader/simdjson.cpp b/singleheader/simdjson.cpp index 5a11b965..508c3d74 100644 --- a/singleheader/simdjson.cpp +++ b/singleheader/simdjson.cpp @@ -1,4 +1,4 @@ -/* auto-generated on Sun Nov 1 11:09:32 CET 2020. Do not edit! */ +/* auto-generated on 2020-11-03 06:07:17 +0100. Do not edit! */ /* begin file src/simdjson.cpp */ #include "simdjson.h" @@ -1020,7 +1020,6 @@ decimal parse_decimal(const char *&p) noexcept { decimal answer; answer.num_digits = 0; answer.decimal_point = 0; - answer.negative = false; answer.truncated = false; answer.negative = (*p == '-'); if ((*p == '-') || (*p == '+')) { @@ -1037,10 +1036,9 @@ decimal parse_decimal(const char *&p) noexcept { answer.num_digits++; ++p; } - const char *first_after_period{}; if (*p == '.') { ++p; - first_after_period = p; + const char *first_after_period = p; // if we have not yet encountered a zero, we have to skip it as well if (answer.num_digits == 0) { // skip zeros @@ -2678,7 +2676,7 @@ simdjson_warn_unused error_code implementation::create_dom_parser_implementation /* begin file include/simdjson/arm64/end.h */ #undef SIMDJSON_IMPLEMENTATION /* end file include/simdjson/arm64/end.h */ -/* end file include/simdjson/arm64/end.h */ +/* end file src/arm64/implementation.cpp */ /* begin file src/arm64/dom_parser_implementation.cpp */ /* begin file include/simdjson/arm64/begin.h */ #define SIMDJSON_IMPLEMENTATION arm64 @@ -3762,7 +3760,7 @@ simdjson_really_inline error_code json_structural_indexer::finish(dom_parser_imp } // unnamed namespace } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -/* end file src/generic/stage1/find_next_document_index.h */ +/* end file src/generic/stage1/json_structural_indexer.h */ /* begin file src/generic/stage1/utf8_validator.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -4212,7 +4210,7 @@ simdjson_warn_unused simdjson_really_inline error_code json_iterator::visit_prim } // unnamed namespace } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -/* end file src/generic/stage2/logger.h */ +/* end file src/generic/stage2/json_iterator.h */ /* begin file src/generic/stage2/tape_writer.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -4602,7 +4600,7 @@ simdjson_really_inline void tape_builder::on_end_string(uint8_t *dst) noexcept { } // unnamed namespace } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -/* end file src/generic/stage2/tape_writer.h */ +/* end file src/generic/stage2/tape_builder.h */ // // Implementation-specific overrides @@ -4656,7 +4654,7 @@ simdjson_warn_unused error_code dom_parser_implementation::parse(const uint8_t * /* begin file include/simdjson/arm64/end.h */ #undef SIMDJSON_IMPLEMENTATION /* end file include/simdjson/arm64/end.h */ -/* end file include/simdjson/arm64/end.h */ +/* end file src/arm64/dom_parser_implementation.cpp */ #endif #if SIMDJSON_IMPLEMENTATION_FALLBACK /* begin file src/fallback/implementation.cpp */ @@ -4685,7 +4683,7 @@ simdjson_warn_unused error_code implementation::create_dom_parser_implementation /* begin file include/simdjson/fallback/end.h */ #undef SIMDJSON_IMPLEMENTATION /* end file include/simdjson/fallback/end.h */ -/* end file include/simdjson/fallback/end.h */ +/* end file src/fallback/implementation.cpp */ /* begin file src/fallback/dom_parser_implementation.cpp */ /* begin file include/simdjson/fallback/begin.h */ #define SIMDJSON_IMPLEMENTATION fallback @@ -5012,11 +5010,10 @@ simdjson_warn_unused error_code implementation::minify(const uint8_t *buf, size_ simdjson_warn_unused bool implementation::validate_utf8(const char *buf, size_t len) const noexcept { const uint8_t *data = (const uint8_t *)buf; uint64_t pos = 0; - uint64_t next_pos = 0; uint32_t code_point = 0; while (pos < len) { // check of the next 8 bytes are ascii. - next_pos = pos + 16; + uint64_t next_pos = pos + 16; if (next_pos <= len) { // if it is safe to read 8 more bytes, check that they are ascii uint64_t v1; memcpy(&v1, data + pos, sizeof(uint64_t)); @@ -5486,7 +5483,7 @@ simdjson_warn_unused simdjson_really_inline error_code json_iterator::visit_prim } // unnamed namespace } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -/* end file src/generic/stage2/logger.h */ +/* end file src/generic/stage2/json_iterator.h */ /* begin file src/generic/stage2/tape_writer.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -5876,7 +5873,7 @@ simdjson_really_inline void tape_builder::on_end_string(uint8_t *dst) noexcept { } // unnamed namespace } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -/* end file src/generic/stage2/tape_writer.h */ +/* end file src/generic/stage2/tape_builder.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -5901,7 +5898,7 @@ simdjson_warn_unused error_code dom_parser_implementation::parse(const uint8_t * /* begin file include/simdjson/fallback/end.h */ #undef SIMDJSON_IMPLEMENTATION /* end file include/simdjson/fallback/end.h */ -/* end file include/simdjson/fallback/end.h */ +/* end file src/fallback/dom_parser_implementation.cpp */ #endif #if SIMDJSON_IMPLEMENTATION_HASWELL /* begin file src/haswell/implementation.cpp */ @@ -5933,7 +5930,7 @@ SIMDJSON_UNTARGET_REGION #undef SIMDJSON_IMPLEMENTATION /* end file include/simdjson/haswell/end.h */ -/* end file include/simdjson/haswell/end.h */ +/* end file src/haswell/implementation.cpp */ /* begin file src/haswell/dom_parser_implementation.cpp */ /* begin file include/simdjson/haswell/begin.h */ #define SIMDJSON_IMPLEMENTATION haswell @@ -7022,7 +7019,7 @@ simdjson_really_inline error_code json_structural_indexer::finish(dom_parser_imp } // unnamed namespace } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -/* end file src/generic/stage1/find_next_document_index.h */ +/* end file src/generic/stage1/json_structural_indexer.h */ /* begin file src/generic/stage1/utf8_validator.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -7471,7 +7468,7 @@ simdjson_warn_unused simdjson_really_inline error_code json_iterator::visit_prim } // unnamed namespace } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -/* end file src/generic/stage2/logger.h */ +/* end file src/generic/stage2/json_iterator.h */ /* begin file src/generic/stage2/tape_writer.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -7861,7 +7858,7 @@ simdjson_really_inline void tape_builder::on_end_string(uint8_t *dst) noexcept { } // unnamed namespace } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -/* end file src/generic/stage2/tape_writer.h */ +/* end file src/generic/stage2/tape_builder.h */ // // Implementation-specific overrides @@ -7914,7 +7911,7 @@ simdjson_warn_unused error_code dom_parser_implementation::parse(const uint8_t * SIMDJSON_UNTARGET_REGION #undef SIMDJSON_IMPLEMENTATION /* end file include/simdjson/haswell/end.h */ -/* end file include/simdjson/haswell/end.h */ +/* end file src/haswell/dom_parser_implementation.cpp */ #endif #if SIMDJSON_IMPLEMENTATION_PPC64 /* begin file src/ppc64/implementation.cpp */ @@ -7943,7 +7940,7 @@ simdjson_warn_unused error_code implementation::create_dom_parser_implementation /* begin file include/simdjson/ppc64/end.h */ #undef SIMDJSON_IMPLEMENTATION /* end file include/simdjson/ppc64/end.h */ -/* end file include/simdjson/ppc64/end.h */ +/* end file src/ppc64/implementation.cpp */ /* begin file src/ppc64/dom_parser_implementation.cpp */ /* begin file include/simdjson/ppc64/begin.h */ #define SIMDJSON_IMPLEMENTATION ppc64 @@ -8997,7 +8994,7 @@ simdjson_really_inline error_code json_structural_indexer::finish(dom_parser_imp } // unnamed namespace } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -/* end file src/generic/stage1/find_next_document_index.h */ +/* end file src/generic/stage1/json_structural_indexer.h */ /* begin file src/generic/stage1/utf8_validator.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -9447,7 +9444,7 @@ simdjson_warn_unused simdjson_really_inline error_code json_iterator::visit_prim } // unnamed namespace } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -/* end file src/generic/stage2/logger.h */ +/* end file src/generic/stage2/json_iterator.h */ /* begin file src/generic/stage2/tape_writer.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -9837,7 +9834,7 @@ simdjson_really_inline void tape_builder::on_end_string(uint8_t *dst) noexcept { } // unnamed namespace } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -/* end file src/generic/stage2/tape_writer.h */ +/* end file src/generic/stage2/tape_builder.h */ // // Implementation-specific overrides @@ -9891,7 +9888,7 @@ simdjson_warn_unused error_code dom_parser_implementation::parse(const uint8_t * /* begin file include/simdjson/ppc64/end.h */ #undef SIMDJSON_IMPLEMENTATION /* end file include/simdjson/ppc64/end.h */ -/* end file include/simdjson/ppc64/end.h */ +/* end file src/ppc64/dom_parser_implementation.cpp */ #endif #if SIMDJSON_IMPLEMENTATION_WESTMERE /* begin file src/westmere/implementation.cpp */ @@ -9922,7 +9919,7 @@ simdjson_warn_unused error_code implementation::create_dom_parser_implementation SIMDJSON_UNTARGET_REGION #undef SIMDJSON_IMPLEMENTATION /* end file include/simdjson/westmere/end.h */ -/* end file include/simdjson/westmere/end.h */ +/* end file src/westmere/implementation.cpp */ /* begin file src/westmere/dom_parser_implementation.cpp */ /* begin file include/simdjson/westmere/begin.h */ #define SIMDJSON_IMPLEMENTATION westmere @@ -11009,7 +11006,7 @@ simdjson_really_inline error_code json_structural_indexer::finish(dom_parser_imp } // unnamed namespace } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -/* end file src/generic/stage1/find_next_document_index.h */ +/* end file src/generic/stage1/json_structural_indexer.h */ /* begin file src/generic/stage1/utf8_validator.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -11458,7 +11455,7 @@ simdjson_warn_unused simdjson_really_inline error_code json_iterator::visit_prim } // unnamed namespace } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -/* end file src/generic/stage2/logger.h */ +/* end file src/generic/stage2/json_iterator.h */ /* begin file src/generic/stage2/tape_writer.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -11848,7 +11845,7 @@ simdjson_really_inline void tape_builder::on_end_string(uint8_t *dst) noexcept { } // unnamed namespace } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -/* end file src/generic/stage2/tape_writer.h */ +/* end file src/generic/stage2/tape_builder.h */ // // Implementation-specific overrides @@ -11902,8 +11899,8 @@ simdjson_warn_unused error_code dom_parser_implementation::parse(const uint8_t * SIMDJSON_UNTARGET_REGION #undef SIMDJSON_IMPLEMENTATION /* end file include/simdjson/westmere/end.h */ -/* end file include/simdjson/westmere/end.h */ +/* end file src/westmere/dom_parser_implementation.cpp */ #endif SIMDJSON_POP_DISABLE_WARNINGS -/* end file include/simdjson/westmere/end.h */ +/* end file src/simdjson.cpp */ diff --git a/singleheader/simdjson.h b/singleheader/simdjson.h index 4c4e9a57..92a16d35 100644 --- a/singleheader/simdjson.h +++ b/singleheader/simdjson.h @@ -1,4 +1,4 @@ -/* auto-generated on Sun Nov 1 11:09:32 CET 2020. Do not edit! */ +/* auto-generated on 2020-11-03 06:07:17 +0100. Do not edit! */ /* begin file include/simdjson.h */ #ifndef SIMDJSON_H #define SIMDJSON_H @@ -142,11 +142,13 @@ #endif // defined(__x86_64__) || defined(_M_AMD64) #ifdef SIMDJSON_IS_32BITS +#ifndef SIMDJSON_NO_PORTABILITY_WARNING #pragma message("The simdjson library is designed \ for 64-bit processors and it seems that you are not \ compiling for a known 64-bit platform. All fast kernels \ will be disabled and performance may be poor. Please \ use a 64-bit target such as x64, 64-bit ARM or 64-bit PPC.") +#endif // SIMDJSON_NO_PORTABILITY_WARNING #endif // SIMDJSON_IS_32BITS // this is almost standard? @@ -2000,7 +2002,7 @@ namespace std { #endif // SIMDJSON_COMMON_DEFS_H -/* end file include/simdjson/nonstd/string_view.hpp */ +/* end file include/simdjson/common_defs.h */ SIMDJSON_PUSH_DISABLE_WARNINGS SIMDJSON_DISABLE_UNDESIRED_WARNINGS @@ -2492,7 +2494,7 @@ simdjson_warn_unused error_code minify(const char *buf, size_t len, char *dst, s } // namespace simdjson #endif // SIMDJSON_MINIFY_H -/* end file include/simdjson/padded_string.h */ +/* end file include/simdjson/minify.h */ /* begin file include/simdjson/implementation.h */ #ifndef SIMDJSON_IMPLEMENTATION_H #define SIMDJSON_IMPLEMENTATION_H @@ -3118,7 +3120,7 @@ extern SIMDJSON_DLLIMPORTEXPORT internal::atomic_ptr activ } // namespace simdjson #endif // SIMDJSON_IMPLEMENTATION_H -/* end file include/simdjson/internal/isadetection.h */ +/* end file include/simdjson/implementation.h */ /* begin file include/simdjson/dom/array.h */ #ifndef SIMDJSON_DOM_ARRAY_H #define SIMDJSON_DOM_ARRAY_H @@ -3205,7 +3207,7 @@ public: } // namespace simdjson #endif // SIMDJSON_INTERNAL_TAPE_REF_H -/* end file include/simdjson/internal/tape_type.h */ +/* end file include/simdjson/internal/tape_ref.h */ namespace simdjson { @@ -3373,7 +3375,7 @@ inline constexpr bool enable_view #include @@ -4257,7 +4259,7 @@ public: } // namespace simdjson #endif // SIMDJSON_DOCUMENT_STREAM_H -/* end file include/simdjson/dom/document.h */ +/* end file include/simdjson/dom/document_stream.h */ /* begin file include/simdjson/dom/element.h */ #ifndef SIMDJSON_DOM_ELEMENT_H #define SIMDJSON_DOM_ELEMENT_H @@ -5452,7 +5454,7 @@ dom::parser build_parsed_json(const char *buf) noexcept = delete; } // namespace simdjson #endif // SIMDJSON_DOM_JSONPARSER_H -/* end file include/simdjson/jsonioutil.h */ +/* end file include/simdjson/dom/jsonparser.h */ /* begin file include/simdjson/dom/parsedjson_iterator.h */ // TODO Remove this -- deprecated API and files @@ -5790,7 +5792,7 @@ public: #endif // SIMDJSON_DISABLE_DEPRECATED_API #endif // SIMDJSON_DOM_PARSEDJSON_ITERATOR_H -/* end file include/simdjson/internal/jsonformatutils.h */ +/* end file include/simdjson/dom/parsedjson_iterator.h */ // Inline functions /* begin file include/simdjson/dom/array-inl.h */ @@ -6383,7 +6385,7 @@ static_assert(std::ranges::sized_range parse_double(cons if (p-start_exp_digits == 0 || p-start_exp_digits > 19) { return NUMBER_ERROR; } exponent += exp_neg ? 0-exp : exp; - overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power; } if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return NUMBER_ERROR; } + overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power; + // // Assemble (or slow-parse) the float // @@ -10594,7 +10597,7 @@ simdjson_unused simdjson_really_inline simdjson_result parse_double(cons /* end file include/simdjson/generic/numberparsing.h */ #endif // SIMDJSON_ARM64_NUMBERPARSING_H -/* end file include/simdjson/generic/numberparsing.h */ +/* end file include/simdjson/arm64/numberparsing.h */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -12576,7 +12579,7 @@ public: } // namespace simdjson /* end file include/simdjson/generic/ondemand/parser.h */ -/* end file include/simdjson/generic/ondemand/parser.h */ +/* end file include/simdjson/generic/ondemand.h */ // Inline definitions /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h */ @@ -14575,7 +14578,7 @@ simdjson_really_inline simdjson_result parse_double(cons if (p-start_exp_digits == 0 || p-start_exp_digits > 19) { return NUMBER_ERROR; } exponent += exp_neg ? 0-exp : exp; - overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power; } if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return NUMBER_ERROR; } + overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power; + // // Assemble (or slow-parse) the float // @@ -16414,7 +16418,7 @@ simdjson_unused simdjson_really_inline simdjson_result parse_double(cons /* end file include/simdjson/generic/numberparsing.h */ #endif // SIMDJSON_HASWELL_NUMBERPARSING_H -/* end file include/simdjson/generic/numberparsing.h */ +/* end file include/simdjson/haswell/numberparsing.h */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -18396,7 +18400,7 @@ public: } // namespace simdjson /* end file include/simdjson/generic/ondemand/parser.h */ -/* end file include/simdjson/generic/ondemand/parser.h */ +/* end file include/simdjson/generic/ondemand.h */ // Inline definitions /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h */ @@ -20395,7 +20399,7 @@ simdjson_really_inline simdjson_result parse_double(cons if (p-start_exp_digits == 0 || p-start_exp_digits > 19) { return NUMBER_ERROR; } exponent += exp_neg ? 0-exp : exp; - overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power; } if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return NUMBER_ERROR; } + overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power; + // // Assemble (or slow-parse) the float // @@ -22187,7 +22192,7 @@ simdjson_unused simdjson_really_inline simdjson_result parse_double(cons /* end file include/simdjson/generic/numberparsing.h */ #endif // SIMDJSON_WESTMERE_NUMBERPARSING_H -/* end file include/simdjson/generic/numberparsing.h */ +/* end file include/simdjson/westmere/numberparsing.h */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -24169,7 +24174,7 @@ public: } // namespace simdjson /* end file include/simdjson/generic/ondemand/parser.h */ -/* end file include/simdjson/generic/ondemand/parser.h */ +/* end file include/simdjson/generic/ondemand.h */ // Inline definitions /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h */ @@ -26168,7 +26173,7 @@ simdjson_really_inline simdjson_result parse_double(cons if (p-start_exp_digits == 0 || p-start_exp_digits > 19) { return NUMBER_ERROR; } exponent += exp_neg ? 0-exp : exp; - overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power; } if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return NUMBER_ERROR; } + overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power; + // // Assemble (or slow-parse) the float // @@ -28103,7 +28109,7 @@ simdjson_unused simdjson_really_inline simdjson_result parse_double(cons /* end file include/simdjson/generic/numberparsing.h */ #endif // SIMDJSON_PPC64_NUMBERPARSING_H -/* end file include/simdjson/generic/numberparsing.h */ +/* end file include/simdjson/ppc64/numberparsing.h */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -30085,7 +30091,7 @@ public: } // namespace simdjson /* end file include/simdjson/generic/ondemand/parser.h */ -/* end file include/simdjson/generic/ondemand/parser.h */ +/* end file include/simdjson/generic/ondemand.h */ // Inline definitions /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h */ @@ -32084,7 +32090,7 @@ simdjson_really_inline simdjson_result parse_double(cons if (p-start_exp_digits == 0 || p-start_exp_digits > 19) { return NUMBER_ERROR; } exponent += exp_neg ? 0-exp : exp; - overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power; } if (jsoncharutils::is_not_structural_or_whitespace(*p)) { return NUMBER_ERROR; } + overflow = overflow || exponent < simdjson::internal::smallest_power || exponent > simdjson::internal::largest_power; + // // Assemble (or slow-parse) the float // @@ -33435,7 +33442,7 @@ simdjson_unused simdjson_really_inline simdjson_result parse_double(cons /* end file include/simdjson/generic/numberparsing.h */ #endif // SIMDJSON_FALLBACK_NUMBERPARSING_H -/* end file include/simdjson/generic/numberparsing.h */ +/* end file include/simdjson/fallback/numberparsing.h */ /* begin file include/simdjson/generic/implementation_simdjson_result_base.h */ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { @@ -35417,7 +35424,7 @@ public: } // namespace simdjson /* end file include/simdjson/generic/ondemand/parser.h */ -/* end file include/simdjson/generic/ondemand/parser.h */ +/* end file include/simdjson/generic/ondemand.h */ // Inline definitions /* begin file include/simdjson/generic/implementation_simdjson_result_base-inl.h */ @@ -37416,7 +37423,7 @@ simdjson_really_inline simdjson_result