Move stage 1 and 2 files to their own directories

This commit is contained in:
John Keiser 2020-05-11 23:12:00 -07:00
parent 4ea866f050
commit 72ab0d11ff
32 changed files with 51 additions and 45 deletions

View File

@ -29,7 +29,7 @@ simdjson's source structure, from the top level, looks like this:
```c++
namespace simdjson {
namespace haswell {
#include "generic/stage1.h"
#include "generic/stage1/json_structural_indexer.h"
}
}
```

View File

@ -31,7 +31,7 @@ static inline uint32_t parse_eight_digits_unrolled(const char *chars) {
#define SWAR_NUMBER_PARSING
#include "generic/numberparsing.h"
#include "generic/stage2/numberparsing.h"
} // namespace arm64
} // namespace simdjson

View File

@ -71,17 +71,17 @@ really_inline simd8<bool> must_be_continuation(simd8<uint8_t> prev1, simd8<uint8
return is_second_byte ^ is_third_byte ^ is_fourth_byte;
}
#include "generic/buf_block_reader.h"
#include "generic/json_string_scanner.h"
#include "generic/json_scanner.h"
#include "generic/stage1/buf_block_reader.h"
#include "generic/stage1/json_string_scanner.h"
#include "generic/stage1/json_scanner.h"
#include "generic/json_minifier.h"
#include "generic/stage1/json_minifier.h"
WARN_UNUSED error_code implementation::minify(const uint8_t *buf, size_t len, uint8_t *dst, size_t &dst_len) const noexcept {
return arm64::stage1::json_minifier::minify<64>(buf, len, dst, dst_len);
}
#include "generic/utf8_lookup2_algorithm.h"
#include "generic/json_structural_indexer.h"
#include "generic/stage1/utf8_lookup2_algorithm.h"
#include "generic/stage1/json_structural_indexer.h"
WARN_UNUSED error_code implementation::stage1(const uint8_t *buf, size_t len, parser &parser, bool streaming) const noexcept {
return arm64::stage1::json_structural_indexer::index<64>(buf, len, parser, streaming);
}

View File

@ -9,10 +9,10 @@
namespace simdjson {
namespace arm64 {
#include "generic/atomparsing.h"
#include "generic/structural_iterator.h"
#include "generic/structural_parser.h"
#include "generic/streaming_structural_parser.h"
#include "generic/stage2/atomparsing.h"
#include "generic/stage2/structural_iterator.h"
#include "generic/stage2/structural_parser.h"
#include "generic/stage2/streaming_structural_parser.h"
} // namespace arm64
} // namespace simdjson

View File

@ -45,7 +45,7 @@ really_inline backslash_and_quote backslash_and_quote::copy_and_find(const uint8
};
}
#include "generic/stringparsing.h"
#include "generic/stage2/stringparsing.h"
} // namespace arm64
} // namespace simdjson

View File

@ -26,7 +26,7 @@ static inline uint32_t parse_eight_digits_unrolled(const char *chars) {
#define SWAR_NUMBER_PARSING
#include "generic/numberparsing.h"
#include "generic/stage2/numberparsing.h"
} // namespace fallback

View File

@ -10,10 +10,10 @@
namespace simdjson {
namespace fallback {
#include "generic/atomparsing.h"
#include "generic/structural_iterator.h"
#include "generic/structural_parser.h"
#include "generic/streaming_structural_parser.h"
#include "generic/stage2/atomparsing.h"
#include "generic/stage2/structural_iterator.h"
#include "generic/stage2/structural_parser.h"
#include "generic/stage2/streaming_structural_parser.h"
} // namespace fallback
} // namespace simdjson

View File

@ -27,7 +27,7 @@ really_inline backslash_and_quote backslash_and_quote::copy_and_find(const uint8
return { src[0] };
}
#include "generic/stringparsing.h"
#include "generic/stage2/stringparsing.h"
} // namespace fallback
} // namespace simdjson

View File

@ -1,3 +1,4 @@
namespace stage2 {
namespace atomparsing {
really_inline uint32_t string_to_uint32(const char* str) { return *reinterpret_cast<const uint32_t *>(str); }
@ -46,4 +47,5 @@ really_inline bool is_valid_null_atom(const uint8_t *src, size_t len) {
else { return false; }
}
} // namespace atomparsing
} // namespace atomparsing
} // namespace stage2

View File

@ -1,3 +1,4 @@
namespace stage2 {
namespace numberparsing {
// Attempts to compute i * 10^(power) exactly; and if "negative" is
@ -568,3 +569,4 @@ really_inline bool parse_number(UNUSED const uint8_t *const src,
}
} // namespace numberparsing
} // namespace stage2

View File

@ -3,6 +3,7 @@
// We assume the file in which it is include already includes
// "stringparsing.h" (this simplifies amalgation)
namespace stage2 {
namespace stringparsing {
// begin copypasta
@ -118,4 +119,5 @@ WARN_UNUSED really_inline uint8_t *parse_string(const uint8_t *src, uint8_t *dst
return nullptr;
}
} // namespace stringparsing
} // namespace stringparsing
} // namespace stage2

View File

@ -39,7 +39,7 @@ static inline uint32_t parse_eight_digits_unrolled(const char *chars) {
#define SWAR_NUMBER_PARSING
#include "generic/numberparsing.h"
#include "generic/stage2/numberparsing.h"
} // namespace haswell

View File

@ -60,17 +60,17 @@ really_inline simd8<bool> must_be_continuation(simd8<uint8_t> prev1, simd8<uint8
return simd8<int8_t>(is_second_byte | is_third_byte | is_fourth_byte) > int8_t(0);
}
#include "generic/buf_block_reader.h"
#include "generic/json_string_scanner.h"
#include "generic/json_scanner.h"
#include "generic/stage1/buf_block_reader.h"
#include "generic/stage1/json_string_scanner.h"
#include "generic/stage1/json_scanner.h"
#include "generic/json_minifier.h"
#include "generic/stage1/json_minifier.h"
WARN_UNUSED error_code implementation::minify(const uint8_t *buf, size_t len, uint8_t *dst, size_t &dst_len) const noexcept {
return haswell::stage1::json_minifier::minify<128>(buf, len, dst, dst_len);
}
#include "generic/utf8_lookup2_algorithm.h"
#include "generic/json_structural_indexer.h"
#include "generic/stage1/utf8_lookup2_algorithm.h"
#include "generic/stage1/json_structural_indexer.h"
WARN_UNUSED error_code implementation::stage1(const uint8_t *buf, size_t len, parser &parser, bool streaming) const noexcept {
return haswell::stage1::json_structural_indexer::index<128>(buf, len, parser, streaming);
}

View File

@ -10,10 +10,10 @@ TARGET_HASWELL
namespace simdjson {
namespace haswell {
#include "generic/atomparsing.h"
#include "generic/structural_iterator.h"
#include "generic/structural_parser.h"
#include "generic/streaming_structural_parser.h"
#include "generic/stage2/atomparsing.h"
#include "generic/stage2/structural_iterator.h"
#include "generic/stage2/structural_parser.h"
#include "generic/stage2/streaming_structural_parser.h"
} // namespace haswell
} // namespace simdjson

View File

@ -41,7 +41,7 @@ really_inline backslash_and_quote backslash_and_quote::copy_and_find(const uint8
};
}
#include "generic/stringparsing.h"
#include "generic/stage2/stringparsing.h"
} // namespace haswell
} // namespace simdjson

View File

@ -40,7 +40,7 @@ static inline uint32_t parse_eight_digits_unrolled(const char *chars) {
#define SWAR_NUMBER_PARSING
#include "generic/numberparsing.h"
#include "generic/stage2/numberparsing.h"
} // namespace westmere

View File

@ -59,17 +59,17 @@ really_inline simd8<bool> must_be_continuation(simd8<uint8_t> prev1, simd8<uint8
return simd8<int8_t>(is_second_byte | is_third_byte | is_fourth_byte) > int8_t(0);
}
#include "generic/buf_block_reader.h"
#include "generic/json_string_scanner.h"
#include "generic/json_scanner.h"
#include "generic/stage1/buf_block_reader.h"
#include "generic/stage1/json_string_scanner.h"
#include "generic/stage1/json_scanner.h"
#include "generic/json_minifier.h"
#include "generic/stage1/json_minifier.h"
WARN_UNUSED error_code implementation::minify(const uint8_t *buf, size_t len, uint8_t *dst, size_t &dst_len) const noexcept {
return westmere::stage1::json_minifier::minify<64>(buf, len, dst, dst_len);
}
#include "generic/utf8_lookup2_algorithm.h"
#include "generic/json_structural_indexer.h"
#include "generic/stage1/utf8_lookup2_algorithm.h"
#include "generic/stage1/json_structural_indexer.h"
WARN_UNUSED error_code implementation::stage1(const uint8_t *buf, size_t len, parser &parser, bool streaming) const noexcept {
return westmere::stage1::json_structural_indexer::index<64>(buf, len, parser, streaming);
}

View File

@ -10,10 +10,10 @@ TARGET_WESTMERE
namespace simdjson {
namespace westmere {
#include "generic/atomparsing.h"
#include "generic/structural_iterator.h"
#include "generic/structural_parser.h"
#include "generic/streaming_structural_parser.h"
#include "generic/stage2/atomparsing.h"
#include "generic/stage2/structural_iterator.h"
#include "generic/stage2/structural_parser.h"
#include "generic/stage2/streaming_structural_parser.h"
} // namespace westmere
} // namespace simdjson

View File

@ -43,7 +43,7 @@ really_inline backslash_and_quote backslash_and_quote::copy_and_find(const uint8
};
}
#include "generic/stringparsing.h"
#include "generic/stage2/stringparsing.h"
} // namespace westmere
} // namespace simdjson