File indexing completed on 2025-01-31 10:12:20
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef GOOGLE_PROTOBUF_GENERATED_MESSAGE_TCTABLE_GEN_H__
0012 #define GOOGLE_PROTOBUF_GENERATED_MESSAGE_TCTABLE_GEN_H__
0013
0014 #include <cstdint>
0015 #include <functional>
0016 #include <string>
0017 #include <vector>
0018
0019 #include "absl/types/variant.h"
0020 #include "google/protobuf/descriptor.h"
0021 #include "google/protobuf/descriptor.pb.h"
0022 #include "google/protobuf/generated_message_tctable_decl.h"
0023
0024
0025 #include "google/protobuf/port_def.inc"
0026
0027 namespace google {
0028 namespace protobuf {
0029 namespace internal {
0030 enum class TcParseFunction : uint8_t;
0031
0032 namespace field_layout {
0033 enum TransformValidation : uint16_t;
0034 }
0035
0036
0037 struct PROTOBUF_EXPORT TailCallTableInfo {
0038 struct MessageOptions {
0039 bool is_lite;
0040 bool uses_codegen;
0041
0042 bool should_profile_driven_cluster_aux_subtable;
0043 };
0044 struct FieldOptions {
0045 const FieldDescriptor* field;
0046 int has_bit_index;
0047
0048 float presence_probability;
0049
0050 field_layout::TransformValidation lazy_opt;
0051 bool is_string_inlined;
0052 bool is_implicitly_weak;
0053 bool use_direct_tcparser_table;
0054 bool should_split;
0055 int inlined_string_index;
0056 };
0057
0058 TailCallTableInfo(const Descriptor* descriptor,
0059 const MessageOptions& message_options,
0060 absl::Span<const FieldOptions> ordered_fields);
0061
0062 TcParseFunction fallback_function;
0063
0064
0065 struct FastFieldInfo {
0066 struct Empty {};
0067 struct Field {
0068 TcParseFunction func;
0069 const FieldDescriptor* field;
0070 uint16_t coded_tag;
0071 uint8_t hasbit_idx;
0072 uint8_t aux_idx;
0073
0074
0075 float presence_probability;
0076 };
0077 struct NonField {
0078 TcParseFunction func;
0079 uint16_t coded_tag;
0080 uint16_t nonfield_info;
0081 };
0082 absl::variant<Empty, Field, NonField> data;
0083
0084 bool is_empty() const { return absl::holds_alternative<Empty>(data); }
0085 const Field* AsField() const { return absl::get_if<Field>(&data); }
0086 const NonField* AsNonField() const { return absl::get_if<NonField>(&data); }
0087 };
0088 std::vector<FastFieldInfo> fast_path_fields;
0089
0090
0091 struct FieldEntryInfo {
0092 const FieldDescriptor* field;
0093 int hasbit_idx;
0094 int inlined_string_idx;
0095 uint16_t aux_idx;
0096 uint16_t type_card;
0097
0098
0099 cpp::Utf8CheckMode utf8_check_mode;
0100 };
0101 std::vector<FieldEntryInfo> field_entries;
0102
0103 enum AuxType {
0104 kNothing = 0,
0105 kInlinedStringDonatedOffset,
0106 kSplitOffset,
0107 kSplitSizeof,
0108 kSubMessage,
0109 kSubTable,
0110 kSubMessageWeak,
0111 kMessageVerifyFunc,
0112 kSelfVerifyFunc,
0113 kEnumRange,
0114 kEnumValidator,
0115 kNumericOffset,
0116 kMapAuxInfo,
0117 kCreateInArena,
0118 };
0119 struct AuxEntry {
0120 AuxType type;
0121 struct EnumRange {
0122 int16_t start;
0123 uint16_t size;
0124 };
0125 union {
0126 const FieldDescriptor* field;
0127 const Descriptor* desc;
0128 uint32_t offset;
0129 EnumRange enum_range;
0130 };
0131 };
0132 std::vector<AuxEntry> aux_entries;
0133
0134 struct SkipEntry16 {
0135 uint16_t skipmap;
0136 uint16_t field_entry_offset;
0137 };
0138 struct SkipEntryBlock {
0139 uint32_t first_fnum;
0140 std::vector<SkipEntry16> entries;
0141 };
0142 struct NumToEntryTable {
0143 uint32_t skipmap32;
0144 std::vector<SkipEntryBlock> blocks;
0145
0146 int size16() const {
0147 int size = 2;
0148 for (const auto& block : blocks) {
0149
0150 size += static_cast<int>(3 + block.entries.size() * 2);
0151 }
0152 return size;
0153 }
0154 };
0155 NumToEntryTable num_to_entry_table;
0156
0157 std::vector<uint8_t> field_name_data;
0158
0159
0160 int table_size_log2;
0161 };
0162
0163 }
0164 }
0165 }
0166
0167 #include "google/protobuf/port_undef.inc"
0168
0169 #endif