Internal change.

PiperOrigin-RevId: 546314630
pull/13241/head
Protobuf Team Bot 1 year ago committed by Copybara-Service
parent d603b4199e
commit 3a3df3057b
  1. 5
      src/google/protobuf/compiler/cpp/helpers.cc
  2. 3
      src/google/protobuf/compiler/cpp/helpers.h
  3. 1
      src/google/protobuf/compiler/cpp/parse_function_generator.cc
  4. 1
      src/google/protobuf/generated_message_reflection.cc
  5. 12
      src/google/protobuf/generated_message_tctable_gen.cc
  6. 2
      src/google/protobuf/generated_message_tctable_gen.h

@ -896,6 +896,11 @@ bool IsRarelyPresent(const FieldDescriptor* field, const Options& options) {
return false;
}
float GetPresenceProbability(const FieldDescriptor* field,
const Options& options) {
return 1.f;
}
bool IsStringInlined(const FieldDescriptor* field, const Options& options) {
(void)field;
(void)options;

@ -367,6 +367,9 @@ bool IsProfileDriven(const Options& options);
// Returns true if `field` is unlikely to be present based on PDProto profile.
bool IsRarelyPresent(const FieldDescriptor* field, const Options& options);
float GetPresenceProbability(const FieldDescriptor* field,
const Options& options);
// Returns true if `field` should be inlined based on PDProto profile.
bool IsStringInlined(const FieldDescriptor* field, const Options& options);

@ -114,6 +114,7 @@ class ParseFunctionGenerator::GeneratedOptionProvider final
return internal::field_layout::TransformValidation{};
};
return {
GetPresenceProbability(field, gen_->options_),
verify_flag(),
IsStringInlined(field, gen_->options_),
IsImplicitWeakField(field, gen_->options_, gen_->scc_analyzer_),

@ -3391,6 +3391,7 @@ const internal::TcParseTableBase* Reflection::CreateTcParseTable() const {
return internal::field_layout::TransformValidation{};
};
return {
1.f, // All fields are assumed present.
verify_flag(), //
ref_.IsInlined(field), //

@ -391,12 +391,18 @@ std::vector<TailCallTableInfo::FastFieldInfo> SplitFastFieldsForSize(
TailCallTableInfo::FastFieldInfo& info = result[fast_idx];
if (!info.func_name.empty()) {
// This field entry is already filled.
continue;
// Null field means END_GROUP which is guaranteed to be present.
if (info.field == nullptr) continue;
// This field entry is already filled. Skip if previous entry is more
// likely present.
const auto prev_options = option_provider.GetForField(info.field);
if (prev_options.presence_probability >= options.presence_probability) {
continue;
}
}
// Fill in this field's entry:
ABSL_CHECK(info.func_name.empty()) << info.func_name;
PopulateFastFieldEntry(entry, options, info);
info.field = field;
info.coded_tag = tag;

@ -57,6 +57,8 @@ enum TransformValidation : uint16_t;
// Helper class for generating tailcall parsing functions.
struct PROTOBUF_EXPORT TailCallTableInfo {
struct PerFieldOptions {
// For presence awareness (e.g. PDProto).
float presence_probability;
// kTvEager, kTvLazy, or 0
field_layout::TransformValidation lazy_opt;
bool is_string_inlined;

Loading…
Cancel
Save