diff options
Diffstat (limited to 'upb')
-rw-r--r-- | upb/bindings/googlepb/bridge.cc | 7 | ||||
-rw-r--r-- | upb/bindings/googlepb/proto2.cc | 230 | ||||
-rw-r--r-- | upb/bindings/lua/upb.c | 19 | ||||
-rw-r--r-- | upb/def.c | 26 | ||||
-rw-r--r-- | upb/def.h | 35 | ||||
-rw-r--r-- | upb/descriptor/descriptor.proto | 111 | ||||
-rwxr-xr-x | upb/descriptor/descriptor.upb.c | 538 | ||||
-rwxr-xr-x | upb/descriptor/descriptor.upb.h | 121 | ||||
-rw-r--r-- | upb/descriptor/reader.c | 9 | ||||
-rw-r--r-- | upb/handlers.c | 72 | ||||
-rw-r--r-- | upb/pb/compile_decoder.c | 418 | ||||
-rw-r--r-- | upb/pb/compile_decoder_x64.c | 2 | ||||
-rw-r--r-- | upb/pb/compile_decoder_x64.dasc | 78 | ||||
-rw-r--r-- | upb/pb/decoder.c | 225 | ||||
-rw-r--r-- | upb/pb/decoder.h | 97 | ||||
-rw-r--r-- | upb/pb/decoder.int.h | 31 | ||||
-rw-r--r-- | upb/pb/glue.c | 4 |
17 files changed, 1345 insertions, 678 deletions
diff --git a/upb/bindings/googlepb/bridge.cc b/upb/bindings/googlepb/bridge.cc index a125249..c8e3474 100644 --- a/upb/bindings/googlepb/bridge.cc +++ b/upb/bindings/googlepb/bridge.cc @@ -109,10 +109,6 @@ const MessageDef* DefBuilder::GetMaybeUnfrozenMessageDef( for (int i = 0; i < fields.size(); i++) { const goog::FieldDescriptor* proto2_f = fields[i]; assert(proto2_f); -#ifdef UPB_GOOGLE3 - // Skip lazy fields for now since we can't properly handle them. - if (proto2_f->options().lazy()) continue; -#endif md->AddField(NewFieldDef(proto2_f, m), &status); } ASSERT_STATUS(&status); @@ -135,6 +131,9 @@ reffed_ptr<FieldDef> DefBuilder::NewFieldDef(const goog::FieldDescriptor* f, Status status; upb_f->set_number(f->number(), &status); upb_f->set_label(FieldDef::ConvertLabel(f->label())); +#ifdef UPB_GOOGLE3 + upb_f->set_lazy(f->options().lazy()); +#endif if (f->is_extension()) { upb_f->set_name(f->full_name(), &status); diff --git a/upb/bindings/googlepb/proto2.cc b/upb/bindings/googlepb/proto2.cc index c0b4907..04e504b 100644 --- a/upb/bindings/googlepb/proto2.cc +++ b/upb/bindings/googlepb/proto2.cc @@ -42,9 +42,14 @@ namespace google_opensource { class GMR_Handlers; } #ifdef UPB_GOOGLE3 +// TODO(haberman): Add public functionality to ExtensionSet for populating +// LazyFields. +#define private public +#include "net/proto2/public/extension_set.h" +#undef private + #include "net/proto2/proto/descriptor.pb.h" #include "net/proto2/public/descriptor.h" -#include "net/proto2/public/extension_set.h" #include "net/proto2/public/generated_message_reflection.h" #include "net/proto2/public/lazy_field.h" #include "net/proto2/public/message.h" @@ -66,9 +71,12 @@ namespace me = ::upb::google_google3; #include "google/protobuf/generated_message_reflection.h" #undef private +#define private public +#include "google/protobuf/extension_set.h" +#undef private + #include "google/protobuf/descriptor.h" #include "google/protobuf/descriptor.pb.h" -#include "google/protobuf/extension_set.h" #include "google/protobuf/message.h" namespace goog = ::google::protobuf; @@ -176,9 +184,14 @@ case goog::FieldDescriptor::cpptype: \ } case goog::FieldDescriptor::CPPTYPE_MESSAGE: #ifdef UPB_GOOGLE3 - if (proto2_f->options().lazy()) { - assert(false); - return false; // Not yet implemented. + if (proto2_f->options().lazy() && + // proto2 lets you set lazy=true on a repeated field, but doesn't + // actually support lazy repeated messages, so just ignore + // lazy=true for repeated messages. + !proto2_f->is_repeated()) { + // Supports lazy fields and lazy extensions. + SetLazyFieldHandlers(proto2_f, m, r, upb_f, h); + return true; } #endif if (proto2_f->is_extension()) { @@ -267,12 +280,14 @@ case goog::FieldDescriptor::cpptype: \ const goog::FieldDescriptor* proto2_f, const goog::internal::GeneratedMessageReflection* r) : offset_(r->extensions_offset_), - number_(proto2_f->number()), - type_(proto2_f->type()) { + field_descriptor_(proto2_f) { } - int number() const { return number_; } - goog::internal::FieldType type() const { return type_; } + int number() const { return field_descriptor_->number(); } + goog::internal::FieldType type() const { return field_descriptor_->type(); } + const goog::FieldDescriptor* field_descriptor() const { + return field_descriptor_; + } goog::internal::ExtensionSet* GetExtensionSet(goog::Message* m) const { return GetPointer<goog::internal::ExtensionSet>(m, offset_); @@ -280,8 +295,10 @@ case goog::FieldDescriptor::cpptype: \ private: const size_t offset_; - int number_; - goog::internal::FieldType type_; + // We know it will outlive because we require that the input message used to + // build these handlers outlives us, and the descriptor will outlive the + // message. + const goog::FieldDescriptor* field_descriptor_; }; // StartSequence ///////////////////////////////////////////////////////////// @@ -693,10 +710,27 @@ case goog::FieldDescriptor::cpptype: \ #ifdef UPB_GOOGLE3 // Handlers for types/features only included in internal proto2 release: // Cord, StringPiece, LazyField, and MessageSet. - // TODO(haberman): LazyField, MessageSet. + // TODO(haberman): MessageSet. // Cord ////////////////////////////////////////////////////////////////////// + static void AppendBufToCord(const char* buf, size_t n, + const upb::BufferHandle* handle, Cord* c) { + const Cord* source_cord = handle->GetAttachedObject<Cord>(); + if (source_cord) { + // This TODO is copied from CordReader::CopyToCord(): + // "We could speed this up by using CordReader internals." + Cord piece(*source_cord); + piece.RemovePrefix(handle->object_offset() + (buf - handle->buffer())); + assert(piece.size() >= n); + piece.RemoveSuffix(piece.size() - n); + + c->Append(piece); + } else { + c->Append(StringPiece(buf, n)); + } + } + static void SetCordHandlers( const proto2::FieldDescriptor* proto2_f, const proto2::internal::GeneratedMessageReflection* r, @@ -723,19 +757,7 @@ case goog::FieldDescriptor::cpptype: \ static void OnCordBuf(Cord* c, const char* buf, size_t n, const upb::BufferHandle* handle) { - const Cord* source_cord = handle->GetAttachedObject<Cord>(); - if (source_cord) { - // This TODO is copied from CordReader::CopyToCord(): - // "We could speed this up by using CordReader internals." - Cord piece(*source_cord); - piece.RemovePrefix(handle->object_offset() + (buf - handle->buffer())); - assert(piece.size() >= n); - piece.RemoveSuffix(piece.size() - n); - - c->Append(piece); - } else { - c->Append(StringPiece(buf, n)); - } + AppendBufToCord(buf, n, handle, c); } static Cord* StartRepeatedCord(proto2::RepeatedField<Cord>* r, @@ -795,6 +817,164 @@ case goog::FieldDescriptor::cpptype: \ return field; } + // LazyField ///////////////////////////////////////////////////////////////// + + // For lazy fields we set both lazy and eager handlers. The user can + // configure the data source to call either, though lazy handlers may only be + // used when the source data is binary protobuf. + static void SetLazyFieldHandlers( + const proto2::FieldDescriptor* proto2_f, + const proto2::Message& m, + const proto2::internal::GeneratedMessageReflection* r, + const upb::FieldDef* f, upb::Handlers* h) { + assert(!proto2_f->is_repeated()); + const goog::Message* field_prototype = GetFieldPrototype(m, proto2_f); + CHKRET(h->SetStringHandler(f, UpbMakeHandler(OnLazyFieldBuf))); + if (proto2_f->is_extension()) { + CHKRET(h->SetStartStringHandler( + f, UpbBind(StartLazyExtension, new ExtensionFieldData(proto2_f, r)))); + CHKRET(h->SetStartSubMessageHandler( + f, UpbBind(StartSubMessageExtension, + new SubMessageExtensionHandlerData(proto2_f, r, + field_prototype)))); + } else { + CHKRET(h->SetStartStringHandler( + f, UpbBind(StartLazyField, new FieldOffset(proto2_f, r)))); + CHKRET(h->SetStartSubMessageHandler( + f, UpbBind(StartLazyFieldEager, + new SubMessageHandlerData(proto2_f, r, field_prototype)))); + } + } + + static proto2::internal::LazyField* StartLazyField(proto2::Message* m, + const FieldOffset* offset, + size_t size_hint) { + UPB_UNUSED(size_hint); + offset->SetHasbit(m); + proto2::internal::LazyField* field = + offset->GetFieldPointer<proto2::internal::LazyField>(m); + field->Clear(); + return field; + } + + // For when the field has a lazy representation but we parse it eagerly anyway + // (either because we want to or because we're parsing from a format other + // than binary protobuf). + static proto2::Message* StartLazyFieldEager( + proto2::Message* m, const SubMessageHandlerData* data) { + data->SetHasbit(m); + proto2::internal::LazyField* field = + data->GetFieldPointer<proto2::internal::LazyField>(m); + return field->MutableByPrototype(*data->prototype()); + } + + class LazyMessageExtensionImpl + : public proto2::internal::ExtensionSet::LazyMessageExtension { + public: + LazyMessageExtensionImpl() {} + virtual ~LazyMessageExtensionImpl() {} + + virtual LazyMessageExtension* New() const { + return new LazyMessageExtensionImpl(); + } + + virtual const proto2::MessageLite& GetMessage( + const proto2::MessageLite& prototype) const { + return lazy_field_.GetByPrototype( + static_cast<const proto2::Message&>(prototype)); + } + + virtual proto2::MessageLite* MutableMessage( + const proto2::MessageLite& prototype) { + return lazy_field_.MutableByPrototype( + static_cast<const proto2::Message&>(prototype)); + } + + virtual void SetAllocatedMessage(proto2::MessageLite* message) { + return lazy_field_.SetAllocated(static_cast<proto2::Message*>(message)); + } + + virtual proto2::MessageLite* ReleaseMessage( + const proto2::MessageLite& prototype) { + return lazy_field_.ReleaseByPrototype( + static_cast<const proto2::Message&>(prototype)); + } + + virtual bool IsInitialized() const { return true; } + + virtual int ByteSize() const { return lazy_field_.MessageByteSize(); } + + int SpaceUsed() const { + return sizeof(*this) + lazy_field_.SpaceUsedExcludingSelf(); + } + + virtual void MergeFrom(const LazyMessageExtension& other) { + MergeFrom(*static_cast<const LazyMessageExtensionImpl*>(&other)); + } + + virtual void MergeFrom(const LazyMessageExtensionImpl& other) { + lazy_field_.MergeFrom(other.lazy_field_); + } + + virtual void Clear() { lazy_field_.Clear(); } + + virtual bool ReadMessage(const proto2::MessageLite& prototype, + proto2::io::CodedInputStream* input) { + return lazy_field_.Read(input); + } + + virtual void WriteMessage(int number, + proto2::io::CodedOutputStream* output) const { + lazy_field_.Write(number, output); + } + + virtual uint8* WriteMessageToArray(int number, uint8* target) const { + return lazy_field_.WriteToArray(number, target); + } + + proto2::internal::LazyField& lazy_field() { return lazy_field_; } + + private: + proto2::internal::LazyField lazy_field_; + DISALLOW_COPY_AND_ASSIGN(LazyMessageExtensionImpl); + }; + + static proto2::internal::LazyField* StartLazyExtension( + proto2::Message* m, const ExtensionFieldData* data, size_t size_hint) { + proto2::internal::ExtensionSet* set = data->GetExtensionSet(m); + + // We have to break encapsulation here since no public accessors expose the + // LazyField. + // + // TODO(haberman): add a function to ExtensionSet that allows us to set the + // lazy field directly. + proto2::internal::ExtensionSet::Extension* item; + LazyMessageExtensionImpl* lazy_extension; + if (set->MaybeNewExtension(data->number(), data->field_descriptor(), + &item)) { + lazy_extension = new LazyMessageExtensionImpl(); + item->type = UPB_DESCRIPTOR_TYPE_MESSAGE; + item->is_repeated = false; + item->is_lazy = true; + item->lazymessage_value = lazy_extension; + } else { + lazy_extension = + CheckDownCast<LazyMessageExtensionImpl*>(item->lazymessage_value); + } + + item->is_cleared = false; + + return &lazy_extension->lazy_field(); + } + + static void OnLazyFieldBuf(proto2::internal::LazyField* field, + const char* buf, size_t len, + const upb::BufferHandle* handle) { + Cord encoded(field->GetEncoded()); + AppendBufToCord(buf, len, handle, &encoded); + field->SetEncoded(encoded); + } + #endif // UPB_GOOGLE3 }; diff --git a/upb/bindings/lua/upb.c b/upb/bindings/lua/upb.c index 1e7540a..022d689 100644 --- a/upb/bindings/lua/upb.c +++ b/upb/bindings/lua/upb.c @@ -326,6 +326,10 @@ static void lupb_fielddef_dosetlabel(lua_State *L, upb_fielddef *f, int narg) { upb_fielddef_setlabel(f, label); } +static void lupb_fielddef_dosetlazy(lua_State *L, upb_fielddef *f, int narg) { + upb_fielddef_setlazy(f, chkbool(L, narg, "lazy")); +} + static void lupb_fielddef_dosetname(lua_State *L, upb_fielddef *f, int narg) { CHK(upb_fielddef_setname(f, chkname(L, narg), &status)); } @@ -402,6 +406,12 @@ static int lupb_fielddef_setlabel(lua_State *L) { return 0; } +static int lupb_fielddef_setlazy(lua_State *L) { + upb_fielddef *f = lupb_fielddef_checkmutable(L, 1); + lupb_fielddef_dosetlazy(L, f, 2); + return 0; +} + static int lupb_fielddef_setname(lua_State *L) { upb_fielddef *f = lupb_fielddef_checkmutable(L, 1); lupb_fielddef_dosetname(L, f, 2); @@ -466,6 +476,7 @@ static int lupb_fielddef_new(lua_State *L) { else if (streql(key, "number")) lupb_fielddef_dosetnumber(L, f, v); else if (streql(key, "type")) lupb_fielddef_dosettype(L, f, v); else if (streql(key, "label")) lupb_fielddef_dosetlabel(L, f, v); + else if (streql(key, "lazy")) lupb_fielddef_dosetlazy(L, f, v); else if (streql(key, "is_extension")) lupb_fielddef_dosetisextension(L, f, v); else if (streql(key, "containing_type_name")) @@ -541,6 +552,12 @@ static int lupb_fielddef_label(lua_State *L) { return 1; } +static int lupb_fielddef_lazy(lua_State *L) { + const upb_fielddef *f = lupb_fielddef_check(L, 1); + lua_pushboolean(L, upb_fielddef_lazy(f)); + return 1; +} + static int lupb_fielddef_name(lua_State *L) { const upb_fielddef *f = lupb_fielddef_check(L, 1); lua_pushstring(L, upb_fielddef_name(f)); @@ -653,6 +670,7 @@ static const struct luaL_Reg lupb_fielddef_m[] = { {"is_extension", lupb_fielddef_isextension}, {"istagdelim", lupb_fielddef_istagdelim}, {"label", lupb_fielddef_label}, + {"lazy", lupb_fielddef_lazy}, {"name", lupb_fielddef_name}, {"number", lupb_fielddef_number}, {"subdef", lupb_fielddef_subdef}, @@ -663,6 +681,7 @@ static const struct luaL_Reg lupb_fielddef_m[] = { {"set_default", lupb_fielddef_setdefault}, {"set_is_extension", lupb_fielddef_setisextension}, {"set_label", lupb_fielddef_setlabel}, + {"set_lazy", lupb_fielddef_setlazy}, {"set_name", lupb_fielddef_setname}, {"set_number", lupb_fielddef_setnumber}, {"set_subdef", lupb_fielddef_setsubdef}, @@ -145,6 +145,12 @@ static bool upb_validate_field(upb_fielddef *f, upb_status *s) { upb_status_seterrmsg(s, "fielddef type was not initialized"); return false; } + if (upb_fielddef_lazy(f) && + upb_fielddef_descriptortype(f) != UPB_DESCRIPTOR_TYPE_MESSAGE) { + upb_status_seterrmsg(s, + "only length-delimited submessage fields may be lazy"); + return false; + } if (upb_fielddef_hassubdef(f)) { if (f->subdef_is_symbolic) { upb_status_seterrf(s, @@ -463,6 +469,7 @@ upb_fielddef *upb_fielddef_new(const void *owner) { f->type_is_set_ = false; f->tagdelim = false; f->is_extension_ = false; + f->lazy_ = false; // For the moment we default this to UPB_INTFMT_VARIABLE, since it will work // with all integer types and is in some since more "default" since the most @@ -565,6 +572,10 @@ bool upb_fielddef_isextension(const upb_fielddef *f) { return f->is_extension_; } +bool upb_fielddef_lazy(const upb_fielddef *f) { + return f->lazy_; +} + const char *upb_fielddef_name(const upb_fielddef *f) { return upb_def_fullname(UPB_UPCAST(f)); } @@ -824,10 +835,14 @@ upb_descriptortype_t upb_fielddef_descriptortype(const upb_fielddef *f) { return 0; } -bool upb_fielddef_setisextension(upb_fielddef *f, bool is_extension) { +void upb_fielddef_setisextension(upb_fielddef *f, bool is_extension) { assert(!upb_fielddef_isfrozen(f)); f->is_extension_ = is_extension; - return true; +} + +void upb_fielddef_setlazy(upb_fielddef *f, bool lazy) { + assert(!upb_fielddef_isfrozen(f)); + f->lazy_ = lazy; } void upb_fielddef_setlabel(upb_fielddef *f, upb_label_t label) { @@ -836,17 +851,16 @@ void upb_fielddef_setlabel(upb_fielddef *f, upb_label_t label) { f->label_ = label; } -bool upb_fielddef_setintfmt(upb_fielddef *f, upb_intfmt_t fmt) { +void upb_fielddef_setintfmt(upb_fielddef *f, upb_intfmt_t fmt) { assert(!upb_fielddef_isfrozen(f)); assert(upb_fielddef_checkintfmt(fmt)); f->intfmt = fmt; - return true; } -bool upb_fielddef_settagdelim(upb_fielddef *f, bool tag_delim) { +void upb_fielddef_settagdelim(upb_fielddef *f, bool tag_delim) { assert(!upb_fielddef_isfrozen(f)); f->tagdelim = tag_delim; - return true; + f->tagdelim = tag_delim; } static bool checksetdefault(upb_fielddef *f, upb_fieldtype_t type) { @@ -274,6 +274,20 @@ class upb::FieldDef /* : public upb::Def */ { uint32_t number() const; // Returns 0 if uninitialized. bool is_extension() const; + // For UPB_TYPE_MESSAGE fields only where is_tag_delimited() == false, + // indicates whether this field should have lazy parsing handlers that yield + // the unparsed string for the submessage. + // + // When we freeze, we ensure that this can only be true for length-delimited + // message fields. Prior to freezing this can be true or false with no + // restrictions. + // + // TODO(haberman): I think we want to move this into a FieldOptions container + // when we add support for custom options (the FieldOptions struct will + // contain both regular FieldOptions like "lazy" *and* custom options). + bool lazy() const; + void set_lazy(bool lazy); + // An integer that can be used as an index into an array of fields for // whatever message this field belongs to. Guaranteed to be less than // f->containing_type()->field_count(). May only be accessed once the def has @@ -450,6 +464,7 @@ struct upb_fielddef { bool default_is_string; bool type_is_set_; // False until type is explicitly set. bool is_extension_; + bool lazy_; upb_intfmt_t intfmt; bool tagdelim; upb_fieldtype_t type_; @@ -459,14 +474,14 @@ struct upb_fielddef { uint32_t index_; }; -#define UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, name, \ - num, msgdef, subdef, selector_base, index, \ +#define UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, lazy, \ + name, num, msgdef, subdef, selector_base, index, \ defaultval, refs, ref2s) \ { \ UPB_DEF_INIT(name, UPB_DEF_FIELD, refs, ref2s), defaultval, {msgdef}, \ {subdef}, false, false, \ type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES, true, is_extension, \ - intfmt, tagdelim, type, label, num, selector_base, index \ + lazy, intfmt, tagdelim, type, label, num, selector_base, index \ } // Native C API. @@ -496,6 +511,7 @@ upb_label_t upb_fielddef_label(const upb_fielddef *f); uint32_t upb_fielddef_number(const upb_fielddef *f); const char *upb_fielddef_name(const upb_fielddef *f); bool upb_fielddef_isextension(const upb_fielddef *f); +bool upb_fielddef_lazy(const upb_fielddef *f); const upb_msgdef *upb_fielddef_containingtype(const upb_fielddef *f); upb_msgdef *upb_fielddef_containingtype_mutable(upb_fielddef *f); const char *upb_fielddef_containingtypename(upb_fielddef *f); @@ -528,9 +544,10 @@ bool upb_fielddef_setnumber(upb_fielddef *f, uint32_t number, upb_status *s); bool upb_fielddef_setname(upb_fielddef *f, const char *name, upb_status *s); bool upb_fielddef_setcontainingtypename(upb_fielddef *f, const char *name, upb_status *s); -bool upb_fielddef_setisextension(upb_fielddef *f, bool is_extension); -bool upb_fielddef_setintfmt(upb_fielddef *f, upb_intfmt_t fmt); -bool upb_fielddef_settagdelim(upb_fielddef *f, bool tag_delim); +void upb_fielddef_setisextension(upb_fielddef *f, bool is_extension); +void upb_fielddef_setlazy(upb_fielddef *f, bool lazy); +void upb_fielddef_setintfmt(upb_fielddef *f, upb_intfmt_t fmt); +void upb_fielddef_settagdelim(upb_fielddef *f, bool tag_delim); void upb_fielddef_setdefaultint64(upb_fielddef *f, int64_t val); void upb_fielddef_setdefaultint32(upb_fielddef *f, int32_t val); void upb_fielddef_setdefaultuint64(upb_fielddef *f, uint64_t val); @@ -1071,6 +1088,12 @@ inline const char* FieldDef::name() const { return upb_fielddef_name(this); } inline bool FieldDef::is_extension() const { return upb_fielddef_isextension(this); } +inline bool FieldDef::lazy() const { + return upb_fielddef_lazy(this); +} +inline void FieldDef::set_lazy(bool lazy) { + upb_fielddef_setlazy(this, lazy); +} inline const MessageDef* FieldDef::containing_type() const { return upb_fielddef_containingtype(this); } diff --git a/upb/descriptor/descriptor.proto b/upb/descriptor/descriptor.proto index 233f879..a785f79 100644 --- a/upb/descriptor/descriptor.proto +++ b/upb/descriptor/descriptor.proto @@ -59,6 +59,11 @@ message FileDescriptorProto { // Names of files imported by this file. repeated string dependency = 3; + // Indexes of the public imported files in the dependency list above. + repeated int32 public_dependency = 10; + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + repeated int32 weak_dependency = 11; // All top-level definitions in this file. repeated DescriptorProto message_type = 4; @@ -101,13 +106,13 @@ message FieldDescriptorProto { // Order is weird for historical reasons. TYPE_DOUBLE = 1; TYPE_FLOAT = 2; - TYPE_INT64 = 3; // Not ZigZag encoded. Negative numbers - // take 10 bytes. Use TYPE_SINT64 if negative - // values are likely. + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + TYPE_INT64 = 3; TYPE_UINT64 = 4; - TYPE_INT32 = 5; // Not ZigZag encoded. Negative numbers - // take 10 bytes. Use TYPE_SINT32 if negative - // values are likely. + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + TYPE_INT32 = 5; TYPE_FIXED64 = 6; TYPE_FIXED32 = 7; TYPE_BOOL = 8; @@ -199,6 +204,7 @@ message MethodDescriptorProto { optional MethodOptions options = 4; } + // =================================================================== // Options @@ -220,10 +226,15 @@ message MethodDescriptorProto { // through 99999. It is up to you to ensure that you do not use the // same number for multiple options. // * For options which will be published and used publicly by multiple -// independent entities, e-mail kenton@google.com to reserve extension -// numbers. Simply tell me how many you need and I'll send you back a -// set of numbers to use -- there's no need to explain how you intend to -// use them. If this turns out to be popular, a web service will be set up +// independent entities, e-mail protobuf-global-extension-registry@google.com +// to reserve extension numbers. Simply provide your project name (e.g. +// Object-C plugin) and your porject website (if available) -- there's no need +// to explain how you intend to use them. Usually you only need one extension +// number. You can declare multiple options with only one extension number by +// putting them in a sub-message. See the Custom Options section of the docs +// for examples: +// http://code.google.com/apis/protocolbuffers/docs/proto.html#options +// If this turns out to be popular, a web service will be set up // to automatically assign option numbers. @@ -266,6 +277,9 @@ message FileOptions { } optional OptimizeMode optimize_for = 9 [default=SPEED]; + // Sets the Go package where structs generated from this .proto will be + // placed. There is no default. + optional string go_package = 11; @@ -344,6 +358,37 @@ message FieldOptions { optional bool packed = 2; + + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outher message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + optional bool lazy = 5 [default=false]; + // Is this field deprecated? // Depending on the target platform, this can emit Deprecated annotations // for accessors, or it will be completely ignored; in the very least, this @@ -364,6 +409,9 @@ message FieldOptions { // TODO: Fully-implement this, then remove the "experimental_" prefix. optional string experimental_map_key = 9; + // For Google-internal migration only. Do not use. + optional bool weak = 10 [default=false]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -373,6 +421,10 @@ message FieldOptions { message EnumOptions { + // Set this option to false to disallow mapping different tag names to a same + // value. + optional bool allow_alias = 2 [default=true]; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -416,6 +468,7 @@ message MethodOptions { extensions 1000 to max; } + // A message representing a option the parser does not recognize. This only // appears in options protos created by the compiler::Parser class. // DescriptorPool resolves these when building Descriptor objects. Therefore, @@ -527,7 +580,41 @@ message SourceCodeInfo { // 1 to each before displaying to a user. repeated int32 span = 2 [packed=true]; - // TODO(kenton): Record comments appearing before and after the - // declaration. + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + optional string leading_comments = 3; + optional string trailing_comments = 4; } } diff --git a/upb/descriptor/descriptor.upb.c b/upb/descriptor/descriptor.upb.c index 8046bcd..fa2f447 100755 --- a/upb/descriptor/descriptor.upb.c +++ b/upb/descriptor/descriptor.upb.c @@ -5,272 +5,292 @@ #include "upb/def.h" const upb_msgdef google_protobuf_msgs[20]; -const upb_fielddef google_protobuf_fields[73]; +const upb_fielddef google_protobuf_fields[81]; const upb_enumdef google_protobuf_enums[4]; -const upb_tabent google_protobuf_strentries[192]; +const upb_tabent google_protobuf_strentries[204]; const upb_tabent google_protobuf_intentries[14]; -const _upb_value google_protobuf_arrays[224]; +const _upb_value google_protobuf_arrays[232]; #ifdef UPB_DEBUG_REFS -static upb_inttable reftables[194]; +static upb_inttable reftables[210]; #endif const upb_msgdef google_protobuf_msgs[20] = { UPB_MSGDEF_INIT("google.protobuf.DescriptorProto", 27, 6, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[0], 8, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[0]),&reftables[0], &reftables[1]), UPB_MSGDEF_INIT("google.protobuf.DescriptorProto.ExtensionRange", 4, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[8], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[16]),&reftables[2], &reftables[3]), UPB_MSGDEF_INIT("google.protobuf.EnumDescriptorProto", 11, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[11], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[20]),&reftables[4], &reftables[5]), - UPB_MSGDEF_INIT("google.protobuf.EnumOptions", 6, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[0], &google_protobuf_arrays[15], 4, 0), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[24]),&reftables[6], &reftables[7]), - UPB_MSGDEF_INIT("google.protobuf.EnumValueDescriptorProto", 8, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[19], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[28]),&reftables[8], &reftables[9]), - UPB_MSGDEF_INIT("google.protobuf.EnumValueOptions", 6, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[2], &google_protobuf_arrays[23], 4, 0), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[32]),&reftables[10], &reftables[11]), - UPB_MSGDEF_INIT("google.protobuf.FieldDescriptorProto", 19, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[27], 9, 8), UPB_STRTABLE_INIT(8, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[36]),&reftables[12], &reftables[13]), - UPB_MSGDEF_INIT("google.protobuf.FieldOptions", 12, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[4], &google_protobuf_arrays[36], 32, 4), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &google_protobuf_strentries[52]),&reftables[14], &reftables[15]), - UPB_MSGDEF_INIT("google.protobuf.FileDescriptorProto", 33, 6, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[68], 10, 9), UPB_STRTABLE_INIT(9, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[60]),&reftables[16], &reftables[17]), - UPB_MSGDEF_INIT("google.protobuf.FileDescriptorSet", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[78], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[76]),&reftables[18], &reftables[19]), - UPB_MSGDEF_INIT("google.protobuf.FileOptions", 18, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[6], &google_protobuf_arrays[80], 64, 8), UPB_STRTABLE_INIT(9, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[80]),&reftables[20], &reftables[21]), - UPB_MSGDEF_INIT("google.protobuf.MessageOptions", 8, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[8], &google_protobuf_arrays[144], 16, 2), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[96]),&reftables[22], &reftables[23]), - UPB_MSGDEF_INIT("google.protobuf.MethodDescriptorProto", 13, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[160], 5, 4), UPB_STRTABLE_INIT(4, 7, UPB_CTYPE_PTR, 3, &google_protobuf_strentries[100]),&reftables[24], &reftables[25]), - UPB_MSGDEF_INIT("google.protobuf.MethodOptions", 6, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[10], &google_protobuf_arrays[165], 4, 0), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[108]),&reftables[26], &reftables[27]), - UPB_MSGDEF_INIT("google.protobuf.ServiceDescriptorProto", 11, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[169], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[112]),&reftables[28], &reftables[29]), - UPB_MSGDEF_INIT("google.protobuf.ServiceOptions", 6, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[12], &google_protobuf_arrays[173], 4, 0), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[116]),&reftables[30], &reftables[31]), - UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[177], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[120]),&reftables[32], &reftables[33]), - UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo.Location", 8, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[179], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[124]),&reftables[34], &reftables[35]), - UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption", 18, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[182], 9, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[128]),&reftables[36], &reftables[37]), - UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption.NamePart", 6, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[191], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[144]),&reftables[38], &reftables[39]), + UPB_MSGDEF_INIT("google.protobuf.EnumOptions", 7, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[0], &google_protobuf_arrays[15], 8, 1), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[24]),&reftables[6], &reftables[7]), + UPB_MSGDEF_INIT("google.protobuf.EnumValueDescriptorProto", 8, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[23], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[28]),&reftables[8], &reftables[9]), + UPB_MSGDEF_INIT("google.protobuf.EnumValueOptions", 6, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[2], &google_protobuf_arrays[27], 4, 0), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[32]),&reftables[10], &reftables[11]), + UPB_MSGDEF_INIT("google.protobuf.FieldDescriptorProto", 19, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[31], 9, 8), UPB_STRTABLE_INIT(8, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[36]),&reftables[12], &reftables[13]), + UPB_MSGDEF_INIT("google.protobuf.FieldOptions", 14, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[4], &google_protobuf_arrays[40], 32, 6), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[52]),&reftables[14], &reftables[15]), + UPB_MSGDEF_INIT("google.protobuf.FileDescriptorProto", 39, 6, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[72], 12, 11), UPB_STRTABLE_INIT(11, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[68]),&reftables[16], &reftables[17]), + UPB_MSGDEF_INIT("google.protobuf.FileDescriptorSet", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[84], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[84]),&reftables[18], &reftables[19]), + UPB_MSGDEF_INIT("google.protobuf.FileOptions", 21, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[6], &google_protobuf_arrays[86], 64, 9), UPB_STRTABLE_INIT(10, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[88]),&reftables[20], &reftables[21]), + UPB_MSGDEF_INIT("google.protobuf.MessageOptions", 8, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[8], &google_protobuf_arrays[150], 16, 2), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[104]),&reftables[22], &reftables[23]), + UPB_MSGDEF_INIT("google.protobuf.MethodDescriptorProto", 13, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[166], 5, 4), UPB_STRTABLE_INIT(4, 7, UPB_CTYPE_PTR, 3, &google_protobuf_strentries[108]),&reftables[24], &reftables[25]), + UPB_MSGDEF_INIT("google.protobuf.MethodOptions", 6, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[10], &google_protobuf_arrays[171], 4, 0), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[116]),&reftables[26], &reftables[27]), + UPB_MSGDEF_INIT("google.protobuf.ServiceDescriptorProto", 11, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[175], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[120]),&reftables[28], &reftables[29]), + UPB_MSGDEF_INIT("google.protobuf.ServiceOptions", 6, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &google_protobuf_intentries[12], &google_protobuf_arrays[179], 4, 0), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[124]),&reftables[30], &reftables[31]), + UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[183], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[128]),&reftables[32], &reftables[33]), + UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo.Location", 14, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[185], 5, 4), UPB_STRTABLE_INIT(4, 7, UPB_CTYPE_PTR, 3, &google_protobuf_strentries[132]),&reftables[34], &reftables[35]), + UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption", 18, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[190], 9, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &google_protobuf_strentries[140]),&reftables[36], &reftables[37]), + UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption.NamePart", 6, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &google_protobuf_arrays[199], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &google_protobuf_strentries[156]),&reftables[38], &reftables[39]), }; -const upb_fielddef google_protobuf_fields[73] = { - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "aggregate_value", 8, &google_protobuf_msgs[18], NULL, 15, 6, {0},&reftables[40], &reftables[41]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "cc_generic_services", 16, &google_protobuf_msgs[10], NULL, 14, 5, {0},&reftables[42], &reftables[43]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, "ctype", 1, &google_protobuf_msgs[7], UPB_UPCAST(&google_protobuf_enums[2]), 6, 1, {0},&reftables[44], &reftables[45]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "default_value", 7, &google_protobuf_msgs[6], NULL, 16, 7, {0},&reftables[46], &reftables[47]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, "dependency", 3, &google_protobuf_msgs[8], NULL, 30, 8, {0},&reftables[48], &reftables[49]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "deprecated", 3, &google_protobuf_msgs[7], NULL, 8, 3, {0},&reftables[50], &reftables[51]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_DOUBLE, 0, false, false, "double_value", 6, &google_protobuf_msgs[18], NULL, 11, 4, {0},&reftables[52], &reftables[53]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, "end", 2, &google_protobuf_msgs[1], NULL, 3, 1, {0},&reftables[54], &reftables[55]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "enum_type", 4, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[2]), 16, 2, {0},&reftables[56], &reftables[57]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "enum_type", 5, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[2]), 13, 1, {0},&reftables[58], &reftables[59]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "experimental_map_key", 9, &google_protobuf_msgs[7], NULL, 9, 4, {0},&reftables[60], &reftables[61]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "extendee", 2, &google_protobuf_msgs[6], NULL, 7, 2, {0},&reftables[62], &reftables[63]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "extension", 7, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[6]), 19, 3, {0},&reftables[64], &reftables[65]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "extension", 6, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[6]), 22, 4, {0},&reftables[66], &reftables[67]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "extension_range", 5, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[1]), 19, 3, {0},&reftables[68], &reftables[69]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "field", 2, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[6]), 10, 0, {0},&reftables[70], &reftables[71]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "file", 1, &google_protobuf_msgs[9], UPB_UPCAST(&google_protobuf_msgs[8]), 5, 0, {0},&reftables[72], &reftables[73]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "identifier_value", 3, &google_protobuf_msgs[18], NULL, 6, 1, {0},&reftables[74], &reftables[75]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "input_type", 2, &google_protobuf_msgs[12], NULL, 7, 2, {0},&reftables[76], &reftables[77]), - UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_BOOL, 0, false, false, "is_extension", 2, &google_protobuf_msgs[19], NULL, 5, 1, {0},&reftables[78], &reftables[79]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "java_generate_equals_and_hash", 20, &google_protobuf_msgs[10], NULL, 17, 8, {0},&reftables[80], &reftables[81]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "java_generic_services", 17, &google_protobuf_msgs[10], NULL, 15, 6, {0},&reftables[82], &reftables[83]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "java_multiple_files", 10, &google_protobuf_msgs[10], NULL, 13, 4, {0},&reftables[84], &reftables[85]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "java_outer_classname", 8, &google_protobuf_msgs[10], NULL, 9, 2, {0},&reftables[86], &reftables[87]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "java_package", 1, &google_protobuf_msgs[10], NULL, 6, 1, {0},&reftables[88], &reftables[89]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, "label", 4, &google_protobuf_msgs[6], UPB_UPCAST(&google_protobuf_enums[0]), 11, 4, {0},&reftables[90], &reftables[91]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "location", 1, &google_protobuf_msgs[16], UPB_UPCAST(&google_protobuf_msgs[17]), 5, 0, {0},&reftables[92], &reftables[93]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "message_set_wire_format", 1, &google_protobuf_msgs[11], NULL, 6, 1, {0},&reftables[94], &reftables[95]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "message_type", 4, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[0]), 10, 0, {0},&reftables[96], &reftables[97]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "method", 2, &google_protobuf_msgs[14], UPB_UPCAST(&google_protobuf_msgs[12]), 6, 0, {0},&reftables[98], &reftables[99]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "name", 2, &google_protobuf_msgs[18], UPB_UPCAST(&google_protobuf_msgs[19]), 5, 0, {0},&reftables[100], &reftables[101]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "name", 1, &google_protobuf_msgs[8], NULL, 22, 6, {0},&reftables[102], &reftables[103]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "name", 1, &google_protobuf_msgs[14], NULL, 8, 2, {0},&reftables[104], &reftables[105]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "name", 1, &google_protobuf_msgs[12], NULL, 4, 1, {0},&reftables[106], &reftables[107]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "name", 1, &google_protobuf_msgs[6], NULL, 4, 1, {0},&reftables[108], &reftables[109]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "name", 1, &google_protobuf_msgs[4], NULL, 4, 1, {0},&reftables[110], &reftables[111]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "name", 1, &google_protobuf_msgs[2], NULL, 8, 2, {0},&reftables[112], &reftables[113]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "name", 1, &google_protobuf_msgs[0], NULL, 24, 6, {0},&reftables[114], &reftables[115]), - UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_STRING, 0, false, false, "name_part", 1, &google_protobuf_msgs[19], NULL, 2, 0, {0},&reftables[116], &reftables[117]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT64, UPB_INTFMT_VARIABLE, false, false, "negative_int_value", 5, &google_protobuf_msgs[18], NULL, 10, 3, {0},&reftables[118], &reftables[119]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "nested_type", 3, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[0]), 13, 1, {0},&reftables[120], &reftables[121]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "no_standard_descriptor_accessor", 2, &google_protobuf_msgs[11], NULL, 7, 2, {0},&reftables[122], &reftables[123]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, "number", 2, &google_protobuf_msgs[4], NULL, 7, 2, {0},&reftables[124], &reftables[125]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, "number", 3, &google_protobuf_msgs[6], NULL, 10, 3, {0},&reftables[126], &reftables[127]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, "optimize_for", 9, &google_protobuf_msgs[10], UPB_UPCAST(&google_protobuf_enums[3]), 12, 3, {0},&reftables[128], &reftables[129]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "options", 3, &google_protobuf_msgs[2], UPB_UPCAST(&google_protobuf_msgs[3]), 7, 1, {0},&reftables[130], &reftables[131]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "options", 8, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[10]), 20, 4, {0},&reftables[132], &reftables[133]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "options", 3, &google_protobuf_msgs[14], UPB_UPCAST(&google_protobuf_msgs[15]), 7, 1, {0},&reftables[134], &reftables[135]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "options", 7, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[11]), 23, 5, {0},&reftables[136], &reftables[137]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "options", 4, &google_protobuf_msgs[12], UPB_UPCAST(&google_protobuf_msgs[13]), 3, 0, {0},&reftables[138], &reftables[139]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "options", 3, &google_protobuf_msgs[4], UPB_UPCAST(&google_protobuf_msgs[5]), 3, 0, {0},&reftables[140], &reftables[141]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "options", 8, &google_protobuf_msgs[6], UPB_UPCAST(&google_protobuf_msgs[7]), 3, 0, {0},&reftables[142], &reftables[143]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "output_type", 3, &google_protobuf_msgs[12], NULL, 10, 3, {0},&reftables[144], &reftables[145]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "package", 2, &google_protobuf_msgs[8], NULL, 25, 7, {0},&reftables[146], &reftables[147]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "packed", 2, &google_protobuf_msgs[7], NULL, 7, 2, {0},&reftables[148], &reftables[149]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, "path", 1, &google_protobuf_msgs[17], NULL, 4, 0, {0},&reftables[150], &reftables[151]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_UINT64, UPB_INTFMT_VARIABLE, false, false, "positive_int_value", 4, &google_protobuf_msgs[18], NULL, 9, 2, {0},&reftables[152], &reftables[153]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, "py_generic_services", 18, &google_protobuf_msgs[10], NULL, 16, 7, {0},&reftables[154], &reftables[155]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "service", 6, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[14]), 16, 2, {0},&reftables[156], &reftables[157]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, "source_code_info", 9, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[16]), 21, 5, {0},&reftables[158], &reftables[159]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, "span", 2, &google_protobuf_msgs[17], NULL, 7, 1, {0},&reftables[160], &reftables[161]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, "start", 1, &google_protobuf_msgs[1], NULL, 2, 0, {0},&reftables[162], &reftables[163]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BYTES, 0, false, false, "string_value", 7, &google_protobuf_msgs[18], NULL, 12, 5, {0},&reftables[164], &reftables[165]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, "type", 5, &google_protobuf_msgs[6], UPB_UPCAST(&google_protobuf_enums[1]), 12, 5, {0},&reftables[166], &reftables[167]), - UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, "type_name", 6, &google_protobuf_msgs[6], NULL, 13, 6, {0},&reftables[168], &reftables[169]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[3], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[170], &reftables[171]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[15], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[172], &reftables[173]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[11], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[174], &reftables[175]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[10], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[176], &reftables[177]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[7], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[178], &reftables[179]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[13], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[180], &reftables[181]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[5], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[182], &reftables[183]), - UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, "value", 2, &google_protobuf_msgs[2], UPB_UPCAST(&google_protobuf_msgs[4]), 6, 0, {0},&reftables[184], &reftables[185]), +const upb_fielddef google_protobuf_fields[81] = { + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "aggregate_value", 8, &google_protobuf_msgs[18], NULL, 15, 6, {0},&reftables[40], &reftables[41]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "allow_alias", 2, &google_protobuf_msgs[3], NULL, 6, 1, {0},&reftables[42], &reftables[43]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "cc_generic_services", 16, &google_protobuf_msgs[10], NULL, 17, 6, {0},&reftables[44], &reftables[45]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, "ctype", 1, &google_protobuf_msgs[7], UPB_UPCAST(&google_protobuf_enums[2]), 6, 1, {0},&reftables[46], &reftables[47]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "default_value", 7, &google_protobuf_msgs[6], NULL, 16, 7, {0},&reftables[48], &reftables[49]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, "dependency", 3, &google_protobuf_msgs[8], NULL, 30, 8, {0},&reftables[50], &reftables[51]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "deprecated", 3, &google_protobuf_msgs[7], NULL, 8, 3, {0},&reftables[52], &reftables[53]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_DOUBLE, 0, false, false, false, "double_value", 6, &google_protobuf_msgs[18], NULL, 11, 4, {0},&reftables[54], &reftables[55]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "end", 2, &google_protobuf_msgs[1], NULL, 3, 1, {0},&reftables[56], &reftables[57]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "enum_type", 5, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[2]), 13, 1, {0},&reftables[58], &reftables[59]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "enum_type", 4, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[2]), 16, 2, {0},&reftables[60], &reftables[61]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "experimental_map_key", 9, &google_protobuf_msgs[7], NULL, 10, 5, {0},&reftables[62], &reftables[63]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "extendee", 2, &google_protobuf_msgs[6], NULL, 7, 2, {0},&reftables[64], &reftables[65]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "extension", 7, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[6]), 19, 3, {0},&reftables[66], &reftables[67]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "extension", 6, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[6]), 22, 4, {0},&reftables[68], &reftables[69]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "extension_range", 5, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[1]), 19, 3, {0},&reftables[70], &reftables[71]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "field", 2, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[6]), 10, 0, {0},&reftables[72], &reftables[73]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "file", 1, &google_protobuf_msgs[9], UPB_UPCAST(&google_protobuf_msgs[8]), 5, 0, {0},&reftables[74], &reftables[75]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "go_package", 11, &google_protobuf_msgs[10], NULL, 14, 5, {0},&reftables[76], &reftables[77]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "identifier_value", 3, &google_protobuf_msgs[18], NULL, 6, 1, {0},&reftables[78], &reftables[79]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "input_type", 2, &google_protobuf_msgs[12], NULL, 7, 2, {0},&reftables[80], &reftables[81]), + UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_BOOL, 0, false, false, false, "is_extension", 2, &google_protobuf_msgs[19], NULL, 5, 1, {0},&reftables[82], &reftables[83]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "java_generate_equals_and_hash", 20, &google_protobuf_msgs[10], NULL, 20, 9, {0},&reftables[84], &reftables[85]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "java_generic_services", 17, &google_protobuf_msgs[10], NULL, 18, 7, {0},&reftables[86], &reftables[87]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "java_multiple_files", 10, &google_protobuf_msgs[10], NULL, 13, 4, {0},&reftables[88], &reftables[89]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "java_outer_classname", 8, &google_protobuf_msgs[10], NULL, 9, 2, {0},&reftables[90], &reftables[91]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "java_package", 1, &google_protobuf_msgs[10], NULL, 6, 1, {0},&reftables[92], &reftables[93]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, "label", 4, &google_protobuf_msgs[6], UPB_UPCAST(&google_protobuf_enums[0]), 11, 4, {0},&reftables[94], &reftables[95]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "lazy", 5, &google_protobuf_msgs[7], NULL, 9, 4, {0},&reftables[96], &reftables[97]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "leading_comments", 3, &google_protobuf_msgs[17], NULL, 8, 2, {0},&reftables[98], &reftables[99]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "location", 1, &google_protobuf_msgs[16], UPB_UPCAST(&google_protobuf_msgs[17]), 5, 0, {0},&reftables[100], &reftables[101]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "message_set_wire_format", 1, &google_protobuf_msgs[11], NULL, 6, 1, {0},&reftables[102], &reftables[103]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "message_type", 4, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[0]), 10, 0, {0},&reftables[104], &reftables[105]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "method", 2, &google_protobuf_msgs[14], UPB_UPCAST(&google_protobuf_msgs[12]), 6, 0, {0},&reftables[106], &reftables[107]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "name", 1, &google_protobuf_msgs[6], NULL, 4, 1, {0},&reftables[108], &reftables[109]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "name", 1, &google_protobuf_msgs[14], NULL, 8, 2, {0},&reftables[110], &reftables[111]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "name", 1, &google_protobuf_msgs[2], NULL, 8, 2, {0},&reftables[112], &reftables[113]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "name", 1, &google_protobuf_msgs[4], NULL, 4, 1, {0},&reftables[114], &reftables[115]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "name", 1, &google_protobuf_msgs[8], NULL, 22, 6, {0},&reftables[116], &reftables[117]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "name", 1, &google_protobuf_msgs[0], NULL, 24, 6, {0},&reftables[118], &reftables[119]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "name", 1, &google_protobuf_msgs[12], NULL, 4, 1, {0},&reftables[120], &reftables[121]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "name", 2, &google_protobuf_msgs[18], UPB_UPCAST(&google_protobuf_msgs[19]), 5, 0, {0},&reftables[122], &reftables[123]), + UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_STRING, 0, false, false, false, "name_part", 1, &google_protobuf_msgs[19], NULL, 2, 0, {0},&reftables[124], &reftables[125]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT64, UPB_INTFMT_VARIABLE, false, false, false, "negative_int_value", 5, &google_protobuf_msgs[18], NULL, 10, 3, {0},&reftables[126], &reftables[127]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "nested_type", 3, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[0]), 13, 1, {0},&reftables[128], &reftables[129]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "no_standard_descriptor_accessor", 2, &google_protobuf_msgs[11], NULL, 7, 2, {0},&reftables[130], &reftables[131]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "number", 3, &google_protobuf_msgs[6], NULL, 10, 3, {0},&reftables[132], &reftables[133]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "number", 2, &google_protobuf_msgs[4], NULL, 7, 2, {0},&reftables[134], &reftables[135]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, "optimize_for", 9, &google_protobuf_msgs[10], UPB_UPCAST(&google_protobuf_enums[3]), 12, 3, {0},&reftables[136], &reftables[137]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "options", 4, &google_protobuf_msgs[12], UPB_UPCAST(&google_protobuf_msgs[13]), 3, 0, {0},&reftables[138], &reftables[139]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "options", 3, &google_protobuf_msgs[14], UPB_UPCAST(&google_protobuf_msgs[15]), 7, 1, {0},&reftables[140], &reftables[141]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "options", 3, &google_protobuf_msgs[2], UPB_UPCAST(&google_protobuf_msgs[3]), 7, 1, {0},&reftables[142], &reftables[143]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "options", 8, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[10]), 20, 4, {0},&reftables[144], &reftables[145]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "options", 8, &google_protobuf_msgs[6], UPB_UPCAST(&google_protobuf_msgs[7]), 3, 0, {0},&reftables[146], &reftables[147]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "options", 3, &google_protobuf_msgs[4], UPB_UPCAST(&google_protobuf_msgs[5]), 3, 0, {0},&reftables[148], &reftables[149]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "options", 7, &google_protobuf_msgs[0], UPB_UPCAST(&google_protobuf_msgs[11]), 23, 5, {0},&reftables[150], &reftables[151]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "output_type", 3, &google_protobuf_msgs[12], NULL, 10, 3, {0},&reftables[152], &reftables[153]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "package", 2, &google_protobuf_msgs[8], NULL, 25, 7, {0},&reftables[154], &reftables[155]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "packed", 2, &google_protobuf_msgs[7], NULL, 7, 2, {0},&reftables[156], &reftables[157]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "path", 1, &google_protobuf_msgs[17], NULL, 4, 0, {0},&reftables[158], &reftables[159]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_UINT64, UPB_INTFMT_VARIABLE, false, false, false, "positive_int_value", 4, &google_protobuf_msgs[18], NULL, 9, 2, {0},&reftables[160], &reftables[161]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "public_dependency", 10, &google_protobuf_msgs[8], NULL, 35, 9, {0},&reftables[162], &reftables[163]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "py_generic_services", 18, &google_protobuf_msgs[10], NULL, 19, 8, {0},&reftables[164], &reftables[165]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "service", 6, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[14]), 16, 2, {0},&reftables[166], &reftables[167]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, "source_code_info", 9, &google_protobuf_msgs[8], UPB_UPCAST(&google_protobuf_msgs[16]), 21, 5, {0},&reftables[168], &reftables[169]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "span", 2, &google_protobuf_msgs[17], NULL, 7, 1, {0},&reftables[170], &reftables[171]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "start", 1, &google_protobuf_msgs[1], NULL, 2, 0, {0},&reftables[172], &reftables[173]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BYTES, 0, false, false, false, "string_value", 7, &google_protobuf_msgs[18], NULL, 12, 5, {0},&reftables[174], &reftables[175]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "trailing_comments", 4, &google_protobuf_msgs[17], NULL, 11, 3, {0},&reftables[176], &reftables[177]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, "type", 5, &google_protobuf_msgs[6], UPB_UPCAST(&google_protobuf_enums[1]), 12, 5, {0},&reftables[178], &reftables[179]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, "type_name", 6, &google_protobuf_msgs[6], NULL, 13, 6, {0},&reftables[180], &reftables[181]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[15], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[182], &reftables[183]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[11], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[184], &reftables[185]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[13], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[186], &reftables[187]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[7], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[188], &reftables[189]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[3], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[190], &reftables[191]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[5], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[192], &reftables[193]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "uninterpreted_option", 999, &google_protobuf_msgs[10], UPB_UPCAST(&google_protobuf_msgs[18]), 5, 0, {0},&reftables[194], &reftables[195]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, "value", 2, &google_protobuf_msgs[2], UPB_UPCAST(&google_protobuf_msgs[4]), 6, 0, {0},&reftables[196], &reftables[197]), + UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, "weak", 10, &google_protobuf_msgs[7], NULL, 13, 6, {0},&reftables[198], &reftables[199]), + UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, "weak_dependency", 11, &google_protobuf_msgs[8], NULL, 38, 10, {0},&reftables[200], &reftables[201]), }; const upb_enumdef google_protobuf_enums[4] = { - UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Label", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &google_protobuf_strentries[148]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[194], 4, 3), 0, &reftables[186], &reftables[187]), - UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Type", UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_INT32, 5, &google_protobuf_strentries[152]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[198], 19, 18), 0, &reftables[188], &reftables[189]), - UPB_ENUMDEF_INIT("google.protobuf.FieldOptions.CType", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &google_protobuf_strentries[184]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[217], 3, 3), 0, &reftables[190], &reftables[191]), - UPB_ENUMDEF_INIT("google.protobuf.FileOptions.OptimizeMode", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &google_protobuf_strentries[188]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[220], 4, 3), 0, &reftables[192], &reftables[193]), + UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Label", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &google_protobuf_strentries[160]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[202], 4, 3), 0, &reftables[202], &reftables[203]), + UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Type", UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_INT32, 5, &google_protobuf_strentries[164]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[206], 19, 18), 0, &reftables[204], &reftables[205]), + UPB_ENUMDEF_INIT("google.protobuf.FieldOptions.CType", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &google_protobuf_strentries[196]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[225], 3, 3), 0, &reftables[206], &reftables[207]), + UPB_ENUMDEF_INIT("google.protobuf.FileOptions.OptimizeMode", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &google_protobuf_strentries[200]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &google_protobuf_arrays[228], 4, 3), 0, &reftables[208], &reftables[209]), }; -const upb_tabent google_protobuf_strentries[192] = { - {UPB_TABKEY_STR("extension"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[13]), NULL}, +const upb_tabent google_protobuf_strentries[204] = { + {UPB_TABKEY_STR("extension"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[14]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[37]), NULL}, + {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[39]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("field"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[15]), NULL}, - {UPB_TABKEY_STR("extension_range"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[14]), NULL}, + {UPB_TABKEY_STR("field"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[16]), NULL}, + {UPB_TABKEY_STR("extension_range"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[15]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("nested_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[40]), NULL}, + {UPB_TABKEY_STR("nested_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[44]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[48]), NULL}, - {UPB_TABKEY_STR("enum_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[8]), &google_protobuf_strentries[14]}, - {UPB_TABKEY_STR("start"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[61]), NULL}, - {UPB_TABKEY_STR("end"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[7]), NULL}, + {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[55]), NULL}, + {UPB_TABKEY_STR("enum_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[10]), &google_protobuf_strentries[14]}, + {UPB_TABKEY_STR("start"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[66]), NULL}, + {UPB_TABKEY_STR("end"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[8]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[72]), NULL}, - {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[45]), NULL}, + {UPB_TABKEY_STR("value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[78]), NULL}, + {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[51]), NULL}, {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[36]), &google_protobuf_strentries[22]}, - {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[65]), NULL}, + {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[75]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, + {UPB_TABKEY_STR("allow_alias"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[1]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, + {UPB_TABKEY_STR("number"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[47]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("number"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[42]), NULL}, + {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[54]), NULL}, + {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[37]), &google_protobuf_strentries[30]}, + {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[76]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[50]), NULL}, - {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[35]), &google_protobuf_strentries[30]}, - {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[71]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("label"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[25]), NULL}, + {UPB_TABKEY_STR("label"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[27]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[34]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("number"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[43]), &google_protobuf_strentries[49]}, + {UPB_TABKEY_STR("number"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[46]), &google_protobuf_strentries[49]}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("type_name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[64]), NULL}, - {UPB_TABKEY_STR("extendee"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[11]), NULL}, - {UPB_TABKEY_STR("type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[63]), &google_protobuf_strentries[48]}, - {UPB_TABKEY_STR("default_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[3]), NULL}, - {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[51]), NULL}, - {UPB_TABKEY_STR("experimental_map_key"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[10]), &google_protobuf_strentries[58]}, + {UPB_TABKEY_STR("type_name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[70]), NULL}, + {UPB_TABKEY_STR("extendee"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[12]), NULL}, + {UPB_TABKEY_STR("type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[69]), &google_protobuf_strentries[48]}, + {UPB_TABKEY_STR("default_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[4]), NULL}, + {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[53]), NULL}, + {UPB_TABKEY_STR("experimental_map_key"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[11]), &google_protobuf_strentries[67]}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("ctype"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[2]), NULL}, + {UPB_TABKEY_STR("weak"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[79]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("deprecated"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[5]), NULL}, - {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[69]), NULL}, - {UPB_TABKEY_STR("packed"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[54]), NULL}, - {UPB_TABKEY_STR("extension"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[12]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[31]), NULL}, - {UPB_TABKEY_STR("service"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[58]), NULL}, + {UPB_TABKEY_STR("packed"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[58]), NULL}, + {UPB_TABKEY_STR("lazy"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[28]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("source_code_info"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[59]), NULL}, + {UPB_TABKEY_STR("ctype"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[3]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, + {UPB_TABKEY_STR("deprecated"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[6]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("dependency"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[4]), NULL}, - {UPB_TABKEY_STR("message_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[28]), NULL}, - {UPB_TABKEY_STR("package"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[53]), NULL}, + {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[74]), NULL}, + {UPB_TABKEY_STR("extension"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[13]), NULL}, + {UPB_TABKEY_STR("weak_dependency"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[80]), NULL}, + {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, + {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[38]), NULL}, + {UPB_TABKEY_STR("service"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[63]), NULL}, + {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, + {UPB_TABKEY_STR("source_code_info"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[64]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[46]), NULL}, - {UPB_TABKEY_STR("enum_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[9]), &google_protobuf_strentries[74]}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("file"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[16]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, + {UPB_TABKEY_STR("dependency"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[5]), NULL}, + {UPB_TABKEY_STR("message_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[32]), NULL}, + {UPB_TABKEY_STR("package"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[57]), NULL}, + {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[52]), &google_protobuf_strentries[82]}, + {UPB_TABKEY_STR("enum_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[9]), NULL}, + {UPB_TABKEY_STR("public_dependency"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[61]), &google_protobuf_strentries[81]}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[68]), NULL}, + {UPB_TABKEY_STR("file"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[17]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("cc_generic_services"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[1]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("java_multiple_files"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[22]), NULL}, + {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[77]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("java_generic_services"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[21]), &google_protobuf_strentries[94]}, - {UPB_TABKEY_STR("java_generate_equals_and_hash"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[20]), NULL}, + {UPB_TABKEY_STR("cc_generic_services"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[2]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, + {UPB_TABKEY_STR("java_multiple_files"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[24]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, + {UPB_TABKEY_STR("java_generic_services"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[23]), &google_protobuf_strentries[102]}, + {UPB_TABKEY_STR("java_generate_equals_and_hash"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[22]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("java_package"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[24]), NULL}, - {UPB_TABKEY_STR("optimize_for"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[44]), NULL}, - {UPB_TABKEY_STR("py_generic_services"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[57]), NULL}, - {UPB_TABKEY_STR("java_outer_classname"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[23]), NULL}, - {UPB_TABKEY_STR("message_set_wire_format"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[27]), &google_protobuf_strentries[98]}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[67]), NULL}, - {UPB_TABKEY_STR("no_standard_descriptor_accessor"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[41]), NULL}, + {UPB_TABKEY_STR("go_package"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[18]), NULL}, + {UPB_TABKEY_STR("java_package"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[26]), NULL}, + {UPB_TABKEY_STR("optimize_for"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[48]), NULL}, + {UPB_TABKEY_STR("py_generic_services"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[62]), NULL}, + {UPB_TABKEY_STR("java_outer_classname"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[25]), NULL}, + {UPB_TABKEY_STR("message_set_wire_format"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[31]), &google_protobuf_strentries[106]}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, + {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[72]), NULL}, + {UPB_TABKEY_STR("no_standard_descriptor_accessor"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[45]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[33]), NULL}, - {UPB_TABKEY_STR("input_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[18]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("output_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[52]), NULL}, + {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[40]), NULL}, + {UPB_TABKEY_STR("input_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[20]), NULL}, + {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, + {UPB_TABKEY_STR("output_type"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[56]), NULL}, {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[49]), NULL}, - {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[70]), NULL}, + {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[73]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[47]), &google_protobuf_strentries[114]}, - {UPB_TABKEY_STR("method"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[29]), NULL}, - {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[32]), &google_protobuf_strentries[113]}, - {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[66]), NULL}, + {UPB_TABKEY_STR("options"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[50]), &google_protobuf_strentries[122]}, + {UPB_TABKEY_STR("method"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[33]), NULL}, + {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[35]), &google_protobuf_strentries[121]}, + {UPB_TABKEY_STR("uninterpreted_option"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[71]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("location"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[26]), NULL}, + {UPB_TABKEY_STR("location"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[30]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("span"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[60]), NULL}, - {UPB_TABKEY_STR("path"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[55]), &google_protobuf_strentries[126]}, - {UPB_TABKEY_STR("double_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[6]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, + {UPB_TABKEY_STR("span"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[65]), &google_protobuf_strentries[139]}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[30]), NULL}, + {UPB_TABKEY_STR("trailing_comments"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[68]), NULL}, + {UPB_TABKEY_STR("leading_comments"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[29]), &google_protobuf_strentries[137]}, + {UPB_TABKEY_STR("path"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[59]), NULL}, + {UPB_TABKEY_STR("double_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[7]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, + {UPB_TABKEY_STR("name"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[41]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("negative_int_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[39]), NULL}, + {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, + {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, + {UPB_TABKEY_STR("negative_int_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[43]), NULL}, {UPB_TABKEY_STR("aggregate_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[0]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("positive_int_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[56]), NULL}, - {UPB_TABKEY_STR("identifier_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[17]), NULL}, - {UPB_TABKEY_STR("string_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[62]), &google_protobuf_strentries[142]}, + {UPB_TABKEY_STR("positive_int_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[60]), NULL}, + {UPB_TABKEY_STR("identifier_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[19]), NULL}, + {UPB_TABKEY_STR("string_value"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[67]), &google_protobuf_strentries[154]}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("is_extension"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[19]), NULL}, - {UPB_TABKEY_STR("name_part"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[38]), NULL}, - {UPB_TABKEY_STR("LABEL_REQUIRED"), UPB_VALUE_INIT_INT32(2), &google_protobuf_strentries[150]}, + {UPB_TABKEY_STR("is_extension"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[21]), NULL}, + {UPB_TABKEY_STR("name_part"), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[42]), NULL}, + {UPB_TABKEY_STR("LABEL_REQUIRED"), UPB_VALUE_INIT_INT32(2), &google_protobuf_strentries[162]}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_STR("LABEL_REPEATED"), UPB_VALUE_INIT_INT32(3), NULL}, {UPB_TABKEY_STR("LABEL_OPTIONAL"), UPB_VALUE_INIT_INT32(1), NULL}, @@ -280,17 +300,17 @@ const upb_tabent google_protobuf_strentries[192] = { {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_STR("TYPE_STRING"), UPB_VALUE_INIT_INT32(9), NULL}, - {UPB_TABKEY_STR("TYPE_FLOAT"), UPB_VALUE_INIT_INT32(2), &google_protobuf_strentries[181]}, + {UPB_TABKEY_STR("TYPE_FLOAT"), UPB_VALUE_INIT_INT32(2), &google_protobuf_strentries[193]}, {UPB_TABKEY_STR("TYPE_DOUBLE"), UPB_VALUE_INIT_INT32(1), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_STR("TYPE_INT32"), UPB_VALUE_INIT_INT32(5), NULL}, {UPB_TABKEY_STR("TYPE_SFIXED32"), UPB_VALUE_INIT_INT32(15), NULL}, {UPB_TABKEY_STR("TYPE_FIXED32"), UPB_VALUE_INIT_INT32(7), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("TYPE_MESSAGE"), UPB_VALUE_INIT_INT32(11), &google_protobuf_strentries[182]}, + {UPB_TABKEY_STR("TYPE_MESSAGE"), UPB_VALUE_INIT_INT32(11), &google_protobuf_strentries[194]}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("TYPE_INT64"), UPB_VALUE_INIT_INT32(3), &google_protobuf_strentries[179]}, + {UPB_TABKEY_STR("TYPE_INT64"), UPB_VALUE_INIT_INT32(3), &google_protobuf_strentries[191]}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, @@ -298,7 +318,7 @@ const upb_tabent google_protobuf_strentries[192] = { {UPB_TABKEY_STR("TYPE_ENUM"), UPB_VALUE_INIT_INT32(14), NULL}, {UPB_TABKEY_STR("TYPE_UINT32"), UPB_VALUE_INIT_INT32(13), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_STR("TYPE_UINT64"), UPB_VALUE_INIT_INT32(4), &google_protobuf_strentries[178]}, + {UPB_TABKEY_STR("TYPE_UINT64"), UPB_VALUE_INIT_INT32(4), &google_protobuf_strentries[190]}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_STR("TYPE_SFIXED64"), UPB_VALUE_INIT_INT32(16), NULL}, {UPB_TABKEY_STR("TYPE_BYTES"), UPB_VALUE_INIT_INT32(12), NULL}, @@ -308,80 +328,83 @@ const upb_tabent google_protobuf_strentries[192] = { {UPB_TABKEY_STR("TYPE_SINT32"), UPB_VALUE_INIT_INT32(17), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_STR("CORD"), UPB_VALUE_INIT_INT32(1), NULL}, - {UPB_TABKEY_STR("STRING"), UPB_VALUE_INIT_INT32(0), &google_protobuf_strentries[185]}, + {UPB_TABKEY_STR("STRING"), UPB_VALUE_INIT_INT32(0), &google_protobuf_strentries[197]}, {UPB_TABKEY_STR("STRING_PIECE"), UPB_VALUE_INIT_INT32(2), NULL}, {UPB_TABKEY_STR("CODE_SIZE"), UPB_VALUE_INIT_INT32(2), NULL}, - {UPB_TABKEY_STR("SPEED"), UPB_VALUE_INIT_INT32(1), &google_protobuf_strentries[191]}, + {UPB_TABKEY_STR("SPEED"), UPB_VALUE_INIT_INT32(1), &google_protobuf_strentries[203]}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, {UPB_TABKEY_STR("LITE_RUNTIME"), UPB_VALUE_INIT_INT32(3), NULL}, }; const upb_tabent google_protobuf_intentries[14] = { {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[65]), NULL}, + {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[75]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[71]), NULL}, + {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[76]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[69]), NULL}, + {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[74]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[68]), NULL}, + {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[77]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[67]), NULL}, + {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[72]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[70]), NULL}, + {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[73]), NULL}, {UPB_TABKEY_NONE, UPB__VALUE_INIT_NONE, NULL}, - {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[66]), NULL}, + {UPB_TABKEY_NUM(999), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[71]), NULL}, }; -const _upb_value google_protobuf_arrays[224] = { +const _upb_value google_protobuf_arrays[232] = { UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[37]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[39]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[16]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[44]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[10]), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[15]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[40]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[8]), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[14]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[13]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[48]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[55]), UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[61]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[7]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[66]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[8]), UPB_ARRAY_EMPTYENT, UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[36]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[72]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[45]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[78]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[51]), UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[1]), UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[35]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[42]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[50]), UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[37]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[47]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[54]), UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[34]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[11]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[43]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[25]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[63]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[64]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[3]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[51]), UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[2]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[54]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[5]), UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[34]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[12]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[46]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[27]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[69]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[70]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[4]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[53]), UPB_ARRAY_EMPTYENT, + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[3]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[58]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[6]), UPB_ARRAY_EMPTYENT, + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[28]), UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[10]), UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[11]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[79]), UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, @@ -403,38 +426,41 @@ const _upb_value google_protobuf_arrays[224] = { UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[31]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[53]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[4]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[28]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[9]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[58]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[12]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[46]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[59]), UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[16]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[38]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[57]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[5]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[32]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[9]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[63]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[13]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[52]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[64]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[61]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[80]), UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[24]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[17]), UPB_ARRAY_EMPTYENT, + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[26]), UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[23]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[44]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[22]), UPB_ARRAY_EMPTYENT, + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[25]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[48]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[24]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[18]), UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[1]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[21]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[57]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[2]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[23]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[62]), UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[20]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[22]), UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, @@ -479,8 +505,8 @@ const _upb_value google_protobuf_arrays[224] = { UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[27]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[41]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[31]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[45]), UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, @@ -495,39 +521,41 @@ const _upb_value google_protobuf_arrays[224] = { UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[33]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[18]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[52]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[40]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[20]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[56]), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[49]), UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[32]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[29]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[47]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[35]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[33]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[50]), UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[26]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[30]), UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[55]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[60]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[59]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[65]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[29]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[68]), UPB_ARRAY_EMPTYENT, UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[30]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[17]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[56]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[39]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[6]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[62]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[41]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[19]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[60]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[43]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[7]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[67]), UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[0]), UPB_ARRAY_EMPTYENT, - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[38]), - UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[19]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[42]), + UPB_VALUE_INIT_CONSTPTR(&google_protobuf_fields[21]), UPB_ARRAY_EMPTYENT, UPB_VALUE_INIT_CONSTPTR("LABEL_OPTIONAL"), UPB_VALUE_INIT_CONSTPTR("LABEL_REQUIRED"), @@ -561,7 +589,23 @@ const _upb_value google_protobuf_arrays[224] = { }; #ifdef UPB_DEBUG_REFS -static upb_inttable reftables[194] = { +static upb_inttable reftables[210] = { + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), + UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR), diff --git a/upb/descriptor/descriptor.upb.h b/upb/descriptor/descriptor.upb.h index 9f0bee0..72256e7 100755 --- a/upb/descriptor/descriptor.upb.h +++ b/upb/descriptor/descriptor.upb.h @@ -55,7 +55,7 @@ typedef enum { // Do not refer to these forward declarations; use the constants // below. extern const upb_msgdef google_protobuf_msgs[20]; -extern const upb_fielddef google_protobuf_fields[73]; +extern const upb_fielddef google_protobuf_fields[81]; extern const upb_enumdef google_protobuf_enums[4]; // Constants for references to defs. @@ -85,55 +85,89 @@ extern const upb_enumdef google_protobuf_enums[4]; // Selector definitions. #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_ENDSEQ 15 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_ENDSTR 18 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_ENDSUBMSG 16 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_STARTSEQ 14 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_STARTSTR 17 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_STARTSUBMSG 4 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_ENUM_TYPE_STRING 19 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSIONRANGE_END_INT32 3 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSIONRANGE_START_INT32 2 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_ENDSEQ 21 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_ENDSTR 24 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_ENDSUBMSG 22 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_ENDSEQ 18 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_ENDSTR 21 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_ENDSUBMSG 19 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_STARTSEQ 17 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_STARTSTR 20 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_STARTSUBMSG 5 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_RANGE_STRING 22 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_STARTSEQ 20 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_STARTSTR 23 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_STARTSUBMSG 6 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_EXTENSION_STRING 25 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_ENDSEQ 9 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_ENDSTR 12 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_ENDSUBMSG 10 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_STARTSEQ 8 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_STARTSTR 11 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_FIELD_STRING 13 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NAME_ENDSTR 26 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NAME_STARTSTR 25 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NAME_STRING 24 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_ENDSEQ 12 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_ENDSTR 15 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_ENDSUBMSG 13 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_STARTSEQ 11 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_STARTSTR 14 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_STARTSUBMSG 3 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_NESTED_TYPE_STRING 16 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_OPTIONS_ENDSTR 25 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_OPTIONS_ENDSUBMSG 23 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_OPTIONS_STARTSTR 24 #define GOOGLE_PROTOBUF_DESCRIPTORPROTO_OPTIONS_STARTSUBMSG 7 +#define GOOGLE_PROTOBUF_DESCRIPTORPROTO_OPTIONS_STRING 26 #define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_NAME_ENDSTR 10 #define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_NAME_STARTSTR 9 #define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_NAME_STRING 8 +#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_OPTIONS_ENDSTR 9 #define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 7 +#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_OPTIONS_STARTSTR 8 #define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 3 +#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_OPTIONS_STRING 10 #define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_ENDSEQ 5 +#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_ENDSTR 8 #define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_ENDSUBMSG 6 #define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_STARTSEQ 4 +#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_STARTSTR 7 #define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_ENUMDESCRIPTORPROTO_VALUE_STRING 9 +#define GOOGLE_PROTOBUF_ENUMOPTIONS_ALLOW_ALIAS_BOOL 6 #define GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4 +#define GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_ENDSTR 7 #define GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5 #define GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3 +#define GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_STARTSTR 6 #define GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_ENUMOPTIONS_UNINTERPRETED_OPTION_STRING 8 #define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_NAME_ENDSTR 6 #define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_NAME_STARTSTR 5 #define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_NAME_STRING 4 #define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_NUMBER_INT32 7 +#define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_OPTIONS_ENDSTR 5 #define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 3 +#define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_OPTIONS_STARTSTR 4 #define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_ENUMVALUEDESCRIPTORPROTO_OPTIONS_STRING 6 #define GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4 +#define GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_ENDSTR 7 #define GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5 #define GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3 +#define GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_STARTSTR 6 #define GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_ENUMVALUEOPTIONS_UNINTERPRETED_OPTION_STRING 8 #define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_DEFAULT_VALUE_ENDSTR 18 #define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_DEFAULT_VALUE_STARTSTR 17 #define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_DEFAULT_VALUE_STRING 16 @@ -145,60 +179,98 @@ extern const upb_enumdef google_protobuf_enums[4]; #define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_NAME_STARTSTR 5 #define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_NAME_STRING 4 #define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_NUMBER_INT32 10 +#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_OPTIONS_ENDSTR 5 #define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 3 +#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_OPTIONS_STARTSTR 4 #define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_OPTIONS_STRING 6 #define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_INT32 12 #define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_NAME_ENDSTR 15 #define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_NAME_STARTSTR 14 #define GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_NAME_STRING 13 #define GOOGLE_PROTOBUF_FIELDOPTIONS_CTYPE_INT32 6 #define GOOGLE_PROTOBUF_FIELDOPTIONS_DEPRECATED_BOOL 8 -#define GOOGLE_PROTOBUF_FIELDOPTIONS_EXPERIMENTAL_MAP_KEY_ENDSTR 11 -#define GOOGLE_PROTOBUF_FIELDOPTIONS_EXPERIMENTAL_MAP_KEY_STARTSTR 10 -#define GOOGLE_PROTOBUF_FIELDOPTIONS_EXPERIMENTAL_MAP_KEY_STRING 9 +#define GOOGLE_PROTOBUF_FIELDOPTIONS_EXPERIMENTAL_MAP_KEY_ENDSTR 12 +#define GOOGLE_PROTOBUF_FIELDOPTIONS_EXPERIMENTAL_MAP_KEY_STARTSTR 11 +#define GOOGLE_PROTOBUF_FIELDOPTIONS_EXPERIMENTAL_MAP_KEY_STRING 10 +#define GOOGLE_PROTOBUF_FIELDOPTIONS_LAZY_BOOL 9 #define GOOGLE_PROTOBUF_FIELDOPTIONS_PACKED_BOOL 7 #define GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4 +#define GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_ENDSTR 7 #define GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5 #define GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3 +#define GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_STARTSTR 6 #define GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_FIELDOPTIONS_UNINTERPRETED_OPTION_STRING 8 +#define GOOGLE_PROTOBUF_FIELDOPTIONS_WEAK_BOOL 13 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_ENDSEQ 29 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_ENDSTR 32 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_STARTSEQ 28 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_STARTSTR 31 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_DEPENDENCY_STRING 30 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_ENDSEQ 12 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_ENDSTR 15 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_ENDSUBMSG 13 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_STARTSEQ 11 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_STARTSTR 14 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_STARTSUBMSG 3 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_ENUM_TYPE_STRING 16 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_ENDSEQ 18 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_ENDSTR 21 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_ENDSUBMSG 19 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_STARTSEQ 17 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_STARTSTR 20 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_STARTSUBMSG 5 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_EXTENSION_STRING 22 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_ENDSEQ 9 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_ENDSTR 12 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_ENDSUBMSG 10 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_STARTSEQ 8 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_STARTSTR 11 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_MESSAGE_TYPE_STRING 13 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_NAME_ENDSTR 24 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_NAME_STARTSTR 23 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_NAME_STRING 22 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_OPTIONS_ENDSTR 22 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 20 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_OPTIONS_STARTSTR 21 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 6 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_OPTIONS_STRING 23 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PACKAGE_ENDSTR 27 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PACKAGE_STARTSTR 26 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PACKAGE_STRING 25 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PUBLIC_DEPENDENCY_ENDSEQ 34 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PUBLIC_DEPENDENCY_INT32 35 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_PUBLIC_DEPENDENCY_STARTSEQ 33 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_ENDSEQ 15 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_ENDSTR 18 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_ENDSUBMSG 16 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_STARTSEQ 14 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_STARTSTR 17 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_STARTSUBMSG 4 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SERVICE_STRING 19 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SOURCE_CODE_INFO_ENDSTR 23 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SOURCE_CODE_INFO_ENDSUBMSG 21 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SOURCE_CODE_INFO_STARTSTR 22 #define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SOURCE_CODE_INFO_STARTSUBMSG 7 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_SOURCE_CODE_INFO_STRING 24 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_WEAK_DEPENDENCY_ENDSEQ 37 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_WEAK_DEPENDENCY_INT32 38 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORPROTO_WEAK_DEPENDENCY_STARTSEQ 36 #define GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_ENDSEQ 4 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_ENDSTR 7 #define GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_ENDSUBMSG 5 #define GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_STARTSEQ 3 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_STARTSTR 6 #define GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_STARTSUBMSG 2 -#define GOOGLE_PROTOBUF_FILEOPTIONS_CC_GENERIC_SERVICES_BOOL 14 -#define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_GENERATE_EQUALS_AND_HASH_BOOL 17 -#define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_GENERIC_SERVICES_BOOL 15 +#define GOOGLE_PROTOBUF_FILEDESCRIPTORSET_FILE_STRING 8 +#define GOOGLE_PROTOBUF_FILEOPTIONS_CC_GENERIC_SERVICES_BOOL 17 +#define GOOGLE_PROTOBUF_FILEOPTIONS_GO_PACKAGE_ENDSTR 16 +#define GOOGLE_PROTOBUF_FILEOPTIONS_GO_PACKAGE_STARTSTR 15 +#define GOOGLE_PROTOBUF_FILEOPTIONS_GO_PACKAGE_STRING 14 +#define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_GENERATE_EQUALS_AND_HASH_BOOL 20 +#define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_GENERIC_SERVICES_BOOL 18 #define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_MULTIPLE_FILES_BOOL 13 #define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_OUTER_CLASSNAME_ENDSTR 11 #define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_OUTER_CLASSNAME_STARTSTR 10 @@ -207,47 +279,72 @@ extern const upb_enumdef google_protobuf_enums[4]; #define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_PACKAGE_STARTSTR 7 #define GOOGLE_PROTOBUF_FILEOPTIONS_JAVA_PACKAGE_STRING 6 #define GOOGLE_PROTOBUF_FILEOPTIONS_OPTIMIZE_FOR_INT32 12 -#define GOOGLE_PROTOBUF_FILEOPTIONS_PY_GENERIC_SERVICES_BOOL 16 +#define GOOGLE_PROTOBUF_FILEOPTIONS_PY_GENERIC_SERVICES_BOOL 19 #define GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4 +#define GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_ENDSTR 7 #define GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5 #define GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3 +#define GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_STARTSTR 6 #define GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_FILEOPTIONS_UNINTERPRETED_OPTION_STRING 8 #define GOOGLE_PROTOBUF_MESSAGEOPTIONS_MESSAGE_SET_WIRE_FORMAT_BOOL 6 #define GOOGLE_PROTOBUF_MESSAGEOPTIONS_NO_STANDARD_DESCRIPTOR_ACCESSOR_BOOL 7 #define GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4 +#define GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_ENDSTR 7 #define GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5 #define GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3 +#define GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_STARTSTR 6 #define GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_MESSAGEOPTIONS_UNINTERPRETED_OPTION_STRING 8 #define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_INPUT_TYPE_ENDSTR 9 #define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_INPUT_TYPE_STARTSTR 8 #define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_INPUT_TYPE_STRING 7 #define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_NAME_ENDSTR 6 #define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_NAME_STARTSTR 5 #define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_NAME_STRING 4 +#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OPTIONS_ENDSTR 5 #define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 3 +#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OPTIONS_STARTSTR 4 #define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OPTIONS_STRING 6 #define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OUTPUT_TYPE_ENDSTR 12 #define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OUTPUT_TYPE_STARTSTR 11 #define GOOGLE_PROTOBUF_METHODDESCRIPTORPROTO_OUTPUT_TYPE_STRING 10 #define GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4 +#define GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_ENDSTR 7 #define GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5 #define GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3 +#define GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_STARTSTR 6 #define GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_METHODOPTIONS_UNINTERPRETED_OPTION_STRING 8 #define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_ENDSEQ 5 +#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_ENDSTR 8 #define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_ENDSUBMSG 6 #define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_STARTSEQ 4 +#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_STARTSTR 7 #define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_METHOD_STRING 9 #define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_NAME_ENDSTR 10 #define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_NAME_STARTSTR 9 #define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_NAME_STRING 8 +#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_OPTIONS_ENDSTR 9 #define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_OPTIONS_ENDSUBMSG 7 +#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_OPTIONS_STARTSTR 8 #define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_OPTIONS_STARTSUBMSG 3 +#define GOOGLE_PROTOBUF_SERVICEDESCRIPTORPROTO_OPTIONS_STRING 10 #define GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_ENDSEQ 4 +#define GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_ENDSTR 7 #define GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_ENDSUBMSG 5 #define GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_STARTSEQ 3 +#define GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_STARTSTR 6 #define GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_SERVICEOPTIONS_UNINTERPRETED_OPTION_STRING 8 #define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_ENDSEQ 4 +#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_ENDSTR 7 #define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_ENDSUBMSG 5 +#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_LEADING_COMMENTS_ENDSTR 10 +#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_LEADING_COMMENTS_STARTSTR 9 +#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_LEADING_COMMENTS_STRING 8 #define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_PATH_ENDSEQ 3 #define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_PATH_INT32 4 #define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_PATH_STARTSEQ 2 @@ -255,7 +352,12 @@ extern const upb_enumdef google_protobuf_enums[4]; #define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_SPAN_INT32 7 #define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_SPAN_STARTSEQ 5 #define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_STARTSEQ 3 +#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_STARTSTR 6 #define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_STRING 8 +#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_TRAILING_COMMENTS_ENDSTR 13 +#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_TRAILING_COMMENTS_STARTSTR 12 +#define GOOGLE_PROTOBUF_SOURCECODEINFO_LOCATION_TRAILING_COMMENTS_STRING 11 #define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_AGGREGATE_VALUE_ENDSTR 17 #define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_AGGREGATE_VALUE_STARTSTR 16 #define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_AGGREGATE_VALUE_STRING 15 @@ -268,9 +370,12 @@ extern const upb_enumdef google_protobuf_enums[4]; #define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAMEPART_NAME_PART_STARTSTR 3 #define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAMEPART_NAME_PART_STRING 2 #define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_ENDSEQ 4 +#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_ENDSTR 7 #define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_ENDSUBMSG 5 #define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_STARTSEQ 3 +#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_STARTSTR 6 #define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_STARTSUBMSG 2 +#define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NAME_STRING 8 #define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_NEGATIVE_INT_VALUE_INT64 10 #define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_POSITIVE_INT_VALUE_UINT64 9 #define GOOGLE_PROTOBUF_UNINTERPRETEDOPTION_STRING_VALUE_ENDSTR 14 diff --git a/upb/descriptor/reader.c b/upb/descriptor/reader.c index eea6ce7..9baca1d 100644 --- a/upb/descriptor/reader.c +++ b/upb/descriptor/reader.c @@ -376,6 +376,13 @@ static bool field_endmsg(void *closure, const void *hd, upb_status *status) { return true; } +static bool field_onlazy(void *closure, const void *hd, bool val) { + UPB_UNUSED(hd); + upb_descreader *r = closure; + upb_fielddef_setlazy(r->f, val); + return true; +} + static bool field_ontype(void *closure, const void *hd, int32_t val) { UPB_UNUSED(hd); upb_descreader *r = closure; @@ -540,6 +547,8 @@ static void reghandlers(void *closure, upb_handlers *h) { upb_handlers_setstring(h, f(h, "type_name"), &field_ontypename, NULL); upb_handlers_setstring(h, f(h, "extendee"), &field_onextendee, NULL); upb_handlers_setstring(h, f(h, "default_value"), &field_ondefaultval, NULL); + } else if (m == GOOGLE_PROTOBUF_FIELDOPTIONS) { + upb_handlers_setbool(h, f(h, "lazy"), &field_onlazy, NULL); } } diff --git a/upb/handlers.c b/upb/handlers.c index 006ff83..be035ba 100644 --- a/upb/handlers.c +++ b/upb/handlers.c @@ -52,6 +52,9 @@ typedef struct { void *closure; } dfs_state; +// TODO(haberman): discard upb_handlers* objects that do not actually have any +// handlers set and cannot reach any upb_handlers* object that does. This is +// slightly tricky to do correctly. static upb_handlers *newformsg(const upb_msgdef *m, const void *owner, dfs_state *s) { upb_handlers *h = upb_handlers_new(m, owner); @@ -425,6 +428,39 @@ bool upb_handlers_freeze(upb_handlers *const*handlers, int n, upb_status *s) { } if (upb_fielddef_issubmsg(f)) { + bool hashandler = false; + if (upb_handlers_gethandler(h, getsel(h, f, UPB_HANDLER_STARTSUBMSG)) || + upb_handlers_gethandler(h, getsel(h, f, UPB_HANDLER_ENDSUBMSG))) { + hashandler = true; + } + + if (upb_fielddef_isseq(f) && + (upb_handlers_gethandler(h, getsel(h, f, UPB_HANDLER_STARTSEQ)) || + upb_handlers_gethandler(h, getsel(h, f, UPB_HANDLER_ENDSEQ)))) { + hashandler = true; + } + + if (hashandler && !upb_handlers_getsubhandlers(h, f)) { + // For now we add an empty subhandlers in this case. It makes the + // decoder code generator simpler, because it only has to handle two + // cases (submessage has handlers or not) as opposed to three + // (submessage has handlers in enclosing message but no subhandlers). + // + // This makes parsing less efficient in the case that we want to + // notice a submessage but skip its contents (like if we're testing + // for submessage presence or counting the number of repeated + // submessages). In this case we will end up parsing the submessage + // field by field and throwing away the results for each, instead of + // skipping the whole delimited thing at once. If this is an issue we + // can revisit it, but do remember that this only arises when you have + // handlers (startseq/startsubmsg/endsubmsg/endseq) set for the + // submessage but no subhandlers. The uses cases for this are + // limited. + upb_handlers *sub = upb_handlers_new(upb_fielddef_msgsubdef(f), &sub); + upb_handlers_setsubhandlers(h, f, sub); + upb_handlers_unref(sub, &sub); + } + // TODO(haberman): check type of submessage. // This is slightly tricky; also consider whether we should check that // they match at setsubhandlers time. @@ -470,16 +506,27 @@ bool upb_handlers_getselector(const upb_fielddef *f, upb_handlertype_t type, *s = f->selector_base; break; case UPB_HANDLER_STRING: - if (!upb_fielddef_isstring(f)) return false; - *s = f->selector_base; + if (upb_fielddef_isstring(f)) { + *s = f->selector_base; + } else if (upb_fielddef_issubmsg(f)) { + *s = f->selector_base + 3; + } else { + return false; + } break; case UPB_HANDLER_STARTSTR: - if (!upb_fielddef_isstring(f)) return false; - *s = f->selector_base + 1; + if (upb_fielddef_isstring(f) || upb_fielddef_issubmsg(f)) { + *s = f->selector_base + 1; + } else { + return false; + } break; case UPB_HANDLER_ENDSTR: - if (!upb_fielddef_isstring(f)) return false; - *s = f->selector_base + 2; + if (upb_fielddef_isstring(f) || upb_fielddef_issubmsg(f)) { + *s = f->selector_base + 2; + } else { + return false; + } break; case UPB_HANDLER_STARTSEQ: if (!upb_fielddef_isseq(f)) return false; @@ -501,7 +548,6 @@ bool upb_handlers_getselector(const upb_fielddef *f, upb_handlertype_t type, if (!upb_fielddef_issubmsg(f)) return false; *s = f->selector_base; break; - // Subhandler slot is selector_base + 2. } assert(*s < upb_fielddef_containingtype(f)->selector_count); return true; @@ -514,9 +560,15 @@ uint32_t upb_handlers_selectorbaseoffset(const upb_fielddef *f) { uint32_t upb_handlers_selectorcount(const upb_fielddef *f) { uint32_t ret = 1; if (upb_fielddef_isseq(f)) ret += 2; // STARTSEQ/ENDSEQ - if (upb_fielddef_isstring(f)) ret += 2; // [STARTSTR]/STRING/ENDSTR - // ENDSUBMSG (STARTSUBMSG is at table beginning) - if (upb_fielddef_issubmsg(f)) ret += 0; + if (upb_fielddef_isstring(f)) ret += 2; // [STRING]/STARTSTR/ENDSTR + if (upb_fielddef_issubmsg(f)) { + // ENDSUBMSG (STARTSUBMSG is at table beginning) + ret += 0; + if (upb_fielddef_lazy(f)) { + // STARTSTR/ENDSTR/STRING (for lazy) + ret += 3; + } + } return ret; } diff --git a/upb/pb/compile_decoder.c b/upb/pb/compile_decoder.c index f96f07a..400d6fa 100644 --- a/upb/pb/compile_decoder.c +++ b/upb/pb/compile_decoder.c @@ -19,13 +19,6 @@ #define MAXLABEL 5 #define EMPTYLABEL -1 -static const void *methodkey(const upb_msgdef *md, const upb_handlers *h) { - const void *ret = h ? (const void*)h : (const void*)md; - assert(ret); - return ret; -} - - /* mgroup *********************************************************************/ static void freegroup(upb_refcounted *r) { @@ -80,10 +73,8 @@ static void visitmethod(const upb_refcounted *r, upb_refcounted_visit *visit, visit(r, m->group, closure); } -static upb_pbdecodermethod *newmethod(const upb_msgdef *msg, - const upb_handlers *dest_handlers, - mgroup *group, - const void *key) { +static upb_pbdecodermethod *newmethod(const upb_handlers *dest_handlers, + mgroup *group) { static const struct upb_refcounted_vtbl vtbl = {visitmethod, freemethod}; upb_pbdecodermethod *ret = malloc(sizeof(*ret)); upb_refcounted_init(UPB_UPCAST(ret), &vtbl, &ret); @@ -92,11 +83,10 @@ static upb_pbdecodermethod *newmethod(const upb_msgdef *msg, // The method references the group and vice-versa, in a circular reference. upb_ref2(ret, group); upb_ref2(group, ret); - upb_inttable_insertptr(&group->methods, key, upb_value_ptr(ret)); // Owns ref + upb_inttable_insertptr(&group->methods, dest_handlers, upb_value_ptr(ret)); upb_refcounted_unref(UPB_UPCAST(ret), &ret); ret->group = UPB_UPCAST(group); - ret->schema_ = msg; ret->dest_handlers_ = dest_handlers; ret->is_native_ = false; // If we JIT, it will update this later. upb_inttable_init(&ret->dispatch, UPB_CTYPE_UINT64); @@ -126,10 +116,6 @@ void upb_pbdecodermethod_checkref(const upb_pbdecodermethod *m, upb_refcounted_checkref(UPB_UPCAST(m), owner); } -const upb_msgdef *upb_pbdecodermethod_schema(const upb_pbdecodermethod *m) { - return m->schema_; -} - const upb_handlers *upb_pbdecodermethod_desthandlers( const upb_pbdecodermethod *m) { return m->dest_handlers_; @@ -144,12 +130,12 @@ bool upb_pbdecodermethod_isnative(const upb_pbdecodermethod *m) { return m->is_native_; } -const upb_pbdecodermethod *upb_pbdecodermethod_newfordesthandlers( - const upb_handlers *dest, const void *owner) { +const upb_pbdecodermethod *upb_pbdecodermethod_new( + const upb_pbdecodermethodopts *opts, const void *owner) { upb_pbcodecache cache; upb_pbcodecache_init(&cache); const upb_pbdecodermethod *ret = - upb_pbcodecache_getdecodermethodfordesthandlers(&cache, dest); + upb_pbcodecache_getdecodermethod(&cache, opts); upb_pbdecodermethod_ref(ret, owner); upb_pbcodecache_uninit(&cache); return ret; @@ -165,11 +151,15 @@ typedef struct { uint32_t *pc; int fwd_labels[MAXLABEL]; int back_labels[MAXLABEL]; + + // For fields marked "lazy", parse them lazily or eagerly? + bool lazy; } compiler; -static compiler *newcompiler(mgroup *group) { +static compiler *newcompiler(mgroup *group, bool lazy) { compiler *ret = malloc(sizeof(*ret)); ret->group = group; + ret->lazy = lazy; for (int i = 0; i < MAXLABEL; i++) { ret->fwd_labels[i] = EMPTYLABEL; ret->back_labels[i] = EMPTYLABEL; @@ -300,11 +290,11 @@ static void putop(compiler *c, opcode op, ...) { } case OP_STARTMSG: case OP_ENDMSG: - case OP_PUSHTAGDELIM: case OP_PUSHLENDELIM: case OP_POP: case OP_SETDELIM: case OP_HALT: + case OP_RET: put32(c, op); break; case OP_PARSE_DOUBLE: @@ -321,13 +311,13 @@ static void putop(compiler *c, opcode op, ...) { case OP_PARSE_SINT32: case OP_PARSE_SINT64: case OP_STARTSEQ: - case OP_SETGROUPNUM: case OP_ENDSEQ: case OP_STARTSUBMSG: case OP_ENDSUBMSG: case OP_STARTSTR: case OP_STRING: case OP_ENDSTR: + case OP_PUSHTAGDELIM: put32(c, op | va_arg(ap, upb_selector_t) << 8); break; case OP_SETBIGGROUPNUM: @@ -382,10 +372,10 @@ const char *upb_pbdecoder_getopname(unsigned int op) { T(DOUBLE), T(FLOAT), T(INT64), T(UINT64), T(INT32), T(FIXED64), T(FIXED32), T(BOOL), T(UINT32), T(SFIXED32), T(SFIXED64), T(SINT32), T(SINT64), OP(STARTMSG), OP(ENDMSG), OP(STARTSEQ), OP(ENDSEQ), OP(STARTSUBMSG), - OP(ENDSUBMSG), OP(STARTSTR), OP(STRING), OP(ENDSTR), OP(CALL), + OP(ENDSUBMSG), OP(STARTSTR), OP(STRING), OP(ENDSTR), OP(CALL), OP(RET), OP(PUSHLENDELIM), OP(PUSHTAGDELIM), OP(SETDELIM), OP(CHECKDELIM), OP(BRANCH), OP(TAG1), OP(TAG2), OP(TAGN), OP(SETDISPATCH), OP(POP), - OP(SETGROUPNUM), OP(SETBIGGROUPNUM), OP(HALT), + OP(SETBIGGROUPNUM), OP(HALT), }; return op > OP_HALT ? names[0] : names[op]; #undef OP @@ -413,16 +403,17 @@ static void dumpbc(uint32_t *p, uint32_t *end, FILE *f) { const upb_pbdecodermethod *method = (void *)((char *)dispatch - offsetof(upb_pbdecodermethod, dispatch)); - fprintf(f, " %s", upb_msgdef_fullname(method->schema_)); + fprintf(f, " %s", upb_msgdef_fullname( + upb_handlers_msgdef(method->dest_handlers_))); break; } case OP_STARTMSG: case OP_ENDMSG: case OP_PUSHLENDELIM: - case OP_PUSHTAGDELIM: case OP_POP: case OP_SETDELIM: case OP_HALT: + case OP_RET: break; case OP_PARSE_DOUBLE: case OP_PARSE_FLOAT: @@ -444,7 +435,7 @@ static void dumpbc(uint32_t *p, uint32_t *end, FILE *f) { case OP_STARTSTR: case OP_STRING: case OP_ENDSTR: - case OP_SETGROUPNUM: + case OP_PUSHTAGDELIM: fprintf(f, " %d", instr >> 8); break; case OP_SETBIGGROUPNUM: @@ -537,11 +528,11 @@ static void putpush(compiler *c, const upb_fielddef *f) { putop(c, OP_PUSHLENDELIM); } else { uint32_t fn = upb_fielddef_number(f); - putop(c, OP_PUSHTAGDELIM); if (fn >= 1 << 24) { + putop(c, OP_PUSHTAGDELIM, 0); putop(c, OP_SETBIGGROUPNUM, fn); } else { - putop(c, OP_SETGROUPNUM, fn); + putop(c, OP_PUSHTAGDELIM, fn); } } } @@ -549,13 +540,35 @@ static void putpush(compiler *c, const upb_fielddef *f) { static upb_pbdecodermethod *find_submethod(const compiler *c, const upb_pbdecodermethod *method, const upb_fielddef *f) { - const upb_handlers *sub = method->dest_handlers_ ? - upb_handlers_getsubhandlers(method->dest_handlers_, f) : NULL; - const void *key = methodkey(upb_downcast_msgdef(upb_fielddef_subdef(f)), sub); + const upb_handlers *sub = + upb_handlers_getsubhandlers(method->dest_handlers_, f); upb_value v; - bool ok = upb_inttable_lookupptr(&c->group->methods, key, &v); - UPB_ASSERT_VAR(ok, ok); - return upb_value_getptr(v); + return upb_inttable_lookupptr(&c->group->methods, sub, &v) + ? upb_value_getptr(v) + : NULL; +} + +static void putsel(compiler *c, opcode op, upb_selector_t sel, + const upb_handlers *h) { + if (upb_handlers_gethandler(h, sel)) { + putop(c, op, sel); + } +} + +// Puts an opcode to call a callback, but only if a callback actually exists for +// this field and handler type. +static void putcb(compiler *c, opcode op, const upb_handlers *h, + const upb_fielddef *f, upb_handlertype_t type) { + putsel(c, op, getsel(f, type), h); +} + +static bool haslazyhandlers(const upb_handlers *h, const upb_fielddef *f) { + if (!upb_fielddef_lazy(f)) + return false; + + return upb_handlers_gethandler(h, getsel(f, UPB_HANDLER_STARTSTR)) || + upb_handlers_gethandler(h, getsel(f, UPB_HANDLER_STRING)) || + upb_handlers_gethandler(h, getsel(f, UPB_HANDLER_ENDSTR)); } // Adds bytecode for parsing the given message to the given decoderplan, @@ -596,177 +609,178 @@ static void compile_method(compiler *c, upb_pbdecodermethod *method) { upb_inttable_uninit(&method->dispatch); upb_inttable_init(&method->dispatch, UPB_CTYPE_UINT64); + const upb_handlers *h = upb_pbdecodermethod_desthandlers(method); + const upb_msgdef *md = upb_handlers_msgdef(h); + method->code_base.ofs = pcofs(c); putop(c, OP_SETDISPATCH, &method->dispatch); - putop(c, OP_STARTMSG); + putsel(c, OP_STARTMSG, UPB_STARTMSG_SELECTOR, h); label(c, LABEL_FIELD); upb_msg_iter i; - for(upb_msg_begin(&i, method->schema_); !upb_msg_done(&i); upb_msg_next(&i)) { + for(upb_msg_begin(&i, md); !upb_msg_done(&i); upb_msg_next(&i)) { const upb_fielddef *f = upb_msg_iter_field(&i); - upb_descriptortype_t type = upb_fielddef_descriptortype(f); + upb_descriptortype_t descriptor_type = upb_fielddef_descriptortype(f); + upb_fieldtype_t type = upb_fielddef_type(f); // From a decoding perspective, ENUM is the same as INT32. - if (type == UPB_DESCRIPTOR_TYPE_ENUM) - type = UPB_DESCRIPTOR_TYPE_INT32; - - label(c, LABEL_FIELD); - - switch (upb_fielddef_type(f)) { - case UPB_TYPE_MESSAGE: { - const upb_pbdecodermethod *sub_m = find_submethod(c, method, f); - int wire_type = (type == UPB_DESCRIPTOR_TYPE_MESSAGE) ? - UPB_WIRE_TYPE_DELIMITED : UPB_WIRE_TYPE_START_GROUP; - if (upb_fielddef_isseq(f)) { - putop(c, OP_CHECKDELIM, LABEL_ENDMSG); - putchecktag(c, f, wire_type, LABEL_DISPATCH); - dispatchtarget(c, method, f, wire_type); - putop(c, OP_PUSHTAGDELIM); - putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ)); - label(c, LABEL_LOOPSTART); - putpush(c, f); - putop(c, OP_STARTSUBMSG, getsel(f, UPB_HANDLER_STARTSUBMSG)); - putop(c, OP_CALL, sub_m); - putop(c, OP_POP); - putop(c, OP_ENDSUBMSG, getsel(f, UPB_HANDLER_ENDSUBMSG)); - if (wire_type == UPB_WIRE_TYPE_DELIMITED) { - putop(c, OP_SETDELIM); - } - putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK); - putchecktag(c, f, wire_type, LABEL_LOOPBREAK); - putop(c, OP_BRANCH, -LABEL_LOOPSTART); - label(c, LABEL_LOOPBREAK); - putop(c, OP_POP); - putop(c, OP_ENDSEQ, getsel(f, UPB_HANDLER_ENDSEQ)); - } else { - putop(c, OP_CHECKDELIM, LABEL_ENDMSG); - putchecktag(c, f, wire_type, LABEL_DISPATCH); - dispatchtarget(c, method, f, wire_type); - putpush(c, f); - putop(c, OP_STARTSUBMSG, getsel(f, UPB_HANDLER_STARTSUBMSG)); - putop(c, OP_CALL, sub_m); - putop(c, OP_POP); - putop(c, OP_ENDSUBMSG, getsel(f, UPB_HANDLER_ENDSUBMSG)); - if (wire_type == UPB_WIRE_TYPE_DELIMITED) { - putop(c, OP_SETDELIM); - } - } - break; + if (descriptor_type == UPB_DESCRIPTOR_TYPE_ENUM) + descriptor_type = UPB_DESCRIPTOR_TYPE_INT32; + + if (type == UPB_TYPE_MESSAGE && !(haslazyhandlers(h, f) && c->lazy)) { + const upb_pbdecodermethod *sub_m = find_submethod(c, method, f); + if (!sub_m) { + // Don't emit any code for this field at all; it will be parsed as an + // unknown field. + continue; } - case UPB_TYPE_STRING: - case UPB_TYPE_BYTES: - if (upb_fielddef_isseq(f)) { - putop(c, OP_CHECKDELIM, LABEL_ENDMSG); - putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH); - dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED); - putop(c, OP_PUSHTAGDELIM); - putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ)); - label(c, LABEL_LOOPSTART); - putop(c, OP_PUSHLENDELIM); - putop(c, OP_STARTSTR, getsel(f, UPB_HANDLER_STARTSTR)); - putop(c, OP_STRING, getsel(f, UPB_HANDLER_STRING)); - putop(c, OP_POP); - putop(c, OP_ENDSTR, getsel(f, UPB_HANDLER_ENDSTR)); - putop(c, OP_SETDELIM); - putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK); - putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_LOOPBREAK); - putop(c, OP_BRANCH, -LABEL_LOOPSTART); - label(c, LABEL_LOOPBREAK); - putop(c, OP_POP); - putop(c, OP_ENDSEQ, getsel(f, UPB_HANDLER_ENDSEQ)); - } else { - putop(c, OP_CHECKDELIM, LABEL_ENDMSG); - putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH); - dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED); - putop(c, OP_PUSHLENDELIM); - putop(c, OP_STARTSTR, getsel(f, UPB_HANDLER_STARTSTR)); - putop(c, OP_STRING, getsel(f, UPB_HANDLER_STRING)); - putop(c, OP_POP); - putop(c, OP_ENDSTR, getsel(f, UPB_HANDLER_ENDSTR)); + + label(c, LABEL_FIELD); + + int wire_type = (descriptor_type == UPB_DESCRIPTOR_TYPE_MESSAGE) + ? UPB_WIRE_TYPE_DELIMITED + : UPB_WIRE_TYPE_START_GROUP; + if (upb_fielddef_isseq(f)) { + putop(c, OP_CHECKDELIM, LABEL_ENDMSG); + putchecktag(c, f, wire_type, LABEL_DISPATCH); + dispatchtarget(c, method, f, wire_type); + putop(c, OP_PUSHTAGDELIM, 0); + putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ)); + label(c, LABEL_LOOPSTART); + putpush(c, f); + putop(c, OP_STARTSUBMSG, getsel(f, UPB_HANDLER_STARTSUBMSG)); + putop(c, OP_CALL, sub_m); + putop(c, OP_POP); + putcb(c, OP_ENDSUBMSG, h, f, UPB_HANDLER_ENDSUBMSG); + if (wire_type == UPB_WIRE_TYPE_DELIMITED) { putop(c, OP_SETDELIM); } - break; - default: { - opcode parse_type = (opcode)type; - assert((int)parse_type >= 0 && parse_type <= OP_MAX); - upb_selector_t sel = getsel(f, upb_handlers_getprimitivehandlertype(f)); - int wire_type = native_wire_types[upb_fielddef_descriptortype(f)]; - if (upb_fielddef_isseq(f)) { - putop(c, OP_CHECKDELIM, LABEL_ENDMSG); - putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH); - dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED); - putop(c, OP_PUSHLENDELIM); - putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ)); // Packed - label(c, LABEL_LOOPSTART); - putop(c, parse_type, sel); - putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK); - putop(c, OP_BRANCH, -LABEL_LOOPSTART); - dispatchtarget(c, method, f, wire_type); - putop(c, OP_PUSHTAGDELIM); - putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ)); // Non-packed - label(c, LABEL_LOOPSTART); - putop(c, parse_type, sel); - putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK); - putchecktag(c, f, wire_type, LABEL_LOOPBREAK); - putop(c, OP_BRANCH, -LABEL_LOOPSTART); - label(c, LABEL_LOOPBREAK); - putop(c, OP_POP); // Packed and non-packed join. - putop(c, OP_ENDSEQ, getsel(f, UPB_HANDLER_ENDSEQ)); - putop(c, OP_SETDELIM); // Could remove for non-packed by dup ENDSEQ. - } else { - putop(c, OP_CHECKDELIM, LABEL_ENDMSG); - putchecktag(c, f, wire_type, LABEL_DISPATCH); - dispatchtarget(c, method, f, wire_type); - putop(c, parse_type, sel); + putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK); + putchecktag(c, f, wire_type, LABEL_LOOPBREAK); + putop(c, OP_BRANCH, -LABEL_LOOPSTART); + label(c, LABEL_LOOPBREAK); + putop(c, OP_POP); + putcb(c, OP_ENDSEQ, h, f, UPB_HANDLER_ENDSEQ); + } else { + putop(c, OP_CHECKDELIM, LABEL_ENDMSG); + putchecktag(c, f, wire_type, LABEL_DISPATCH); + dispatchtarget(c, method, f, wire_type); + putpush(c, f); + putop(c, OP_STARTSUBMSG, getsel(f, UPB_HANDLER_STARTSUBMSG)); + putop(c, OP_CALL, sub_m); + putop(c, OP_POP); + putcb(c, OP_ENDSUBMSG, h, f, UPB_HANDLER_ENDSUBMSG); + if (wire_type == UPB_WIRE_TYPE_DELIMITED) { + putop(c, OP_SETDELIM); } } + } else if (type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES || + type == UPB_TYPE_MESSAGE) { + label(c, LABEL_FIELD); + if (upb_fielddef_isseq(f)) { + putop(c, OP_CHECKDELIM, LABEL_ENDMSG); + putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH); + dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED); + putop(c, OP_PUSHTAGDELIM, 0); + putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ)); + label(c, LABEL_LOOPSTART); + putop(c, OP_PUSHLENDELIM); + putop(c, OP_STARTSTR, getsel(f, UPB_HANDLER_STARTSTR)); + // Need to emit even if no handler to skip past the string. + putop(c, OP_STRING, getsel(f, UPB_HANDLER_STRING)); + putop(c, OP_POP); + putcb(c, OP_ENDSTR, h, f, UPB_HANDLER_ENDSTR); + putop(c, OP_SETDELIM); + putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK); + putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_LOOPBREAK); + putop(c, OP_BRANCH, -LABEL_LOOPSTART); + label(c, LABEL_LOOPBREAK); + putop(c, OP_POP); + putcb(c, OP_ENDSEQ, h, f, UPB_HANDLER_ENDSEQ); + } else { + putop(c, OP_CHECKDELIM, LABEL_ENDMSG); + putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH); + dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED); + putop(c, OP_PUSHLENDELIM); + putop(c, OP_STARTSTR, getsel(f, UPB_HANDLER_STARTSTR)); + putop(c, OP_STRING, getsel(f, UPB_HANDLER_STRING)); + putop(c, OP_POP); + putcb(c, OP_ENDSTR, h, f, UPB_HANDLER_ENDSTR); + putop(c, OP_SETDELIM); + } + } else { + label(c, LABEL_FIELD); + opcode parse_type = (opcode)descriptor_type; + assert((int)parse_type >= 0 && parse_type <= OP_MAX); + upb_selector_t sel = getsel(f, upb_handlers_getprimitivehandlertype(f)); + int wire_type = native_wire_types[upb_fielddef_descriptortype(f)]; + if (upb_fielddef_isseq(f)) { + putop(c, OP_CHECKDELIM, LABEL_ENDMSG); + putchecktag(c, f, UPB_WIRE_TYPE_DELIMITED, LABEL_DISPATCH); + dispatchtarget(c, method, f, UPB_WIRE_TYPE_DELIMITED); + putop(c, OP_PUSHLENDELIM); + putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ)); // Packed + label(c, LABEL_LOOPSTART); + putop(c, parse_type, sel); + putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK); + putop(c, OP_BRANCH, -LABEL_LOOPSTART); + dispatchtarget(c, method, f, wire_type); + putop(c, OP_PUSHTAGDELIM, 0); + putop(c, OP_STARTSEQ, getsel(f, UPB_HANDLER_STARTSEQ)); // Non-packed + label(c, LABEL_LOOPSTART); + putop(c, parse_type, sel); + putop(c, OP_CHECKDELIM, LABEL_LOOPBREAK); + putchecktag(c, f, wire_type, LABEL_LOOPBREAK); + putop(c, OP_BRANCH, -LABEL_LOOPSTART); + label(c, LABEL_LOOPBREAK); + putop(c, OP_POP); // Packed and non-packed join. + putcb(c, OP_ENDSEQ, h, f, UPB_HANDLER_ENDSEQ); + putop(c, OP_SETDELIM); // Could remove for non-packed by dup ENDSEQ. + } else { + putop(c, OP_CHECKDELIM, LABEL_ENDMSG); + putchecktag(c, f, wire_type, LABEL_DISPATCH); + dispatchtarget(c, method, f, wire_type); + putop(c, parse_type, sel); + } } } + // For now we just loop back to the last field of the message (or if none, // the DISPATCH opcode for the message. putop(c, OP_BRANCH, -LABEL_FIELD); + + // Insert both a label and a dispatch table entry for this end-of-msg. label(c, LABEL_ENDMSG); - putop(c, OP_ENDMSG); + upb_value val = upb_value_uint64(pcofs(c) - method->code_base.ofs); + upb_inttable_insert(&method->dispatch, DISPATCH_ENDMSG, val); + + putsel(c, OP_ENDMSG, UPB_ENDMSG_SELECTOR, h); + putop(c, OP_RET); upb_inttable_compact(&method->dispatch); } -// Populate "methods" with new upb_pbdecodermethod objects reachable from "md". -// "h" can be NULL, in which case the methods will not be statically bound to -// destination handlers. -// -// Returns the method for this msgdef/handlers. +// Populate "methods" with new upb_pbdecodermethod objects reachable from "h". +// Returns the method for these handlers. // -// Note that there is a deep difference between keying the method table on -// upb_msgdef and keying it on upb_handlers. Since upb_msgdef : upb_handlers -// can be 1:many, binding a handlers statically can result in *more* methods -// being generated than if the methods are dynamically-bound. -// -// On the other hand, if/when the optimization mentioned below is implemented, -// binding to a upb_handlers can result in *fewer* methods being generated if -// many of the submessages have no handlers bound to them. -static void find_methods(compiler *c, const upb_msgdef *md, - const upb_handlers *h) { - const void *key = methodkey(md, h); +// Generates a new method for every destination handlers reachable from "h". +static void find_methods(compiler *c, const upb_handlers *h) { upb_value v; - if (upb_inttable_lookupptr(&c->group->methods, key, &v)) + if (upb_inttable_lookupptr(&c->group->methods, h, &v)) return; - newmethod(md, h, c->group, key); + newmethod(h, c->group); // Find submethods. upb_msg_iter i; + const upb_msgdef *md = upb_handlers_msgdef(h); for(upb_msg_begin(&i, md); !upb_msg_done(&i); upb_msg_next(&i)) { const upb_fielddef *f = upb_msg_iter_field(&i); - if (upb_fielddef_type(f) != UPB_TYPE_MESSAGE) - continue; - const upb_handlers *sub_h = h ? upb_handlers_getsubhandlers(h, f) : NULL; - - if (h && !sub_h && - upb_fielddef_descriptortype(f) == UPB_DESCRIPTOR_TYPE_MESSAGE) { - // OPT: We could optimize away the sub-method, but would have to make sure - // this field is compiled as a string instead of a submessage. + const upb_handlers *sub_h; + if (upb_fielddef_type(f) == UPB_TYPE_MESSAGE && + (sub_h = upb_handlers_getsubhandlers(h, f)) != NULL) { + // We only generate a decoder method for submessages with handlers. + // Others will be parsed as unknown fields. + find_methods(c, sub_h); } - - find_methods(c, upb_downcast_msgdef(upb_fielddef_subdef(f)), sub_h); } } @@ -814,12 +828,6 @@ static void sethandlers(mgroup *g, bool allowjit) { } } -static bool bind_dynamic(bool allowjit) { - // For the moment, JIT handlers always bind statically, but bytecode handlers - // never do. - return !allowjit; -} - #else // UPB_USE_JIT_X64 static void sethandlers(mgroup *g, bool allowjit) { @@ -828,33 +836,19 @@ static void sethandlers(mgroup *g, bool allowjit) { set_bytecode_handlers(g); } -static bool bind_dynamic(bool allowjit) { - // Bytecode handlers never bind statically. - UPB_UNUSED(allowjit); - return true; -} - #endif // UPB_USE_JIT_X64 // TODO(haberman): allow this to be constructed for an arbitrary set of dest // handlers and other mgroups (but verify we have a transitive closure). -const mgroup *mgroup_new(const upb_handlers *dest, bool allowjit, +const mgroup *mgroup_new(const upb_handlers *dest, bool allowjit, bool lazy, const void *owner) { UPB_UNUSED(allowjit); assert(upb_handlers_isfrozen(dest)); - const upb_msgdef *md = upb_handlers_msgdef(dest); mgroup *g = newgroup(owner); - compiler *c = newcompiler(g); - - if (bind_dynamic(allowjit)) { - // If binding dynamically, remove the reference against destination - // handlers. - dest = NULL; - } - - find_methods(c, md, dest); + compiler *c = newcompiler(g, lazy); + find_methods(c, dest); // We compile in two passes: // 1. all messages are assigned relative offsets from the beginning of the @@ -909,20 +903,28 @@ bool upb_pbcodecache_setallowjit(upb_pbcodecache *c, bool allow) { return true; } -const upb_pbdecodermethod *upb_pbcodecache_getdecodermethodfordesthandlers( - upb_pbcodecache *c, const upb_handlers *handlers) { +const upb_pbdecodermethod *upb_pbcodecache_getdecodermethod( + upb_pbcodecache *c, const upb_pbdecodermethodopts *opts) { // Right now we build a new DecoderMethod every time. // TODO(haberman): properly cache methods by their true key. - const mgroup *g = mgroup_new(handlers, c->allow_jit_, c); + const mgroup *g = mgroup_new(opts->handlers, c->allow_jit_, opts->lazy, c); upb_inttable_push(&c->groups, upb_value_constptr(g)); - const upb_msgdef *md = upb_handlers_msgdef(handlers); - if (bind_dynamic(c->allow_jit_)) { - handlers = NULL; - } - upb_value v; - bool ok = upb_inttable_lookupptr(&g->methods, methodkey(md, handlers), &v); + bool ok = upb_inttable_lookupptr(&g->methods, opts->handlers, &v); UPB_ASSERT_VAR(ok, ok); return upb_value_getptr(v); } + + +/* upb_pbdecodermethodopts ****************************************************/ + +void upb_pbdecodermethodopts_init(upb_pbdecodermethodopts *opts, + const upb_handlers *h) { + opts->handlers = h; + opts->lazy = false; +} + +void upb_pbdecodermethodopts_setlazy(upb_pbdecodermethodopts *opts, bool lazy) { + opts->lazy = lazy; +} diff --git a/upb/pb/compile_decoder_x64.c b/upb/pb/compile_decoder_x64.c index 44331b8..913a748 100644 --- a/upb/pb/compile_decoder_x64.c +++ b/upb/pb/compile_decoder_x64.c @@ -194,6 +194,8 @@ static void patchdispatch(jitcompiler *jc) { } // Define for JIT debugging. +//#define UPB_JIT_LOAD_SO + #ifdef UPB_JIT_LOAD_SO static void load_so(jitcompiler *jc) { // Dump to a .so file in /tmp and load that, so all the tooling works right diff --git a/upb/pb/compile_decoder_x64.dasc b/upb/pb/compile_decoder_x64.dasc index 571aa9b..97fb5ce 100644 --- a/upb/pb/compile_decoder_x64.dasc +++ b/upb/pb/compile_decoder_x64.dasc @@ -42,6 +42,9 @@ | mov DECODER->top, FRAME | mov DECODER->ptr, PTR | mov DECODER->data_end, DATAEND +| // We don't guarantee that delim_end is NULL when out of range like the +| // interpreter does. +| mov DECODER->delim_end, DELIMEND | sub DELIMEND, DECODER->buf | add DELIMEND, DECODER->bufstart_ofs | mov FRAME->end_ofs, DELIMEND @@ -205,6 +208,8 @@ static void emit_static_asm(jitcompiler *jc) { | | mov DECODER, rdi | callp upb_pbdecoder_resume // Same args as us; reuse regs. + | test eax, eax + | jns >1 | mov DECODER->saved_rsp, rsp | mov rax, rbx | load_regs @@ -212,12 +217,13 @@ static void emit_static_asm(jitcompiler *jc) { | // Test whether we have a saved stack to resume. | mov ARG3_64, DECODER->call_len | test ARG3_64, ARG3_64 - | jnz >1 + | jnz >2 | | call rax | | mov rax, DECODER->size_param | mov qword DECODER->call_len, 0 + |1: | add rsp, 8 // Counter previous alignment. | pop rbx | pop r12 @@ -227,7 +233,7 @@ static void emit_static_asm(jitcompiler *jc) { | pop rbp | ret | - |1: + |2: | // Resume decoder. | lea ARG2_64, DECODER->callstack | sub rsp, ARG3_64 @@ -293,6 +299,7 @@ static void emit_static_asm(jitcompiler *jc) { | add DELIMEND, rdx | cmp FRAME, DECODER->limit | je >3 // Stack overflow + | mov dword FRAME->groupnum, 0 | test rcx, rcx | jz >2 | mov DATAEND, DECODER->end @@ -850,24 +857,7 @@ static void jittag(jitcompiler *jc, uint64_t tag, int n, int ofs, |5: } -// Emit message-specific assembly. Overall code layout is: -// +---------------------------------------------------------------------------+ -// | Message A | -// | 1. function prologue (startmsg), jmps to OP_CHECKDELIM_RET before first | -// | OP_TAG* in 4. | -// | 2. function epilogue (endmsg), returns from function. | -// | 3. dispatch function (returns fptr to 4) | -// | - loops internally to skip unknown fields | -// | - after each unknown field does OP_CHECKDELIM_RET (returns 2) | -// | - also returns 2 for END_GROUP. -// | 4. code for each op: | -// | - OP_TAG* on mismatch calls 3 to get addr, then jumps to 4 (or 2 on EOM).| -// | - OP_CHECKDELIM_RET jumps to 2 | -// +---------------------------------------------------------------------------+ -// | Message B | -// | 1. ... | -// | ... | -// +---------------------------------------------------------------------------+ +// Compile the bytecode to x64. static void jitbytecode(jitcompiler *jc) { upb_pbdecodermethod *method = NULL; const upb_handlers *h = NULL; @@ -877,20 +867,21 @@ static void jitbytecode(jitcompiler *jc) { uint32_t arg = instr >> 8; int32_t longofs = arg; - if (op != OP_STARTMSG && op != OP_SETDISPATCH) { + if (op != OP_SETDISPATCH) { + // Skipped for SETDISPATCH because it defines its own asmlabel for the + // dispatch code it emits. asmlabel(jc, "0x%lx.%s", pcofs(jc), upb_pbdecoder_getopname(op)); + + // Skipped for SETDISPATCH because it should point at the function + // prologue, not the dispatch function that is emitted first. + // TODO: optimize this to only define pclabels that are actually used. + |=>define_pclabel(jc, jc->pc): } - // TODO: optimize this to only define pclabels that are actually used. - |=>define_pclabel(jc, jc->pc): + jc->pc++; switch (op) { case OP_STARTMSG: { - // This opcode serves as a function prolouge also. - const char *msgname = upb_msgdef_fullname(method->schema_); - asmlabel(jc, "0x%lx.parse.%s", pcofs(jc), msgname); - |=>define_pclabel(jc, method): - | sub rsp, 8 upb_func *startmsg = gethandler(h, UPB_STARTMSG_SELECTOR); if (startmsg) { // bool startmsg(void *closure, const void *hd) @@ -905,11 +896,12 @@ static void jitbytecode(jitcompiler *jc) { | jmp <1 |2: } + } else { + | nop } break; } case OP_ENDMSG: { - // This opcode serves as a function epiloue also. upb_func *endmsg = gethandler(h, UPB_ENDMSG_SELECTOR); |9: if (endmsg) { @@ -919,11 +911,12 @@ static void jitbytecode(jitcompiler *jc) { | mov ARG3_64, DECODER->status | callp endmsg } - | add rsp, 8 - | ret break; } case OP_SETDISPATCH: { + uint32_t *op_pc = jc->pc - 1; + + // Load info for new method. upb_inttable *dispatch; memcpy(&dispatch, jc->pc, sizeof(void*)); jc->pc += sizeof(void*) / sizeof(uint32_t); @@ -936,9 +929,18 @@ static void jitbytecode(jitcompiler *jc) { // case instead of parsing it field by field. We should also do the skip // in the containing message's code. h = method->dest_handlers_; - const char *msgname = upb_msgdef_fullname(method->schema_); + const char *msgname = upb_msgdef_fullname(upb_handlers_msgdef(h)); + + // Emit dispatch code for new method. asmlabel(jc, "0x%lx.dispatch.%s", pcofs(jc), msgname); jitdispatch(jc, method); + + // Emit function prologue for new method. + asmlabel(jc, "0x%lx.parse.%s", pcofs(jc), msgname); + |=>define_pclabel(jc, op_pc): + |=>define_pclabel(jc, method): + | sub rsp, 8 + break; } case OP_PARSE_DOUBLE: @@ -1056,6 +1058,7 @@ static void jitbytecode(jitcompiler *jc) { | add FRAME, sizeof(upb_pbdecoder_frame) | cmp FRAME, DECODER->limit | je ->err + | mov dword FRAME->groupnum, arg break; case OP_PUSHLENDELIM: | call ->pushlendelim @@ -1075,9 +1078,6 @@ static void jitbytecode(jitcompiler *jc) { | mov DATAEND, DELIMEND |1: break; - case OP_SETGROUPNUM: - | mov dword FRAME->groupnum, arg - break; case OP_SETBIGGROUPNUM: | mov dword FRAME->groupnum, *jc->pc++ break; @@ -1086,11 +1086,16 @@ static void jitbytecode(jitcompiler *jc) { | je =>pclabel(jc, jc->pc + longofs) break; case OP_CALL: - | call =>pclabel(jc, jc->pc + longofs + 3) + | call =>pclabel(jc, jc->pc + longofs) break; case OP_BRANCH: | jmp =>pclabel(jc, jc->pc + longofs); break; + case OP_RET: + |9: + | add rsp, 8 + | ret + break; case OP_TAG1: jittag(jc, (arg >> 8) & 0xff, 1, (int8_t)arg, method); break; @@ -1107,6 +1112,7 @@ static void jitbytecode(jitcompiler *jc) { assert(false); } } + asmlabel(jc, "eof"); | nop } diff --git a/upb/pb/decoder.c b/upb/pb/decoder.c index c5fae0e..9c54b8a 100644 --- a/upb/pb/decoder.c +++ b/upb/pb/decoder.c @@ -18,7 +18,6 @@ #endif #define CHECK_SUSPEND(x) if (!(x)) return upb_pbdecoder_suspend(d); -#define CHECK_RETURN(x) { int32_t ret = x; if (ret >= 0) return ret; } // Error messages that are shared between the bytecode and JIT decoders. const char *kPbDecoderStackOverflow = "Nesting too deep."; @@ -45,10 +44,10 @@ static bool consumes_input(opcode op) { case OP_PUSHTAGDELIM: case OP_POP: case OP_SETDELIM: - case OP_SETGROUPNUM: case OP_SETBIGGROUPNUM: case OP_CHECKDELIM: case OP_CALL: + case OP_RET: case OP_BRANCH: return false; default: @@ -147,13 +146,12 @@ static void checkpoint(upb_pbdecoder *d) { } // Resumes the decoder from an initial state or from a previous suspend. -void *upb_pbdecoder_resume(upb_pbdecoder *d, void *p, const char *buf, - size_t size, const upb_bufhandle *handle) { +int32_t upb_pbdecoder_resume(upb_pbdecoder *d, void *p, const char *buf, + size_t size, const upb_bufhandle *handle) { UPB_UNUSED(p); // Useless; just for the benefit of the JIT. d->buf_param = buf; d->size_param = size; d->handle = handle; - d->skip = 0; if (d->residual_end > d->residual) { // We have residual bytes from the last buffer. assert(ptr(d) == d->residual); @@ -161,7 +159,11 @@ void *upb_pbdecoder_resume(upb_pbdecoder *d, void *p, const char *buf, switchtobuf(d, buf, buf + size); } d->checkpoint = ptr(d); - return d; // For the JIT. + if (d->top->groupnum < 0) { + CHECK_RETURN(upb_pbdecoder_skipunknown(d, -1, 0)); + d->checkpoint = ptr(d); + } + return DECODE_OK; } // Suspends the decoder at the last checkpoint, without saving any residual @@ -176,10 +178,10 @@ size_t upb_pbdecoder_suspend(upb_pbdecoder *d) { assert(!in_residual_buf(d, d->checkpoint)); assert(d->buf == d->buf_param); size_t consumed = d->checkpoint - d->buf; - d->bufstart_ofs += consumed + d->skip; + d->bufstart_ofs += consumed; d->residual_end = d->residual; switchtobuf(d, d->residual, d->residual_end); - return consumed + d->skip; + return consumed; } } @@ -209,11 +211,11 @@ static size_t suspend_save(upb_pbdecoder *d) { assert(save <= sizeof(d->residual)); memcpy(d->residual, ptr(d), save); d->residual_end = d->residual + save; - d->bufstart_ofs = offset(d) + d->skip; + d->bufstart_ofs = offset(d); } switchtobuf(d, d->residual, d->residual_end); - return d->size_param + d->skip; + return d->size_param; } static int32_t skip(upb_pbdecoder *d, size_t bytes) { @@ -221,12 +223,16 @@ static int32_t skip(upb_pbdecoder *d, size_t bytes) { if (curbufleft(d) >= bytes) { // Skipped data is all in current buffer. advance(d, bytes); + return DECODE_OK; } else { // Skipped data extends beyond currently available buffers. - d->skip = bytes - curbufleft(d); - advance(d, curbufleft(d)); + d->pc = d->last; + size_t skip = bytes - curbufleft(d); + d->bufstart_ofs += (d->end - d->buf) + skip; + d->residual_end = d->residual; + switchtobuf(d, d->residual, d->residual_end); + return d->size_param + skip; } - return DECODE_OK; } FORCEINLINE void consumebytes(upb_pbdecoder *d, void *buf, size_t bytes) { @@ -247,8 +253,8 @@ static NOINLINE int32_t getbytes_slow(upb_pbdecoder *d, void *buf, if (curbufleft(d) >= bytes) { consumebytes(d, buf + avail, bytes); return DECODE_OK; - } else if (d->data_end - d->buf == d->top->end_ofs - d->bufstart_ofs) { - seterr(d, "Submessage ended in the middle of a value"); + } else if (d->data_end == d->delim_end) { + seterr(d, "Submessage ended in the middle of a value or group"); return upb_pbdecoder_suspend(d); } else { return suspend_save(d); @@ -378,11 +384,24 @@ static bool push(upb_pbdecoder *d, uint64_t end) { fr++; fr->end_ofs = end; fr->dispatch = NULL; - fr->groupnum = -1; + fr->groupnum = 0; d->top = fr; return true; } +static bool pushtagdelim(upb_pbdecoder *d, uint32_t arg) { + // While we expect to see an "end" tag (either ENDGROUP or a non-sequence + // field number) prior to hitting any enclosing submessage end, pushing our + // existing delim end prevents us from continuing to parse values from a + // corrupt proto that doesn't give us an END tag in time. + if (!push(d, d->top->end_ofs)) + return false; + d->top->groupnum = arg; + return true; +} + +static void pop(upb_pbdecoder *d) { d->top--; } + NOINLINE int32_t upb_pbdecoder_checktag_slow(upb_pbdecoder *d, uint64_t expected) { uint64_t data = 0; @@ -400,46 +419,103 @@ NOINLINE int32_t upb_pbdecoder_checktag_slow(upb_pbdecoder *d, } } -int32_t upb_pbdecoder_skipunknown(upb_pbdecoder *d, uint32_t fieldnum, +int32_t upb_pbdecoder_skipunknown(upb_pbdecoder *d, int32_t fieldnum, uint8_t wire_type) { - if (fieldnum == 0 || fieldnum > UPB_MAX_FIELDNUMBER) { - seterr(d, "Invalid field number"); - return upb_pbdecoder_suspend(d); - } - - if (wire_type == UPB_WIRE_TYPE_END_GROUP) { - if (fieldnum != d->top->groupnum) { - seterr(d, "Unmatched ENDGROUP tag."); + if (fieldnum >= 0) + goto have_tag; + + while (true) { + uint32_t tag; + CHECK_RETURN(decode_v32(d, &tag)); + wire_type = tag & 0x7; + fieldnum = tag >> 3; + +have_tag: + if (fieldnum == 0) { + seterr(d, "Saw invalid field number (0)"); return upb_pbdecoder_suspend(d); } - return DECODE_ENDGROUP; - } - // TODO: deliver to unknown field callback. - switch (wire_type) { - case UPB_WIRE_TYPE_VARINT: { - uint64_t u64; - return decode_varint(d, &u64); + // TODO: deliver to unknown field callback. + switch (wire_type) { + case UPB_WIRE_TYPE_32BIT: + CHECK_RETURN(skip(d, 4)); + break; + case UPB_WIRE_TYPE_64BIT: + CHECK_RETURN(skip(d, 8)); + break; + case UPB_WIRE_TYPE_VARINT: { + uint64_t u64; + CHECK_RETURN(decode_varint(d, &u64)); + break; + } + case UPB_WIRE_TYPE_DELIMITED: { + uint32_t len; + CHECK_RETURN(decode_v32(d, &len)); + CHECK_RETURN(skip(d, len)); + break; + } + case UPB_WIRE_TYPE_START_GROUP: + CHECK_SUSPEND(pushtagdelim(d, -fieldnum)); + break; + case UPB_WIRE_TYPE_END_GROUP: + if (fieldnum == -d->top->groupnum) { + pop(d); + } else if (fieldnum == d->top->groupnum) { + return DECODE_ENDGROUP; + } else { + seterr(d, "Unmatched ENDGROUP tag."); + return upb_pbdecoder_suspend(d); + } + break; + default: + seterr(d, "Invalid wire type"); + return upb_pbdecoder_suspend(d); } - case UPB_WIRE_TYPE_32BIT: - return skip(d, 4); - case UPB_WIRE_TYPE_64BIT: - return skip(d, 8); - case UPB_WIRE_TYPE_DELIMITED: { - uint32_t len; - CHECK_RETURN(decode_v32(d, &len)); - return skip(d, len); + + if (d->top->groupnum >= 0) { + return DECODE_OK; } - case UPB_WIRE_TYPE_START_GROUP: - seterr(d, "Can't handle unknown groups yet"); - return upb_pbdecoder_suspend(d); - case UPB_WIRE_TYPE_END_GROUP: - default: - seterr(d, "Invalid wire type"); + + if (ptr(d) == d->delim_end) { + seterr(d, "Enclosing submessage ended in the middle of value or group"); + // Unlike most errors we notice during parsing, right now we have consumed + // all of the user's input. + // + // There are three different options for how to handle this case: + // + // 1. decode() = short count, error = set + // 2. decode() = full count, error = set + // 3. decode() = full count, error NOT set, short count and error will + // be reported on next call to decode() (or end()) + // + // (1) and (3) have the advantage that they preserve the invariant that an + // error occurs iff decode() returns a short count. + // + // (2) and (3) have the advantage of reflecting the fact that all of the + // bytes were in fact parsed (and possibly delivered to the unknown field + // handler, in the future when that is supported). + // + // (3) requires extra state in the decode (a place to store the "permanent + // error" that we should return for all subsequent attempts to decode). + // But we likely want this anyway. + // + // Right now we do (1), thanks to the fact that we checkpoint *after* this + // check. (3) may be a better choice long term; unclear at the moment. return upb_pbdecoder_suspend(d); + } + + checkpoint(d); } } +static void goto_endmsg(upb_pbdecoder *d) { + upb_value v; + bool found = upb_inttable_lookup32(d->top->dispatch, DISPATCH_ENDMSG, &v); + UPB_ASSERT_VAR(found, found); + d->pc = d->top->base + upb_value_getuint64(v); +} + static int32_t dispatch(upb_pbdecoder *d) { upb_inttable *dispatch = d->top->dispatch; @@ -470,7 +546,7 @@ static int32_t dispatch(upb_pbdecoder *d) { int32_t ret = upb_pbdecoder_skipunknown(d, fieldnum, wire_type); if (ret == DECODE_ENDGROUP) { - d->pc = d->top->base - 1; // Back to OP_ENDMSG. + goto_endmsg(d); return DECODE_OK; } else { d->pc = d->last - 1; // Rewind to CHECKDELIM. @@ -493,7 +569,11 @@ size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf, upb_pbdecoder *d = closure; const mgroup *group = hd; assert(buf); - upb_pbdecoder_resume(d, NULL, buf, size, handle); + int32_t result = upb_pbdecoder_resume(d, NULL, buf, size, handle); + if (result == DECODE_ENDGROUP) { + goto_endmsg(d); + } + CHECK_RETURN(result); UPB_UNUSED(group); #define VMCASE(op, code) \ @@ -552,8 +632,6 @@ size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf, ) VMCASE(OP_ENDMSG, CHECK_SUSPEND(upb_sink_endmsg(&d->top->sink, d->status)); - assert(d->call_len > 0); - d->pc = d->callstack[--d->call_len]; ) VMCASE(OP_STARTSEQ, upb_pbdecoder_frame *outer = outer_frame(d); @@ -579,25 +657,39 @@ size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf, ) VMCASE(OP_STRING, uint32_t len = curbufleft(d); - CHECK_SUSPEND( - upb_sink_putstring(&d->top->sink, arg, ptr(d), len, handle)); - advance(d, len); - if (d->delim_end == NULL) { // String extends beyond this buf? - d->pc--; - d->bufstart_ofs += size; - d->residual_end = d->residual; - return size; + size_t n = upb_sink_putstring(&d->top->sink, arg, ptr(d), len, handle); + if (n > len) { + if (n > d->top->end_ofs - offset(d)) { + seterr(d, "Tried to skip past end of string."); + return upb_pbdecoder_suspend(d); + } else { + return skip(d, n); + } + } else if (n < len) { + advance(d, n); + return upb_pbdecoder_suspend(d); + } else { + advance(d, n); + if (d->delim_end == NULL) { // String extends beyond this buf? + d->pc--; // Do OP_STRING again when we resume. + d->bufstart_ofs += size; + d->residual_end = d->residual; + return size; + } } ) VMCASE(OP_ENDSTR, CHECK_SUSPEND(upb_sink_endstr(&d->top->sink, arg)); ) VMCASE(OP_PUSHTAGDELIM, - CHECK_SUSPEND(push(d, d->top->end_ofs)); + CHECK_SUSPEND(pushtagdelim(d, arg)); + ) + VMCASE(OP_SETBIGGROUPNUM, + d->top->groupnum = *d->pc++; ) VMCASE(OP_POP, assert(d->top > d->stack); - d->top--; + pop(d); ) VMCASE(OP_PUSHLENDELIM, uint32_t len; @@ -608,13 +700,9 @@ size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf, VMCASE(OP_SETDELIM, set_delim_end(d); ) - VMCASE(OP_SETGROUPNUM, - d->top->groupnum = arg; - ) - VMCASE(OP_SETBIGGROUPNUM, - d->top->groupnum = *d->pc++; - ) VMCASE(OP_CHECKDELIM, + // We are guaranteed of this assert because we never allow ourselves to + // consume bytes beyond data_end, which covers delim_end when non-NULL. assert(!(d->delim_end && ptr(d) > d->delim_end)); if (ptr(d) == d->delim_end) d->pc += longofs; @@ -623,6 +711,10 @@ size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf, d->callstack[d->call_len++] = d->pc; d->pc += longofs; ) + VMCASE(OP_RET, + assert(d->call_len > 0); + d->pc = d->callstack[--d->call_len]; + ) VMCASE(OP_BRANCH, d->pc += longofs; ) @@ -755,6 +847,7 @@ void upb_pbdecoder_init(upb_pbdecoder *d, const upb_pbdecodermethod *m, void upb_pbdecoder_reset(upb_pbdecoder *d) { d->top = d->stack; d->top->end_ofs = UINT64_MAX; + d->top->groupnum = 0; d->bufstart_ofs = 0; d->ptr = d->residual; d->buf = d->residual; diff --git a/upb/pb/decoder.h b/upb/pb/decoder.h index 4313bb3..586d2d5 100644 --- a/upb/pb/decoder.h +++ b/upb/pb/decoder.h @@ -20,19 +20,23 @@ namespace pb { class CodeCache; class Decoder; class DecoderMethod; +class DecoderMethodOptions; } // namespace pb } // namespace upb typedef upb::pb::CodeCache upb_pbcodecache; typedef upb::pb::Decoder upb_pbdecoder; typedef upb::pb::DecoderMethod upb_pbdecodermethod; +typedef upb::pb::DecoderMethodOptions upb_pbdecodermethodopts; #else struct upb_pbdecoder; struct upb_pbdecodermethod; +struct upb_pbdecodermethodopts; struct upb_pbcodecache; typedef struct upb_pbdecoder upb_pbdecoder; typedef struct upb_pbdecodermethod upb_pbdecodermethod; +typedef struct upb_pbdecodermethodopts upb_pbdecodermethodopts; typedef struct upb_pbcodecache upb_pbcodecache; #endif @@ -72,14 +76,40 @@ typedef struct { // that calls from the JIT into C work correctly. uint64_t end_ofs; const uint32_t *base; - uint32_t groupnum; + + // 0 indicates a length-delimited field. + // A positive number indicates a known group. + // A negative number indicates an unknown group. + int32_t groupnum; upb_inttable *dispatch; // Not used by the JIT. } upb_pbdecoder_frame; #ifdef __cplusplus -// Represents the code to parse a protobuf according to a specific schema, -// optionally bound to a set of destination handlers. +// The parameters one uses to construct a DecoderMethod. +// TODO(haberman): move allowjit here? Seems more convenient for users. +class upb::pb::DecoderMethodOptions { + public: + // Parameter represents the destination handlers that this method will push + // to. + explicit DecoderMethodOptions(const Handlers* dest_handlers); + + // Should the decoder push submessages to lazy handlers for fields that have + // them? The caller should set this iff the lazy handlers expect data that is + // in protobuf binary format and the caller wishes to lazy parse it. + void set_lazy(bool lazy); + + private: +#else +struct upb_pbdecodermethodopts { +#endif + const upb_handlers *handlers; + bool lazy; +}; + +#ifdef __cplusplus + +// Represents the code to parse a protobuf according to a destination Handlers. class upb::pb::DecoderMethod /* : public upb::RefCounted */ { public: // From upb::ReferenceCounted. @@ -88,14 +118,9 @@ class upb::pb::DecoderMethod /* : public upb::RefCounted */ { void DonateRef(const void* from, const void* to) const; void CheckRef(const void* owner) const; - // The schema that this method parses. Never NULL. - const MessageDef* schema() const; - // The destination handlers that are statically bound to this method. // This method is only capable of outputting to a sink that uses these // handlers. - // - // Will be NULL if this method is not statically bound. const Handlers* dest_handlers() const; // The input handlers for this decoder method. @@ -106,8 +131,7 @@ class upb::pb::DecoderMethod /* : public upb::RefCounted */ { // Convenience method for generating a DecoderMethod without explicitly // creating a CodeCache. - static reffed_ptr<const DecoderMethod> NewForDestHandlers( - const upb::Handlers *dest); + static reffed_ptr<const DecoderMethod> New(const DecoderMethodOptions& opts); private: UPB_DISALLOW_POD_OPS(DecoderMethod, upb::pb::DecoderMethod); @@ -138,13 +162,7 @@ struct upb_pbdecodermethod { // The handler one calls to invoke this method. upb_byteshandler input_handler_; - // The message type that this method is parsing. - const upb_msgdef *schema_; - - // The destination handlers this method is bound to, or NULL if this method - // can be bound to a destination handlers instance at runtime. - // - // If non-NULL, we own a ref. + // The destination handlers this method is bound to. We own a ref. const upb_handlers *dest_handlers_; // The dispatch table layout is: @@ -183,8 +201,7 @@ class upb::pb::Decoder { void Reset(); // Resets the output sink of the Decoder. - // The given sink must match method()->schema() as well as - // method()->dest_handlers() if the latter is non-NULL. + // The given sink must match method()->dest_handlers(). // // This must be called at least once before the decoder can be used. It may // only be called with the decoder is in a state where it was just created or @@ -221,9 +238,6 @@ struct upb_pbdecoder { // Overall stream offset of "buf." uint64_t bufstart_ofs; - // How many bytes past the end of the user buffer we want to skip. - size_t skip; - // Buffer for residual bytes not parsed from the previous buffer. // The maximum number of residual bytes we require is 12; a five-byte // unknown tag plus an eight-byte value, less one because the value @@ -290,8 +304,7 @@ class upb::pb::CodeCache { // more efficient decoding. However the returned method may or may not // actually be statically bound. But in all cases, the returned method can // push data to the given handlers. - const DecoderMethod *GetDecoderMethodForDestHandlers( - const upb::Handlers *handlers); + const DecoderMethod *GetDecoderMethod(const DecoderMethodOptions& opts); // If/when someone needs to explicitly create a dynamically-bound // DecoderMethod*, we can add a method to get it here. @@ -320,27 +333,30 @@ const upb_pbdecodermethod *upb_pbdecoder_method(const upb_pbdecoder *d); bool upb_pbdecoder_resetoutput(upb_pbdecoder *d, upb_sink *sink); upb_bytessink *upb_pbdecoder_input(upb_pbdecoder *d); +void upb_pbdecodermethodopts_init(upb_pbdecodermethodopts *opts, + const upb_handlers *h); +void upb_pbdecodermethodopts_setlazy(upb_pbdecodermethodopts *opts, bool lazy); + void upb_pbdecodermethod_ref(const upb_pbdecodermethod *m, const void *owner); void upb_pbdecodermethod_unref(const upb_pbdecodermethod *m, const void *owner); void upb_pbdecodermethod_donateref(const upb_pbdecodermethod *m, const void *from, const void *to); void upb_pbdecodermethod_checkref(const upb_pbdecodermethod *m, const void *owner); -const upb_msgdef *upb_pbdecodermethod_schema(const upb_pbdecodermethod *m); const upb_handlers *upb_pbdecodermethod_desthandlers( const upb_pbdecodermethod *m); const upb_byteshandler *upb_pbdecodermethod_inputhandler( const upb_pbdecodermethod *m); bool upb_pbdecodermethod_isnative(const upb_pbdecodermethod *m); -const upb_pbdecodermethod *upb_pbdecodermethod_newfordesthandlers( - const upb_handlers *dest, const void *owner); +const upb_pbdecodermethod *upb_pbdecodermethod_new( + const upb_pbdecodermethodopts *opts, const void *owner); void upb_pbcodecache_init(upb_pbcodecache *c); void upb_pbcodecache_uninit(upb_pbcodecache *c); bool upb_pbcodecache_allowjit(const upb_pbcodecache *c); bool upb_pbcodecache_setallowjit(upb_pbcodecache *c, bool allow); -const upb_pbdecodermethod *upb_pbcodecache_getdecodermethodfordesthandlers( - upb_pbcodecache *c, const upb_handlers *handlers); +const upb_pbdecodermethod *upb_pbcodecache_getdecodermethod( + upb_pbcodecache *c, const upb_pbdecodermethodopts *opts); #ifdef __cplusplus } /* extern "C" */ @@ -391,6 +407,13 @@ inline BytesSink* Decoder::input() { return upb_pbdecoder_input(this); } +inline DecoderMethodOptions::DecoderMethodOptions(const Handlers* h) { + upb_pbdecodermethodopts_init(this, h); +} +inline void DecoderMethodOptions::set_lazy(bool lazy) { + upb_pbdecodermethodopts_setlazy(this, lazy); +} + inline void DecoderMethod::Ref(const void *owner) const { upb_pbdecodermethod_ref(this, owner); } @@ -403,9 +426,6 @@ inline void DecoderMethod::DonateRef(const void *from, const void *to) const { inline void DecoderMethod::CheckRef(const void *owner) const { upb_pbdecodermethod_checkref(this, owner); } -inline const MessageDef* DecoderMethod::schema() const { - return upb_pbdecodermethod_schema(this); -} inline const Handlers* DecoderMethod::dest_handlers() const { return upb_pbdecodermethod_desthandlers(this); } @@ -416,10 +436,9 @@ inline bool DecoderMethod::is_native() const { return upb_pbdecodermethod_isnative(this); } // static -inline reffed_ptr<const DecoderMethod> DecoderMethod::NewForDestHandlers( - const Handlers *dest) { - const upb_pbdecodermethod *m = - upb_pbdecodermethod_newfordesthandlers(dest, &m); +inline reffed_ptr<const DecoderMethod> DecoderMethod::New( + const DecoderMethodOptions &opts) { + const upb_pbdecodermethod *m = upb_pbdecodermethod_new(&opts, &m); return reffed_ptr<const DecoderMethod>(m, &m); } @@ -435,9 +454,9 @@ inline bool CodeCache::allow_jit() const { inline bool CodeCache::set_allow_jit(bool allow) { return upb_pbcodecache_setallowjit(this, allow); } -inline const DecoderMethod* CodeCache::GetDecoderMethodForDestHandlers( - const upb::Handlers* handlers) { - return upb_pbcodecache_getdecodermethodfordesthandlers(this, handlers); +inline const DecoderMethod *CodeCache::GetDecoderMethod( + const DecoderMethodOptions& opts) { + return upb_pbcodecache_getdecodermethod(this, &opts); } } // namespace pb diff --git a/upb/pb/decoder.int.h b/upb/pb/decoder.int.h index 20afa68..11aa133 100644 --- a/upb/pb/decoder.int.h +++ b/upb/pb/decoder.int.h @@ -40,12 +40,10 @@ typedef enum { OP_PUSHLENDELIM = 24, // No arg. OP_POP = 25, // No arg. OP_SETDELIM = 26, // No arg. - OP_SETGROUPNUM = 27, - OP_SETBIGGROUPNUM = 28, // two words: | unused (24) | opc || groupnum (32) | - - // The arg for these opcodes is a local label reference. - OP_CHECKDELIM = 29, - OP_CALL = 30, + OP_SETBIGGROUPNUM = 27, // two words: | unused (24) | opc || groupnum (32) | + OP_CHECKDELIM = 28, + OP_CALL = 29, + OP_RET = 30, OP_BRANCH = 31, // Different opcodes depending on how many bytes expected. @@ -112,10 +110,10 @@ size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf, bool upb_pbdecoder_end(void *closure, const void *handler_data); // Decoder-internal functions that the JIT calls to handle fallback paths. -void *upb_pbdecoder_resume(upb_pbdecoder *d, void *p, const char *buf, - size_t size, const upb_bufhandle *handle); +int32_t upb_pbdecoder_resume(upb_pbdecoder *d, void *p, const char *buf, + size_t size, const upb_bufhandle *handle); size_t upb_pbdecoder_suspend(upb_pbdecoder *d); -int32_t upb_pbdecoder_skipunknown(upb_pbdecoder *d, uint32_t fieldnum, +int32_t upb_pbdecoder_skipunknown(upb_pbdecoder *d, int32_t fieldnum, uint8_t wire_type); int32_t upb_pbdecoder_checktag_slow(upb_pbdecoder *d, uint64_t expected); int32_t upb_pbdecoder_decode_varint_slow(upb_pbdecoder *d, uint64_t *u64); @@ -137,8 +135,21 @@ void upb_pbdecoder_freejit(mgroup *group); // wherever that takes you." #define LABEL_DISPATCH 0 +// A special slot in the dispatch table that stores the epilogue (ENDMSG and/or +// RET) for branching to when we find an appropriate ENDGROUP tag. +#define DISPATCH_ENDMSG 0 + +// All of the functions in decoder.c that return int32_t return values according +// to the following scheme: +// 1. negative values indicate a return code from the following list. +// 2. positive values indicate that error or end of buffer was hit, and +// that the decode function should immediately return the given value +// (the decoder state has already been suspended and is ready to be +// resumed). #define DECODE_OK -1 #define DECODE_MISMATCH -2 // Used only from checktag_slow(). -#define DECODE_ENDGROUP -2 // Used only from checkunknown(). +#define DECODE_ENDGROUP -3 // Used only from checkunknown(). + +#define CHECK_RETURN(x) { int32_t ret = x; if (ret >= 0) return ret; } #endif // UPB_DECODER_INT_H_ diff --git a/upb/pb/glue.c b/upb/pb/glue.c index 73ef145..fde2dd1 100644 --- a/upb/pb/glue.c +++ b/upb/pb/glue.c @@ -17,8 +17,10 @@ upb_def **upb_load_defs_from_descriptor(const char *str, size_t len, int *n, void *owner, upb_status *status) { // Create handlers. const upb_handlers *reader_h = upb_descreader_newhandlers(&reader_h); + upb_pbdecodermethodopts opts; + upb_pbdecodermethodopts_init(&opts, reader_h); const upb_pbdecodermethod *decoder_m = - upb_pbdecodermethod_newfordesthandlers(reader_h, &decoder_m); + upb_pbdecodermethod_new(&opts, &decoder_m); upb_pbdecoder decoder; upb_descreader reader; |