Move end_scope to stage 2 code
This commit is contained in:
parent
7219d28a31
commit
a03115a4a6
|
@ -1041,8 +1041,6 @@ public:
|
|||
really_inline bool on_number_s64(int64_t value) noexcept; ///< @private
|
||||
really_inline bool on_number_u64(uint64_t value) noexcept; ///< @private
|
||||
really_inline bool on_number_double(double value) noexcept; ///< @private
|
||||
|
||||
really_inline void end_scope(uint32_t start_tape_index, uint32_t count) noexcept; ///< @private
|
||||
private:
|
||||
/**
|
||||
* The maximum document length this parser will automatically support.
|
||||
|
|
|
@ -113,15 +113,6 @@ really_inline void parser::write_tape(uint64_t val, internal::tape_type t) noexc
|
|||
doc.tape[current_loc++] = val | ((uint64_t(char(t))) << 56);
|
||||
}
|
||||
|
||||
// this function is responsible for annotating the start of the scope
|
||||
really_inline void parser::end_scope(uint32_t start_tape_index, uint32_t count) noexcept {
|
||||
// count can overflow if it exceeds 24 bits... so we saturate
|
||||
// the convention being that a cnt of 0xffffff or more is undetermined in value (>= 0xffffff).
|
||||
const uint32_t cntsat = count > 0xFFFFFF ? 0xFFFFFF : count;
|
||||
// This is a load and an OR. It would be possible to just write once at doc.tape[d.tape_index]
|
||||
doc.tape[start_tape_index] |= current_loc | (uint64_t(cntsat) << 32);
|
||||
}
|
||||
|
||||
} // namespace simdjson
|
||||
} // namespace dom
|
||||
|
||||
|
|
|
@ -152,22 +152,33 @@ struct structural_parser {
|
|||
return depth >= doc_parser.max_depth();
|
||||
}
|
||||
|
||||
// this function is responsible for annotating the start of the scope
|
||||
really_inline void end_scope() noexcept {
|
||||
// count can overflow if it exceeds 24 bits... so we saturate
|
||||
// the convention being that a cnt of 0xffffff or more is undetermined in value (>= 0xffffff).
|
||||
const uint32_t start_tape_index = doc_parser.containing_scope[depth].tape_index;
|
||||
const uint32_t count = doc_parser.containing_scope[depth].count;
|
||||
const uint32_t cntsat = count > 0xFFFFFF ? 0xFFFFFF : count;
|
||||
// This is a load and an OR. It would be possible to just write once at doc.tape[d.tape_index]
|
||||
doc_parser.doc.tape[start_tape_index] |= doc_parser.current_loc | (uint64_t(cntsat) << 32);
|
||||
}
|
||||
|
||||
really_inline bool end_object() {
|
||||
depth--;
|
||||
doc_parser.on_end_object(doc_parser.containing_scope[depth].tape_index);
|
||||
doc_parser.end_scope(doc_parser.containing_scope[depth].tape_index, doc_parser.containing_scope[depth].count);
|
||||
end_scope();
|
||||
return false;
|
||||
}
|
||||
really_inline bool end_array() {
|
||||
depth--;
|
||||
doc_parser.on_end_array(doc_parser.containing_scope[depth].tape_index);
|
||||
doc_parser.end_scope(doc_parser.containing_scope[depth].tape_index, doc_parser.containing_scope[depth].count);
|
||||
end_scope();
|
||||
return false;
|
||||
}
|
||||
really_inline bool end_document() {
|
||||
depth--;
|
||||
doc_parser.on_end_document(doc_parser.containing_scope[depth].tape_index);
|
||||
doc_parser.end_scope(doc_parser.containing_scope[depth].tape_index, doc_parser.containing_scope[depth].count);
|
||||
end_scope();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue