diff --git a/editions/golden/compare_cpp_codegen_failure.xml b/editions/golden/compare_cpp_codegen_failure.xml index 1f423bf08c..824b12a969 100644 --- a/editions/golden/compare_cpp_codegen_failure.xml +++ b/editions/golden/compare_cpp_codegen_failure.xml @@ -2,7 +2,7 @@ - + diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc index 857abf057d..6c709ea4cf 100644 --- a/src/google/protobuf/arena_unittest.cc +++ b/src/google/protobuf/arena_unittest.cc @@ -528,7 +528,6 @@ class DispatcherTestProto : public Message { : Message(nullptr, nullptr) { ABSL_LOG(FATAL); } - DispatcherTestProto* New(Arena*) const PROTOBUF_FINAL { ABSL_LOG(FATAL); } const ClassData* GetClassData() const PROTOBUF_FINAL { ABSL_LOG(FATAL); } }; // We use a specialization to inject behavior for the test. diff --git a/src/google/protobuf/compiler/cpp/file.cc b/src/google/protobuf/compiler/cpp/file.cc index 246e09fa09..9ad4783d4d 100644 --- a/src/google/protobuf/compiler/cpp/file.cc +++ b/src/google/protobuf/compiler/cpp/file.cc @@ -489,6 +489,7 @@ void FileGenerator::GenerateSourceIncludes(io::Printer* p) { IncludeFile("third_party/protobuf/generated_message_tctable_impl.h", p); // TODO This is to include parse_context.h, we need a better way IncludeFile("third_party/protobuf/extension_set.h", p); + IncludeFile("third_party/protobuf/generated_message_util.h", p); IncludeFile("third_party/protobuf/wire_format_lite.h", p); if (ShouldVerify(file_, options_, &scc_analyzer_)) { diff --git a/src/google/protobuf/compiler/cpp/file_unittest.cc b/src/google/protobuf/compiler/cpp/file_unittest.cc index c494dd5538..e667736538 100644 --- a/src/google/protobuf/compiler/cpp/file_unittest.cc +++ b/src/google/protobuf/compiler/cpp/file_unittest.cc @@ -115,6 +115,9 @@ TEST(FileTest, TopologicallyOrderedDescriptors) { "OneBytes", "MoreString", "MoreBytes", + "MessageCreatorZeroInit", + "MessageCreatorMemcpy.M2Entry", + "MessageCreatorFunc", "ManyOptionalString", "Int64ParseTester", "Int64Message", @@ -153,6 +156,7 @@ TEST(FileTest, TopologicallyOrderedDescriptors) { "TestCamelCaseFieldNames", "TestAllTypes", "RedactedFields", + "MessageCreatorMemcpy", "TestVerifyUint32BigFieldNumber", "TestVerifyUint32", "TestVerifyOneUint32", @@ -206,9 +210,6 @@ TEST(FileTest, TopologicallyOrderedDescriptors) { EXPECT_TRUE(match) << "failed to match; expected " << kExpectedDescriptorOrder[i] << ", got " << desc->full_name(); - if (!match) { - break; - } } } diff --git a/src/google/protobuf/compiler/cpp/message.cc b/src/google/protobuf/compiler/cpp/message.cc index cdeeedb935..daf0ed3615 100644 --- a/src/google/protobuf/compiler/cpp/message.cc +++ b/src/google/protobuf/compiler/cpp/message.cc @@ -1389,12 +1389,17 @@ void MessageGenerator::GenerateMapEntryClassDefinition(io::Printer* p) { $decl_verify_func$; private: + friend class ::$proto_ns$::MessageLite; + friend struct ::$tablename$; + $parse_decls$; $decl_annotate$; const $superclass$::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::$proto_ns$::Arena* arena); + static constexpr auto InternalNewImpl_(); static const $superclass$::ClassDataFull _class_data_; - friend struct ::$tablename$; }; )cc"); } @@ -2134,7 +2139,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { // implements Message ---------------------------------------------- - $classname$* New(::$proto_ns$::Arena* arena = nullptr) const PROTOBUF_FINAL { + $classname$* New(::$proto_ns$::Arena* arena = nullptr) const { return $superclass$::DefaultConstruct<$classname$>(arena); } $generated_methods$; @@ -2159,6 +2164,9 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) { } $arena_dtor$; const $superclass$::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::$proto_ns$::Arena* arena); + static constexpr auto InternalNewImpl_(); static const $superclass$::$classdata_type$ _class_data_; public: @@ -3788,12 +3796,176 @@ void MessageGenerator::GenerateSwap(io::Printer* p) { format("}\n"); } +MessageGenerator::NewOpRequirements MessageGenerator::GetNewOp( + io::Printer* arena_emitter) const { + size_t arena_seeding_count = 0; + NewOpRequirements op; + if (IsBootstrapProto(options_, descriptor_->file())) { + // To simplify bootstrapping we always use a function for these types. + // It makes it easier to change the ABI of the `MessageCreator` class. + op.needs_to_run_constructor = true; + return op; + } + + if (NeedsArenaDestructor() == ArenaDtorNeeds::kRequired) { + // We can't skip the ArenaDtor for these messages. + op.needs_to_run_constructor = true; + } + + if (descriptor_->extension_range_count() > 0) { + op.needs_arena_seeding = true; + ++arena_seeding_count; + if (arena_emitter) { + arena_emitter->Emit(R"cc( + PROTOBUF_FIELD_OFFSET($classname$, $extensions$) + + decltype($classname$::$extensions$)::InternalGetArenaOffset( + $superclass$::internal_visibility()), + )cc"); + } + } + + if (num_weak_fields_ != 0) { + op.needs_to_run_constructor = true; + } + + for (const FieldDescriptor* field : FieldRange(descriptor_)) { + const auto print_arena_offset = [&](absl::string_view suffix = "") { + ++arena_seeding_count; + if (arena_emitter) { + arena_emitter->Emit( + {{"field", FieldMemberName(field, false)}, {"suffix", suffix}}, + R"cc( + PROTOBUF_FIELD_OFFSET($classname$, $field$) + + decltype($classname$::$field$):: + InternalGetArenaOffset$suffix$( + $superclass$::internal_visibility()), + )cc"); + } + }; + if (ShouldSplit(field, options_)) { + op.needs_memcpy = true; + } else if (field->real_containing_oneof() != nullptr) { + /* nothing to do */ + } else if (field->is_map()) { + op.needs_arena_seeding = true; + // MapField contains an internal vtable pointer we need to copy. + op.needs_memcpy = true; + print_arena_offset(); + // Non-lite maps currently have more than one arena pointer in them. Print + // both. + if (HasDescriptorMethods(descriptor_->file(), options_)) { + print_arena_offset("Alt"); + } + } else if (field->is_repeated()) { + op.needs_arena_seeding = true; + print_arena_offset(); + } else { + const auto& generator = field_generators_.get(field); + if (generator.has_trivial_zero_default()) { + /* nothing to do */ + } else { + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_INT32: + case FieldDescriptor::CPPTYPE_INT64: + case FieldDescriptor::CPPTYPE_UINT32: + case FieldDescriptor::CPPTYPE_UINT64: + case FieldDescriptor::CPPTYPE_DOUBLE: + case FieldDescriptor::CPPTYPE_FLOAT: + case FieldDescriptor::CPPTYPE_BOOL: + case FieldDescriptor::CPPTYPE_ENUM: + op.needs_memcpy = true; + break; + + case FieldDescriptor::CPPTYPE_STRING: + switch (internal::cpp::EffectiveStringCType(field)) { + case FieldOptions::STRING_PIECE: + op.needs_arena_seeding = true; + print_arena_offset(); + break; + case FieldOptions::CORD: + // Cord fields are currently rejected above because of ArenaDtor + // requirements. + ABSL_CHECK(op.needs_to_run_constructor); + break; + case FieldOptions::STRING: + op.needs_memcpy = true; + break; + default: + ABSL_LOG(FATAL); + } + break; + case FieldDescriptor::CPPTYPE_MESSAGE: + ABSL_LOG(FATAL) << "Message should be zero initializable."; + break; + } + } + } + } + + // If we are going to generate too many arena seeding offsets, we can skip the + // attempt because we know it will fail at compile time and fallback to + // placement new. The arena seeding code can handle up to an offset of + // `63 * sizeof(Arena*)`. + // This prevents generating huge lists that have to be run during constant + // evaluation to just fail anyway. The actual upper bound is smaller than + // this, but any reasonable value is enough to prevent long compile times for + // big messages. + if (arena_seeding_count >= 64) { + op.needs_to_run_constructor = true; + } + + return op; +} + void MessageGenerator::GenerateClassData(io::Printer* p) { + const auto new_op = GetNewOp(nullptr); + // Always generate PlacementNew_ because we might need it for different + // reasons. EnableCustomNewFor might be false in this compiler, or the + // object might be too large for arena seeding. + // We mark `inline` to avoid library bloat if the function is unused. + p->Emit(R"cc( + inline void* $classname$::PlacementNew_(const void*, void* mem, + ::$proto_ns$::Arena* arena) { + return ::new (mem) $classname$(arena); + } + )cc"); + if (new_op.needs_to_run_constructor) { + p->Emit(R"cc( + constexpr auto $classname$::InternalNewImpl_() { + return $pbi$::MessageCreator(&$classname$::PlacementNew_, + sizeof($classname$)); + } + )cc"); + } else if (new_op.needs_arena_seeding) { + p->Emit({{"copy_type", new_op.needs_memcpy ? "CopyInit" : "ZeroInit"}, + {"arena_offsets", [&] { GetNewOp(p); }}}, + R"cc( + constexpr auto $classname$::InternalNewImpl_() { + constexpr auto arena_bits = $pbi$::EncodePlacementArenaOffsets({ + $arena_offsets$, + }); + if (arena_bits.has_value()) { + return $pbi$::MessageCreator::$copy_type$(sizeof($classname$), *arena_bits); + } else { + return $pbi$::MessageCreator(&$classname$::PlacementNew_, + sizeof($classname$)); + } + } + )cc"); + } else { + p->Emit({{"copy_type", new_op.needs_memcpy ? "CopyInit" : "ZeroInit"}, + {"arena_offsets", [&] { GetNewOp(p); }}}, + R"cc( + constexpr auto $classname$::InternalNewImpl_() { + return $pbi$::MessageCreator::$copy_type$(sizeof($classname$)); + } + )cc"); + } + auto vars = p->WithVars( {{"default_instance", absl::StrCat("&", DefaultInstanceName(descriptor_, options_), "._instance")}}); - const auto on_demand_register_arena_dtor = [&] { if (NeedsArenaDestructor() == ArenaDtorNeeds::kOnDemand) { p->Emit(R"cc( @@ -3883,9 +4055,9 @@ void MessageGenerator::GenerateClassData(io::Printer* p) { $on_demand_register_arena_dtor$, $is_initialized$, &$classname$::MergeImpl, + $superclass$::GetNewImpl<$classname$>(), #if defined(PROTOBUF_CUSTOM_VTABLE) $superclass$::GetDeleteImpl<$classname$>(), - $superclass$::GetNewImpl<$classname$>(), $custom_vtable_methods$, #endif // PROTOBUF_CUSTOM_VTABLE PROTOBUF_FIELD_OFFSET($classname$, $cached_size$), @@ -3921,9 +4093,9 @@ void MessageGenerator::GenerateClassData(io::Printer* p) { $on_demand_register_arena_dtor$, $is_initialized$, &$classname$::MergeImpl, + $superclass$::GetNewImpl<$classname$>(), #if defined(PROTOBUF_CUSTOM_VTABLE) $superclass$::GetDeleteImpl<$classname$>(), - $superclass$::GetNewImpl<$classname$>(), $custom_vtable_methods$, #endif // PROTOBUF_CUSTOM_VTABLE PROTOBUF_FIELD_OFFSET($classname$, $cached_size$), diff --git a/src/google/protobuf/compiler/cpp/message.h b/src/google/protobuf/compiler/cpp/message.h index 46bade9db7..f77eaadd88 100644 --- a/src/google/protobuf/compiler/cpp/message.h +++ b/src/google/protobuf/compiler/cpp/message.h @@ -134,6 +134,17 @@ class MessageGenerator { void GenerateIsInitialized(io::Printer* p); bool NeedsIsInitialized(); + struct NewOpRequirements { + // Some field is initialized to non-zero values. Eg string fields pointing + // to default string. + bool needs_memcpy = false; + // Some field has a copy of the arena. + bool needs_arena_seeding = false; + // Some field has logic that needs to run. + bool needs_to_run_constructor = false; + }; + NewOpRequirements GetNewOp(io::Printer* arena_emitter) const; + // Helpers for GenerateSerializeWithCachedSizes(). // // cached_has_bit_index maintains that: diff --git a/src/google/protobuf/compiler/cpp/parse_function_generator.cc b/src/google/protobuf/compiler/cpp/parse_function_generator.cc index 69d1103a1a..d0a1731ddf 100644 --- a/src/google/protobuf/compiler/cpp/parse_function_generator.cc +++ b/src/google/protobuf/compiler/cpp/parse_function_generator.cc @@ -490,10 +490,6 @@ void ParseFunctionGenerator::GenerateTailCallTable(io::Printer* printer) { )cc"); break; } - case TailCallTableInfo::kCreateInArena: - format("{::_pbi::TcParser::CreateInArenaStorageCb<$1$>},\n", - QualifiedClassName(aux_entry.desc, options_)); - break; } } } diff --git a/src/google/protobuf/compiler/cpp/test_bad_identifiers.proto b/src/google/protobuf/compiler/cpp/test_bad_identifiers.proto index 430b92700f..e375362aaa 100644 --- a/src/google/protobuf/compiler/cpp/test_bad_identifiers.proto +++ b/src/google/protobuf/compiler/cpp/test_bad_identifiers.proto @@ -69,18 +69,32 @@ message TestConflictingSymbolNames { optional int32 controller = 14; optional int32 already_here = 15; + // Integral types + optional uint32 uint8 = 47; + optional uint32 uint8_t = 48; + optional uint32 uint16 = 49; + optional uint32 uint16_t = 50; optional uint32 uint32 = 16; optional uint32 uint32_t = 41; optional uint64 uint64 = 17; optional uint32 uint64_t = 42; - optional string string = 18; - optional int32 memset = 19; + optional uint32 int8 = 51; + optional uint32 int8_t = 52; + optional uint32 int16 = 53; + optional uint32 int16_t = 54; optional int32 int32 = 20; optional int32 int32_t = 43; optional int64 int64 = 21; optional int64 int64_t = 44; optional int64 size_t = 45; + optional int64 ssize_t = 55; + optional int64 intptr_t = 46; + optional int64 uintptr_t = 56; + + optional string string = 18; + optional int32 memset = 19; + // Internal identifier optional uint32 cached_size = 22; optional uint32 extensions = 23; optional uint32 bit = 24; diff --git a/src/google/protobuf/compiler/java/java_features.pb.cc b/src/google/protobuf/compiler/java/java_features.pb.cc index f4799713bc..4c92088b6c 100644 --- a/src/google/protobuf/compiler/java/java_features.pb.cc +++ b/src/google/protobuf/compiler/java/java_features.pb.cc @@ -10,6 +10,7 @@ #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/generated_message_tctable_impl.h" #include "google/protobuf/extension_set.h" +#include "google/protobuf/generated_message_util.h" #include "google/protobuf/wire_format_lite.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/generated_message_reflection.h" @@ -193,6 +194,13 @@ inline void JavaFeatures::SharedDtor() { _impl_.~Impl_(); } +inline void* JavaFeatures::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) JavaFeatures(arena); +} +constexpr auto JavaFeatures::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(JavaFeatures)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -203,9 +211,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized &JavaFeatures::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &JavaFeatures::ByteSizeLong, &JavaFeatures::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE diff --git a/src/google/protobuf/compiler/java/java_features.pb.h b/src/google/protobuf/compiler/java/java_features.pb.h index 2f851642ca..add37c10b3 100644 --- a/src/google/protobuf/compiler/java/java_features.pb.h +++ b/src/google/protobuf/compiler/java/java_features.pb.h @@ -175,7 +175,7 @@ class PROTOC_EXPORT JavaFeatures final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - JavaFeatures* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + JavaFeatures* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -231,6 +231,9 @@ class PROTOC_EXPORT JavaFeatures final : public ::google::protobuf::Message *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc index 95c78cd993..3f22130ece 100644 --- a/src/google/protobuf/compiler/plugin.pb.cc +++ b/src/google/protobuf/compiler/plugin.pb.cc @@ -10,6 +10,7 @@ #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/generated_message_tctable_impl.h" #include "google/protobuf/extension_set.h" +#include "google/protobuf/generated_message_util.h" #include "google/protobuf/wire_format_lite.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/generated_message_reflection.h" @@ -391,6 +392,13 @@ inline void Version::SharedDtor() { _impl_.~Impl_(); } +inline void* Version::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) Version(arena); +} +constexpr auto Version::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(Version)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -401,9 +409,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized &Version::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &Version::ByteSizeLong, &Version::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -725,6 +733,32 @@ inline void CodeGeneratorRequest::SharedDtor() { _impl_.~Impl_(); } +inline void* CodeGeneratorRequest::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) CodeGeneratorRequest(arena); +} +constexpr auto CodeGeneratorRequest::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(CodeGeneratorRequest, _impl_.file_to_generate_) + + decltype(CodeGeneratorRequest::_impl_.file_to_generate_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(CodeGeneratorRequest, _impl_.proto_file_) + + decltype(CodeGeneratorRequest::_impl_.proto_file_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(CodeGeneratorRequest, _impl_.source_file_descriptors_) + + decltype(CodeGeneratorRequest::_impl_.source_file_descriptors_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(CodeGeneratorRequest), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&CodeGeneratorRequest::PlacementNew_, + sizeof(CodeGeneratorRequest)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -735,9 +769,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor CodeGeneratorRequest::IsInitializedImpl, &CodeGeneratorRequest::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &CodeGeneratorRequest::ByteSizeLong, &CodeGeneratorRequest::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -1114,6 +1148,13 @@ inline void CodeGeneratorResponse_File::SharedDtor() { _impl_.~Impl_(); } +inline void* CodeGeneratorResponse_File::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) CodeGeneratorResponse_File(arena); +} +constexpr auto CodeGeneratorResponse_File::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(CodeGeneratorResponse_File)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -1124,9 +1165,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized &CodeGeneratorResponse_File::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &CodeGeneratorResponse_File::ByteSizeLong, &CodeGeneratorResponse_File::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -1458,6 +1499,24 @@ inline void CodeGeneratorResponse::SharedDtor() { _impl_.~Impl_(); } +inline void* CodeGeneratorResponse::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) CodeGeneratorResponse(arena); +} +constexpr auto CodeGeneratorResponse::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(CodeGeneratorResponse, _impl_.file_) + + decltype(CodeGeneratorResponse::_impl_.file_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(CodeGeneratorResponse), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&CodeGeneratorResponse::PlacementNew_, + sizeof(CodeGeneratorResponse)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -1468,9 +1527,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized &CodeGeneratorResponse::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &CodeGeneratorResponse::ByteSizeLong, &CodeGeneratorResponse::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index 107bbbf8bd..9c18b53b2a 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -192,7 +192,7 @@ class PROTOC_EXPORT Version final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - Version* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + Version* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -248,6 +248,9 @@ class PROTOC_EXPORT Version final : public ::google::protobuf::Message *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -425,7 +428,7 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf // implements Message ---------------------------------------------- - CodeGeneratorResponse_File* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + CodeGeneratorResponse_File* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -481,6 +484,9 @@ class PROTOC_EXPORT CodeGeneratorResponse_File final : public ::google::protobuf *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -674,7 +680,7 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes // implements Message ---------------------------------------------- - CodeGeneratorResponse* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + CodeGeneratorResponse* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -730,6 +736,9 @@ class PROTOC_EXPORT CodeGeneratorResponse final : public ::google::protobuf::Mes *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -947,7 +956,7 @@ class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Mess // implements Message ---------------------------------------------- - CodeGeneratorRequest* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + CodeGeneratorRequest* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1008,6 +1017,9 @@ class PROTOC_EXPORT CodeGeneratorRequest final : public ::google::protobuf::Mess *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: diff --git a/src/google/protobuf/cpp_features.pb.cc b/src/google/protobuf/cpp_features.pb.cc index e1cdb53896..50f1979657 100644 --- a/src/google/protobuf/cpp_features.pb.cc +++ b/src/google/protobuf/cpp_features.pb.cc @@ -10,6 +10,7 @@ #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/generated_message_tctable_impl.h" #include "google/protobuf/extension_set.h" +#include "google/protobuf/generated_message_util.h" #include "google/protobuf/wire_format_lite.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/generated_message_reflection.h" @@ -193,6 +194,13 @@ inline void CppFeatures::SharedDtor() { _impl_.~Impl_(); } +inline void* CppFeatures::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) CppFeatures(arena); +} +constexpr auto CppFeatures::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(CppFeatures)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -203,9 +211,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized &CppFeatures::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &CppFeatures::ByteSizeLong, &CppFeatures::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE diff --git a/src/google/protobuf/cpp_features.pb.h b/src/google/protobuf/cpp_features.pb.h index 3c09b51fea..22d009042b 100644 --- a/src/google/protobuf/cpp_features.pb.h +++ b/src/google/protobuf/cpp_features.pb.h @@ -176,7 +176,7 @@ class PROTOBUF_EXPORT CppFeatures final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - CppFeatures* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + CppFeatures* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -232,6 +232,9 @@ class PROTOBUF_EXPORT CppFeatures final : public ::google::protobuf::Message *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index d999dc5eb5..2e07e9bd7b 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -10,6 +10,7 @@ #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/generated_message_tctable_impl.h" #include "google/protobuf/extension_set.h" +#include "google/protobuf/generated_message_util.h" #include "google/protobuf/wire_format_lite.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/generated_message_reflection.h" @@ -2655,6 +2656,24 @@ inline void FileDescriptorSet::SharedDtor() { _impl_.~Impl_(); } +inline void* FileDescriptorSet::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) FileDescriptorSet(arena); +} +constexpr auto FileDescriptorSet::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(FileDescriptorSet, _impl_.file_) + + decltype(FileDescriptorSet::_impl_.file_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(FileDescriptorSet), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&FileDescriptorSet::PlacementNew_, + sizeof(FileDescriptorSet)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -2665,9 +2684,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor FileDescriptorSet::IsInitializedImpl, &FileDescriptorSet::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &FileDescriptorSet::ByteSizeLong, &FileDescriptorSet::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -2925,6 +2944,48 @@ inline void FileDescriptorProto::SharedDtor() { _impl_.~Impl_(); } +inline void* FileDescriptorProto::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) FileDescriptorProto(arena); +} +constexpr auto FileDescriptorProto::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_.dependency_) + + decltype(FileDescriptorProto::_impl_.dependency_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_.public_dependency_) + + decltype(FileDescriptorProto::_impl_.public_dependency_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_.weak_dependency_) + + decltype(FileDescriptorProto::_impl_.weak_dependency_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_.message_type_) + + decltype(FileDescriptorProto::_impl_.message_type_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_.enum_type_) + + decltype(FileDescriptorProto::_impl_.enum_type_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_.service_) + + decltype(FileDescriptorProto::_impl_.service_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(FileDescriptorProto, _impl_.extension_) + + decltype(FileDescriptorProto::_impl_.extension_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(FileDescriptorProto), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&FileDescriptorProto::PlacementNew_, + sizeof(FileDescriptorProto)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -2935,9 +2996,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor FileDescriptorProto::IsInitializedImpl, &FileDescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &FileDescriptorProto::ByteSizeLong, &FileDescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -3540,6 +3601,13 @@ inline void DescriptorProto_ExtensionRange::SharedDtor() { _impl_.~Impl_(); } +inline void* DescriptorProto_ExtensionRange::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) DescriptorProto_ExtensionRange(arena); +} +constexpr auto DescriptorProto_ExtensionRange::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(DescriptorProto_ExtensionRange)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -3550,9 +3618,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor DescriptorProto_ExtensionRange::IsInitializedImpl, &DescriptorProto_ExtensionRange::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &DescriptorProto_ExtensionRange::ByteSizeLong, &DescriptorProto_ExtensionRange::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -3828,6 +3896,13 @@ inline void DescriptorProto_ReservedRange::SharedDtor() { _impl_.~Impl_(); } +inline void* DescriptorProto_ReservedRange::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) DescriptorProto_ReservedRange(arena); +} +constexpr auto DescriptorProto_ReservedRange::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(DescriptorProto_ReservedRange)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -3838,9 +3913,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized &DescriptorProto_ReservedRange::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &DescriptorProto_ReservedRange::ByteSizeLong, &DescriptorProto_ReservedRange::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -4111,6 +4186,52 @@ inline void DescriptorProto::SharedDtor() { _impl_.~Impl_(); } +inline void* DescriptorProto::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) DescriptorProto(arena); +} +constexpr auto DescriptorProto::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(DescriptorProto, _impl_.field_) + + decltype(DescriptorProto::_impl_.field_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(DescriptorProto, _impl_.extension_) + + decltype(DescriptorProto::_impl_.extension_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(DescriptorProto, _impl_.nested_type_) + + decltype(DescriptorProto::_impl_.nested_type_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(DescriptorProto, _impl_.enum_type_) + + decltype(DescriptorProto::_impl_.enum_type_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(DescriptorProto, _impl_.extension_range_) + + decltype(DescriptorProto::_impl_.extension_range_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(DescriptorProto, _impl_.oneof_decl_) + + decltype(DescriptorProto::_impl_.oneof_decl_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(DescriptorProto, _impl_.reserved_range_) + + decltype(DescriptorProto::_impl_.reserved_range_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(DescriptorProto, _impl_.reserved_name_) + + decltype(DescriptorProto::_impl_.reserved_name_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(DescriptorProto), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&DescriptorProto::PlacementNew_, + sizeof(DescriptorProto)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -4121,9 +4242,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor DescriptorProto::IsInitializedImpl, &DescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &DescriptorProto::ByteSizeLong, &DescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -4659,6 +4780,13 @@ inline void ExtensionRangeOptions_Declaration::SharedDtor() { _impl_.~Impl_(); } +inline void* ExtensionRangeOptions_Declaration::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) ExtensionRangeOptions_Declaration(arena); +} +constexpr auto ExtensionRangeOptions_Declaration::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(ExtensionRangeOptions_Declaration)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -4669,9 +4797,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized &ExtensionRangeOptions_Declaration::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &ExtensionRangeOptions_Declaration::ByteSizeLong, &ExtensionRangeOptions_Declaration::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -5014,6 +5142,31 @@ inline void ExtensionRangeOptions::SharedDtor() { _impl_.~Impl_(); } +inline void* ExtensionRangeOptions::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) ExtensionRangeOptions(arena); +} +constexpr auto ExtensionRangeOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions, _impl_._extensions_) + + decltype(ExtensionRangeOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions, _impl_.uninterpreted_option_) + + decltype(ExtensionRangeOptions::_impl_.uninterpreted_option_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(ExtensionRangeOptions, _impl_.declaration_) + + decltype(ExtensionRangeOptions::_impl_.declaration_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(ExtensionRangeOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&ExtensionRangeOptions::PlacementNew_, + sizeof(ExtensionRangeOptions)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -5024,9 +5177,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor ExtensionRangeOptions::IsInitializedImpl, &ExtensionRangeOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &ExtensionRangeOptions::ByteSizeLong, &ExtensionRangeOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -5403,6 +5556,13 @@ inline void FieldDescriptorProto::SharedDtor() { _impl_.~Impl_(); } +inline void* FieldDescriptorProto::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) FieldDescriptorProto(arena); +} +constexpr auto FieldDescriptorProto::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(FieldDescriptorProto)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -5413,9 +5573,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor FieldDescriptorProto::IsInitializedImpl, &FieldDescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &FieldDescriptorProto::ByteSizeLong, &FieldDescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -5927,6 +6087,13 @@ inline void OneofDescriptorProto::SharedDtor() { _impl_.~Impl_(); } +inline void* OneofDescriptorProto::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) OneofDescriptorProto(arena); +} +constexpr auto OneofDescriptorProto::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(OneofDescriptorProto)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -5937,9 +6104,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor OneofDescriptorProto::IsInitializedImpl, &OneofDescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &OneofDescriptorProto::ByteSizeLong, &OneofDescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -6195,6 +6362,13 @@ inline void EnumDescriptorProto_EnumReservedRange::SharedDtor() { _impl_.~Impl_(); } +inline void* EnumDescriptorProto_EnumReservedRange::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) EnumDescriptorProto_EnumReservedRange(arena); +} +constexpr auto EnumDescriptorProto_EnumReservedRange::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(EnumDescriptorProto_EnumReservedRange)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -6205,9 +6379,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized &EnumDescriptorProto_EnumReservedRange::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &EnumDescriptorProto_EnumReservedRange::ByteSizeLong, &EnumDescriptorProto_EnumReservedRange::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -6468,6 +6642,32 @@ inline void EnumDescriptorProto::SharedDtor() { _impl_.~Impl_(); } +inline void* EnumDescriptorProto::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) EnumDescriptorProto(arena); +} +constexpr auto EnumDescriptorProto::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(EnumDescriptorProto, _impl_.value_) + + decltype(EnumDescriptorProto::_impl_.value_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(EnumDescriptorProto, _impl_.reserved_range_) + + decltype(EnumDescriptorProto::_impl_.reserved_range_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(EnumDescriptorProto, _impl_.reserved_name_) + + decltype(EnumDescriptorProto::_impl_.reserved_name_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(EnumDescriptorProto), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&EnumDescriptorProto::PlacementNew_, + sizeof(EnumDescriptorProto)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -6478,9 +6678,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor EnumDescriptorProto::IsInitializedImpl, &EnumDescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &EnumDescriptorProto::ByteSizeLong, &EnumDescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -6854,6 +7054,13 @@ inline void EnumValueDescriptorProto::SharedDtor() { _impl_.~Impl_(); } +inline void* EnumValueDescriptorProto::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) EnumValueDescriptorProto(arena); +} +constexpr auto EnumValueDescriptorProto::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(EnumValueDescriptorProto)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -6864,9 +7071,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor EnumValueDescriptorProto::IsInitializedImpl, &EnumValueDescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &EnumValueDescriptorProto::ByteSizeLong, &EnumValueDescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -7172,6 +7379,24 @@ inline void ServiceDescriptorProto::SharedDtor() { _impl_.~Impl_(); } +inline void* ServiceDescriptorProto::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) ServiceDescriptorProto(arena); +} +constexpr auto ServiceDescriptorProto::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(ServiceDescriptorProto, _impl_.method_) + + decltype(ServiceDescriptorProto::_impl_.method_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(ServiceDescriptorProto), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&ServiceDescriptorProto::PlacementNew_, + sizeof(ServiceDescriptorProto)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -7182,9 +7407,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor ServiceDescriptorProto::IsInitializedImpl, &ServiceDescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &ServiceDescriptorProto::ByteSizeLong, &ServiceDescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -7512,6 +7737,13 @@ inline void MethodDescriptorProto::SharedDtor() { _impl_.~Impl_(); } +inline void* MethodDescriptorProto::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) MethodDescriptorProto(arena); +} +constexpr auto MethodDescriptorProto::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(MethodDescriptorProto)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -7522,9 +7754,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor MethodDescriptorProto::IsInitializedImpl, &MethodDescriptorProto::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &MethodDescriptorProto::ByteSizeLong, &MethodDescriptorProto::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -7950,6 +8182,27 @@ inline void FileOptions::SharedDtor() { _impl_.~Impl_(); } +inline void* FileOptions::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) FileOptions(arena); +} +constexpr auto FileOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(FileOptions, _impl_._extensions_) + + decltype(FileOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(FileOptions, _impl_.uninterpreted_option_) + + decltype(FileOptions::_impl_.uninterpreted_option_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(FileOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&FileOptions::PlacementNew_, + sizeof(FileOptions)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -7960,9 +8213,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor FileOptions::IsInitializedImpl, &FileOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &FileOptions::ByteSizeLong, &FileOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -8754,6 +9007,27 @@ inline void MessageOptions::SharedDtor() { _impl_.~Impl_(); } +inline void* MessageOptions::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) MessageOptions(arena); +} +constexpr auto MessageOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_._extensions_) + + decltype(MessageOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(MessageOptions, _impl_.uninterpreted_option_) + + decltype(MessageOptions::_impl_.uninterpreted_option_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(MessageOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&MessageOptions::PlacementNew_, + sizeof(MessageOptions)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -8764,9 +9038,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor MessageOptions::IsInitializedImpl, &MessageOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &MessageOptions::ByteSizeLong, &MessageOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -9158,6 +9432,13 @@ inline void FieldOptions_EditionDefault::SharedDtor() { _impl_.~Impl_(); } +inline void* FieldOptions_EditionDefault::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) FieldOptions_EditionDefault(arena); +} +constexpr auto FieldOptions_EditionDefault::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(FieldOptions_EditionDefault)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -9168,9 +9449,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized &FieldOptions_EditionDefault::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &FieldOptions_EditionDefault::ByteSizeLong, &FieldOptions_EditionDefault::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -9433,6 +9714,13 @@ inline void FieldOptions_FeatureSupport::SharedDtor() { _impl_.~Impl_(); } +inline void* FieldOptions_FeatureSupport::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) FieldOptions_FeatureSupport(arena); +} +constexpr auto FieldOptions_FeatureSupport::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(FieldOptions_FeatureSupport)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -9443,9 +9731,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized &FieldOptions_FeatureSupport::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &FieldOptions_FeatureSupport::ByteSizeLong, &FieldOptions_FeatureSupport::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -9776,6 +10064,35 @@ inline void FieldOptions::SharedDtor() { _impl_.~Impl_(); } +inline void* FieldOptions::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) FieldOptions(arena); +} +constexpr auto FieldOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_._extensions_) + + decltype(FieldOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_.targets_) + + decltype(FieldOptions::_impl_.targets_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_.edition_defaults_) + + decltype(FieldOptions::_impl_.edition_defaults_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(FieldOptions, _impl_.uninterpreted_option_) + + decltype(FieldOptions::_impl_.uninterpreted_option_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(FieldOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&FieldOptions::PlacementNew_, + sizeof(FieldOptions)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -9786,9 +10103,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor FieldOptions::IsInitializedImpl, &FieldOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &FieldOptions::ByteSizeLong, &FieldOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -10367,6 +10684,27 @@ inline void OneofOptions::SharedDtor() { _impl_.~Impl_(); } +inline void* OneofOptions::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) OneofOptions(arena); +} +constexpr auto OneofOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(OneofOptions, _impl_._extensions_) + + decltype(OneofOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(OneofOptions, _impl_.uninterpreted_option_) + + decltype(OneofOptions::_impl_.uninterpreted_option_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(OneofOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&OneofOptions::PlacementNew_, + sizeof(OneofOptions)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -10377,9 +10715,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor OneofOptions::IsInitializedImpl, &OneofOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &OneofOptions::ByteSizeLong, &OneofOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -10682,6 +11020,27 @@ inline void EnumOptions::SharedDtor() { _impl_.~Impl_(); } +inline void* EnumOptions::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) EnumOptions(arena); +} +constexpr auto EnumOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_._extensions_) + + decltype(EnumOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(EnumOptions, _impl_.uninterpreted_option_) + + decltype(EnumOptions::_impl_.uninterpreted_option_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(EnumOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&EnumOptions::PlacementNew_, + sizeof(EnumOptions)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -10692,9 +11051,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor EnumOptions::IsInitializedImpl, &EnumOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &EnumOptions::ByteSizeLong, &EnumOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -11070,6 +11429,27 @@ inline void EnumValueOptions::SharedDtor() { _impl_.~Impl_(); } +inline void* EnumValueOptions::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) EnumValueOptions(arena); +} +constexpr auto EnumValueOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(EnumValueOptions, _impl_._extensions_) + + decltype(EnumValueOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(EnumValueOptions, _impl_.uninterpreted_option_) + + decltype(EnumValueOptions::_impl_.uninterpreted_option_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(EnumValueOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&EnumValueOptions::PlacementNew_, + sizeof(EnumValueOptions)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -11080,9 +11460,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor EnumValueOptions::IsInitializedImpl, &EnumValueOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &EnumValueOptions::ByteSizeLong, &EnumValueOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -11464,6 +11844,27 @@ inline void ServiceOptions::SharedDtor() { _impl_.~Impl_(); } +inline void* ServiceOptions::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) ServiceOptions(arena); +} +constexpr auto ServiceOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(ServiceOptions, _impl_._extensions_) + + decltype(ServiceOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(ServiceOptions, _impl_.uninterpreted_option_) + + decltype(ServiceOptions::_impl_.uninterpreted_option_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(ServiceOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&ServiceOptions::PlacementNew_, + sizeof(ServiceOptions)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -11474,9 +11875,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor ServiceOptions::IsInitializedImpl, &ServiceOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &ServiceOptions::ByteSizeLong, &ServiceOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -11807,6 +12208,27 @@ inline void MethodOptions::SharedDtor() { _impl_.~Impl_(); } +inline void* MethodOptions::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) MethodOptions(arena); +} +constexpr auto MethodOptions::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(MethodOptions, _impl_._extensions_) + + decltype(MethodOptions::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(MethodOptions, _impl_.uninterpreted_option_) + + decltype(MethodOptions::_impl_.uninterpreted_option_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(MethodOptions), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&MethodOptions::PlacementNew_, + sizeof(MethodOptions)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -11817,9 +12239,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor MethodOptions::IsInitializedImpl, &MethodOptions::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &MethodOptions::ByteSizeLong, &MethodOptions::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -12164,6 +12586,13 @@ inline void UninterpretedOption_NamePart::SharedDtor() { _impl_.~Impl_(); } +inline void* UninterpretedOption_NamePart::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) UninterpretedOption_NamePart(arena); +} +constexpr auto UninterpretedOption_NamePart::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(UninterpretedOption_NamePart)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -12174,9 +12603,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor UninterpretedOption_NamePart::IsInitializedImpl, &UninterpretedOption_NamePart::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &UninterpretedOption_NamePart::ByteSizeLong, &UninterpretedOption_NamePart::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -12454,6 +12883,24 @@ inline void UninterpretedOption::SharedDtor() { _impl_.~Impl_(); } +inline void* UninterpretedOption::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) UninterpretedOption(arena); +} +constexpr auto UninterpretedOption::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(UninterpretedOption, _impl_.name_) + + decltype(UninterpretedOption::_impl_.name_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(UninterpretedOption), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&UninterpretedOption::PlacementNew_, + sizeof(UninterpretedOption)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -12464,9 +12911,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor UninterpretedOption::IsInitializedImpl, &UninterpretedOption::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &UninterpretedOption::ByteSizeLong, &UninterpretedOption::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -12870,6 +13317,23 @@ inline void FeatureSet::SharedDtor() { _impl_.~Impl_(); } +inline void* FeatureSet::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) FeatureSet(arena); +} +constexpr auto FeatureSet::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(FeatureSet, _impl_._extensions_) + + decltype(FeatureSet::_impl_._extensions_)::InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(FeatureSet), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&FeatureSet::PlacementNew_, + sizeof(FeatureSet)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -12880,9 +13344,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor FeatureSet::IsInitializedImpl, &FeatureSet::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &FeatureSet::ByteSizeLong, &FeatureSet::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -13251,6 +13715,13 @@ inline void FeatureSetDefaults_FeatureSetEditionDefault::SharedDtor() { _impl_.~Impl_(); } +inline void* FeatureSetDefaults_FeatureSetEditionDefault::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) FeatureSetDefaults_FeatureSetEditionDefault(arena); +} +constexpr auto FeatureSetDefaults_FeatureSetEditionDefault::InternalNewImpl_() { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(FeatureSetDefaults_FeatureSetEditionDefault)); +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -13261,9 +13732,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor FeatureSetDefaults_FeatureSetEditionDefault::IsInitializedImpl, &FeatureSetDefaults_FeatureSetEditionDefault::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &FeatureSetDefaults_FeatureSetEditionDefault::ByteSizeLong, &FeatureSetDefaults_FeatureSetEditionDefault::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -13578,6 +14049,24 @@ inline void FeatureSetDefaults::SharedDtor() { _impl_.~Impl_(); } +inline void* FeatureSetDefaults::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) FeatureSetDefaults(arena); +} +constexpr auto FeatureSetDefaults::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(FeatureSetDefaults, _impl_.defaults_) + + decltype(FeatureSetDefaults::_impl_.defaults_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(FeatureSetDefaults), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&FeatureSetDefaults::PlacementNew_, + sizeof(FeatureSetDefaults)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -13588,9 +14077,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor FeatureSetDefaults::IsInitializedImpl, &FeatureSetDefaults::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &FeatureSetDefaults::ByteSizeLong, &FeatureSetDefaults::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -13888,6 +14377,32 @@ inline void SourceCodeInfo_Location::SharedDtor() { _impl_.~Impl_(); } +inline void* SourceCodeInfo_Location::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) SourceCodeInfo_Location(arena); +} +constexpr auto SourceCodeInfo_Location::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(SourceCodeInfo_Location, _impl_.path_) + + decltype(SourceCodeInfo_Location::_impl_.path_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(SourceCodeInfo_Location, _impl_.span_) + + decltype(SourceCodeInfo_Location::_impl_.span_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + PROTOBUF_FIELD_OFFSET(SourceCodeInfo_Location, _impl_.leading_detached_comments_) + + decltype(SourceCodeInfo_Location::_impl_.leading_detached_comments_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(SourceCodeInfo_Location), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&SourceCodeInfo_Location::PlacementNew_, + sizeof(SourceCodeInfo_Location)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -13898,9 +14413,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized &SourceCodeInfo_Location::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &SourceCodeInfo_Location::ByteSizeLong, &SourceCodeInfo_Location::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -14232,6 +14747,24 @@ inline void SourceCodeInfo::SharedDtor() { _impl_.~Impl_(); } +inline void* SourceCodeInfo::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) SourceCodeInfo(arena); +} +constexpr auto SourceCodeInfo::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(SourceCodeInfo, _impl_.location_) + + decltype(SourceCodeInfo::_impl_.location_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(SourceCodeInfo), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&SourceCodeInfo::PlacementNew_, + sizeof(SourceCodeInfo)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -14242,9 +14775,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized &SourceCodeInfo::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &SourceCodeInfo::ByteSizeLong, &SourceCodeInfo::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -14476,6 +15009,24 @@ inline void GeneratedCodeInfo_Annotation::SharedDtor() { _impl_.~Impl_(); } +inline void* GeneratedCodeInfo_Annotation::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) GeneratedCodeInfo_Annotation(arena); +} +constexpr auto GeneratedCodeInfo_Annotation::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _impl_.path_) + + decltype(GeneratedCodeInfo_Annotation::_impl_.path_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::CopyInit(sizeof(GeneratedCodeInfo_Annotation), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&GeneratedCodeInfo_Annotation::PlacementNew_, + sizeof(GeneratedCodeInfo_Annotation)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -14486,9 +15037,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized &GeneratedCodeInfo_Annotation::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &GeneratedCodeInfo_Annotation::ByteSizeLong, &GeneratedCodeInfo_Annotation::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE @@ -14813,6 +15364,24 @@ inline void GeneratedCodeInfo::SharedDtor() { _impl_.~Impl_(); } +inline void* GeneratedCodeInfo::PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena) { + return ::new (mem) GeneratedCodeInfo(arena); +} +constexpr auto GeneratedCodeInfo::InternalNewImpl_() { + constexpr auto arena_bits = ::google::protobuf::internal::EncodePlacementArenaOffsets({ + PROTOBUF_FIELD_OFFSET(GeneratedCodeInfo, _impl_.annotation_) + + decltype(GeneratedCodeInfo::_impl_.annotation_):: + InternalGetArenaOffset( + ::google::protobuf::Message::internal_visibility()), + }); + if (arena_bits.has_value()) { + return ::google::protobuf::internal::MessageCreator::ZeroInit(sizeof(GeneratedCodeInfo), *arena_bits); + } else { + return ::google::protobuf::internal::MessageCreator(&GeneratedCodeInfo::PlacementNew_, + sizeof(GeneratedCodeInfo)); + } +} PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 const ::google::protobuf::MessageLite::ClassDataFull @@ -14823,9 +15392,9 @@ const ::google::protobuf::MessageLite::ClassDataFull nullptr, // OnDemandRegisterArenaDtor nullptr, // IsInitialized &GeneratedCodeInfo::MergeImpl, + ::google::protobuf::Message::GetNewImpl(), #if defined(PROTOBUF_CUSTOM_VTABLE) ::google::protobuf::Message::GetDeleteImpl(), - ::google::protobuf::Message::GetNewImpl(), ::google::protobuf::Message::GetClearImpl(), &GeneratedCodeInfo::ByteSizeLong, &GeneratedCodeInfo::_InternalSerialize, #endif // PROTOBUF_CUSTOM_VTABLE diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 6443a80622..e93986007c 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -778,7 +778,7 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::prot // implements Message ---------------------------------------------- - UninterpretedOption_NamePart* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + UninterpretedOption_NamePart* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -839,6 +839,9 @@ class PROTOBUF_EXPORT UninterpretedOption_NamePart final : public ::google::prot *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -990,7 +993,7 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: // implements Message ---------------------------------------------- - SourceCodeInfo_Location* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + SourceCodeInfo_Location* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1046,6 +1049,9 @@ class PROTOBUF_EXPORT SourceCodeInfo_Location final : public ::google::protobuf: *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -1269,7 +1275,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot // implements Message ---------------------------------------------- - GeneratedCodeInfo_Annotation* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + GeneratedCodeInfo_Annotation* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1325,6 +1331,9 @@ class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final : public ::google::prot *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -1543,7 +1552,7 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::proto // implements Message ---------------------------------------------- - FieldOptions_FeatureSupport* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + FieldOptions_FeatureSupport* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1599,6 +1608,9 @@ class PROTOBUF_EXPORT FieldOptions_FeatureSupport final : public ::google::proto *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -1776,7 +1788,7 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::proto // implements Message ---------------------------------------------- - FieldOptions_EditionDefault* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + FieldOptions_EditionDefault* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -1832,6 +1844,9 @@ class PROTOBUF_EXPORT FieldOptions_EditionDefault final : public ::google::proto *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -1983,7 +1998,7 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - FeatureSet* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + FeatureSet* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -2044,6 +2059,9 @@ class PROTOBUF_EXPORT FeatureSet final : public ::google::protobuf::Message *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -2542,7 +2560,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: // implements Message ---------------------------------------------- - ExtensionRangeOptions_Declaration* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + ExtensionRangeOptions_Declaration* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -2598,6 +2616,9 @@ class PROTOBUF_EXPORT ExtensionRangeOptions_Declaration final : public ::google: *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -2794,7 +2815,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::goo // implements Message ---------------------------------------------- - EnumDescriptorProto_EnumReservedRange* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + EnumDescriptorProto_EnumReservedRange* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -2850,6 +2871,9 @@ class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final : public ::goo *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -2995,7 +3019,7 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::pro // implements Message ---------------------------------------------- - DescriptorProto_ReservedRange* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + DescriptorProto_ReservedRange* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -3051,6 +3075,9 @@ class PROTOBUF_EXPORT DescriptorProto_ReservedRange final : public ::google::pro *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -3196,7 +3223,7 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes // implements Message ---------------------------------------------- - UninterpretedOption* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + UninterpretedOption* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -3257,6 +3284,9 @@ class PROTOBUF_EXPORT UninterpretedOption final : public ::google::protobuf::Mes *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -3492,7 +3522,7 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - SourceCodeInfo* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + SourceCodeInfo* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -3548,6 +3578,9 @@ class PROTOBUF_EXPORT SourceCodeInfo final : public ::google::protobuf::Message *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -3686,7 +3719,7 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Messa // implements Message ---------------------------------------------- - GeneratedCodeInfo* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + GeneratedCodeInfo* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -3742,6 +3775,9 @@ class PROTOBUF_EXPORT GeneratedCodeInfo final : public ::google::protobuf::Messa *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -3880,7 +3916,7 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public // implements Message ---------------------------------------------- - FeatureSetDefaults_FeatureSetEditionDefault* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + FeatureSetDefaults_FeatureSetEditionDefault* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -3941,6 +3977,9 @@ class PROTOBUF_EXPORT FeatureSetDefaults_FeatureSetEditionDefault final : public *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -4107,7 +4146,7 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - ServiceOptions* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + ServiceOptions* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -4168,6 +4207,9 @@ class PROTOBUF_EXPORT ServiceOptions final : public ::google::protobuf::Message *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -4516,7 +4558,7 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - OneofOptions* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + OneofOptions* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -4577,6 +4619,9 @@ class PROTOBUF_EXPORT OneofOptions final : public ::google::protobuf::Message *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -4912,7 +4957,7 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - MethodOptions* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + MethodOptions* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -4973,6 +5018,9 @@ class PROTOBUF_EXPORT MethodOptions final : public ::google::protobuf::Message *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -5354,7 +5402,7 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - MessageOptions* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + MessageOptions* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -5415,6 +5463,9 @@ class PROTOBUF_EXPORT MessageOptions final : public ::google::protobuf::Message *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -5815,7 +5866,7 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - FileOptions* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + FileOptions* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -5876,6 +5927,9 @@ class PROTOBUF_EXPORT FileOptions final : public ::google::protobuf::Message *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -6538,7 +6592,7 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - FieldOptions* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + FieldOptions* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -6599,6 +6653,9 @@ class PROTOBUF_EXPORT FieldOptions final : public ::google::protobuf::Message *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -7197,7 +7254,7 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Mess // implements Message ---------------------------------------------- - FeatureSetDefaults* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + FeatureSetDefaults* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -7258,6 +7315,9 @@ class PROTOBUF_EXPORT FeatureSetDefaults final : public ::google::protobuf::Mess *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -7423,7 +7483,7 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M // implements Message ---------------------------------------------- - ExtensionRangeOptions* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + ExtensionRangeOptions* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -7484,6 +7544,9 @@ class PROTOBUF_EXPORT ExtensionRangeOptions final : public ::google::protobuf::M *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -7871,7 +7934,7 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag // implements Message ---------------------------------------------- - EnumValueOptions* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + EnumValueOptions* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -7932,6 +7995,9 @@ class PROTOBUF_EXPORT EnumValueOptions final : public ::google::protobuf::Messag *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -8310,7 +8376,7 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - EnumOptions* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + EnumOptions* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -8371,6 +8437,9 @@ class PROTOBUF_EXPORT EnumOptions final : public ::google::protobuf::Message *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -8745,7 +8814,7 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : public ::google::protobuf::Me // implements Message ---------------------------------------------- - OneofDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + OneofDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -8806,6 +8875,9 @@ class PROTOBUF_EXPORT OneofDescriptorProto final : public ::google::protobuf::Me *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -8961,7 +9033,7 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M // implements Message ---------------------------------------------- - MethodDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + MethodDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -9022,6 +9094,9 @@ class PROTOBUF_EXPORT MethodDescriptorProto final : public ::google::protobuf::M *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -9241,7 +9316,7 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me // implements Message ---------------------------------------------- - FieldDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + FieldDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -9302,6 +9377,9 @@ class PROTOBUF_EXPORT FieldDescriptorProto final : public ::google::protobuf::Me *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -9653,7 +9731,7 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf // implements Message ---------------------------------------------- - EnumValueDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + EnumValueDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -9714,6 +9792,9 @@ class PROTOBUF_EXPORT EnumValueDescriptorProto final : public ::google::protobuf *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -9882,7 +9963,7 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::pr // implements Message ---------------------------------------------- - DescriptorProto_ExtensionRange* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + DescriptorProto_ExtensionRange* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -9943,6 +10024,9 @@ class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final : public ::google::pr *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -10105,7 +10189,7 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf:: // implements Message ---------------------------------------------- - ServiceDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + ServiceDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -10166,6 +10250,9 @@ class PROTOBUF_EXPORT ServiceDescriptorProto final : public ::google::protobuf:: *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -10340,7 +10427,7 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes // implements Message ---------------------------------------------- - EnumDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + EnumDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -10401,6 +10488,9 @@ class PROTOBUF_EXPORT EnumDescriptorProto final : public ::google::protobuf::Mes *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -10619,7 +10709,7 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message // implements Message ---------------------------------------------- - DescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + DescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -10680,6 +10770,9 @@ class PROTOBUF_EXPORT DescriptorProto final : public ::google::protobuf::Message *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -10994,7 +11087,7 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes // implements Message ---------------------------------------------- - FileDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + FileDescriptorProto* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -11055,6 +11148,9 @@ class PROTOBUF_EXPORT FileDescriptorProto final : public ::google::protobuf::Mes *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: @@ -11418,7 +11514,7 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa // implements Message ---------------------------------------------- - FileDescriptorSet* New(::google::protobuf::Arena* arena = nullptr) const PROTOBUF_FINAL { + FileDescriptorSet* New(::google::protobuf::Arena* arena = nullptr) const { return ::google::protobuf::Message::DefaultConstruct(arena); } using ::google::protobuf::Message::CopyFrom; @@ -11479,6 +11575,9 @@ class PROTOBUF_EXPORT FileDescriptorSet final : public ::google::protobuf::Messa *this = ::std::move(from); } const ::google::protobuf::Message::ClassData* GetClassData() const PROTOBUF_FINAL; + static void* PlacementNew_(const void*, void* mem, + ::google::protobuf::Arena* arena); + static constexpr auto InternalNewImpl_(); static const ::google::protobuf::Message::ClassDataFull _class_data_; public: diff --git a/src/google/protobuf/dynamic_message.cc b/src/google/protobuf/dynamic_message.cc index 138c941282..f6fab022b4 100644 --- a/src/google/protobuf/dynamic_message.cc +++ b/src/google/protobuf/dynamic_message.cc @@ -181,8 +181,6 @@ inline int AlignOffset(int offset) { return AlignTo(offset, kSafeAlignment); } class DynamicMessage final : public Message { public: - explicit DynamicMessage(const DynamicMessageFactory::TypeInfo* type_info); - // This should only be used by GetPrototypeNoLock() to avoid dead lock. DynamicMessage(DynamicMessageFactory::TypeInfo* type_info, bool lock_factory); DynamicMessage(const DynamicMessage&) = delete; @@ -202,8 +200,6 @@ class DynamicMessage final : public Message { // implements Message ---------------------------------------------- - Message* New(Arena* arena) const PROTOBUF_FINAL; - const ClassData* GetClassData() const PROTOBUF_FINAL; #if defined(__cpp_lib_destroying_delete) && defined(__cpp_sized_deallocation) @@ -237,6 +233,7 @@ class DynamicMessage final : public Message { return reinterpret_cast(this) + offset; } + static void* NewImpl(const void* prototype, void* mem, Arena* arena); static void DeleteImpl(void* ptr, bool free_memory); void* MutableRaw(int i); @@ -250,7 +247,6 @@ class DynamicMessage final : public Message { }; struct DynamicMessageFactory::TypeInfo { - int size; int has_bits_offset; int oneof_case_offset; int extensions_offset; @@ -272,8 +268,8 @@ struct DynamicMessageFactory::TypeInfo { nullptr, // on_demand_register_arena_dtor &DynamicMessage::IsInitializedImpl, &DynamicMessage::MergeImpl, + internal::MessageCreator(), // to be filled later &DynamicMessage::DeleteImpl, - DynamicMessage::GetNewImpl(), DynamicMessage::ClearImpl, DynamicMessage::ByteSizeLongImpl, DynamicMessage::_InternalSerializeImpl, @@ -307,13 +303,6 @@ struct DynamicMessageFactory::TypeInfo { } }; -DynamicMessage::DynamicMessage(const DynamicMessageFactory::TypeInfo* type_info) - : Message(type_info->class_data.base()), - type_info_(type_info), - cached_byte_size_(0) { - SharedCtor(true); -} - DynamicMessage::DynamicMessage(const DynamicMessageFactory::TypeInfo* type_info, Arena* arena) : Message(arena, type_info->class_data.base()), @@ -472,7 +461,7 @@ bool DynamicMessage::is_prototype() const { #if defined(__cpp_lib_destroying_delete) && defined(__cpp_sized_deallocation) void DynamicMessage::operator delete(DynamicMessage* msg, std::destroying_delete_t) { - const size_t size = msg->type_info_->size; + const size_t size = msg->type_info_->class_data.allocation_size(); msg->~DynamicMessage(); ::operator delete(msg, size); } @@ -574,9 +563,16 @@ DynamicMessage::~DynamicMessage() { } } +void* DynamicMessage::NewImpl(const void* prototype, void* mem, Arena* arena) { + const auto* type_info = + static_cast(prototype)->type_info_; + memset(mem, 0, type_info->class_data.allocation_size()); + return new (mem) DynamicMessage(type_info, arena); +} + void DynamicMessage::DeleteImpl(void* ptr, bool free_memory) { auto* msg = static_cast(ptr); - const size_t size = msg->type_info_->size; + const size_t size = msg->type_info_->class_data.allocation_size(); msg->~DynamicMessage(); if (free_memory) { internal::SizedDelete(ptr, size); @@ -607,18 +603,6 @@ void DynamicMessage::CrossLinkPrototypes() { } } -Message* DynamicMessage::New(Arena* arena) const { - if (arena != nullptr) { - void* new_base = Arena::CreateArray(arena, type_info_->size); - memset(new_base, 0, type_info_->size); - return new (new_base) DynamicMessage(type_info_, arena); - } else { - void* new_base = operator new(type_info_->size); - memset(new_base, 0, type_info_->size); - return new (new_base) DynamicMessage(type_info_); - } -} - const MessageLite::ClassData* DynamicMessage::GetClassData() const { return type_info_->class_data.base(); } @@ -751,9 +735,8 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock( type_info->weak_field_map_offset = -1; - // Align the final size to make sure no clever allocators think that - // alignment is not necessary. - type_info->size = size; + type_info->class_data.message_creator = + internal::MessageCreator(DynamicMessage::NewImpl, size); // Construct the reflection object. @@ -787,7 +770,7 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock( PROTOBUF_FIELD_OFFSET(DynamicMessage, _internal_metadata_), type_info->extensions_offset, type_info->oneof_case_offset, - type_info->size, + static_cast(type_info->class_data.allocation_size()), type_info->weak_field_map_offset, nullptr, // inlined_string_indices_ 0, // inlined_string_donated_offset_ diff --git a/src/google/protobuf/extension_set.h b/src/google/protobuf/extension_set.h index ab4b0f92ed..39a8b56ad3 100644 --- a/src/google/protobuf/extension_set.h +++ b/src/google/protobuf/extension_set.h @@ -531,6 +531,10 @@ class PROTOBUF_EXPORT ExtensionSet { // as .dll. int SpaceUsedExcludingSelf() const; + static constexpr size_t InternalGetArenaOffset(internal::InternalVisibility) { + return PROTOBUF_FIELD_OFFSET(ExtensionSet, arena_); + } + private: template friend class PrimitiveTypeTraits; diff --git a/src/google/protobuf/generated_message_reflection.cc b/src/google/protobuf/generated_message_reflection.cc index 23000b857d..db087dab35 100644 --- a/src/google/protobuf/generated_message_reflection.cc +++ b/src/google/protobuf/generated_message_reflection.cc @@ -3359,7 +3359,6 @@ void Reflection::PopulateTcParseFieldAux( break; case internal::TailCallTableInfo::kSubTable: case internal::TailCallTableInfo::kSubMessageWeak: - case internal::TailCallTableInfo::kCreateInArena: case internal::TailCallTableInfo::kMessageVerifyFunc: case internal::TailCallTableInfo::kSelfVerifyFunc: ABSL_LOG(FATAL) << "Not supported"; diff --git a/src/google/protobuf/generated_message_tctable_decl.h b/src/google/protobuf/generated_message_tctable_decl.h index 185ae9c469..94996ef2ed 100644 --- a/src/google/protobuf/generated_message_tctable_decl.h +++ b/src/google/protobuf/generated_message_tctable_decl.h @@ -428,8 +428,6 @@ struct alignas(uint64_t) TcParseTableBase { : message_default_p(msg) {} constexpr FieldAux(const TcParseTableBase* table) : table(table) {} constexpr FieldAux(MapAuxInfo map_info) : map_info(map_info) {} - constexpr FieldAux(void (*create_in_arena)(Arena*, void*)) - : create_in_arena(create_in_arena) {} constexpr FieldAux(LazyEagerVerifyFnType verify_func) : verify_func(verify_func) {} struct { @@ -441,7 +439,6 @@ struct alignas(uint64_t) TcParseTableBase { const uint32_t* enum_data; const TcParseTableBase* table; MapAuxInfo map_info; - void (*create_in_arena)(Arena*, void*); LazyEagerVerifyFnType verify_func; const MessageLite* message_default() const { diff --git a/src/google/protobuf/generated_message_tctable_gen.cc b/src/google/protobuf/generated_message_tctable_gen.cc index dd94a9c311..c0be3dad1f 100644 --- a/src/google/protobuf/generated_message_tctable_gen.cc +++ b/src/google/protobuf/generated_message_tctable_gen.cc @@ -908,9 +908,8 @@ TailCallTableInfo::TailCallTableInfo( if (message_options.uses_codegen) { // If we don't use codegen we can't add these. auto* map_value = field->message_type()->map_value(); - if (auto* sub = map_value->message_type()) { - aux_entries.push_back({kCreateInArena}); - aux_entries.back().desc = sub; + if (map_value->message_type() != nullptr) { + aux_entries.push_back({kSubTable, {map_value}}); } else if (map_value->type() == FieldDescriptor::TYPE_ENUM && !cpp::HasPreservingUnknownEnumSemantics(map_value)) { aux_entries.push_back({kEnumValidator, {map_value}}); diff --git a/src/google/protobuf/generated_message_tctable_gen.h b/src/google/protobuf/generated_message_tctable_gen.h index ac2557921e..6360f6ecbb 100644 --- a/src/google/protobuf/generated_message_tctable_gen.h +++ b/src/google/protobuf/generated_message_tctable_gen.h @@ -112,7 +112,6 @@ struct PROTOBUF_EXPORT TailCallTableInfo { kEnumValidator, kNumericOffset, kMapAuxInfo, - kCreateInArena, }; struct AuxEntry { AuxType type; diff --git a/src/google/protobuf/generated_message_tctable_impl.h b/src/google/protobuf/generated_message_tctable_impl.h index 1619289e28..1334822dd8 100644 --- a/src/google/protobuf/generated_message_tctable_impl.h +++ b/src/google/protobuf/generated_message_tctable_impl.h @@ -822,11 +822,6 @@ class PROTOBUF_EXPORT TcParser final { }; } - template - static void CreateInArenaStorageCb(Arena* arena, void* p) { - Arena::CreateInArenaStorage(static_cast(p), arena); - } - private: // Optimized small tag varint parser for int32/int64 template diff --git a/src/google/protobuf/generated_message_tctable_lite.cc b/src/google/protobuf/generated_message_tctable_lite.cc index 6cf977022b..665da26c8e 100644 --- a/src/google/protobuf/generated_message_tctable_lite.cc +++ b/src/google/protobuf/generated_message_tctable_lite.cc @@ -357,7 +357,7 @@ PROTOBUF_NOINLINE const char* TcParser::FastEndG2(PROTOBUF_TC_PARAM_DECL) { inline PROTOBUF_ALWAYS_INLINE MessageLite* TcParser::NewMessage( const TcParseTableBase* table, Arena* arena) { - return table->default_instance()->New(arena); + return table->class_data->New(arena); } MessageLite* TcParser::AddMessage(const TcParseTableBase* table, @@ -2522,7 +2522,7 @@ PROTOBUF_ALWAYS_INLINE inline void TcParser::InitializeMapNodeEntry( map.arena()); break; case MapTypeCard::kMessage: - aux[1].create_in_arena(map.arena(), reinterpret_cast(obj)); + aux[1].table->class_data->PlacementNew(obj, map.arena()); break; default: Unreachable(); diff --git a/src/google/protobuf/generated_message_util.h b/src/google/protobuf/generated_message_util.h index 589e010574..ab676e406b 100644 --- a/src/google/protobuf/generated_message_util.h +++ b/src/google/protobuf/generated_message_util.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -31,6 +32,7 @@ #include "absl/base/call_once.h" #include "absl/base/casts.h" #include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "google/protobuf/any.h" #include "google/protobuf/has_bits.h" #include "google/protobuf/implicit_weak_message.h" @@ -375,6 +377,19 @@ inline void AddToRepeatedPtrField(google::protobuf::RepeatedPtrField EncodePlacementArenaOffsets( + std::initializer_list offsets) { + uintptr_t arena_bits = 0; + for (size_t offset : offsets) { + offset /= sizeof(Arena*); + if (offset >= sizeof(arena_bits) * 8) { + return absl::nullopt; + } + arena_bits |= uintptr_t{1} << offset; + } + return arena_bits; +} + } // namespace internal } // namespace protobuf } // namespace google diff --git a/src/google/protobuf/implicit_weak_message.cc b/src/google/protobuf/implicit_weak_message.cc index 91fbf2ddb1..bd2aac6fc4 100644 --- a/src/google/protobuf/implicit_weak_message.cc +++ b/src/google/protobuf/implicit_weak_message.cc @@ -69,8 +69,9 @@ constexpr MessageLite::ClassDataLite<1> ImplicitWeakMessage::class_data_ = { nullptr, // on_demand_register_arena_dtor nullptr, // is_initialized (always true) MergeImpl, + internal::MessageCreator(NewImpl, + sizeof(ImplicitWeakMessage)), GetDeleteImpl(), - GetNewImpl(), &ClearImpl, &ByteSizeLongImpl, &_InternalSerializeImpl, diff --git a/src/google/protobuf/implicit_weak_message.h b/src/google/protobuf/implicit_weak_message.h index 095028a6be..a72e913dd6 100644 --- a/src/google/protobuf/implicit_weak_message.h +++ b/src/google/protobuf/implicit_weak_message.h @@ -59,10 +59,6 @@ class PROTOBUF_EXPORT ImplicitWeakMessage final : public MessageLite { const ClassData* GetClassData() const PROTOBUF_FINAL; - MessageLite* New(Arena* arena) const PROTOBUF_FINAL { - return Arena::Create(arena); - } - void Clear() PROTOBUF_FINAL { data_->clear(); } size_t ByteSizeLong() const PROTOBUF_FINAL { @@ -218,6 +214,11 @@ struct WeakRepeatedPtrField { RepeatedPtrField weak; }; + static constexpr size_t InternalGetArenaOffset( + internal::InternalVisibility visibility) { + return decltype(weak)::InternalGetArenaOffset(visibility); + } + private: WeakRepeatedPtrField(Arena* arena, const WeakRepeatedPtrField& rhs) : WeakRepeatedPtrField(arena) { diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h index 74cfa9d439..071decad5f 100644 --- a/src/google/protobuf/map.h +++ b/src/google/protobuf/map.h @@ -1625,6 +1625,10 @@ class Map : private internal::KeyMapBase> { return SpaceUsedInternal() + internal::SpaceUsedInValues(this); } + static constexpr size_t InternalGetArenaOffset(internal::InternalVisibility) { + return PROTOBUF_FIELD_OFFSET(Map, alloc_); + } + private: struct Rank1 {}; struct Rank0 : Rank1 {}; diff --git a/src/google/protobuf/map_entry.h b/src/google/protobuf/map_entry.h index 8704b63286..3fbd531bfa 100644 --- a/src/google/protobuf/map_entry.h +++ b/src/google/protobuf/map_entry.h @@ -103,10 +103,6 @@ class MapEntry : public Message { using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; - Message* New(Arena* arena) const PROTOBUF_FINAL { - return Arena::Create(arena); - } - struct _Internal; protected: diff --git a/src/google/protobuf/map_field.h b/src/google/protobuf/map_field.h index 5a18523c43..237fd28eb0 100644 --- a/src/google/protobuf/map_field.h +++ b/src/google/protobuf/map_field.h @@ -406,6 +406,10 @@ class PROTOBUF_EXPORT MapFieldBase : public MapFieldBaseForParse { return internal::ToIntSize(SpaceUsedExcludingSelfLong()); } + static constexpr size_t InternalGetArenaOffset(internal::InternalVisibility) { + return PROTOBUF_FIELD_OFFSET(MapFieldBase, payload_); + } + protected: // Gets the size of space used by map field. size_t SpaceUsedExcludingSelfNoLock() const { @@ -608,6 +612,12 @@ class TypeDefinedMapFieldBase : public MapFieldBase { void InternalSwap(TypeDefinedMapFieldBase* other); + static constexpr size_t InternalGetArenaOffsetAlt( + internal::InternalVisibility access) { + return PROTOBUF_FIELD_OFFSET(TypeDefinedMapFieldBase, map_) + + decltype(map_)::InternalGetArenaOffset(access); + } + protected: friend struct MapFieldTestPeer; diff --git a/src/google/protobuf/map_field_lite.h b/src/google/protobuf/map_field_lite.h index be224617a7..b4187763db 100644 --- a/src/google/protobuf/map_field_lite.h +++ b/src/google/protobuf/map_field_lite.h @@ -8,6 +8,7 @@ #ifndef GOOGLE_PROTOBUF_MAP_FIELD_LITE_H__ #define GOOGLE_PROTOBUF_MAP_FIELD_LITE_H__ +#include #include #include "absl/log/absl_check.h" @@ -74,6 +75,12 @@ class MapFieldLite { void Swap(MapFieldLite* other) { map_.swap(other->map_); } void InternalSwap(MapFieldLite* other) { map_.InternalSwap(&other->map_); } + static constexpr size_t InternalGetArenaOffset( + internal::InternalVisibility access) { + return PROTOBUF_FIELD_OFFSET(MapFieldLite, map_) + + decltype(map_)::InternalGetArenaOffset(access); + } + private: typedef void DestructorSkippable_; diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h index 22a5f20934..fb4fa3a63a 100644 --- a/src/google/protobuf/message.h +++ b/src/google/protobuf/message.h @@ -261,13 +261,9 @@ class PROTOBUF_EXPORT Message : public MessageLite { // Construct a new instance on the arena. Ownership is passed to the caller // if arena is a nullptr. -#if defined(PROTOBUF_CUSTOM_VTABLE) Message* New(Arena* arena) const { return static_cast(MessageLite::New(arena)); } -#else // PROTOBUF_CUSTOM_VTABLE - Message* New(Arena* arena) const override = 0; -#endif // PROTOBUF_CUSTOM_VTABLE // Make this message into a copy of the given message. The given message // must have the same descriptor, but need not necessarily be the same class. diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc index 132bdc608b..9b3debf11e 100644 --- a/src/google/protobuf/message_lite.cc +++ b/src/google/protobuf/message_lite.cc @@ -64,6 +64,15 @@ void MessageLite::CheckTypeAndMergeFrom(const MessageLite& other) { data->merge_to_from(*this, other); } +MessageLite* MessageLite::New(Arena* arena) const { + auto* data = GetClassData(); + // The `instance->New()` expression requires using the actual instance + // instead of the prototype for the inner function call. + // Certain custom instances have special per-instance state that needs to be + // copied. + return data->message_creator.New(this, data->prototype, arena); +} + bool MessageLite::IsInitialized() const { auto* data = GetClassData(); return data->is_initialized != nullptr ? data->is_initialized(*this) : true; diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h index c811e04941..c3ae2039b3 100644 --- a/src/google/protobuf/message_lite.h +++ b/src/google/protobuf/message_lite.h @@ -19,12 +19,16 @@ #include #include #include +#include #include +#include #include #include #include "absl/base/attributes.h" +#include "absl/base/casts.h" #include "absl/log/absl_check.h" +#include "absl/numeric/bits.h" #include "absl/strings/cord.h" #include "absl/strings/string_view.h" #include "google/protobuf/arena.h" @@ -66,6 +70,67 @@ class ZeroCopyOutputStream; } // namespace io namespace internal { +class MessageCreator { + public: + using Func = void* (*)(const void*, void*, Arena*); + + // Use -1/0/1 to be able to use <0, ==0, >0 + enum Tag : int8_t { + kFunc = -1, + kZeroInit = 0, + kMemcpy = 1, + }; + + constexpr MessageCreator() + : allocation_size_(), tag_(), arena_bits_(uintptr_t{}) {} + + static constexpr MessageCreator ZeroInit(uint32_t allocation_size, + uintptr_t arena_bits = 0) { + MessageCreator out; + out.allocation_size_ = allocation_size; + out.tag_ = kZeroInit; + out.arena_bits_ = arena_bits; + return out; + } + static constexpr MessageCreator CopyInit(uint32_t allocation_size, + uintptr_t arena_bits = 0) { + MessageCreator out; + out.allocation_size_ = allocation_size; + out.tag_ = kMemcpy; + out.arena_bits_ = arena_bits; + return out; + } + constexpr MessageCreator(Func func, uint32_t allocation_size) + : allocation_size_(allocation_size), tag_(kFunc), func_(func) {} + + // Template for testing. + template + MessageLite* New(const MessageLite* prototype_for_func, + const MessageLite* prototype_for_copy, Arena* arena) const; + + template + MessageLite* PlacementNew(const MessageLite* prototype_for_func, + const MessageLite* prototype_for_copy, void* mem, + Arena* arena) const; + + Tag tag() const { return tag_; } + + uint32_t allocation_size() const { return allocation_size_; } + + uintptr_t arena_bits() const { + ABSL_DCHECK_NE(+tag(), +kFunc); + return arena_bits_; + } + + private: + uint32_t allocation_size_; + Tag tag_; + union { + Func func_; + uintptr_t arena_bits_; + }; +}; + // Allow easy change to regular int on platforms where the atomic might have a // perf impact. // @@ -254,13 +319,7 @@ class PROTOBUF_EXPORT MessageLite { // Construct a new instance on the arena. Ownership is passed to the caller // if arena is a nullptr. -#if defined(PROTOBUF_CUSTOM_VTABLE) - MessageLite* New(Arena* arena) const { - return static_cast(_class_data_->new_message(this, arena)); - } -#else - virtual MessageLite* New(Arena* arena) const = 0; -#endif // PROTOBUF_CUSTOM_VTABLE + MessageLite* New(Arena* arena) const; // Returns the arena, if any, that directly owns this message and its internal // memory (Arena::Own is different in that the arena doesn't directly own the @@ -561,16 +620,25 @@ class PROTOBUF_EXPORT MessageLite { return static_cast(Arena::DefaultConstruct(arena)); } -#if defined(PROTOBUF_CUSTOM_VTABLE) template - static void* NewImpl(const void* prototype, Arena* arena) { - return static_cast(prototype)->New(arena); + static void* NewImpl(const void*, void* mem, Arena* arena) { + return ::new (mem) T(arena); } template - static constexpr auto GetNewImpl() { - return NewImpl; + static constexpr internal::MessageCreator GetNewImpl() { +#if defined(__cpp_if_constexpr) + if constexpr (internal::EnableCustomNewFor()) { +#else + // Equally valid code, but might be more work for the compiler + if (internal::EnableCustomNewFor()) { +#endif + return T::InternalNewImpl_(); + } else { + return internal::MessageCreator(&T::PlacementNew_, sizeof(T)); + } } +#if defined(PROTOBUF_CUSTOM_VTABLE) template static void DeleteImpl(void* msg, bool free_memory) { static_cast(msg)->~T(); @@ -593,8 +661,6 @@ class PROTOBUF_EXPORT MessageLite { // When custom vtables are off we avoid instantiating the functions because we // will not use them anyway. Less work for the compiler. template - using GetNewImpl = std::nullptr_t; - template using GetDeleteImpl = std::nullptr_t; template using GetClearImpl = std::nullptr_t; @@ -638,7 +704,7 @@ class PROTOBUF_EXPORT MessageLite { // We could save more data by omitting any optional pointer that would // otherwise be null. We can have some metadata in ClassData telling us if we // have them and their offset. - using NewMessageF = void* (*)(const void* prototype, Arena* arena); + friend internal::MessageCreator; using DeleteMessageF = void (*)(void* msg, bool free_memory); struct ClassData { const MessageLite* prototype; @@ -646,9 +712,9 @@ class PROTOBUF_EXPORT MessageLite { void (*on_demand_register_arena_dtor)(MessageLite& msg, Arena& arena); bool (*is_initialized)(const MessageLite&); void (*merge_to_from)(MessageLite& to, const MessageLite& from_msg); + internal::MessageCreator message_creator; #if defined(PROTOBUF_CUSTOM_VTABLE) DeleteMessageF delete_message; - NewMessageF new_message; void (*clear)(MessageLite&); size_t (*byte_size_long)(const MessageLite&); uint8_t* (*serialize)(const MessageLite& msg, uint8_t* ptr, @@ -672,12 +738,14 @@ class PROTOBUF_EXPORT MessageLite { bool (*is_initialized)(const MessageLite&), void (*merge_to_from)(MessageLite& to, const MessageLite& from_msg), + internal::MessageCreator message_creator, uint32_t cached_size_offset, bool is_lite) : prototype(prototype), tc_table(tc_table), on_demand_register_arena_dtor(on_demand_register_arena_dtor), is_initialized(is_initialized), merge_to_from(merge_to_from), + message_creator(message_creator), cached_size_offset(cached_size_offset), is_lite(is_lite) {} #endif // !PROTOBUF_CUSTOM_VTABLE @@ -690,8 +758,8 @@ class PROTOBUF_EXPORT MessageLite { void (*on_demand_register_arena_dtor)(MessageLite&, Arena&), bool (*is_initialized)(const MessageLite&), void (*merge_to_from)(MessageLite& to, const MessageLite& from_msg), - DeleteMessageF delete_message, // - NewMessageF new_message, // + internal::MessageCreator message_creator, // + DeleteMessageF delete_message, // void (*clear)(MessageLite&), size_t (*byte_size_long)(const MessageLite&), uint8_t* (*serialize)(const MessageLite& msg, uint8_t* ptr, @@ -702,9 +770,9 @@ class PROTOBUF_EXPORT MessageLite { on_demand_register_arena_dtor(on_demand_register_arena_dtor), is_initialized(is_initialized), merge_to_from(merge_to_from), + message_creator(message_creator), #if defined(PROTOBUF_CUSTOM_VTABLE) delete_message(delete_message), - new_message(new_message), clear(clear), byte_size_long(byte_size_long), serialize(serialize), @@ -717,6 +785,18 @@ class PROTOBUF_EXPORT MessageLite { ABSL_DCHECK(!is_lite); return *static_cast(this); } + + MessageLite* New(Arena* arena) const { + return message_creator.New(prototype, prototype, arena); + } + + MessageLite* PlacementNew(void* mem, Arena* arena) const { + return message_creator.PlacementNew(prototype, prototype, mem, arena); + } + + uint32_t allocation_size() const { + return message_creator.allocation_size(); + } }; template struct ClassDataLite { @@ -879,6 +959,7 @@ class PROTOBUF_EXPORT MessageLite { friend class internal::WeakFieldMap; friend class internal::WireFormatLite; friend class internal::RustMapHelper; + friend struct internal::TcParseTableBase; template friend class Arena::InternalHelper; @@ -1085,6 +1166,122 @@ inline void AssertDownCast(const MessageLite& from, const MessageLite& to) { << "Cannot downcast " << from.GetTypeName() << " to " << to.GetTypeName(); } +template +PROTOBUF_ALWAYS_INLINE inline MessageLite* MessageCreator::PlacementNew( + const MessageLite* prototype_for_func, + const MessageLite* prototype_for_copy, void* mem, Arena* arena) const { + const Tag as_tag = tag(); + // When the feature is not enabled we skip the `as_tag` check since it is + // unnecessary. Except for testing, where we want to test the copy logic even + // when we can't use it for real messages. + constexpr bool kMustBeFunc = !test_call && !internal::EnableCustomNew(); + static_assert(kFunc < 0 && !(kZeroInit < 0) && !(kMemcpy < 0), + "Only kFunc must be the only negative value"); + if (ABSL_PREDICT_FALSE(kMustBeFunc || as_tag < 0)) { + PROTOBUF_DEBUG_COUNTER("MessageCreator.Func").Inc(); + return static_cast(func_(prototype_for_func, mem, arena)); + } + + char* dst = static_cast(mem); + const size_t size = allocation_size_; + const char* src = reinterpret_cast(prototype_for_copy); + + // These are a bit more efficient than calling normal memset/memcpy because: + // - We know the minimum size is 16. We have a fallback for when it is not. + // - We can "underflow" the buffer because those are the MessageLite bytes + // we will set later. +#ifndef PROTO2_OPENSOURCE + // This manual handling shows a 1.85% improvement in the parsing + // microbenchmark. + // TODO: Verify this is still the case. +#endif // !PROTO2_OPENSOUCE + if (as_tag == kZeroInit) { + // Make sure the input is really all zeros. + ABSL_DCHECK(std::all_of(src + sizeof(MessageLite), src + size, + [](auto c) { return c == 0; })); + + if (sizeof(MessageLite) != 16) { + memset(dst, 0, size); + } else if (size <= 32) { + memset(dst + size - 16, 0, 16); + } else if (size <= 64) { + memset(dst + 16, 0, 16); + memset(dst + size - 32, 0, 32); + } else { + for (size_t offset = 16; offset + 64 < size; offset += 64) { + absl::PrefetchToLocalCacheForWrite(dst + offset + 64); + memset(dst + offset, 0, 64); + } + memset(dst + size - 64, 0, 64); + } + } else { + ABSL_DCHECK_EQ(+as_tag, +kMemcpy); + + if (sizeof(MessageLite) != 16) { + memcpy(dst, src, size); + } else if (size <= 32) { + memcpy(dst + size - 16, src + size - 16, 16); + } else if (size <= 64) { + memcpy(dst + 16, src + 16, 16); + memcpy(dst + size - 32, src + size - 32, 32); + } else { + for (size_t offset = 16; offset + 64 < size; offset += 64) { + absl::PrefetchToLocalCache(src + offset + 64); + absl::PrefetchToLocalCacheForWrite(dst + offset + 64); + memcpy(dst + offset, src + offset, 64); + } + memcpy(dst + size - 64, src + size - 64, 64); + } + } + + if (arena_bits() != 0) { + if (as_tag == kZeroInit) { + PROTOBUF_DEBUG_COUNTER("MessageCreator.ZeroArena").Inc(); + } else { + PROTOBUF_DEBUG_COUNTER("MessageCreator.McpyArena").Inc(); + } + } else { + if (as_tag == kZeroInit) { + PROTOBUF_DEBUG_COUNTER("MessageCreator.Zero").Inc(); + } else { + PROTOBUF_DEBUG_COUNTER("MessageCreator.Mcpy").Inc(); + } + } + + if (internal::PerformDebugChecks() || arena != nullptr) { + if (uintptr_t offsets = arena_bits()) { + do { + const size_t offset = absl::countr_zero(offsets) * sizeof(Arena*); + ABSL_DCHECK_LE(offset + sizeof(Arena*), size); + // Verify we are overwriting a null pointer. If we are not, there is a + // bug somewhere. + ABSL_DCHECK_EQ(*reinterpret_cast(dst + offset), nullptr); + memcpy(dst + offset, &arena, sizeof(arena)); + offsets &= offsets - 1; + } while (offsets != 0); + } + } + + // The second memcpy overwrites part of the first, but the compiler should + // avoid the double-write. It's easier than trying to avoid the overlap. + memcpy(dst, static_cast(prototype_for_copy), + sizeof(MessageLite)); + memcpy(dst + PROTOBUF_FIELD_OFFSET(MessageLite, _internal_metadata_), &arena, + sizeof(arena)); + return Launder(reinterpret_cast(mem)); +} + +template +PROTOBUF_ALWAYS_INLINE inline MessageLite* MessageCreator::New( + const MessageLite* prototype_for_func, + const MessageLite* prototype_for_copy, Arena* arena) const { + return PlacementNew(prototype_for_func, prototype_for_copy, + arena != nullptr + ? arena->AllocateAligned(allocation_size_) + : ::operator new(allocation_size_), + arena); +} + } // namespace internal std::string ShortFormat(const MessageLite& message_lite); diff --git a/src/google/protobuf/message_unittest.cc b/src/google/protobuf/message_unittest.cc index 3dfb3dab55..745fb1423c 100644 --- a/src/google/protobuf/message_unittest.cc +++ b/src/google/protobuf/message_unittest.cc @@ -10,6 +10,8 @@ // Sanjay Ghemawat, Jeff Dean, and others. #include +#include +#include #include #include @@ -20,6 +22,7 @@ #include "google/protobuf/has_bits.h" #include "google/protobuf/internal_visibility.h" #include "google/protobuf/message_lite.h" +#include "google/protobuf/port.h" #include "google/protobuf/unittest.pb.h" #include "google/protobuf/unittest_import.pb.h" #include "google/protobuf/unittest_lite.pb.h" diff --git a/src/google/protobuf/port.h b/src/google/protobuf/port.h index 27f19d43a8..ed021cd3a7 100644 --- a/src/google/protobuf/port.h +++ b/src/google/protobuf/port.h @@ -260,6 +260,15 @@ inline constexpr bool DebugHardenClearOneofMessageOnArena() { #endif } +constexpr bool PerformDebugChecks() { +#if defined(NDEBUG) && !defined(PROTOBUF_ASAN) && !defined(PROTOBUF_MSAN) && \ + !defined(PROTOBUF_TSAN) + return false; +#else + return true; +#endif +} + // Returns true if pointers are 8B aligned, leaving least significant 3 bits // available. inline constexpr bool PtrIsAtLeast8BAligned() { return alignof(void*) >= 8; } @@ -325,6 +334,31 @@ inline void PrefetchToLocalCache(const void* ptr) { absl::PrefetchToLocalCache(ptr); } +template +constexpr T* Launder(T* p) { +#if defined(__cpp_lib_launder) && __cpp_lib_launder >= 201606L + return std::launder(p); +#elif ABSL_HAVE_BUILTIN(__builtin_launder) + return __builtin_launder(p); +#else + return p; +#endif +} + +#if ABSL_HAVE_BUILTIN(__is_bitwise_cloneable) +constexpr bool EnableCustomNew() { return true; } +template +constexpr bool EnableCustomNewFor() { + return __is_bitwise_cloneable(T); +} +#else +constexpr bool EnableCustomNew() { return false; } +template +constexpr bool EnableCustomNewFor() { + return false; +} +#endif + constexpr bool IsOss() { return true; } // Counter library for debugging internal protobuf logic. diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index 3f8065be79..5d13a3f676 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -443,6 +443,11 @@ class RepeatedField final // This is public due to it being called by generated code. inline void InternalSwap(RepeatedField* other); + static constexpr size_t InternalGetArenaOffset(internal::InternalVisibility) { + return PROTOBUF_FIELD_OFFSET(RepeatedField, soo_rep_) + + PROTOBUF_FIELD_OFFSET(internal::ShortSooRep, arena_and_size); + } + private: using InternalArenaConstructable_ = void; // We use std::max in order to share template instantiations between diff --git a/src/google/protobuf/repeated_ptr_field.h b/src/google/protobuf/repeated_ptr_field.h index fcd99edc1b..eb54fc86e1 100644 --- a/src/google/protobuf/repeated_ptr_field.h +++ b/src/google/protobuf/repeated_ptr_field.h @@ -535,6 +535,10 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { // Gets the Arena on which this RepeatedPtrField stores its elements. inline Arena* GetArena() const { return arena_; } + static constexpr size_t InternalGetArenaOffset(internal::InternalVisibility) { + return PROTOBUF_FIELD_OFFSET(RepeatedPtrFieldBase, arena_); + } + private: using InternalArenaConstructable_ = void; using DestructorSkippable_ = void; @@ -1225,6 +1229,8 @@ class RepeatedPtrField final : private internal::RepeatedPtrFieldBase { internal::RepeatedPtrFieldBase::InternalSwap(other); } + using RepeatedPtrFieldBase::InternalGetArenaOffset; + private: using InternalArenaConstructable_ = void; diff --git a/src/google/protobuf/unittest.proto b/src/google/protobuf/unittest.proto index ce2cdc9fea..9561ee6b14 100644 --- a/src/google/protobuf/unittest.proto +++ b/src/google/protobuf/unittest.proto @@ -1853,3 +1853,27 @@ message TestMessageWithManyRepeatedPtrFields { repeated string repeated_string_31 = 31; repeated string repeated_string_32 = 32; } + +message MessageCreatorZeroInit { + optional int32 i = 1; + optional double d = 2; + optional MessageCreatorZeroInit m = 3; + oneof one { + string os = 10; + string oc = 11 [ctype=CORD]; + fixed64 of = 12; + MessageCreatorZeroInit ol = 13 [lazy=true]; + } +} + +message MessageCreatorMemcpy { + optional string s = 1; + repeated int32 i = 2 [packed=true]; + optional MessageCreatorMemcpy m = 3 [lazy=true]; + map m2 = 4; +} + +message MessageCreatorFunc { + // This one is ArenaDtorNeeds::kRequired so we must run the constructor. + optional string c = 3 [ctype=CORD]; +}