From 50c6c24a2bf781c55c46ad02e5ba6c12f0ce22e4 Mon Sep 17 00:00:00 2001 From: Samuel Benzaquen Date: Thu, 20 Aug 2026 12:05:32 -0700 Subject: [PATCH] Remove table prefetching experiment. It didn't pan out and was never turned on. PiperOrigin-RevId: 967969922 --- .../golden/compare_cpp_codegen_failure.txt | 8 +- .../golden/compare_cpp_codegen_failure.xml | 4 +- .../compiler/cpp/parse_function_generator.cc | 23 +--- .../compiler/csharp/c_sharp_features.pb.cc | 3 - .../compiler/java/java_features.pb.cc | 6 - src/google/protobuf/compiler/plugin.pb.cc | 12 -- src/google/protobuf/cpp_features.pb.cc | 3 - src/google/protobuf/cpp_file_options.pb.cc | 3 - src/google/protobuf/descriptor.pb.cc | 105 ------------------ .../protobuf/generated_message_reflection.cc | 13 +-- .../protobuf/generated_message_tctable_decl.h | 21 +--- .../generated_message_tctable_lite_test.cc | 24 ---- .../protobuf/json_enumvalue_options.pb.cc | 3 - src/google/protobuf/port_def.inc | 5 - src/google/protobuf/port_undef.inc | 1 - 15 files changed, 11 insertions(+), 223 deletions(-) diff --git a/editions/golden/compare_cpp_codegen_failure.txt b/editions/golden/compare_cpp_codegen_failure.txt index 3b73849728..ad089a97f0 100644 --- a/editions/golden/compare_cpp_codegen_failure.txt +++ b/editions/golden/compare_cpp_codegen_failure.txt @@ -1,7 +1,7 @@ [ RUN ] third_party/protobuf/editions/golden/simple_proto3.pb.cc (Go) @@ @@ - ::_pbi::TcParser::GetTable<::protobuf_editions_test::golden::SimpleProto3>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE + nullptr, // post_loop_handler + ::_pbi::TcParser::MpUnknownFields, // fallback }, {{ - // optional int32 int32_field = 1; + // int32 int32_field = 1; @@ -37,8 +37,8 @@ [ FAILED ] third_party/protobuf/editions/golden/simple_proto3.pb.cc (Go) [ RUN ] third_party/protobuf/editions/golden/simple_proto3.pb.cc (Java) @@ @@ - ::_pbi::TcParser::GetTable<::protobuf_editions_test::golden::SimpleProto3>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE + nullptr, // post_loop_handler + ::_pbi::TcParser::MpUnknownFields, // fallback }, {{ - // optional int32 int32_field = 1; + // int32 int32_field = 1; diff --git a/editions/golden/compare_cpp_codegen_failure.xml b/editions/golden/compare_cpp_codegen_failure.xml index c1fae83b27..1db90f38a2 100644 --- a/editions/golden/compare_cpp_codegen_failure.xml +++ b/editions/golden/compare_cpp_codegen_failure.xml @@ -2,10 +2,10 @@ - + - + diff --git a/src/google/protobuf/compiler/cpp/parse_function_generator.cc b/src/google/protobuf/compiler/cpp/parse_function_generator.cc index e86b71a708..aac08d932c 100644 --- a/src/google/protobuf/compiler/cpp/parse_function_generator.cc +++ b/src/google/protobuf/compiler/cpp/parse_function_generator.cc @@ -243,26 +243,7 @@ void ParseFunctionGenerator::GenerateParseTableHelperDefinition( p->Emit("nullptr, // post_loop_handler\n"); } }}, - {"fallback", TcParseFunctionName(tc_table_info_->fallback_function)}, - {"to_prefetch", - [&] { - std::vector subtable_fields; - for (const auto& aux : tc_table_info_->aux_entries) { - if (aux.type == internal::TailCallTableInfo::kClassData) { - subtable_fields.push_back(aux.field); - } - } - const auto* hottest = FindHottestField(subtable_fields, options_); - p->Emit( - {{"hot_type", QualifiedClassName(hottest == nullptr - ? descriptor_ - : hottest->message_type(), - options_)}}, - R"cc( -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<$hot_type$>(), // to_prefetch -#endif // PROTOBUF_PREFETCH_PARSE_TABLE)cc"); - }}}, + {"fallback", TcParseFunctionName(tc_table_info_->fallback_function)}}, // clang-format off R"cc( $has_bits_offset$, @@ -277,7 +258,7 @@ void ParseFunctionGenerator::GenerateParseTableHelperDefinition( class_data, $post_loop_handler$, $fallback$, // fallback - $to_prefetch$)cc" + )cc" // clang-format on ); }; diff --git a/src/google/protobuf/compiler/csharp/c_sharp_features.pb.cc b/src/google/protobuf/compiler/csharp/c_sharp_features.pb.cc index 243645442a..7bd537da04 100755 --- a/src/google/protobuf/compiler/csharp/c_sharp_features.pb.cc +++ b/src/google/protobuf/compiler/csharp/c_sharp_features.pb.cc @@ -64,9 +64,6 @@ constexpr CSharpFeatures::ParseTableT_ CSharpFeatures::_Internal::GenerateParseT class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::pb::CSharpFeatures>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // optional bool nullable_reference_types = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_MESSAGE, targets = TARGET_TYPE_FILE, edition_defaults = { {::_pbi::TcParser::SingularVarintNoZag1(), diff --git a/src/google/protobuf/compiler/java/java_features.pb.cc b/src/google/protobuf/compiler/java/java_features.pb.cc index 5455bd13af..bb2dc48401 100644 --- a/src/google/protobuf/compiler/java/java_features.pb.cc +++ b/src/google/protobuf/compiler/java/java_features.pb.cc @@ -64,9 +64,6 @@ constexpr JavaFeatures_NestInFileClassFeature::ParseTableT_ JavaFeatures_NestInF class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::pb::JavaFeatures_NestInFileClassFeature>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, }}, {{ @@ -159,9 +156,6 @@ constexpr JavaFeatures::ParseTableT_ JavaFeatures::_Internal::GenerateParseTable class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::pb::JavaFeatures>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional bool legacy_closed_enum = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index 9491533b0e..1836c2e930 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -72,9 +72,6 @@ constexpr Version::ParseTableT_ Version::_Internal::GenerateParseTable(const ::_ class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::compiler::Version>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // optional string suffix = 4; {::_pbi::TcParser::FastBS1, @@ -205,9 +202,6 @@ constexpr CodeGeneratorResponse_File::ParseTableT_ CodeGeneratorResponse_File::_ class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::compiler::CodeGeneratorResponse_File>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16; {::_pbi::TcParser::FastMcS2, @@ -344,9 +338,6 @@ constexpr CodeGeneratorResponse::ParseTableT_ CodeGeneratorResponse::_Internal:: class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::compiler::CodeGeneratorResponse>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional string error = 1; @@ -493,9 +484,6 @@ constexpr CodeGeneratorRequest::ParseTableT_ CodeGeneratorRequest::_Internal::Ge class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::compiler::CodeGeneratorRequest>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // repeated string file_to_generate = 1; diff --git a/src/google/protobuf/cpp_features.pb.cc b/src/google/protobuf/cpp_features.pb.cc index c6a84a13ea..1bfe2482f8 100644 --- a/src/google/protobuf/cpp_features.pb.cc +++ b/src/google/protobuf/cpp_features.pb.cc @@ -64,9 +64,6 @@ constexpr CppFeatures::ParseTableT_ CppFeatures::_Internal::GenerateParseTable(c class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::pb::CppFeatures>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // optional .pb.CppFeatures.RepeatedType repeated_type = 4 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { {::_pbi::TcParser::FastEr0S1, diff --git a/src/google/protobuf/cpp_file_options.pb.cc b/src/google/protobuf/cpp_file_options.pb.cc index 7bb2e06da6..b3d01c413c 100644 --- a/src/google/protobuf/cpp_file_options.pb.cc +++ b/src/google/protobuf/cpp_file_options.pb.cc @@ -65,9 +65,6 @@ constexpr CppFileOptions::ParseTableT_ CppFileOptions::_Internal::GenerateParseT class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::pb::file::CppFileOptions>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // string namespace = 1; {::_pbi::TcParser::FastUS1, diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index fec7b2eb99..7f5a4c12ea 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -136,9 +136,6 @@ constexpr UninterpretedOption_NamePart::ParseTableT_ UninterpretedOption_NamePar class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption_NamePart>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // required bool is_extension = 2; {::_pbi::TcParser::SingularVarintNoZag1(), @@ -261,9 +258,6 @@ constexpr SourceCodeInfo_Location::ParseTableT_ SourceCodeInfo_Location::_Intern class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::SourceCodeInfo_Location>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // repeated int32 path = 1 [packed = true]; @@ -424,9 +418,6 @@ constexpr GeneratedCodeInfo_Annotation::ParseTableT_ GeneratedCodeInfo_Annotatio class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::GeneratedCodeInfo_Annotation>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // repeated int32 path = 1 [packed = true]; @@ -579,9 +570,6 @@ constexpr FieldOptions_FeatureSupport::ParseTableT_ FieldOptions_FeatureSupport: class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::FieldOptions_FeatureSupport>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional .google.protobuf.Edition edition_introduced = 1; @@ -734,9 +722,6 @@ constexpr FieldOptions_EditionDefault::ParseTableT_ FieldOptions_EditionDefault: class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::FieldOptions_EditionDefault>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // optional string value = 2; {::_pbi::TcParser::FastBS1, @@ -859,9 +844,6 @@ constexpr FeatureSet_VisibilityFeature::ParseTableT_ FeatureSet_VisibilityFeatur class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet_VisibilityFeature>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, }}, {{ @@ -958,9 +940,6 @@ constexpr FeatureSet_ProtoLimitsFeature::ParseTableT_ FeatureSet_ProtoLimitsFeat class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet_ProtoLimitsFeature>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, }}, {{ @@ -1059,9 +1038,6 @@ constexpr FeatureSet::ParseTableT_ FeatureSet::_Internal::GenerateParseTable(con class_data, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::FeatureSet>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional .google.protobuf.FeatureSet.FieldPresence field_presence = 1 [retention = RETENTION_RUNTIME, targets = TARGET_TYPE_FIELD, targets = TARGET_TYPE_FILE, edition_defaults = { @@ -1248,9 +1224,6 @@ constexpr ExtensionRangeOptions_Declaration::ParseTableT_ ExtensionRangeOptions_ class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::ExtensionRangeOptions_Declaration>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional int32 number = 1; @@ -1399,9 +1372,6 @@ constexpr EnumDescriptorProto_EnumReservedRange::ParseTableT_ EnumDescriptorProt class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::EnumDescriptorProto_EnumReservedRange>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // optional int32 end = 2; {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(EnumDescriptorProto_EnumReservedRange, _impl_.end_), 1>(), @@ -1522,9 +1492,6 @@ constexpr DescriptorProto_ReservedRange::ParseTableT_ DescriptorProto_ReservedRa class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::DescriptorProto_ReservedRange>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // optional int32 end = 2; {::_pbi::TcParser::SingularVarintNoZag1<::uint32_t, offsetof(DescriptorProto_ReservedRange, _impl_.end_), 1>(), @@ -1645,9 +1612,6 @@ constexpr UninterpretedOption::ParseTableT_ UninterpretedOption::_Internal::Gene class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::UninterpretedOption>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // optional string aggregate_value = 8; {::_pbi::TcParser::FastBS1, @@ -1816,9 +1780,6 @@ constexpr SourceCodeInfo::ParseTableT_ SourceCodeInfo::_Internal::GenerateParseT class_data, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::SourceCodeInfo>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // repeated .google.protobuf.SourceCodeInfo.Location location = 1; {::_pbi::TcParser::FastMcR1, @@ -1938,9 +1899,6 @@ constexpr GeneratedCodeInfo::ParseTableT_ GeneratedCodeInfo::_Internal::Generate class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::GeneratedCodeInfo>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; {::_pbi::TcParser::FastMcR1, @@ -2060,9 +2018,6 @@ constexpr FeatureSetDefaults_FeatureSetEditionDefault::ParseTableT_ FeatureSetDe class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // optional .google.protobuf.FeatureSet overridable_features = 4; {::_pbi::TcParser::FastMcS1, @@ -2195,9 +2150,6 @@ constexpr ServiceOptions::ParseTableT_ ServiceOptions::_Internal::GenerateParseT class_data, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::ServiceOptions>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional bool deprecated = 33 [default = false]; @@ -2337,9 +2289,6 @@ constexpr OneofOptions::ParseTableT_ OneofOptions::_Internal::GenerateParseTable class_data, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::OneofOptions>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional .google.protobuf.FeatureSet features = 1; @@ -2471,9 +2420,6 @@ constexpr MethodOptions::ParseTableT_ MethodOptions::_Internal::GenerateParseTab class_data, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::MethodOptions>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional bool deprecated = 33 [default = false]; @@ -2624,9 +2570,6 @@ constexpr MessageOptions::ParseTableT_ MessageOptions::_Internal::GenerateParseT class_data, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::MessageOptions>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional bool message_set_wire_format = 1 [default = false]; @@ -2786,9 +2729,6 @@ constexpr FileOptions::ParseTableT_ FileOptions::_Internal::GenerateParseTable(c class_data, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::FileOptions>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional string java_package = 1; @@ -3073,9 +3013,6 @@ constexpr FieldOptions::ParseTableT_ FieldOptions::_Internal::GenerateParseTable class_data, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::FieldOptions>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // optional bool debug_redact = 16 [default = false]; {::_pbi::TcParser::FastV8S2, @@ -3293,9 +3230,6 @@ constexpr FeatureSetDefaults::ParseTableT_ FeatureSetDefaults::_Internal::Genera class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::FeatureSetDefaults>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // optional .google.protobuf.Edition minimum_edition = 4; {::_pbi::TcParser::FastEvS1, @@ -3427,9 +3361,6 @@ constexpr ExtensionRangeOptions::ParseTableT_ ExtensionRangeOptions::_Internal:: class_data, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::ExtensionRangeOptions>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, {::_pbi::TcParser::MiniParse, {}}, @@ -3582,9 +3513,6 @@ constexpr EnumValueOptions::ParseTableT_ EnumValueOptions::_Internal::GeneratePa class_data, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::EnumValueOptions>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional bool deprecated = 1 [default = false]; @@ -3739,9 +3667,6 @@ constexpr EnumOptions::ParseTableT_ EnumOptions::_Internal::GenerateParseTable(c class_data, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::EnumOptions>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, {::_pbi::TcParser::MiniParse, {}}, @@ -3892,9 +3817,6 @@ constexpr OneofDescriptorProto::ParseTableT_ OneofDescriptorProto::_Internal::Ge class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::OneofDescriptorProto>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // optional .google.protobuf.OneofOptions options = 2; {::_pbi::TcParser::FastMcS1, @@ -4019,9 +3941,6 @@ constexpr MethodDescriptorProto::ParseTableT_ MethodDescriptorProto::_Internal:: class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::MethodDescriptorProto>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional string name = 1; @@ -4180,9 +4099,6 @@ constexpr FieldDescriptorProto::ParseTableT_ FieldDescriptorProto::_Internal::Ge class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::FieldDescriptorProto>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional string name = 1; @@ -4382,9 +4298,6 @@ constexpr EnumValueDescriptorProto::ParseTableT_ EnumValueDescriptorProto::_Inte class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::EnumValueDescriptorProto>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional string name = 1; @@ -4517,9 +4430,6 @@ constexpr DescriptorProto_ExtensionRange::ParseTableT_ DescriptorProto_Extension class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::DescriptorProto_ExtensionRange>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional int32 start = 1; @@ -4650,9 +4560,6 @@ constexpr ServiceDescriptorProto::ParseTableT_ ServiceDescriptorProto::_Internal class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::ServiceDescriptorProto>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional string name = 1; @@ -4790,9 +4697,6 @@ constexpr EnumDescriptorProto::ParseTableT_ EnumDescriptorProto::_Internal::Gene class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::EnumDescriptorProto>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional string name = 1; @@ -4962,9 +4866,6 @@ constexpr DescriptorProto::ParseTableT_ DescriptorProto::_Internal::GeneratePars class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::DescriptorProto>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional string name = 1; @@ -5197,9 +5098,6 @@ constexpr FileDescriptorProto::ParseTableT_ FileDescriptorProto::_Internal::Gene class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::FileDescriptorProto>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ {::_pbi::TcParser::MiniParse, {}}, // optional string name = 1; @@ -5452,9 +5350,6 @@ constexpr FileDescriptorSet::ParseTableT_ FileDescriptorSet::_Internal::Generate class_data, nullptr, // post_loop_handler ::_pbi::TcParser::GenericFallback, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::google::protobuf::FileDescriptorSet>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // repeated .google.protobuf.FileDescriptorProto file = 1; {::_pbi::TcParser::FastMcR1, diff --git a/src/google/protobuf/generated_message_reflection.cc b/src/google/protobuf/generated_message_reflection.cc index 042bac646c..83a026b6fc 100644 --- a/src/google/protobuf/generated_message_reflection.cc +++ b/src/google/protobuf/generated_message_reflection.cc @@ -3859,18 +3859,7 @@ const internal::TcParseTableBase* Reflection::CreateTcParseTable() const { aux_offset, internal::GetClassData(*schema_.default_instance()), nullptr, - GetFastParseFunction(table_info.fallback_function) -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - , - nullptr -#endif // PROTOBUF_PREFETCH_PARSE_TABLE - }; -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - // We'll prefetch `to_prefetch->to_prefetch` unconditionally to avoid - // branches. Here we don't know which field is the hottest, so set the pointer - // to itself to avoid nullptr. - res->to_prefetch = res; -#endif // PROTOBUF_PREFETCH_PARSE_TABLE + GetFastParseFunction(table_info.fallback_function)}; // Now copy the rest of the payloads PopulateTcParseFastEntries(table_info, res); diff --git a/src/google/protobuf/generated_message_tctable_decl.h b/src/google/protobuf/generated_message_tctable_decl.h index dbf13e37e4..06c93ffb56 100644 --- a/src/google/protobuf/generated_message_tctable_decl.h +++ b/src/google/protobuf/generated_message_tctable_decl.h @@ -308,9 +308,6 @@ struct alignas(uint64_t) TcParseTableBase { TailCallParseFunc fallback; // A sub message's table to be prefetched. -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - const TcParseTableBase* to_prefetch; -#endif // PROTOBUF_PREFETCH_PARSE_TABLE // This constructor exactly follows the field layout, so it's technically // not necessary. However, it makes it much much easier to add or re-arrange @@ -326,12 +323,7 @@ struct alignas(uint64_t) TcParseTableBase { uint16_t num_aux_entries, uint32_t aux_offset, const ClassData* class_data, PostLoopHandler post_loop_handler, - TailCallParseFunc fallback -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - , - const TcParseTableBase* to_prefetch -#endif // PROTOBUF_PREFETCH_PARSE_TABLE - ) + TailCallParseFunc fallback) : has_bits_offset(has_bits_offset), extension_offset(extension_offset), max_field_number(max_field_number), @@ -345,13 +337,7 @@ struct alignas(uint64_t) TcParseTableBase { aux_offset(aux_offset), class_data(class_data), post_loop_handler(post_loop_handler), - fallback(fallback) -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - , - to_prefetch(to_prefetch) -#endif // PROTOBUF_PREFETCH_PARSE_TABLE - { - } + fallback(fallback) {} // Table entry for fast-path tailcall dispatch handling. struct FastFieldEntry { @@ -609,9 +595,6 @@ constexpr TcParseTable<0> CreateStubTcParseTable( class_data, // post_loop_handler, // nullptr, // fallback -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - nullptr, // to_prefetch -#endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{{StubParseImpl, {}}}}, }; diff --git a/src/google/protobuf/generated_message_tctable_lite_test.cc b/src/google/protobuf/generated_message_tctable_lite_test.cc index ad68626779..ad4afdcb25 100644 --- a/src/google/protobuf/generated_message_tctable_lite_test.cc +++ b/src/google/protobuf/generated_message_tctable_lite_test.cc @@ -114,9 +114,6 @@ TEST(FastVarints, NameHere) { &class_data, nullptr, // post_loop_handler FastParserGaveUp, // fallback -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - nullptr, // to_prefetch -#endif // PROTOBUF_PREFETCH_PARSE_TABLE }, // Fast Table: {{ @@ -308,9 +305,6 @@ TEST(IsEntryForFieldNumTest, Matcher) { nullptr, // default instance nullptr, // post_loop_handler nullptr, // fallback function -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - nullptr, // to_prefetch -#endif // PROTOBUF_PREFETCH_PARSE_TABLE }}; // clang-format on int table_field_numbers[] = {1, 2, 3}; @@ -415,9 +409,6 @@ TEST_F(FindFieldEntryTest, SequentialFieldRange) { nullptr, // default instance nullptr, // post_loop_handler {}, // fallback function -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - nullptr, // to_prefetch -#endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {}, // fast_entries // field_lookup_table for 2, 3, 4, 5, 111: @@ -459,9 +450,6 @@ TEST_F(FindFieldEntryTest, SmallScanRange) { nullptr, // default instance nullptr, // post_loop_handler {}, // fallback function -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - nullptr, // to_prefetch -#endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {}, // fast_entries // field_lookup_table for 1, 3, 4, 5, 7, 111: @@ -511,9 +499,6 @@ TEST_F(FindFieldEntryTest, BinarySearchRange) { nullptr, // default instance nullptr, // post_loop_handler {}, // fallback function -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - nullptr, // to_prefetch -#endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {}, // fast_entries // field_lookup_table for 1, 3, 4, 5, 6, 8, 9, 11, 12, 70 @@ -560,9 +545,6 @@ TEST_F(FindFieldEntryTest, OutOfRange) { nullptr, // default instance nullptr, // post_loop_handler {}, // fallback function -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - nullptr, // to_prefetch -#endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {}, // fast_entries {{// field lookup table @@ -614,9 +596,6 @@ TEST_F(FindFieldEntryTest, EmptyMessage) { nullptr, // default instance nullptr, // post_loop_handler nullptr, // fallback function -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - nullptr, // to_prefetch -#endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {}, // fast_entries {{// empty field lookup table @@ -668,9 +647,6 @@ const TcParseTable<5, 134, 5, 2176, 55> test_all_types_table = { nullptr, // default instance nullptr, // post_loop_handler nullptr, // fallback function -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE - nullptr, // to_prefetch -#endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // tail-call table diff --git a/src/google/protobuf/json_enumvalue_options.pb.cc b/src/google/protobuf/json_enumvalue_options.pb.cc index e226c16412..e37cc9439d 100644 --- a/src/google/protobuf/json_enumvalue_options.pb.cc +++ b/src/google/protobuf/json_enumvalue_options.pb.cc @@ -65,9 +65,6 @@ constexpr JsonEnumValueOptions::ParseTableT_ JsonEnumValueOptions::_Internal::Ge class_data, nullptr, // post_loop_handler ::_pbi::TcParser::MpUnknownFields, // fallback - #ifdef PROTOBUF_PREFETCH_PARSE_TABLE - ::_pbi::TcParser::GetTable<::pb::enumvalue::JsonEnumValueOptions>(), // to_prefetch - #endif // PROTOBUF_PREFETCH_PARSE_TABLE }, {{ // string string = 1; {::_pbi::TcParser::FastUS1, diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index 7be69df070..f03e592b8b 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -593,11 +593,6 @@ #define PROTOBUF_DESCRIPTOR_WEAK_MESSAGES_ALLOWED #endif -// TODO: Enable the feature by default and remove this flag. -#ifdef PROTOBUF_PREFETCH_PARSE_TABLE -#error PROTOBUF_PREFETCH_PARSE_TABLE was previously defined -#endif - #ifdef PROTOBUF_PREFETCH_WITH_OFFSET #error PROTOBUF_PREFETCH_WITH_OFFSET was previously defined #endif diff --git a/src/google/protobuf/port_undef.inc b/src/google/protobuf/port_undef.inc index f00fbf9386..34386d6198 100644 --- a/src/google/protobuf/port_undef.inc +++ b/src/google/protobuf/port_undef.inc @@ -63,7 +63,6 @@ #undef PROTOBUF_OVERRIDE #undef PROTOBUF_FINAL #undef PROTOBUF_DESCRIPTOR_WEAK_MESSAGES_ALLOWED -#undef PROTOBUF_PREFETCH_PARSE_TABLE #undef PROTOBUF_PREFETCH_WITH_OFFSET #undef PROTOBUF_DEBUG_COUNTER #undef PROTOBUF_TC_PARAM_DECL