Skip to content

Commit f8fd93e

Browse files
committed
Testing.
1 parent 4643323 commit f8fd93e

14 files changed

Lines changed: 1516 additions & 1095 deletions

File tree

Include/jsonifier/HashMap.hpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ namespace jsonifier_internal {
460460
returnValues.type = hash_map_type::single_byte;
461461
return returnValues;
462462
} else {
463-
return collectFirstByteAndUniqueIndexHashMapData<value_type>(pairsNew);
463+
return collectUniqueByteAndLengthHashMapData<value_type>(pairsNew);
464464
}
465465
}
466466

@@ -663,7 +663,7 @@ namespace jsonifier_internal {
663663
return hashData<value_type>.uniqueIndices[static_cast<uint8_t>(iter[static_cast<uint8_t>(hashData<value_type>.uniqueIndex)])];
664664
}
665665
return hashData<value_type>.storageSize;
666-
} else if constexpr (hashData<value_type>.type == hash_map_type::first_byte_and_unique_index) {
666+
} else if constexpr (hashData<value_type>.type == hash_map_type::first_byte_and_unique_index) {
667667
static constexpr auto uniqueFirstByteCount{ countFirstBytes(tupleReferencesByFirstByte<value_type>) };
668668
static constexpr auto mappings{ generateMappingsForFirstBytes(collectFirstBytes<uniqueFirstByteCount>(tupleReferencesByFirstByte<value_type>),
669669
hashData<value_type>.uniqueIndices) };
@@ -675,7 +675,8 @@ namespace jsonifier_internal {
675675
return mappings[flattenedIdx];
676676
}
677677
return hashData<value_type>.storageSize;
678-
} else if constexpr (hashData<value_type>.type == hash_map_type::unique_byte_and_length) {
678+
}
679+
else if constexpr (hashData<value_type>.type == hash_map_type::unique_byte_and_length) {
679680
static constexpr size_t storageMask = hashData<value_type>.storageSize - 1;
680681
const auto newPtr = char_comparison<'"', std::remove_cvref_t<decltype(*iter)>>::memchar(iter + subAmount01, subAmount02);
681682
if JSONIFIER_LIKELY (newPtr) {
@@ -714,9 +715,11 @@ namespace jsonifier_internal {
714715
uint64_t matches;
715716
#if JSONIFIER_CHECK_FOR_INSTRUCTION(JSONIFIER_NEON)
716717
uint8x8_t dup = vdup_n_u8(hash);
717-
auto mask = vceq_u8(ctrlBytesPtr + resultIndex, dup);
718+
int8x8_t data = vld1_s8(reinterpret_cast<const int8_t*>(ctrlBytesPtr + resultIndex));
719+
int8x8_t dup_signed = vreinterpret_s8_u8(dup);
720+
int8x8_t mask = vceq_s8(data, dup_signed);
718721
static constexpr uint64_t msbs = 0x8080808080808080ULL;
719-
matches = vget_lane_u64(vreinterpret_u64_u8(mask), 0) & msbs;
722+
matches = vget_lane_u64(vreinterpret_u64_s8(mask), 0) & msbs;
720723
#else
721724
matches = simd_internal::opCmpEq(simd_internal::gatherValue<simd_type>(static_cast<uint8_t>(hash)),
722725
simd_internal::gatherValues<simd_type>(ctrlBytesPtr + resultIndex));

Include/jsonifier/Parse_Impl.hpp

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ namespace jsonifier_internal {
8484

8585
template<typename class_type_new, typename parse_context_type> struct json_entity_parse_base {
8686
JSONIFIER_ALWAYS_INLINE virtual bool processIndex(class_type_new& value, parse_context_type& context) = 0;
87-
JSONIFIER_ALWAYS_INLINE virtual ~json_entity_parse_base() noexcept = default;
87+
JSONIFIER_ALWAYS_INLINE virtual ~json_entity_parse_base() noexcept = default;
8888
};
8989

9090
template<jsonifier::parse_options options, jsonifier::string_view nameNew, jsonifier::json_type typeNew, auto ptrNew, typename parse_context_type, typename buffer_type,
@@ -184,8 +184,8 @@ namespace jsonifier_internal {
184184
typename parse_context_type, typename buffer_type, auto tuple, bool minifiedOrInsideRepeated>
185185
struct construct_json_entity_parse_final {
186186
static constexpr auto originalTupleValue{ jsonifier_internal::get<index>(tuple) };
187-
using type =
188-
json_entity_parse_type<options, originalTupleValue.name, originalTupleValue.type, originalTupleValue.memberPtr, parse_context_type, buffer_type, minifiedOrInsideRepeated>;
187+
using type = json_entity_parse_type<options, originalTupleValue.name, originalTupleValue.type, originalTupleValue.memberPtr, parse_context_type, buffer_type,
188+
minifiedOrInsideRepeated>;
189189
};
190190

191191
template<template<auto, auto, auto, auto, typename, typename, bool> typename json_entity_parse_type, jsonifier::parse_options options, size_t index, typename class_type,
@@ -211,27 +211,24 @@ namespace jsonifier_internal {
211211

212212
template<typename parse_context_type, typename buffer_type, typename value_type, jsonifier::parse_options options, bool... values> struct index_processor_parse;
213213

214-
template<jsonifier::parse_options options, auto tupleElem, typename value_type, typename context_type>
215-
struct parse_index_processor_impl {
216-
JSONIFIER_ALWAYS_INLINE static void impl(const value_type& value,context_type& context) {
214+
template<jsonifier::parse_options options, auto tupleElem, typename value_type, typename context_type> struct parse_index_processor_impl {
215+
JSONIFIER_ALWAYS_INLINE static void impl(const value_type& value, context_type& context) {
217216
}
218217
};
219218

220-
template<jsonifier::parse_options options, bool minified, typename value_type, typename context_type, typename... value_holder_types>
221-
struct parser_core;
219+
template<jsonifier::parse_options options, bool minified, typename value_type, typename context_type, typename... value_holder_types> struct parser_core;
222220

223-
template<jsonifier::parse_options options, bool minified, typename value_type, typename context_type, typename value_holder_type,
224-
typename... value_holder_types>
221+
template<jsonifier::parse_options options, bool minified, typename value_type, typename context_type, typename value_holder_type, typename... value_holder_types>
225222
struct parser_core<options, minified, value_type, context_type, value_holder_type, value_holder_types...> {
226-
JSONIFIER_INLINE static void processIndices(const value_type& value,context_type& context) {
223+
JSONIFIER_INLINE static void processIndices(const value_type& value, context_type& context) {
227224
parse_index_processor_impl<options, value_holder_type::value, value_type, context_type>::impl(value, context);
228225
parser_core<options, minified, value_type, context_type, value_holder_types...>::processIndices(value, context);
229226
}
230227
};
231228

232229
template<jsonifier::parse_options options, bool minified, typename value_type, typename context_type, typename value_holder_type>
233230
struct parser_core<options, minified, value_type, context_type, value_holder_type> {
234-
JSONIFIER_ALWAYS_INLINE static void processIndices(const value_type& value,context_type& context) {
231+
JSONIFIER_ALWAYS_INLINE static void processIndices(const value_type& value, context_type& context) {
235232
parse_index_processor_impl<options, value_holder_type::value, value_type, context_type>::impl(value, context);
236233
}
237234
};
@@ -240,17 +237,15 @@ namespace jsonifier_internal {
240237
static constexpr auto value{ valueNew };
241238
};
242239

243-
template<jsonifier::parse_options options, bool minified, typename value_type, typename context_type, typename index_sequence, auto tuple>
244-
struct get_parser_core;
240+
template<jsonifier::parse_options options, bool minified, typename value_type, typename context_type, typename index_sequence, auto tuple> struct get_parser_core;
245241

246242
template<jsonifier::parse_options options, bool minified, typename value_type, typename context_type, size_t... I, auto tuple>
247243
struct get_parser_core<options, minified, value_type, context_type, std::index_sequence<I...>, tuple> {
248244
using type = parser_core<options, minified, value_type, context_type, value_holder<I, value_type, jsonifier_internal::get<I>(tuple)>...>;
249245
};
250246

251247
template<jsonifier::parse_options options, bool minified, typename value_type, typename context_type, auto value> using parser_core_t =
252-
typename get_parser_core<options, minified, value_type, context_type, jsonifier_internal::tag_range<jsonifier_internal::tuple_size_v<decltype(value)>>,
253-
value>::type;
248+
typename get_parser_core<options, minified, value_type, context_type, jsonifier_internal::tag_range<jsonifier_internal::tuple_size_v<decltype(value)>>, value>::type;
254249

255250
template<typename parse_context_type, typename buffer_type, typename value_type, jsonifier::parse_options options>
256251
struct index_processor_parse<parse_context_type, buffer_type, value_type, options, false> : derailleur<options, parse_context_type> {
@@ -575,9 +570,9 @@ namespace jsonifier_internal {
575570
JSONIFIER_SKIP_WS();
576571
size_t wsSize{ static_cast<size_t>(context.iter - wsStart) };
577572
if (whitespaceTable[static_cast<uint8_t>(*(context.iter + wsSize))]) {
578-
return parseObjects<true>(value, context, wsStart, wsSize);
573+
return parseObjects<value_type, true>(value, context, wsStart, wsSize);
579574
} else {
580-
return parseObjects<false>(value, context, wsStart, wsSize);
575+
return parseObjects<value_type, false>(value, context, wsStart, wsSize);
581576
}
582577
} else {
583578
++context.iter;

Include/jsonifier/StringUtils.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,6 @@ namespace jsonifier_internal {
10661066
if (depth == 0) {
10671067
return;
10681068
}
1069-
++context.iter;
10701069
remainingLength = static_cast<size_t>(context.endIter - context.iter);
10711070
nextOpenOrClose = getNextOpenOrClose<valueStart, valueEnd>(context, remainingLength);
10721071
}

Source/BoundsTest.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
namespace bounds_tests {
3232

3333
bool boundsTests() noexcept {
34+
/*
3435
jsonifier::jsonifier_core<> parser{};
3536
test_generator<test_struct> tests{};
3637
partial_test<partial_test_struct> newTests{};
@@ -50,7 +51,7 @@ namespace bounds_tests {
5051
test<test_struct> newData{};
5152
parser.parseJson(newData, testString);
5253
testString.resize(testString.size() - 1);
53-
}
54+
}*/
5455
return true;
5556
}
5657

0 commit comments

Comments
 (0)