google-protobuf 3.20.0.rc.1-x86-linux → 3.20.0.rc.2-x86-linux

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of google-protobuf might be problematic. Click here for more details.

@@ -254,6 +254,14 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
254
254
  ((void)(addr), (void)(size))
255
255
  #endif
256
256
 
257
+ /* Disable proto2 arena behavior (TEMPORARY) **********************************/
258
+
259
+ #ifdef UPB_DISABLE_PROTO2_ENUM_CHECKING
260
+ #define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 1
261
+ #else
262
+ #define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 0
263
+ #endif
264
+
257
265
  /** upb/decode.c ************************************************************/
258
266
 
259
267
  #include <setjmp.h>
@@ -610,6 +618,18 @@ static char* encode_varint32(uint32_t val, char* ptr) {
610
618
  return ptr;
611
619
  }
612
620
 
621
+ static void upb_Decode_AddUnknownVarints(upb_Decoder* d, upb_Message* msg,
622
+ uint32_t val1, uint32_t val2) {
623
+ char buf[20];
624
+ char* end = buf;
625
+ end = encode_varint32(val1, end);
626
+ end = encode_varint32(val2, end);
627
+
628
+ if (!_upb_Message_AddUnknown(msg, buf, end - buf, &d->arena)) {
629
+ decode_err(d, kUpb_DecodeStatus_OutOfMemory);
630
+ }
631
+ }
632
+
613
633
  UPB_NOINLINE
614
634
  static bool decode_checkenum_slow(upb_Decoder* d, const char* ptr,
615
635
  upb_Message* msg, const upb_MiniTable_Enum* e,
@@ -623,17 +643,9 @@ static bool decode_checkenum_slow(upb_Decoder* d, const char* ptr,
623
643
 
624
644
  // Unrecognized enum goes into unknown fields.
625
645
  // For packed fields the tag could be arbitrarily far in the past, so we
626
- // just re-encode the tag here.
627
- char buf[20];
628
- char* end = buf;
646
+ // just re-encode the tag and value here.
629
647
  uint32_t tag = ((uint32_t)field->number << 3) | kUpb_WireType_Varint;
630
- end = encode_varint32(tag, end);
631
- end = encode_varint32(v, end);
632
-
633
- if (!_upb_Message_AddUnknown(msg, buf, end - buf, &d->arena)) {
634
- decode_err(d, kUpb_DecodeStatus_OutOfMemory);
635
- }
636
-
648
+ upb_Decode_AddUnknownVarints(d, msg, tag, v);
637
649
  return false;
638
650
  }
639
651
 
@@ -852,8 +864,20 @@ static const char* decode_tomap(upb_Decoder* d, const char* ptr,
852
864
  upb_value_ptr(_upb_Message_New(entry->subs[0].submsg, &d->arena));
853
865
  }
854
866
 
867
+ const char* start = ptr;
855
868
  ptr = decode_tosubmsg(d, ptr, &ent.k, subs, field, val->size);
856
- _upb_Map_Set(map, &ent.k, map->key_size, &ent.v, map->val_size, &d->arena);
869
+ // check if ent had any unknown fields
870
+ size_t size;
871
+ upb_Message_GetUnknown(&ent.k, &size);
872
+ if (size != 0) {
873
+ uint32_t tag = ((uint32_t)field->number << 3) | kUpb_WireType_Delimited;
874
+ upb_Decode_AddUnknownVarints(d, msg, tag, (uint32_t)(ptr - start));
875
+ if (!_upb_Message_AddUnknown(msg, start, ptr - start, &d->arena)) {
876
+ decode_err(d, kUpb_DecodeStatus_OutOfMemory);
877
+ }
878
+ } else {
879
+ _upb_Map_Set(map, &ent.k, map->key_size, &ent.v, map->val_size, &d->arena);
880
+ }
857
881
  return ptr;
858
882
  }
859
883
 
@@ -967,7 +991,7 @@ static const char* decode_msgset(upb_Decoder* d, const char* ptr,
967
991
  .fields = NULL,
968
992
  .size = 0,
969
993
  .field_count = 0,
970
- .ext = upb_ExtMode_IsMessageSet_ITEM,
994
+ .ext = kUpb_ExtMode_IsMessageSet_ITEM,
971
995
  .dense_below = 0,
972
996
  .table_mask = -1};
973
997
  return decode_group(d, ptr, msg, &item_layout, 1);
@@ -1005,19 +1029,19 @@ static const upb_MiniTable_Field* decode_findfield(upb_Decoder* d,
1005
1029
 
1006
1030
  if (d->extreg) {
1007
1031
  switch (l->ext) {
1008
- case upb_ExtMode_Extendable: {
1032
+ case kUpb_ExtMode_Extendable: {
1009
1033
  const upb_MiniTable_Extension* ext =
1010
1034
  _upb_extreg_get(d->extreg, l, field_number);
1011
1035
  if (ext) return &ext->field;
1012
1036
  break;
1013
1037
  }
1014
- case upb_ExtMode_IsMessageSet:
1038
+ case kUpb_ExtMode_IsMessageSet:
1015
1039
  if (field_number == _UPB_MSGSET_ITEM) {
1016
1040
  static upb_MiniTable_Field item = {0, 0, 0, 0, TYPE_MSGSET_ITEM, 0};
1017
1041
  return &item;
1018
1042
  }
1019
1043
  break;
1020
- case upb_ExtMode_IsMessageSet_ITEM:
1044
+ case kUpb_ExtMode_IsMessageSet_ITEM:
1021
1045
  switch (field_number) {
1022
1046
  case _UPB_MSGSET_TYPEID: {
1023
1047
  static upb_MiniTable_Field type_id = {
@@ -1110,7 +1134,7 @@ static const char* decode_known(upb_Decoder* d, const char* ptr,
1110
1134
  const upb_MiniTable_Sub* subs = layout->subs;
1111
1135
  uint8_t mode = field->mode;
1112
1136
 
1113
- if (UPB_UNLIKELY(mode & upb_LabelFlags_IsExtension)) {
1137
+ if (UPB_UNLIKELY(mode & kUpb_LabelFlags_IsExtension)) {
1114
1138
  const upb_MiniTable_Extension* ext_layout =
1115
1139
  (const upb_MiniTable_Extension*)field;
1116
1140
  upb_Message_Extension* ext =
@@ -1291,7 +1315,7 @@ upb_DecodeStatus upb_Decode(const char* buf, size_t size, void* msg,
1291
1315
 
1292
1316
  if (size <= 16) {
1293
1317
  memset(&state.patch, 0, 32);
1294
- memcpy(&state.patch, buf, size);
1318
+ if (size) memcpy(&state.patch, buf, size);
1295
1319
  buf = state.patch;
1296
1320
  state.end = buf + size;
1297
1321
  state.limit = 0;
@@ -1593,7 +1617,7 @@ static void encode_array(upb_encstate* e, const upb_Message* msg,
1593
1617
  const upb_MiniTable_Sub* subs,
1594
1618
  const upb_MiniTable_Field* f) {
1595
1619
  const upb_Array* arr = *UPB_PTR_AT(msg, f->offset, upb_Array*);
1596
- bool packed = f->mode & upb_LabelFlags_IsPacked;
1620
+ bool packed = f->mode & kUpb_LabelFlags_IsPacked;
1597
1621
  size_t pre_len = e->limit - e->ptr;
1598
1622
 
1599
1623
  if (arr == NULL || arr->len == 0) {
@@ -1747,23 +1771,29 @@ static bool encode_shouldencode(upb_encstate* e, const upb_Message* msg,
1747
1771
  if (f->presence == 0) {
1748
1772
  /* Proto3 presence or map/array. */
1749
1773
  const void* mem = UPB_PTR_AT(msg, f->offset, void);
1750
- switch (f->mode >> upb_FieldRep_Shift) {
1751
- case upb_FieldRep_1Byte: {
1774
+ switch (f->mode >> kUpb_FieldRep_Shift) {
1775
+ case kUpb_FieldRep_1Byte: {
1752
1776
  char ch;
1753
1777
  memcpy(&ch, mem, 1);
1754
1778
  return ch != 0;
1755
1779
  }
1756
- case upb_FieldRep_4Byte: {
1780
+ #if UINTPTR_MAX == 0xffffffff
1781
+ case kUpb_FieldRep_Pointer:
1782
+ #endif
1783
+ case kUpb_FieldRep_4Byte: {
1757
1784
  uint32_t u32;
1758
1785
  memcpy(&u32, mem, 4);
1759
1786
  return u32 != 0;
1760
1787
  }
1761
- case upb_FieldRep_8Byte: {
1788
+ #if UINTPTR_MAX != 0xffffffff
1789
+ case kUpb_FieldRep_Pointer:
1790
+ #endif
1791
+ case kUpb_FieldRep_8Byte: {
1762
1792
  uint64_t u64;
1763
1793
  memcpy(&u64, mem, 8);
1764
1794
  return u64 != 0;
1765
1795
  }
1766
- case upb_FieldRep_StringView: {
1796
+ case kUpb_FieldRep_StringView: {
1767
1797
  const upb_StringView* str = (const upb_StringView*)mem;
1768
1798
  return str->size != 0;
1769
1799
  }
@@ -1837,16 +1867,16 @@ static void encode_message(upb_encstate* e, const upb_Message* msg,
1837
1867
  }
1838
1868
  }
1839
1869
 
1840
- if (m->ext != upb_ExtMode_NonExtendable) {
1870
+ if (m->ext != kUpb_ExtMode_NonExtendable) {
1841
1871
  /* Encode all extensions together. Unlike C++, we do not attempt to keep
1842
1872
  * these in field number order relative to normal fields or even to each
1843
1873
  * other. */
1844
1874
  size_t ext_count;
1845
1875
  const upb_Message_Extension* ext = _upb_Message_Getexts(msg, &ext_count);
1846
- const upb_Message_Extension* end = ext + ext_count;
1847
1876
  if (ext_count) {
1877
+ const upb_Message_Extension* end = ext + ext_count;
1848
1878
  for (; ext != end; ext++) {
1849
- if (UPB_UNLIKELY(m->ext == upb_ExtMode_IsMessageSet)) {
1879
+ if (UPB_UNLIKELY(m->ext == kUpb_ExtMode_IsMessageSet)) {
1850
1880
  encode_msgset_item(e, ext);
1851
1881
  } else {
1852
1882
  encode_field(e, &ext->data, &ext->ext->sub, &ext->ext->field);
@@ -1855,12 +1885,14 @@ static void encode_message(upb_encstate* e, const upb_Message* msg,
1855
1885
  }
1856
1886
  }
1857
1887
 
1858
- const upb_MiniTable_Field* f = &m->fields[m->field_count];
1859
- const upb_MiniTable_Field* first = &m->fields[0];
1860
- while (f != first) {
1861
- f--;
1862
- if (encode_shouldencode(e, msg, m->subs, f)) {
1863
- encode_field(e, msg, m->subs, f);
1888
+ if (m->field_count) {
1889
+ const upb_MiniTable_Field* f = &m->fields[m->field_count];
1890
+ const upb_MiniTable_Field* first = &m->fields[0];
1891
+ while (f != first) {
1892
+ f--;
1893
+ if (encode_shouldencode(e, msg, m->subs, f)) {
1894
+ encode_field(e, msg, m->subs, f);
1895
+ }
1864
1896
  }
1865
1897
  }
1866
1898
 
@@ -1927,7 +1959,7 @@ static bool realloc_internal(upb_Message* msg, size_t need, upb_Arena* arena) {
1927
1959
  upb_Message_Internal* in = upb_Message_Getinternal(msg);
1928
1960
  if (!in->internal) {
1929
1961
  /* No internal data, allocate from scratch. */
1930
- size_t size = UPB_MAX(128, _upb_Log2Ceilingsize(need + overhead));
1962
+ size_t size = UPB_MAX(128, _upb_Log2CeilingSize(need + overhead));
1931
1963
  upb_Message_InternalData* internal = upb_Arena_Malloc(arena, size);
1932
1964
  if (!internal) return false;
1933
1965
  internal->size = size;
@@ -1936,7 +1968,7 @@ static bool realloc_internal(upb_Message* msg, size_t need, upb_Arena* arena) {
1936
1968
  in->internal = internal;
1937
1969
  } else if (in->internal->ext_begin - in->internal->unknown_end < need) {
1938
1970
  /* Internal data is too small, reallocate. */
1939
- size_t new_size = _upb_Log2Ceilingsize(in->internal->size + need);
1971
+ size_t new_size = _upb_Log2CeilingSize(in->internal->size + need);
1940
1972
  size_t ext_bytes = in->internal->size - in->internal->ext_begin;
1941
1973
  size_t new_ext_begin = new_size - ext_bytes;
1942
1974
  upb_Message_InternalData* internal =
@@ -2182,7 +2214,7 @@ bool _upb_mapsorter_pushmap(_upb_mapsorter* s, upb_FieldType key_type,
2182
2214
 
2183
2215
  /* Grow s->entries if necessary. */
2184
2216
  if (sorted->end > s->cap) {
2185
- s->cap = _upb_Log2Ceilingsize(sorted->end);
2217
+ s->cap = _upb_Log2CeilingSize(sorted->end);
2186
2218
  s->entries = realloc(s->entries, s->cap * sizeof(*s->entries));
2187
2219
  if (!s->entries) return false;
2188
2220
  }
@@ -2624,7 +2656,7 @@ static uint64_t WyhashMix(uint64_t v0, uint64_t v1) {
2624
2656
  return low ^ high;
2625
2657
  }
2626
2658
 
2627
- uint64_t Wyhash(const void* data, size_t len, uint64_t seed,
2659
+ static uint64_t Wyhash(const void* data, size_t len, uint64_t seed,
2628
2660
  const uint64_t salt[]) {
2629
2661
  const uint8_t* ptr = (const uint8_t*)data;
2630
2662
  uint64_t starting_length = (uint64_t)len;
@@ -2708,14 +2740,18 @@ const uint64_t kWyhashSalt[5] = {
2708
2740
  0x082EFA98EC4E6C89ULL, 0x452821E638D01377ULL,
2709
2741
  };
2710
2742
 
2711
- static uint32_t table_hash(const char* p, size_t n) {
2712
- return Wyhash(p, n, 0, kWyhashSalt);
2743
+ uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed) {
2744
+ return Wyhash(p, n, seed, kWyhashSalt);
2745
+ }
2746
+
2747
+ static uint32_t _upb_Hash_NoSeed(const char* p, size_t n) {
2748
+ return _upb_Hash(p, n, 0);
2713
2749
  }
2714
2750
 
2715
2751
  static uint32_t strhash(upb_tabkey key) {
2716
2752
  uint32_t len;
2717
2753
  char* str = upb_tabstr(key, &len);
2718
- return table_hash(str, len);
2754
+ return _upb_Hash_NoSeed(str, len);
2719
2755
  }
2720
2756
 
2721
2757
  static bool streql(upb_tabkey k1, lookupkey_t k2) {
@@ -2771,20 +2807,20 @@ bool upb_strtable_insert(upb_strtable* t, const char* k, size_t len,
2771
2807
  tabkey = strcopy(key, a);
2772
2808
  if (tabkey == 0) return false;
2773
2809
 
2774
- hash = table_hash(key.str.str, key.str.len);
2810
+ hash = _upb_Hash_NoSeed(key.str.str, key.str.len);
2775
2811
  insert(&t->t, key, tabkey, v, hash, &strhash, &streql);
2776
2812
  return true;
2777
2813
  }
2778
2814
 
2779
2815
  bool upb_strtable_lookup2(const upb_strtable* t, const char* key, size_t len,
2780
2816
  upb_value* v) {
2781
- uint32_t hash = table_hash(key, len);
2817
+ uint32_t hash = _upb_Hash_NoSeed(key, len);
2782
2818
  return lookup(&t->t, strkey2(key, len), v, hash, &streql);
2783
2819
  }
2784
2820
 
2785
2821
  bool upb_strtable_remove2(upb_strtable* t, const char* key, size_t len,
2786
2822
  upb_value* val) {
2787
- uint32_t hash = table_hash(key, len);
2823
+ uint32_t hash = _upb_Hash_NoSeed(key, len);
2788
2824
  upb_tabkey tabkey;
2789
2825
  return rm(&t->t, strkey2(key, len), val, &tabkey, hash, &streql);
2790
2826
  }
@@ -3511,7 +3547,6 @@ static void upb_FixLocale(char* p) {
3511
3547
  }
3512
3548
  }
3513
3549
 
3514
-
3515
3550
  void _upb_EncodeRoundTripDouble(double val, char* buf, size_t size) {
3516
3551
  assert(size >= kUpb_RoundTripBufferSize);
3517
3552
  snprintf(buf, size, "%.*g", DBL_DIG, val);
@@ -4575,13 +4610,13 @@ static const upb_MiniTable_Sub google_protobuf_FileDescriptorSet_submsgs[1] = {
4575
4610
  };
4576
4611
 
4577
4612
  static const upb_MiniTable_Field google_protobuf_FileDescriptorSet__fields[1] = {
4578
- {1, UPB_SIZE(0, 0), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4613
+ {1, UPB_SIZE(0, 0), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4579
4614
  };
4580
4615
 
4581
4616
  const upb_MiniTable google_protobuf_FileDescriptorSet_msginit = {
4582
4617
  &google_protobuf_FileDescriptorSet_submsgs[0],
4583
4618
  &google_protobuf_FileDescriptorSet__fields[0],
4584
- UPB_SIZE(8, 8), 1, upb_ExtMode_NonExtendable, 1, 255, 0,
4619
+ UPB_SIZE(8, 8), 1, kUpb_ExtMode_NonExtendable, 1, 255, 0,
4585
4620
  };
4586
4621
 
4587
4622
  static const upb_MiniTable_Sub google_protobuf_FileDescriptorProto_submsgs[6] = {
@@ -4594,24 +4629,24 @@ static const upb_MiniTable_Sub google_protobuf_FileDescriptorProto_submsgs[6] =
4594
4629
  };
4595
4630
 
4596
4631
  static const upb_MiniTable_Field google_protobuf_FileDescriptorProto__fields[12] = {
4597
- {1, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4598
- {2, UPB_SIZE(12, 24), 2, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4599
- {3, UPB_SIZE(36, 72), 0, 0, 12, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4600
- {4, UPB_SIZE(40, 80), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4601
- {5, UPB_SIZE(44, 88), 0, 1, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4602
- {6, UPB_SIZE(48, 96), 0, 4, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4603
- {7, UPB_SIZE(52, 104), 0, 2, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4604
- {8, UPB_SIZE(28, 56), 3, 3, 11, kUpb_FieldMode_Scalar | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4605
- {9, UPB_SIZE(32, 64), 4, 5, 11, kUpb_FieldMode_Scalar | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4606
- {10, UPB_SIZE(56, 112), 0, 0, 5, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4607
- {11, UPB_SIZE(60, 120), 0, 0, 5, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4608
- {12, UPB_SIZE(20, 40), 5, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4632
+ {1, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4633
+ {2, UPB_SIZE(12, 24), 2, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4634
+ {3, UPB_SIZE(36, 72), 0, 0, 12, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4635
+ {4, UPB_SIZE(40, 80), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4636
+ {5, UPB_SIZE(44, 88), 0, 1, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4637
+ {6, UPB_SIZE(48, 96), 0, 4, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4638
+ {7, UPB_SIZE(52, 104), 0, 2, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4639
+ {8, UPB_SIZE(28, 56), 3, 3, 11, kUpb_FieldMode_Scalar | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4640
+ {9, UPB_SIZE(32, 64), 4, 5, 11, kUpb_FieldMode_Scalar | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4641
+ {10, UPB_SIZE(56, 112), 0, 0, 5, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4642
+ {11, UPB_SIZE(60, 120), 0, 0, 5, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4643
+ {12, UPB_SIZE(20, 40), 5, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4609
4644
  };
4610
4645
 
4611
4646
  const upb_MiniTable google_protobuf_FileDescriptorProto_msginit = {
4612
4647
  &google_protobuf_FileDescriptorProto_submsgs[0],
4613
4648
  &google_protobuf_FileDescriptorProto__fields[0],
4614
- UPB_SIZE(64, 128), 12, upb_ExtMode_NonExtendable, 12, 255, 0,
4649
+ UPB_SIZE(64, 128), 12, kUpb_ExtMode_NonExtendable, 12, 255, 0,
4615
4650
  };
4616
4651
 
4617
4652
  static const upb_MiniTable_Sub google_protobuf_DescriptorProto_submsgs[7] = {
@@ -4625,22 +4660,22 @@ static const upb_MiniTable_Sub google_protobuf_DescriptorProto_submsgs[7] = {
4625
4660
  };
4626
4661
 
4627
4662
  static const upb_MiniTable_Field google_protobuf_DescriptorProto__fields[10] = {
4628
- {1, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4629
- {2, UPB_SIZE(16, 32), 0, 4, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4630
- {3, UPB_SIZE(20, 40), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4631
- {4, UPB_SIZE(24, 48), 0, 3, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4632
- {5, UPB_SIZE(28, 56), 0, 1, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4633
- {6, UPB_SIZE(32, 64), 0, 4, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4634
- {7, UPB_SIZE(12, 24), 2, 5, 11, kUpb_FieldMode_Scalar | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4635
- {8, UPB_SIZE(36, 72), 0, 6, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4636
- {9, UPB_SIZE(40, 80), 0, 2, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4637
- {10, UPB_SIZE(44, 88), 0, 0, 12, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4663
+ {1, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4664
+ {2, UPB_SIZE(16, 32), 0, 4, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4665
+ {3, UPB_SIZE(20, 40), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4666
+ {4, UPB_SIZE(24, 48), 0, 3, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4667
+ {5, UPB_SIZE(28, 56), 0, 1, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4668
+ {6, UPB_SIZE(32, 64), 0, 4, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4669
+ {7, UPB_SIZE(12, 24), 2, 5, 11, kUpb_FieldMode_Scalar | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4670
+ {8, UPB_SIZE(36, 72), 0, 6, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4671
+ {9, UPB_SIZE(40, 80), 0, 2, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4672
+ {10, UPB_SIZE(44, 88), 0, 0, 12, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4638
4673
  };
4639
4674
 
4640
4675
  const upb_MiniTable google_protobuf_DescriptorProto_msginit = {
4641
4676
  &google_protobuf_DescriptorProto_submsgs[0],
4642
4677
  &google_protobuf_DescriptorProto__fields[0],
4643
- UPB_SIZE(48, 96), 10, upb_ExtMode_NonExtendable, 10, 255, 0,
4678
+ UPB_SIZE(48, 96), 10, kUpb_ExtMode_NonExtendable, 10, 255, 0,
4644
4679
  };
4645
4680
 
4646
4681
  static const upb_MiniTable_Sub google_protobuf_DescriptorProto_ExtensionRange_submsgs[1] = {
@@ -4648,26 +4683,26 @@ static const upb_MiniTable_Sub google_protobuf_DescriptorProto_ExtensionRange_su
4648
4683
  };
4649
4684
 
4650
4685
  static const upb_MiniTable_Field google_protobuf_DescriptorProto_ExtensionRange__fields[3] = {
4651
- {1, UPB_SIZE(4, 4), 1, 0, 5, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4652
- {2, UPB_SIZE(8, 8), 2, 0, 5, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4653
- {3, UPB_SIZE(12, 16), 3, 0, 11, kUpb_FieldMode_Scalar | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4686
+ {1, UPB_SIZE(4, 4), 1, 0, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4687
+ {2, UPB_SIZE(8, 8), 2, 0, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4688
+ {3, UPB_SIZE(12, 16), 3, 0, 11, kUpb_FieldMode_Scalar | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4654
4689
  };
4655
4690
 
4656
4691
  const upb_MiniTable google_protobuf_DescriptorProto_ExtensionRange_msginit = {
4657
4692
  &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0],
4658
4693
  &google_protobuf_DescriptorProto_ExtensionRange__fields[0],
4659
- UPB_SIZE(16, 24), 3, upb_ExtMode_NonExtendable, 3, 255, 0,
4694
+ UPB_SIZE(16, 24), 3, kUpb_ExtMode_NonExtendable, 3, 255, 0,
4660
4695
  };
4661
4696
 
4662
4697
  static const upb_MiniTable_Field google_protobuf_DescriptorProto_ReservedRange__fields[2] = {
4663
- {1, UPB_SIZE(4, 4), 1, 0, 5, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4664
- {2, UPB_SIZE(8, 8), 2, 0, 5, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4698
+ {1, UPB_SIZE(4, 4), 1, 0, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4699
+ {2, UPB_SIZE(8, 8), 2, 0, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4665
4700
  };
4666
4701
 
4667
4702
  const upb_MiniTable google_protobuf_DescriptorProto_ReservedRange_msginit = {
4668
4703
  NULL,
4669
4704
  &google_protobuf_DescriptorProto_ReservedRange__fields[0],
4670
- UPB_SIZE(16, 16), 2, upb_ExtMode_NonExtendable, 2, 255, 0,
4705
+ UPB_SIZE(16, 16), 2, kUpb_ExtMode_NonExtendable, 2, 255, 0,
4671
4706
  };
4672
4707
 
4673
4708
  static const upb_MiniTable_Sub google_protobuf_ExtensionRangeOptions_submsgs[1] = {
@@ -4675,13 +4710,13 @@ static const upb_MiniTable_Sub google_protobuf_ExtensionRangeOptions_submsgs[1]
4675
4710
  };
4676
4711
 
4677
4712
  static const upb_MiniTable_Field google_protobuf_ExtensionRangeOptions__fields[1] = {
4678
- {999, UPB_SIZE(0, 0), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4713
+ {999, UPB_SIZE(0, 0), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4679
4714
  };
4680
4715
 
4681
4716
  const upb_MiniTable google_protobuf_ExtensionRangeOptions_msginit = {
4682
4717
  &google_protobuf_ExtensionRangeOptions_submsgs[0],
4683
4718
  &google_protobuf_ExtensionRangeOptions__fields[0],
4684
- UPB_SIZE(8, 8), 1, upb_ExtMode_Extendable, 0, 255, 0,
4719
+ UPB_SIZE(8, 8), 1, kUpb_ExtMode_Extendable, 0, 255, 0,
4685
4720
  };
4686
4721
 
4687
4722
  static const upb_MiniTable_Sub google_protobuf_FieldDescriptorProto_submsgs[3] = {
@@ -4691,23 +4726,23 @@ static const upb_MiniTable_Sub google_protobuf_FieldDescriptorProto_submsgs[3] =
4691
4726
  };
4692
4727
 
4693
4728
  static const upb_MiniTable_Field google_protobuf_FieldDescriptorProto__fields[11] = {
4694
- {1, UPB_SIZE(24, 24), 1, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4695
- {2, UPB_SIZE(32, 40), 2, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4696
- {3, UPB_SIZE(12, 12), 3, 0, 5, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4697
- {4, UPB_SIZE(4, 4), 4, 1, 14, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4698
- {5, UPB_SIZE(8, 8), 5, 2, 14, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4699
- {6, UPB_SIZE(40, 56), 6, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4700
- {7, UPB_SIZE(48, 72), 7, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4701
- {8, UPB_SIZE(64, 104), 8, 0, 11, kUpb_FieldMode_Scalar | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4702
- {9, UPB_SIZE(16, 16), 9, 0, 5, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4703
- {10, UPB_SIZE(56, 88), 10, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4704
- {17, UPB_SIZE(20, 20), 11, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4729
+ {1, UPB_SIZE(24, 24), 1, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4730
+ {2, UPB_SIZE(32, 40), 2, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4731
+ {3, UPB_SIZE(12, 12), 3, 0, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4732
+ {4, UPB_SIZE(4, 4), 4, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4733
+ {5, UPB_SIZE(8, 8), 5, 2, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4734
+ {6, UPB_SIZE(40, 56), 6, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4735
+ {7, UPB_SIZE(48, 72), 7, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4736
+ {8, UPB_SIZE(64, 104), 8, 0, 11, kUpb_FieldMode_Scalar | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4737
+ {9, UPB_SIZE(16, 16), 9, 0, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4738
+ {10, UPB_SIZE(56, 88), 10, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4739
+ {17, UPB_SIZE(20, 20), 11, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4705
4740
  };
4706
4741
 
4707
4742
  const upb_MiniTable google_protobuf_FieldDescriptorProto_msginit = {
4708
4743
  &google_protobuf_FieldDescriptorProto_submsgs[0],
4709
4744
  &google_protobuf_FieldDescriptorProto__fields[0],
4710
- UPB_SIZE(72, 112), 11, upb_ExtMode_NonExtendable, 10, 255, 0,
4745
+ UPB_SIZE(72, 112), 11, kUpb_ExtMode_NonExtendable, 10, 255, 0,
4711
4746
  };
4712
4747
 
4713
4748
  static const upb_MiniTable_Sub google_protobuf_OneofDescriptorProto_submsgs[1] = {
@@ -4715,14 +4750,14 @@ static const upb_MiniTable_Sub google_protobuf_OneofDescriptorProto_submsgs[1] =
4715
4750
  };
4716
4751
 
4717
4752
  static const upb_MiniTable_Field google_protobuf_OneofDescriptorProto__fields[2] = {
4718
- {1, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4719
- {2, UPB_SIZE(12, 24), 2, 0, 11, kUpb_FieldMode_Scalar | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4753
+ {1, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4754
+ {2, UPB_SIZE(12, 24), 2, 0, 11, kUpb_FieldMode_Scalar | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4720
4755
  };
4721
4756
 
4722
4757
  const upb_MiniTable google_protobuf_OneofDescriptorProto_msginit = {
4723
4758
  &google_protobuf_OneofDescriptorProto_submsgs[0],
4724
4759
  &google_protobuf_OneofDescriptorProto__fields[0],
4725
- UPB_SIZE(16, 32), 2, upb_ExtMode_NonExtendable, 2, 255, 0,
4760
+ UPB_SIZE(16, 32), 2, kUpb_ExtMode_NonExtendable, 2, 255, 0,
4726
4761
  };
4727
4762
 
4728
4763
  static const upb_MiniTable_Sub google_protobuf_EnumDescriptorProto_submsgs[3] = {
@@ -4732,28 +4767,28 @@ static const upb_MiniTable_Sub google_protobuf_EnumDescriptorProto_submsgs[3] =
4732
4767
  };
4733
4768
 
4734
4769
  static const upb_MiniTable_Field google_protobuf_EnumDescriptorProto__fields[5] = {
4735
- {1, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4736
- {2, UPB_SIZE(16, 32), 0, 2, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4737
- {3, UPB_SIZE(12, 24), 2, 1, 11, kUpb_FieldMode_Scalar | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4738
- {4, UPB_SIZE(20, 40), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4739
- {5, UPB_SIZE(24, 48), 0, 0, 12, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4770
+ {1, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4771
+ {2, UPB_SIZE(16, 32), 0, 2, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4772
+ {3, UPB_SIZE(12, 24), 2, 1, 11, kUpb_FieldMode_Scalar | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4773
+ {4, UPB_SIZE(20, 40), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4774
+ {5, UPB_SIZE(24, 48), 0, 0, 12, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4740
4775
  };
4741
4776
 
4742
4777
  const upb_MiniTable google_protobuf_EnumDescriptorProto_msginit = {
4743
4778
  &google_protobuf_EnumDescriptorProto_submsgs[0],
4744
4779
  &google_protobuf_EnumDescriptorProto__fields[0],
4745
- UPB_SIZE(32, 64), 5, upb_ExtMode_NonExtendable, 5, 255, 0,
4780
+ UPB_SIZE(32, 64), 5, kUpb_ExtMode_NonExtendable, 5, 255, 0,
4746
4781
  };
4747
4782
 
4748
4783
  static const upb_MiniTable_Field google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[2] = {
4749
- {1, UPB_SIZE(4, 4), 1, 0, 5, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4750
- {2, UPB_SIZE(8, 8), 2, 0, 5, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4784
+ {1, UPB_SIZE(4, 4), 1, 0, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4785
+ {2, UPB_SIZE(8, 8), 2, 0, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4751
4786
  };
4752
4787
 
4753
4788
  const upb_MiniTable google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = {
4754
4789
  NULL,
4755
4790
  &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0],
4756
- UPB_SIZE(16, 16), 2, upb_ExtMode_NonExtendable, 2, 255, 0,
4791
+ UPB_SIZE(16, 16), 2, kUpb_ExtMode_NonExtendable, 2, 255, 0,
4757
4792
  };
4758
4793
 
4759
4794
  static const upb_MiniTable_Sub google_protobuf_EnumValueDescriptorProto_submsgs[1] = {
@@ -4761,15 +4796,15 @@ static const upb_MiniTable_Sub google_protobuf_EnumValueDescriptorProto_submsgs[
4761
4796
  };
4762
4797
 
4763
4798
  static const upb_MiniTable_Field google_protobuf_EnumValueDescriptorProto__fields[3] = {
4764
- {1, UPB_SIZE(8, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4765
- {2, UPB_SIZE(4, 4), 2, 0, 5, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4766
- {3, UPB_SIZE(16, 24), 3, 0, 11, kUpb_FieldMode_Scalar | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4799
+ {1, UPB_SIZE(8, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4800
+ {2, UPB_SIZE(4, 4), 2, 0, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4801
+ {3, UPB_SIZE(16, 24), 3, 0, 11, kUpb_FieldMode_Scalar | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4767
4802
  };
4768
4803
 
4769
4804
  const upb_MiniTable google_protobuf_EnumValueDescriptorProto_msginit = {
4770
4805
  &google_protobuf_EnumValueDescriptorProto_submsgs[0],
4771
4806
  &google_protobuf_EnumValueDescriptorProto__fields[0],
4772
- UPB_SIZE(24, 32), 3, upb_ExtMode_NonExtendable, 3, 255, 0,
4807
+ UPB_SIZE(24, 32), 3, kUpb_ExtMode_NonExtendable, 3, 255, 0,
4773
4808
  };
4774
4809
 
4775
4810
  static const upb_MiniTable_Sub google_protobuf_ServiceDescriptorProto_submsgs[2] = {
@@ -4778,15 +4813,15 @@ static const upb_MiniTable_Sub google_protobuf_ServiceDescriptorProto_submsgs[2]
4778
4813
  };
4779
4814
 
4780
4815
  static const upb_MiniTable_Field google_protobuf_ServiceDescriptorProto__fields[3] = {
4781
- {1, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4782
- {2, UPB_SIZE(16, 32), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4783
- {3, UPB_SIZE(12, 24), 2, 1, 11, kUpb_FieldMode_Scalar | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4816
+ {1, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4817
+ {2, UPB_SIZE(16, 32), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4818
+ {3, UPB_SIZE(12, 24), 2, 1, 11, kUpb_FieldMode_Scalar | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4784
4819
  };
4785
4820
 
4786
4821
  const upb_MiniTable google_protobuf_ServiceDescriptorProto_msginit = {
4787
4822
  &google_protobuf_ServiceDescriptorProto_submsgs[0],
4788
4823
  &google_protobuf_ServiceDescriptorProto__fields[0],
4789
- UPB_SIZE(24, 48), 3, upb_ExtMode_NonExtendable, 3, 255, 0,
4824
+ UPB_SIZE(24, 48), 3, kUpb_ExtMode_NonExtendable, 3, 255, 0,
4790
4825
  };
4791
4826
 
4792
4827
  static const upb_MiniTable_Sub google_protobuf_MethodDescriptorProto_submsgs[1] = {
@@ -4794,18 +4829,18 @@ static const upb_MiniTable_Sub google_protobuf_MethodDescriptorProto_submsgs[1]
4794
4829
  };
4795
4830
 
4796
4831
  static const upb_MiniTable_Field google_protobuf_MethodDescriptorProto__fields[6] = {
4797
- {1, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4798
- {2, UPB_SIZE(12, 24), 2, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4799
- {3, UPB_SIZE(20, 40), 3, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4800
- {4, UPB_SIZE(28, 56), 4, 0, 11, kUpb_FieldMode_Scalar | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4801
- {5, UPB_SIZE(1, 1), 5, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4802
- {6, UPB_SIZE(2, 2), 6, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4832
+ {1, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4833
+ {2, UPB_SIZE(12, 24), 2, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4834
+ {3, UPB_SIZE(20, 40), 3, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4835
+ {4, UPB_SIZE(28, 56), 4, 0, 11, kUpb_FieldMode_Scalar | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4836
+ {5, UPB_SIZE(1, 1), 5, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4837
+ {6, UPB_SIZE(2, 2), 6, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4803
4838
  };
4804
4839
 
4805
4840
  const upb_MiniTable google_protobuf_MethodDescriptorProto_msginit = {
4806
4841
  &google_protobuf_MethodDescriptorProto_submsgs[0],
4807
4842
  &google_protobuf_MethodDescriptorProto__fields[0],
4808
- UPB_SIZE(32, 64), 6, upb_ExtMode_NonExtendable, 6, 255, 0,
4843
+ UPB_SIZE(32, 64), 6, kUpb_ExtMode_NonExtendable, 6, 255, 0,
4809
4844
  };
4810
4845
 
4811
4846
  static const upb_MiniTable_Sub google_protobuf_FileOptions_submsgs[2] = {
@@ -4814,33 +4849,33 @@ static const upb_MiniTable_Sub google_protobuf_FileOptions_submsgs[2] = {
4814
4849
  };
4815
4850
 
4816
4851
  static const upb_MiniTable_Field google_protobuf_FileOptions__fields[21] = {
4817
- {1, UPB_SIZE(20, 24), 1, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4818
- {8, UPB_SIZE(28, 40), 2, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4819
- {9, UPB_SIZE(4, 4), 3, 1, 14, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4820
- {10, UPB_SIZE(8, 8), 4, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4821
- {11, UPB_SIZE(36, 56), 5, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4822
- {16, UPB_SIZE(9, 9), 6, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4823
- {17, UPB_SIZE(10, 10), 7, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4824
- {18, UPB_SIZE(11, 11), 8, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4825
- {20, UPB_SIZE(12, 12), 9, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4826
- {23, UPB_SIZE(13, 13), 10, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4827
- {27, UPB_SIZE(14, 14), 11, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4828
- {31, UPB_SIZE(15, 15), 12, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4829
- {36, UPB_SIZE(44, 72), 13, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4830
- {37, UPB_SIZE(52, 88), 14, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4831
- {39, UPB_SIZE(60, 104), 15, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4832
- {40, UPB_SIZE(68, 120), 16, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4833
- {41, UPB_SIZE(76, 136), 17, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4834
- {42, UPB_SIZE(16, 16), 18, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4835
- {44, UPB_SIZE(84, 152), 19, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4836
- {45, UPB_SIZE(92, 168), 20, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4837
- {999, UPB_SIZE(100, 184), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4852
+ {1, UPB_SIZE(20, 24), 1, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4853
+ {8, UPB_SIZE(28, 40), 2, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4854
+ {9, UPB_SIZE(4, 4), 3, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4855
+ {10, UPB_SIZE(8, 8), 4, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4856
+ {11, UPB_SIZE(36, 56), 5, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4857
+ {16, UPB_SIZE(9, 9), 6, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4858
+ {17, UPB_SIZE(10, 10), 7, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4859
+ {18, UPB_SIZE(11, 11), 8, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4860
+ {20, UPB_SIZE(12, 12), 9, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4861
+ {23, UPB_SIZE(13, 13), 10, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4862
+ {27, UPB_SIZE(14, 14), 11, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4863
+ {31, UPB_SIZE(15, 15), 12, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4864
+ {36, UPB_SIZE(44, 72), 13, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4865
+ {37, UPB_SIZE(52, 88), 14, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4866
+ {39, UPB_SIZE(60, 104), 15, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4867
+ {40, UPB_SIZE(68, 120), 16, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4868
+ {41, UPB_SIZE(76, 136), 17, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4869
+ {42, UPB_SIZE(16, 16), 18, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4870
+ {44, UPB_SIZE(84, 152), 19, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4871
+ {45, UPB_SIZE(92, 168), 20, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4872
+ {999, UPB_SIZE(100, 184), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4838
4873
  };
4839
4874
 
4840
4875
  const upb_MiniTable google_protobuf_FileOptions_msginit = {
4841
4876
  &google_protobuf_FileOptions_submsgs[0],
4842
4877
  &google_protobuf_FileOptions__fields[0],
4843
- UPB_SIZE(104, 192), 21, upb_ExtMode_Extendable, 1, 255, 0,
4878
+ UPB_SIZE(104, 192), 21, kUpb_ExtMode_Extendable, 1, 255, 0,
4844
4879
  };
4845
4880
 
4846
4881
  static const upb_MiniTable_Sub google_protobuf_MessageOptions_submsgs[1] = {
@@ -4848,17 +4883,17 @@ static const upb_MiniTable_Sub google_protobuf_MessageOptions_submsgs[1] = {
4848
4883
  };
4849
4884
 
4850
4885
  static const upb_MiniTable_Field google_protobuf_MessageOptions__fields[5] = {
4851
- {1, UPB_SIZE(1, 1), 1, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4852
- {2, UPB_SIZE(2, 2), 2, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4853
- {3, UPB_SIZE(3, 3), 3, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4854
- {7, UPB_SIZE(4, 4), 4, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4855
- {999, UPB_SIZE(8, 8), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4886
+ {1, UPB_SIZE(1, 1), 1, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4887
+ {2, UPB_SIZE(2, 2), 2, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4888
+ {3, UPB_SIZE(3, 3), 3, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4889
+ {7, UPB_SIZE(4, 4), 4, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4890
+ {999, UPB_SIZE(8, 8), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4856
4891
  };
4857
4892
 
4858
4893
  const upb_MiniTable google_protobuf_MessageOptions_msginit = {
4859
4894
  &google_protobuf_MessageOptions_submsgs[0],
4860
4895
  &google_protobuf_MessageOptions__fields[0],
4861
- UPB_SIZE(16, 16), 5, upb_ExtMode_Extendable, 3, 255, 0,
4896
+ UPB_SIZE(16, 16), 5, kUpb_ExtMode_Extendable, 3, 255, 0,
4862
4897
  };
4863
4898
 
4864
4899
  static const upb_MiniTable_Sub google_protobuf_FieldOptions_submsgs[3] = {
@@ -4867,20 +4902,21 @@ static const upb_MiniTable_Sub google_protobuf_FieldOptions_submsgs[3] = {
4867
4902
  {.subenum = &google_protobuf_FieldOptions_JSType_enuminit},
4868
4903
  };
4869
4904
 
4870
- static const upb_MiniTable_Field google_protobuf_FieldOptions__fields[7] = {
4871
- {1, UPB_SIZE(4, 4), 1, 1, 14, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4872
- {2, UPB_SIZE(12, 12), 2, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4873
- {3, UPB_SIZE(13, 13), 3, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4874
- {5, UPB_SIZE(14, 14), 4, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4875
- {6, UPB_SIZE(8, 8), 5, 2, 14, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4876
- {10, UPB_SIZE(15, 15), 6, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4877
- {999, UPB_SIZE(16, 16), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4905
+ static const upb_MiniTable_Field google_protobuf_FieldOptions__fields[8] = {
4906
+ {1, UPB_SIZE(4, 4), 1, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4907
+ {2, UPB_SIZE(12, 12), 2, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4908
+ {3, UPB_SIZE(13, 13), 3, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4909
+ {5, UPB_SIZE(14, 14), 4, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4910
+ {6, UPB_SIZE(8, 8), 5, 2, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4911
+ {10, UPB_SIZE(15, 15), 6, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4912
+ {15, UPB_SIZE(16, 16), 7, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4913
+ {999, UPB_SIZE(20, 24), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4878
4914
  };
4879
4915
 
4880
4916
  const upb_MiniTable google_protobuf_FieldOptions_msginit = {
4881
4917
  &google_protobuf_FieldOptions_submsgs[0],
4882
4918
  &google_protobuf_FieldOptions__fields[0],
4883
- UPB_SIZE(24, 24), 7, upb_ExtMode_Extendable, 3, 255, 0,
4919
+ UPB_SIZE(24, 32), 8, kUpb_ExtMode_Extendable, 3, 255, 0,
4884
4920
  };
4885
4921
 
4886
4922
  static const upb_MiniTable_Sub google_protobuf_OneofOptions_submsgs[1] = {
@@ -4888,13 +4924,13 @@ static const upb_MiniTable_Sub google_protobuf_OneofOptions_submsgs[1] = {
4888
4924
  };
4889
4925
 
4890
4926
  static const upb_MiniTable_Field google_protobuf_OneofOptions__fields[1] = {
4891
- {999, UPB_SIZE(0, 0), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4927
+ {999, UPB_SIZE(0, 0), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4892
4928
  };
4893
4929
 
4894
4930
  const upb_MiniTable google_protobuf_OneofOptions_msginit = {
4895
4931
  &google_protobuf_OneofOptions_submsgs[0],
4896
4932
  &google_protobuf_OneofOptions__fields[0],
4897
- UPB_SIZE(8, 8), 1, upb_ExtMode_Extendable, 0, 255, 0,
4933
+ UPB_SIZE(8, 8), 1, kUpb_ExtMode_Extendable, 0, 255, 0,
4898
4934
  };
4899
4935
 
4900
4936
  static const upb_MiniTable_Sub google_protobuf_EnumOptions_submsgs[1] = {
@@ -4902,15 +4938,15 @@ static const upb_MiniTable_Sub google_protobuf_EnumOptions_submsgs[1] = {
4902
4938
  };
4903
4939
 
4904
4940
  static const upb_MiniTable_Field google_protobuf_EnumOptions__fields[3] = {
4905
- {2, UPB_SIZE(1, 1), 1, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4906
- {3, UPB_SIZE(2, 2), 2, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4907
- {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4941
+ {2, UPB_SIZE(1, 1), 1, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4942
+ {3, UPB_SIZE(2, 2), 2, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4943
+ {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4908
4944
  };
4909
4945
 
4910
4946
  const upb_MiniTable google_protobuf_EnumOptions_msginit = {
4911
4947
  &google_protobuf_EnumOptions_submsgs[0],
4912
4948
  &google_protobuf_EnumOptions__fields[0],
4913
- UPB_SIZE(8, 16), 3, upb_ExtMode_Extendable, 0, 255, 0,
4949
+ UPB_SIZE(8, 16), 3, kUpb_ExtMode_Extendable, 0, 255, 0,
4914
4950
  };
4915
4951
 
4916
4952
  static const upb_MiniTable_Sub google_protobuf_EnumValueOptions_submsgs[1] = {
@@ -4918,14 +4954,14 @@ static const upb_MiniTable_Sub google_protobuf_EnumValueOptions_submsgs[1] = {
4918
4954
  };
4919
4955
 
4920
4956
  static const upb_MiniTable_Field google_protobuf_EnumValueOptions__fields[2] = {
4921
- {1, UPB_SIZE(1, 1), 1, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4922
- {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4957
+ {1, UPB_SIZE(1, 1), 1, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4958
+ {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4923
4959
  };
4924
4960
 
4925
4961
  const upb_MiniTable google_protobuf_EnumValueOptions_msginit = {
4926
4962
  &google_protobuf_EnumValueOptions_submsgs[0],
4927
4963
  &google_protobuf_EnumValueOptions__fields[0],
4928
- UPB_SIZE(8, 16), 2, upb_ExtMode_Extendable, 1, 255, 0,
4964
+ UPB_SIZE(8, 16), 2, kUpb_ExtMode_Extendable, 1, 255, 0,
4929
4965
  };
4930
4966
 
4931
4967
  static const upb_MiniTable_Sub google_protobuf_ServiceOptions_submsgs[1] = {
@@ -4933,14 +4969,14 @@ static const upb_MiniTable_Sub google_protobuf_ServiceOptions_submsgs[1] = {
4933
4969
  };
4934
4970
 
4935
4971
  static const upb_MiniTable_Field google_protobuf_ServiceOptions__fields[2] = {
4936
- {33, UPB_SIZE(1, 1), 1, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4937
- {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4972
+ {33, UPB_SIZE(1, 1), 1, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4973
+ {999, UPB_SIZE(4, 8), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4938
4974
  };
4939
4975
 
4940
4976
  const upb_MiniTable google_protobuf_ServiceOptions_msginit = {
4941
4977
  &google_protobuf_ServiceOptions_submsgs[0],
4942
4978
  &google_protobuf_ServiceOptions__fields[0],
4943
- UPB_SIZE(8, 16), 2, upb_ExtMode_Extendable, 0, 255, 0,
4979
+ UPB_SIZE(8, 16), 2, kUpb_ExtMode_Extendable, 0, 255, 0,
4944
4980
  };
4945
4981
 
4946
4982
  static const upb_MiniTable_Sub google_protobuf_MethodOptions_submsgs[2] = {
@@ -4949,15 +4985,15 @@ static const upb_MiniTable_Sub google_protobuf_MethodOptions_submsgs[2] = {
4949
4985
  };
4950
4986
 
4951
4987
  static const upb_MiniTable_Field google_protobuf_MethodOptions__fields[3] = {
4952
- {33, UPB_SIZE(8, 8), 1, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
4953
- {34, UPB_SIZE(4, 4), 2, 1, 14, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
4954
- {999, UPB_SIZE(12, 16), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4988
+ {33, UPB_SIZE(8, 8), 1, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4989
+ {34, UPB_SIZE(4, 4), 2, 1, 14, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
4990
+ {999, UPB_SIZE(12, 16), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
4955
4991
  };
4956
4992
 
4957
4993
  const upb_MiniTable google_protobuf_MethodOptions_msginit = {
4958
4994
  &google_protobuf_MethodOptions_submsgs[0],
4959
4995
  &google_protobuf_MethodOptions__fields[0],
4960
- UPB_SIZE(16, 24), 3, upb_ExtMode_Extendable, 0, 255, 0,
4996
+ UPB_SIZE(16, 24), 3, kUpb_ExtMode_Extendable, 0, 255, 0,
4961
4997
  };
4962
4998
 
4963
4999
  static const upb_MiniTable_Sub google_protobuf_UninterpretedOption_submsgs[1] = {
@@ -4965,30 +5001,30 @@ static const upb_MiniTable_Sub google_protobuf_UninterpretedOption_submsgs[1] =
4965
5001
  };
4966
5002
 
4967
5003
  static const upb_MiniTable_Field google_protobuf_UninterpretedOption__fields[7] = {
4968
- {2, UPB_SIZE(56, 80), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
4969
- {3, UPB_SIZE(32, 32), 1, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4970
- {4, UPB_SIZE(8, 8), 2, 0, 4, kUpb_FieldMode_Scalar | (upb_FieldRep_8Byte << upb_FieldRep_Shift)},
4971
- {5, UPB_SIZE(16, 16), 3, 0, 3, kUpb_FieldMode_Scalar | (upb_FieldRep_8Byte << upb_FieldRep_Shift)},
4972
- {6, UPB_SIZE(24, 24), 4, 0, 1, kUpb_FieldMode_Scalar | (upb_FieldRep_8Byte << upb_FieldRep_Shift)},
4973
- {7, UPB_SIZE(40, 48), 5, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4974
- {8, UPB_SIZE(48, 64), 6, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
5004
+ {2, UPB_SIZE(56, 80), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
5005
+ {3, UPB_SIZE(32, 32), 1, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
5006
+ {4, UPB_SIZE(8, 8), 2, 0, 4, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)},
5007
+ {5, UPB_SIZE(16, 16), 3, 0, 3, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)},
5008
+ {6, UPB_SIZE(24, 24), 4, 0, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)},
5009
+ {7, UPB_SIZE(40, 48), 5, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
5010
+ {8, UPB_SIZE(48, 64), 6, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
4975
5011
  };
4976
5012
 
4977
5013
  const upb_MiniTable google_protobuf_UninterpretedOption_msginit = {
4978
5014
  &google_protobuf_UninterpretedOption_submsgs[0],
4979
5015
  &google_protobuf_UninterpretedOption__fields[0],
4980
- UPB_SIZE(64, 96), 7, upb_ExtMode_NonExtendable, 0, 255, 0,
5016
+ UPB_SIZE(64, 96), 7, kUpb_ExtMode_NonExtendable, 0, 255, 0,
4981
5017
  };
4982
5018
 
4983
5019
  static const upb_MiniTable_Field google_protobuf_UninterpretedOption_NamePart__fields[2] = {
4984
- {1, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
4985
- {2, UPB_SIZE(1, 1), 2, 0, 8, kUpb_FieldMode_Scalar | (upb_FieldRep_1Byte << upb_FieldRep_Shift)},
5020
+ {1, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
5021
+ {2, UPB_SIZE(1, 1), 2, 0, 8, kUpb_FieldMode_Scalar | (kUpb_FieldRep_1Byte << kUpb_FieldRep_Shift)},
4986
5022
  };
4987
5023
 
4988
5024
  const upb_MiniTable google_protobuf_UninterpretedOption_NamePart_msginit = {
4989
5025
  NULL,
4990
5026
  &google_protobuf_UninterpretedOption_NamePart__fields[0],
4991
- UPB_SIZE(16, 32), 2, upb_ExtMode_NonExtendable, 2, 255, 2,
5027
+ UPB_SIZE(16, 32), 2, kUpb_ExtMode_NonExtendable, 2, 255, 2,
4992
5028
  };
4993
5029
 
4994
5030
  static const upb_MiniTable_Sub google_protobuf_SourceCodeInfo_submsgs[1] = {
@@ -4996,27 +5032,27 @@ static const upb_MiniTable_Sub google_protobuf_SourceCodeInfo_submsgs[1] = {
4996
5032
  };
4997
5033
 
4998
5034
  static const upb_MiniTable_Field google_protobuf_SourceCodeInfo__fields[1] = {
4999
- {1, UPB_SIZE(0, 0), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
5035
+ {1, UPB_SIZE(0, 0), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
5000
5036
  };
5001
5037
 
5002
5038
  const upb_MiniTable google_protobuf_SourceCodeInfo_msginit = {
5003
5039
  &google_protobuf_SourceCodeInfo_submsgs[0],
5004
5040
  &google_protobuf_SourceCodeInfo__fields[0],
5005
- UPB_SIZE(8, 8), 1, upb_ExtMode_NonExtendable, 1, 255, 0,
5041
+ UPB_SIZE(8, 8), 1, kUpb_ExtMode_NonExtendable, 1, 255, 0,
5006
5042
  };
5007
5043
 
5008
5044
  static const upb_MiniTable_Field google_protobuf_SourceCodeInfo_Location__fields[5] = {
5009
- {1, UPB_SIZE(20, 40), 0, 0, 5, kUpb_FieldMode_Array | upb_LabelFlags_IsPacked | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
5010
- {2, UPB_SIZE(24, 48), 0, 0, 5, kUpb_FieldMode_Array | upb_LabelFlags_IsPacked | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
5011
- {3, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
5012
- {4, UPB_SIZE(12, 24), 2, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
5013
- {6, UPB_SIZE(28, 56), 0, 0, 12, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
5045
+ {1, UPB_SIZE(20, 40), 0, 0, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
5046
+ {2, UPB_SIZE(24, 48), 0, 0, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
5047
+ {3, UPB_SIZE(4, 8), 1, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
5048
+ {4, UPB_SIZE(12, 24), 2, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
5049
+ {6, UPB_SIZE(28, 56), 0, 0, 12, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
5014
5050
  };
5015
5051
 
5016
5052
  const upb_MiniTable google_protobuf_SourceCodeInfo_Location_msginit = {
5017
5053
  NULL,
5018
5054
  &google_protobuf_SourceCodeInfo_Location__fields[0],
5019
- UPB_SIZE(32, 64), 5, upb_ExtMode_NonExtendable, 4, 255, 0,
5055
+ UPB_SIZE(32, 64), 5, kUpb_ExtMode_NonExtendable, 4, 255, 0,
5020
5056
  };
5021
5057
 
5022
5058
  static const upb_MiniTable_Sub google_protobuf_GeneratedCodeInfo_submsgs[1] = {
@@ -5024,26 +5060,26 @@ static const upb_MiniTable_Sub google_protobuf_GeneratedCodeInfo_submsgs[1] = {
5024
5060
  };
5025
5061
 
5026
5062
  static const upb_MiniTable_Field google_protobuf_GeneratedCodeInfo__fields[1] = {
5027
- {1, UPB_SIZE(0, 0), 0, 0, 11, kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
5063
+ {1, UPB_SIZE(0, 0), 0, 0, 11, kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
5028
5064
  };
5029
5065
 
5030
5066
  const upb_MiniTable google_protobuf_GeneratedCodeInfo_msginit = {
5031
5067
  &google_protobuf_GeneratedCodeInfo_submsgs[0],
5032
5068
  &google_protobuf_GeneratedCodeInfo__fields[0],
5033
- UPB_SIZE(8, 8), 1, upb_ExtMode_NonExtendable, 1, 255, 0,
5069
+ UPB_SIZE(8, 8), 1, kUpb_ExtMode_NonExtendable, 1, 255, 0,
5034
5070
  };
5035
5071
 
5036
5072
  static const upb_MiniTable_Field google_protobuf_GeneratedCodeInfo_Annotation__fields[4] = {
5037
- {1, UPB_SIZE(20, 32), 0, 0, 5, kUpb_FieldMode_Array | upb_LabelFlags_IsPacked | (upb_FieldRep_Pointer << upb_FieldRep_Shift)},
5038
- {2, UPB_SIZE(12, 16), 1, 0, 12, kUpb_FieldMode_Scalar | (upb_FieldRep_StringView << upb_FieldRep_Shift)},
5039
- {3, UPB_SIZE(4, 4), 2, 0, 5, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
5040
- {4, UPB_SIZE(8, 8), 3, 0, 5, kUpb_FieldMode_Scalar | (upb_FieldRep_4Byte << upb_FieldRep_Shift)},
5073
+ {1, UPB_SIZE(20, 32), 0, 0, 5, kUpb_FieldMode_Array | kUpb_LabelFlags_IsPacked | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift)},
5074
+ {2, UPB_SIZE(12, 16), 1, 0, 12, kUpb_FieldMode_Scalar | (kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
5075
+ {3, UPB_SIZE(4, 4), 2, 0, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
5076
+ {4, UPB_SIZE(8, 8), 3, 0, 5, kUpb_FieldMode_Scalar | (kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
5041
5077
  };
5042
5078
 
5043
5079
  const upb_MiniTable google_protobuf_GeneratedCodeInfo_Annotation_msginit = {
5044
5080
  NULL,
5045
5081
  &google_protobuf_GeneratedCodeInfo_Annotation__fields[0],
5046
- UPB_SIZE(24, 48), 4, upb_ExtMode_NonExtendable, 4, 255, 0,
5082
+ UPB_SIZE(24, 48), 4, kUpb_ExtMode_NonExtendable, 4, 255, 0,
5047
5083
  };
5048
5084
 
5049
5085
  static const upb_MiniTable *messages_layout[27] = {
@@ -5190,6 +5226,9 @@ struct upb_FieldDef {
5190
5226
  bool has_json_name_;
5191
5227
  upb_FieldType type_;
5192
5228
  upb_Label label_;
5229
+ #if UINTPTR_MAX == 0xffffffff
5230
+ uint32_t padding; // Increase size to a multiple of 8.
5231
+ #endif
5193
5232
  };
5194
5233
 
5195
5234
  struct upb_ExtensionRange {
@@ -5227,6 +5266,9 @@ struct upb_MessageDef {
5227
5266
  int nested_ext_count;
5228
5267
  bool in_message_set;
5229
5268
  upb_WellKnown well_known_type;
5269
+ #if UINTPTR_MAX == 0xffffffff
5270
+ uint32_t padding; // Increase size to a multiple of 8.
5271
+ #endif
5230
5272
  };
5231
5273
 
5232
5274
  struct upb_EnumDef {
@@ -5240,6 +5282,9 @@ struct upb_EnumDef {
5240
5282
  const upb_EnumValueDef* values;
5241
5283
  int value_count;
5242
5284
  int32_t defaultval;
5285
+ #if UINTPTR_MAX == 0xffffffff
5286
+ uint32_t padding; // Increase size to a multiple of 8.
5287
+ #endif
5243
5288
  };
5244
5289
 
5245
5290
  struct upb_EnumValueDef {
@@ -5258,6 +5303,9 @@ struct upb_OneofDef {
5258
5303
  const upb_FieldDef** fields;
5259
5304
  upb_strtable ntof;
5260
5305
  upb_inttable itof;
5306
+ #if UINTPTR_MAX == 0xffffffff
5307
+ uint32_t padding; // Increase size to a multiple of 8.
5308
+ #endif
5261
5309
  };
5262
5310
 
5263
5311
  struct upb_FileDef {
@@ -5292,6 +5340,7 @@ struct upb_MethodDef {
5292
5340
  const char* full_name;
5293
5341
  const upb_MessageDef* input_type;
5294
5342
  const upb_MessageDef* output_type;
5343
+ int index;
5295
5344
  bool client_streaming;
5296
5345
  bool server_streaming;
5297
5346
  };
@@ -5350,6 +5399,20 @@ static const void* unpack_def(upb_value v, upb_deftype_t type) {
5350
5399
  }
5351
5400
 
5352
5401
  static upb_value pack_def(const void* ptr, upb_deftype_t type) {
5402
+ // Our 3-bit pointer tagging requires all pointers to be multiples of 8.
5403
+ // The arena will always yield 8-byte-aligned addresses, however we put
5404
+ // the defs into arrays. For each element in the array to be 8-byte-aligned,
5405
+ // the sizes of each def type must also be a multiple of 8.
5406
+ //
5407
+ // If any of these asserts fail, we need to add or remove padding on 32-bit
5408
+ // machines (64-bit machines will have 8-byte alignment already due to
5409
+ // pointers, which all of these structs have).
5410
+ UPB_ASSERT((sizeof(upb_FieldDef) & UPB_DEFTYPE_MASK) == 0);
5411
+ UPB_ASSERT((sizeof(upb_MessageDef) & UPB_DEFTYPE_MASK) == 0);
5412
+ UPB_ASSERT((sizeof(upb_EnumDef) & UPB_DEFTYPE_MASK) == 0);
5413
+ UPB_ASSERT((sizeof(upb_EnumValueDef) & UPB_DEFTYPE_MASK) == 0);
5414
+ UPB_ASSERT((sizeof(upb_ServiceDef) & UPB_DEFTYPE_MASK) == 0);
5415
+ UPB_ASSERT((sizeof(upb_OneofDef) & UPB_DEFTYPE_MASK) == 0);
5353
5416
  uintptr_t num = (uintptr_t)ptr;
5354
5417
  UPB_ASSERT((num & UPB_DEFTYPE_MASK) == 0);
5355
5418
  num |= type;
@@ -5795,8 +5858,8 @@ upb_Syntax upb_MessageDef_Syntax(const upb_MessageDef* m) {
5795
5858
  return m->file->syntax;
5796
5859
  }
5797
5860
 
5798
- const upb_FieldDef* upb_MessageDef_FindFieldByNumberWithSize(
5799
- const upb_MessageDef* m, uint32_t i) {
5861
+ const upb_FieldDef* upb_MessageDef_FindFieldByNumber(const upb_MessageDef* m,
5862
+ uint32_t i) {
5800
5863
  upb_value val;
5801
5864
  return upb_inttable_lookup(&m->itof, i, &val) ? upb_value_getconstptr(val)
5802
5865
  : NULL;
@@ -6084,6 +6147,8 @@ const char* upb_MethodDef_FullName(const upb_MethodDef* m) {
6084
6147
  return m->full_name;
6085
6148
  }
6086
6149
 
6150
+ int upb_MethodDef_Index(const upb_MethodDef* m) { return m->index; }
6151
+
6087
6152
  const char* upb_MethodDef_Name(const upb_MethodDef* m) {
6088
6153
  return shortdefname(m->full_name);
6089
6154
  }
@@ -6469,8 +6534,8 @@ static void assign_layout_indices(const upb_MessageDef* m, upb_MiniTable* l,
6469
6534
  int n = upb_MessageDef_numfields(m);
6470
6535
  int dense_below = 0;
6471
6536
  for (i = 0; i < n; i++) {
6472
- upb_FieldDef* f = (upb_FieldDef*)upb_MessageDef_FindFieldByNumberWithSize(
6473
- m, fields[i].number);
6537
+ upb_FieldDef* f =
6538
+ (upb_FieldDef*)upb_MessageDef_FindFieldByNumber(m, fields[i].number);
6474
6539
  UPB_ASSERT(f);
6475
6540
  f->layout_index = i;
6476
6541
  if (i < UINT8_MAX && fields[i].number == i + 1 &&
@@ -6488,17 +6553,17 @@ static uint8_t map_descriptortype(const upb_FieldDef* f) {
6488
6553
  if (type == kUpb_FieldType_String && f->file->syntax == kUpb_Syntax_Proto2) {
6489
6554
  return kUpb_FieldType_Bytes;
6490
6555
  } else if (type == kUpb_FieldType_Enum &&
6491
- f->sub.enumdef->file->syntax == kUpb_Syntax_Proto3) {
6556
+ (f->sub.enumdef->file->syntax == kUpb_Syntax_Proto3 ||
6557
+ UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 ||
6558
+ // TODO(https://github.com/protocolbuffers/upb/issues/541):
6559
+ // fix map enum values to check for unknown enum values and put
6560
+ // them in the unknown field set.
6561
+ upb_MessageDef_IsMapEntry(upb_FieldDef_ContainingType(f)))) {
6492
6562
  return kUpb_FieldType_Int32;
6493
6563
  }
6494
6564
  return type;
6495
6565
  }
6496
6566
 
6497
- static bool IsProto2Enum(const upb_FieldDef* f) {
6498
- return upb_FieldDef_CType(f) == kUpb_CType_Enum &&
6499
- f->sub.enumdef->file->syntax == kUpb_Syntax_Proto2;
6500
- }
6501
-
6502
6567
  static void fill_fieldlayout(upb_MiniTable_Field* field,
6503
6568
  const upb_FieldDef* f) {
6504
6569
  field->number = upb_FieldDef_Number(f);
@@ -6506,43 +6571,43 @@ static void fill_fieldlayout(upb_MiniTable_Field* field,
6506
6571
 
6507
6572
  if (upb_FieldDef_IsMap(f)) {
6508
6573
  field->mode =
6509
- kUpb_FieldMode_Map | (upb_FieldRep_Pointer << upb_FieldRep_Shift);
6574
+ kUpb_FieldMode_Map | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift);
6510
6575
  } else if (upb_FieldDef_IsRepeated(f)) {
6511
6576
  field->mode =
6512
- kUpb_FieldMode_Array | (upb_FieldRep_Pointer << upb_FieldRep_Shift);
6577
+ kUpb_FieldMode_Array | (kUpb_FieldRep_Pointer << kUpb_FieldRep_Shift);
6513
6578
  } else {
6514
6579
  /* Maps descriptor type -> elem_size_lg2. */
6515
6580
  static const uint8_t sizes[] = {
6516
- -1, /* invalid descriptor type */
6517
- upb_FieldRep_8Byte, /* DOUBLE */
6518
- upb_FieldRep_4Byte, /* FLOAT */
6519
- upb_FieldRep_8Byte, /* INT64 */
6520
- upb_FieldRep_8Byte, /* UINT64 */
6521
- upb_FieldRep_4Byte, /* INT32 */
6522
- upb_FieldRep_8Byte, /* FIXED64 */
6523
- upb_FieldRep_4Byte, /* FIXED32 */
6524
- upb_FieldRep_1Byte, /* BOOL */
6525
- upb_FieldRep_StringView, /* STRING */
6526
- upb_FieldRep_Pointer, /* GROUP */
6527
- upb_FieldRep_Pointer, /* MESSAGE */
6528
- upb_FieldRep_StringView, /* BYTES */
6529
- upb_FieldRep_4Byte, /* UINT32 */
6530
- upb_FieldRep_4Byte, /* ENUM */
6531
- upb_FieldRep_4Byte, /* SFIXED32 */
6532
- upb_FieldRep_8Byte, /* SFIXED64 */
6533
- upb_FieldRep_4Byte, /* SINT32 */
6534
- upb_FieldRep_8Byte, /* SINT64 */
6581
+ -1, /* invalid descriptor type */
6582
+ kUpb_FieldRep_8Byte, /* DOUBLE */
6583
+ kUpb_FieldRep_4Byte, /* FLOAT */
6584
+ kUpb_FieldRep_8Byte, /* INT64 */
6585
+ kUpb_FieldRep_8Byte, /* UINT64 */
6586
+ kUpb_FieldRep_4Byte, /* INT32 */
6587
+ kUpb_FieldRep_8Byte, /* FIXED64 */
6588
+ kUpb_FieldRep_4Byte, /* FIXED32 */
6589
+ kUpb_FieldRep_1Byte, /* BOOL */
6590
+ kUpb_FieldRep_StringView, /* STRING */
6591
+ kUpb_FieldRep_Pointer, /* GROUP */
6592
+ kUpb_FieldRep_Pointer, /* MESSAGE */
6593
+ kUpb_FieldRep_StringView, /* BYTES */
6594
+ kUpb_FieldRep_4Byte, /* UINT32 */
6595
+ kUpb_FieldRep_4Byte, /* ENUM */
6596
+ kUpb_FieldRep_4Byte, /* SFIXED32 */
6597
+ kUpb_FieldRep_8Byte, /* SFIXED64 */
6598
+ kUpb_FieldRep_4Byte, /* SINT32 */
6599
+ kUpb_FieldRep_8Byte, /* SINT64 */
6535
6600
  };
6536
6601
  field->mode = kUpb_FieldMode_Scalar |
6537
- (sizes[field->descriptortype] << upb_FieldRep_Shift);
6602
+ (sizes[field->descriptortype] << kUpb_FieldRep_Shift);
6538
6603
  }
6539
6604
 
6540
6605
  if (upb_FieldDef_IsPacked(f)) {
6541
- field->mode |= upb_LabelFlags_IsPacked;
6606
+ field->mode |= kUpb_LabelFlags_IsPacked;
6542
6607
  }
6543
6608
 
6544
6609
  if (upb_FieldDef_IsExtension(f)) {
6545
- field->mode |= upb_LabelFlags_IsExtension;
6610
+ field->mode |= kUpb_LabelFlags_IsExtension;
6546
6611
  }
6547
6612
  }
6548
6613
 
@@ -6562,7 +6627,9 @@ static void make_layout(symtab_addctx* ctx, const upb_MessageDef* m) {
6562
6627
  const upb_FieldDef* f = &m->fields[i];
6563
6628
  if (upb_FieldDef_IsSubMessage(f)) {
6564
6629
  sublayout_count++;
6565
- } else if (IsProto2Enum(f)) {
6630
+ }
6631
+ if (upb_FieldDef_CType(f) == kUpb_CType_Enum &&
6632
+ f->sub.enumdef->file->syntax == kUpb_Syntax_Proto2) {
6566
6633
  sublayout_count++;
6567
6634
  }
6568
6635
  }
@@ -6578,12 +6645,12 @@ static void make_layout(symtab_addctx* ctx, const upb_MessageDef* m) {
6578
6645
 
6579
6646
  if (upb_MessageDef_ExtensionRangeCount(m) > 0) {
6580
6647
  if (google_protobuf_MessageOptions_message_set_wire_format(m->opts)) {
6581
- l->ext = upb_ExtMode_IsMessageSet;
6648
+ l->ext = kUpb_ExtMode_IsMessageSet;
6582
6649
  } else {
6583
- l->ext = upb_ExtMode_Extendable;
6650
+ l->ext = kUpb_ExtMode_Extendable;
6584
6651
  }
6585
6652
  } else {
6586
- l->ext = upb_ExtMode_NonExtendable;
6653
+ l->ext = kUpb_ExtMode_NonExtendable;
6587
6654
  }
6588
6655
 
6589
6656
  /* TODO(haberman): initialize fast tables so that reflection-based parsing
@@ -6594,8 +6661,8 @@ static void make_layout(symtab_addctx* ctx, const upb_MessageDef* m) {
6594
6661
  if (upb_MessageDef_IsMapEntry(m)) {
6595
6662
  /* TODO(haberman): refactor this method so this special case is more
6596
6663
  * elegant. */
6597
- const upb_FieldDef* key = upb_MessageDef_FindFieldByNumberWithSize(m, 1);
6598
- const upb_FieldDef* val = upb_MessageDef_FindFieldByNumberWithSize(m, 2);
6664
+ const upb_FieldDef* key = upb_MessageDef_FindFieldByNumber(m, 1);
6665
+ const upb_FieldDef* val = upb_MessageDef_FindFieldByNumber(m, 2);
6599
6666
  fields[0].number = 1;
6600
6667
  fields[1].number = 2;
6601
6668
  fields[0].mode = kUpb_FieldMode_Scalar;
@@ -6610,8 +6677,6 @@ static void make_layout(symtab_addctx* ctx, const upb_MessageDef* m) {
6610
6677
 
6611
6678
  if (upb_FieldDef_CType(val) == kUpb_CType_Message) {
6612
6679
  subs[0].submsg = upb_FieldDef_MessageSubDef(val)->layout;
6613
- } else if (IsProto2Enum(val)) {
6614
- subs[0].subenum = upb_FieldDef_EnumSubDef(val)->layout;
6615
6680
  }
6616
6681
 
6617
6682
  upb_FieldDef* fielddefs = (upb_FieldDef*)&m->fields[0];
@@ -6660,11 +6725,11 @@ static void make_layout(symtab_addctx* ctx, const upb_MessageDef* m) {
6660
6725
 
6661
6726
  fill_fieldlayout(field, f);
6662
6727
 
6663
- if (upb_FieldDef_IsSubMessage(f)) {
6728
+ if (field->descriptortype == kUpb_FieldType_Message ||
6729
+ field->descriptortype == kUpb_FieldType_Group) {
6664
6730
  field->submsg_index = sublayout_count++;
6665
6731
  subs[field->submsg_index].submsg = upb_FieldDef_MessageSubDef(f)->layout;
6666
- } else if (upb_FieldDef_CType(f) == kUpb_CType_Enum &&
6667
- f->file->syntax == kUpb_Syntax_Proto2) {
6732
+ } else if (field->descriptortype == kUpb_FieldType_Enum) {
6668
6733
  field->submsg_index = sublayout_count++;
6669
6734
  subs[field->submsg_index].subenum = upb_FieldDef_EnumSubDef(f)->layout;
6670
6735
  UPB_ASSERT(subs[field->submsg_index].subenum);
@@ -6683,7 +6748,7 @@ static void make_layout(symtab_addctx* ctx, const upb_MessageDef* m) {
6683
6748
  }
6684
6749
 
6685
6750
  /* Account for space used by hasbits. */
6686
- l->size = div_round_up(hasbit + 1, 8);
6751
+ l->size = hasbit ? div_round_up(hasbit + 1, 8) : 0;
6687
6752
 
6688
6753
  /* Allocate non-oneof fields. */
6689
6754
  for (int i = 0; i < m->field_count; i++) {
@@ -6710,6 +6775,10 @@ static void make_layout(symtab_addctx* ctx, const upb_MessageDef* m) {
6710
6775
 
6711
6776
  if (upb_OneofDef_IsSynthetic(o)) continue;
6712
6777
 
6778
+ if (o->field_count == 0) {
6779
+ symtab_errf(ctx, "Oneof must have at least one field (%s)", o->full_name);
6780
+ }
6781
+
6713
6782
  /* Calculate field size: the max of all field sizes. */
6714
6783
  for (int j = 0; j < o->field_count; j++) {
6715
6784
  const upb_FieldDef* f = o->fields[j];
@@ -6732,7 +6801,10 @@ static void make_layout(symtab_addctx* ctx, const upb_MessageDef* m) {
6732
6801
  l->size = UPB_ALIGN_UP(l->size, 8);
6733
6802
 
6734
6803
  /* Sort fields by number. */
6735
- qsort(fields, upb_MessageDef_numfields(m), sizeof(*fields), field_number_cmp);
6804
+ if (fields) {
6805
+ qsort(fields, upb_MessageDef_numfields(m), sizeof(*fields),
6806
+ field_number_cmp);
6807
+ }
6736
6808
  assign_layout_indices(m, l, fields);
6737
6809
  }
6738
6810
 
@@ -6893,8 +6965,8 @@ static const void* symtab_resolveany(symtab_addctx* ctx,
6893
6965
  }
6894
6966
  } else {
6895
6967
  /* Remove components from base until we find an entry or run out. */
6896
- size_t baselen = strlen(base);
6897
- char* tmp = malloc(sym.size + strlen(base) + 1);
6968
+ size_t baselen = base ? strlen(base) : 0;
6969
+ char* tmp = malloc(sym.size + baselen + 1);
6898
6970
  while (1) {
6899
6971
  char* p = tmp;
6900
6972
  if (baselen) {
@@ -6930,10 +7002,10 @@ static const void* symtab_resolve(symtab_addctx* ctx, const char* from_name_dbg,
6930
7002
  const void* ret =
6931
7003
  symtab_resolveany(ctx, from_name_dbg, base, sym, &found_type);
6932
7004
  if (ret && found_type != type) {
6933
- symtab_errf(
6934
- ctx,
6935
- "type mismatch when resolving %s: couldn't find name %s with type=%d",
6936
- from_name_dbg, sym.data, (int)type);
7005
+ symtab_errf(ctx,
7006
+ "type mismatch when resolving %s: couldn't find "
7007
+ "name " UPB_STRINGVIEW_FORMAT " with type=%d",
7008
+ from_name_dbg, UPB_STRINGVIEW_ARGS(sym), (int)type);
6937
7009
  }
6938
7010
  return ret;
6939
7011
  }
@@ -6953,6 +7025,11 @@ static void create_oneofdef(
6953
7025
 
6954
7026
  SET_OPTIONS(o->opts, OneofDescriptorProto, OneofOptions, oneof_proto);
6955
7027
 
7028
+ upb_value existing_v;
7029
+ if (upb_strtable_lookup2(&m->ntof, name.data, name.size, &existing_v)) {
7030
+ symtab_errf(ctx, "duplicate oneof name (%s)", o->full_name);
7031
+ }
7032
+
6956
7033
  v = pack_def(o, UPB_DEFTYPE_ONEOF);
6957
7034
  CHK_OOM(upb_strtable_insert(&m->ntof, name.data, name.size, v, ctx->arena));
6958
7035
 
@@ -7262,7 +7339,7 @@ static void create_fielddef(
7262
7339
  f->file = ctx->file; /* Must happen prior to symtab_add(). */
7263
7340
 
7264
7341
  if (!google_protobuf_FieldDescriptorProto_has_name(field_proto)) {
7265
- symtab_errf(ctx, "field has no name (%s)", upb_MessageDef_FullName(m));
7342
+ symtab_errf(ctx, "field has no name");
7266
7343
  }
7267
7344
 
7268
7345
  name = google_protobuf_FieldDescriptorProto_name(field_proto);
@@ -7479,6 +7556,7 @@ static void create_service(
7479
7556
 
7480
7557
  m->service = s;
7481
7558
  m->full_name = makefullname(ctx, s->full_name, name);
7559
+ m->index = i;
7482
7560
  m->client_streaming =
7483
7561
  google_protobuf_MethodDescriptorProto_client_streaming(method_proto);
7484
7562
  m->server_streaming =
@@ -7506,6 +7584,12 @@ static int count_bits_debug(uint64_t x) {
7506
7584
  return n;
7507
7585
  }
7508
7586
 
7587
+ static int compare_int32(const void* a_ptr, const void* b_ptr) {
7588
+ int32_t a = *(int32_t*)a_ptr;
7589
+ int32_t b = *(int32_t*)b_ptr;
7590
+ return a < b ? -1 : (a == b ? 0 : 1);
7591
+ }
7592
+
7509
7593
  upb_MiniTable_Enum* create_enumlayout(symtab_addctx* ctx,
7510
7594
  const upb_EnumDef* e) {
7511
7595
  int n = 0;
@@ -7514,7 +7598,7 @@ upb_MiniTable_Enum* create_enumlayout(symtab_addctx* ctx,
7514
7598
  for (int i = 0; i < e->value_count; i++) {
7515
7599
  uint32_t val = (uint32_t)e->values[i].number;
7516
7600
  if (val < 64) {
7517
- mask |= 1 << val;
7601
+ mask |= 1ULL << val;
7518
7602
  } else {
7519
7603
  n++;
7520
7604
  }
@@ -7536,6 +7620,17 @@ upb_MiniTable_Enum* create_enumlayout(symtab_addctx* ctx,
7536
7620
  UPB_ASSERT(p == values + n);
7537
7621
  }
7538
7622
 
7623
+ // Enums can have duplicate values; we must sort+uniq them.
7624
+ if (values) qsort(values, n, sizeof(*values), &compare_int32);
7625
+
7626
+ int dst = 0;
7627
+ for (int i = 0; i < n; dst++) {
7628
+ int32_t val = values[i];
7629
+ while (i < n && values[i] == val) i++; // Skip duplicates.
7630
+ values[dst] = val;
7631
+ }
7632
+ n = dst;
7633
+
7539
7634
  UPB_ASSERT(upb_inttable_count(&e->iton) == n + count_bits_debug(mask));
7540
7635
 
7541
7636
  upb_MiniTable_Enum* layout = symtab_alloc(ctx, sizeof(*layout));
@@ -7619,7 +7714,7 @@ static void create_enumdef(
7619
7714
  if (ctx->layout) {
7620
7715
  UPB_ASSERT(ctx->enum_count < ctx->layout->enum_count);
7621
7716
  e->layout = ctx->layout->enums[ctx->enum_count++];
7622
- UPB_ASSERT(n ==
7717
+ UPB_ASSERT(upb_inttable_count(&e->iton) ==
7623
7718
  e->layout->value_count + count_bits_debug(e->layout->mask));
7624
7719
  } else {
7625
7720
  e->layout = create_enumlayout(ctx, e);
@@ -7890,15 +7985,10 @@ static void resolve_msgdef(symtab_addctx* ctx, upb_MessageDef* m) {
7890
7985
  resolve_fielddef(ctx, m->full_name, (upb_FieldDef*)&m->fields[i]);
7891
7986
  }
7892
7987
 
7893
- for (int i = 0; i < m->nested_ext_count; i++) {
7894
- resolve_fielddef(ctx, m->full_name, (upb_FieldDef*)&m->nested_exts[i]);
7895
- }
7896
-
7897
- if (!ctx->layout) make_layout(ctx, m);
7898
-
7899
7988
  m->in_message_set = false;
7900
- if (m->nested_ext_count == 1) {
7901
- const upb_FieldDef* ext = &m->nested_exts[0];
7989
+ for (int i = 0; i < m->nested_ext_count; i++) {
7990
+ upb_FieldDef* ext = (upb_FieldDef*)&m->nested_exts[i];
7991
+ resolve_fielddef(ctx, m->full_name, ext);
7902
7992
  if (ext->type_ == kUpb_FieldType_Message &&
7903
7993
  ext->label_ == kUpb_Label_Optional && ext->sub.msgdef == m &&
7904
7994
  google_protobuf_MessageOptions_message_set_wire_format(
@@ -7907,6 +7997,8 @@ static void resolve_msgdef(symtab_addctx* ctx, upb_MessageDef* m) {
7907
7997
  }
7908
7998
  }
7909
7999
 
8000
+ if (!ctx->layout) make_layout(ctx, m);
8001
+
7910
8002
  for (int i = 0; i < m->nested_msg_count; i++) {
7911
8003
  resolve_msgdef(ctx, (upb_MessageDef*)&m->nested_msgs[i]);
7912
8004
  }
@@ -8038,7 +8130,7 @@ static void build_filedef(
8038
8130
  int32_t* mutable_weak_deps = (int32_t*)file->weak_deps;
8039
8131
  for (i = 0; i < n; i++) {
8040
8132
  if (weak_deps[i] >= file->dep_count) {
8041
- symtab_errf(ctx, "public_dep %d is out of range", (int)public_deps[i]);
8133
+ symtab_errf(ctx, "weak_dep %d is out of range", (int)weak_deps[i]);
8042
8134
  }
8043
8135
  mutable_weak_deps[i] = weak_deps[i];
8044
8136
  }
@@ -8194,7 +8286,8 @@ const upb_FileDef* upb_DefPool_AddFile(
8194
8286
  /* Include here since we want most of this file to be stdio-free. */
8195
8287
  #include <stdio.h>
8196
8288
 
8197
- bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init) {
8289
+ bool _upb_DefPool_LoadDefInitEx(upb_DefPool* s, const _upb_DefPool_Init* init,
8290
+ bool rebuild_minitable) {
8198
8291
  /* Since this function should never fail (it would indicate a bug in upb) we
8199
8292
  * print errors to stderr instead of returning error status to the user. */
8200
8293
  _upb_DefPool_Init** deps = init->deps;
@@ -8211,7 +8304,7 @@ bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init) {
8211
8304
  arena = upb_Arena_New();
8212
8305
 
8213
8306
  for (; *deps; deps++) {
8214
- if (!_upb_DefPool_LoadDefInit(s, *deps)) goto err;
8307
+ if (!_upb_DefPool_LoadDefInitEx(s, *deps, rebuild_minitable)) goto err;
8215
8308
  }
8216
8309
 
8217
8310
  file = google_protobuf_FileDescriptorProto_parse_ex(
@@ -8228,7 +8321,8 @@ bool _upb_DefPool_LoadDefInit(upb_DefPool* s, const _upb_DefPool_Init* init) {
8228
8321
  goto err;
8229
8322
  }
8230
8323
 
8231
- if (!_upb_DefPool_AddFile(s, file, init->layout, &status)) {
8324
+ const upb_MiniTable_File* mt = rebuild_minitable ? NULL : init->layout;
8325
+ if (!_upb_DefPool_AddFile(s, file, mt, &status)) {
8232
8326
  goto err;
8233
8327
  }
8234
8328
 
@@ -8458,10 +8552,10 @@ make:
8458
8552
  if (!a) return (upb_MutableMessageValue){.array = NULL};
8459
8553
  if (upb_FieldDef_IsMap(f)) {
8460
8554
  const upb_MessageDef* entry = upb_FieldDef_MessageSubDef(f);
8461
- const upb_FieldDef* key = upb_MessageDef_FindFieldByNumberWithSize(
8462
- entry, kUpb_MapEntry_KeyFieldNumber);
8463
- const upb_FieldDef* value = upb_MessageDef_FindFieldByNumberWithSize(
8464
- entry, kUpb_MapEntry_ValueFieldNumber);
8555
+ const upb_FieldDef* key =
8556
+ upb_MessageDef_FindFieldByNumber(entry, kUpb_MapEntry_KeyFieldNumber);
8557
+ const upb_FieldDef* value =
8558
+ upb_MessageDef_FindFieldByNumber(entry, kUpb_MapEntry_ValueFieldNumber);
8465
8559
  ret.map =
8466
8560
  upb_Map_New(a, upb_FieldDef_CType(key), upb_FieldDef_CType(value));
8467
8561
  } else if (upb_FieldDef_IsRepeated(f)) {
@@ -8591,8 +8685,7 @@ bool _upb_Message_DiscardUnknown(upb_Message* msg, const upb_MessageDef* m,
8591
8685
  const upb_MessageDef* subm = upb_FieldDef_MessageSubDef(f);
8592
8686
  if (!subm) continue;
8593
8687
  if (upb_FieldDef_IsMap(f)) {
8594
- const upb_FieldDef* val_f =
8595
- upb_MessageDef_FindFieldByNumberWithSize(subm, 2);
8688
+ const upb_FieldDef* val_f = upb_MessageDef_FindFieldByNumber(subm, 2);
8596
8689
  const upb_MessageDef* val_m = upb_FieldDef_MessageSubDef(val_f);
8597
8690
  upb_Map* map = (upb_Map*)val.map_val;
8598
8691
  size_t iter = kUpb_Map_Begin;
@@ -9624,10 +9717,8 @@ static void jsondec_array(jsondec* d, upb_Message* msg, const upb_FieldDef* f) {
9624
9717
  static void jsondec_map(jsondec* d, upb_Message* msg, const upb_FieldDef* f) {
9625
9718
  upb_Map* map = upb_Message_Mutable(msg, f, d->arena).map;
9626
9719
  const upb_MessageDef* entry = upb_FieldDef_MessageSubDef(f);
9627
- const upb_FieldDef* key_f =
9628
- upb_MessageDef_FindFieldByNumberWithSize(entry, 1);
9629
- const upb_FieldDef* val_f =
9630
- upb_MessageDef_FindFieldByNumberWithSize(entry, 2);
9720
+ const upb_FieldDef* key_f = upb_MessageDef_FindFieldByNumber(entry, 1);
9721
+ const upb_FieldDef* val_f = upb_MessageDef_FindFieldByNumber(entry, 2);
9631
9722
 
9632
9723
  jsondec_objstart(d);
9633
9724
  while (jsondec_objnext(d)) {
@@ -9869,10 +9960,9 @@ static void jsondec_timestamp(jsondec* d, upb_Message* msg,
9869
9960
  jsondec_err(d, "Timestamp out of range");
9870
9961
  }
9871
9962
 
9872
- upb_Message_Set(msg, upb_MessageDef_FindFieldByNumberWithSize(m, 1), seconds,
9873
- d->arena);
9874
- upb_Message_Set(msg, upb_MessageDef_FindFieldByNumberWithSize(m, 2), nanos,
9963
+ upb_Message_Set(msg, upb_MessageDef_FindFieldByNumber(m, 1), seconds,
9875
9964
  d->arena);
9965
+ upb_Message_Set(msg, upb_MessageDef_FindFieldByNumber(m, 2), nanos, d->arena);
9876
9966
  return;
9877
9967
 
9878
9968
  malformed:
@@ -9904,15 +9994,14 @@ static void jsondec_duration(jsondec* d, upb_Message* msg,
9904
9994
  nanos.int32_val = -nanos.int32_val;
9905
9995
  }
9906
9996
 
9907
- upb_Message_Set(msg, upb_MessageDef_FindFieldByNumberWithSize(m, 1), seconds,
9908
- d->arena);
9909
- upb_Message_Set(msg, upb_MessageDef_FindFieldByNumberWithSize(m, 2), nanos,
9997
+ upb_Message_Set(msg, upb_MessageDef_FindFieldByNumber(m, 1), seconds,
9910
9998
  d->arena);
9999
+ upb_Message_Set(msg, upb_MessageDef_FindFieldByNumber(m, 2), nanos, d->arena);
9911
10000
  }
9912
10001
 
9913
10002
  static void jsondec_listvalue(jsondec* d, upb_Message* msg,
9914
10003
  const upb_MessageDef* m) {
9915
- const upb_FieldDef* values_f = upb_MessageDef_FindFieldByNumberWithSize(m, 1);
10004
+ const upb_FieldDef* values_f = upb_MessageDef_FindFieldByNumber(m, 1);
9916
10005
  const upb_MessageDef* value_m = upb_FieldDef_MessageSubDef(values_f);
9917
10006
  upb_Array* values = upb_Message_Mutable(msg, values_f, d->arena).array;
9918
10007
 
@@ -9929,10 +10018,9 @@ static void jsondec_listvalue(jsondec* d, upb_Message* msg,
9929
10018
 
9930
10019
  static void jsondec_struct(jsondec* d, upb_Message* msg,
9931
10020
  const upb_MessageDef* m) {
9932
- const upb_FieldDef* fields_f = upb_MessageDef_FindFieldByNumberWithSize(m, 1);
10021
+ const upb_FieldDef* fields_f = upb_MessageDef_FindFieldByNumber(m, 1);
9933
10022
  const upb_MessageDef* entry_m = upb_FieldDef_MessageSubDef(fields_f);
9934
- const upb_FieldDef* value_f =
9935
- upb_MessageDef_FindFieldByNumberWithSize(entry_m, 2);
10023
+ const upb_FieldDef* value_f = upb_MessageDef_FindFieldByNumber(entry_m, 2);
9936
10024
  const upb_MessageDef* value_m = upb_FieldDef_MessageSubDef(value_f);
9937
10025
  upb_Map* fields = upb_Message_Mutable(msg, fields_f, d->arena).map;
9938
10026
 
@@ -9958,42 +10046,42 @@ static void jsondec_wellknownvalue(jsondec* d, upb_Message* msg,
9958
10046
  switch (jsondec_peek(d)) {
9959
10047
  case JD_NUMBER:
9960
10048
  /* double number_value = 2; */
9961
- f = upb_MessageDef_FindFieldByNumberWithSize(m, 2);
10049
+ f = upb_MessageDef_FindFieldByNumber(m, 2);
9962
10050
  val.double_val = jsondec_number(d);
9963
10051
  break;
9964
10052
  case JD_STRING:
9965
10053
  /* string string_value = 3; */
9966
- f = upb_MessageDef_FindFieldByNumberWithSize(m, 3);
10054
+ f = upb_MessageDef_FindFieldByNumber(m, 3);
9967
10055
  val.str_val = jsondec_string(d);
9968
10056
  break;
9969
10057
  case JD_FALSE:
9970
10058
  /* bool bool_value = 4; */
9971
- f = upb_MessageDef_FindFieldByNumberWithSize(m, 4);
10059
+ f = upb_MessageDef_FindFieldByNumber(m, 4);
9972
10060
  val.bool_val = false;
9973
10061
  jsondec_false(d);
9974
10062
  break;
9975
10063
  case JD_TRUE:
9976
10064
  /* bool bool_value = 4; */
9977
- f = upb_MessageDef_FindFieldByNumberWithSize(m, 4);
10065
+ f = upb_MessageDef_FindFieldByNumber(m, 4);
9978
10066
  val.bool_val = true;
9979
10067
  jsondec_true(d);
9980
10068
  break;
9981
10069
  case JD_NULL:
9982
10070
  /* NullValue null_value = 1; */
9983
- f = upb_MessageDef_FindFieldByNumberWithSize(m, 1);
10071
+ f = upb_MessageDef_FindFieldByNumber(m, 1);
9984
10072
  val.int32_val = 0;
9985
10073
  jsondec_null(d);
9986
10074
  break;
9987
10075
  /* Note: these cases return, because upb_Message_Mutable() is enough. */
9988
10076
  case JD_OBJECT:
9989
10077
  /* Struct struct_value = 5; */
9990
- f = upb_MessageDef_FindFieldByNumberWithSize(m, 5);
10078
+ f = upb_MessageDef_FindFieldByNumber(m, 5);
9991
10079
  submsg = upb_Message_Mutable(msg, f, d->arena).msg;
9992
10080
  jsondec_struct(d, submsg, upb_FieldDef_MessageSubDef(f));
9993
10081
  return;
9994
10082
  case JD_ARRAY:
9995
10083
  /* ListValue list_value = 6; */
9996
- f = upb_MessageDef_FindFieldByNumberWithSize(m, 6);
10084
+ f = upb_MessageDef_FindFieldByNumber(m, 6);
9997
10085
  submsg = upb_Message_Mutable(msg, f, d->arena).msg;
9998
10086
  jsondec_listvalue(d, submsg, upb_FieldDef_MessageSubDef(f));
9999
10087
  return;
@@ -10040,7 +10128,7 @@ static upb_StringView jsondec_mask(jsondec* d, const char* buf,
10040
10128
  static void jsondec_fieldmask(jsondec* d, upb_Message* msg,
10041
10129
  const upb_MessageDef* m) {
10042
10130
  /* repeated string paths = 1; */
10043
- const upb_FieldDef* paths_f = upb_MessageDef_FindFieldByNumberWithSize(m, 1);
10131
+ const upb_FieldDef* paths_f = upb_MessageDef_FindFieldByNumber(m, 1);
10044
10132
  upb_Array* arr = upb_Message_Mutable(msg, paths_f, d->arena).array;
10045
10133
  upb_StringView str = jsondec_string(d);
10046
10134
  const char* ptr = str.data;
@@ -10080,8 +10168,7 @@ static void jsondec_anyfield(jsondec* d, upb_Message* msg,
10080
10168
 
10081
10169
  static const upb_MessageDef* jsondec_typeurl(jsondec* d, upb_Message* msg,
10082
10170
  const upb_MessageDef* m) {
10083
- const upb_FieldDef* type_url_f =
10084
- upb_MessageDef_FindFieldByNumberWithSize(m, 1);
10171
+ const upb_FieldDef* type_url_f = upb_MessageDef_FindFieldByNumber(m, 1);
10085
10172
  const upb_MessageDef* type_m;
10086
10173
  upb_StringView type_url = jsondec_string(d);
10087
10174
  const char* end = type_url.data + type_url.size;
@@ -10112,7 +10199,7 @@ static const upb_MessageDef* jsondec_typeurl(jsondec* d, upb_Message* msg,
10112
10199
  static void jsondec_any(jsondec* d, upb_Message* msg, const upb_MessageDef* m) {
10113
10200
  /* string type_url = 1;
10114
10201
  * bytes value = 2; */
10115
- const upb_FieldDef* value_f = upb_MessageDef_FindFieldByNumberWithSize(m, 2);
10202
+ const upb_FieldDef* value_f = upb_MessageDef_FindFieldByNumber(m, 2);
10116
10203
  upb_Message* any_msg;
10117
10204
  const upb_MessageDef* any_m = NULL;
10118
10205
  const char* pre_type_data = NULL;
@@ -10174,7 +10261,7 @@ static void jsondec_any(jsondec* d, upb_Message* msg, const upb_MessageDef* m) {
10174
10261
 
10175
10262
  static void jsondec_wrapper(jsondec* d, upb_Message* msg,
10176
10263
  const upb_MessageDef* m) {
10177
- const upb_FieldDef* value_f = upb_MessageDef_FindFieldByNumberWithSize(m, 1);
10264
+ const upb_FieldDef* value_f = upb_MessageDef_FindFieldByNumber(m, 1);
10178
10265
  upb_MessageValue val = jsondec_value(d, value_f);
10179
10266
  upb_Message_Set(msg, value_f, val, d->arena);
10180
10267
  }
@@ -10356,9 +10443,8 @@ static void jsonenc_nanos(jsonenc* e, int32_t nanos) {
10356
10443
 
10357
10444
  static void jsonenc_timestamp(jsonenc* e, const upb_Message* msg,
10358
10445
  const upb_MessageDef* m) {
10359
- const upb_FieldDef* seconds_f =
10360
- upb_MessageDef_FindFieldByNumberWithSize(m, 1);
10361
- const upb_FieldDef* nanos_f = upb_MessageDef_FindFieldByNumberWithSize(m, 2);
10446
+ const upb_FieldDef* seconds_f = upb_MessageDef_FindFieldByNumber(m, 1);
10447
+ const upb_FieldDef* nanos_f = upb_MessageDef_FindFieldByNumber(m, 2);
10362
10448
  int64_t seconds = upb_Message_Get(msg, seconds_f).int64_val;
10363
10449
  int32_t nanos = upb_Message_Get(msg, nanos_f).int32_val;
10364
10450
  int L, N, I, J, K, hour, min, sec;
@@ -10377,7 +10463,8 @@ static void jsonenc_timestamp(jsonenc* e, const upb_Message* msg,
10377
10463
  * Fliegel, H. F., and Van Flandern, T. C., "A Machine Algorithm for
10378
10464
  * Processing Calendar Dates," Communications of the Association of
10379
10465
  * Computing Machines, vol. 11 (1968), p. 657. */
10380
- L = (int)(seconds / 86400) + 68569 + 2440588;
10466
+ seconds += 62135596800; // Ensure seconds is positive.
10467
+ L = (int)(seconds / 86400) - 719162 + 68569 + 2440588;
10381
10468
  N = 4 * L / 146097;
10382
10469
  L = L - (146097 * N + 3) / 4;
10383
10470
  I = 4000 * (L + 1) / 1461001;
@@ -10399,9 +10486,8 @@ static void jsonenc_timestamp(jsonenc* e, const upb_Message* msg,
10399
10486
 
10400
10487
  static void jsonenc_duration(jsonenc* e, const upb_Message* msg,
10401
10488
  const upb_MessageDef* m) {
10402
- const upb_FieldDef* seconds_f =
10403
- upb_MessageDef_FindFieldByNumberWithSize(m, 1);
10404
- const upb_FieldDef* nanos_f = upb_MessageDef_FindFieldByNumberWithSize(m, 2);
10489
+ const upb_FieldDef* seconds_f = upb_MessageDef_FindFieldByNumber(m, 1);
10490
+ const upb_FieldDef* nanos_f = upb_MessageDef_FindFieldByNumber(m, 2);
10405
10491
  int64_t seconds = upb_Message_Get(msg, seconds_f).int64_val;
10406
10492
  int32_t nanos = upb_Message_Get(msg, nanos_f).int32_val;
10407
10493
 
@@ -10550,7 +10636,7 @@ static void upb_JsonEncode_Float(jsonenc* e, float val) {
10550
10636
 
10551
10637
  static void jsonenc_wrapper(jsonenc* e, const upb_Message* msg,
10552
10638
  const upb_MessageDef* m) {
10553
- const upb_FieldDef* val_f = upb_MessageDef_FindFieldByNumberWithSize(m, 1);
10639
+ const upb_FieldDef* val_f = upb_MessageDef_FindFieldByNumber(m, 1);
10554
10640
  upb_MessageValue val = upb_Message_Get(msg, val_f);
10555
10641
  jsonenc_scalar(e, val, val_f);
10556
10642
  }
@@ -10594,9 +10680,8 @@ badurl:
10594
10680
 
10595
10681
  static void jsonenc_any(jsonenc* e, const upb_Message* msg,
10596
10682
  const upb_MessageDef* m) {
10597
- const upb_FieldDef* type_url_f =
10598
- upb_MessageDef_FindFieldByNumberWithSize(m, 1);
10599
- const upb_FieldDef* value_f = upb_MessageDef_FindFieldByNumberWithSize(m, 2);
10683
+ const upb_FieldDef* type_url_f = upb_MessageDef_FindFieldByNumber(m, 1);
10684
+ const upb_FieldDef* value_f = upb_MessageDef_FindFieldByNumber(m, 2);
10600
10685
  upb_StringView type_url = upb_Message_Get(msg, type_url_f).str_val;
10601
10686
  upb_StringView value = upb_Message_Get(msg, value_f).str_val;
10602
10687
  const upb_MessageDef* any_m = jsonenc_getanymsg(e, type_url);
@@ -10655,7 +10740,7 @@ static void jsonenc_fieldpath(jsonenc* e, upb_StringView path) {
10655
10740
 
10656
10741
  static void jsonenc_fieldmask(jsonenc* e, const upb_Message* msg,
10657
10742
  const upb_MessageDef* m) {
10658
- const upb_FieldDef* paths_f = upb_MessageDef_FindFieldByNumberWithSize(m, 1);
10743
+ const upb_FieldDef* paths_f = upb_MessageDef_FindFieldByNumber(m, 1);
10659
10744
  const upb_Array* paths = upb_Message_Get(msg, paths_f).array_val;
10660
10745
  bool first = true;
10661
10746
  size_t i, n = 0;
@@ -10674,11 +10759,10 @@ static void jsonenc_fieldmask(jsonenc* e, const upb_Message* msg,
10674
10759
 
10675
10760
  static void jsonenc_struct(jsonenc* e, const upb_Message* msg,
10676
10761
  const upb_MessageDef* m) {
10677
- const upb_FieldDef* fields_f = upb_MessageDef_FindFieldByNumberWithSize(m, 1);
10762
+ const upb_FieldDef* fields_f = upb_MessageDef_FindFieldByNumber(m, 1);
10678
10763
  const upb_Map* fields = upb_Message_Get(msg, fields_f).map_val;
10679
10764
  const upb_MessageDef* entry_m = upb_FieldDef_MessageSubDef(fields_f);
10680
- const upb_FieldDef* value_f =
10681
- upb_MessageDef_FindFieldByNumberWithSize(entry_m, 2);
10765
+ const upb_FieldDef* value_f = upb_MessageDef_FindFieldByNumber(entry_m, 2);
10682
10766
  size_t iter = kUpb_Map_Begin;
10683
10767
  bool first = true;
10684
10768
 
@@ -10701,7 +10785,7 @@ static void jsonenc_struct(jsonenc* e, const upb_Message* msg,
10701
10785
 
10702
10786
  static void jsonenc_listvalue(jsonenc* e, const upb_Message* msg,
10703
10787
  const upb_MessageDef* m) {
10704
- const upb_FieldDef* values_f = upb_MessageDef_FindFieldByNumberWithSize(m, 1);
10788
+ const upb_FieldDef* values_f = upb_MessageDef_FindFieldByNumber(m, 1);
10705
10789
  const upb_MessageDef* values_m = upb_FieldDef_MessageSubDef(values_f);
10706
10790
  const upb_Array* values = upb_Message_Get(msg, values_f).array_val;
10707
10791
  size_t i;
@@ -10883,10 +10967,8 @@ static void jsonenc_array(jsonenc* e, const upb_Array* arr,
10883
10967
 
10884
10968
  static void jsonenc_map(jsonenc* e, const upb_Map* map, const upb_FieldDef* f) {
10885
10969
  const upb_MessageDef* entry = upb_FieldDef_MessageSubDef(f);
10886
- const upb_FieldDef* key_f =
10887
- upb_MessageDef_FindFieldByNumberWithSize(entry, 1);
10888
- const upb_FieldDef* val_f =
10889
- upb_MessageDef_FindFieldByNumberWithSize(entry, 2);
10970
+ const upb_FieldDef* key_f = upb_MessageDef_FindFieldByNumber(entry, 1);
10971
+ const upb_FieldDef* val_f = upb_MessageDef_FindFieldByNumber(entry, 2);
10890
10972
  size_t iter = kUpb_Map_Begin;
10891
10973
  bool first = true;
10892
10974
 
@@ -11030,3 +11112,4 @@ size_t upb_JsonEncode(const upb_Message* msg, const upb_MessageDef* m,
11030
11112
  #undef UPB_POISON_MEMORY_REGION
11031
11113
  #undef UPB_UNPOISON_MEMORY_REGION
11032
11114
  #undef UPB_ASAN
11115
+ #undef UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3