From 763a3f62930d41bb8993b9c8f9225f7a861300d4 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 22 Sep 2020 14:11:16 -0700 Subject: [PATCH 01/88] WIP. --- BUILD | 1 + upb/decode.c | 9 -- upb/decode.h | 23 +++++ upb/decode_fast.c | 210 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 234 insertions(+), 9 deletions(-) create mode 100644 upb/decode_fast.c diff --git a/BUILD b/BUILD index 90aa7a7919..f6217178a8 100644 --- a/BUILD +++ b/BUILD @@ -79,6 +79,7 @@ cc_library( name = "upb", srcs = [ "upb/decode.c", + "upb/decode_fast.c", "upb/encode.c", "upb/msg.c", "upb/msg.h", diff --git a/upb/decode.c b/upb/decode.c index 416ea25cc5..907bcb73d8 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -134,15 +134,6 @@ static const int8_t delim_ops[37] = { OP_VARPCK_LG2(3), /* REPEATED SINT64 */ }; -/* Data pertaining to the parse. */ -typedef struct { - const char *limit; /* End of delimited region or end of buffer. */ - upb_arena *arena; - int depth; - uint32_t end_group; /* Set to field number of END_GROUP tag, if any. */ - jmp_buf err; -} upb_decstate; - typedef union { bool bool_val; uint32_t uint32_val; diff --git a/upb/decode.h b/upb/decode.h index 9de8638de5..7f7a363ea4 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -5,6 +5,8 @@ #ifndef UPB_DECODE_H_ #define UPB_DECODE_H_ +#include + #include "upb/msg.h" #ifdef __cplusplus @@ -14,6 +16,27 @@ extern "C" { bool upb_decode(const char *buf, size_t size, upb_msg *msg, const upb_msglayout *l, upb_arena *arena); +/* Internal only: data pertaining to the parse. */ +typedef struct { + const char *limit; /* End of delimited region or end of buffer. */ + const char *fastlimit; /* End of delimited region or end of buffer. */ + upb_arena *arena; + int depth; + uint32_t end_group; /* Set to field number of END_GROUP tag, if any. */ + jmp_buf err; +} upb_decstate; + +struct upb_fasttable; + +typedef const char *_upb_field_parser(upb_decstate *d, const char *ptr, + upb_msg *msg, struct upb_fasttable *table, + uint64_t hasbits, uint64_t data); + +typedef struct upb_fasttable { + _upb_field_parser *field_parser[16]; + uint64_t field_data[16]; +} upb_fasttable; + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/upb/decode_fast.c b/upb/decode_fast.c new file mode 100644 index 0000000000..070ae68e13 --- /dev/null +++ b/upb/decode_fast.c @@ -0,0 +1,210 @@ + +#include "upb/decode.h" + +#include "upb/port_def.inc" + +#define UPB_PARSE_PARAMS \ + upb_decstate *d, const char *ptr, upb_msg *msg, upb_fasttable *table, \ + uint64_t hasbits, uint64_t data + +UPB_NOINLINE +const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, + upb_fasttable *table, uint64_t hasbits) { + uint16_t tag; + uint64_t data; + if (UPB_UNLIKELY(ptr >= d->fastlimit)) return ptr; + memcpy(&tag, ptr, 2); + data = table->field_data[(tag & 0xf7) >> 3] ^ tag; + return table->field_parser[(tag & 0xf7) >> 3](d, ptr, msg, table, hasbits, + data); +} + +UPB_FORCEINLINE bool fastdecode_checktag(uint64_t data, int tagbytes) { + const char zeros[2] = {0, 0}; + return memcmp(&data, &zeros, tagbytes) == 0; +} + +UPB_FORCEINLINE +static const char *fastdecode_scalarfixed(UPB_PARSE_PARAMS, int tagbytes, + int valbytes) { + char *field; + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) return ptr; + hasbits |= data; + field = (char*)msg + (data >> 48); + memcpy(field, ptr + tagbytes, valbytes); + return fastdecode_dispatch(d, ptr + tagbytes + valbytes, msg, table, hasbits); +} + +const char *upb_psf64_1bt(UPB_PARSE_PARAMS) { + return fastdecode_scalarfixed(d, ptr, msg, table, hasbits, data, 1, 8); +} + +const char *upb_psf64_2bt(UPB_PARSE_PARAMS) { + return fastdecode_scalarfixed(d, ptr, msg, table, hasbits, data, 2, 8); +} + +const char *upb_psf32_1bt(UPB_PARSE_PARAMS) { + return fastdecode_scalarfixed(d, ptr, msg, table, hasbits, data, 1, 4); +} + +const char *upb_psf32_2bt(UPB_PARSE_PARAMS) { + return fastdecode_scalarfixed(d, ptr, msg, table, hasbits, data, 2, 4); +} + +UPB_FORCEINLINE +static const char *fastdecode_longvarint_impl(UPB_PARSE_PARAMS, int64_t res1, + int valbytes) { + char *field = (char *)data; + + // The algorithm relies on sign extension to set all high bits when the varint + // continues. This way it can use "and" to aggregate in to the result. + const int8_t *p = (const int8_t*)(ptr); + // However this requires the low bits after shifting to be 1's as well. On + // x86_64 a shld from a single register filled with enough 1's in the high + // bits can accomplish all this in one instruction. It so happens that res1 + // has 57 high bits of ones, which is enough for the largest shift done. + assert(res1 >> 7 == -1); + uint64_t ones = res1; // save the useful high bit 1's in res1 + uint64_t byte; + int64_t res2, res3; + int sign_bit; + +#define SHLD(n) byte = ((byte << (n * 7)) | (ones >> (64 - (n * 7)))) + + // Micro benchmarks show a substantial improvement to capture the sign + // of the result in the case of just assigning the result of the shift + // (ie first 2 steps). +#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__) +#define SHLD_SIGN(n) \ + __asm__("shldq %3, %2, %1" \ + : "=@ccs"(sign_bit), "+r"(byte) \ + : "r"(ones), "i"(n * 7)) +#else +#define SHLD_SIGN(n) \ + do { \ + SHLD(n); \ + sign_bit = (int64_t)(byte) < 0; \ + } while (0) +#endif + byte = p[1]; + SHLD_SIGN(1); + res2 = byte; + if (!sign_bit) goto done2; + byte = p[2]; + SHLD_SIGN(2); + res3 = byte; + if (!sign_bit) goto done3; + byte = p[3]; + SHLD(3); + res1 &= byte; + if (res1 >= 0) goto done4; + byte = p[4]; + SHLD(4); + res2 &= byte; + if (res2 >= 0) goto done5; + byte = p[5]; + SHLD(5); + res3 &= byte; + if (res3 >= 0) goto done6; + byte = p[6]; + SHLD(6); + res1 &= byte; + if (res1 >= 0) goto done7; + byte = p[7]; + SHLD(7); + res2 &= byte; + if (res2 >= 0) goto done8; + byte = p[8]; + SHLD(8); + res3 &= byte; + if (res3 >= 0) goto done9; + byte = p[9]; + // Last byte only contains 0 or 1 for valid 64bit varints. If it's 0 it's + // a denormalized varint that shouldn't happen. The continuation bit of byte + // 9 has already the right value hence just expect byte to be 1. + if (UPB_LIKELY(byte == 1)) goto done10; + if (byte == 0) { + res3 ^= (uint64_t)(1) << 63; + goto done10; + } + + return NULL; // Value is too long to be a varint64 + +#define DONE(n) \ + done##n : { \ + uint64_t val = res1 & res2 & res3; \ + memcpy(field, &val, valbytes); \ + return fastdecode_dispatch(d, (const char *)p + n, msg, table, hasbits); \ + }; + +done2 : { + uint64_t val = res1 & res2; + memcpy(field, &val, valbytes); + return fastdecode_dispatch(d, (const char*)p + 2, msg, table, hasbits); +} + + DONE(3) + DONE(4) + DONE(5) + DONE(6) + DONE(7) + DONE(8) + DONE(9) + DONE(10) +#undef DONE +} + +UPB_NOINLINE +static const char *fastdecode_longvarint32(UPB_PARSE_PARAMS, int64_t val) { + return fastdecode_longvarint_impl(d, ptr, msg, table, hasbits, data, val, 4); +} + +UPB_NOINLINE +static const char *fastdecode_longvarint64(UPB_PARSE_PARAMS, int64_t val) { + return fastdecode_longvarint_impl(d, ptr, msg, table, hasbits, data, val, 8); +} + +UPB_FORCEINLINE +static const char *fastdecode_longvarint(UPB_PARSE_PARAMS, int64_t val, + int valbytes) { + if (valbytes == 4) { + return fastdecode_longvarint32(d, ptr, msg, table, hasbits, data, val); + } else if (valbytes == 8) { + return fastdecode_longvarint64(d, ptr, msg, table, hasbits, data, val); + } + UPB_UNREACHABLE(); +} + +UPB_FORCEINLINE +static const char *fastdecode_scalarvarint(UPB_PARSE_PARAMS, int tagbytes, + int valbytes) { + int64_t val; + void *field; + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) return ptr; + ptr += tagbytes; + hasbits |= data; + field = (char*)msg + (data >> 48); + val = *ptr; + if (UPB_UNLIKELY(val < 0)) { + return fastdecode_longvarint(d, ptr, msg, table, hasbits, (uint64_t)field, + val, valbytes); + } + memcpy(field, &val, valbytes); + return fastdecode_dispatch(d, ptr + 1, msg, table, hasbits); +} + +const char *upb_psv32_1bt(UPB_PARSE_PARAMS) { + return fastdecode_scalarvarint(d, ptr, msg, table, hasbits, data, 1, 4); +} + +const char *upb_psv32_2bt(UPB_PARSE_PARAMS) { + return fastdecode_scalarvarint(d, ptr, msg, table, hasbits, data, 2, 4); +} + +const char *upb_psv64_1bt(UPB_PARSE_PARAMS) { + return fastdecode_scalarvarint(d, ptr, msg, table, hasbits, data, 1, 8); +} + +const char *upb_psv64_2bt(UPB_PARSE_PARAMS) { + return fastdecode_scalarvarint(d, ptr, msg, table, hasbits, data, 2, 8); +} From 34b98bc030c69a061c294f4dc983bcde41a9a7a8 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 22 Sep 2020 14:29:24 -0700 Subject: [PATCH 02/88] Avoid passing too many params to fallback. --- upb/decode_fast.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 070ae68e13..2b565a4da7 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -52,22 +52,23 @@ const char *upb_psf32_2bt(UPB_PARSE_PARAMS) { } UPB_FORCEINLINE -static const char *fastdecode_longvarint_impl(UPB_PARSE_PARAMS, int64_t res1, - int valbytes) { +static const char *fastdecode_longvarint_impl(UPB_PARSE_PARAMS, int valbytes) { char *field = (char *)data; // The algorithm relies on sign extension to set all high bits when the varint // continues. This way it can use "and" to aggregate in to the result. const int8_t *p = (const int8_t*)(ptr); + int64_t res1 = *p; + uint64_t ones = res1; // save the useful high bit 1's in res1 + uint64_t byte; + int64_t res2, res3; + int sign_bit; + // However this requires the low bits after shifting to be 1's as well. On // x86_64 a shld from a single register filled with enough 1's in the high // bits can accomplish all this in one instruction. It so happens that res1 // has 57 high bits of ones, which is enough for the largest shift done. assert(res1 >> 7 == -1); - uint64_t ones = res1; // save the useful high bit 1's in res1 - uint64_t byte; - int64_t res2, res3; - int sign_bit; #define SHLD(n) byte = ((byte << (n * 7)) | (ones >> (64 - (n * 7)))) @@ -155,22 +156,21 @@ done2 : { } UPB_NOINLINE -static const char *fastdecode_longvarint32(UPB_PARSE_PARAMS, int64_t val) { - return fastdecode_longvarint_impl(d, ptr, msg, table, hasbits, data, val, 4); +static const char *fastdecode_longvarint32(UPB_PARSE_PARAMS) { + return fastdecode_longvarint_impl(d, ptr, msg, table, hasbits, data, 4); } UPB_NOINLINE -static const char *fastdecode_longvarint64(UPB_PARSE_PARAMS, int64_t val) { - return fastdecode_longvarint_impl(d, ptr, msg, table, hasbits, data, val, 8); +static const char *fastdecode_longvarint64(UPB_PARSE_PARAMS) { + return fastdecode_longvarint_impl(d, ptr, msg, table, hasbits, data, 8); } UPB_FORCEINLINE -static const char *fastdecode_longvarint(UPB_PARSE_PARAMS, int64_t val, - int valbytes) { +static const char *fastdecode_longvarint(UPB_PARSE_PARAMS, int valbytes) { if (valbytes == 4) { - return fastdecode_longvarint32(d, ptr, msg, table, hasbits, data, val); + return fastdecode_longvarint32(d, ptr, msg, table, hasbits, data); } else if (valbytes == 8) { - return fastdecode_longvarint64(d, ptr, msg, table, hasbits, data, val); + return fastdecode_longvarint64(d, ptr, msg, table, hasbits, data); } UPB_UNREACHABLE(); } @@ -178,17 +178,17 @@ static const char *fastdecode_longvarint(UPB_PARSE_PARAMS, int64_t val, UPB_FORCEINLINE static const char *fastdecode_scalarvarint(UPB_PARSE_PARAMS, int tagbytes, int valbytes) { - int64_t val; + uint64_t val = 0; void *field; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) return ptr; ptr += tagbytes; hasbits |= data; field = (char*)msg + (data >> 48); - val = *ptr; - if (UPB_UNLIKELY(val < 0)) { + if (UPB_UNLIKELY(*ptr < 0)) { return fastdecode_longvarint(d, ptr, msg, table, hasbits, (uint64_t)field, - val, valbytes); + valbytes); } + val = *ptr; memcpy(field, &val, valbytes); return fastdecode_dispatch(d, ptr + 1, msg, table, hasbits); } From 26abaa2345a8f8320c1371a40a6d015eb35c779f Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 29 Sep 2020 22:30:12 -0700 Subject: [PATCH 03/88] WIP. --- upb/decode.c | 181 +++++++++-------- upb/decode.h | 28 +-- upb/decode_fast.c | 490 +++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 552 insertions(+), 147 deletions(-) diff --git a/upb/decode.c b/upb/decode.c index 907bcb73d8..f3b151aadd 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -491,101 +491,108 @@ static const char *decode_tomsg(upb_decstate *d, const char *ptr, upb_msg *msg, return ptr; } -static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, - const upb_msglayout *layout) { - while (ptr < d->limit) { - uint32_t tag; - const upb_msglayout_field *field; - int field_number; - int wire_type; - const char *field_start = ptr; - wireval val; - int op; - - ptr = decode_varint32(d, ptr, d->limit, &tag); - field_number = tag >> 3; - wire_type = tag & 7; - - field = upb_find_field(layout, field_number); - - switch (wire_type) { - case UPB_WIRE_TYPE_VARINT: - ptr = decode_varint64(d, ptr, d->limit, &val.uint64_val); - op = varint_ops[field->descriptortype]; - decode_munge(field->descriptortype, &val); - break; - case UPB_WIRE_TYPE_32BIT: - if (d->limit - ptr < 4) decode_err(d); - memcpy(&val.uint32_val, ptr, 4); - val.uint32_val = _upb_be_swap32(val.uint32_val); - ptr += 4; - op = OP_SCALAR_LG2(2); - if (((1 << field->descriptortype) & fixed32_ok) == 0) goto unknown; - break; - case UPB_WIRE_TYPE_64BIT: - if (d->limit - ptr < 8) decode_err(d); - memcpy(&val.uint64_val, ptr, 8); - val.uint64_val = _upb_be_swap64(val.uint64_val); - ptr += 8; - op = OP_SCALAR_LG2(3); - if (((1 << field->descriptortype) & fixed64_ok) == 0) goto unknown; - break; - case UPB_WIRE_TYPE_DELIMITED: { - uint32_t size; - int ndx = field->descriptortype; - if (_upb_isrepeated(field)) ndx += 18; - ptr = decode_varint32(d, ptr, d->limit, &size); - if (size >= INT32_MAX || (size_t)(d->limit - ptr) < size) { - decode_err(d); /* Length overflow. */ - } - val.str_val.data = ptr; - val.str_val.size = size; - ptr += size; - op = delim_ops[ndx]; - break; +const char *decode_field(upb_decstate *d, const char *ptr, upb_msg *msg, + const upb_msglayout *layout) { + uint32_t tag; + const upb_msglayout_field *field; + int field_number; + int wire_type; + const char *field_start = ptr; + wireval val; + int op; + + ptr = decode_varint32(d, ptr, d->limit, &tag); + field_number = tag >> 3; + wire_type = tag & 7; + + field = upb_find_field(layout, field_number); + + switch (wire_type) { + case UPB_WIRE_TYPE_VARINT: + ptr = decode_varint64(d, ptr, d->limit, &val.uint64_val); + op = varint_ops[field->descriptortype]; + decode_munge(field->descriptortype, &val); + break; + case UPB_WIRE_TYPE_32BIT: + if (d->limit - ptr < 4) decode_err(d); + memcpy(&val.uint32_val, ptr, 4); + val.uint32_val = _upb_be_swap32(val.uint32_val); + ptr += 4; + op = OP_SCALAR_LG2(2); + if (((1 << field->descriptortype) & fixed32_ok) == 0) goto unknown; + break; + case UPB_WIRE_TYPE_64BIT: + if (d->limit - ptr < 8) decode_err(d); + memcpy(&val.uint64_val, ptr, 8); + val.uint64_val = _upb_be_swap64(val.uint64_val); + ptr += 8; + op = OP_SCALAR_LG2(3); + if (((1 << field->descriptortype) & fixed64_ok) == 0) goto unknown; + break; + case UPB_WIRE_TYPE_DELIMITED: { + uint32_t size; + int ndx = field->descriptortype; + if (_upb_isrepeated(field)) ndx += 18; + ptr = decode_varint32(d, ptr, d->limit, &size); + if (size >= INT32_MAX || (size_t)(d->limit - ptr) < size) { + decode_err(d); /* Length overflow. */ } - case UPB_WIRE_TYPE_START_GROUP: - val.uint32_val = field_number; - op = OP_SUBMSG; - if (field->descriptortype != UPB_DTYPE_GROUP) goto unknown; + val.str_val.data = ptr; + val.str_val.size = size; + ptr += size; + op = delim_ops[ndx]; + break; + } + case UPB_WIRE_TYPE_START_GROUP: + val.uint32_val = field_number; + op = OP_SUBMSG; + if (field->descriptortype != UPB_DTYPE_GROUP) goto unknown; + break; + case UPB_WIRE_TYPE_END_GROUP: + d->end_group = field_number; + return ptr; + default: + decode_err(d); + } + + if (op >= 0) { + /* Parse, using op for dispatch. */ + switch (field->label) { + case UPB_LABEL_REPEATED: + case _UPB_LABEL_PACKED: + ptr = decode_toarray(d, ptr, msg, layout, field, val, op); + break; + case _UPB_LABEL_MAP: + decode_tomap(d, msg, layout, field, val); break; - case UPB_WIRE_TYPE_END_GROUP: - d->end_group = field_number; - return ptr; default: - decode_err(d); + ptr = decode_tomsg(d, ptr, msg, layout, field, val, op); + break; } - - if (op >= 0) { - /* Parse, using op for dispatch. */ - switch (field->label) { - case UPB_LABEL_REPEATED: - case _UPB_LABEL_PACKED: - ptr = decode_toarray(d, ptr, msg, layout, field, val, op); - break; - case _UPB_LABEL_MAP: - decode_tomap(d, msg, layout, field, val); - break; - default: - ptr = decode_tomsg(d, ptr, msg, layout, field, val, op); - break; - } - } else { - unknown: - /* Skip unknown field. */ - if (field_number == 0) decode_err(d); - if (wire_type == UPB_WIRE_TYPE_START_GROUP) { - ptr = decode_group(d, ptr, NULL, NULL, field_number); - } - if (msg) { - if (!_upb_msg_addunknown(msg, field_start, ptr - field_start, - d->arena)) { - decode_err(d); - } + } else { + unknown: + /* Skip unknown field. */ + if (field_number == 0) decode_err(d); + if (wire_type == UPB_WIRE_TYPE_START_GROUP) { + ptr = decode_group(d, ptr, NULL, NULL, field_number); + } + if (msg) { + if (!_upb_msg_addunknown(msg, field_start, ptr - field_start, + d->arena)) { + decode_err(d); } } } + return ptr; +} + +static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, + const upb_msglayout *layout) { + while (ptr < d->limit) { + ptr = decode_field(d, ptr, msg, layout); + } + if (ptr != d->limit) decode_err(d); return ptr; } diff --git a/upb/decode.h b/upb/decode.h index 7f7a363ea4..c6387190d2 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -16,27 +16,33 @@ extern "C" { bool upb_decode(const char *buf, size_t size, upb_msg *msg, const upb_msglayout *l, upb_arena *arena); -/* Internal only: data pertaining to the parse. */ -typedef struct { - const char *limit; /* End of delimited region or end of buffer. */ - const char *fastlimit; /* End of delimited region or end of buffer. */ - upb_arena *arena; - int depth; - uint32_t end_group; /* Set to field number of END_GROUP tag, if any. */ - jmp_buf err; -} upb_decstate; - struct upb_fasttable; +struct upb_decstate; -typedef const char *_upb_field_parser(upb_decstate *d, const char *ptr, +typedef const char *_upb_field_parser(struct upb_decstate *d, const char *ptr, upb_msg *msg, struct upb_fasttable *table, uint64_t hasbits, uint64_t data); typedef struct upb_fasttable { _upb_field_parser *field_parser[16]; uint64_t field_data[16]; + _upb_field_parser *fallback; } upb_fasttable; +/* Internal only: data pertaining to the parse. */ +typedef struct upb_decstate { + char *arena_ptr, *arena_end; + const void *rep_end; + const char *limit; /* End of delimited region or end of buffer. */ + const char *fastlimit; /* End of delimited region or end of buffer. */ + upb_array *arr; + _upb_field_parser *resume; + upb_arena *arena; + int depth; + uint32_t end_group; /* Set to field number of END_GROUP tag, if any. */ + jmp_buf err; +} upb_decstate; + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 2b565a4da7..6d8952292c 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -7,54 +7,411 @@ upb_decstate *d, const char *ptr, upb_msg *msg, upb_fasttable *table, \ uint64_t hasbits, uint64_t data +#define UPB_PARSE_ARGS d, ptr, msg, table, hasbits, data + +const char *fastdecode_err(upb_decstate *d); + +const char *fastdecode_reallocarr(upb_decstate *d, const char *ptr, + upb_msg *msg, upb_fasttable *table, + int elem_size); + UPB_NOINLINE -const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, - upb_fasttable *table, uint64_t hasbits) { +static const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, + upb_msg *msg, upb_fasttable *table, + uint64_t hasbits) { uint16_t tag; uint64_t data; if (UPB_UNLIKELY(ptr >= d->fastlimit)) return ptr; memcpy(&tag, ptr, 2); data = table->field_data[(tag & 0xf7) >> 3] ^ tag; - return table->field_parser[(tag & 0xf7) >> 3](d, ptr, msg, table, hasbits, - data); + return table->field_parser[(tag & 0xf7) >> 3](UPB_PARSE_ARGS); +} + +#if 0 +UPB_NOINLINE +static const char *fastdecode_parseloop(upb_decstate *d, const char *ptr, + upb_msg *msg, upb_fasttable *table) { + uint64_t hasbits = 0; + while (ptr < d->fastlimit) { + ptr = fastdecode_dispatch(d, ptr, msg, table, hasbits); + /*ptr = decode_field(d, ptr, msg, table->layout);*/ + } + return ptr; +} +#endif + +UPB_FORCEINLINE static bool fastdecode_checktag(uint64_t data, int tagbytes) { + if (tagbytes == 1) { + return (data & 0xff) == 0; + } else { + return (data & 0xffff) == 0; + } +} + +UPB_FORCEINLINE static uint16_t fastdecode_readtag(const char *ptr, int tagbytes) { + uint16_t ret = 0; + memcpy(&ret, ptr, tagbytes); + return ret; } -UPB_FORCEINLINE bool fastdecode_checktag(uint64_t data, int tagbytes) { - const char zeros[2] = {0, 0}; - return memcmp(&data, &zeros, tagbytes) == 0; +typedef enum { + CARD_s = 0, + CARD_o = 1, + CARD_r = 2, + CARD_p = 3 +} upb_card; + +UPB_FORCEINLINE +static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, + uint64_t data, uint64_t *hasbits, + uint16_t *expected_tag, int *elem_avail, + upb_card card, int tagbytes, int valbytes) { + void *field = (char *)msg + (data >> 48); + + switch (card) { + case CARD_s: + *hasbits |= data; + return field; + case CARD_o: { + uint32_t *case_ptr = UPB_PTR_AT(msg, (data >> 16) & 0xffff, uint32_t); + *case_ptr = (data >> 32) & 0xffff; + return field; + } + case CARD_r: { + upb_array **arr_p = field; + upb_array *arr; + *hasbits >>= 16; + *(uint32_t*)msg |= *hasbits; + *hasbits = 0; + if (UPB_LIKELY(!*arr_p)) { + //(void)d; + size_t need = (valbytes * 4) + sizeof(upb_array); + if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < need)) { + *elem_avail = 0; + return NULL; + } + arr = (void*)d->arena_ptr; + field = arr + 1; + arr->data = (uintptr_t)field; + *arr_p = arr; + arr->size = 4; + arr->len = 0; + *elem_avail = 4; + d->arena_ptr += need; + } else { + arr = *arr_p; + field = _upb_array_ptr(arr); + *elem_avail = arr->size - arr->len; + field = (char*)field + (arr->len * valbytes); + arr->len = arr->size; + } + *expected_tag = fastdecode_readtag(ptr, tagbytes); + d->arr = arr; + return field; + } + default: + UPB_UNREACHABLE(); + } +} + +UPB_FORCEINLINE +static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, + upb_card card) { + upb_strview *dst; + uint16_t expected_tag; + int elem_avail; + + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + return table->fallback(UPB_PARSE_ARGS); + } + + dst = fastdecode_getfield(d, ptr, msg, data, &hasbits, &expected_tag, + &elem_avail, card, tagbytes, sizeof(upb_strview)); + +again: + if (card == CARD_r) { + if (UPB_UNLIKELY(elem_avail == 0)) { + return fastdecode_reallocarr(d, ptr, msg, table, sizeof(upb_strview)); + } + } + + { + int64_t len = ptr[tagbytes]; + if (UPB_UNLIKELY(len < 0)) { + if (card == CARD_r) { + d->arr->len -= elem_avail; + } + return ptr; + } + ptr += tagbytes + 1; + dst->data = ptr; + dst->size = len; + ptr += len; + if (UPB_UNLIKELY(ptr > d->limit)) { + return fastdecode_err(d); + } + } + + + if (card == CARD_r) { + if (UPB_LIKELY(ptr < d->fastlimit) && + fastdecode_readtag(ptr, tagbytes) == expected_tag) { + elem_avail--; + dst++; + goto again; + } + d->arr->len -= elem_avail; + } + + return fastdecode_dispatch(d, ptr, msg, table, hasbits); +} + +const char *upb_pss_1bt(UPB_PARSE_PARAMS) { + return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_s); +} + +const char *upb_pos_1bt(UPB_PARSE_PARAMS) { + return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_o); +} + +const char *upb_prs_1bt(UPB_PARSE_PARAMS) { + return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_r); +} + +UPB_FORCEINLINE +static const char *fastdecode_fixed(UPB_PARSE_PARAMS, int tagbytes, int valbytes, + upb_card card) { + char *dst; + uint16_t expected_tag; + int elem_avail; + + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + return ptr; + } + + dst = fastdecode_getfield(d, ptr, msg, data, &hasbits, &expected_tag, + &elem_avail, card, tagbytes, valbytes); + +again: + if (card == CARD_r) { + if (UPB_UNLIKELY(elem_avail == 0)) { + return fastdecode_reallocarr(d, ptr, msg, table, valbytes); + } + } + + { + ptr += tagbytes; + memcpy(dst, ptr, valbytes); + ptr += valbytes; + } + + if (card == CARD_r) { + if (UPB_LIKELY(ptr < d->fastlimit) && + fastdecode_readtag(ptr, tagbytes) == expected_tag) { + elem_avail--; + dst += valbytes; + goto again; + } + d->arr->len -= elem_avail; + } + + return fastdecode_dispatch(d, ptr, msg, table, hasbits); +} + +const char *upb_psf8_1bt(UPB_PARSE_PARAMS) { + return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_s); +} + +const char *upb_pof8_1bt(UPB_PARSE_PARAMS) { + return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_o); +} + +const char *upb_prf8_1bt(UPB_PARSE_PARAMS) { + return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_r); +} + +#if 0 +UPB_FORCEINLINE +static const char *fastdecode_repeatedfixed(UPB_PARSE_PARAMS, int tagbytes, + int valbytes, _upb_field_parser *fallback) { + char *dst; + uint16_t expected_tag; + upb_array **arr_p; + upb_array *arr; + + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + if (fallback) { + // Patch data to amtch packed wiretype. + data ^= 0x2 ^ (valbytes == 4 ? 5 : 1); + fallback(UPB_PARSE_ARGS); + } else { + return table->fallback(UPB_PARSE_ARGS); + } + } + + arr_p = UPB_PTR_AT(msg, (data >> 48), upb_array*); + arr = *arr_p; + if (UPB_UNLIKELY(!arr || arr->size - arr->len < 4)) { + return fastdecode_allocarr(UPB_PARSE_ARGS); + } + dst = _upb_array_ptr(arr); + d->dstend = dst + (arr->size * valbytes); + dst += (arr->len * valbytes); + expected_tag = fastdecode_readtag(ptr, tagbytes); + + do { + ptr += tagbytes; + //fastdecode_reserve(d, arr, &dst, &dstend); + if (UPB_UNLIKELY(dst == d->dstend)) { + return fastdecode_reallocarr(UPB_PARSE_ARGS); + } + memcpy(dst, ptr, valbytes); + dst += valbytes; + ptr += valbytes; + /* + if (UPB_UNLIKELY(ptr >= d->fastlimit)) { + arr->len = (dst - (char*)_upb_array_ptr(arr)) / valbytes; + return ptr; + } + */ + } while (fastdecode_readtag(ptr, tagbytes) == expected_tag); + + return fastdecode_dispatch(d, ptr, msg, table, hasbits); } UPB_FORCEINLINE static const char *fastdecode_scalarfixed(UPB_PARSE_PARAMS, int tagbytes, - int valbytes) { + int valbytes, upb_card card) { char *field; - if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) return ptr; - hasbits |= data; - field = (char*)msg + (data >> 48); + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + return table->fallback(UPB_PARSE_ARGS); + } + field = fastdecode_getfield(msg, data, &hasbits, card); memcpy(field, ptr + tagbytes, valbytes); - return fastdecode_dispatch(d, ptr + tagbytes + valbytes, msg, table, hasbits); + ptr += tagbytes + valbytes; + return fastdecode_dispatch(d, ptr, msg, table, hasbits); } -const char *upb_psf64_1bt(UPB_PARSE_PARAMS) { - return fastdecode_scalarfixed(d, ptr, msg, table, hasbits, data, 1, 8); + arr_p = UPB_PTR_AT(msg, (data >> 48), upb_array*); + if (UPB_UNLIKELY(!arr_p)) goto alloc_arr; + arr = *arr_p; + dst = (char*)_upb_array_ptr(arr); + dstend = dst + arr->size; + dst += arr->len; + +const char *fastdecode_allocarr(UPB_PARSE_PARAMS) + ; + +UPB_FORCEINLINE +static void fastdecode_getarr(upb_decstate *d, upb_msg *msg, uint64_t data, + int valbytes, char **dst) { + upb_array **arr_p = UPB_PTR_AT(msg, (data >> 48), upb_array*); + upb_array *arr = *arr_p; + /* + if (UPB_UNLIKELY(!arr || arr->size - arr->len < 4)) { + fastdecode_allocarr(d, arr_p); + } + */ + (void)d; + *dst = _upb_array_ptr(arr); + d->dstend = *dst + (arr->size * valbytes); + *dst += (arr->len * valbytes); } -const char *upb_psf64_2bt(UPB_PARSE_PARAMS) { - return fastdecode_scalarfixed(d, ptr, msg, table, hasbits, data, 2, 8); +UPB_FORCEINLINE +static const char *fastdecode_repeatedfixed(UPB_PARSE_PARAMS, int tagbytes, + int valbytes, _upb_field_parser *fallback) { + char *dst; + uint16_t expected_tag; + upb_array **arr_p; + upb_array *arr; + + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + if (fallback) { + // Patch data to amtch packed wiretype. + data ^= 0x2 ^ (valbytes == 4 ? 5 : 1); + fallback(UPB_PARSE_ARGS); + } else { + return table->fallback(UPB_PARSE_ARGS); + } + } + + arr_p = UPB_PTR_AT(msg, (data >> 48), upb_array*); + arr = *arr_p; + if (UPB_UNLIKELY(!arr || arr->size - arr->len < 4)) { + return fastdecode_allocarr(UPB_PARSE_ARGS); + } + dst = _upb_array_ptr(arr); + d->dstend = dst + (arr->size * valbytes); + dst += (arr->len * valbytes); + expected_tag = fastdecode_readtag(ptr, tagbytes); + + do { + ptr += tagbytes; + //fastdecode_reserve(d, arr, &dst, &dstend); + if (UPB_UNLIKELY(dst == d->dstend)) { + return fastdecode_reallocarr(UPB_PARSE_ARGS); + } + memcpy(dst, ptr, valbytes); + dst += valbytes; + ptr += valbytes; + /* + if (UPB_UNLIKELY(ptr >= d->fastlimit)) { + arr->len = (dst - (char*)_upb_array_ptr(arr)) / valbytes; + return ptr; + } + */ + } while (fastdecode_readtag(ptr, tagbytes) == expected_tag); + + return fastdecode_dispatch(d, ptr, msg, table, hasbits); } -const char *upb_psf32_1bt(UPB_PARSE_PARAMS) { - return fastdecode_scalarfixed(d, ptr, msg, table, hasbits, data, 1, 4); +UPB_NOINLINE +const char *upb_prf8_1bt(UPB_PARSE_PARAMS) { + return fastdecode_repeatedfixed(UPB_PARSE_ARGS, 1, 8, false); } -const char *upb_psf32_2bt(UPB_PARSE_PARAMS) { - return fastdecode_scalarfixed(d, ptr, msg, table, hasbits, data, 2, 4); + +// Generate all fixed functions. +// {s,o,r,p} x {f4,f8} x {1bt,2bt} + +#define F(card, valbytes, tagbytes) \ + const char *upb_p##card##f##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ + return fastdecode_fixed(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card); \ + } + +#define TYPES(card, tagbytes) \ + F(card, 4, tagbytes) \ + F(card, 8, tagbytes) + +#define TAGBYTES(card) \ + TYPES(card, 1) \ + TYPES(card, 2) + +TAGBYTES(s) +TAGBYTES(o) +TAGBYTES(r) +TAGBYTES(p) + + +UPB_FORCEINLINE uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigzag) { + if (valbytes == 1) { + return val != 0; + } else if (zigzag) { + if (valbytes == 4) { + uint32_t n = val; + return (n >> 1) ^ -(int32_t)(n & 1); + } else if (valbytes == 8) { + return (val >> 1) ^ -(int64_t)(val & 1); + } + UPB_UNREACHABLE(); + } + return val; } UPB_FORCEINLINE -static const char *fastdecode_longvarint_impl(UPB_PARSE_PARAMS, int valbytes) { - char *field = (char *)data; - +static const char *fastdecode_longvarint_impl(const char *ptr, void *field, + int valbytes) { // The algorithm relies on sign extension to set all high bits when the varint // continues. This way it can use "and" to aggregate in to the result. const int8_t *p = (const int8_t*)(ptr); @@ -131,17 +488,17 @@ static const char *fastdecode_longvarint_impl(UPB_PARSE_PARAMS, int valbytes) { return NULL; // Value is too long to be a varint64 -#define DONE(n) \ - done##n : { \ - uint64_t val = res1 & res2 & res3; \ - memcpy(field, &val, valbytes); \ - return fastdecode_dispatch(d, (const char *)p + n, msg, table, hasbits); \ +#define DONE(n) \ + done##n : { \ + uint64_t val = res1 & res2 & res3; \ + memcpy(field, &val, valbytes); \ + return (const char *)p + n; \ }; done2 : { uint64_t val = res1 & res2; memcpy(field, &val, valbytes); - return fastdecode_dispatch(d, (const char*)p + 2, msg, table, hasbits); + return (const char*)p + 2; } DONE(3) @@ -152,59 +509,94 @@ done2 : { DONE(8) DONE(9) DONE(10) + #undef DONE +#undef SHLD +#undef SHLD_SIGN } UPB_NOINLINE static const char *fastdecode_longvarint32(UPB_PARSE_PARAMS) { - return fastdecode_longvarint_impl(d, ptr, msg, table, hasbits, data, 4); + (void)d; + (void)msg; + (void)table; + (void)hasbits; + return fastdecode_longvarint_impl(ptr, (void*)data, 4); } UPB_NOINLINE static const char *fastdecode_longvarint64(UPB_PARSE_PARAMS) { - return fastdecode_longvarint_impl(d, ptr, msg, table, hasbits, data, 8); + (void)d; + (void)msg; + (void)table; + (void)hasbits; + return fastdecode_longvarint_impl(ptr, (void*)data, 8); } UPB_FORCEINLINE static const char *fastdecode_longvarint(UPB_PARSE_PARAMS, int valbytes) { if (valbytes == 4) { - return fastdecode_longvarint32(d, ptr, msg, table, hasbits, data); + return fastdecode_longvarint32(UPB_PARSE_ARGS); } else if (valbytes == 8) { - return fastdecode_longvarint64(d, ptr, msg, table, hasbits, data); + return fastdecode_longvarint64(UPB_PARSE_ARGS); } UPB_UNREACHABLE(); } UPB_FORCEINLINE -static const char *fastdecode_scalarvarint(UPB_PARSE_PARAMS, int tagbytes, - int valbytes) { +static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, + int valbytes, bool zigzag, bool oneof) { uint64_t val = 0; void *field; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) return ptr; ptr += tagbytes; - hasbits |= data; + fastdecode_getfield(msg, data, &hasbits, oneof); field = (char*)msg + (data >> 48); if (UPB_UNLIKELY(*ptr < 0)) { return fastdecode_longvarint(d, ptr, msg, table, hasbits, (uint64_t)field, valbytes); } - val = *ptr; + val = fastdecode_munge(*ptr, valbytes, zigzag); memcpy(field, &val, valbytes); return fastdecode_dispatch(d, ptr + 1, msg, table, hasbits); } -const char *upb_psv32_1bt(UPB_PARSE_PARAMS) { - return fastdecode_scalarvarint(d, ptr, msg, table, hasbits, data, 1, 4); -} +// Generate all varint functions. +// {s,o,r} x {b1,v4,z4,v8,z8} x {1bt,2bt} -const char *upb_psv32_2bt(UPB_PARSE_PARAMS) { - return fastdecode_scalarvarint(d, ptr, msg, table, hasbits, data, 2, 4); -} +#define z_ZZ true +#define b_ZZ false +#define v_ZZ false -const char *upb_psv64_1bt(UPB_PARSE_PARAMS) { - return fastdecode_scalarvarint(d, ptr, msg, table, hasbits, data, 1, 8); -} +#define F(card, type, valbytes, tagbytes) \ + const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ + return fastdecode_varint(UPB_PARSE_ARGS, tagbytes, valbytes, type##_ZZ, \ + card##_ONEOF); \ + } -const char *upb_psv64_2bt(UPB_PARSE_PARAMS) { - return fastdecode_scalarvarint(d, ptr, msg, table, hasbits, data, 2, 8); -} +#define TYPES(card, tagbytes) \ + F(card, b, 1, tagbytes) \ + F(card, v, 4, tagbytes) \ + F(card, v, 8, tagbytes) \ + F(card, z, 4, tagbytes) \ + F(card, z, 8, tagbytes) + +#define TAGBYTES(card) \ + TYPES(card, 1) \ + TYPES(card, 2) + +TAGBYTES(s) +TAGBYTES(o) +TAGBYTES(r) + +#undef z_ZZ +#undef b_ZZ +#undef v_ZZ +#undef o_ONEOF +#undef s_ONEOF +#undef r_ONEOF +#undef F +#undef TYPES +#undef TAGBYTES + +#endif From 383ae5293e0445271ae11b0d21d2e7fbf6a665cb Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sat, 3 Oct 2020 16:47:46 -0700 Subject: [PATCH 04/88] WIP. --- upb/decode_fast.c | 326 +++++++++++++++++++++------------------------- 1 file changed, 151 insertions(+), 175 deletions(-) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 6d8952292c..5e34c8d931 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -13,7 +13,7 @@ const char *fastdecode_err(upb_decstate *d); const char *fastdecode_reallocarr(upb_decstate *d, const char *ptr, upb_msg *msg, upb_fasttable *table, - int elem_size); + size_t needbytes); UPB_NOINLINE static const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, @@ -27,20 +27,8 @@ static const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, return table->field_parser[(tag & 0xf7) >> 3](UPB_PARSE_ARGS); } -#if 0 -UPB_NOINLINE -static const char *fastdecode_parseloop(upb_decstate *d, const char *ptr, - upb_msg *msg, upb_fasttable *table) { - uint64_t hasbits = 0; - while (ptr < d->fastlimit) { - ptr = fastdecode_dispatch(d, ptr, msg, table, hasbits); - /*ptr = decode_field(d, ptr, msg, table->layout);*/ - } - return ptr; -} -#endif - -UPB_FORCEINLINE static bool fastdecode_checktag(uint64_t data, int tagbytes) { +UPB_FORCEINLINE +static bool fastdecode_checktag(uint64_t data, int tagbytes) { if (tagbytes == 1) { return (data & 0xff) == 0; } else { @@ -48,7 +36,33 @@ UPB_FORCEINLINE static bool fastdecode_checktag(uint64_t data, int tagbytes) { } } -UPB_FORCEINLINE static uint16_t fastdecode_readtag(const char *ptr, int tagbytes) { +UPB_FORCEINLINE +bool fastdecode_boundscheck(const char *ptr, unsigned len, const char *end) { + uintptr_t uptr = (uintptr_t)ptr; + uintptr_t uend = (uintptr_t)end; + uintptr_t res = uptr + len; + return res < uptr || res > uend; +} + +UPB_FORCEINLINE +static bool fastdecode_readlongsize(const char *ptr, uint32_t *size, + const char **out) { + int i; + *size = ptr[0]; + UPB_ASSERT(ptr[0] < 0); + for (i = 1; i < 5; i++) { + uint32_t byte = ptr[i]; + (*size) += (byte - 1) << (7 * i); + if (UPB_LIKELY(byte < 128)) { + *out = ptr + i + 1; + return true; + } + } + return false; +} + +UPB_FORCEINLINE +static uint16_t fastdecode_readtag(const char *ptr, int tagbytes) { uint16_t ret = 0; memcpy(&ret, ptr, tagbytes); return ret; @@ -63,31 +77,32 @@ typedef enum { UPB_FORCEINLINE static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, - uint64_t data, uint64_t *hasbits, - uint16_t *expected_tag, int *elem_avail, - upb_card card, int tagbytes, int valbytes) { - void *field = (char *)msg + (data >> 48); + uint64_t *data, uint64_t *hasbits, + upb_card card, int tagbytes, int valbytes, + bool store_len) { + void *field = (char *)msg + (*data >> 48); switch (card) { case CARD_s: - *hasbits |= data; + *hasbits |= *data; return field; case CARD_o: { - uint32_t *case_ptr = UPB_PTR_AT(msg, (data >> 16) & 0xffff, uint32_t); - *case_ptr = (data >> 32) & 0xffff; + uint32_t *case_ptr = UPB_PTR_AT(msg, (*data >> 16) & 0xffff, uint32_t); + *case_ptr = (*data >> 32) & 0xffff; return field; } case CARD_r: { upb_array **arr_p = field; upb_array *arr; + uint64_t elem_avail; + uint16_t expected_tag; *hasbits >>= 16; *(uint32_t*)msg |= *hasbits; *hasbits = 0; if (UPB_LIKELY(!*arr_p)) { - //(void)d; size_t need = (valbytes * 4) + sizeof(upb_array); if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < need)) { - *elem_avail = 0; + *data = 0; return NULL; } arr = (void*)d->arena_ptr; @@ -95,17 +110,18 @@ static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, arr->data = (uintptr_t)field; *arr_p = arr; arr->size = 4; - arr->len = 0; - *elem_avail = 4; + if (store_len) arr->len = 5; + elem_avail = 4; d->arena_ptr += need; } else { arr = *arr_p; field = _upb_array_ptr(arr); - *elem_avail = arr->size - arr->len; + elem_avail = arr->size - arr->len; field = (char*)field + (arr->len * valbytes); - arr->len = arr->size; + if (store_len) arr->len = arr->size + 1; } - *expected_tag = fastdecode_readtag(ptr, tagbytes); + expected_tag = fastdecode_readtag(ptr, tagbytes); + *data = elem_avail | ((uint64_t)expected_tag << 32); d->arr = arr; return field; } @@ -114,23 +130,40 @@ static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, } } +/* string fields **************************************************************/ + +UPB_NOINLINE +static const char *fastdecode_longstring(upb_decstate *d, const char *ptr, + upb_msg *msg, upb_fasttable *table, + uint64_t hasbits, upb_strview *dst) { + uint32_t len; + if (!fastdecode_readlongsize(ptr, &len, &ptr)) { + return fastdecode_err(d); + } + dst->data = ptr; + dst->size = len; + if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit))) { + return fastdecode_err(d); + } + ptr += len; + return fastdecode_dispatch(d, ptr, msg, table, hasbits); +} + UPB_FORCEINLINE static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, upb_card card) { upb_strview *dst; - uint16_t expected_tag; - int elem_avail; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { - return table->fallback(UPB_PARSE_ARGS); + return ptr; } - dst = fastdecode_getfield(d, ptr, msg, data, &hasbits, &expected_tag, - &elem_avail, card, tagbytes, sizeof(upb_strview)); + dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, card, tagbytes, + sizeof(upb_strview), true); again: if (card == CARD_r) { - if (UPB_UNLIKELY(elem_avail == 0)) { + if (UPB_UNLIKELY((uint32_t)data == 0)) { return fastdecode_reallocarr(d, ptr, msg, table, sizeof(upb_strview)); } } @@ -139,28 +172,28 @@ again: int64_t len = ptr[tagbytes]; if (UPB_UNLIKELY(len < 0)) { if (card == CARD_r) { - d->arr->len -= elem_avail; + d->arr->len -= (uint32_t)data; } - return ptr; + return fastdecode_longstring(d, ptr, msg, table, hasbits, dst); } ptr += tagbytes + 1; dst->data = ptr; dst->size = len; - ptr += len; - if (UPB_UNLIKELY(ptr > d->limit)) { + if (UPB_UNLIKELY(!fastdecode_boundscheck(ptr, len, d->limit))) { return fastdecode_err(d); } + ptr += len; } if (card == CARD_r) { if (UPB_LIKELY(ptr < d->fastlimit) && - fastdecode_readtag(ptr, tagbytes) == expected_tag) { - elem_avail--; + fastdecode_readtag(ptr, tagbytes) == (uint16_t)(data >> 32)) { + data--; dst++; goto again; } - d->arr->len -= elem_avail; + d->arr->len -= (uint32_t)data; } return fastdecode_dispatch(d, ptr, msg, table, hasbits); @@ -178,23 +211,41 @@ const char *upb_prs_1bt(UPB_PARSE_PARAMS) { return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_r); } +const char *upb_pss_2bt(UPB_PARSE_PARAMS) { + return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_s); +} + +const char *upb_pos_2bt(UPB_PARSE_PARAMS) { + return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_o); +} + +const char *upb_prs_2bt(UPB_PARSE_PARAMS) { + return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_r); +} + +/* fixed fields ***************************************************************/ + UPB_FORCEINLINE static const char *fastdecode_fixed(UPB_PARSE_PARAMS, int tagbytes, int valbytes, - upb_card card) { + upb_card card, _upb_field_parser *fallback) { char *dst; - uint16_t expected_tag; - int elem_avail; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { - return ptr; + if (fallback) { + // Patch data to amtch packed wiretype. + data ^= 0x2 ^ (valbytes == 4 ? 5 : 1); + return fallback(UPB_PARSE_ARGS); + } else { + return ptr; + } } - dst = fastdecode_getfield(d, ptr, msg, data, &hasbits, &expected_tag, - &elem_avail, card, tagbytes, valbytes); + dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, card, tagbytes, + valbytes, true); again: if (card == CARD_r) { - if (UPB_UNLIKELY(elem_avail == 0)) { + if (UPB_UNLIKELY((uint32_t)data == 0)) { return fastdecode_reallocarr(d, ptr, msg, table, valbytes); } } @@ -207,170 +258,95 @@ again: if (card == CARD_r) { if (UPB_LIKELY(ptr < d->fastlimit) && - fastdecode_readtag(ptr, tagbytes) == expected_tag) { - elem_avail--; + fastdecode_readtag(ptr, tagbytes) == (uint16_t)(data >> 32)) { + data--; dst += valbytes; goto again; } - d->arr->len -= elem_avail; + d->arr->len -= (uint32_t)data; } return fastdecode_dispatch(d, ptr, msg, table, hasbits); } -const char *upb_psf8_1bt(UPB_PARSE_PARAMS) { - return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_s); -} - -const char *upb_pof8_1bt(UPB_PARSE_PARAMS) { - return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_o); -} - -const char *upb_prf8_1bt(UPB_PARSE_PARAMS) { - return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_r); -} +UPB_NOINLINE +const char *fastdecode_longfixedpacked(upb_decstate *d, const char *ptr, + upb_msg *msg, upb_fasttable *table, + uint64_t hasbits, void *dst); -#if 0 UPB_FORCEINLINE -static const char *fastdecode_repeatedfixed(UPB_PARSE_PARAMS, int tagbytes, - int valbytes, _upb_field_parser *fallback) { +static const char *fastdecode_fixedpacked(UPB_PARSE_PARAMS, int tagbytes, int valbytes, + _upb_field_parser *fallback) { char *dst; - uint16_t expected_tag; - upb_array **arr_p; - upb_array *arr; + char *end; + uint32_t len; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { if (fallback) { // Patch data to amtch packed wiretype. data ^= 0x2 ^ (valbytes == 4 ? 5 : 1); - fallback(UPB_PARSE_ARGS); + return fallback(UPB_PARSE_ARGS); } else { - return table->fallback(UPB_PARSE_ARGS); - } - } - - arr_p = UPB_PTR_AT(msg, (data >> 48), upb_array*); - arr = *arr_p; - if (UPB_UNLIKELY(!arr || arr->size - arr->len < 4)) { - return fastdecode_allocarr(UPB_PARSE_ARGS); - } - dst = _upb_array_ptr(arr); - d->dstend = dst + (arr->size * valbytes); - dst += (arr->len * valbytes); - expected_tag = fastdecode_readtag(ptr, tagbytes); - - do { - ptr += tagbytes; - //fastdecode_reserve(d, arr, &dst, &dstend); - if (UPB_UNLIKELY(dst == d->dstend)) { - return fastdecode_reallocarr(UPB_PARSE_ARGS); - } - memcpy(dst, ptr, valbytes); - dst += valbytes; - ptr += valbytes; - /* - if (UPB_UNLIKELY(ptr >= d->fastlimit)) { - arr->len = (dst - (char*)_upb_array_ptr(arr)) / valbytes; return ptr; } - */ - } while (fastdecode_readtag(ptr, tagbytes) == expected_tag); - - return fastdecode_dispatch(d, ptr, msg, table, hasbits); -} - -UPB_FORCEINLINE -static const char *fastdecode_scalarfixed(UPB_PARSE_PARAMS, int tagbytes, - int valbytes, upb_card card) { - char *field; - if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { - return table->fallback(UPB_PARSE_ARGS); } - field = fastdecode_getfield(msg, data, &hasbits, card); - memcpy(field, ptr + tagbytes, valbytes); - ptr += tagbytes + valbytes; - return fastdecode_dispatch(d, ptr, msg, table, hasbits); -} - arr_p = UPB_PTR_AT(msg, (data >> 48), upb_array*); - if (UPB_UNLIKELY(!arr_p)) goto alloc_arr; - arr = *arr_p; - dst = (char*)_upb_array_ptr(arr); - dstend = dst + arr->size; - dst += arr->len; + dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, CARD_r, tagbytes, + valbytes, false); -const char *fastdecode_allocarr(UPB_PARSE_PARAMS) - ; + len = ptr[tagbytes]; + if (UPB_UNLIKELY(len < 0)) { + return fastdecode_longfixedpacked(d, ptr, msg, table, hasbits, dst); + } -UPB_FORCEINLINE -static void fastdecode_getarr(upb_decstate *d, upb_msg *msg, uint64_t data, - int valbytes, char **dst) { - upb_array **arr_p = UPB_PTR_AT(msg, (data >> 48), upb_array*); - upb_array *arr = *arr_p; - /* - if (UPB_UNLIKELY(!arr || arr->size - arr->len < 4)) { - fastdecode_allocarr(d, arr_p); + if (UPB_UNLIKELY(len > (size_t)(uint32_t)data * valbytes)) { + return fastdecode_reallocarr(d, ptr, msg, table, len); } - */ - (void)d; - *dst = _upb_array_ptr(arr); - d->dstend = *dst + (arr->size * valbytes); - *dst += (arr->len * valbytes); -} -UPB_FORCEINLINE -static const char *fastdecode_repeatedfixed(UPB_PARSE_PARAMS, int tagbytes, - int valbytes, _upb_field_parser *fallback) { - char *dst; - uint16_t expected_tag; - upb_array **arr_p; - upb_array *arr; + ptr += tagbytes; - if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { - if (fallback) { - // Patch data to amtch packed wiretype. - data ^= 0x2 ^ (valbytes == 4 ? 5 : 1); - fallback(UPB_PARSE_ARGS); - } else { - return table->fallback(UPB_PARSE_ARGS); - } + if (UPB_UNLIKELY((len & (valbytes - 1)) != 0 || /* Non-multiple length. */ + fastdecode_boundscheck(ptr, len, d->limit))) { + return fastdecode_err(d); } - arr_p = UPB_PTR_AT(msg, (data >> 48), upb_array*); - arr = *arr_p; - if (UPB_UNLIKELY(!arr || arr->size - arr->len < 4)) { - return fastdecode_allocarr(UPB_PARSE_ARGS); - } - dst = _upb_array_ptr(arr); - d->dstend = dst + (arr->size * valbytes); - dst += (arr->len * valbytes); - expected_tag = fastdecode_readtag(ptr, tagbytes); + end = dst + len; + d->arr->len += len / valbytes; - do { - ptr += tagbytes; - //fastdecode_reserve(d, arr, &dst, &dstend); - if (UPB_UNLIKELY(dst == d->dstend)) { - return fastdecode_reallocarr(UPB_PARSE_ARGS); - } - memcpy(dst, ptr, valbytes); + while (dst < end) { + memcpy(dst, ptr, valbytes); /* Inline memcpy() loop */ dst += valbytes; ptr += valbytes; - /* - if (UPB_UNLIKELY(ptr >= d->fastlimit)) { - arr->len = (dst - (char*)_upb_array_ptr(arr)) / valbytes; - return ptr; - } - */ - } while (fastdecode_readtag(ptr, tagbytes) == expected_tag); + } return fastdecode_dispatch(d, ptr, msg, table, hasbits); } +UPB_NOINLINE +const char *upb_prf8_1bt(UPB_PARSE_PARAMS); + +UPB_NOINLINE +const char *upb_ppf8_1bt(UPB_PARSE_PARAMS) { + return fastdecode_fixedpacked(UPB_PARSE_ARGS, 1, 8, &upb_prf8_1bt); +} + +UPB_NOINLINE +const char *upb_psf8_1bt(UPB_PARSE_PARAMS) { + return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_s, NULL); +} + +UPB_NOINLINE +const char *upb_pof8_1bt(UPB_PARSE_PARAMS) { + return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_o, NULL); +} + UPB_NOINLINE const char *upb_prf8_1bt(UPB_PARSE_PARAMS) { - return fastdecode_repeatedfixed(UPB_PARSE_ARGS, 1, 8, false); + return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_r, &upb_ppf8_1bt); } +#if 0 + // Generate all fixed functions. // {s,o,r,p} x {f4,f8} x {1bt,2bt} From 438ecaeb5ae98c8e98d62947d3069121e0bbbf3e Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sat, 3 Oct 2020 19:18:45 -0700 Subject: [PATCH 05/88] Give all field parsers a generic table entry. --- CMakeLists.txt | 1 + benchmark.py | 6 +- .../google/protobuf/descriptor.upb.c | 999 ++++++++++++++++++ upb/decode.c | 23 +- upb/decode.h | 19 +- upb/decode_fast.c | 37 +- upb/def.c | 5 + upb/msg.h | 10 + upbc/generator.cc | 8 + 9 files changed, 1071 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dd6454321..f5ce67f2f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,7 @@ add_library(port upb/port.c) add_library(upb upb/decode.c + upb/decode_fast.c upb/encode.c upb/msg.c upb/msg.h diff --git a/benchmark.py b/benchmark.py index b75dd4d5a8..2e36a2ddb7 100755 --- a/benchmark.py +++ b/benchmark.py @@ -30,12 +30,12 @@ def Run(cmd): def Benchmark(outbase, runs=12): tmpfile = "/tmp/bench-output.json" Run("rm -rf {}".format(tmpfile)) - Run("bazel test :all") - Run("bazel build -c opt :benchmark") + Run("CC=clang bazel test :all") + Run("CC=clang bazel build -c opt :benchmark") Run("./bazel-bin/benchmark --benchmark_out_format=json --benchmark_out={} --benchmark_repetitions={}".format(tmpfile, runs)) - Run("bazel build -c opt --copt=-g :conformance_upb") + Run("CC=clang bazel build -c opt --copt=-g :conformance_upb") Run("cp -f bazel-bin/conformance_upb {}.bin".format(outbase)) with open(tmpfile) as f: diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index 44cd3ae2ce..d3a197c849 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -21,6 +21,43 @@ static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1] = }; const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_FileDescriptorSet_submsgs[0], &google_protobuf_FileDescriptorSet__fields[0], UPB_SIZE(4, 8), 1, false, @@ -51,6 +88,43 @@ static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12] }; const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_FileDescriptorProto_submsgs[0], &google_protobuf_FileDescriptorProto__fields[0], UPB_SIZE(64, 128), 12, false, @@ -80,6 +154,43 @@ static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10] = { }; const upb_msglayout google_protobuf_DescriptorProto_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_DescriptorProto_submsgs[0], &google_protobuf_DescriptorProto__fields[0], UPB_SIZE(48, 96), 10, false, @@ -96,6 +207,43 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange_ }; const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0], &google_protobuf_DescriptorProto_ExtensionRange__fields[0], UPB_SIZE(16, 24), 3, false, @@ -107,6 +255,43 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__ }; const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, NULL, &google_protobuf_DescriptorProto_ReservedRange__fields[0], UPB_SIZE(12, 12), 2, false, @@ -121,6 +306,43 @@ static const upb_msglayout_field google_protobuf_ExtensionRangeOptions__fields[1 }; const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_ExtensionRangeOptions_submsgs[0], &google_protobuf_ExtensionRangeOptions__fields[0], UPB_SIZE(4, 8), 1, false, @@ -145,6 +367,43 @@ static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[11 }; const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_FieldDescriptorProto_submsgs[0], &google_protobuf_FieldDescriptorProto__fields[0], UPB_SIZE(80, 128), 11, false, @@ -160,6 +419,43 @@ static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2] }; const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_OneofDescriptorProto_submsgs[0], &google_protobuf_OneofDescriptorProto__fields[0], UPB_SIZE(16, 32), 2, false, @@ -180,6 +476,43 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5] }; const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_EnumDescriptorProto_submsgs[0], &google_protobuf_EnumDescriptorProto__fields[0], UPB_SIZE(32, 64), 5, false, @@ -191,6 +524,43 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReserve }; const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, NULL, &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0], UPB_SIZE(12, 12), 2, false, @@ -207,6 +577,43 @@ static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__field }; const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_EnumValueDescriptorProto_submsgs[0], &google_protobuf_EnumValueDescriptorProto__fields[0], UPB_SIZE(24, 32), 3, false, @@ -224,6 +631,43 @@ static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[ }; const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_ServiceDescriptorProto_submsgs[0], &google_protobuf_ServiceDescriptorProto__fields[0], UPB_SIZE(24, 48), 3, false, @@ -243,6 +687,43 @@ static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6 }; const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_MethodDescriptorProto_submsgs[0], &google_protobuf_MethodDescriptorProto__fields[0], UPB_SIZE(32, 64), 6, false, @@ -277,6 +758,43 @@ static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { }; const upb_msglayout google_protobuf_FileOptions_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_FileOptions_submsgs[0], &google_protobuf_FileOptions__fields[0], UPB_SIZE(112, 208), 21, false, @@ -295,6 +813,43 @@ static const upb_msglayout_field google_protobuf_MessageOptions__fields[5] = { }; const upb_msglayout google_protobuf_MessageOptions_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_MessageOptions_submsgs[0], &google_protobuf_MessageOptions__fields[0], UPB_SIZE(12, 16), 5, false, @@ -315,6 +870,43 @@ static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = { }; const upb_msglayout google_protobuf_FieldOptions_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_FieldOptions_submsgs[0], &google_protobuf_FieldOptions__fields[0], UPB_SIZE(32, 40), 7, false, @@ -329,6 +921,43 @@ static const upb_msglayout_field google_protobuf_OneofOptions__fields[1] = { }; const upb_msglayout google_protobuf_OneofOptions_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_OneofOptions_submsgs[0], &google_protobuf_OneofOptions__fields[0], UPB_SIZE(4, 8), 1, false, @@ -345,6 +974,43 @@ static const upb_msglayout_field google_protobuf_EnumOptions__fields[3] = { }; const upb_msglayout google_protobuf_EnumOptions_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_EnumOptions_submsgs[0], &google_protobuf_EnumOptions__fields[0], UPB_SIZE(8, 16), 3, false, @@ -360,6 +1026,43 @@ static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2] = { }; const upb_msglayout google_protobuf_EnumValueOptions_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_EnumValueOptions_submsgs[0], &google_protobuf_EnumValueOptions__fields[0], UPB_SIZE(8, 16), 2, false, @@ -375,6 +1078,43 @@ static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2] = { }; const upb_msglayout google_protobuf_ServiceOptions_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_ServiceOptions_submsgs[0], &google_protobuf_ServiceOptions__fields[0], UPB_SIZE(8, 16), 2, false, @@ -391,6 +1131,43 @@ static const upb_msglayout_field google_protobuf_MethodOptions__fields[3] = { }; const upb_msglayout google_protobuf_MethodOptions_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_MethodOptions_submsgs[0], &google_protobuf_MethodOptions__fields[0], UPB_SIZE(24, 32), 3, false, @@ -411,6 +1188,43 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption__fields[7] }; const upb_msglayout google_protobuf_UninterpretedOption_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_UninterpretedOption_submsgs[0], &google_protobuf_UninterpretedOption__fields[0], UPB_SIZE(64, 96), 7, false, @@ -422,6 +1236,43 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__f }; const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, NULL, &google_protobuf_UninterpretedOption_NamePart__fields[0], UPB_SIZE(16, 32), 2, false, @@ -436,6 +1287,43 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1] = { }; const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_SourceCodeInfo_submsgs[0], &google_protobuf_SourceCodeInfo__fields[0], UPB_SIZE(4, 8), 1, false, @@ -450,6 +1338,43 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields }; const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, NULL, &google_protobuf_SourceCodeInfo_Location__fields[0], UPB_SIZE(32, 64), 5, false, @@ -464,6 +1389,43 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1] = }; const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, &google_protobuf_GeneratedCodeInfo_submsgs[0], &google_protobuf_GeneratedCodeInfo__fields[0], UPB_SIZE(4, 8), 1, false, @@ -477,6 +1439,43 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__f }; const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { + { + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + &fastdecode_generic, + }, + { + 0 + }, NULL, &google_protobuf_GeneratedCodeInfo_Annotation__fields[0], UPB_SIZE(24, 48), 4, false, diff --git a/upb/decode.c b/upb/decode.c index f3b151aadd..2130f1e583 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -275,6 +275,7 @@ static upb_msg *decode_newsubmsg(upb_decstate *d, const upb_msglayout *layout, return _upb_msg_new(subl, d->arena); } +UPB_FORCEINLINE static void decode_tosubmsg(upb_decstate *d, upb_msg *submsg, const upb_msglayout *layout, const upb_msglayout_field *field, upb_strview val) { @@ -288,6 +289,7 @@ static void decode_tosubmsg(upb_decstate *d, upb_msg *submsg, d->depth++; } +UPB_FORCEINLINE static const char *decode_group(upb_decstate *d, const char *ptr, upb_msg *submsg, const upb_msglayout *subl, uint32_t number) { @@ -299,6 +301,7 @@ static const char *decode_group(upb_decstate *d, const char *ptr, return ptr; } +UPB_FORCEINLINE static const char *decode_togroup(upb_decstate *d, const char *ptr, upb_msg *submsg, const upb_msglayout *layout, const upb_msglayout_field *field) { @@ -306,6 +309,7 @@ static const char *decode_togroup(upb_decstate *d, const char *ptr, return decode_group(d, ptr, submsg, subl, field->number); } +UPB_FORCEINLINE static const char *decode_toarray(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *layout, const upb_msglayout_field *field, wireval val, @@ -398,6 +402,7 @@ static const char *decode_toarray(upb_decstate *d, const char *ptr, } } +UPB_FORCEINLINE static void decode_tomap(upb_decstate *d, upb_msg *msg, const upb_msglayout *layout, const upb_msglayout_field *field, wireval val) { @@ -434,6 +439,7 @@ static void decode_tomap(upb_decstate *d, upb_msg *msg, _upb_map_set(map, &ent.k, map->key_size, &ent.v, map->val_size, d->arena); } +UPB_FORCEINLINE static const char *decode_tomsg(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *layout, const upb_msglayout_field *field, wireval val, @@ -491,8 +497,9 @@ static const char *decode_tomsg(upb_decstate *d, const char *ptr, upb_msg *msg, return ptr; } -const char *decode_field(upb_decstate *d, const char *ptr, upb_msg *msg, - const upb_msglayout *layout) { +UPB_FORCEINLINE +static const char *decode_field(upb_decstate *d, const char *ptr, upb_msg *msg, + const upb_msglayout *layout) { uint32_t tag; const upb_msglayout_field *field; int field_number; @@ -587,10 +594,19 @@ const char *decode_field(upb_decstate *d, const char *ptr, upb_msg *msg, return ptr; } +const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, + const upb_msglayout *table, uint64_t hasbits, + uint64_t data) { + *(uint32_t*)msg |= hasbits; /* Sync hasbits. */ + (void)data; + return decode_field(d, ptr, msg, table); +} + static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *layout) { while (ptr < d->limit) { - ptr = decode_field(d, ptr, msg, layout); + ptr = fastdecode_dispatch(d, ptr, msg, layout, 0); + if (ptr < d->limit) ptr = decode_field(d, ptr, msg, layout); } if (ptr != d->limit) decode_err(d); @@ -601,6 +617,7 @@ bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, upb_arena *arena) { upb_decstate state; state.limit = buf + size; + state.fastlimit = buf + size - 16; state.arena = arena; state.depth = 64; state.end_group = 0; diff --git a/upb/decode.h b/upb/decode.h index c6387190d2..6fc4a2da91 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -16,19 +16,6 @@ extern "C" { bool upb_decode(const char *buf, size_t size, upb_msg *msg, const upb_msglayout *l, upb_arena *arena); -struct upb_fasttable; -struct upb_decstate; - -typedef const char *_upb_field_parser(struct upb_decstate *d, const char *ptr, - upb_msg *msg, struct upb_fasttable *table, - uint64_t hasbits, uint64_t data); - -typedef struct upb_fasttable { - _upb_field_parser *field_parser[16]; - uint64_t field_data[16]; - _upb_field_parser *fallback; -} upb_fasttable; - /* Internal only: data pertaining to the parse. */ typedef struct upb_decstate { char *arena_ptr, *arena_end; @@ -43,6 +30,12 @@ typedef struct upb_decstate { jmp_buf err; } upb_decstate; +const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, + const upb_msglayout *table, uint64_t hasbits); +const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, + const upb_msglayout *table, uint64_t hasbits, + uint64_t data); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 5e34c8d931..1b9e6ead3f 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -3,30 +3,34 @@ #include "upb/port_def.inc" -#define UPB_PARSE_PARAMS \ - upb_decstate *d, const char *ptr, upb_msg *msg, upb_fasttable *table, \ +#define UPB_PARSE_PARAMS \ + upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, \ uint64_t hasbits, uint64_t data #define UPB_PARSE_ARGS d, ptr, msg, table, hasbits, data -const char *fastdecode_err(upb_decstate *d); - -const char *fastdecode_reallocarr(upb_decstate *d, const char *ptr, - upb_msg *msg, upb_fasttable *table, - size_t needbytes); - UPB_NOINLINE -static const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, - upb_msg *msg, upb_fasttable *table, - uint64_t hasbits) { +const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, + const upb_msglayout *table, uint64_t hasbits) { uint16_t tag; uint64_t data; + size_t idx; if (UPB_UNLIKELY(ptr >= d->fastlimit)) return ptr; memcpy(&tag, ptr, 2); - data = table->field_data[(tag & 0xf7) >> 3] ^ tag; - return table->field_parser[(tag & 0xf7) >> 3](UPB_PARSE_ARGS); + idx = (tag & 0xf8) >> 3; + data = table->field_data[idx] ^ tag; + return table->field_parser[idx](UPB_PARSE_ARGS); } +#if 0 + +const char *fastdecode_err(upb_decstate *d); + +const char *fastdecode_reallocarr(upb_decstate *d, const char *ptr, + upb_msg *msg, upb_msglayout *table, + size_t needbytes); + + UPB_FORCEINLINE static bool fastdecode_checktag(uint64_t data, int tagbytes) { if (tagbytes == 1) { @@ -134,7 +138,7 @@ static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, UPB_NOINLINE static const char *fastdecode_longstring(upb_decstate *d, const char *ptr, - upb_msg *msg, upb_fasttable *table, + upb_msg *msg, upb_msglayout *table, uint64_t hasbits, upb_strview *dst) { uint32_t len; if (!fastdecode_readlongsize(ptr, &len, &ptr)) { @@ -271,7 +275,7 @@ again: UPB_NOINLINE const char *fastdecode_longfixedpacked(upb_decstate *d, const char *ptr, - upb_msg *msg, upb_fasttable *table, + upb_msg *msg, upb_msglayout *table, uint64_t hasbits, void *dst); UPB_FORCEINLINE @@ -345,9 +349,6 @@ const char *upb_prf8_1bt(UPB_PARSE_PARAMS) { return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_r, &upb_ppf8_1bt); } -#if 0 - - // Generate all fixed functions. // {s,o,r,p} x {f4,f8} x {1bt,2bt} diff --git a/upb/def.c b/upb/def.c index 00a5877bde..c5225a1806 100644 --- a/upb/def.c +++ b/upb/def.c @@ -949,6 +949,7 @@ static bool make_layout(const upb_symtab *symtab, const upb_msgdef *m) { const upb_msglayout **submsgs; upb_msglayout_field *fields; upb_alloc *alloc = upb_arena_alloc(symtab->arena); + size_t i; memset(l, 0, sizeof(*l)); @@ -965,6 +966,10 @@ static bool make_layout(const upb_symtab *symtab, const upb_msgdef *m) { l->fields = fields; l->submsgs = submsgs; + for (i = 0; i < 32; i++) { + l->field_parser[i] = &fastdecode_generic; + } + if (upb_msgdef_mapentry(m)) { /* TODO(haberman): refactor this method so this special case is more * elegant. */ diff --git a/upb/msg.h b/upb/msg.h index 695c278b21..7a1ec760ed 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -46,7 +46,17 @@ typedef struct { uint8_t label; /* google.protobuf.Label or _UPB_LABEL_* above. */ } upb_msglayout_field; +struct upb_msglayout; +struct upb_decstate; + +typedef const char *_upb_field_parser(struct upb_decstate *d, const char *ptr, + upb_msg *msg, + const struct upb_msglayout *table, + uint64_t hasbits, uint64_t data); + typedef struct upb_msglayout { + _upb_field_parser *field_parser[32]; + uint64_t field_data[32]; const struct upb_msglayout *const* submsgs; const upb_msglayout_field *fields; /* Must be aligned to sizeof(void*). Doesn't include internal members like diff --git a/upbc/generator.cc b/upbc/generator.cc index 72df0244aa..cd247a2ad7 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -804,6 +804,14 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output) { } output("const upb_msglayout $0 = {\n", MessageInit(message)); + output(" {\n"); + for (int i = 0; i < 32; i++) { + output(" &fastdecode_generic,\n"); + } + output(" },\n"); + output(" {\n"); + output(" 0\n"); + output(" },\n"); output(" $0,\n", submsgs_array_ref); output(" $0,\n", fields_array_ref); output(" $0, $1, $2,\n", GetSizeInit(layout.message_size()), From 3937874a85a2d301cf68deeda04422c5c7d5aefa Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 5 Oct 2020 01:18:23 -0700 Subject: [PATCH 06/88] We have a properly structured algorithm, but perf regresses by 20%. --- upb/decode.c | 21 ++++++++++++--------- upb/decode.h | 1 + 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/upb/decode.c b/upb/decode.c index 2130f1e583..6e0779bf2a 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -275,7 +275,6 @@ static upb_msg *decode_newsubmsg(upb_decstate *d, const upb_msglayout *layout, return _upb_msg_new(subl, d->arena); } -UPB_FORCEINLINE static void decode_tosubmsg(upb_decstate *d, upb_msg *submsg, const upb_msglayout *layout, const upb_msglayout_field *field, upb_strview val) { @@ -283,13 +282,14 @@ static void decode_tosubmsg(upb_decstate *d, upb_msg *submsg, const char *saved_limit = d->limit; if (--d->depth < 0) decode_err(d); d->limit = val.data + val.size; + d->fastlimit = UPB_MIN(d->limit, d->fastend); decode_msg(d, val.data, submsg, subl); d->limit = saved_limit; + d->fastlimit = UPB_MIN(d->limit, d->fastend); if (d->end_group != 0) decode_err(d); d->depth++; } -UPB_FORCEINLINE static const char *decode_group(upb_decstate *d, const char *ptr, upb_msg *submsg, const upb_msglayout *subl, uint32_t number) { @@ -301,7 +301,6 @@ static const char *decode_group(upb_decstate *d, const char *ptr, return ptr; } -UPB_FORCEINLINE static const char *decode_togroup(upb_decstate *d, const char *ptr, upb_msg *submsg, const upb_msglayout *layout, const upb_msglayout_field *field) { @@ -402,7 +401,6 @@ static const char *decode_toarray(upb_decstate *d, const char *ptr, } } -UPB_FORCEINLINE static void decode_tomap(upb_decstate *d, upb_msg *msg, const upb_msglayout *layout, const upb_msglayout_field *field, wireval val) { @@ -594,19 +592,23 @@ static const char *decode_field(upb_decstate *d, const char *ptr, upb_msg *msg, return ptr; } +UPB_NOINLINE const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits, uint64_t data) { - *(uint32_t*)msg |= hasbits; /* Sync hasbits. */ + if (hasbits) *(uint32_t*)msg |= hasbits; /* Sync hasbits. */ (void)data; - return decode_field(d, ptr, msg, table); + ptr = decode_field(d, ptr, msg, table); + return fastdecode_dispatch(d, ptr, msg, table, hasbits); } +UPB_NOINLINE static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *layout) { - while (ptr < d->limit) { + while (1) { ptr = fastdecode_dispatch(d, ptr, msg, layout, 0); - if (ptr < d->limit) ptr = decode_field(d, ptr, msg, layout); + if (ptr == d->limit) break; + ptr = decode_field(d, ptr, msg, layout); } if (ptr != d->limit) decode_err(d); @@ -617,7 +619,8 @@ bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, upb_arena *arena) { upb_decstate state; state.limit = buf + size; - state.fastlimit = buf + size - 16; + state.fastend = buf + size - 16; + state.fastlimit = state.fastend; state.arena = arena; state.depth = 64; state.end_group = 0; diff --git a/upb/decode.h b/upb/decode.h index 6fc4a2da91..29194534b4 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -22,6 +22,7 @@ typedef struct upb_decstate { const void *rep_end; const char *limit; /* End of delimited region or end of buffer. */ const char *fastlimit; /* End of delimited region or end of buffer. */ + const char *fastend; upb_array *arr; _upb_field_parser *resume; upb_arena *arena; From fac992db83fe49cacd956b3cdd8dc287b07f74cc Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 5 Oct 2020 11:42:47 -0700 Subject: [PATCH 07/88] Cleanup for showing. --- benchmark.py | 2 +- .../google/protobuf/descriptor.upb.c | 1025 +++++++++++++++-- tests/test_generated_code.c | 3 + upb/decode.c | 15 +- upb/decode.h | 36 +- upb/decode_fast.c | 578 ++-------- upbc/generator.cc | 105 +- 7 files changed, 1170 insertions(+), 594 deletions(-) diff --git a/benchmark.py b/benchmark.py index 2e36a2ddb7..b6c16a6a76 100755 --- a/benchmark.py +++ b/benchmark.py @@ -30,7 +30,7 @@ def Run(cmd): def Benchmark(outbase, runs=12): tmpfile = "/tmp/bench-output.json" Run("rm -rf {}".format(tmpfile)) - Run("CC=clang bazel test :all") + #Run("CC=clang bazel test :all") Run("CC=clang bazel build -c opt :benchmark") Run("./bazel-bin/benchmark --benchmark_out_format=json --benchmark_out={} --benchmark_repetitions={}".format(tmpfile, runs)) diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index d3a197c849..58137f58e4 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -56,7 +56,38 @@ const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_FileDescriptorSet_submsgs[0], &google_protobuf_FileDescriptorSet__fields[0], @@ -90,6 +121,8 @@ static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12] const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { { &fastdecode_generic, + &upb_pss_1bt, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -99,9 +132,7 @@ const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -123,7 +154,38 @@ const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973706, 2251799813816330), + UPB_SIZE(3377699720790034, 6755399441317906), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(5629499534737506, 11258999068950626), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_FileDescriptorProto_submsgs[0], &google_protobuf_FileDescriptorProto__fields[0], @@ -156,7 +218,7 @@ static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10] = { const upb_msglayout google_protobuf_DescriptorProto_msginit = { { &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -189,7 +251,38 @@ const upb_msglayout google_protobuf_DescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973706, 2251799813816330), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_DescriptorProto_submsgs[0], &google_protobuf_DescriptorProto__fields[0], @@ -209,8 +302,8 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange_ const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { { &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psv4_1bt, + &upb_psv4_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -242,7 +335,38 @@ const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973704, 1125899906973704), + UPB_SIZE(2251799813947408, 2251799813947408), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0], &google_protobuf_DescriptorProto_ExtensionRange__fields[0], @@ -257,8 +381,8 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__ const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { { &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psv4_1bt, + &upb_psv4_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -290,7 +414,38 @@ const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973704, 1125899906973704), + UPB_SIZE(2251799813947408, 2251799813947408), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, NULL, &google_protobuf_DescriptorProto_ReservedRange__fields[0], @@ -341,7 +496,38 @@ const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_ExtensionRangeOptions_submsgs[0], &google_protobuf_ExtensionRangeOptions__fields[0], @@ -369,23 +555,23 @@ static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[11 const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { { &fastdecode_generic, + &upb_pss_1bt, + &upb_pss_1bt, + &upb_psv4_1bt, + &upb_psv4_1bt, + &upb_psv4_1bt, + &upb_pss_1bt, + &upb_pss_1bt, &fastdecode_generic, + &upb_psv4_1bt, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psb1_2bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -402,7 +588,38 @@ const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(10133099165777930, 11258999072620554), + UPB_SIZE(12384898983657490, 15762598704185362), + UPB_SIZE(6755399441580056, 6755399441580056), + UPB_SIZE(2251799813816352, 2251799813816352), + UPB_SIZE(4503599627632680, 4503599627632680), + UPB_SIZE(14636698805731378, 20266198339944498), + UPB_SIZE(16888498636193850, 24769797984092218), + UPB_SIZE(0, 0), + UPB_SIZE(7881299348947016, 7881299348947016), + UPB_SIZE(19140298483433554, 29273397645017170), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(9007199256838280, 9007199256838280), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_FieldDescriptorProto_submsgs[0], &google_protobuf_FieldDescriptorProto__fields[0], @@ -421,7 +638,7 @@ static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2] const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { { &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -454,7 +671,38 @@ const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973706, 2251799813816330), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_OneofDescriptorProto_submsgs[0], &google_protobuf_OneofDescriptorProto__fields[0], @@ -478,7 +726,7 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5] const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { { &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -511,7 +759,38 @@ const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973706, 2251799813816330), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_EnumDescriptorProto_submsgs[0], &google_protobuf_EnumDescriptorProto__fields[0], @@ -526,8 +805,8 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReserve const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { { &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psv4_1bt, + &upb_psv4_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -559,7 +838,38 @@ const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msgini &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973704, 1125899906973704), + UPB_SIZE(2251799813947408, 2251799813947408), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, NULL, &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0], @@ -579,8 +889,8 @@ static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__field const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { { &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, + &upb_psv4_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -612,7 +922,38 @@ const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(2251799813947402, 2251799813947402), + UPB_SIZE(1125899906973712, 1125899906973712), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_EnumValueDescriptorProto_submsgs[0], &google_protobuf_EnumValueDescriptorProto__fields[0], @@ -633,7 +974,7 @@ static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[ const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { { &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -666,7 +1007,38 @@ const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973706, 2251799813816330), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_ServiceDescriptorProto_submsgs[0], &google_protobuf_ServiceDescriptorProto__fields[0], @@ -689,12 +1061,12 @@ static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6 const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { { &fastdecode_generic, + &upb_pss_1bt, + &upb_pss_1bt, + &upb_pss_1bt, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psb1_1bt, + &upb_psb1_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -722,7 +1094,38 @@ const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899907366922, 2251799814209546), + UPB_SIZE(3377699721576466, 6755399442104338), + UPB_SIZE(5629499536310298, 11258999070523418), + UPB_SIZE(0, 0), + UPB_SIZE(281474976841768, 281474976841768), + UPB_SIZE(562949953683504, 562949953683504), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_MethodDescriptorProto_submsgs[0], &google_protobuf_MethodDescriptorProto__fields[0], @@ -760,40 +1163,71 @@ static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { const upb_msglayout google_protobuf_FileOptions_msginit = { { &fastdecode_generic, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, + &upb_pss_1bt, + &upb_psv4_1bt, + &upb_psb1_1bt, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, + &upb_psb1_2bt, + &upb_psb1_2bt, + &upb_psb1_2bt, &fastdecode_generic, + &upb_psb1_2bt, &fastdecode_generic, &fastdecode_generic, + &upb_psb1_2bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, + &upb_psb1_2bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psb1_2bt, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(7881299482116106, 9007199388958730), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(10133099430019138, 13510799150547010), + UPB_SIZE(2251799813816392, 2251799813816392), + UPB_SIZE(4503599627632720, 4503599627632720), + UPB_SIZE(12384899512139866, 18014399046352986), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(4785074604605568, 4785074604605568), + UPB_SIZE(5066549581840520, 5066549581840520), + UPB_SIZE(5348024559599760, 5348024559599760), + UPB_SIZE(0, 0), + UPB_SIZE(5629499538407584, 5629499538407584), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(5910974519312568, 5910974519312568), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(6192449504411864, 6192449504411864), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(6473924497899768, 6473924497899768), }, &google_protobuf_FileOptions_submsgs[0], &google_protobuf_FileOptions__fields[0], @@ -815,13 +1249,13 @@ static const upb_msglayout_field google_protobuf_MessageOptions__fields[5] = { const upb_msglayout google_protobuf_MessageOptions_msginit = { { &fastdecode_generic, + &upb_psb1_1bt, + &upb_psb1_1bt, + &upb_psb1_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psb1_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -848,7 +1282,38 @@ const upb_msglayout google_protobuf_MessageOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(281474976841736, 281474976841736), + UPB_SIZE(562949953683472, 562949953683472), + UPB_SIZE(844424930656280, 844424930656280), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(1125899907891256, 1125899907891256), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_MessageOptions_submsgs[0], &google_protobuf_MessageOptions__fields[0], @@ -872,16 +1337,16 @@ static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = { const upb_msglayout google_protobuf_FieldOptions_msginit = { { &fastdecode_generic, + &upb_psv4_1bt, + &upb_psb1_1bt, + &upb_psb1_1bt, &fastdecode_generic, + &upb_psb1_1bt, + &upb_psv4_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psb1_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -905,7 +1370,38 @@ const upb_msglayout google_protobuf_FieldOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(2251799813816328, 2251799813816328), + UPB_SIZE(6755399441580048, 6755399441580048), + UPB_SIZE(7036874418815000, 7036874418815000), + UPB_SIZE(0, 0), + UPB_SIZE(7318349396574248, 7318349396574248), + UPB_SIZE(4503599627632688, 4503599627632688), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(7599824375382096, 7599824375382096), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_FieldOptions_submsgs[0], &google_protobuf_FieldOptions__fields[0], @@ -956,7 +1452,38 @@ const upb_msglayout google_protobuf_OneofOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_OneofOptions_submsgs[0], &google_protobuf_OneofOptions__fields[0], @@ -977,8 +1504,8 @@ const upb_msglayout google_protobuf_EnumOptions_msginit = { { &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psb1_1bt, + &upb_psb1_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -1009,7 +1536,38 @@ const upb_msglayout google_protobuf_EnumOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(281474976841744, 281474976841744), + UPB_SIZE(562949953683480, 562949953683480), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_EnumOptions_submsgs[0], &google_protobuf_EnumOptions__fields[0], @@ -1028,7 +1586,7 @@ static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2] = { const upb_msglayout google_protobuf_EnumValueOptions_msginit = { { &fastdecode_generic, - &fastdecode_generic, + &upb_psb1_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -1061,7 +1619,38 @@ const upb_msglayout google_protobuf_EnumValueOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(281474976841736, 281474976841736), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_EnumValueOptions_submsgs[0], &google_protobuf_EnumValueOptions__fields[0], @@ -1113,7 +1702,38 @@ const upb_msglayout google_protobuf_ServiceOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_ServiceOptions_submsgs[0], &google_protobuf_ServiceOptions__fields[0], @@ -1166,7 +1786,38 @@ const upb_msglayout google_protobuf_MethodOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_MethodOptions_submsgs[0], &google_protobuf_MethodOptions__fields[0], @@ -1192,12 +1843,12 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, + &upb_pss_1bt, + &upb_psv8_1bt, + &upb_psv8_1bt, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -1223,7 +1874,38 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(9007199255789594, 9007199255789594), + UPB_SIZE(2251799813816352, 2251799813816352), + UPB_SIZE(4503599627632680, 4503599627632680), + UPB_SIZE(0, 0), + UPB_SIZE(11258999070523450, 13510798884208698), + UPB_SIZE(13510798886305858, 18014398513676354), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_UninterpretedOption_submsgs[0], &google_protobuf_UninterpretedOption__fields[0], @@ -1238,8 +1920,8 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__f const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { { &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, + &upb_psb1_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -1271,7 +1953,38 @@ const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899907104778, 2251799813947402), + UPB_SIZE(281474976841744, 281474976841744), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, NULL, &google_protobuf_UninterpretedOption_NamePart__fields[0], @@ -1322,7 +2035,38 @@ const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_SourceCodeInfo_submsgs[0], &google_protobuf_SourceCodeInfo__fields[0], @@ -1342,8 +2086,8 @@ const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -1373,7 +2117,38 @@ const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973722, 2251799813816346), + UPB_SIZE(3377699720790050, 6755399441317922), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, NULL, &google_protobuf_SourceCodeInfo_Location__fields[0], @@ -1424,7 +2199,38 @@ const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_GeneratedCodeInfo_submsgs[0], &google_protobuf_GeneratedCodeInfo__fields[0], @@ -1442,9 +2248,9 @@ const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { { &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, + &upb_psv4_1bt, + &upb_psv4_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -1474,7 +2280,38 @@ const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(3377699721052178, 4503599627894802), + UPB_SIZE(1125899906973720, 1125899906973720), + UPB_SIZE(2251799813947424, 2251799813947424), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, NULL, &google_protobuf_GeneratedCodeInfo_Annotation__fields[0], diff --git a/tests/test_generated_code.c b/tests/test_generated_code.c index c6f024a61f..c25f7cc8a1 100644 --- a/tests/test_generated_code.c +++ b/tests/test_generated_code.c @@ -47,8 +47,11 @@ static void test_scalars() { msg2 = protobuf_test_messages_proto3_TestAllTypesProto3_parse( serialized.data, serialized.size, arena); + ASSERT(msg2); ASSERT(protobuf_test_messages_proto3_TestAllTypesProto3_optional_int32( msg2) == 10); + fprintf(stderr, "optional_int64: %d\n", (int)protobuf_test_messages_proto3_TestAllTypesProto3_optional_int64( + msg2)); ASSERT(protobuf_test_messages_proto3_TestAllTypesProto3_optional_int64( msg2) == 20); ASSERT(protobuf_test_messages_proto3_TestAllTypesProto3_optional_uint32( diff --git a/upb/decode.c b/upb/decode.c index 6e0779bf2a..8b87ed2a01 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -146,6 +146,11 @@ static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, UPB_NORETURN static void decode_err(upb_decstate *d) { longjmp(d->err, 1); } +const char *fastdecode_err(upb_decstate *d) { + longjmp(d->err, 1); + return NULL; +} + void decode_verifyutf8(upb_decstate *d, const char *buf, int len) { static const uint8_t utf8_offset[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -596,8 +601,9 @@ UPB_NOINLINE const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits, uint64_t data) { - if (hasbits) *(uint32_t*)msg |= hasbits; /* Sync hasbits. */ + *(uint32_t*)msg |= hasbits >> 16; /* Sync hasbits. */ (void)data; + if (ptr == d->limit) return ptr; ptr = decode_field(d, ptr, msg, table); return fastdecode_dispatch(d, ptr, msg, table, hasbits); } @@ -605,12 +611,7 @@ const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, UPB_NOINLINE static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *layout) { - while (1) { - ptr = fastdecode_dispatch(d, ptr, msg, layout, 0); - if (ptr == d->limit) break; - ptr = decode_field(d, ptr, msg, layout); - } - + ptr = fastdecode_dispatch(d, ptr, msg, layout, 0); if (ptr != d->limit) decode_err(d); return ptr; } diff --git a/upb/decode.h b/upb/decode.h index 29194534b4..9a8473e026 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -18,13 +18,10 @@ bool upb_decode(const char *buf, size_t size, upb_msg *msg, /* Internal only: data pertaining to the parse. */ typedef struct upb_decstate { - char *arena_ptr, *arena_end; - const void *rep_end; const char *limit; /* End of delimited region or end of buffer. */ const char *fastlimit; /* End of delimited region or end of buffer. */ const char *fastend; upb_array *arr; - _upb_field_parser *resume; upb_arena *arena; int depth; uint32_t end_group; /* Set to field number of END_GROUP tag, if any. */ @@ -36,6 +33,39 @@ const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits, uint64_t data); +const char *fastdecode_err(upb_decstate *d); + +#define UPB_PARSE_PARAMS \ + upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, \ + uint64_t hasbits, uint64_t data + +#define F(card, type, valbytes, tagbytes) \ + const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS); + +#define TYPES(card, tagbytes) \ + F(card, b, 1, tagbytes) \ + F(card, v, 4, tagbytes) \ + F(card, v, 8, tagbytes) \ + F(card, z, 4, tagbytes) \ + F(card, z, 8, tagbytes) + +#define TAGBYTES(card) \ + TYPES(card, 1) \ + TYPES(card, 2) + +TAGBYTES(s) +TAGBYTES(o) +//TAGBYTES(r) + +const char *upb_pss_1bt(UPB_PARSE_PARAMS); +const char *upb_pss_2bt(UPB_PARSE_PARAMS); +const char *upb_pos_1bt(UPB_PARSE_PARAMS); +const char *upb_pos_2bt(UPB_PARSE_PARAMS); + +#undef F +#undef TYPES +#undef TAGBYTES +#undef UPB_PARSE_PARAMS #ifdef __cplusplus } /* extern "C" */ diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 1b9e6ead3f..5a851f428f 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -9,28 +9,28 @@ #define UPB_PARSE_ARGS d, ptr, msg, table, hasbits, data +typedef enum { + CARD_s = 0, + CARD_o = 1, + CARD_r = 2, + CARD_p = 3 +} upb_card; + UPB_NOINLINE const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits) { uint16_t tag; - uint64_t data; + uint64_t data = 0;; size_t idx; - if (UPB_UNLIKELY(ptr >= d->fastlimit)) return ptr; + if (UPB_UNLIKELY(ptr >= d->fastlimit)) { + return fastdecode_generic(UPB_PARSE_ARGS); + } memcpy(&tag, ptr, 2); idx = (tag & 0xf8) >> 3; data = table->field_data[idx] ^ tag; return table->field_parser[idx](UPB_PARSE_ARGS); } -#if 0 - -const char *fastdecode_err(upb_decstate *d); - -const char *fastdecode_reallocarr(upb_decstate *d, const char *ptr, - upb_msg *msg, upb_msglayout *table, - size_t needbytes); - - UPB_FORCEINLINE static bool fastdecode_checktag(uint64_t data, int tagbytes) { if (tagbytes == 1) { @@ -40,337 +40,6 @@ static bool fastdecode_checktag(uint64_t data, int tagbytes) { } } -UPB_FORCEINLINE -bool fastdecode_boundscheck(const char *ptr, unsigned len, const char *end) { - uintptr_t uptr = (uintptr_t)ptr; - uintptr_t uend = (uintptr_t)end; - uintptr_t res = uptr + len; - return res < uptr || res > uend; -} - -UPB_FORCEINLINE -static bool fastdecode_readlongsize(const char *ptr, uint32_t *size, - const char **out) { - int i; - *size = ptr[0]; - UPB_ASSERT(ptr[0] < 0); - for (i = 1; i < 5; i++) { - uint32_t byte = ptr[i]; - (*size) += (byte - 1) << (7 * i); - if (UPB_LIKELY(byte < 128)) { - *out = ptr + i + 1; - return true; - } - } - return false; -} - -UPB_FORCEINLINE -static uint16_t fastdecode_readtag(const char *ptr, int tagbytes) { - uint16_t ret = 0; - memcpy(&ret, ptr, tagbytes); - return ret; -} - -typedef enum { - CARD_s = 0, - CARD_o = 1, - CARD_r = 2, - CARD_p = 3 -} upb_card; - -UPB_FORCEINLINE -static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, - uint64_t *data, uint64_t *hasbits, - upb_card card, int tagbytes, int valbytes, - bool store_len) { - void *field = (char *)msg + (*data >> 48); - - switch (card) { - case CARD_s: - *hasbits |= *data; - return field; - case CARD_o: { - uint32_t *case_ptr = UPB_PTR_AT(msg, (*data >> 16) & 0xffff, uint32_t); - *case_ptr = (*data >> 32) & 0xffff; - return field; - } - case CARD_r: { - upb_array **arr_p = field; - upb_array *arr; - uint64_t elem_avail; - uint16_t expected_tag; - *hasbits >>= 16; - *(uint32_t*)msg |= *hasbits; - *hasbits = 0; - if (UPB_LIKELY(!*arr_p)) { - size_t need = (valbytes * 4) + sizeof(upb_array); - if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < need)) { - *data = 0; - return NULL; - } - arr = (void*)d->arena_ptr; - field = arr + 1; - arr->data = (uintptr_t)field; - *arr_p = arr; - arr->size = 4; - if (store_len) arr->len = 5; - elem_avail = 4; - d->arena_ptr += need; - } else { - arr = *arr_p; - field = _upb_array_ptr(arr); - elem_avail = arr->size - arr->len; - field = (char*)field + (arr->len * valbytes); - if (store_len) arr->len = arr->size + 1; - } - expected_tag = fastdecode_readtag(ptr, tagbytes); - *data = elem_avail | ((uint64_t)expected_tag << 32); - d->arr = arr; - return field; - } - default: - UPB_UNREACHABLE(); - } -} - -/* string fields **************************************************************/ - -UPB_NOINLINE -static const char *fastdecode_longstring(upb_decstate *d, const char *ptr, - upb_msg *msg, upb_msglayout *table, - uint64_t hasbits, upb_strview *dst) { - uint32_t len; - if (!fastdecode_readlongsize(ptr, &len, &ptr)) { - return fastdecode_err(d); - } - dst->data = ptr; - dst->size = len; - if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit))) { - return fastdecode_err(d); - } - ptr += len; - return fastdecode_dispatch(d, ptr, msg, table, hasbits); -} - -UPB_FORCEINLINE -static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, - upb_card card) { - upb_strview *dst; - - if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { - return ptr; - } - - dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, card, tagbytes, - sizeof(upb_strview), true); - -again: - if (card == CARD_r) { - if (UPB_UNLIKELY((uint32_t)data == 0)) { - return fastdecode_reallocarr(d, ptr, msg, table, sizeof(upb_strview)); - } - } - - { - int64_t len = ptr[tagbytes]; - if (UPB_UNLIKELY(len < 0)) { - if (card == CARD_r) { - d->arr->len -= (uint32_t)data; - } - return fastdecode_longstring(d, ptr, msg, table, hasbits, dst); - } - ptr += tagbytes + 1; - dst->data = ptr; - dst->size = len; - if (UPB_UNLIKELY(!fastdecode_boundscheck(ptr, len, d->limit))) { - return fastdecode_err(d); - } - ptr += len; - } - - - if (card == CARD_r) { - if (UPB_LIKELY(ptr < d->fastlimit) && - fastdecode_readtag(ptr, tagbytes) == (uint16_t)(data >> 32)) { - data--; - dst++; - goto again; - } - d->arr->len -= (uint32_t)data; - } - - return fastdecode_dispatch(d, ptr, msg, table, hasbits); -} - -const char *upb_pss_1bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_s); -} - -const char *upb_pos_1bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_o); -} - -const char *upb_prs_1bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_r); -} - -const char *upb_pss_2bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_s); -} - -const char *upb_pos_2bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_o); -} - -const char *upb_prs_2bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_r); -} - -/* fixed fields ***************************************************************/ - -UPB_FORCEINLINE -static const char *fastdecode_fixed(UPB_PARSE_PARAMS, int tagbytes, int valbytes, - upb_card card, _upb_field_parser *fallback) { - char *dst; - - if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { - if (fallback) { - // Patch data to amtch packed wiretype. - data ^= 0x2 ^ (valbytes == 4 ? 5 : 1); - return fallback(UPB_PARSE_ARGS); - } else { - return ptr; - } - } - - dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, card, tagbytes, - valbytes, true); - -again: - if (card == CARD_r) { - if (UPB_UNLIKELY((uint32_t)data == 0)) { - return fastdecode_reallocarr(d, ptr, msg, table, valbytes); - } - } - - { - ptr += tagbytes; - memcpy(dst, ptr, valbytes); - ptr += valbytes; - } - - if (card == CARD_r) { - if (UPB_LIKELY(ptr < d->fastlimit) && - fastdecode_readtag(ptr, tagbytes) == (uint16_t)(data >> 32)) { - data--; - dst += valbytes; - goto again; - } - d->arr->len -= (uint32_t)data; - } - - return fastdecode_dispatch(d, ptr, msg, table, hasbits); -} - -UPB_NOINLINE -const char *fastdecode_longfixedpacked(upb_decstate *d, const char *ptr, - upb_msg *msg, upb_msglayout *table, - uint64_t hasbits, void *dst); - -UPB_FORCEINLINE -static const char *fastdecode_fixedpacked(UPB_PARSE_PARAMS, int tagbytes, int valbytes, - _upb_field_parser *fallback) { - char *dst; - char *end; - uint32_t len; - - if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { - if (fallback) { - // Patch data to amtch packed wiretype. - data ^= 0x2 ^ (valbytes == 4 ? 5 : 1); - return fallback(UPB_PARSE_ARGS); - } else { - return ptr; - } - } - - dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, CARD_r, tagbytes, - valbytes, false); - - len = ptr[tagbytes]; - if (UPB_UNLIKELY(len < 0)) { - return fastdecode_longfixedpacked(d, ptr, msg, table, hasbits, dst); - } - - if (UPB_UNLIKELY(len > (size_t)(uint32_t)data * valbytes)) { - return fastdecode_reallocarr(d, ptr, msg, table, len); - } - - ptr += tagbytes; - - if (UPB_UNLIKELY((len & (valbytes - 1)) != 0 || /* Non-multiple length. */ - fastdecode_boundscheck(ptr, len, d->limit))) { - return fastdecode_err(d); - } - - end = dst + len; - d->arr->len += len / valbytes; - - while (dst < end) { - memcpy(dst, ptr, valbytes); /* Inline memcpy() loop */ - dst += valbytes; - ptr += valbytes; - } - - return fastdecode_dispatch(d, ptr, msg, table, hasbits); -} - -UPB_NOINLINE -const char *upb_prf8_1bt(UPB_PARSE_PARAMS); - -UPB_NOINLINE -const char *upb_ppf8_1bt(UPB_PARSE_PARAMS) { - return fastdecode_fixedpacked(UPB_PARSE_ARGS, 1, 8, &upb_prf8_1bt); -} - -UPB_NOINLINE -const char *upb_psf8_1bt(UPB_PARSE_PARAMS) { - return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_s, NULL); -} - -UPB_NOINLINE -const char *upb_pof8_1bt(UPB_PARSE_PARAMS) { - return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_o, NULL); -} - -UPB_NOINLINE -const char *upb_prf8_1bt(UPB_PARSE_PARAMS) { - return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_r, &upb_ppf8_1bt); -} - -// Generate all fixed functions. -// {s,o,r,p} x {f4,f8} x {1bt,2bt} - -#define F(card, valbytes, tagbytes) \ - const char *upb_p##card##f##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ - return fastdecode_fixed(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card); \ - } - -#define TYPES(card, tagbytes) \ - F(card, 4, tagbytes) \ - F(card, 8, tagbytes) - -#define TAGBYTES(card) \ - TYPES(card, 1) \ - TYPES(card, 2) - -TAGBYTES(s) -TAGBYTES(o) -TAGBYTES(r) -TAGBYTES(p) - - UPB_FORCEINLINE uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigzag) { if (valbytes == 1) { return val != 0; @@ -387,155 +56,44 @@ UPB_FORCEINLINE uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigza } UPB_FORCEINLINE -static const char *fastdecode_longvarint_impl(const char *ptr, void *field, - int valbytes) { - // The algorithm relies on sign extension to set all high bits when the varint - // continues. This way it can use "and" to aggregate in to the result. - const int8_t *p = (const int8_t*)(ptr); - int64_t res1 = *p; - uint64_t ones = res1; // save the useful high bit 1's in res1 - uint64_t byte; - int64_t res2, res3; - int sign_bit; - - // However this requires the low bits after shifting to be 1's as well. On - // x86_64 a shld from a single register filled with enough 1's in the high - // bits can accomplish all this in one instruction. It so happens that res1 - // has 57 high bits of ones, which is enough for the largest shift done. - assert(res1 >> 7 == -1); +static void *fastdecode_getfield(upb_msg *msg, uint64_t *data, + uint64_t *hasbits, upb_card card) { + size_t ofs = (*data >> 48); + void *field = (char *)msg + ofs; -#define SHLD(n) byte = ((byte << (n * 7)) | (ones >> (64 - (n * 7)))) - - // Micro benchmarks show a substantial improvement to capture the sign - // of the result in the case of just assigning the result of the shift - // (ie first 2 steps). -#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__) -#define SHLD_SIGN(n) \ - __asm__("shldq %3, %2, %1" \ - : "=@ccs"(sign_bit), "+r"(byte) \ - : "r"(ones), "i"(n * 7)) -#else -#define SHLD_SIGN(n) \ - do { \ - SHLD(n); \ - sign_bit = (int64_t)(byte) < 0; \ - } while (0) -#endif - byte = p[1]; - SHLD_SIGN(1); - res2 = byte; - if (!sign_bit) goto done2; - byte = p[2]; - SHLD_SIGN(2); - res3 = byte; - if (!sign_bit) goto done3; - byte = p[3]; - SHLD(3); - res1 &= byte; - if (res1 >= 0) goto done4; - byte = p[4]; - SHLD(4); - res2 &= byte; - if (res2 >= 0) goto done5; - byte = p[5]; - SHLD(5); - res3 &= byte; - if (res3 >= 0) goto done6; - byte = p[6]; - SHLD(6); - res1 &= byte; - if (res1 >= 0) goto done7; - byte = p[7]; - SHLD(7); - res2 &= byte; - if (res2 >= 0) goto done8; - byte = p[8]; - SHLD(8); - res3 &= byte; - if (res3 >= 0) goto done9; - byte = p[9]; - // Last byte only contains 0 or 1 for valid 64bit varints. If it's 0 it's - // a denormalized varint that shouldn't happen. The continuation bit of byte - // 9 has already the right value hence just expect byte to be 1. - if (UPB_LIKELY(byte == 1)) goto done10; - if (byte == 0) { - res3 ^= (uint64_t)(1) << 63; - goto done10; + switch (card) { + case CARD_s: + *hasbits |= *data; + return field; + case CARD_o: { + uint32_t *case_ptr = UPB_PTR_AT(msg, (*data >> 16) & 0xffff, uint32_t); + *case_ptr = (*data >> 32) & 0xffff; + return field; + } + case CARD_r: + UPB_ASSERT(false); /* NYI */ + default: + UPB_UNREACHABLE(); } - - return NULL; // Value is too long to be a varint64 - -#define DONE(n) \ - done##n : { \ - uint64_t val = res1 & res2 & res3; \ - memcpy(field, &val, valbytes); \ - return (const char *)p + n; \ - }; - -done2 : { - uint64_t val = res1 & res2; - memcpy(field, &val, valbytes); - return (const char*)p + 2; -} - - DONE(3) - DONE(4) - DONE(5) - DONE(6) - DONE(7) - DONE(8) - DONE(9) - DONE(10) - -#undef DONE -#undef SHLD -#undef SHLD_SIGN } -UPB_NOINLINE -static const char *fastdecode_longvarint32(UPB_PARSE_PARAMS) { - (void)d; - (void)msg; - (void)table; - (void)hasbits; - return fastdecode_longvarint_impl(ptr, (void*)data, 4); -} - -UPB_NOINLINE -static const char *fastdecode_longvarint64(UPB_PARSE_PARAMS) { - (void)d; - (void)msg; - (void)table; - (void)hasbits; - return fastdecode_longvarint_impl(ptr, (void*)data, 8); -} - -UPB_FORCEINLINE -static const char *fastdecode_longvarint(UPB_PARSE_PARAMS, int valbytes) { - if (valbytes == 4) { - return fastdecode_longvarint32(UPB_PARSE_ARGS); - } else if (valbytes == 8) { - return fastdecode_longvarint64(UPB_PARSE_ARGS); - } - UPB_UNREACHABLE(); -} +/* varint fields **************************************************************/ UPB_FORCEINLINE static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, - int valbytes, bool zigzag, bool oneof) { + int valbytes, upb_card card, bool zigzag) { uint64_t val = 0; - void *field; - if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) return ptr; - ptr += tagbytes; - fastdecode_getfield(msg, data, &hasbits, oneof); - field = (char*)msg + (data >> 48); - if (UPB_UNLIKELY(*ptr < 0)) { - return fastdecode_longvarint(d, ptr, msg, table, hasbits, (uint64_t)field, - valbytes); + void *dst; + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + return fastdecode_generic(UPB_PARSE_ARGS);; } - val = fastdecode_munge(*ptr, valbytes, zigzag); - memcpy(field, &val, valbytes); - return fastdecode_dispatch(d, ptr + 1, msg, table, hasbits); + dst = fastdecode_getfield(msg, &data, &hasbits, card); + if (UPB_UNLIKELY(ptr[tagbytes] < 0)) { + return fastdecode_generic(UPB_PARSE_ARGS); + } + val = fastdecode_munge(ptr[tagbytes], valbytes, zigzag); + memcpy(dst, &val, valbytes); + return fastdecode_dispatch(d, ptr + tagbytes + 1, msg, table, hasbits); } // Generate all varint functions. @@ -547,8 +105,8 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, #define F(card, type, valbytes, tagbytes) \ const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ - return fastdecode_varint(UPB_PARSE_ARGS, tagbytes, valbytes, type##_ZZ, \ - card##_ONEOF); \ + return fastdecode_varint(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card, \ + type##_ZZ); \ } #define TYPES(card, tagbytes) \ @@ -564,7 +122,7 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, TAGBYTES(s) TAGBYTES(o) -TAGBYTES(r) +//TAGBYTES(r) #undef z_ZZ #undef b_ZZ @@ -576,4 +134,52 @@ TAGBYTES(r) #undef TYPES #undef TAGBYTES -#endif +/* string fields **************************************************************/ + +UPB_FORCEINLINE +bool fastdecode_boundscheck(const char *ptr, unsigned len, const char *end) { + uintptr_t uptr = (uintptr_t)ptr; + uintptr_t uend = (uintptr_t)end; + uintptr_t res = uptr + len; + return res < uptr || res > uend; +} + +UPB_FORCEINLINE +static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, + upb_card card) { + upb_strview *dst; + int64_t len; + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + return fastdecode_generic(UPB_PARSE_ARGS); + } + + dst = fastdecode_getfield(msg, &data, &hasbits, card); + len = ptr[tagbytes]; + if (UPB_UNLIKELY(len < 0)) { + return fastdecode_generic(UPB_PARSE_ARGS); + } + ptr += tagbytes + 1; + dst->data = ptr; + dst->size = len; + if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit))) { + return fastdecode_err(d); + } + ptr += len; + return fastdecode_dispatch(d, ptr, msg, table, hasbits); +} + +const char *upb_pss_1bt(UPB_PARSE_PARAMS) { + return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_s); +} + +const char *upb_pos_1bt(UPB_PARSE_PARAMS) { + return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_o); +} + +const char *upb_pss_2bt(UPB_PARSE_PARAMS) { + return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_s); +} + +const char *upb_pos_2bt(UPB_PARSE_PARAMS) { + return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_o); +} diff --git a/upbc/generator.cc b/upbc/generator.cc index cd247a2ad7..6fd1c85451 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -703,6 +703,101 @@ int TableDescriptorType(const protobuf::FieldDescriptor* field) { } } +typedef std::pair TableEntry; + +void TryFillTableEntry(const protobuf::Descriptor* message, + const MessageLayout& layout, int num, TableEntry& ent) { + const protobuf::FieldDescriptor* field = message->FindFieldByNumber(num); + if (!field) return; + + std::string type = ""; + std::string cardinality = ""; + uint8_t wire_type = 0; + switch (field->type()) { + case protobuf::FieldDescriptor::TYPE_BOOL: + type = "b1"; + break; + case protobuf::FieldDescriptor::TYPE_INT32: + case protobuf::FieldDescriptor::TYPE_ENUM: + case protobuf::FieldDescriptor::TYPE_UINT32: + type = "v4"; + break; + case protobuf::FieldDescriptor::TYPE_INT64: + case protobuf::FieldDescriptor::TYPE_UINT64: + type = "v8"; + break; + case protobuf::FieldDescriptor::TYPE_SINT32: + type = "z4"; + break; + case protobuf::FieldDescriptor::TYPE_SINT64: + type = "z8"; + break; + case protobuf::FieldDescriptor::TYPE_STRING: + case protobuf::FieldDescriptor::TYPE_BYTES: + type = "s"; + wire_type = 2; + break; + default: + return; // Not supported yet. + } + + switch (field->label()) { + case protobuf::FieldDescriptor::LABEL_REPEATED: + return; // Not supported yet. + case protobuf::FieldDescriptor::LABEL_OPTIONAL: + case protobuf::FieldDescriptor::LABEL_REQUIRED: + if (field->real_containing_oneof()) { + cardinality = "o"; + } else { + cardinality = "s"; + } + break; + } + + uint16_t expected_tag = (num << 3) | wire_type; + if (num > 15) num |= 0x100; + MessageLayout::Size offset = layout.GetFieldOffset(field); + + MessageLayout::Size data; + data.size32 = ((uint64_t)offset.size32 << 48) | expected_tag; + data.size64 = ((uint64_t)offset.size64 << 48) | expected_tag; + + if (field->real_containing_oneof()) { + MessageLayout::Size case_ofs = + layout.GetOneofCaseOffset(field->real_containing_oneof()); + data.size32 |= ((uint64_t)num << 32) | (case_ofs.size32 << 16); + data.size64 |= ((uint64_t)num << 32) | (case_ofs.size64 << 16); + } else { + uint32_t hasbit_mask = 0; + + if (layout.HasHasbit(field)) { + int index = layout.GetHasbitIndex(field); + if (index > 31) return; + hasbit_mask = 1 << index; + } + + data.size32 |= (uint64_t)hasbit_mask << 16; + data.size64 |= (uint64_t)hasbit_mask << 16; + } + + ent.first = absl::Substitute("upb_p$0$1_$2bt", cardinality, type, + (num < 15) ? "1" : "2"); + ent.second = data; +} + +std::vector FastDecodeTable(const protobuf::Descriptor* message, + const MessageLayout& layout) { + std::vector table; + MessageLayout::Size empty_size; + empty_size.size32 = 0; + empty_size.size64 = 0; + for (int i = 0; i < 32; i++) { + table.emplace_back(TableEntry{"fastdecode_generic", empty_size}); + TryFillTableEntry(message, layout, i, table.back()); + } + return table; +} + void WriteSource(const protobuf::FileDescriptor* file, Output& output) { EmitFileWarning(file, output); @@ -803,14 +898,18 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output) { output("};\n\n"); } + std::vector table = FastDecodeTable(message, layout); + output("const upb_msglayout $0 = {\n", MessageInit(message)); output(" {\n"); - for (int i = 0; i < 32; i++) { - output(" &fastdecode_generic,\n"); + for (const auto& ent : table) { + output(" &$0,\n", ent.first); } output(" },\n"); output(" {\n"); - output(" 0\n"); + for (const auto& ent : table) { + output(" $0,\n", GetSizeInit(ent.second)); + } output(" },\n"); output(" $0,\n", submsgs_array_ref); output(" $0,\n", fields_array_ref); From d43ccfa079dbaad02a6979fa2619a399cbfb2ceb Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 5 Oct 2020 11:45:49 -0700 Subject: [PATCH 08/88] Revert test changes. --- tests/test_generated_code.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/test_generated_code.c b/tests/test_generated_code.c index c25f7cc8a1..c6f024a61f 100644 --- a/tests/test_generated_code.c +++ b/tests/test_generated_code.c @@ -47,11 +47,8 @@ static void test_scalars() { msg2 = protobuf_test_messages_proto3_TestAllTypesProto3_parse( serialized.data, serialized.size, arena); - ASSERT(msg2); ASSERT(protobuf_test_messages_proto3_TestAllTypesProto3_optional_int32( msg2) == 10); - fprintf(stderr, "optional_int64: %d\n", (int)protobuf_test_messages_proto3_TestAllTypesProto3_optional_int64( - msg2)); ASSERT(protobuf_test_messages_proto3_TestAllTypesProto3_optional_int64( msg2) == 20); ASSERT(protobuf_test_messages_proto3_TestAllTypesProto3_optional_uint32( From 7ec2c5234601cfa756fb491a58fe8a7fe42f2eb1 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 6 Oct 2020 22:11:57 -0700 Subject: [PATCH 09/88] Donate/steal from arena to accelerate decoding. --- benchmark.py | 6 +- .../google/protobuf/descriptor.upb.c | 16 +-- upb/decode.c | 125 +++++++++++++++--- upb/msg.c | 68 +++++----- upb/msg.h | 26 ++-- upbc/message_layout.cc | 2 +- 6 files changed, 172 insertions(+), 71 deletions(-) diff --git a/benchmark.py b/benchmark.py index b75dd4d5a8..2e36a2ddb7 100755 --- a/benchmark.py +++ b/benchmark.py @@ -30,12 +30,12 @@ def Run(cmd): def Benchmark(outbase, runs=12): tmpfile = "/tmp/bench-output.json" Run("rm -rf {}".format(tmpfile)) - Run("bazel test :all") - Run("bazel build -c opt :benchmark") + Run("CC=clang bazel test :all") + Run("CC=clang bazel build -c opt :benchmark") Run("./bazel-bin/benchmark --benchmark_out_format=json --benchmark_out={} --benchmark_repetitions={}".format(tmpfile, runs)) - Run("bazel build -c opt --copt=-g :conformance_upb") + Run("CC=clang bazel build -c opt --copt=-g :conformance_upb") Run("cp -f bazel-bin/conformance_upb {}.bin".format(outbase)) with open(tmpfile) as f: diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index 44cd3ae2ce..62c71ace2a 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -23,7 +23,7 @@ static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1] = const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { &google_protobuf_FileDescriptorSet_submsgs[0], &google_protobuf_FileDescriptorSet__fields[0], - UPB_SIZE(4, 8), 1, false, + UPB_SIZE(8, 8), 1, false, }; static const upb_msglayout *const google_protobuf_FileDescriptorProto_submsgs[6] = { @@ -109,7 +109,7 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__ const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { NULL, &google_protobuf_DescriptorProto_ReservedRange__fields[0], - UPB_SIZE(12, 12), 2, false, + UPB_SIZE(16, 16), 2, false, }; static const upb_msglayout *const google_protobuf_ExtensionRangeOptions_submsgs[1] = { @@ -123,7 +123,7 @@ static const upb_msglayout_field google_protobuf_ExtensionRangeOptions__fields[1 const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { &google_protobuf_ExtensionRangeOptions_submsgs[0], &google_protobuf_ExtensionRangeOptions__fields[0], - UPB_SIZE(4, 8), 1, false, + UPB_SIZE(8, 8), 1, false, }; static const upb_msglayout *const google_protobuf_FieldDescriptorProto_submsgs[1] = { @@ -193,7 +193,7 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReserve const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { NULL, &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0], - UPB_SIZE(12, 12), 2, false, + UPB_SIZE(16, 16), 2, false, }; static const upb_msglayout *const google_protobuf_EnumValueDescriptorProto_submsgs[1] = { @@ -297,7 +297,7 @@ static const upb_msglayout_field google_protobuf_MessageOptions__fields[5] = { const upb_msglayout google_protobuf_MessageOptions_msginit = { &google_protobuf_MessageOptions_submsgs[0], &google_protobuf_MessageOptions__fields[0], - UPB_SIZE(12, 16), 5, false, + UPB_SIZE(16, 16), 5, false, }; static const upb_msglayout *const google_protobuf_FieldOptions_submsgs[1] = { @@ -331,7 +331,7 @@ static const upb_msglayout_field google_protobuf_OneofOptions__fields[1] = { const upb_msglayout google_protobuf_OneofOptions_msginit = { &google_protobuf_OneofOptions_submsgs[0], &google_protobuf_OneofOptions__fields[0], - UPB_SIZE(4, 8), 1, false, + UPB_SIZE(8, 8), 1, false, }; static const upb_msglayout *const google_protobuf_EnumOptions_submsgs[1] = { @@ -438,7 +438,7 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1] = { const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { &google_protobuf_SourceCodeInfo_submsgs[0], &google_protobuf_SourceCodeInfo__fields[0], - UPB_SIZE(4, 8), 1, false, + UPB_SIZE(8, 8), 1, false, }; static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields[5] = { @@ -466,7 +466,7 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1] = const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { &google_protobuf_GeneratedCodeInfo_submsgs[0], &google_protobuf_GeneratedCodeInfo__fields[0], - UPB_SIZE(4, 8), 1, false, + UPB_SIZE(8, 8), 1, false, }; static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__fields[4] = { diff --git a/upb/decode.c b/upb/decode.c index 416ea25cc5..e65f49f628 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -137,6 +137,8 @@ static const int8_t delim_ops[37] = { /* Data pertaining to the parse. */ typedef struct { const char *limit; /* End of delimited region or end of buffer. */ + char *arena_ptr; + char *arena_end; upb_arena *arena; int depth; uint32_t end_group; /* Set to field number of END_GROUP tag, if any. */ @@ -189,12 +191,93 @@ void decode_verifyutf8(upb_decstate *d, const char *buf, int len) { if (i != len) decode_err(d); } -static bool decode_reserve(upb_decstate *d, upb_array *arr, size_t elem) { - bool need_realloc = arr->size - arr->len < elem; - if (need_realloc && !_upb_array_realloc(arr, arr->len + elem, d->arena)) { +static void decode_stealmem(upb_decstate *d) { + _upb_arena_head *a = (_upb_arena_head*)d->arena; + d->arena_ptr = a->ptr; + d->arena_end = a->end; + a->ptr = a->end; +} + +static void decode_donatemem(upb_decstate *d) { + _upb_arena_head *a = (_upb_arena_head*)d->arena; + UPB_ASSERT(a->end == d->arena_end); + a->ptr = d->arena_ptr; +} + +UPB_NOINLINE +static void *decode_mallocfallback(upb_decstate *d, size_t size) { + char *ptr = _upb_arena_slowmalloc(d->arena, size); + if (!ptr) decode_err(d); + decode_stealmem(d); + return ptr; +} + +UPB_FORCEINLINE +static void *decode_malloc(upb_decstate *d, size_t size) { + UPB_ASSERT((size & 7) == 0); + char *ptr = d->arena_ptr; + if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < size)) { + return decode_mallocfallback(d, size); + } + d->arena_ptr += size; + return ptr; +} + +static upb_msg *decode_newmsg(upb_decstate *d, const upb_msglayout *l) { + size_t size = l->size + sizeof(upb_msg_internal); + char *msg_data = decode_malloc(d, size); + memset(msg_data, 0, size); + return msg_data + sizeof(upb_msg_internal); +} + +UPB_NOINLINE +static void decode_realloc(upb_decstate *d, upb_array *arr, size_t need_elem) { + decode_donatemem(d); + bool ok = _upb_array_realloc(arr, arr->len + need_elem, d->arena); + decode_stealmem(d); + if (!ok) decode_err(d); +} + +UPB_FORCEINLINE +static bool decode_reserve(upb_decstate *d, upb_array *arr, size_t need_elem) { + if (arr->size - arr->len < need_elem) { + decode_realloc(d, arr, need_elem); + return true; + } + return false; +} + +static upb_array *decode_newarr(upb_decstate *d, upb_fieldtype_t type) { + size_t elem_size_lg2 = _upb_fieldtype_to_sizelg2[type]; + size_t count = type == UPB_TYPE_BOOL ? 8 : 4; + size_t size = sizeof(upb_array) + (count * (1 << elem_size_lg2)); + upb_array *arr = decode_malloc(d, size); + + if (!arr) { decode_err(d); } - return need_realloc; + + arr->data = _upb_array_tagptr(arr + 1, elem_size_lg2); + arr->len = 0; + arr->size = count; + + return arr; +} + +static void decode_addunknown(upb_decstate *d, upb_msg *msg, const char *ptr, + size_t len) { + upb_msg_internal *in = upb_msg_getinternal(msg); + if (!in->unknown || in->unknown->size - in->unknown->len < len) { + bool ok; + decode_donatemem(d); + ok = _upb_msg_addunknown(msg, ptr, len, d->arena); + decode_stealmem(d); + if (!ok) decode_err(d); + } else { + char *dst = UPB_PTR_AT(in->unknown + 1, in->unknown->len, char); + memcpy(dst, ptr, len); + in->unknown->len += len; + } } UPB_NOINLINE @@ -280,8 +363,7 @@ static const upb_msglayout_field *upb_find_field(const upb_msglayout *l, static upb_msg *decode_newsubmsg(upb_decstate *d, const upb_msglayout *layout, const upb_msglayout_field *field) { - const upb_msglayout *subl = layout->submsgs[field->submsg_index]; - return _upb_msg_new(subl, d->arena); + return decode_newmsg(d, layout->submsgs[field->submsg_index]); } static void decode_tosubmsg(upb_decstate *d, upb_msg *submsg, @@ -325,8 +407,7 @@ static const char *decode_toarray(upb_decstate *d, const char *ptr, if (!arr) { upb_fieldtype_t type = desctype_to_fieldtype[field->descriptortype]; - arr = _upb_array_new(d->arena, type); - if (!arr) decode_err(d); + arr = decode_newarr(d, type); *arrp = arr; } @@ -424,7 +505,9 @@ static void decode_tomap(upb_decstate *d, upb_msg *msg, char val_size = desctype_to_mapsize[val_field->descriptortype]; UPB_ASSERT(key_field->offset == 0); UPB_ASSERT(val_field->offset == sizeof(upb_strview)); + decode_donatemem(d); /* We'll let map use the actual arena. */ map = _upb_map_new(d->arena, key_size, val_size); + decode_stealmem(d); *map_p = map; } @@ -434,13 +517,15 @@ static void decode_tomap(upb_decstate *d, upb_msg *msg, if (entry->fields[1].descriptortype == UPB_DESCRIPTOR_TYPE_MESSAGE || entry->fields[1].descriptortype == UPB_DESCRIPTOR_TYPE_GROUP) { /* Create proactively to handle the case where it doesn't appear. */ - ent.v.val = upb_value_ptr(_upb_msg_new(entry->submsgs[0], d->arena)); + ent.v.val = upb_value_ptr(decode_newmsg(d, entry->submsgs[0])); } decode_tosubmsg(d, &ent.k, layout, field, val.str_val); /* Insert into map. */ + decode_donatemem(d); /* We'll let map use the actual arena. */ _upb_map_set(map, &ent.k, map->key_size, &ent.v, map->val_size, d->arena); + decode_stealmem(d); } static const char *decode_tomsg(upb_decstate *d, const char *ptr, upb_msg *msg, @@ -587,10 +672,7 @@ static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, ptr = decode_group(d, ptr, NULL, NULL, field_number); } if (msg) { - if (!_upb_msg_addunknown(msg, field_start, ptr - field_start, - d->arena)) { - decode_err(d); - } + decode_addunknown(d, msg, field_start, ptr - field_start); } } } @@ -601,18 +683,27 @@ static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, upb_arena *arena) { + bool ret; upb_decstate state; + state.limit = buf + size; state.arena = arena; state.depth = 64; state.end_group = 0; - if (setjmp(state.err)) return false; - if (size == 0) return true; - decode_msg(&state, buf, msg, l); - return state.end_group == 0; + decode_stealmem(&state); + + if (setjmp(state.err)) { + ret = false; + } else { + decode_msg(&state, buf, msg, l); + ret = state.end_group == 0; + } + + decode_donatemem(&state); + return ret; } #undef OP_SCALAR_LG2 diff --git a/upb/msg.c b/upb/msg.c index 25747c8481..b9310c9f7b 100644 --- a/upb/msg.c +++ b/upb/msg.c @@ -7,7 +7,7 @@ /** upb_msg *******************************************************************/ -static const char _upb_fieldtype_to_sizelg2[12] = { +const char _upb_fieldtype_to_sizelg2[12] = { 0, 0, /* UPB_TYPE_BOOL */ 2, /* UPB_TYPE_FLOAT */ @@ -22,17 +22,10 @@ static const char _upb_fieldtype_to_sizelg2[12] = { UPB_SIZE(3, 4), /* UPB_TYPE_BYTES */ }; -static uintptr_t tag_arrptr(void* ptr, int elem_size_lg2) { - UPB_ASSERT(elem_size_lg2 <= 4); - return (uintptr_t)ptr | elem_size_lg2; -} - -static int upb_msg_internalsize(const upb_msglayout *l) { - return sizeof(upb_msg_internal) - l->extendable * sizeof(void *); -} +static const size_t overhead = sizeof(upb_msg_internal); static size_t upb_msg_sizeof(const upb_msglayout *l) { - return l->size + upb_msg_internalsize(l); + return l->size + overhead; } static const upb_msg_internal *upb_msg_getinternal_const(const upb_msg *msg) { @@ -40,14 +33,9 @@ static const upb_msg_internal *upb_msg_getinternal_const(const upb_msg *msg) { return UPB_PTR_AT(msg, -size, upb_msg_internal); } -static upb_msg_internal *upb_msg_getinternal(upb_msg *msg) { - return (upb_msg_internal*)upb_msg_getinternal_const(msg); -} - void _upb_msg_clear(upb_msg *msg, const upb_msglayout *l) { - ptrdiff_t internal = upb_msg_internalsize(l); - void *mem = UPB_PTR_AT(msg, -internal, char); - memset(mem, 0, l->size + internal); + void *mem = UPB_PTR_AT(msg, -overhead, char); + memset(mem, 0, l->size + overhead); } upb_msg *_upb_msg_new(const upb_msglayout *l, upb_arena *a) { @@ -58,37 +46,51 @@ upb_msg *_upb_msg_new(const upb_msglayout *l, upb_arena *a) { return NULL; } - msg = UPB_PTR_AT(mem, upb_msg_internalsize(l), upb_msg); + msg = UPB_PTR_AT(mem, overhead, upb_msg); _upb_msg_clear(msg, l); return msg; } bool _upb_msg_addunknown(upb_msg *msg, const char *data, size_t len, upb_arena *arena) { + upb_msg_internal *in = upb_msg_getinternal(msg); - if (len > in->unknown_size - in->unknown_len) { - upb_alloc *alloc = upb_arena_alloc(arena); - size_t need = in->unknown_size + len; - size_t newsize = UPB_MAX(in->unknown_size * 2, need); - void *mem = upb_realloc(alloc, in->unknown, in->unknown_size, newsize); - if (!mem) return false; - in->unknown = mem; - in->unknown_size = newsize; + if (!in->unknown) { + size_t size = 128; + while (size < len) size *= 2; + in->unknown = upb_arena_malloc(arena, size + overhead); + if (!in->unknown) return false; + in->unknown->size = size; + in->unknown->len = 0; + } else if (in->unknown->size - in->unknown->len < len) { + size_t need = in->unknown->len + len; + size_t size = in->unknown->size;; + while (size < need) size *= 2; + in->unknown = upb_arena_realloc( + arena, in->unknown, in->unknown->size + overhead, size + overhead); + if (!in->unknown) return false; } - memcpy(in->unknown + in->unknown_len, data, len); - in->unknown_len += len; + memcpy(UPB_PTR_AT(in->unknown + 1, in->unknown->len, char), data, len); + in->unknown->len += len; return true; } void _upb_msg_discardunknown_shallow(upb_msg *msg) { upb_msg_internal *in = upb_msg_getinternal(msg); - in->unknown_len = 0; + if (in->unknown) { + in->unknown->len = 0; + } } const char *upb_msg_getunknown(const upb_msg *msg, size_t *len) { const upb_msg_internal *in = upb_msg_getinternal_const(msg); - *len = in->unknown_len; - return in->unknown; + if (in->unknown) { + *len = in->unknown->len; + return (char*)(in->unknown + 1); + } else { + *len = 0; + return NULL; + } } /** upb_array *****************************************************************/ @@ -100,7 +102,7 @@ upb_array *_upb_array_new(upb_arena *a, upb_fieldtype_t type) { return NULL; } - arr->data = tag_arrptr(NULL, _upb_fieldtype_to_sizelg2[type]); + arr->data = _upb_array_tagptr(NULL, _upb_fieldtype_to_sizelg2[type]); arr->len = 0; arr->size = 0; @@ -124,7 +126,7 @@ bool _upb_array_realloc(upb_array *arr, size_t min_size, upb_arena *arena) { return false; } - arr->data = tag_arrptr(ptr, elem_size_lg2); + arr->data = _upb_array_tagptr(ptr, elem_size_lg2); arr->size = new_size; return true; } diff --git a/upb/msg.h b/upb/msg.h index 695c278b21..625a72f6c3 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -62,25 +62,28 @@ typedef struct upb_msglayout { * compatibility. We put these before the user's data. The user's upb_msg* * points after the upb_msg_internal. */ -/* Used when a message is not extendable. */ typedef struct { - char *unknown; - size_t unknown_len; - size_t unknown_size; -} upb_msg_internal; + uint32_t len; + uint32_t size; + /* Data follows. */ +} upb_msg_unknowndata; -/* Used when a message is extendable. */ +/* Used when a message is not extendable. */ typedef struct { - upb_inttable *extdict; - upb_msg_internal base; -} upb_msg_internal_withext; + upb_msg_unknowndata *unknown; +} upb_msg_internal; /* Maps upb_fieldtype_t -> memory size. */ extern char _upb_fieldtype_to_size[12]; +extern const char _upb_fieldtype_to_sizelg2[12]; /* Creates a new messages with the given layout on the given arena. */ upb_msg *_upb_msg_new(const upb_msglayout *l, upb_arena *a); +UPB_INLINE upb_msg_internal *upb_msg_getinternal(upb_msg *msg) { + return UPB_PTR_AT(msg, -sizeof(upb_msg_internal), upb_msg_internal); +} + /* Clears the given message. */ void _upb_msg_clear(upb_msg *msg, const upb_msglayout *l); @@ -179,6 +182,11 @@ UPB_INLINE const void *_upb_array_constptr(const upb_array *arr) { return (void*)(arr->data & ~(uintptr_t)7); } +UPB_INLINE uintptr_t _upb_array_tagptr(void* ptr, int elem_size_lg2) { + UPB_ASSERT(elem_size_lg2 <= 4); + return (uintptr_t)ptr | elem_size_lg2; +} + UPB_INLINE void *_upb_array_ptr(upb_array *arr) { return (void*)_upb_array_constptr(arr); } diff --git a/upbc/message_layout.cc b/upbc/message_layout.cc index cb7f7f9c43..14aa3e1a3e 100644 --- a/upbc/message_layout.cc +++ b/upbc/message_layout.cc @@ -105,7 +105,7 @@ int64_t MessageLayout::FieldLayoutRank(const protobuf::FieldDescriptor* field) { void MessageLayout::ComputeLayout(const protobuf::Descriptor* descriptor) { size_ = Size{0, 0}; - maxalign_ = Size{0, 0}; + maxalign_ = Size{8, 8}; if (descriptor->options().map_entry()) { // Map entries aren't actually stored, they are only used during parsing. From f173642db43d44984ffad93ee61ec6d7b7225148 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 7 Oct 2020 01:00:38 -0700 Subject: [PATCH 10/88] Handle non-repeated submessages. --- upb/decode.c | 20 +------------ upb/decode.h | 30 ++++++++++++++++++++ upb/decode_fast.c | 72 +++++++++++++++++++++++++++++++++++++++++++++-- upbc/generator.cc | 21 ++++++++++++-- 4 files changed, 118 insertions(+), 25 deletions(-) diff --git a/upb/decode.c b/upb/decode.c index 25b07e0a1a..6b04ff7031 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -199,31 +199,13 @@ static void decode_donatemem(upb_decstate *d) { } UPB_NOINLINE -static void *decode_mallocfallback(upb_decstate *d, size_t size) { +void *decode_mallocfallback(upb_decstate *d, size_t size) { char *ptr = _upb_arena_slowmalloc(d->arena, size); if (!ptr) decode_err(d); decode_stealmem(d); return ptr; } -UPB_FORCEINLINE -static void *decode_malloc(upb_decstate *d, size_t size) { - UPB_ASSERT((size & 7) == 0); - char *ptr = d->arena_ptr; - if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < size)) { - return decode_mallocfallback(d, size); - } - d->arena_ptr += size; - return ptr; -} - -static upb_msg *decode_newmsg(upb_decstate *d, const upb_msglayout *l) { - size_t size = l->size + sizeof(upb_msg_internal); - char *msg_data = decode_malloc(d, size); - memset(msg_data, 0, size); - return msg_data + sizeof(upb_msg_internal); -} - UPB_NOINLINE static void decode_realloc(upb_decstate *d, upb_array *arr, size_t need_elem) { decode_donatemem(d); diff --git a/upb/decode.h b/upb/decode.h index 432604c71c..8bc4201f45 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -9,6 +9,8 @@ #include "upb/msg.h" +#include "upb/port_def.inc" + #ifdef __cplusplus extern "C" { #endif @@ -37,6 +39,28 @@ const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, uint64_t data); const char *fastdecode_err(upb_decstate *d); +void *decode_mallocfallback(upb_decstate *d, size_t size); + +UPB_FORCEINLINE +static void *decode_malloc(upb_decstate *d, size_t size) { + UPB_ASSERT((size & 7) == 0); + char *ptr = d->arena_ptr; + if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < size)) { + return decode_mallocfallback(d, size); + } + d->arena_ptr += size; + return ptr; +} + +UPB_INLINE +upb_msg *decode_newmsg(upb_decstate *d, const upb_msglayout *l) { + size_t size = l->size + sizeof(upb_msg_internal); + char *msg_data = (char*)decode_malloc(d, size); + memset(msg_data, 0, size); + return msg_data + sizeof(upb_msg_internal); +} + + #define UPB_PARSE_PARAMS \ upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, \ uint64_t hasbits, uint64_t data @@ -63,6 +87,10 @@ const char *upb_pss_1bt(UPB_PARSE_PARAMS); const char *upb_pss_2bt(UPB_PARSE_PARAMS); const char *upb_pos_1bt(UPB_PARSE_PARAMS); const char *upb_pos_2bt(UPB_PARSE_PARAMS); +const char *upb_psm_1bt(UPB_PARSE_PARAMS); +const char *upb_pom_1bt(UPB_PARSE_PARAMS); +const char *upb_psm_2bt(UPB_PARSE_PARAMS); +const char *upb_pom_2bt(UPB_PARSE_PARAMS); #undef F #undef TYPES @@ -73,4 +101,6 @@ const char *upb_pos_2bt(UPB_PARSE_PARAMS); } /* extern "C" */ #endif +#include "upb/port_undef.inc" + #endif /* UPB_DECODE_H_ */ diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 5a851f428f..800f97e7f8 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -56,9 +56,8 @@ UPB_FORCEINLINE uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigza } UPB_FORCEINLINE -static void *fastdecode_getfield(upb_msg *msg, uint64_t *data, - uint64_t *hasbits, upb_card card) { - size_t ofs = (*data >> 48); +static void *fastdecode_getfield_ofs(upb_msg *msg, size_t ofs, uint64_t *data, + uint64_t *hasbits, upb_card card) { void *field = (char *)msg + ofs; switch (card) { @@ -77,6 +76,12 @@ static void *fastdecode_getfield(upb_msg *msg, uint64_t *data, } } +UPB_FORCEINLINE +static void *fastdecode_getfield(upb_msg *msg, uint64_t *data, + uint64_t *hasbits, upb_card card) { + return fastdecode_getfield_ofs(msg, *data >> 48, data, hasbits, card); +} + /* varint fields **************************************************************/ UPB_FORCEINLINE @@ -183,3 +188,64 @@ const char *upb_pss_2bt(UPB_PARSE_PARAMS) { const char *upb_pos_2bt(UPB_PARSE_PARAMS) { return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_o); } + +/* message fields *************************************************************/ + +UPB_FORCEINLINE +static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, + upb_card card) { + const char *saved_limit; + const upb_msglayout_field *field = &table->fields[data >> 48]; + size_t ofs = field->offset; + const upb_msglayout *subl = table->submsgs[field->submsg_index]; + upb_msg **submsg; + int64_t len; + + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + return fastdecode_generic(UPB_PARSE_ARGS); + } + + submsg = fastdecode_getfield_ofs(msg, ofs, &data, &hasbits, card); + len = ptr[tagbytes]; + if (UPB_UNLIKELY(len < 0)) { + return fastdecode_generic(UPB_PARSE_ARGS); + } + ptr += tagbytes + 1; + if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit))) { + return fastdecode_err(d); + } + if (!*submsg) { + *submsg = decode_newmsg(d, subl); + } + + saved_limit = d->limit; + if (--d->depth < 0) return fastdecode_err(d); + d->limit = ptr + len; + d->fastlimit = UPB_MIN(d->limit, d->fastend); + + ptr = fastdecode_dispatch(d, ptr, *submsg, subl, 0); + if (ptr != d->limit) return fastdecode_err(d); + + d->limit = saved_limit; + d->fastlimit = UPB_MIN(d->limit, d->fastend); + if (d->end_group != 0) return fastdecode_err(d); + d->depth++; + + return fastdecode_dispatch(d, ptr, msg, table, hasbits); +} + +const char *upb_psm_1bt(UPB_PARSE_PARAMS) { + return fastdecode_submsg(UPB_PARSE_ARGS, 1, CARD_s); +} + +const char *upb_pom_1bt(UPB_PARSE_PARAMS) { + return fastdecode_submsg(UPB_PARSE_ARGS, 1, CARD_o); +} + +const char *upb_psm_2bt(UPB_PARSE_PARAMS) { + return fastdecode_submsg(UPB_PARSE_ARGS, 2, CARD_s); +} + +const char *upb_pom_2bt(UPB_PARSE_PARAMS) { + return fastdecode_submsg(UPB_PARSE_ARGS, 2, CARD_o); +} diff --git a/upbc/generator.cc b/upbc/generator.cc index 6fd1c85451..cb7fdac3ca 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -737,6 +737,10 @@ void TryFillTableEntry(const protobuf::Descriptor* message, type = "s"; wire_type = 2; break; + case protobuf::FieldDescriptor::TYPE_MESSAGE: + type = "m"; + wire_type = 2; + break; default: return; // Not supported yet. } @@ -755,12 +759,23 @@ void TryFillTableEntry(const protobuf::Descriptor* message, } uint16_t expected_tag = (num << 3) | wire_type; - if (num > 15) num |= 0x100; + if (num > 15) expected_tag |= 0x100; MessageLayout::Size offset = layout.GetFieldOffset(field); MessageLayout::Size data; - data.size32 = ((uint64_t)offset.size32 << 48) | expected_tag; - data.size64 = ((uint64_t)offset.size64 << 48) | expected_tag; + if (field->type() == protobuf::FieldDescriptor::TYPE_MESSAGE) { + // Message fields index into the field array instead of giving an offset. + std::vector order = + FieldNumberOrder(message); + auto it = std::find(order.begin(), order.end(), field); + assert(it != order.end()); + uint64_t idx = it - order.begin(); + data.size32 = (idx << 48) | expected_tag; + data.size64 = (idx << 48) | expected_tag; + } else { + data.size32 = ((uint64_t)offset.size32 << 48) | expected_tag; + data.size64 = ((uint64_t)offset.size64 << 48) | expected_tag; + } if (field->real_containing_oneof()) { MessageLayout::Size case_ofs = From 88b1ec77843462050897479a96b2a10d4082df55 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 7 Oct 2020 11:17:38 -0700 Subject: [PATCH 11/88] Table-driven supports repeated sub-messages. --- upb/decode.h | 2 + upb/decode_fast.c | 129 +++++++++++++++++++++++++++++++++++++--------- upbc/generator.cc | 10 +++- 3 files changed, 115 insertions(+), 26 deletions(-) diff --git a/upb/decode.h b/upb/decode.h index 8bc4201f45..eeeb61aa1f 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -89,8 +89,10 @@ const char *upb_pos_1bt(UPB_PARSE_PARAMS); const char *upb_pos_2bt(UPB_PARSE_PARAMS); const char *upb_psm_1bt(UPB_PARSE_PARAMS); const char *upb_pom_1bt(UPB_PARSE_PARAMS); +const char *upb_prm_1bt(UPB_PARSE_PARAMS); const char *upb_psm_2bt(UPB_PARSE_PARAMS); const char *upb_pom_2bt(UPB_PARSE_PARAMS); +const char *upb_prm_2bt(UPB_PARSE_PARAMS); #undef F #undef TYPES diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 800f97e7f8..71be07a4a8 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -56,8 +56,18 @@ UPB_FORCEINLINE uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigza } UPB_FORCEINLINE -static void *fastdecode_getfield_ofs(upb_msg *msg, size_t ofs, uint64_t *data, - uint64_t *hasbits, upb_card card) { +static uint16_t fastdecode_readtag(const char *ptr, int tagbytes) { + uint16_t ret = 0; + memcpy(&ret, ptr, tagbytes); + return ret; +} + +UPB_FORCEINLINE +static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, + upb_msg *msg, size_t ofs, uint64_t *data, + uint64_t *hasbits, upb_array **outarr, + int tagbytes, int valbytes, + upb_card card) { void *field = (char *)msg + ofs; switch (card) { @@ -69,17 +79,51 @@ static void *fastdecode_getfield_ofs(upb_msg *msg, size_t ofs, uint64_t *data, *case_ptr = (*data >> 32) & 0xffff; return field; } - case CARD_r: - UPB_ASSERT(false); /* NYI */ + case CARD_r: { + uint8_t elem_size_lg2 = __builtin_ctz(valbytes); + upb_array **arr_p = field; + upb_array *arr; + uint64_t elem_avail; + uint16_t expected_tag; + *hasbits >>= 16; + *(uint32_t*)msg |= *hasbits; + *hasbits = 0; + if (UPB_LIKELY(!*arr_p)) { + size_t need = (valbytes * 4) + sizeof(upb_array); + if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < need)) { + *data = 0; + return NULL; + } + arr = (void*)d->arena_ptr; + field = arr + 1; + arr->data = _upb_array_tagptr(field, elem_size_lg2); + *arr_p = arr; + arr->size = 4; + arr->len = 0; + elem_avail = 4; + d->arena_ptr += need; + } else { + arr = *arr_p; + field = _upb_array_ptr(arr); + elem_avail = arr->size - arr->len; + field = (char*)field + (arr->len * valbytes); + } + expected_tag = fastdecode_readtag(ptr, tagbytes); + *data = elem_avail | ((uint64_t)expected_tag << 32); + *outarr = arr; + return field; + } default: UPB_UNREACHABLE(); } } UPB_FORCEINLINE -static void *fastdecode_getfield(upb_msg *msg, uint64_t *data, - uint64_t *hasbits, upb_card card) { - return fastdecode_getfield_ofs(msg, *data >> 48, data, hasbits, card); +static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, + uint64_t *data, uint64_t *hasbits, + int tagbytes, int valbytes, upb_card card) { + return fastdecode_getfield_ofs(d, ptr, msg, *data >> 48, data, hasbits, NULL, + tagbytes, valbytes, card); } /* varint fields **************************************************************/ @@ -92,7 +136,8 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { return fastdecode_generic(UPB_PARSE_ARGS);; } - dst = fastdecode_getfield(msg, &data, &hasbits, card); + dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, tagbytes, valbytes, + card); if (UPB_UNLIKELY(ptr[tagbytes] < 0)) { return fastdecode_generic(UPB_PARSE_ARGS); } @@ -158,7 +203,8 @@ static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, return fastdecode_generic(UPB_PARSE_ARGS); } - dst = fastdecode_getfield(msg, &data, &hasbits, card); + dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, tagbytes, + sizeof(upb_strview), card); len = ptr[tagbytes]; if (UPB_UNLIKELY(len < 0)) { return fastdecode_generic(UPB_PARSE_ARGS); @@ -198,30 +244,46 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, const upb_msglayout_field *field = &table->fields[data >> 48]; size_t ofs = field->offset; const upb_msglayout *subl = table->submsgs[field->submsg_index]; + upb_array *arr; upb_msg **submsg; - int64_t len; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { return fastdecode_generic(UPB_PARSE_ARGS); } - submsg = fastdecode_getfield_ofs(msg, ofs, &data, &hasbits, card); - len = ptr[tagbytes]; - if (UPB_UNLIKELY(len < 0)) { - return fastdecode_generic(UPB_PARSE_ARGS); - } - ptr += tagbytes + 1; - if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit))) { - return fastdecode_err(d); - } - if (!*submsg) { - *submsg = decode_newmsg(d, subl); + submsg = fastdecode_getfield_ofs(d, ptr, msg, ofs, &data, &hasbits, &arr, + tagbytes, sizeof(upb_msg *), card); + +again: + if (card == CARD_r) { + if (UPB_UNLIKELY((uint32_t)data == 0)) { + return fastdecode_generic(UPB_PARSE_ARGS); + } } - saved_limit = d->limit; - if (--d->depth < 0) return fastdecode_err(d); - d->limit = ptr + len; - d->fastlimit = UPB_MIN(d->limit, d->fastend); + { + int64_t len = ptr[tagbytes]; + if (UPB_UNLIKELY(len < 0)) { + return fastdecode_generic(UPB_PARSE_ARGS); + } + ptr += tagbytes + 1; + if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit))) { + return fastdecode_err(d); + } + if (card == CARD_r || !*submsg) { + *submsg = decode_newmsg(d, subl); + } + if (card == CARD_r) { + size_t elem_ofs = (size_t)(submsg - (upb_msg **)_upb_array_ptr(arr)); + UPB_ASSERT(elem_ofs == arr->len); + arr->len++; + } + + saved_limit = d->limit; + if (--d->depth < 0) return fastdecode_err(d); + d->limit = ptr + len; + d->fastlimit = UPB_MIN(d->limit, d->fastend); + } ptr = fastdecode_dispatch(d, ptr, *submsg, subl, 0); if (ptr != d->limit) return fastdecode_err(d); @@ -231,6 +293,15 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, if (d->end_group != 0) return fastdecode_err(d); d->depth++; + if (card == CARD_r) { + if (UPB_LIKELY(ptr < d->fastlimit) && + fastdecode_readtag(ptr, tagbytes) == (uint16_t)(data >> 32)) { + data--; + submsg++; + goto again; + } + } + return fastdecode_dispatch(d, ptr, msg, table, hasbits); } @@ -242,6 +313,10 @@ const char *upb_pom_1bt(UPB_PARSE_PARAMS) { return fastdecode_submsg(UPB_PARSE_ARGS, 1, CARD_o); } +const char *upb_prm_1bt(UPB_PARSE_PARAMS) { + return fastdecode_submsg(UPB_PARSE_ARGS, 1, CARD_r); +} + const char *upb_psm_2bt(UPB_PARSE_PARAMS) { return fastdecode_submsg(UPB_PARSE_ARGS, 2, CARD_s); } @@ -249,3 +324,7 @@ const char *upb_psm_2bt(UPB_PARSE_PARAMS) { const char *upb_pom_2bt(UPB_PARSE_PARAMS) { return fastdecode_submsg(UPB_PARSE_ARGS, 2, CARD_o); } + +const char *upb_prm_2bt(UPB_PARSE_PARAMS) { + return fastdecode_submsg(UPB_PARSE_ARGS, 2, CARD_r); +} diff --git a/upbc/generator.cc b/upbc/generator.cc index cb7fdac3ca..d5a02f7f0e 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -738,6 +738,9 @@ void TryFillTableEntry(const protobuf::Descriptor* message, wire_type = 2; break; case protobuf::FieldDescriptor::TYPE_MESSAGE: + if (field->is_map()) { + return; // Not supported yet (ever?). + } type = "m"; wire_type = 2; break; @@ -747,7 +750,12 @@ void TryFillTableEntry(const protobuf::Descriptor* message, switch (field->label()) { case protobuf::FieldDescriptor::LABEL_REPEATED: - return; // Not supported yet. + if (field->type() == protobuf::FieldDescriptor::TYPE_MESSAGE) { + cardinality = "r"; + break; + } else { + return; // Not supported yet. + } case protobuf::FieldDescriptor::LABEL_OPTIONAL: case protobuf::FieldDescriptor::LABEL_REQUIRED: if (field->real_containing_oneof()) { From 405e7934b1eebfa9f1c8c525e0f8f4e4e79d7d8e Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 7 Oct 2020 14:39:50 -0700 Subject: [PATCH 12/88] Handle 2-byte submessage lengths. --- upb/decode.c | 4 ++++ upb/decode_fast.c | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/upb/decode.c b/upb/decode.c index 6b04ff7031..2bc4d9c818 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -694,7 +694,11 @@ bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, decode_stealmem(&state); +#ifdef __APPLE__ + if (_setjmp(state.err)) { +#else if (setjmp(state.err)) { +#endif ret = false; } else { decode_msg(&state, buf, msg, l); diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 71be07a4a8..e6da81b049 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -262,9 +262,14 @@ again: } { - int64_t len = ptr[tagbytes]; - if (UPB_UNLIKELY(len < 0)) { - return fastdecode_generic(UPB_PARSE_ARGS); + uint32_t len = (uint8_t)ptr[tagbytes]; + if (UPB_UNLIKELY(len & 0x80)) { + uint32_t byte = (uint8_t)ptr[tagbytes + 1]; + len += (byte - 1) << 7; + if (UPB_UNLIKELY(byte & 0x80)) { + return fastdecode_generic(UPB_PARSE_ARGS); + } + ptr++; } ptr += tagbytes + 1; if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit))) { From e46e94ec7f7a34691cc442001a2a3c0cb61c9eb7 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 7 Oct 2020 14:55:27 -0700 Subject: [PATCH 13/88] Added benchmarks for proto2. --- BUILD | 1 + tests/benchmark.cc | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/BUILD b/BUILD index f6217178a8..5c1e424578 100644 --- a/BUILD +++ b/BUILD @@ -358,6 +358,7 @@ cc_binary( ":descriptor_upb_proto", ":descriptor_upbreflection", "@com_github_google_benchmark//:benchmark_main", + "@com_google_protobuf//:protobuf", ], ) diff --git a/tests/benchmark.cc b/tests/benchmark.cc index 453adebc3b..15f8871303 100644 --- a/tests/benchmark.cc +++ b/tests/benchmark.cc @@ -3,6 +3,7 @@ #include #include "google/protobuf/descriptor.upb.h" #include "google/protobuf/descriptor.upbdefs.h" +#include "google/protobuf/descriptor.pb.h" upb_strview descriptor = google_protobuf_descriptor_proto_upbdefinit.descriptor; @@ -63,6 +64,53 @@ static void BM_ParseDescriptor(benchmark::State& state) { } BENCHMARK(BM_ParseDescriptor); +static void BM_ParseDescriptorProto2NoArena(benchmark::State& state) { + size_t bytes = 0; + for (auto _ : state) { + google::protobuf::FileDescriptorProto proto; + bool ok = proto.ParseFromArray(descriptor.data, descriptor.size); + + if (!ok) { + printf("Failed to parse.\n"); + exit(1); + } + bytes += descriptor.size; + } + state.SetBytesProcessed(state.iterations() * descriptor.size); +} +BENCHMARK(BM_ParseDescriptorProto2NoArena); + +static void BM_ParseDescriptorProto2WithArena(benchmark::State& state) { + size_t bytes = 0; + for (auto _ : state) { + google::protobuf::Arena arena; + auto proto = + google::protobuf::Arena::Create( + &arena); + bool ok = proto->ParseFromArray(descriptor.data, descriptor.size); + + if (!ok) { + printf("Failed to parse.\n"); + exit(1); + } + bytes += descriptor.size; + } + state.SetBytesProcessed(state.iterations() * descriptor.size); +} +BENCHMARK(BM_ParseDescriptorProto2WithArena); + +static void BM_SerializeDescriptorProto2(benchmark::State& state) { + size_t bytes = 0; + google::protobuf::FileDescriptorProto proto; + proto.ParseFromArray(descriptor.data, descriptor.size); + for (auto _ : state) { + proto.SerializeToArray(buf, sizeof(buf)); + bytes += descriptor.size; + } + state.SetBytesProcessed(state.iterations() * descriptor.size); +} +BENCHMARK(BM_SerializeDescriptorProto2); + static void BM_SerializeDescriptor(benchmark::State& state) { int64_t total = 0; upb_arena* arena = upb_arena_new(); From 8dd7b5a2ca455692f431b881e831ea5c1fa7fb6a Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 7 Oct 2020 17:46:41 -0700 Subject: [PATCH 14/88] A bunch more optimization. --- tests/benchmark.cc | 6 ++-- upb/decode_fast.c | 74 +++++++++++++++++++++++++++++++++++++--------- 2 files changed, 63 insertions(+), 17 deletions(-) diff --git a/tests/benchmark.cc b/tests/benchmark.cc index 15f8871303..b0cbba7b78 100644 --- a/tests/benchmark.cc +++ b/tests/benchmark.cc @@ -41,6 +41,7 @@ static void BM_ParseDescriptorNoHeap(benchmark::State& state) { } bytes += descriptor.size; upb_arena_free(arena); + fprintf(stderr, "+++ finished parse\n"); } state.SetBytesProcessed(state.iterations() * descriptor.size); } @@ -84,9 +85,8 @@ static void BM_ParseDescriptorProto2WithArena(benchmark::State& state) { size_t bytes = 0; for (auto _ : state) { google::protobuf::Arena arena; - auto proto = - google::protobuf::Arena::Create( - &arena); + auto proto = google::protobuf::Arena::CreateMessage< + google::protobuf::FileDescriptorProto>(&arena); bool ok = proto->ParseFromArray(descriptor.data, descriptor.size); if (!ok) { diff --git a/upb/decode_fast.c b/upb/decode_fast.c index e6da81b049..7156b75fb8 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -23,6 +23,10 @@ const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, uint64_t data = 0;; size_t idx; if (UPB_UNLIKELY(ptr >= d->fastlimit)) { + if (UPB_LIKELY(ptr == d->limit)) { + return ptr; + } + //fprintf(stderr, "dispatch hit end\n"); return fastdecode_generic(UPB_PARSE_ARGS); } memcpy(&tag, ptr, 2); @@ -66,7 +70,7 @@ UPB_FORCEINLINE static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, upb_msg *msg, size_t ofs, uint64_t *data, uint64_t *hasbits, upb_array **outarr, - int tagbytes, int valbytes, + void **end, int tagbytes, int valbytes, upb_card card) { void *field = (char *)msg + ofs; @@ -83,7 +87,6 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, uint8_t elem_size_lg2 = __builtin_ctz(valbytes); upb_array **arr_p = field; upb_array *arr; - uint64_t elem_avail; uint16_t expected_tag; *hasbits >>= 16; *(uint32_t*)msg |= *hasbits; @@ -92,6 +95,7 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, size_t need = (valbytes * 4) + sizeof(upb_array); if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < need)) { *data = 0; + *end = NULL; return NULL; } arr = (void*)d->arena_ptr; @@ -100,16 +104,16 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, *arr_p = arr; arr->size = 4; arr->len = 0; - elem_avail = 4; + *end = (char*)field + (arr->size * valbytes); d->arena_ptr += need; } else { arr = *arr_p; field = _upb_array_ptr(arr); - elem_avail = arr->size - arr->len; + *end = (char*)field + (arr->size * valbytes); field = (char*)field + (arr->len * valbytes); } expected_tag = fastdecode_readtag(ptr, tagbytes); - *data = elem_avail | ((uint64_t)expected_tag << 32); + *data = expected_tag; *outarr = arr; return field; } @@ -123,27 +127,64 @@ static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, uint64_t *data, uint64_t *hasbits, int tagbytes, int valbytes, upb_card card) { return fastdecode_getfield_ofs(d, ptr, msg, *data >> 48, data, hasbits, NULL, - tagbytes, valbytes, card); + NULL, tagbytes, valbytes, card); } /* varint fields **************************************************************/ +/* +UPB_FORCEINLINE +static const char *fastdecode_longvarint(UPB_PARSE_PARAMS, int valbytes, int varintbytes) { + uint64_t val = 0; + void *dst = (void*)data; +#ifdef __BMI2__ +#else + for (int i = 0; i < varintbytes; i++) { + uint64_t byte = ptr[i]; + if (i != varintbytes - 1) byte &= 0x7f; + val |= byte << (7 * i); + } +#endif + memcpy((void*)data, &val, valbytes); + return fastdecode_dispatch(d, ptr + varintbytes, msg, table, hasbits); +} + +UPB_FORCEINLINE +static const char *fastdecode_longvarintjmp(UPB_PARSE_PARAMS, void *dst, + _upb_field_parser *funcs) { + uint64_t bytes; + memcpy(&bytes, ptr + 1, 8); + bytes = ~bytes & 0x8080808080808080; + data = (uint64_t)dst; + return funcs[__builtin_ctz(bytes) / 8](UPB_PARSE_ARGS); +} +*/ + UPB_FORCEINLINE static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, int valbytes, upb_card card, bool zigzag) { uint64_t val = 0; void *dst; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + //fprintf(stderr, "varint field tag mismatch\n"); return fastdecode_generic(UPB_PARSE_ARGS);; } dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, tagbytes, valbytes, card); - if (UPB_UNLIKELY(ptr[tagbytes] < 0)) { - return fastdecode_generic(UPB_PARSE_ARGS); + val = (uint8_t)ptr[tagbytes]; + if (UPB_UNLIKELY(val & 0x80)) { + uint32_t byte = (uint8_t)ptr[tagbytes + 1]; + val += (byte - 1) << 7; + if (UPB_UNLIKELY(byte & 0x80)) { + //fprintf(stderr, "varint field >2 bytes\n"); + return fastdecode_generic(UPB_PARSE_ARGS); + } + ptr++; } - val = fastdecode_munge(ptr[tagbytes], valbytes, zigzag); + ptr += tagbytes + 1; + val = fastdecode_munge(val, valbytes, zigzag); memcpy(dst, &val, valbytes); - return fastdecode_dispatch(d, ptr + tagbytes + 1, msg, table, hasbits); + return fastdecode_dispatch(d, ptr, msg, table, hasbits); } // Generate all varint functions. @@ -200,6 +241,7 @@ static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, upb_strview *dst; int64_t len; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + //fprintf(stderr, "string field tag mismatch\n"); return fastdecode_generic(UPB_PARSE_ARGS); } @@ -207,6 +249,7 @@ static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, sizeof(upb_strview), card); len = ptr[tagbytes]; if (UPB_UNLIKELY(len < 0)) { + //fprintf(stderr, "string field len >1 byte\n"); return fastdecode_generic(UPB_PARSE_ARGS); } ptr += tagbytes + 1; @@ -246,17 +289,20 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, const upb_msglayout *subl = table->submsgs[field->submsg_index]; upb_array *arr; upb_msg **submsg; + void *end; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + //fprintf(stderr, "submessage field tag mismatch\n"); return fastdecode_generic(UPB_PARSE_ARGS); } submsg = fastdecode_getfield_ofs(d, ptr, msg, ofs, &data, &hasbits, &arr, - tagbytes, sizeof(upb_msg *), card); + &end, tagbytes, sizeof(upb_msg *), card); again: if (card == CARD_r) { - if (UPB_UNLIKELY((uint32_t)data == 0)) { + if (UPB_UNLIKELY(submsg == end)) { + //fprintf(stderr, "need array realloc\n"); return fastdecode_generic(UPB_PARSE_ARGS); } } @@ -267,6 +313,7 @@ again: uint32_t byte = (uint8_t)ptr[tagbytes + 1]; len += (byte - 1) << 7; if (UPB_UNLIKELY(byte & 0x80)) { + //fprintf(stderr, "submessage field len >2 bytes\n"); return fastdecode_generic(UPB_PARSE_ARGS); } ptr++; @@ -300,8 +347,7 @@ again: if (card == CARD_r) { if (UPB_LIKELY(ptr < d->fastlimit) && - fastdecode_readtag(ptr, tagbytes) == (uint16_t)(data >> 32)) { - data--; + fastdecode_readtag(ptr, tagbytes) == (uint16_t)data) { submsg++; goto again; } From 9e5c5ce0890646e10c8787c2dabf6f6e9aa8151e Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 7 Oct 2020 22:41:34 -0700 Subject: [PATCH 15/88] Optimized memset() with cutoff and fixed group & unknown message bugs. --- .../google/protobuf/descriptor.upb.c | 132 +++++++++--------- tests/benchmark.cc | 2 +- upb/decode.c | 34 ++++- upb/decode.h | 12 +- upb/decode_fast.c | 29 ++-- upbc/generator.cc | 2 +- 6 files changed, 118 insertions(+), 93 deletions(-) diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index ac95b2ec9e..38acc66406 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -23,7 +23,7 @@ static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1] = const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { { &fastdecode_generic, - &fastdecode_generic, + &upb_prm_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -57,7 +57,7 @@ const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { }, { UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + UPB_SIZE(10, 10), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -124,12 +124,12 @@ const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { &upb_pss_1bt, &upb_pss_1bt, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_prm_1bt, + &upb_prm_1bt, + &upb_prm_1bt, + &upb_prm_1bt, + &upb_psm_1bt, + &upb_psm_1bt, &fastdecode_generic, &fastdecode_generic, &upb_pss_1bt, @@ -158,12 +158,12 @@ const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { UPB_SIZE(1125899906973706, 2251799813816330), UPB_SIZE(3377699720790034, 6755399441317906), UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + UPB_SIZE(844424930132002, 844424930132002), + UPB_SIZE(1125899906842666, 1125899906842666), + UPB_SIZE(1407374883553330, 1407374883553330), + UPB_SIZE(1688849860263994, 1688849860263994), + UPB_SIZE(1970324838023234, 1970324838023234), + UPB_SIZE(2251799815782474, 2251799815782474), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(5629499534737506, 11258999068950626), @@ -219,14 +219,14 @@ const upb_msglayout google_protobuf_DescriptorProto_msginit = { { &fastdecode_generic, &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_prm_1bt, + &upb_prm_1bt, + &upb_prm_1bt, + &upb_prm_1bt, + &upb_prm_1bt, + &upb_psm_1bt, + &upb_prm_1bt, + &upb_prm_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -253,14 +253,14 @@ const upb_msglayout google_protobuf_DescriptorProto_msginit = { { UPB_SIZE(0, 0), UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + UPB_SIZE(281474976710674, 281474976710674), + UPB_SIZE(562949953421338, 562949953421338), + UPB_SIZE(844424930132002, 844424930132002), + UPB_SIZE(1125899906842666, 1125899906842666), + UPB_SIZE(1407374883553330, 1407374883553330), + UPB_SIZE(1688849860526138, 1688849860526138), + UPB_SIZE(1970324836974658, 1970324836974658), + UPB_SIZE(2251799813685322, 2251799813685322), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -304,7 +304,7 @@ const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { &fastdecode_generic, &upb_psv4_1bt, &upb_psv4_1bt, - &fastdecode_generic, + &upb_psm_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -338,7 +338,7 @@ const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { UPB_SIZE(0, 0), UPB_SIZE(1125899906973704, 1125899906973704), UPB_SIZE(2251799813947408, 2251799813947408), - UPB_SIZE(0, 0), + UPB_SIZE(562949953945626, 562949953945626), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -562,7 +562,7 @@ const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { &upb_psv4_1bt, &upb_pss_1bt, &upb_pss_1bt, - &fastdecode_generic, + &upb_psm_1bt, &upb_psv4_1bt, &upb_pss_1bt, &fastdecode_generic, @@ -596,7 +596,7 @@ const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { UPB_SIZE(4503599627632680, 4503599627632680), UPB_SIZE(14636698805731378, 20266198339944498), UPB_SIZE(16888498636193850, 24769797984092218), - UPB_SIZE(0, 0), + UPB_SIZE(1970324971192386, 1970324971192386), UPB_SIZE(7881299348947016, 7881299348947016), UPB_SIZE(19140298483433554, 29273397645017170), UPB_SIZE(0, 0), @@ -605,7 +605,7 @@ const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), - UPB_SIZE(9007199256838280, 9007199256838280), + UPB_SIZE(9007199256838536, 9007199256838536), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -639,7 +639,7 @@ const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { { &fastdecode_generic, &upb_pss_1bt, - &fastdecode_generic, + &upb_psm_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -673,7 +673,7 @@ const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { { UPB_SIZE(0, 0), UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(0, 0), + UPB_SIZE(281474976972818, 281474976972818), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -727,9 +727,9 @@ const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { { &fastdecode_generic, &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_prm_1bt, + &upb_psm_1bt, + &upb_prm_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -761,9 +761,9 @@ const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { { UPB_SIZE(0, 0), UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + UPB_SIZE(281474976710674, 281474976710674), + UPB_SIZE(562949953683482, 562949953683482), + UPB_SIZE(844424930132002, 844424930132002), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -891,7 +891,7 @@ const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { &fastdecode_generic, &upb_pss_1bt, &upb_psv4_1bt, - &fastdecode_generic, + &upb_psm_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -925,7 +925,7 @@ const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { UPB_SIZE(0, 0), UPB_SIZE(2251799813947402, 2251799813947402), UPB_SIZE(1125899906973712, 1125899906973712), - UPB_SIZE(0, 0), + UPB_SIZE(562949953945626, 562949953945626), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -975,8 +975,8 @@ const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { { &fastdecode_generic, &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, + &upb_prm_1bt, + &upb_psm_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -1009,8 +1009,8 @@ const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { { UPB_SIZE(0, 0), UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + UPB_SIZE(281474976710674, 281474976710674), + UPB_SIZE(562949953683482, 562949953683482), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -1064,7 +1064,7 @@ const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { &upb_pss_1bt, &upb_pss_1bt, &upb_pss_1bt, - &fastdecode_generic, + &upb_psm_1bt, &upb_psb1_1bt, &upb_psb1_1bt, &fastdecode_generic, @@ -1098,7 +1098,7 @@ const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { UPB_SIZE(1125899907366922, 2251799814209546), UPB_SIZE(3377699721576466, 6755399442104338), UPB_SIZE(5629499536310298, 11258999070523418), - UPB_SIZE(0, 0), + UPB_SIZE(844424934326306, 844424934326306), UPB_SIZE(281474976841768, 281474976841768), UPB_SIZE(562949953683504, 562949953683504), UPB_SIZE(0, 0), @@ -1212,22 +1212,22 @@ const upb_msglayout google_protobuf_FileOptions_msginit = { UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), - UPB_SIZE(4785074604605568, 4785074604605568), - UPB_SIZE(5066549581840520, 5066549581840520), - UPB_SIZE(5348024559599760, 5348024559599760), + UPB_SIZE(4785074604605824, 4785074604605824), + UPB_SIZE(5066549581840776, 5066549581840776), + UPB_SIZE(5348024559600016, 5348024559600016), UPB_SIZE(0, 0), - UPB_SIZE(5629499538407584, 5629499538407584), + UPB_SIZE(5629499538407840, 5629499538407840), UPB_SIZE(0, 0), UPB_SIZE(0, 0), - UPB_SIZE(5910974519312568, 5910974519312568), + UPB_SIZE(5910974519312824, 5910974519312824), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), - UPB_SIZE(6192449504411864, 6192449504411864), + UPB_SIZE(6192449504412120, 6192449504412120), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), - UPB_SIZE(6473924497899768, 6473924497899768), + UPB_SIZE(6473924497900024, 6473924497900024), }, &google_protobuf_FileOptions_submsgs[0], &google_protobuf_FileOptions__fields[0], @@ -1842,12 +1842,12 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { { &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, + &upb_prm_1bt, &upb_pss_1bt, &upb_psv8_1bt, &upb_psv8_1bt, &fastdecode_generic, - &upb_pss_1bt, + &fastdecode_generic, &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, @@ -1876,12 +1876,12 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { { UPB_SIZE(0, 0), UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + UPB_SIZE(18, 18), UPB_SIZE(9007199255789594, 9007199255789594), UPB_SIZE(2251799813816352, 2251799813816352), UPB_SIZE(4503599627632680, 4503599627632680), UPB_SIZE(0, 0), - UPB_SIZE(11258999070523450, 13510798884208698), + UPB_SIZE(0, 0), UPB_SIZE(13510798886305858, 18014398513676354), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -2002,7 +2002,7 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1] = { const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { { &fastdecode_generic, - &fastdecode_generic, + &upb_prm_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -2036,7 +2036,7 @@ const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { }, { UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + UPB_SIZE(10, 10), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -2166,7 +2166,7 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1] = const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { { &fastdecode_generic, - &fastdecode_generic, + &upb_prm_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -2200,7 +2200,7 @@ const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { }, { UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + UPB_SIZE(10, 10), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), diff --git a/tests/benchmark.cc b/tests/benchmark.cc index b0cbba7b78..c4b1abfeaa 100644 --- a/tests/benchmark.cc +++ b/tests/benchmark.cc @@ -41,7 +41,7 @@ static void BM_ParseDescriptorNoHeap(benchmark::State& state) { } bytes += descriptor.size; upb_arena_free(arena); - fprintf(stderr, "+++ finished parse\n"); + //fprintf(stderr, "+++ finished parse: %zu\n", descriptor.size); } state.SetBytesProcessed(state.iterations() * descriptor.size); } diff --git a/upb/decode.c b/upb/decode.c index 2bc4d9c818..8383cef946 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -565,9 +565,14 @@ static const char *decode_tomsg(upb_decstate *d, const char *ptr, upb_msg *msg, return ptr; } +typedef struct { + const char *ptr; + bool group_end; +} decode_parseret; + UPB_FORCEINLINE -static const char *decode_field(upb_decstate *d, const char *ptr, upb_msg *msg, - const upb_msglayout *layout) { +static decode_parseret decode_field(upb_decstate *d, const char *ptr, + upb_msg *msg, const upb_msglayout *layout) { uint32_t tag; const upb_msglayout_field *field; int field_number; @@ -575,6 +580,7 @@ static const char *decode_field(upb_decstate *d, const char *ptr, upb_msg *msg, const char *field_start = ptr; wireval val; int op; + decode_parseret ret; ptr = decode_varint32(d, ptr, d->limit, &tag); field_number = tag >> 3; @@ -625,7 +631,9 @@ static const char *decode_field(upb_decstate *d, const char *ptr, upb_msg *msg, break; case UPB_WIRE_TYPE_END_GROUP: d->end_group = field_number; - return ptr; + ret.ptr = ptr; + ret.group_end = true; + return ret; default: decode_err(d); } @@ -656,24 +664,36 @@ static const char *decode_field(upb_decstate *d, const char *ptr, upb_msg *msg, } } - return ptr; + ret.ptr = ptr; + ret.group_end = false; + return ret; } UPB_NOINLINE const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits, uint64_t data) { + decode_parseret ret; *(uint32_t*)msg |= hasbits >> 16; /* Sync hasbits. */ (void)data; if (ptr == d->limit) return ptr; - ptr = decode_field(d, ptr, msg, table); - return fastdecode_dispatch(d, ptr, msg, table, hasbits); + ret = decode_field(d, ptr, msg, table); + if (ret.group_end) return ptr; + return fastdecode_dispatch(d, ret.ptr, msg, table, hasbits); } UPB_NOINLINE static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *layout) { - ptr = fastdecode_dispatch(d, ptr, msg, layout, 0); + if (msg) { + ptr = fastdecode_dispatch(d, ptr, msg, layout, 0); + } else { + while (ptr < d->limit) { + decode_parseret ret = decode_field(d, ptr, msg, layout); + ptr = ret.ptr; + if (ret.group_end) return ptr; + } + } if (ptr != d->limit) decode_err(d); return ptr; } diff --git a/upb/decode.h b/upb/decode.h index eeeb61aa1f..ceee70c539 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -54,9 +54,17 @@ static void *decode_malloc(upb_decstate *d, size_t size) { UPB_INLINE upb_msg *decode_newmsg(upb_decstate *d, const upb_msglayout *l) { + const size_t cutoff = 192; size_t size = l->size + sizeof(upb_msg_internal); - char *msg_data = (char*)decode_malloc(d, size); - memset(msg_data, 0, size); + char *msg_data; + if (size <= cutoff && (size_t)(d->arena_end - d->arena_ptr) >= cutoff) { + msg_data = d->arena_ptr; + memset(msg_data, 0, cutoff); + d->arena_ptr += size; + } else { + msg_data = (char*)decode_malloc(d, size); + memset(msg_data, 0, size); + } return msg_data + sizeof(upb_msg_internal); } diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 7156b75fb8..2a7e73ba98 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -9,6 +9,10 @@ #define UPB_PARSE_ARGS d, ptr, msg, table, hasbits, data +#define RETURN_GENERIC(msg) \ + /* fprintf(stderr, msg); */ \ + return fastdecode_generic(UPB_PARSE_ARGS); + typedef enum { CARD_s = 0, CARD_o = 1, @@ -24,10 +28,10 @@ const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, size_t idx; if (UPB_UNLIKELY(ptr >= d->fastlimit)) { if (UPB_LIKELY(ptr == d->limit)) { + *(uint32_t*)msg |= hasbits >> 16; /* Sync hasbits. */ return ptr; } - //fprintf(stderr, "dispatch hit end\n"); - return fastdecode_generic(UPB_PARSE_ARGS); + RETURN_GENERIC("dispatch hit end\n"); } memcpy(&tag, ptr, 2); idx = (tag & 0xf8) >> 3; @@ -166,8 +170,7 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, uint64_t val = 0; void *dst; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { - //fprintf(stderr, "varint field tag mismatch\n"); - return fastdecode_generic(UPB_PARSE_ARGS);; + RETURN_GENERIC("varint field tag mismatch\n"); } dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, tagbytes, valbytes, card); @@ -176,8 +179,7 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, uint32_t byte = (uint8_t)ptr[tagbytes + 1]; val += (byte - 1) << 7; if (UPB_UNLIKELY(byte & 0x80)) { - //fprintf(stderr, "varint field >2 bytes\n"); - return fastdecode_generic(UPB_PARSE_ARGS); + RETURN_GENERIC("varint field >2 bytes\n"); } ptr++; } @@ -241,16 +243,14 @@ static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, upb_strview *dst; int64_t len; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { - //fprintf(stderr, "string field tag mismatch\n"); - return fastdecode_generic(UPB_PARSE_ARGS); + RETURN_GENERIC("string field tag mismatch\n"); } dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, tagbytes, sizeof(upb_strview), card); len = ptr[tagbytes]; if (UPB_UNLIKELY(len < 0)) { - //fprintf(stderr, "string field len >1 byte\n"); - return fastdecode_generic(UPB_PARSE_ARGS); + RETURN_GENERIC("string field len >1 byte\n"); } ptr += tagbytes + 1; dst->data = ptr; @@ -292,8 +292,7 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, void *end; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { - //fprintf(stderr, "submessage field tag mismatch\n"); - return fastdecode_generic(UPB_PARSE_ARGS); + RETURN_GENERIC("submessage field tag mismatch\n"); } submsg = fastdecode_getfield_ofs(d, ptr, msg, ofs, &data, &hasbits, &arr, @@ -302,8 +301,7 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, again: if (card == CARD_r) { if (UPB_UNLIKELY(submsg == end)) { - //fprintf(stderr, "need array realloc\n"); - return fastdecode_generic(UPB_PARSE_ARGS); + RETURN_GENERIC("need array realloc\n"); } } @@ -313,8 +311,7 @@ again: uint32_t byte = (uint8_t)ptr[tagbytes + 1]; len += (byte - 1) << 7; if (UPB_UNLIKELY(byte & 0x80)) { - //fprintf(stderr, "submessage field len >2 bytes\n"); - return fastdecode_generic(UPB_PARSE_ARGS); + RETURN_GENERIC("submessage field len >2 bytes\n"); } ptr++; } diff --git a/upbc/generator.cc b/upbc/generator.cc index d5a02f7f0e..0ea76163be 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -733,7 +733,7 @@ void TryFillTableEntry(const protobuf::Descriptor* message, type = "z8"; break; case protobuf::FieldDescriptor::TYPE_STRING: - case protobuf::FieldDescriptor::TYPE_BYTES: + //case protobuf::FieldDescriptor::TYPE_BYTES: type = "s"; wire_type = 2; break; From 388b6f64eb007bf4ff9108c6066c1214d3c525f4 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 7 Oct 2020 23:09:36 -0700 Subject: [PATCH 16/88] A small optimization: don't increment array length every iteration. --- upb/decode_fast.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 2a7e73ba98..e31065d29f 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -98,6 +98,7 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, if (UPB_LIKELY(!*arr_p)) { size_t need = (valbytes * 4) + sizeof(upb_array); if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < need)) { + *outarr = NULL; *data = 0; *end = NULL; return NULL; @@ -107,7 +108,6 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, arr->data = _upb_array_tagptr(field, elem_size_lg2); *arr_p = arr; arr->size = 4; - arr->len = 0; *end = (char*)field + (arr->size * valbytes); d->arena_ptr += need; } else { @@ -301,6 +301,7 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, again: if (card == CARD_r) { if (UPB_UNLIKELY(submsg == end)) { + if (arr) arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); RETURN_GENERIC("need array realloc\n"); } } @@ -311,6 +312,9 @@ again: uint32_t byte = (uint8_t)ptr[tagbytes + 1]; len += (byte - 1) << 7; if (UPB_UNLIKELY(byte & 0x80)) { + if (card == CARD_r) { + arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); + } RETURN_GENERIC("submessage field len >2 bytes\n"); } ptr++; @@ -322,11 +326,6 @@ again: if (card == CARD_r || !*submsg) { *submsg = decode_newmsg(d, subl); } - if (card == CARD_r) { - size_t elem_ofs = (size_t)(submsg - (upb_msg **)_upb_array_ptr(arr)); - UPB_ASSERT(elem_ofs == arr->len); - arr->len++; - } saved_limit = d->limit; if (--d->depth < 0) return fastdecode_err(d); @@ -335,6 +334,7 @@ again: } ptr = fastdecode_dispatch(d, ptr, *submsg, subl, 0); + submsg++; if (ptr != d->limit) return fastdecode_err(d); d->limit = saved_limit; @@ -345,9 +345,9 @@ again: if (card == CARD_r) { if (UPB_LIKELY(ptr < d->fastlimit) && fastdecode_readtag(ptr, tagbytes) == (uint16_t)data) { - submsg++; goto again; } + arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); } return fastdecode_dispatch(d, ptr, msg, table, hasbits); From 52a0ed3891554d8e7005f5382b8e67d2d124ba34 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 7 Oct 2020 23:26:36 -0700 Subject: [PATCH 17/88] Fixed a bug with tag number 15. --- generated_for_cmake/google/protobuf/descriptor.upb.c | 4 ++-- upbc/generator.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index 38acc66406..c5185925ce 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -1847,7 +1847,7 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { &upb_psv8_1bt, &upb_psv8_1bt, &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, @@ -1881,7 +1881,7 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { UPB_SIZE(2251799813816352, 2251799813816352), UPB_SIZE(4503599627632680, 4503599627632680), UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + UPB_SIZE(11258999070523450, 13510798884208698), UPB_SIZE(13510798886305858, 18014398513676354), UPB_SIZE(0, 0), UPB_SIZE(0, 0), diff --git a/upbc/generator.cc b/upbc/generator.cc index 0ea76163be..70ae335da7 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -733,7 +733,7 @@ void TryFillTableEntry(const protobuf::Descriptor* message, type = "z8"; break; case protobuf::FieldDescriptor::TYPE_STRING: - //case protobuf::FieldDescriptor::TYPE_BYTES: + case protobuf::FieldDescriptor::TYPE_BYTES: type = "s"; wire_type = 2; break; @@ -804,7 +804,7 @@ void TryFillTableEntry(const protobuf::Descriptor* message, } ent.first = absl::Substitute("upb_p$0$1_$2bt", cardinality, type, - (num < 15) ? "1" : "2"); + (num > 15) ? "2" : "1"); ent.second = data; } From e39ec95ca2100004c7ce024c8b7e0a1d472dc204 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 8 Oct 2020 01:01:52 -0700 Subject: [PATCH 18/88] Hoisted updates to limits and depth out of the loop. --- upb/decode_fast.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index e31065d29f..a10b1b9fd5 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -283,7 +283,8 @@ const char *upb_pos_2bt(UPB_PARSE_PARAMS) { UPB_FORCEINLINE static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, upb_card card) { - const char *saved_limit; + const char *saved_limit = d->limit; + const char *saved_fastlimit = d->fastlimit; const upb_msglayout_field *field = &table->fields[data >> 48]; size_t ofs = field->offset; const upb_msglayout *subl = table->submsgs[field->submsg_index]; @@ -295,6 +296,8 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, RETURN_GENERIC("submessage field tag mismatch\n"); } + if (--d->depth < 0) return fastdecode_err(d); + submsg = fastdecode_getfield_ofs(d, ptr, msg, ofs, &data, &hasbits, &arr, &end, tagbytes, sizeof(upb_msg *), card); @@ -302,6 +305,9 @@ again: if (card == CARD_r) { if (UPB_UNLIKELY(submsg == end)) { if (arr) arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); + d->limit = saved_limit; + d->fastlimit = saved_fastlimit; + d->depth++; RETURN_GENERIC("need array realloc\n"); } } @@ -315,41 +321,43 @@ again: if (card == CARD_r) { arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); } + d->limit = saved_limit; + d->fastlimit = saved_fastlimit; + d->depth++; RETURN_GENERIC("submessage field len >2 bytes\n"); } ptr++; } ptr += tagbytes + 1; - if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit))) { + if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, saved_limit))) { return fastdecode_err(d); } - if (card == CARD_r || !*submsg) { - *submsg = decode_newmsg(d, subl); - } - - saved_limit = d->limit; - if (--d->depth < 0) return fastdecode_err(d); d->limit = ptr + len; d->fastlimit = UPB_MIN(d->limit, d->fastend); } + if (card == CARD_r || !*submsg) { + *submsg = decode_newmsg(d, subl); + } ptr = fastdecode_dispatch(d, ptr, *submsg, subl, 0); submsg++; - if (ptr != d->limit) return fastdecode_err(d); - d->limit = saved_limit; - d->fastlimit = UPB_MIN(d->limit, d->fastend); - if (d->end_group != 0) return fastdecode_err(d); - d->depth++; + if (ptr != d->limit || d->end_group != 0) { + return fastdecode_err(d); + } if (card == CARD_r) { - if (UPB_LIKELY(ptr < d->fastlimit) && + if (UPB_LIKELY(ptr < saved_fastlimit) && fastdecode_readtag(ptr, tagbytes) == (uint16_t)data) { goto again; } arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); } + d->limit = saved_limit; + d->fastlimit = saved_fastlimit; + d->depth++; + return fastdecode_dispatch(d, ptr, msg, table, hasbits); } From 4c65b25daf78eed1c0c2632f95c7e89272872609 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 8 Oct 2020 12:42:23 -0700 Subject: [PATCH 19/88] Handle long varints, now 2GB/s! --- upb/decode_fast.c | 154 +++++++++++++++++++++++++++++++++------------- 1 file changed, 110 insertions(+), 44 deletions(-) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index a10b1b9fd5..bce4a09cc5 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -48,21 +48,6 @@ static bool fastdecode_checktag(uint64_t data, int tagbytes) { } } -UPB_FORCEINLINE uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigzag) { - if (valbytes == 1) { - return val != 0; - } else if (zigzag) { - if (valbytes == 4) { - uint32_t n = val; - return (n >> 1) ^ -(int32_t)(n & 1); - } else if (valbytes == 8) { - return (val >> 1) ^ -(int64_t)(val & 1); - } - UPB_UNREACHABLE(); - } - return val; -} - UPB_FORCEINLINE static uint16_t fastdecode_readtag(const char *ptr, int tagbytes) { uint16_t ret = 0; @@ -96,7 +81,8 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, *(uint32_t*)msg |= *hasbits; *hasbits = 0; if (UPB_LIKELY(!*arr_p)) { - size_t need = (valbytes * 4) + sizeof(upb_array); + const size_t initial_len = 8; + size_t need = (valbytes * initial_len) + sizeof(upb_array); if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < need)) { *outarr = NULL; *data = 0; @@ -107,7 +93,7 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, field = arr + 1; arr->data = _upb_array_tagptr(field, elem_size_lg2); *arr_p = arr; - arr->size = 4; + arr->size = initial_len; *end = (char*)field + (arr->size * valbytes); d->arena_ptr += need; } else { @@ -136,37 +122,75 @@ static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, /* varint fields **************************************************************/ -/* -UPB_FORCEINLINE -static const char *fastdecode_longvarint(UPB_PARSE_PARAMS, int valbytes, int varintbytes) { - uint64_t val = 0; - void *dst = (void*)data; #ifdef __BMI2__ -#else - for (int i = 0; i < varintbytes; i++) { - uint64_t byte = ptr[i]; - if (i != varintbytes - 1) byte &= 0x7f; - val |= byte << (7 * i); +#include +#endif + +UPB_FORCEINLINE uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigzag) { + if (valbytes == 1) { + return val != 0; + } else if (zigzag) { + if (valbytes == 4) { + uint32_t n = val; + return (n >> 1) ^ -(int32_t)(n & 1); + } else if (valbytes == 8) { + return (val >> 1) ^ -(int64_t)(val & 1); + } + UPB_UNREACHABLE(); } + return val; +} + +UPB_FORCEINLINE +static int fastdecode_varintlen(uint64_t data64) { + uint64_t clear_bits = ~data64 & 0x8080808080808080; + if (clear_bits == 0) return -1; + return __builtin_ctzl(clear_bits) / 8 + 1; +} + +UPB_FORCEINLINE +static const char *fastdecode_longvarint(UPB_PARSE_PARAMS, int valbytes, + int varintbytes, bool zigzag) { + uint64_t val = data >> 18; + size_t ofs = (uint16_t)data; + uint64_t data64; + int sawbytes; + memcpy(&data64, ptr + 2, 8); + sawbytes = fastdecode_varintlen(data64) + 2; + UPB_ASSERT(sawbytes == varintbytes); +#ifdef __BMI2__ + if (varintbytes != 3) { + uint64_t mask = 0x7f7f7f7f7f7f7f7f >> (8 * (10 - varintbytes)); + val |= _pext_u64(data64, mask) << 14; + } else #endif - memcpy((void*)data, &val, valbytes); + { + for (int i = 2; i < varintbytes; i++) { + uint64_t byte = ptr[i]; + if (i != varintbytes - 1) byte &= 0x7f; + val |= byte << (7 * i); + } + } + val = fastdecode_munge(val, valbytes, zigzag); + memcpy((char*)msg + ofs, &val, valbytes); return fastdecode_dispatch(d, ptr + varintbytes, msg, table, hasbits); } UPB_FORCEINLINE -static const char *fastdecode_longvarintjmp(UPB_PARSE_PARAMS, void *dst, - _upb_field_parser *funcs) { - uint64_t bytes; - memcpy(&bytes, ptr + 1, 8); - bytes = ~bytes & 0x8080808080808080; - data = (uint64_t)dst; - return funcs[__builtin_ctz(bytes) / 8](UPB_PARSE_ARGS); +static const char *fastdecode_longvarintjmp(UPB_PARSE_PARAMS, + _upb_field_parser **funcs) { + int len; + uint64_t data64; + memcpy(&data64, ptr + 2, 8); + len = fastdecode_varintlen(data64); + if (len < 0) return fastdecode_err(d); + return funcs[len - 1](UPB_PARSE_ARGS); } -*/ UPB_FORCEINLINE static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, - int valbytes, upb_card card, bool zigzag) { + int valbytes, upb_card card, bool zigzag, + _upb_field_parser **funcs) { uint64_t val = 0; void *dst; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { @@ -179,27 +203,69 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, uint32_t byte = (uint8_t)ptr[tagbytes + 1]; val += (byte - 1) << 7; if (UPB_UNLIKELY(byte & 0x80)) { - RETURN_GENERIC("varint field >2 bytes\n"); + ptr += tagbytes; + data = (uint32_t)(val << 18 | data >> 48); + return fastdecode_longvarintjmp(UPB_PARSE_ARGS, funcs); } - ptr++; + ptr += tagbytes + 2; + } else { + ptr += tagbytes + 1; } - ptr += tagbytes + 1; val = fastdecode_munge(val, valbytes, zigzag); memcpy(dst, &val, valbytes); return fastdecode_dispatch(d, ptr, msg, table, hasbits); } -// Generate all varint functions. -// {s,o,r} x {b1,v4,z4,v8,z8} x {1bt,2bt} - #define z_ZZ true #define b_ZZ false #define v_ZZ false +// Generate varint vallbacks. + +#define FUNCNAME(type, valbytes, varintbytes) \ + upb_pl##type##valbytes##_##varintbytes##bv + +#define TABLENAME(type, valbytes) \ + upb_pl##type##valbytes##_table + +#define F(type, valbytes, varintbytes) \ + static const char *FUNCNAME(type, valbytes, varintbytes)(UPB_PARSE_PARAMS) { \ + return fastdecode_longvarint(UPB_PARSE_ARGS, valbytes, varintbytes, \ + type##_ZZ); \ + } + +#define FALLBACKS(type, valbytes) \ + F(type, valbytes, 3) \ + F(type, valbytes, 4) \ + F(type, valbytes, 5) \ + F(type, valbytes, 6) \ + F(type, valbytes, 7) \ + F(type, valbytes, 8) \ + F(type, valbytes, 9) \ + F(type, valbytes, 10) \ + static _upb_field_parser *TABLENAME(type, valbytes)[8] = { \ + &FUNCNAME(type, valbytes, 3), &FUNCNAME(type, valbytes, 4), \ + &FUNCNAME(type, valbytes, 5), &FUNCNAME(type, valbytes, 6), \ + &FUNCNAME(type, valbytes, 7), &FUNCNAME(type, valbytes, 8), \ + &FUNCNAME(type, valbytes, 9), &FUNCNAME(type, valbytes, 10)}; + +FALLBACKS(b, 1) +FALLBACKS(v, 4) +FALLBACKS(v, 8) +FALLBACKS(z, 4) +FALLBACKS(z, 8) + +#undef F +#undef FALLBACKS +#undef FUNCNAME + +// Generate all varint functions. +// {s,o,r} x {b1,v4,z4,v8,z8} x {1bt,2bt} + #define F(card, type, valbytes, tagbytes) \ const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ return fastdecode_varint(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card, \ - type##_ZZ); \ + type##_ZZ, TABLENAME(type, valbytes)); \ } #define TYPES(card, tagbytes) \ From 526e4307947a347696448a6525a669224fb5ec23 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 8 Oct 2020 14:24:58 -0700 Subject: [PATCH 20/88] I think this may have reached the optimization limit. ------------------------------------------------------------------------- Benchmark Time CPU Iterations ------------------------------------------------------------------------- BM_ArenaOneAlloc 21 ns 21 ns 32994231 BM_ArenaInitialBlockOneAlloc 6 ns 6 ns 116318005 BM_ParseDescriptorNoHeap 3028 ns 3028 ns 231138 2.34354GB/s BM_ParseDescriptor 3557 ns 3557 ns 196583 1.99498GB/s BM_ParseDescriptorProto2NoArena 33228 ns 33226 ns 21196 218.688MB/s BM_ParseDescriptorProto2WithArena 22863 ns 22861 ns 30666 317.831MB/s BM_SerializeDescriptorProto2 5444 ns 5444 ns 127368 1.30348GB/s BM_SerializeDescriptor 12509 ns 12508 ns 55816 580.914MB/s $ perf stat bazel-bin/benchmark --benchmark_filter=BM_ParseDescriptorNoHeap 2020-10-08 14:07:06 Running bazel-bin/benchmark Run on (72 X 3700 MHz CPU s) CPU Caches: L1 Data 32K (x36) L1 Instruction 32K (x36) L2 Unified 1024K (x36) L3 Unified 25344K (x2) ---------------------------------------------------------------- Benchmark Time CPU Iterations ---------------------------------------------------------------- BM_ParseDescriptorNoHeap 3071 ns 3071 ns 227743 2.31094GB/s Performance counter stats for 'bazel-bin/benchmark --benchmark_filter=BM_ParseDescriptorNoHeap': 1,050.22 msec task-clock # 0.978 CPUs utilized 4 context-switches # 0.004 K/sec 0 cpu-migrations # 0.000 K/sec 179 page-faults # 0.170 K/sec 3,875,796,334 cycles # 3.690 GHz 13,282,835,967 instructions # 3.43 insn per cycle 2,887,725,848 branches # 2749.627 M/sec 8,324,912 branch-misses # 0.29% of all branches 1.073924364 seconds time elapsed 1.042806000 seconds user 0.008021000 seconds sys Profile: 23.96% benchmark benchmark [.] upb_prm_1bt_max192b 22.44% benchmark benchmark [.] fastdecode_dispatch 18.96% benchmark benchmark [.] upb_pss_1bt 14.20% benchmark benchmark [.] upb_psv4_1bt 8.33% benchmark benchmark [.] upb_prm_1bt_max64b 6.66% benchmark benchmark [.] upb_prm_1bt_max128b 1.29% benchmark benchmark [.] upb_psm_1bt_max64b 0.77% benchmark benchmark [.] fastdecode_generic 0.55% benchmark [kernel.kallsyms] [k] smp_call_function_single 0.42% benchmark [kernel.kallsyms] [k] _raw_spin_lock_irqsave 0.42% benchmark benchmark [.] upb_psm_1bt_max256b 0.31% benchmark benchmark [.] upb_psb1_1bt 0.21% benchmark benchmark [.] upb_plv4_5bv 0.14% benchmark benchmark [.] upb_psb1_2bt 0.12% benchmark benchmark [.] decode_longvarint64 0.08% benchmark [kernel.kallsyms] [k] vsnprintf 0.07% benchmark [kernel.kallsyms] [k] _raw_spin_lock 0.07% benchmark benchmark [.] _upb_msg_new 0.06% benchmark ld-2.31.so [.] check_match --- benchmark.py | 4 +- .../google/protobuf/descriptor.upb.c | 56 +++++++++---------- upb/decode.h | 43 ++++++++++---- upb/decode_fast.c | 45 +++++++-------- upbc/generator.cc | 23 +++++++- 5 files changed, 107 insertions(+), 64 deletions(-) diff --git a/benchmark.py b/benchmark.py index b6c16a6a76..7b5717f797 100755 --- a/benchmark.py +++ b/benchmark.py @@ -30,8 +30,8 @@ def Run(cmd): def Benchmark(outbase, runs=12): tmpfile = "/tmp/bench-output.json" Run("rm -rf {}".format(tmpfile)) - #Run("CC=clang bazel test :all") - Run("CC=clang bazel build -c opt :benchmark") + Run("CC=clang bazel test :all") + Run("CC=clang bazel build -c opt --copt=-march=native :benchmark") Run("./bazel-bin/benchmark --benchmark_out_format=json --benchmark_out={} --benchmark_repetitions={}".format(tmpfile, runs)) diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index c5185925ce..6b10be7de0 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -23,7 +23,7 @@ static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1] = const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { { &fastdecode_generic, - &upb_prm_1bt, + &upb_prm_1bt_max192b, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -124,12 +124,12 @@ const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { &upb_pss_1bt, &upb_pss_1bt, &fastdecode_generic, - &upb_prm_1bt, - &upb_prm_1bt, - &upb_prm_1bt, - &upb_prm_1bt, - &upb_psm_1bt, - &upb_psm_1bt, + &upb_prm_1bt_max128b, + &upb_prm_1bt_max128b, + &upb_prm_1bt_max64b, + &upb_prm_1bt_max192b, + &upb_psm_1bt_max256b, + &upb_psm_1bt_max64b, &fastdecode_generic, &fastdecode_generic, &upb_pss_1bt, @@ -219,14 +219,14 @@ const upb_msglayout google_protobuf_DescriptorProto_msginit = { { &fastdecode_generic, &upb_pss_1bt, - &upb_prm_1bt, - &upb_prm_1bt, - &upb_prm_1bt, - &upb_prm_1bt, - &upb_prm_1bt, - &upb_psm_1bt, - &upb_prm_1bt, - &upb_prm_1bt, + &upb_prm_1bt_max192b, + &upb_prm_1bt_max128b, + &upb_prm_1bt_max128b, + &upb_prm_1bt_max64b, + &upb_prm_1bt_max192b, + &upb_psm_1bt_max64b, + &upb_prm_1bt_max64b, + &upb_prm_1bt_max64b, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -304,7 +304,7 @@ const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { &fastdecode_generic, &upb_psv4_1bt, &upb_psv4_1bt, - &upb_psm_1bt, + &upb_psm_1bt_max64b, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -562,7 +562,7 @@ const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { &upb_psv4_1bt, &upb_pss_1bt, &upb_pss_1bt, - &upb_psm_1bt, + &upb_psm_1bt_max64b, &upb_psv4_1bt, &upb_pss_1bt, &fastdecode_generic, @@ -639,7 +639,7 @@ const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { { &fastdecode_generic, &upb_pss_1bt, - &upb_psm_1bt, + &upb_psm_1bt_max64b, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -727,9 +727,9 @@ const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { { &fastdecode_generic, &upb_pss_1bt, - &upb_prm_1bt, - &upb_psm_1bt, - &upb_prm_1bt, + &upb_prm_1bt_max64b, + &upb_psm_1bt_max64b, + &upb_prm_1bt_max64b, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -891,7 +891,7 @@ const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { &fastdecode_generic, &upb_pss_1bt, &upb_psv4_1bt, - &upb_psm_1bt, + &upb_psm_1bt_max64b, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -975,8 +975,8 @@ const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { { &fastdecode_generic, &upb_pss_1bt, - &upb_prm_1bt, - &upb_psm_1bt, + &upb_prm_1bt_max128b, + &upb_psm_1bt_max64b, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -1064,7 +1064,7 @@ const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { &upb_pss_1bt, &upb_pss_1bt, &upb_pss_1bt, - &upb_psm_1bt, + &upb_psm_1bt_max64b, &upb_psb1_1bt, &upb_psb1_1bt, &fastdecode_generic, @@ -1842,7 +1842,7 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { { &fastdecode_generic, &fastdecode_generic, - &upb_prm_1bt, + &upb_prm_1bt_max64b, &upb_pss_1bt, &upb_psv8_1bt, &upb_psv8_1bt, @@ -2002,7 +2002,7 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1] = { const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { { &fastdecode_generic, - &upb_prm_1bt, + &upb_prm_1bt_max128b, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -2166,7 +2166,7 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1] = const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { { &fastdecode_generic, - &upb_prm_1bt, + &upb_prm_1bt_max64b, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, diff --git a/upb/decode.h b/upb/decode.h index ceee70c539..e79f3341ab 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -53,13 +53,15 @@ static void *decode_malloc(upb_decstate *d, size_t size) { } UPB_INLINE -upb_msg *decode_newmsg(upb_decstate *d, const upb_msglayout *l) { - const size_t cutoff = 192; +upb_msg *decode_newmsg_ceil(upb_decstate *d, const upb_msglayout *l, + int msg_ceil_bytes) { size_t size = l->size + sizeof(upb_msg_internal); char *msg_data; - if (size <= cutoff && (size_t)(d->arena_end - d->arena_ptr) >= cutoff) { + if (msg_ceil_bytes > 0 && + (size_t)(d->arena_end - d->arena_ptr) >= (size_t)msg_ceil_bytes) { + UPB_ASSERT(size <= (size_t)msg_ceil_bytes); msg_data = d->arena_ptr; - memset(msg_data, 0, cutoff); + memset(msg_data, 0, msg_ceil_bytes); d->arena_ptr += size; } else { msg_data = (char*)decode_malloc(d, size); @@ -68,6 +70,10 @@ upb_msg *decode_newmsg(upb_decstate *d, const upb_msglayout *l) { return msg_data + sizeof(upb_msg_internal); } +UPB_INLINE +upb_msg *decode_newmsg(upb_decstate *d, const upb_msglayout *l) { + return decode_newmsg_ceil(d, l, -1); +} #define UPB_PARSE_PARAMS \ upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, \ @@ -95,16 +101,33 @@ const char *upb_pss_1bt(UPB_PARSE_PARAMS); const char *upb_pss_2bt(UPB_PARSE_PARAMS); const char *upb_pos_1bt(UPB_PARSE_PARAMS); const char *upb_pos_2bt(UPB_PARSE_PARAMS); -const char *upb_psm_1bt(UPB_PARSE_PARAMS); -const char *upb_pom_1bt(UPB_PARSE_PARAMS); -const char *upb_prm_1bt(UPB_PARSE_PARAMS); -const char *upb_psm_2bt(UPB_PARSE_PARAMS); -const char *upb_pom_2bt(UPB_PARSE_PARAMS); -const char *upb_prm_2bt(UPB_PARSE_PARAMS); #undef F #undef TYPES #undef TAGBYTES + +#define F(card, tagbytes, size_ceil, ceil_arg) \ + const char *upb_p##card##m_##tagbytes##bt_max##size_ceil##b(UPB_PARSE_PARAMS); + +#define SIZES(card, tagbytes) \ + F(card, tagbytes, 64, 64) \ + F(card, tagbytes, 128, 128) \ + F(card, tagbytes, 192, 192) \ + F(card, tagbytes, 256, 256) \ + F(card, tagbytes, max, -1) + +#define TAGBYTES(card) \ + SIZES(card, 1) \ + SIZES(card, 2) + +TAGBYTES(s) +TAGBYTES(o) +TAGBYTES(r) + +#undef TAGBYTES +#undef SIZES +#undef F + #undef UPB_PARSE_PARAMS #ifdef __cplusplus diff --git a/upb/decode_fast.c b/upb/decode_fast.c index bce4a09cc5..95bfa28748 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -81,7 +81,7 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, *(uint32_t*)msg |= *hasbits; *hasbits = 0; if (UPB_LIKELY(!*arr_p)) { - const size_t initial_len = 8; + const size_t initial_len = 32; size_t need = (valbytes * initial_len) + sizeof(upb_array); if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < need)) { *outarr = NULL; @@ -348,7 +348,7 @@ const char *upb_pos_2bt(UPB_PARSE_PARAMS) { UPB_FORCEINLINE static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, - upb_card card) { + int msg_ceil_bytes, upb_card card) { const char *saved_limit = d->limit; const char *saved_fastlimit = d->fastlimit; const upb_msglayout_field *field = &table->fields[data >> 48]; @@ -403,7 +403,7 @@ again: } if (card == CARD_r || !*submsg) { - *submsg = decode_newmsg(d, subl); + *submsg = decode_newmsg_ceil(d, subl, msg_ceil_bytes); } ptr = fastdecode_dispatch(d, ptr, *submsg, subl, 0); submsg++; @@ -427,26 +427,27 @@ again: return fastdecode_dispatch(d, ptr, msg, table, hasbits); } -const char *upb_psm_1bt(UPB_PARSE_PARAMS) { - return fastdecode_submsg(UPB_PARSE_ARGS, 1, CARD_s); -} - -const char *upb_pom_1bt(UPB_PARSE_PARAMS) { - return fastdecode_submsg(UPB_PARSE_ARGS, 1, CARD_o); -} +#define F(card, tagbytes, size_ceil, ceil_arg) \ + const char *upb_p##card##m_##tagbytes##bt_max##size_ceil##b( \ + UPB_PARSE_PARAMS) { \ + return fastdecode_submsg(UPB_PARSE_ARGS, tagbytes, ceil_arg, CARD_##card); \ + } -const char *upb_prm_1bt(UPB_PARSE_PARAMS) { - return fastdecode_submsg(UPB_PARSE_ARGS, 1, CARD_r); -} +#define SIZES(card, tagbytes) \ + F(card, tagbytes, 64, 64) \ + F(card, tagbytes, 128, 128) \ + F(card, tagbytes, 192, 192) \ + F(card, tagbytes, 256, 256) \ + F(card, tagbytes, max, -1) -const char *upb_psm_2bt(UPB_PARSE_PARAMS) { - return fastdecode_submsg(UPB_PARSE_ARGS, 2, CARD_s); -} +#define TAGBYTES(card) \ + SIZES(card, 1) \ + SIZES(card, 2) -const char *upb_pom_2bt(UPB_PARSE_PARAMS) { - return fastdecode_submsg(UPB_PARSE_ARGS, 2, CARD_o); -} +TAGBYTES(s) +TAGBYTES(o) +TAGBYTES(r) -const char *upb_prm_2bt(UPB_PARSE_PARAMS) { - return fastdecode_submsg(UPB_PARSE_ARGS, 2, CARD_r); -} +#undef TAGBYTES +#undef SIZES +#undef F diff --git a/upbc/generator.cc b/upbc/generator.cc index 70ae335da7..8005b9904e 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -803,8 +803,27 @@ void TryFillTableEntry(const protobuf::Descriptor* message, data.size64 |= (uint64_t)hasbit_mask << 16; } - ent.first = absl::Substitute("upb_p$0$1_$2bt", cardinality, type, - (num > 15) ? "2" : "1"); + if (field->type() == protobuf::FieldDescriptor::TYPE_MESSAGE) { + std::string size_ceil = "max"; + size_t size = SIZE_MAX; + if (field->message_type()->file() == field->file()) { + MessageLayout sub_layout(field->message_type()); + size = sub_layout.message_size().size64 + 8; + } + std::vector breaks = {64, 128, 192, 256}; + for (auto brk : breaks) { + if (size <= brk) { + size_ceil = std::to_string(brk); + break; + } + } + ent.first = absl::Substitute("upb_p$0$1_$2bt_max$3b", cardinality, type, + (num > 15) ? "2" : "1", size_ceil); + + } else { + ent.first = absl::Substitute("upb_p$0$1_$2bt", cardinality, type, + (num > 15) ? "2" : "1"); + } ent.second = data; } From 0dcc5641eb7a908c750548e4e9f306ae0bed4d0b Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 9 Oct 2020 09:48:45 -0700 Subject: [PATCH 21/88] Replicated dispatch and implemeted array resizing logic. Up to 2.67GB/s. --- upb/decode_fast.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 95bfa28748..bae1c223f7 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -20,7 +20,7 @@ typedef enum { CARD_p = 3 } upb_card; -UPB_NOINLINE +UPB_FORCEINLINE const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits) { uint16_t tag; @@ -81,7 +81,7 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, *(uint32_t*)msg |= *hasbits; *hasbits = 0; if (UPB_LIKELY(!*arr_p)) { - const size_t initial_len = 32; + const size_t initial_len = 8; size_t need = (valbytes * initial_len) + sizeof(upb_array); if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < need)) { *outarr = NULL; @@ -370,11 +370,31 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, again: if (card == CARD_r) { if (UPB_UNLIKELY(submsg == end)) { - if (arr) arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); - d->limit = saved_limit; - d->fastlimit = saved_fastlimit; - d->depth++; - RETURN_GENERIC("need array realloc\n"); + if (arr) { + size_t old_size = arr->size; + size_t old_bytes = old_size * sizeof(upb_msg*); + size_t new_size = old_size * 2; + size_t new_bytes = new_size * sizeof(upb_msg*); + char *old_ptr = _upb_array_ptr(arr); + if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < new_bytes)) { + d->limit = saved_limit; + d->fastlimit = saved_fastlimit; + arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); + d->depth++; + RETURN_GENERIC("repeated realloc failed: arena full"); + } + memcpy(d->arena_ptr, old_ptr, old_bytes); + arr->size = new_size; + arr->data = _upb_array_tagptr(d->arena_ptr, 3); + submsg = (void*)(d->arena_ptr + (old_size * sizeof(upb_msg*))); + end = (void*)(d->arena_ptr + (new_size * sizeof(upb_msg*))); + d->arena_ptr += new_bytes; + } else { + d->limit = saved_limit; + d->fastlimit = saved_fastlimit; + d->depth++; + RETURN_GENERIC("need array realloc\n"); + } } } From 537b6f42c20c0dd797703ecb89c61bb130b33365 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 9 Oct 2020 17:00:08 -0700 Subject: [PATCH 22/88] A few updates to the benchamrk and minor implementation changes. --- tests/benchmark.cc | 59 +++++++++++++++++++++++++++++++++------------- upb/decode.h | 9 ++++--- upb/decode_fast.c | 29 +++++++++++++---------- 3 files changed, 65 insertions(+), 32 deletions(-) diff --git a/tests/benchmark.cc b/tests/benchmark.cc index c4b1abfeaa..78dbeb65cc 100644 --- a/tests/benchmark.cc +++ b/tests/benchmark.cc @@ -1,9 +1,12 @@ -#include #include + +#include + +#include "google/protobuf/descriptor.pb.h" +#include "google/protobuf/arena.h" #include "google/protobuf/descriptor.upb.h" #include "google/protobuf/descriptor.upbdefs.h" -#include "google/protobuf/descriptor.pb.h" upb_strview descriptor = google_protobuf_descriptor_proto_upbdefinit.descriptor; @@ -28,10 +31,10 @@ static void BM_ArenaInitialBlockOneAlloc(benchmark::State& state) { } BENCHMARK(BM_ArenaInitialBlockOneAlloc); -static void BM_ParseDescriptorNoHeap(benchmark::State& state) { +static void BM_ParseDescriptor_Upb(benchmark::State& state) { size_t bytes = 0; for (auto _ : state) { - upb_arena* arena = upb_arena_init(buf, sizeof(buf), NULL); + upb_arena* arena = upb_arena_new(); google_protobuf_FileDescriptorProto* set = google_protobuf_FileDescriptorProto_parse(descriptor.data, descriptor.size, arena); @@ -41,16 +44,15 @@ static void BM_ParseDescriptorNoHeap(benchmark::State& state) { } bytes += descriptor.size; upb_arena_free(arena); - //fprintf(stderr, "+++ finished parse: %zu\n", descriptor.size); } state.SetBytesProcessed(state.iterations() * descriptor.size); } -BENCHMARK(BM_ParseDescriptorNoHeap); +BENCHMARK(BM_ParseDescriptor_Upb); -static void BM_ParseDescriptor(benchmark::State& state) { +static void BM_ParseDescriptor_Upb_LargeInitialBlock(benchmark::State& state) { size_t bytes = 0; for (auto _ : state) { - upb_arena* arena = upb_arena_new(); + upb_arena* arena = upb_arena_init(buf, sizeof(buf), NULL); google_protobuf_FileDescriptorProto* set = google_protobuf_FileDescriptorProto_parse(descriptor.data, descriptor.size, arena); @@ -60,16 +62,17 @@ static void BM_ParseDescriptor(benchmark::State& state) { } bytes += descriptor.size; upb_arena_free(arena); + //fprintf(stderr, "+++ finished parse: %zu\n", descriptor.size); } state.SetBytesProcessed(state.iterations() * descriptor.size); } -BENCHMARK(BM_ParseDescriptor); +BENCHMARK(BM_ParseDescriptor_Upb_LargeInitialBlock); -static void BM_ParseDescriptorProto2NoArena(benchmark::State& state) { +static void BM_ParseDescriptor_Proto2_NoArena(benchmark::State& state) { size_t bytes = 0; for (auto _ : state) { google::protobuf::FileDescriptorProto proto; - bool ok = proto.ParseFromArray(descriptor.data, descriptor.size); + bool ok = proto.ParsePartialFromArray(descriptor.data, descriptor.size); if (!ok) { printf("Failed to parse.\n"); @@ -79,15 +82,37 @@ static void BM_ParseDescriptorProto2NoArena(benchmark::State& state) { } state.SetBytesProcessed(state.iterations() * descriptor.size); } -BENCHMARK(BM_ParseDescriptorProto2NoArena); +BENCHMARK(BM_ParseDescriptor_Proto2_NoArena); -static void BM_ParseDescriptorProto2WithArena(benchmark::State& state) { +static void BM_ParseDescriptor_Proto2_Arena(benchmark::State& state) { size_t bytes = 0; for (auto _ : state) { google::protobuf::Arena arena; - auto proto = google::protobuf::Arena::CreateMessage< - google::protobuf::FileDescriptorProto>(&arena); - bool ok = proto->ParseFromArray(descriptor.data, descriptor.size); + arena.Reset(); + auto proto = google::protobuf::Arena::CreateMessage(&arena); + bool ok = proto->ParsePartialFromArray(descriptor.data, descriptor.size); + + if (!ok) { + printf("Failed to parse.\n"); + exit(1); + } + bytes += descriptor.size; + } + state.SetBytesProcessed(state.iterations() * descriptor.size); +} +BENCHMARK(BM_ParseDescriptor_Proto2_Arena); + +static void BM_ParseDescriptor_Proto2_Arena_LargeInitialBlock(benchmark::State& state) { + size_t bytes = 0; + //fprintf(stderr, "size: %d\n", (int)descriptor.size); + google::protobuf::ArenaOptions options; + options.initial_block = buf; + options.initial_block_size = sizeof(buf); + for (auto _ : state) { + google::protobuf::Arena arena(options); + arena.Reset(); + auto proto = google::protobuf::Arena::CreateMessage(&arena); + bool ok = proto->ParsePartialFromArray(descriptor.data, descriptor.size); if (!ok) { printf("Failed to parse.\n"); @@ -97,7 +122,7 @@ static void BM_ParseDescriptorProto2WithArena(benchmark::State& state) { } state.SetBytesProcessed(state.iterations() * descriptor.size); } -BENCHMARK(BM_ParseDescriptorProto2WithArena); +BENCHMARK(BM_ParseDescriptor_Proto2_Arena_LargeInitialBlock); static void BM_SerializeDescriptorProto2(benchmark::State& state) { size_t bytes = 0; diff --git a/upb/decode.h b/upb/decode.h index e79f3341ab..372e44b39d 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -41,11 +41,15 @@ const char *fastdecode_err(upb_decstate *d); void *decode_mallocfallback(upb_decstate *d, size_t size); +UPB_FORCEINLINE bool decode_arenahas(upb_decstate *d, size_t bytes) { + return (size_t)(d->arena_end - d->arena_ptr) >= bytes; +} + UPB_FORCEINLINE static void *decode_malloc(upb_decstate *d, size_t size) { UPB_ASSERT((size & 7) == 0); char *ptr = d->arena_ptr; - if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < size)) { + if (UPB_UNLIKELY(!decode_arenahas(d, size))) { return decode_mallocfallback(d, size); } d->arena_ptr += size; @@ -57,8 +61,7 @@ upb_msg *decode_newmsg_ceil(upb_decstate *d, const upb_msglayout *l, int msg_ceil_bytes) { size_t size = l->size + sizeof(upb_msg_internal); char *msg_data; - if (msg_ceil_bytes > 0 && - (size_t)(d->arena_end - d->arena_ptr) >= (size_t)msg_ceil_bytes) { + if (msg_ceil_bytes > 0 && decode_arenahas(d, msg_ceil_bytes)) { UPB_ASSERT(size <= (size_t)msg_ceil_bytes); msg_data = d->arena_ptr; memset(msg_data, 0, msg_ceil_bytes); diff --git a/upb/decode_fast.c b/upb/decode_fast.c index bae1c223f7..207a930351 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -14,10 +14,9 @@ return fastdecode_generic(UPB_PARSE_ARGS); typedef enum { - CARD_s = 0, - CARD_o = 1, - CARD_r = 2, - CARD_p = 3 + CARD_s = 0, /* Singular (optional, non-repeated) */ + CARD_o = 1, /* Oneof */ + CARD_r = 2, /* Repeated */ } upb_card; UPB_FORCEINLINE @@ -191,7 +190,7 @@ UPB_FORCEINLINE static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, int valbytes, upb_card card, bool zigzag, _upb_field_parser **funcs) { - uint64_t val = 0; + uint64_t val; void *dst; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { RETURN_GENERIC("varint field tag mismatch\n"); @@ -296,7 +295,7 @@ TAGBYTES(o) /* string fields **************************************************************/ UPB_FORCEINLINE -bool fastdecode_boundscheck(const char *ptr, unsigned len, const char *end) { +bool fastdecode_boundscheck(const char *ptr, size_t len, const char *end) { uintptr_t uptr = (uintptr_t)ptr; uintptr_t uend = (uintptr_t)end; uintptr_t res = uptr + len; @@ -314,15 +313,13 @@ static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, tagbytes, sizeof(upb_strview), card); - len = ptr[tagbytes]; - if (UPB_UNLIKELY(len < 0)) { - RETURN_GENERIC("string field len >1 byte\n"); - } + len = (int8_t)ptr[tagbytes]; ptr += tagbytes + 1; dst->data = ptr; dst->size = len; if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit))) { - return fastdecode_err(d); + dst->size = 0; + RETURN_GENERIC("string field len >1 byte\n"); } ptr += len; return fastdecode_dispatch(d, ptr, msg, table, hasbits); @@ -346,6 +343,14 @@ const char *upb_pos_2bt(UPB_PARSE_PARAMS) { /* message fields *************************************************************/ +UPB_FORCEINLINE +bool fastdecode_boundscheck2(const char *ptr, unsigned len, const char *end) { + uintptr_t uptr = (uintptr_t)ptr; + uintptr_t uend = (uintptr_t)end; + uintptr_t res = uptr + len; + return res < uptr || res > uend; +} + UPB_FORCEINLINE static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, int msg_ceil_bytes, upb_card card) { @@ -415,7 +420,7 @@ again: ptr++; } ptr += tagbytes + 1; - if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, saved_limit))) { + if (UPB_UNLIKELY(fastdecode_boundscheck2(ptr, len, saved_limit))) { return fastdecode_err(d); } d->limit = ptr + len; From ff957b996c6ac757f9f62847955c50a8561bc668 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 9 Oct 2020 22:28:27 -0700 Subject: [PATCH 23/88] Fixed C89 compat issues. --- upb/decode.h | 2 +- upb/decode_fast.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/upb/decode.h b/upb/decode.h index 372e44b39d..f53856198c 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -98,7 +98,7 @@ upb_msg *decode_newmsg(upb_decstate *d, const upb_msglayout *l) { TAGBYTES(s) TAGBYTES(o) -//TAGBYTES(r) +/* TAGBYTES(r) */ const char *upb_pss_1bt(UPB_PARSE_PARAMS); const char *upb_pss_2bt(UPB_PARSE_PARAMS); diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 207a930351..2b61727f78 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -16,7 +16,7 @@ typedef enum { CARD_s = 0, /* Singular (optional, non-repeated) */ CARD_o = 1, /* Oneof */ - CARD_r = 2, /* Repeated */ + CARD_r = 2 /* Repeated */ } upb_card; UPB_FORCEINLINE @@ -164,7 +164,8 @@ static const char *fastdecode_longvarint(UPB_PARSE_PARAMS, int valbytes, } else #endif { - for (int i = 2; i < varintbytes; i++) { + int i; + for (i = 2; i < varintbytes; i++) { uint64_t byte = ptr[i]; if (i != varintbytes - 1) byte &= 0x7f; val |= byte << (7 * i); @@ -219,7 +220,7 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, #define b_ZZ false #define v_ZZ false -// Generate varint vallbacks. +/* Generate varint vallbacks. */ #define FUNCNAME(type, valbytes, varintbytes) \ upb_pl##type##valbytes##_##varintbytes##bv @@ -258,8 +259,8 @@ FALLBACKS(z, 8) #undef FALLBACKS #undef FUNCNAME -// Generate all varint functions. -// {s,o,r} x {b1,v4,z4,v8,z8} x {1bt,2bt} +/* Generate all varint functions. + * {s,o,r} x {b1,v4,z4,v8,z8} x {1bt,2bt} */ #define F(card, type, valbytes, tagbytes) \ const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ @@ -280,7 +281,7 @@ FALLBACKS(z, 8) TAGBYTES(s) TAGBYTES(o) -//TAGBYTES(r) +/* TAGBYTES(r) */ #undef z_ZZ #undef b_ZZ From 64d293894ae29a391dc5975413ecc8eedf5453f2 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 9 Oct 2020 22:53:23 -0700 Subject: [PATCH 24/88] Fixed bug introduced by last optimization. --- upb/decode_fast.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 2b61727f78..12678a13d4 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -307,6 +307,7 @@ UPB_FORCEINLINE static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, upb_card card) { upb_strview *dst; + const char *str; int64_t len; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { RETURN_GENERIC("string field tag mismatch\n"); @@ -315,15 +316,14 @@ static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, tagbytes, sizeof(upb_strview), card); len = (int8_t)ptr[tagbytes]; - ptr += tagbytes + 1; - dst->data = ptr; + str = ptr + tagbytes + 1; + dst->data = str; dst->size = len; - if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit))) { + if (UPB_UNLIKELY(fastdecode_boundscheck(str, len, d->limit))) { dst->size = 0; RETURN_GENERIC("string field len >1 byte\n"); } - ptr += len; - return fastdecode_dispatch(d, ptr, msg, table, hasbits); + return fastdecode_dispatch(d, str + len, msg, table, hasbits); } const char *upb_pss_1bt(UPB_PARSE_PARAMS) { From 89bd8b87e1a7eddb3f55d151932c61963e1f1084 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 9 Oct 2020 23:36:01 -0700 Subject: [PATCH 25/88] Fixed a few more C89 compat issues. --- upb/decode.h | 2 +- upb/decode_fast.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/upb/decode.h b/upb/decode.h index f53856198c..1f7f4fd315 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -47,8 +47,8 @@ UPB_FORCEINLINE bool decode_arenahas(upb_decstate *d, size_t bytes) { UPB_FORCEINLINE static void *decode_malloc(upb_decstate *d, size_t size) { - UPB_ASSERT((size & 7) == 0); char *ptr = d->arena_ptr; + UPB_ASSERT((size & 7) == 0); if (UPB_UNLIKELY(!decode_arenahas(d, size))) { return decode_mallocfallback(d, size); } diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 12678a13d4..8124344a21 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -23,7 +23,7 @@ UPB_FORCEINLINE const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits) { uint16_t tag; - uint64_t data = 0;; + uint64_t data = 0; size_t idx; if (UPB_UNLIKELY(ptr >= d->fastlimit)) { if (UPB_LIKELY(ptr == d->limit)) { From d87179501d557ebb8e3ba6d01653d9db1bea6aed Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sat, 10 Oct 2020 00:30:11 -0700 Subject: [PATCH 26/88] Another build fix. --- upb/decode.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/upb/decode.h b/upb/decode.h index 1f7f4fd315..152b4eea5e 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -41,12 +41,11 @@ const char *fastdecode_err(upb_decstate *d); void *decode_mallocfallback(upb_decstate *d, size_t size); -UPB_FORCEINLINE bool decode_arenahas(upb_decstate *d, size_t bytes) { +UPB_INLINE bool decode_arenahas(upb_decstate *d, size_t bytes) { return (size_t)(d->arena_end - d->arena_ptr) >= bytes; } -UPB_FORCEINLINE -static void *decode_malloc(upb_decstate *d, size_t size) { +UPB_INLINE void *decode_malloc(upb_decstate *d, size_t size) { char *ptr = d->arena_ptr; UPB_ASSERT((size & 7) == 0); if (UPB_UNLIKELY(!decode_arenahas(d, size))) { From 9938cf8f27b742797248685870b9d8745a1b58b4 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sat, 10 Oct 2020 19:25:50 -0700 Subject: [PATCH 27/88] Put submsg_index directly in table data. Drop oneof support for now to focus. --- .../google/protobuf/descriptor.upb.c | 52 ++++++------ upb/decode.h | 2 +- upb/decode_fast.c | 46 +++++----- upbc/generator.cc | 83 ++++++++++--------- upbc/message_layout.cc | 4 +- 5 files changed, 94 insertions(+), 93 deletions(-) diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index 6b10be7de0..6489da2761 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -158,12 +158,12 @@ const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { UPB_SIZE(1125899906973706, 2251799813816330), UPB_SIZE(3377699720790034, 6755399441317906), UPB_SIZE(0, 0), - UPB_SIZE(844424930132002, 844424930132002), - UPB_SIZE(1125899906842666, 1125899906842666), - UPB_SIZE(1407374883553330, 1407374883553330), - UPB_SIZE(1688849860263994, 1688849860263994), - UPB_SIZE(1970324838023234, 1970324838023234), - UPB_SIZE(2251799815782474, 2251799815782474), + UPB_SIZE(11258999068426274, 22517998136852514), + UPB_SIZE(12384898975268906, 24769797950537770), + UPB_SIZE(13510798882111538, 27021597764223026), + UPB_SIZE(14636698788954170, 29273397577908282), + UPB_SIZE(7881299348160578, 15762598696058946), + UPB_SIZE(9007199255068746, 18014398509809738), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(5629499534737506, 11258999068950626), @@ -192,7 +192,7 @@ const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { UPB_SIZE(64, 128), 12, false, }; -static const upb_msglayout *const google_protobuf_DescriptorProto_submsgs[8] = { +static const upb_msglayout *const google_protobuf_DescriptorProto_submsgs[7] = { &google_protobuf_DescriptorProto_msginit, &google_protobuf_DescriptorProto_ExtensionRange_msginit, &google_protobuf_DescriptorProto_ReservedRange_msginit, @@ -253,14 +253,14 @@ const upb_msglayout google_protobuf_DescriptorProto_msginit = { { UPB_SIZE(0, 0), UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(281474976710674, 281474976710674), - UPB_SIZE(562949953421338, 562949953421338), - UPB_SIZE(844424930132002, 844424930132002), - UPB_SIZE(1125899906842666, 1125899906842666), - UPB_SIZE(1407374883553330, 1407374883553330), - UPB_SIZE(1688849860526138, 1688849860526138), - UPB_SIZE(1970324836974658, 1970324836974658), - UPB_SIZE(2251799813685322, 2251799813685322), + UPB_SIZE(4503599627370514, 9007199254741010), + UPB_SIZE(5629499534213146, 11258999068426266), + UPB_SIZE(6755399441055778, 13510798882111522), + UPB_SIZE(7881299347898410, 15762598695796778), + UPB_SIZE(9007199254741042, 18014398509482034), + UPB_SIZE(3377699720659002, 6755399441186874), + UPB_SIZE(10133099161583682, 20266198323167298), + UPB_SIZE(11258999068426314, 22517998136852554), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -338,7 +338,7 @@ const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { UPB_SIZE(0, 0), UPB_SIZE(1125899906973704, 1125899906973704), UPB_SIZE(2251799813947408, 2251799813947408), - UPB_SIZE(562949953945626, 562949953945626), + UPB_SIZE(3377699720724506, 4503599627567130), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -596,7 +596,7 @@ const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { UPB_SIZE(4503599627632680, 4503599627632680), UPB_SIZE(14636698805731378, 20266198339944498), UPB_SIZE(16888498636193850, 24769797984092218), - UPB_SIZE(1970324971192386, 1970324971192386), + UPB_SIZE(21392098230730818, 33776997205999682), UPB_SIZE(7881299348947016, 7881299348947016), UPB_SIZE(19140298483433554, 29273397645017170), UPB_SIZE(0, 0), @@ -673,7 +673,7 @@ const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { { UPB_SIZE(0, 0), UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(281474976972818, 281474976972818), + UPB_SIZE(3377699720658962, 6755399441186834), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -761,9 +761,9 @@ const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { { UPB_SIZE(0, 0), UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(281474976710674, 281474976710674), - UPB_SIZE(562949953683482, 562949953683482), - UPB_SIZE(844424930132002, 844424930132002), + UPB_SIZE(4503599627370514, 9007199254741010), + UPB_SIZE(3377699720658970, 6755399441186842), + UPB_SIZE(5629499534213154, 11258999068426274), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -925,7 +925,7 @@ const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { UPB_SIZE(0, 0), UPB_SIZE(2251799813947402, 2251799813947402), UPB_SIZE(1125899906973712, 1125899906973712), - UPB_SIZE(562949953945626, 562949953945626), + UPB_SIZE(4503599627567130, 6755399441252378), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -1009,8 +1009,8 @@ const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { { UPB_SIZE(0, 0), UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(281474976710674, 281474976710674), - UPB_SIZE(562949953683482, 562949953683482), + UPB_SIZE(4503599627370514, 9007199254741010), + UPB_SIZE(3377699720658970, 6755399441186842), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -1098,7 +1098,7 @@ const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { UPB_SIZE(1125899907366922, 2251799814209546), UPB_SIZE(3377699721576466, 6755399442104338), UPB_SIZE(5629499536310298, 11258999070523418), - UPB_SIZE(844424934326306, 844424934326306), + UPB_SIZE(7881299348291618, 15762598696189986), UPB_SIZE(281474976841768, 281474976841768), UPB_SIZE(562949953683504, 562949953683504), UPB_SIZE(0, 0), @@ -1876,7 +1876,7 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { { UPB_SIZE(0, 0), UPB_SIZE(0, 0), - UPB_SIZE(18, 18), + UPB_SIZE(15762598695796754, 22517998136852498), UPB_SIZE(9007199255789594, 9007199255789594), UPB_SIZE(2251799813816352, 2251799813816352), UPB_SIZE(4503599627632680, 4503599627632680), diff --git a/upb/decode.h b/upb/decode.h index 152b4eea5e..62a080f78e 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -60,7 +60,7 @@ upb_msg *decode_newmsg_ceil(upb_decstate *d, const upb_msglayout *l, int msg_ceil_bytes) { size_t size = l->size + sizeof(upb_msg_internal); char *msg_data; - if (msg_ceil_bytes > 0 && decode_arenahas(d, msg_ceil_bytes)) { + if (UPB_LIKELY(msg_ceil_bytes > 0 && decode_arenahas(d, msg_ceil_bytes))) { UPB_ASSERT(size <= (size_t)msg_ceil_bytes); msg_data = d->arena_ptr; memset(msg_data, 0, msg_ceil_bytes); diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 8124344a21..74a73388a7 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -56,21 +56,21 @@ static uint16_t fastdecode_readtag(const char *ptr, int tagbytes) { UPB_FORCEINLINE static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, - upb_msg *msg, size_t ofs, uint64_t *data, + upb_msg *msg, uint64_t *data, uint64_t *hasbits, upb_array **outarr, void **end, int tagbytes, int valbytes, - upb_card card) { + upb_card card, bool hasbit_is_idx) { + size_t ofs = *data >> 48; void *field = (char *)msg + ofs; switch (card) { case CARD_s: - *hasbits |= *data; - return field; - case CARD_o: { - uint32_t *case_ptr = UPB_PTR_AT(msg, (*data >> 16) & 0xffff, uint32_t); - *case_ptr = (*data >> 32) & 0xffff; + if (hasbit_is_idx) { + *hasbits |= 1 << (uint16_t)(*data >> 16); + } else { + *hasbits |= *data; + } return field; - } case CARD_r: { uint8_t elem_size_lg2 = __builtin_ctz(valbytes); upb_array **arr_p = field; @@ -115,8 +115,8 @@ UPB_FORCEINLINE static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, uint64_t *data, uint64_t *hasbits, int tagbytes, int valbytes, upb_card card) { - return fastdecode_getfield_ofs(d, ptr, msg, *data >> 48, data, hasbits, NULL, - NULL, tagbytes, valbytes, card); + return fastdecode_getfield_ofs(d, ptr, msg, data, hasbits, NULL, NULL, + tagbytes, valbytes, card, false); } /* varint fields **************************************************************/ @@ -355,14 +355,6 @@ bool fastdecode_boundscheck2(const char *ptr, unsigned len, const char *end) { UPB_FORCEINLINE static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, int msg_ceil_bytes, upb_card card) { - const char *saved_limit = d->limit; - const char *saved_fastlimit = d->fastlimit; - const upb_msglayout_field *field = &table->fields[data >> 48]; - size_t ofs = field->offset; - const upb_msglayout *subl = table->submsgs[field->submsg_index]; - upb_array *arr; - upb_msg **submsg; - void *end; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { RETURN_GENERIC("submessage field tag mismatch\n"); @@ -370,13 +362,21 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, if (--d->depth < 0) return fastdecode_err(d); - submsg = fastdecode_getfield_ofs(d, ptr, msg, ofs, &data, &hasbits, &arr, - &end, tagbytes, sizeof(upb_msg *), card); + upb_msg **submsg; + upb_array *arr; + void *end; + uint16_t submsg_idx = data >> 32; + const upb_msglayout *subl = table->submsgs[submsg_idx]; + submsg = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &arr, &end, + tagbytes, sizeof(upb_msg *), card, true); + + const char *saved_limit = d->limit; + const char *saved_fastlimit = d->fastlimit; again: if (card == CARD_r) { if (UPB_UNLIKELY(submsg == end)) { - if (arr) { + if (UPB_LIKELY(arr != NULL)) { size_t old_size = arr->size; size_t old_bytes = old_size * sizeof(upb_msg*); size_t new_size = old_size * 2; @@ -428,13 +428,13 @@ again: d->fastlimit = UPB_MIN(d->limit, d->fastend); } - if (card == CARD_r || !*submsg) { + if (card == CARD_r || UPB_LIKELY(!*submsg)) { *submsg = decode_newmsg_ceil(d, subl, msg_ceil_bytes); } ptr = fastdecode_dispatch(d, ptr, *submsg, subl, 0); submsg++; - if (ptr != d->limit || d->end_group != 0) { + if (UPB_UNLIKELY(ptr != d->limit || d->end_group != 0)) { return fastdecode_err(d); } diff --git a/upbc/generator.cc b/upbc/generator.cc index 8005b9904e..8e992c44ba 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -703,6 +703,27 @@ int TableDescriptorType(const protobuf::FieldDescriptor* field) { } } +struct SubmsgArray { + std::vector messages; + absl::flat_hash_map indexes; +}; + +SubmsgArray GetSubmsgArray(const protobuf::Descriptor* message) { + SubmsgArray ret; + MessageLayout layout(message); + std::vector sorted_submsgs = + SortedSubmessages(message); + int i = 0; + for (auto submsg : sorted_submsgs) { + if (ret.indexes.find(submsg->message_type()) != ret.indexes.end()) { + continue; + } + ret.messages.push_back(submsg->message_type()); + ret.indexes[submsg->message_type()] = i++; + } + return ret; +} + typedef std::pair TableEntry; void TryFillTableEntry(const protobuf::Descriptor* message, @@ -759,7 +780,7 @@ void TryFillTableEntry(const protobuf::Descriptor* message, case protobuf::FieldDescriptor::LABEL_OPTIONAL: case protobuf::FieldDescriptor::LABEL_REQUIRED: if (field->real_containing_oneof()) { - cardinality = "o"; + return; // Not supported yet. } else { cardinality = "s"; } @@ -769,40 +790,30 @@ void TryFillTableEntry(const protobuf::Descriptor* message, uint16_t expected_tag = (num << 3) | wire_type; if (num > 15) expected_tag |= 0x100; MessageLayout::Size offset = layout.GetFieldOffset(field); + uint64_t hasbit_index = 0; - MessageLayout::Size data; - if (field->type() == protobuf::FieldDescriptor::TYPE_MESSAGE) { - // Message fields index into the field array instead of giving an offset. - std::vector order = - FieldNumberOrder(message); - auto it = std::find(order.begin(), order.end(), field); - assert(it != order.end()); - uint64_t idx = it - order.begin(); - data.size32 = (idx << 48) | expected_tag; - data.size64 = (idx << 48) | expected_tag; - } else { - data.size32 = ((uint64_t)offset.size32 << 48) | expected_tag; - data.size64 = ((uint64_t)offset.size64 << 48) | expected_tag; + if (layout.HasHasbit(field)) { + hasbit_index = layout.GetHasbitIndex(field); + if (hasbit_index > 31) return; } - if (field->real_containing_oneof()) { - MessageLayout::Size case_ofs = - layout.GetOneofCaseOffset(field->real_containing_oneof()); - data.size32 |= ((uint64_t)num << 32) | (case_ofs.size32 << 16); - data.size64 |= ((uint64_t)num << 32) | (case_ofs.size64 << 16); - } else { - uint32_t hasbit_mask = 0; + MessageLayout::Size data; - if (layout.HasHasbit(field)) { - int index = layout.GetHasbitIndex(field); - if (index > 31) return; - hasbit_mask = 1 << index; - } + data.size32 = ((uint64_t)offset.size32 << 48) | expected_tag; + data.size64 = ((uint64_t)offset.size64 << 48) | expected_tag; + if (field->type() == protobuf::FieldDescriptor::TYPE_MESSAGE) { + SubmsgArray submsg_array = GetSubmsgArray(message); + uint64_t idx = submsg_array.indexes[field->message_type()]; + data.size32 |= idx << 32 | hasbit_index << 16; + data.size64 |= idx << 32 | hasbit_index << 16; + } else { + uint32_t hasbit_mask = 1U << hasbit_index; data.size32 |= (uint64_t)hasbit_mask << 16; data.size64 |= (uint64_t)hasbit_mask << 16; } + if (field->type() == protobuf::FieldDescriptor::TYPE_MESSAGE) { std::string size_ceil = "max"; size_t size = SIZE_MAX; @@ -863,27 +874,19 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output) { std::string msgname = ToCIdent(message->full_name()); std::string fields_array_ref = "NULL"; std::string submsgs_array_ref = "NULL"; - absl::flat_hash_map submsg_indexes; MessageLayout layout(message); - std::vector sorted_submsgs = - SortedSubmessages(message); + SubmsgArray submsg_array = GetSubmsgArray(message); - if (!sorted_submsgs.empty()) { + if (!submsg_array.messages.empty()) { // TODO(haberman): could save a little bit of space by only generating a // "submsgs" array for every strongly-connected component. std::string submsgs_array_name = msgname + "_submsgs"; submsgs_array_ref = "&" + submsgs_array_name + "[0]"; output("static const upb_msglayout *const $0[$1] = {\n", - submsgs_array_name, sorted_submsgs.size()); + submsgs_array_name, submsg_array.messages.size()); - int i = 0; - for (auto submsg : sorted_submsgs) { - if (submsg_indexes.find(submsg->message_type()) != - submsg_indexes.end()) { - continue; - } - output(" &$0,\n", MessageInit(submsg->message_type())); - submsg_indexes[submsg->message_type()] = i++; + for (auto submsg : submsg_array.messages) { + output(" &$0,\n", MessageInit(submsg)); } output("};\n\n"); @@ -901,7 +904,7 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output) { std::string presence = "0"; if (field->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { - submsg_index = submsg_indexes[field->message_type()]; + submsg_index = submsg_array.indexes[field->message_type()]; } if (MessageLayout::HasHasbit(field)) { diff --git a/upbc/message_layout.cc b/upbc/message_layout.cc index 14aa3e1a3e..36aa0c6d59 100644 --- a/upbc/message_layout.cc +++ b/upbc/message_layout.cc @@ -24,9 +24,7 @@ MessageLayout::Size MessageLayout::Place( } bool MessageLayout::HasHasbit(const protobuf::FieldDescriptor* field) { - return field->file()->syntax() == protobuf::FileDescriptor::SYNTAX_PROTO2 && - field->label() != protobuf::FieldDescriptor::LABEL_REPEATED && - !field->containing_oneof() && + return field->has_presence() && !field->real_containing_oneof() && !field->containing_type()->options().map_entry(); } From 7363b91ac3c5a249fd603870621c3f462fb87c76 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 11 Oct 2020 15:21:53 -0700 Subject: [PATCH 28/88] Moved arena inline for decoder. --- BUILD | 1 + CMakeLists.txt | 1 + upb/decode.c | 40 +++++++++++++++++++++++++--------------- upb/upb.c | 21 +-------------------- 4 files changed, 28 insertions(+), 35 deletions(-) diff --git a/BUILD b/BUILD index a7d106bfc4..9e49b42304 100644 --- a/BUILD +++ b/BUILD @@ -85,6 +85,7 @@ cc_library( "upb/table.c", "upb/table.int.h", "upb/upb.c", + "upb/upb.int.h", ], hdrs = [ "upb/decode.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dd6454321..67eeb2c698 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,7 @@ add_library(upb upb/table.c upb/table.int.h upb/upb.c + upb/upb.int.h upb/decode.h upb/encode.h upb/upb.h diff --git a/upb/decode.c b/upb/decode.c index 416ea25cc5..59cb3f6ff9 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -1,10 +1,13 @@ +#include "upb/decode.h" + #include #include -#include "upb/decode.h" #include "upb/upb.h" +#include "upb/upb.int.h" +/* Must be last. */ #include "upb/port_def.inc" /* Maps descriptor type -> upb field type. */ @@ -137,7 +140,7 @@ static const int8_t delim_ops[37] = { /* Data pertaining to the parse. */ typedef struct { const char *limit; /* End of delimited region or end of buffer. */ - upb_arena *arena; + upb_arena arena; int depth; uint32_t end_group; /* Set to field number of END_GROUP tag, if any. */ jmp_buf err; @@ -191,7 +194,7 @@ void decode_verifyutf8(upb_decstate *d, const char *buf, int len) { static bool decode_reserve(upb_decstate *d, upb_array *arr, size_t elem) { bool need_realloc = arr->size - arr->len < elem; - if (need_realloc && !_upb_array_realloc(arr, arr->len + elem, d->arena)) { + if (need_realloc && !_upb_array_realloc(arr, arr->len + elem, &d->arena)) { decode_err(d); } return need_realloc; @@ -281,7 +284,7 @@ static const upb_msglayout_field *upb_find_field(const upb_msglayout *l, static upb_msg *decode_newsubmsg(upb_decstate *d, const upb_msglayout *layout, const upb_msglayout_field *field) { const upb_msglayout *subl = layout->submsgs[field->submsg_index]; - return _upb_msg_new(subl, d->arena); + return _upb_msg_new(subl, &d->arena); } static void decode_tosubmsg(upb_decstate *d, upb_msg *submsg, @@ -325,7 +328,7 @@ static const char *decode_toarray(upb_decstate *d, const char *ptr, if (!arr) { upb_fieldtype_t type = desctype_to_fieldtype[field->descriptortype]; - arr = _upb_array_new(d->arena, type); + arr = _upb_array_new(&d->arena, type); if (!arr) decode_err(d); *arrp = arr; } @@ -424,7 +427,7 @@ static void decode_tomap(upb_decstate *d, upb_msg *msg, char val_size = desctype_to_mapsize[val_field->descriptortype]; UPB_ASSERT(key_field->offset == 0); UPB_ASSERT(val_field->offset == sizeof(upb_strview)); - map = _upb_map_new(d->arena, key_size, val_size); + map = _upb_map_new(&d->arena, key_size, val_size); *map_p = map; } @@ -434,13 +437,13 @@ static void decode_tomap(upb_decstate *d, upb_msg *msg, if (entry->fields[1].descriptortype == UPB_DESCRIPTOR_TYPE_MESSAGE || entry->fields[1].descriptortype == UPB_DESCRIPTOR_TYPE_GROUP) { /* Create proactively to handle the case where it doesn't appear. */ - ent.v.val = upb_value_ptr(_upb_msg_new(entry->submsgs[0], d->arena)); + ent.v.val = upb_value_ptr(_upb_msg_new(entry->submsgs[0], &d->arena)); } decode_tosubmsg(d, &ent.k, layout, field, val.str_val); /* Insert into map. */ - _upb_map_set(map, &ent.k, map->key_size, &ent.v, map->val_size, d->arena); + _upb_map_set(map, &ent.k, map->key_size, &ent.v, map->val_size, &d->arena); } static const char *decode_tomsg(upb_decstate *d, const char *ptr, upb_msg *msg, @@ -588,7 +591,7 @@ static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, } if (msg) { if (!_upb_msg_addunknown(msg, field_start, ptr - field_start, - d->arena)) { + &d->arena)) { decode_err(d); } } @@ -601,18 +604,25 @@ static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, upb_arena *arena) { + bool ok; upb_decstate state; + + if (size == 0) return true; + state.limit = buf + size; - state.arena = arena; + state.arena = *arena; state.depth = 64; state.end_group = 0; - if (setjmp(state.err)) return false; - - if (size == 0) return true; - decode_msg(&state, buf, msg, l); + if (setjmp(state.err)) { + ok = false; + } else { + decode_msg(&state, buf, msg, l); + ok = state.end_group == 0; + } - return state.end_group == 0; + *arena = state.arena; + return ok; } #undef OP_SCALAR_LG2 diff --git a/upb/upb.c b/upb/upb.c index 3089c059e1..e0a68dff47 100644 --- a/upb/upb.c +++ b/upb/upb.c @@ -1,5 +1,5 @@ -#include "upb/upb.h" +#include "upb/upb.int.h" #include #include @@ -85,25 +85,6 @@ typedef struct cleanup_ent { void *ud; } cleanup_ent; -struct upb_arena { - _upb_arena_head head; - uint32_t *cleanups; - - /* Allocator to allocate arena blocks. We are responsible for freeing these - * when we are destroyed. */ - upb_alloc *block_alloc; - uint32_t last_size; - - /* When multiple arenas are fused together, each arena points to a parent - * arena (root points to itself). The root tracks how many live arenas - * reference it. */ - uint32_t refcount; /* Only used when a->parent == a */ - struct upb_arena *parent; - - /* Linked list of blocks to free/cleanup. */ - mem_block *freelist, *freelist_tail; -}; - static const size_t memblock_reserve = UPB_ALIGN_UP(sizeof(mem_block), 16); static upb_arena *arena_findroot(upb_arena *a) { From bcbcdadbd2821742353b483f261695cbb941188c Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 11 Oct 2020 15:44:38 -0700 Subject: [PATCH 29/88] Fixed memory leak. --- upb/decode.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/upb/decode.c b/upb/decode.c index 59cb3f6ff9..b0b6105d3d 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -141,6 +141,7 @@ static const int8_t delim_ops[37] = { typedef struct { const char *limit; /* End of delimited region or end of buffer. */ upb_arena arena; + upb_arena *orig_parent; int depth; uint32_t end_group; /* Set to field number of END_GROUP tag, if any. */ jmp_buf err; @@ -610,9 +611,13 @@ bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, if (size == 0) return true; state.limit = buf + size; - state.arena = *arena; state.depth = 64; state.end_group = 0; + state.orig_parent = arena->parent; + state.arena = *arena; + if (arena->parent == arena) { + state.arena.parent = &state.arena; + } if (setjmp(state.err)) { ok = false; @@ -622,6 +627,7 @@ bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, } *arena = state.arena; + arena->parent = state.orig_parent; return ok; } From 36662b3735c58685f2f1c30610c9dbcfd7fa2f78 Mon Sep 17 00:00:00 2001 From: Gerben Stavenga Date: Sun, 11 Oct 2020 15:57:33 -0700 Subject: [PATCH 30/88] Refactor some code. I extracted some common code from all message field parsers, to a tail recursive function. Removed the varint jmp table for a simple varint parse loop, that removes the stack frames. Also careful with not losing information in repeated message tag check. When written mindful the checks and loads that happen can be reused for tag dispatch if not the expected tag. --- BUILD | 4 +- upb/decode_fast.c | 288 ++++++++++++++++++++-------------------------- upbc/generator.cc | 4 +- 3 files changed, 126 insertions(+), 170 deletions(-) diff --git a/BUILD b/BUILD index 5c1e424578..161edd8b7c 100644 --- a/BUILD +++ b/BUILD @@ -40,8 +40,8 @@ CPPOPTS = [ COPTS = CPPOPTS + [ # copybara:strip_for_google3_begin - "-pedantic", - "-Werror=pedantic", + #"-pedantic", + #"-Werror=pedantic", "-Wstrict-prototypes", # copybara:strip_end ] diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 74a73388a7..5a561b11ec 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -19,23 +19,35 @@ typedef enum { CARD_r = 2 /* Repeated */ } upb_card; +UPB_FORCEINLINE +const char *fastdecode_tag_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, + const upb_msglayout *table, uint64_t hasbits, uint32_t tag) { + uint64_t data; + size_t idx; + idx = (tag & 0xf8) >> 3; + data = table->field_data[idx] ^ tag; + return table->field_parser[idx](UPB_PARSE_ARGS); +} + +UPB_FORCEINLINE +uint32_t fastdecode_load_tag(const char* ptr) { + uint16_t tag; + memcpy(&tag, ptr, 2); + return tag; +} + UPB_FORCEINLINE const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits) { - uint16_t tag; - uint64_t data = 0; - size_t idx; if (UPB_UNLIKELY(ptr >= d->fastlimit)) { if (UPB_LIKELY(ptr == d->limit)) { *(uint32_t*)msg |= hasbits >> 16; /* Sync hasbits. */ return ptr; } + uint64_t data = 0; RETURN_GENERIC("dispatch hit end\n"); } - memcpy(&tag, ptr, 2); - idx = (tag & 0xf8) >> 3; - data = table->field_data[idx] ^ tag; - return table->field_parser[idx](UPB_PARSE_ARGS); + return fastdecode_tag_dispatch(d, ptr, msg, table, hasbits, fastdecode_load_tag(ptr)); } UPB_FORCEINLINE @@ -47,18 +59,11 @@ static bool fastdecode_checktag(uint64_t data, int tagbytes) { } } -UPB_FORCEINLINE -static uint16_t fastdecode_readtag(const char *ptr, int tagbytes) { - uint16_t ret = 0; - memcpy(&ret, ptr, tagbytes); - return ret; -} - UPB_FORCEINLINE static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, upb_msg *msg, uint64_t *data, uint64_t *hasbits, upb_array **outarr, - void **end, int tagbytes, int valbytes, + void **end, int valbytes, upb_card card, bool hasbit_is_idx) { size_t ofs = *data >> 48; void *field = (char *)msg + ofs; @@ -66,7 +71,7 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, switch (card) { case CARD_s: if (hasbit_is_idx) { - *hasbits |= 1 << (uint16_t)(*data >> 16); + *hasbits |= 1ull << ((*data >> 32) & 63); } else { *hasbits |= *data; } @@ -75,7 +80,6 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, uint8_t elem_size_lg2 = __builtin_ctz(valbytes); upb_array **arr_p = field; upb_array *arr; - uint16_t expected_tag; *hasbits >>= 16; *(uint32_t*)msg |= *hasbits; *hasbits = 0; @@ -101,8 +105,7 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, *end = (char*)field + (arr->size * valbytes); field = (char*)field + (arr->len * valbytes); } - expected_tag = fastdecode_readtag(ptr, tagbytes); - *data = expected_tag; + *data = fastdecode_load_tag(ptr); *outarr = arr; return field; } @@ -114,9 +117,9 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, UPB_FORCEINLINE static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, uint64_t *data, uint64_t *hasbits, - int tagbytes, int valbytes, upb_card card) { + int valbytes, upb_card card) { return fastdecode_getfield_ofs(d, ptr, msg, data, hasbits, NULL, NULL, - tagbytes, valbytes, card, false); + valbytes, card, false); } /* varint fields **************************************************************/ @@ -140,77 +143,31 @@ UPB_FORCEINLINE uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigza return val; } -UPB_FORCEINLINE -static int fastdecode_varintlen(uint64_t data64) { - uint64_t clear_bits = ~data64 & 0x8080808080808080; - if (clear_bits == 0) return -1; - return __builtin_ctzl(clear_bits) / 8 + 1; -} - -UPB_FORCEINLINE -static const char *fastdecode_longvarint(UPB_PARSE_PARAMS, int valbytes, - int varintbytes, bool zigzag) { - uint64_t val = data >> 18; - size_t ofs = (uint16_t)data; - uint64_t data64; - int sawbytes; - memcpy(&data64, ptr + 2, 8); - sawbytes = fastdecode_varintlen(data64) + 2; - UPB_ASSERT(sawbytes == varintbytes); -#ifdef __BMI2__ - if (varintbytes != 3) { - uint64_t mask = 0x7f7f7f7f7f7f7f7f >> (8 * (10 - varintbytes)); - val |= _pext_u64(data64, mask) << 14; - } else -#endif - { - int i; - for (i = 2; i < varintbytes; i++) { - uint64_t byte = ptr[i]; - if (i != varintbytes - 1) byte &= 0x7f; - val |= byte << (7 * i); - } - } - val = fastdecode_munge(val, valbytes, zigzag); - memcpy((char*)msg + ofs, &val, valbytes); - return fastdecode_dispatch(d, ptr + varintbytes, msg, table, hasbits); -} - -UPB_FORCEINLINE -static const char *fastdecode_longvarintjmp(UPB_PARSE_PARAMS, - _upb_field_parser **funcs) { - int len; - uint64_t data64; - memcpy(&data64, ptr + 2, 8); - len = fastdecode_varintlen(data64); - if (len < 0) return fastdecode_err(d); - return funcs[len - 1](UPB_PARSE_ARGS); -} - UPB_FORCEINLINE static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, - int valbytes, upb_card card, bool zigzag, - _upb_field_parser **funcs) { + int valbytes, upb_card card, bool zigzag) { uint64_t val; void *dst; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { RETURN_GENERIC("varint field tag mismatch\n"); } - dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, tagbytes, valbytes, + dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, valbytes, card); - val = (uint8_t)ptr[tagbytes]; + ptr += tagbytes + 1; + val = (uint8_t)ptr[-1]; if (UPB_UNLIKELY(val & 0x80)) { - uint32_t byte = (uint8_t)ptr[tagbytes + 1]; - val += (byte - 1) << 7; - if (UPB_UNLIKELY(byte & 0x80)) { - ptr += tagbytes; - data = (uint32_t)(val << 18 | data >> 48); - return fastdecode_longvarintjmp(UPB_PARSE_ARGS, funcs); + for (int i = 0; i < 8; i++) { + ptr++; + uint64_t byte = (uint8_t)ptr[-1]; + val += (byte - 1) << (7 + 7 * i); + if (UPB_LIKELY((byte & 0x80) == 0)) goto done; } - ptr += tagbytes + 2; - } else { - ptr += tagbytes + 1; + ptr++; + uint64_t byte = (uint8_t)ptr[-1]; + if (byte > 1) return fastdecode_err(d); + val += (byte - 1) << 63; } +done: val = fastdecode_munge(val, valbytes, zigzag); memcpy(dst, &val, valbytes); return fastdecode_dispatch(d, ptr, msg, table, hasbits); @@ -220,52 +177,13 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, #define b_ZZ false #define v_ZZ false -/* Generate varint vallbacks. */ - -#define FUNCNAME(type, valbytes, varintbytes) \ - upb_pl##type##valbytes##_##varintbytes##bv - -#define TABLENAME(type, valbytes) \ - upb_pl##type##valbytes##_table - -#define F(type, valbytes, varintbytes) \ - static const char *FUNCNAME(type, valbytes, varintbytes)(UPB_PARSE_PARAMS) { \ - return fastdecode_longvarint(UPB_PARSE_ARGS, valbytes, varintbytes, \ - type##_ZZ); \ - } - -#define FALLBACKS(type, valbytes) \ - F(type, valbytes, 3) \ - F(type, valbytes, 4) \ - F(type, valbytes, 5) \ - F(type, valbytes, 6) \ - F(type, valbytes, 7) \ - F(type, valbytes, 8) \ - F(type, valbytes, 9) \ - F(type, valbytes, 10) \ - static _upb_field_parser *TABLENAME(type, valbytes)[8] = { \ - &FUNCNAME(type, valbytes, 3), &FUNCNAME(type, valbytes, 4), \ - &FUNCNAME(type, valbytes, 5), &FUNCNAME(type, valbytes, 6), \ - &FUNCNAME(type, valbytes, 7), &FUNCNAME(type, valbytes, 8), \ - &FUNCNAME(type, valbytes, 9), &FUNCNAME(type, valbytes, 10)}; - -FALLBACKS(b, 1) -FALLBACKS(v, 4) -FALLBACKS(v, 8) -FALLBACKS(z, 4) -FALLBACKS(z, 8) - -#undef F -#undef FALLBACKS -#undef FUNCNAME - /* Generate all varint functions. * {s,o,r} x {b1,v4,z4,v8,z8} x {1bt,2bt} */ #define F(card, type, valbytes, tagbytes) \ const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ return fastdecode_varint(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card, \ - type##_ZZ, TABLENAME(type, valbytes)); \ + type##_ZZ); \ } #define TYPES(card, tagbytes) \ @@ -313,7 +231,7 @@ static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, RETURN_GENERIC("string field tag mismatch\n"); } - dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, tagbytes, + dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, sizeof(upb_strview), card); len = (int8_t)ptr[tagbytes]; str = ptr + tagbytes + 1; @@ -352,6 +270,40 @@ bool fastdecode_boundscheck2(const char *ptr, unsigned len, const char *end) { return res < uptr || res > uend; } +UPB_NOINLINE static +const char *fastdecode_lendelim_submsg(upb_decstate *d, const char *ptr, upb_msg *msg, + const upb_msglayout *table, uint64_t hasbits, const char* saved_limit) { + uint32_t len = (uint8_t)ptr[-1]; + if (UPB_UNLIKELY(len & 0x80)) { + ptr++; + uint32_t byte = (uint8_t)ptr[-1]; + len += (byte - 1) << 7; + if (UPB_UNLIKELY(byte & 0x80)) { + ptr++; + uint32_t byte = (uint8_t)ptr[-1]; + len += (byte - 1) << 14; + if (UPB_UNLIKELY(byte & 0x80)) { + ptr++; + uint32_t byte = (uint8_t)ptr[-1]; + len += (byte - 1) << 21; + if (UPB_UNLIKELY(byte & 0x80)) { + ptr++; + uint32_t byte = (uint8_t)ptr[-1]; + len += (byte - 1) << 28; + if (UPB_UNLIKELY(byte >= 8)) return fastdecode_err(d); + } + } + } + } + if (UPB_UNLIKELY(fastdecode_boundscheck2(ptr, len, saved_limit))) { + return fastdecode_err(d); + } + d->limit = ptr + len; + d->fastlimit = UPB_MIN(d->limit, d->fastend); + + return fastdecode_dispatch(d, ptr, msg, table, hasbits); +} + UPB_FORCEINLINE static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, int msg_ceil_bytes, upb_card card) { @@ -360,16 +312,22 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, RETURN_GENERIC("submessage field tag mismatch\n"); } - if (--d->depth < 0) return fastdecode_err(d); + if (--d->depth == 0) return fastdecode_err(d); upb_msg **submsg; upb_array *arr; void *end; - uint16_t submsg_idx = data >> 32; + uint32_t submsg_idx = data; + submsg_idx >>= 16; asm("" : "+r" (submsg_idx)); const upb_msglayout *subl = table->submsgs[submsg_idx]; submsg = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &arr, &end, - tagbytes, sizeof(upb_msg *), card, true); + sizeof(upb_msg *), card, true); + if (card == CARD_s) { + *(uint32_t*)msg |= hasbits >> 16; + hasbits = 0; + } + const char *saved_limit = d->limit; const char *saved_fastlimit = d->fastlimit; @@ -383,11 +341,7 @@ again: size_t new_bytes = new_size * sizeof(upb_msg*); char *old_ptr = _upb_array_ptr(arr); if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < new_bytes)) { - d->limit = saved_limit; - d->fastlimit = saved_fastlimit; - arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); - d->depth++; - RETURN_GENERIC("repeated realloc failed: arena full"); + goto repeated_generic; } memcpy(d->arena_ptr, old_ptr, old_bytes); arr->size = new_size; @@ -396,54 +350,49 @@ again: end = (void*)(d->arena_ptr + (new_size * sizeof(upb_msg*))); d->arena_ptr += new_bytes; } else { - d->limit = saved_limit; - d->fastlimit = saved_fastlimit; - d->depth++; - RETURN_GENERIC("need array realloc\n"); + goto repeated_generic; } } } + + upb_msg* child = *submsg; - { - uint32_t len = (uint8_t)ptr[tagbytes]; - if (UPB_UNLIKELY(len & 0x80)) { - uint32_t byte = (uint8_t)ptr[tagbytes + 1]; - len += (byte - 1) << 7; - if (UPB_UNLIKELY(byte & 0x80)) { - if (card == CARD_r) { - arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); - } - d->limit = saved_limit; - d->fastlimit = saved_fastlimit; - d->depth++; - RETURN_GENERIC("submessage field len >2 bytes\n"); - } - ptr++; - } - ptr += tagbytes + 1; - if (UPB_UNLIKELY(fastdecode_boundscheck2(ptr, len, saved_limit))) { - return fastdecode_err(d); - } - d->limit = ptr + len; - d->fastlimit = UPB_MIN(d->limit, d->fastend); - } - - if (card == CARD_r || UPB_LIKELY(!*submsg)) { - *submsg = decode_newmsg_ceil(d, subl, msg_ceil_bytes); + if (card == CARD_r || UPB_LIKELY(!child)) { + *submsg = child = decode_newmsg_ceil(d, subl, msg_ceil_bytes); } - ptr = fastdecode_dispatch(d, ptr, *submsg, subl, 0); - submsg++; + + ptr += tagbytes + 1; + + ptr = fastdecode_lendelim_submsg(d, ptr, child, subl, 0, saved_limit); if (UPB_UNLIKELY(ptr != d->limit || d->end_group != 0)) { return fastdecode_err(d); } if (card == CARD_r) { - if (UPB_LIKELY(ptr < saved_fastlimit) && - fastdecode_readtag(ptr, tagbytes) == (uint16_t)data) { - goto again; + submsg++; + if (UPB_LIKELY(ptr < saved_fastlimit)) { + uint32_t tag = fastdecode_load_tag(ptr); + if (tagbytes == 1) { + if ((uint8_t)tag == (uint8_t)data) goto again; + } else { + if ((uint16_t)tag == (uint16_t)data) goto again; + } + arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); + d->limit = saved_limit; + d->fastlimit = saved_fastlimit; + d->depth++; + return fastdecode_tag_dispatch(d, ptr, msg, table, hasbits, tag); + } else { + if (ptr == saved_limit) { + arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); + d->limit = saved_limit; + d->fastlimit = saved_fastlimit; + d->depth++; + return ptr; + } + goto repeated_generic; } - arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); } d->limit = saved_limit; @@ -451,6 +400,13 @@ again: d->depth++; return fastdecode_dispatch(d, ptr, msg, table, hasbits); + +repeated_generic: + arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); + d->limit = saved_limit; + d->fastlimit = saved_fastlimit; + d->depth++; + RETURN_GENERIC("repeated generic"); } #define F(card, tagbytes, size_ceil, ceil_arg) \ diff --git a/upbc/generator.cc b/upbc/generator.cc index 8e992c44ba..296b10f6c8 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -805,8 +805,8 @@ void TryFillTableEntry(const protobuf::Descriptor* message, if (field->type() == protobuf::FieldDescriptor::TYPE_MESSAGE) { SubmsgArray submsg_array = GetSubmsgArray(message); uint64_t idx = submsg_array.indexes[field->message_type()]; - data.size32 |= idx << 32 | hasbit_index << 16; - data.size64 |= idx << 32 | hasbit_index << 16; + data.size32 |= idx << 16 | hasbit_index << 32; + data.size64 |= idx << 16 | hasbit_index << 32; } else { uint32_t hasbit_mask = 1U << hasbit_index; data.size32 |= (uint64_t)hasbit_mask << 16; From 85a43e54614ebf30cb700f106afff172e232e734 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 11 Oct 2020 16:06:44 -0700 Subject: [PATCH 31/88] Added new internal header. --- upb/upb.int.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 upb/upb.int.h diff --git a/upb/upb.int.h b/upb/upb.int.h new file mode 100644 index 0000000000..b857560e4e --- /dev/null +++ b/upb/upb.int.h @@ -0,0 +1,29 @@ + +#ifndef UPB_INT_H_ +#define UPB_INT_H_ + +#include "upb/upb.h" + +struct mem_block; +typedef struct mem_block mem_block; + +struct upb_arena { + _upb_arena_head head; + uint32_t *cleanups; + + /* Allocator to allocate arena blocks. We are responsible for freeing these + * when we are destroyed. */ + upb_alloc *block_alloc; + uint32_t last_size; + + /* When multiple arenas are fused together, each arena points to a parent + * arena (root points to itself). The root tracks how many live arenas + * reference it. */ + uint32_t refcount; /* Only used when a->parent == a */ + struct upb_arena *parent; + + /* Linked list of blocks to free/cleanup. */ + mem_block *freelist, *freelist_tail; +}; + +#endif /* UPB_INT_H_ */ From 7f67f68c1ce09cb56c5ee271a46e28b3fee7f7e3 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 11 Oct 2020 17:04:54 -0700 Subject: [PATCH 32/88] Shrunk the arena state that needs to be synced. --- upb/decode.c | 12 ++++-------- upb/upb.c | 11 ++++++----- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/upb/decode.c b/upb/decode.c index b0b6105d3d..62e7c7d76b 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -141,7 +141,6 @@ static const int8_t delim_ops[37] = { typedef struct { const char *limit; /* End of delimited region or end of buffer. */ upb_arena arena; - upb_arena *orig_parent; int depth; uint32_t end_group; /* Set to field number of END_GROUP tag, if any. */ jmp_buf err; @@ -613,11 +612,9 @@ bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, state.limit = buf + size; state.depth = 64; state.end_group = 0; - state.orig_parent = arena->parent; - state.arena = *arena; - if (arena->parent == arena) { - state.arena.parent = &state.arena; - } + state.arena.head = arena->head; + state.arena.last_size = arena->last_size; + state.arena.parent = arena; if (setjmp(state.err)) { ok = false; @@ -626,8 +623,7 @@ bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, ok = state.end_group == 0; } - *arena = state.arena; - arena->parent = state.orig_parent; + arena->head = state.arena.head; return ok; } diff --git a/upb/upb.c b/upb/upb.c index e0a68dff47..41f4463333 100644 --- a/upb/upb.c +++ b/upb/upb.c @@ -98,9 +98,9 @@ static upb_arena *arena_findroot(upb_arena *a) { return a; } -static void upb_arena_addblock(upb_arena *a, void *ptr, size_t size) { +static void upb_arena_addblock(upb_arena *a, upb_arena *root, void *ptr, + size_t size) { mem_block *block = ptr; - upb_arena *root = arena_findroot(a); /* The block is for arena |a|, but should appear in the freelist of |root|. */ block->next = root->freelist; @@ -118,11 +118,12 @@ static void upb_arena_addblock(upb_arena *a, void *ptr, size_t size) { } static bool upb_arena_allocblock(upb_arena *a, size_t size) { + upb_arena *root = arena_findroot(a); size_t block_size = UPB_MAX(size, a->last_size * 2) + memblock_reserve; - mem_block *block = upb_malloc(a->block_alloc, block_size); + mem_block *block = upb_malloc(root->block_alloc, block_size); if (!block) return false; - upb_arena_addblock(a, block, block_size); + upb_arena_addblock(a, root, block, block_size); return true; } @@ -165,7 +166,7 @@ upb_arena *arena_initslow(void *mem, size_t n, upb_alloc *alloc) { a->freelist = NULL; a->freelist_tail = NULL; - upb_arena_addblock(a, mem, n); + upb_arena_addblock(a, a, mem, n); return a; } From ddc52ab9d6377439c4f1ea4c7be904a15cd20f46 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 11 Oct 2020 17:11:51 -0700 Subject: [PATCH 33/88] Shave off one more store. --- upb/decode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/upb/decode.c b/upb/decode.c index 62e7c7d76b..8dcd3df1eb 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -623,7 +623,8 @@ bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, ok = state.end_group == 0; } - arena->head = state.arena.head; + arena->head.ptr = state.arena.head.ptr; + arena->head.end = state.arena.head.end; return ok; } From 0bf063a2cab234cd23ac665c421be3a1d2507fcf Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 11 Oct 2020 17:56:57 -0700 Subject: [PATCH 34/88] Shrink overhead of message representation. --- benchmark.py | 42 ++++++++++++++++------------- upb/decode.c | 2 +- upb/msg.c | 76 ++++++++++++++++++++++++---------------------------- upb/msg.h | 34 ++++++++++++++++------- 4 files changed, 84 insertions(+), 70 deletions(-) diff --git a/benchmark.py b/benchmark.py index b75dd4d5a8..44f4940f5f 100755 --- a/benchmark.py +++ b/benchmark.py @@ -27,30 +27,33 @@ def GitWorktree(commit): def Run(cmd): subprocess.check_call(cmd, shell=True) -def Benchmark(outbase, runs=12): +def Benchmark(outbase, bench_cpu=True, runs=12): tmpfile = "/tmp/bench-output.json" Run("rm -rf {}".format(tmpfile)) - Run("bazel test :all") - Run("bazel build -c opt :benchmark") + Run("CC=clang bazel test :all") - Run("./bazel-bin/benchmark --benchmark_out_format=json --benchmark_out={} --benchmark_repetitions={}".format(tmpfile, runs)) + if bench_cpu: + Run("CC=clang bazel build -c opt :benchmark") - Run("bazel build -c opt --copt=-g :conformance_upb") - Run("cp -f bazel-bin/conformance_upb {}.bin".format(outbase)) + Run("./bazel-bin/benchmark --benchmark_out_format=json --benchmark_out={} --benchmark_repetitions={}".format(tmpfile, runs)) + with open(tmpfile) as f: + bench_json = json.load(f) + + # Translate into the format expected by benchstat. + with open(outbase + ".txt", "w") as f: + for run in bench_json["benchmarks"]: + name = re.sub(r'^BM_', 'Benchmark', run["name"]) + if name.endswith("_mean") or name.endswith("_median") or name.endswith("_stddev"): + continue + values = (name, run["iterations"], run["cpu_time"]) + print("{} {} {} ns/op".format(*values), file=f) - with open(tmpfile) as f: - bench_json = json.load(f) + Run("CC=clang bazel build -c opt --copt=-g :conformance_upb") + Run("cp -f bazel-bin/conformance_upb {}.bin".format(outbase)) - # Translate into the format expected by benchstat. - with open(outbase + ".txt", "w") as f: - for run in bench_json["benchmarks"]: - name = re.sub(r'^BM_', 'Benchmark', run["name"]) - if name.endswith("_mean") or name.endswith("_median") or name.endswith("_stddev"): - continue - values = (name, run["iterations"], run["cpu_time"]) - print("{} {} {} ns/op".format(*values), file=f) baseline = "master" +bench_cpu = True if len(sys.argv) > 1: baseline = sys.argv[1] @@ -60,16 +63,17 @@ if len(sys.argv) > 1: pass # Benchmark our current directory first, since it's more likely to be broken. -Benchmark("/tmp/new") +Benchmark("/tmp/new", bench_cpu) # Benchmark the baseline. with GitWorktree(baseline): - Benchmark("/tmp/old") + Benchmark("/tmp/old", bench_cpu) print() print() -Run("~/go/bin/benchstat /tmp/old.txt /tmp/new.txt") +if bench_cpu: + Run("~/go/bin/benchstat /tmp/old.txt /tmp/new.txt") print() print() diff --git a/upb/decode.c b/upb/decode.c index 8dcd3df1eb..cedca1e374 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -616,7 +616,7 @@ bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, state.arena.last_size = arena->last_size; state.arena.parent = arena; - if (setjmp(state.err)) { + if (UPB_UNLIKELY(setjmp(state.err))) { ok = false; } else { decode_msg(&state, buf, msg, l); diff --git a/upb/msg.c b/upb/msg.c index 25747c8481..ee4ee8b06b 100644 --- a/upb/msg.c +++ b/upb/msg.c @@ -22,73 +22,67 @@ static const char _upb_fieldtype_to_sizelg2[12] = { UPB_SIZE(3, 4), /* UPB_TYPE_BYTES */ }; -static uintptr_t tag_arrptr(void* ptr, int elem_size_lg2) { - UPB_ASSERT(elem_size_lg2 <= 4); - return (uintptr_t)ptr | elem_size_lg2; -} - -static int upb_msg_internalsize(const upb_msglayout *l) { - return sizeof(upb_msg_internal) - l->extendable * sizeof(void *); -} - -static size_t upb_msg_sizeof(const upb_msglayout *l) { - return l->size + upb_msg_internalsize(l); -} +static const size_t overhead = sizeof(upb_msg_internal); static const upb_msg_internal *upb_msg_getinternal_const(const upb_msg *msg) { ptrdiff_t size = sizeof(upb_msg_internal); return UPB_PTR_AT(msg, -size, upb_msg_internal); } -static upb_msg_internal *upb_msg_getinternal(upb_msg *msg) { - return (upb_msg_internal*)upb_msg_getinternal_const(msg); +upb_msg *_upb_msg_new(const upb_msglayout *l, upb_arena *a) { + return _upb_msg_new_inl(l, a); } void _upb_msg_clear(upb_msg *msg, const upb_msglayout *l) { - ptrdiff_t internal = upb_msg_internalsize(l); - void *mem = UPB_PTR_AT(msg, -internal, char); - memset(mem, 0, l->size + internal); + void *mem = UPB_PTR_AT(msg, -sizeof(upb_msg_internal), char); + memset(mem, 0, upb_msg_sizeof(l)); } -upb_msg *_upb_msg_new(const upb_msglayout *l, upb_arena *a) { - void *mem = upb_arena_malloc(a, upb_msg_sizeof(l)); - upb_msg *msg; - - if (!mem) { - return NULL; - } - - msg = UPB_PTR_AT(mem, upb_msg_internalsize(l), upb_msg); - _upb_msg_clear(msg, l); - return msg; +static uintptr_t tag_arrptr(void* ptr, int elem_size_lg2) { + UPB_ASSERT(elem_size_lg2 <= 4); + return (uintptr_t)ptr | elem_size_lg2; } bool _upb_msg_addunknown(upb_msg *msg, const char *data, size_t len, upb_arena *arena) { + upb_msg_internal *in = upb_msg_getinternal(msg); - if (len > in->unknown_size - in->unknown_len) { - upb_alloc *alloc = upb_arena_alloc(arena); - size_t need = in->unknown_size + len; - size_t newsize = UPB_MAX(in->unknown_size * 2, need); - void *mem = upb_realloc(alloc, in->unknown, in->unknown_size, newsize); - if (!mem) return false; - in->unknown = mem; - in->unknown_size = newsize; + if (!in->unknown) { + size_t size = 128; + while (size < len) size *= 2; + in->unknown = upb_arena_malloc(arena, size + overhead); + if (!in->unknown) return false; + in->unknown->size = size; + in->unknown->len = 0; + } else if (in->unknown->size - in->unknown->len < len) { + size_t need = in->unknown->len + len; + size_t size = in->unknown->size;; + while (size < need) size *= 2; + in->unknown = upb_arena_realloc( + arena, in->unknown, in->unknown->size + overhead, size + overhead); + if (!in->unknown) return false; } - memcpy(in->unknown + in->unknown_len, data, len); - in->unknown_len += len; + memcpy(UPB_PTR_AT(in->unknown + 1, in->unknown->len, char), data, len); + in->unknown->len += len; return true; } void _upb_msg_discardunknown_shallow(upb_msg *msg) { upb_msg_internal *in = upb_msg_getinternal(msg); - in->unknown_len = 0; + if (in->unknown) { + in->unknown->len = 0; + } } const char *upb_msg_getunknown(const upb_msg *msg, size_t *len) { const upb_msg_internal *in = upb_msg_getinternal_const(msg); - *len = in->unknown_len; - return in->unknown; + if (in->unknown) { + *len = in->unknown->len; + return (char*)(in->unknown + 1); + } else { + *len = 0; + return NULL; + } } /** upb_array *****************************************************************/ diff --git a/upb/msg.h b/upb/msg.h index 695c278b21..e06d3c7a5c 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -62,25 +62,41 @@ typedef struct upb_msglayout { * compatibility. We put these before the user's data. The user's upb_msg* * points after the upb_msg_internal. */ -/* Used when a message is not extendable. */ typedef struct { - char *unknown; - size_t unknown_len; - size_t unknown_size; -} upb_msg_internal; + uint32_t len; + uint32_t size; + /* Data follows. */ +} upb_msg_unknowndata; -/* Used when a message is extendable. */ +/* Used when a message is not extendable. */ typedef struct { - upb_inttable *extdict; - upb_msg_internal base; -} upb_msg_internal_withext; + upb_msg_unknowndata *unknown; +} upb_msg_internal; /* Maps upb_fieldtype_t -> memory size. */ extern char _upb_fieldtype_to_size[12]; +UPB_INLINE size_t upb_msg_sizeof(const upb_msglayout *l) { + return l->size + sizeof(upb_msg_internal); +} + +UPB_INLINE upb_msg *_upb_msg_new_inl(const upb_msglayout *l, upb_arena *a) { + size_t size = upb_msg_sizeof(l); + void *mem = upb_arena_malloc(a, size); + upb_msg *msg; + if (UPB_UNLIKELY(!mem)) return NULL; + msg = UPB_PTR_AT(mem, sizeof(upb_msg_internal), upb_msg); + memset(mem, 0, size); + return msg; +} + /* Creates a new messages with the given layout on the given arena. */ upb_msg *_upb_msg_new(const upb_msglayout *l, upb_arena *a); +UPB_INLINE upb_msg_internal *upb_msg_getinternal(upb_msg *msg) { + return UPB_PTR_AT(msg, -sizeof(upb_msg_internal), upb_msg_internal); +} + /* Clears the given message. */ void _upb_msg_clear(upb_msg *msg, const upb_msglayout *l); From 9557b97acc5a94981914c4f5e2349e36eaec0f4c Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 11 Oct 2020 20:23:53 -0700 Subject: [PATCH 35/88] Implemented inline array allocation, and moved type->lg2 map to reflection. --- benchmark.py | 2 +- .../google/protobuf/descriptor.upb.h | 144 +++++++++--------- upb/decode.c | 50 +++--- upb/msg.c | 54 ++----- upb/msg.h | 31 ++-- upb/reflection.c | 17 ++- upbc/generator.cc | 28 ++-- 7 files changed, 159 insertions(+), 167 deletions(-) diff --git a/benchmark.py b/benchmark.py index 44f4940f5f..70a3cce118 100755 --- a/benchmark.py +++ b/benchmark.py @@ -33,7 +33,7 @@ def Benchmark(outbase, bench_cpu=True, runs=12): Run("CC=clang bazel test :all") if bench_cpu: - Run("CC=clang bazel build -c opt :benchmark") + Run("CC=clang bazel build -c opt --copt=-march=native :benchmark") Run("./bazel-bin/benchmark --benchmark_out_format=json --benchmark_out={} --benchmark_repetitions={}".format(tmpfile, runs)) with open(tmpfile) as f: diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.h b/generated_for_cmake/google/protobuf/descriptor.upb.h index 64701a0cf2..0d9b20078b 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.h +++ b/generated_for_cmake/google/protobuf/descriptor.upb.h @@ -174,12 +174,12 @@ UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorS return (google_protobuf_FileDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); } UPB_INLINE google_protobuf_FileDescriptorProto** google_protobuf_FileDescriptorSet_resize_file(google_protobuf_FileDescriptorSet *msg, size_t len, upb_arena *arena) { - return (google_protobuf_FileDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_FileDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_FileDescriptorProto* google_protobuf_FileDescriptorSet_add_file(google_protobuf_FileDescriptorSet *msg, upb_arena *arena) { struct google_protobuf_FileDescriptorProto* sub = (struct google_protobuf_FileDescriptorProto*)_upb_msg_new(&google_protobuf_FileDescriptorProto_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -232,22 +232,22 @@ UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_mutable_dependency(g return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len); } UPB_INLINE upb_strview* google_protobuf_FileDescriptorProto_resize_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { - return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(36, 72), len, UPB_TYPE_STRING, arena); + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(36, 72), len, UPB_SIZE(3, 4), arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_dependency(google_protobuf_FileDescriptorProto *msg, upb_strview val, upb_arena *arena) { - return _upb_array_append_accessor(msg, UPB_SIZE(36, 72), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, + return _upb_array_append_accessor(msg, UPB_SIZE(36, 72), UPB_SIZE(8, 16), UPB_SIZE(3, 4), &val, arena); } UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_mutable_message_type(google_protobuf_FileDescriptorProto *msg, size_t *len) { return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len); } UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_FileDescriptorProto_resize_message_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 80), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 80), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_FileDescriptorProto_add_message_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)_upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(40, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(40, 80), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -255,12 +255,12 @@ UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorP return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len); } UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_FileDescriptorProto_resize_enum_type(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(44, 88), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(44, 88), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_FileDescriptorProto_add_enum_type(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)_upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(44, 88), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(44, 88), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -268,12 +268,12 @@ UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescript return (google_protobuf_ServiceDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(48, 96), len); } UPB_INLINE google_protobuf_ServiceDescriptorProto** google_protobuf_FileDescriptorProto_resize_service(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_ServiceDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(48, 96), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_ServiceDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(48, 96), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_ServiceDescriptorProto* google_protobuf_FileDescriptorProto_add_service(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { struct google_protobuf_ServiceDescriptorProto* sub = (struct google_protobuf_ServiceDescriptorProto*)_upb_msg_new(&google_protobuf_ServiceDescriptorProto_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(48, 96), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(48, 96), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -281,12 +281,12 @@ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptor return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(52, 104), len); } UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_FileDescriptorProto_resize_extension(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(52, 104), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(52, 104), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDescriptorProto_add_extension(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(52, 104), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(52, 104), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -320,20 +320,20 @@ UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_public_dependenc return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 112), len); } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_public_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { - return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(56, 112), len, UPB_TYPE_INT32, arena); + return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(56, 112), len, 2, arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_public_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) { - return _upb_array_append_accessor(msg, UPB_SIZE(56, 112), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, + return _upb_array_append_accessor(msg, UPB_SIZE(56, 112), UPB_SIZE(4, 4), 2, &val, arena); } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_mutable_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(60, 120), len); } UPB_INLINE int32_t* google_protobuf_FileDescriptorProto_resize_weak_dependency(google_protobuf_FileDescriptorProto *msg, size_t len, upb_arena *arena) { - return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(60, 120), len, UPB_TYPE_INT32, arena); + return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(60, 120), len, 2, arena); } UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_protobuf_FileDescriptorProto *msg, int32_t val, upb_arena *arena) { - return _upb_array_append_accessor(msg, UPB_SIZE(60, 120), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, + return _upb_array_append_accessor(msg, UPB_SIZE(60, 120), UPB_SIZE(4, 4), 2, &val, arena); } UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_strview value) { @@ -383,12 +383,12 @@ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProt return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len); } UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_field(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_field(google_protobuf_DescriptorProto *msg, upb_arena *arena) { struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -396,12 +396,12 @@ UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_mut return (google_protobuf_DescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len); } UPB_INLINE google_protobuf_DescriptorProto** google_protobuf_DescriptorProto_resize_nested_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_DescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_DescriptorProto* google_protobuf_DescriptorProto_add_nested_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) { struct google_protobuf_DescriptorProto* sub = (struct google_protobuf_DescriptorProto*)_upb_msg_new(&google_protobuf_DescriptorProto_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(20, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(20, 40), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -409,12 +409,12 @@ UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto return (google_protobuf_EnumDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len); } UPB_INLINE google_protobuf_EnumDescriptorProto** google_protobuf_DescriptorProto_resize_enum_type(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_EnumDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_EnumDescriptorProto* google_protobuf_DescriptorProto_add_enum_type(google_protobuf_DescriptorProto *msg, upb_arena *arena) { struct google_protobuf_EnumDescriptorProto* sub = (struct google_protobuf_EnumDescriptorProto*)_upb_msg_new(&google_protobuf_EnumDescriptorProto_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(24, 48), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(24, 48), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -422,12 +422,12 @@ UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_Desc return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len); } UPB_INLINE google_protobuf_DescriptorProto_ExtensionRange** google_protobuf_DescriptorProto_resize_extension_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_DescriptorProto_ExtensionRange**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_DescriptorProto_ExtensionRange* google_protobuf_DescriptorProto_add_extension_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) { struct google_protobuf_DescriptorProto_ExtensionRange* sub = (struct google_protobuf_DescriptorProto_ExtensionRange*)_upb_msg_new(&google_protobuf_DescriptorProto_ExtensionRange_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(28, 56), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(28, 56), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -435,12 +435,12 @@ UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProt return (google_protobuf_FieldDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(32, 64), len); } UPB_INLINE google_protobuf_FieldDescriptorProto** google_protobuf_DescriptorProto_resize_extension(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 64), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_FieldDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(32, 64), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_DescriptorProto_add_extension(google_protobuf_DescriptorProto *msg, upb_arena *arena) { struct google_protobuf_FieldDescriptorProto* sub = (struct google_protobuf_FieldDescriptorProto*)_upb_msg_new(&google_protobuf_FieldDescriptorProto_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(32, 64), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(32, 64), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -461,12 +461,12 @@ UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProt return (google_protobuf_OneofDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(36, 72), len); } UPB_INLINE google_protobuf_OneofDescriptorProto** google_protobuf_DescriptorProto_resize_oneof_decl(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_OneofDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(36, 72), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_OneofDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(36, 72), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_OneofDescriptorProto* google_protobuf_DescriptorProto_add_oneof_decl(google_protobuf_DescriptorProto *msg, upb_arena *arena) { struct google_protobuf_OneofDescriptorProto* sub = (struct google_protobuf_OneofDescriptorProto*)_upb_msg_new(&google_protobuf_OneofDescriptorProto_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(36, 72), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(36, 72), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -474,12 +474,12 @@ UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_Descr return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(40, 80), len); } UPB_INLINE google_protobuf_DescriptorProto_ReservedRange** google_protobuf_DescriptorProto_resize_reserved_range(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 80), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_DescriptorProto_ReservedRange**)_upb_array_resize_accessor(msg, UPB_SIZE(40, 80), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_DescriptorProto_ReservedRange* google_protobuf_DescriptorProto_add_reserved_range(google_protobuf_DescriptorProto *msg, upb_arena *arena) { struct google_protobuf_DescriptorProto_ReservedRange* sub = (struct google_protobuf_DescriptorProto_ReservedRange*)_upb_msg_new(&google_protobuf_DescriptorProto_ReservedRange_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(40, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(40, 80), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -487,10 +487,10 @@ UPB_INLINE upb_strview* google_protobuf_DescriptorProto_mutable_reserved_name(go return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(44, 88), len); } UPB_INLINE upb_strview* google_protobuf_DescriptorProto_resize_reserved_name(google_protobuf_DescriptorProto *msg, size_t len, upb_arena *arena) { - return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(44, 88), len, UPB_TYPE_STRING, arena); + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(44, 88), len, UPB_SIZE(3, 4), arena); } UPB_INLINE bool google_protobuf_DescriptorProto_add_reserved_name(google_protobuf_DescriptorProto *msg, upb_strview val, upb_arena *arena) { - return _upb_array_append_accessor(msg, UPB_SIZE(44, 88), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, + return _upb_array_append_accessor(msg, UPB_SIZE(44, 88), UPB_SIZE(8, 16), UPB_SIZE(3, 4), &val, arena); } @@ -586,12 +586,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeO return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ExtensionRangeOptions_resize_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ExtensionRangeOptions_add_uninterpreted_option(google_protobuf_ExtensionRangeOptions *msg, upb_arena *arena) { struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -756,12 +756,12 @@ UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescri return (google_protobuf_EnumValueDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len); } UPB_INLINE google_protobuf_EnumValueDescriptorProto** google_protobuf_EnumDescriptorProto_resize_value(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_EnumValueDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_EnumValueDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_EnumValueDescriptorProto* google_protobuf_EnumDescriptorProto_add_value(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) { struct google_protobuf_EnumValueDescriptorProto* sub = (struct google_protobuf_EnumValueDescriptorProto*)_upb_msg_new(&google_protobuf_EnumValueDescriptorProto_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -782,12 +782,12 @@ UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protob return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len); } UPB_INLINE google_protobuf_EnumDescriptorProto_EnumReservedRange** google_protobuf_EnumDescriptorProto_resize_reserved_range(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_EnumDescriptorProto_EnumReservedRange**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_EnumDescriptorProto_EnumReservedRange* google_protobuf_EnumDescriptorProto_add_reserved_range(google_protobuf_EnumDescriptorProto *msg, upb_arena *arena) { struct google_protobuf_EnumDescriptorProto_EnumReservedRange* sub = (struct google_protobuf_EnumDescriptorProto_EnumReservedRange*)_upb_msg_new(&google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(20, 40), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(20, 40), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -795,10 +795,10 @@ UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_mutable_reserved_nam return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len); } UPB_INLINE upb_strview* google_protobuf_EnumDescriptorProto_resize_reserved_name(google_protobuf_EnumDescriptorProto *msg, size_t len, upb_arena *arena) { - return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_TYPE_STRING, arena); + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_SIZE(3, 4), arena); } UPB_INLINE bool google_protobuf_EnumDescriptorProto_add_reserved_name(google_protobuf_EnumDescriptorProto *msg, upb_strview val, upb_arena *arena) { - return _upb_array_append_accessor(msg, UPB_SIZE(24, 48), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, + return _upb_array_append_accessor(msg, UPB_SIZE(24, 48), UPB_SIZE(8, 16), UPB_SIZE(3, 4), &val, arena); } @@ -902,12 +902,12 @@ UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescri return (google_protobuf_MethodDescriptorProto**)_upb_array_mutable_accessor(msg, UPB_SIZE(16, 32), len); } UPB_INLINE google_protobuf_MethodDescriptorProto** google_protobuf_ServiceDescriptorProto_resize_method(google_protobuf_ServiceDescriptorProto *msg, size_t len, upb_arena *arena) { - return (google_protobuf_MethodDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_MethodDescriptorProto**)_upb_array_resize_accessor(msg, UPB_SIZE(16, 32), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_MethodDescriptorProto* google_protobuf_ServiceDescriptorProto_add_method(google_protobuf_ServiceDescriptorProto *msg, upb_arena *arena) { struct google_protobuf_MethodDescriptorProto* sub = (struct google_protobuf_MethodDescriptorProto*)_upb_msg_new(&google_protobuf_MethodDescriptorProto_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(16, 32), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -1127,12 +1127,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_mut return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(108, 192), len); } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FileOptions_resize_uninterpreted_option(google_protobuf_FileOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(108, 192), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(108, 192), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FileOptions_add_uninterpreted_option(google_protobuf_FileOptions *msg, upb_arena *arena) { struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(108, 192), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(108, 192), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -1182,12 +1182,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(8, 8), len); } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MessageOptions_resize_uninterpreted_option(google_protobuf_MessageOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(8, 8), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(8, 8), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MessageOptions_add_uninterpreted_option(google_protobuf_MessageOptions *msg, upb_arena *arena) { struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(8, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(8, 8), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -1249,12 +1249,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_mu return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 32), len); } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_FieldOptions_resize_uninterpreted_option(google_protobuf_FieldOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 32), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(28, 32), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_FieldOptions_add_uninterpreted_option(google_protobuf_FieldOptions *msg, upb_arena *arena) { struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(28, 32), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(28, 32), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -1280,12 +1280,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_mu return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_OneofOptions_resize_uninterpreted_option(google_protobuf_OneofOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_OneofOptions_add_uninterpreted_option(google_protobuf_OneofOptions *msg, upb_arena *arena) { struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -1323,12 +1323,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_mut return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumOptions_resize_uninterpreted_option(google_protobuf_EnumOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumOptions_add_uninterpreted_option(google_protobuf_EnumOptions *msg, upb_arena *arena) { struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -1360,12 +1360,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOption return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_EnumValueOptions_resize_uninterpreted_option(google_protobuf_EnumValueOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_EnumValueOptions_add_uninterpreted_option(google_protobuf_EnumValueOptions *msg, upb_arena *arena) { struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -1397,12 +1397,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_ return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(4, 8), len); } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_ServiceOptions_resize_uninterpreted_option(google_protobuf_ServiceOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(4, 8), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_ServiceOptions_add_uninterpreted_option(google_protobuf_ServiceOptions *msg, upb_arena *arena) { struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(4, 8), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -1440,12 +1440,12 @@ UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_m return (google_protobuf_UninterpretedOption**)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 24), len); } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_resize_uninterpreted_option(google_protobuf_MethodOptions *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 24), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_UninterpretedOption**)_upb_array_resize_accessor(msg, UPB_SIZE(20, 24), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_UninterpretedOption* google_protobuf_MethodOptions_add_uninterpreted_option(google_protobuf_MethodOptions *msg, upb_arena *arena) { struct google_protobuf_UninterpretedOption* sub = (struct google_protobuf_UninterpretedOption*)_upb_msg_new(&google_protobuf_UninterpretedOption_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(20, 24), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(20, 24), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -1483,12 +1483,12 @@ UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_Uninte return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_mutable_accessor(msg, UPB_SIZE(56, 80), len); } UPB_INLINE google_protobuf_UninterpretedOption_NamePart** google_protobuf_UninterpretedOption_resize_name(google_protobuf_UninterpretedOption *msg, size_t len, upb_arena *arena) { - return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_resize_accessor(msg, UPB_SIZE(56, 80), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_UninterpretedOption_NamePart**)_upb_array_resize_accessor(msg, UPB_SIZE(56, 80), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_UninterpretedOption_add_name(google_protobuf_UninterpretedOption *msg, upb_arena *arena) { struct google_protobuf_UninterpretedOption_NamePart* sub = (struct google_protobuf_UninterpretedOption_NamePart*)_upb_msg_new(&google_protobuf_UninterpretedOption_NamePart_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(56, 80), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(56, 80), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -1566,12 +1566,12 @@ UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeI return (google_protobuf_SourceCodeInfo_Location**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); } UPB_INLINE google_protobuf_SourceCodeInfo_Location** google_protobuf_SourceCodeInfo_resize_location(google_protobuf_SourceCodeInfo *msg, size_t len, upb_arena *arena) { - return (google_protobuf_SourceCodeInfo_Location**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_SourceCodeInfo_Location**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_SourceCodeInfo_Location* google_protobuf_SourceCodeInfo_add_location(google_protobuf_SourceCodeInfo *msg, upb_arena *arena) { struct google_protobuf_SourceCodeInfo_Location* sub = (struct google_protobuf_SourceCodeInfo_Location*)_upb_msg_new(&google_protobuf_SourceCodeInfo_Location_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -1602,20 +1602,20 @@ UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_path(google_ return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len); } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_path(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) { - return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, UPB_TYPE_INT32, arena); + return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 40), len, 2, arena); } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_path(google_protobuf_SourceCodeInfo_Location *msg, int32_t val, upb_arena *arena) { - return _upb_array_append_accessor(msg, UPB_SIZE(20, 40), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, + return _upb_array_append_accessor(msg, UPB_SIZE(20, 40), UPB_SIZE(4, 4), 2, &val, arena); } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_mutable_span(google_protobuf_SourceCodeInfo_Location *msg, size_t *len) { return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len); } UPB_INLINE int32_t* google_protobuf_SourceCodeInfo_Location_resize_span(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) { - return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, UPB_TYPE_INT32, arena); + return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(24, 48), len, 2, arena); } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_span(google_protobuf_SourceCodeInfo_Location *msg, int32_t val, upb_arena *arena) { - return _upb_array_append_accessor(msg, UPB_SIZE(24, 48), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, + return _upb_array_append_accessor(msg, UPB_SIZE(24, 48), UPB_SIZE(4, 4), 2, &val, arena); } UPB_INLINE void google_protobuf_SourceCodeInfo_Location_set_leading_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview value) { @@ -1630,10 +1630,10 @@ UPB_INLINE upb_strview* google_protobuf_SourceCodeInfo_Location_mutable_leading_ return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(28, 56), len); } UPB_INLINE upb_strview* google_protobuf_SourceCodeInfo_Location_resize_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, size_t len, upb_arena *arena) { - return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_TYPE_STRING, arena); + return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(28, 56), len, UPB_SIZE(3, 4), arena); } UPB_INLINE bool google_protobuf_SourceCodeInfo_Location_add_leading_detached_comments(google_protobuf_SourceCodeInfo_Location *msg, upb_strview val, upb_arena *arena) { - return _upb_array_append_accessor(msg, UPB_SIZE(28, 56), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val, + return _upb_array_append_accessor(msg, UPB_SIZE(28, 56), UPB_SIZE(8, 16), UPB_SIZE(3, 4), &val, arena); } @@ -1658,12 +1658,12 @@ UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_Genera return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len); } UPB_INLINE google_protobuf_GeneratedCodeInfo_Annotation** google_protobuf_GeneratedCodeInfo_resize_annotation(google_protobuf_GeneratedCodeInfo *msg, size_t len, upb_arena *arena) { - return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_TYPE_MESSAGE, arena); + return (google_protobuf_GeneratedCodeInfo_Annotation**)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_SIZE(2, 3), arena); } UPB_INLINE struct google_protobuf_GeneratedCodeInfo_Annotation* google_protobuf_GeneratedCodeInfo_add_annotation(google_protobuf_GeneratedCodeInfo *msg, upb_arena *arena) { struct google_protobuf_GeneratedCodeInfo_Annotation* sub = (struct google_protobuf_GeneratedCodeInfo_Annotation*)_upb_msg_new(&google_protobuf_GeneratedCodeInfo_Annotation_msginit, arena); bool ok = _upb_array_append_accessor( - msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_TYPE_MESSAGE, &sub, arena); + msg, UPB_SIZE(0, 0), UPB_SIZE(4, 8), UPB_SIZE(2, 3), &sub, arena); if (!ok) return NULL; return sub; } @@ -1694,10 +1694,10 @@ UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(go return (int32_t*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 32), len); } UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_resize_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t len, upb_arena *arena) { - return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 32), len, UPB_TYPE_INT32, arena); + return (int32_t*)_upb_array_resize_accessor(msg, UPB_SIZE(20, 32), len, 2, arena); } UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t val, upb_arena *arena) { - return _upb_array_append_accessor(msg, UPB_SIZE(20, 32), UPB_SIZE(4, 4), UPB_TYPE_INT32, &val, + return _upb_array_append_accessor(msg, UPB_SIZE(20, 32), UPB_SIZE(4, 4), 2, &val, arena); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_strview value) { diff --git a/upb/decode.c b/upb/decode.c index cedca1e374..ce848140bb 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -11,26 +11,26 @@ #include "upb/port_def.inc" /* Maps descriptor type -> upb field type. */ -static const uint8_t desctype_to_fieldtype[] = { +static const uint8_t desctype_to_elem_size_lg2[] = { -1, /* invalid descriptor type */ - UPB_TYPE_DOUBLE, /* DOUBLE */ - UPB_TYPE_FLOAT, /* FLOAT */ - UPB_TYPE_INT64, /* INT64 */ - UPB_TYPE_UINT64, /* UINT64 */ - UPB_TYPE_INT32, /* INT32 */ - UPB_TYPE_UINT64, /* FIXED64 */ - UPB_TYPE_UINT32, /* FIXED32 */ - UPB_TYPE_BOOL, /* BOOL */ - UPB_TYPE_STRING, /* STRING */ - UPB_TYPE_MESSAGE, /* GROUP */ - UPB_TYPE_MESSAGE, /* MESSAGE */ - UPB_TYPE_BYTES, /* BYTES */ - UPB_TYPE_UINT32, /* UINT32 */ - UPB_TYPE_ENUM, /* ENUM */ - UPB_TYPE_INT32, /* SFIXED32 */ - UPB_TYPE_INT64, /* SFIXED64 */ - UPB_TYPE_INT32, /* SINT32 */ - UPB_TYPE_INT64, /* SINT64 */ + 3, /* DOUBLE */ + 2, /* FLOAT */ + 3, /* INT64 */ + 3, /* UINT64 */ + 2, /* INT32 */ + 3, /* FIXED64 */ + 2, /* FIXED32 */ + 0, /* BOOL */ + UPB_SIZE(3, 4), /* STRING */ + UPB_SIZE(2, 3), /* GROUP */ + UPB_SIZE(2, 3), /* MESSAGE */ + UPB_SIZE(3, 4), /* BYTES */ + 2, /* UINT32 */ + 2, /* ENUM */ + 2, /* SFIXED32 */ + 3, /* SFIXED64 */ + 2, /* SINT32 */ + 3, /* SINT64 */ }; /* Maps descriptor type -> upb map size. */ @@ -284,7 +284,7 @@ static const upb_msglayout_field *upb_find_field(const upb_msglayout *l, static upb_msg *decode_newsubmsg(upb_decstate *d, const upb_msglayout *layout, const upb_msglayout_field *field) { const upb_msglayout *subl = layout->submsgs[field->submsg_index]; - return _upb_msg_new(subl, &d->arena); + return _upb_msg_new_inl(subl, &d->arena); } static void decode_tosubmsg(upb_decstate *d, upb_msg *submsg, @@ -326,15 +326,15 @@ static const char *decode_toarray(upb_decstate *d, const char *ptr, upb_array *arr = *arrp; void *mem; - if (!arr) { - upb_fieldtype_t type = desctype_to_fieldtype[field->descriptortype]; - arr = _upb_array_new(&d->arena, type); + if (arr) { + decode_reserve(d, arr, 1); + } else { + size_t lg2 = desctype_to_elem_size_lg2[field->descriptortype]; + arr = _upb_array_new(&d->arena, 4, lg2); if (!arr) decode_err(d); *arrp = arr; } - decode_reserve(d, arr, 1); - switch (op) { case OP_SCALAR_LG2(0): case OP_SCALAR_LG2(2): diff --git a/upb/msg.c b/upb/msg.c index ee4ee8b06b..c878be9777 100644 --- a/upb/msg.c +++ b/upb/msg.c @@ -7,21 +7,6 @@ /** upb_msg *******************************************************************/ -static const char _upb_fieldtype_to_sizelg2[12] = { - 0, - 0, /* UPB_TYPE_BOOL */ - 2, /* UPB_TYPE_FLOAT */ - 2, /* UPB_TYPE_INT32 */ - 2, /* UPB_TYPE_UINT32 */ - 2, /* UPB_TYPE_ENUM */ - UPB_SIZE(2, 3), /* UPB_TYPE_MESSAGE */ - 3, /* UPB_TYPE_DOUBLE */ - 3, /* UPB_TYPE_INT64 */ - 3, /* UPB_TYPE_UINT64 */ - UPB_SIZE(3, 4), /* UPB_TYPE_STRING */ - UPB_SIZE(3, 4), /* UPB_TYPE_BYTES */ -}; - static const size_t overhead = sizeof(upb_msg_internal); static const upb_msg_internal *upb_msg_getinternal_const(const upb_msg *msg) { @@ -38,11 +23,6 @@ void _upb_msg_clear(upb_msg *msg, const upb_msglayout *l) { memset(mem, 0, upb_msg_sizeof(l)); } -static uintptr_t tag_arrptr(void* ptr, int elem_size_lg2) { - UPB_ASSERT(elem_size_lg2 <= 4); - return (uintptr_t)ptr | elem_size_lg2; -} - bool _upb_msg_addunknown(upb_msg *msg, const char *data, size_t len, upb_arena *arena) { @@ -87,20 +67,6 @@ const char *upb_msg_getunknown(const upb_msg *msg, size_t *len) { /** upb_array *****************************************************************/ -upb_array *_upb_array_new(upb_arena *a, upb_fieldtype_t type) { - upb_array *arr = upb_arena_malloc(a, sizeof(upb_array)); - - if (!arr) { - return NULL; - } - - arr->data = tag_arrptr(NULL, _upb_fieldtype_to_sizelg2[type]); - arr->len = 0; - arr->size = 0; - - return arr; -} - bool _upb_array_realloc(upb_array *arr, size_t min_size, upb_arena *arena) { size_t new_size = UPB_MAX(arr->size, 4); int elem_size_lg2 = arr->data & 7; @@ -118,16 +84,16 @@ bool _upb_array_realloc(upb_array *arr, size_t min_size, upb_arena *arena) { return false; } - arr->data = tag_arrptr(ptr, elem_size_lg2); + arr->data = _upb_tag_arrptr(ptr, elem_size_lg2); arr->size = new_size; return true; } -static upb_array *getorcreate_array(upb_array **arr_ptr, upb_fieldtype_t type, +static upb_array *getorcreate_array(upb_array **arr_ptr, int elem_size_lg2, upb_arena *arena) { upb_array *arr = *arr_ptr; if (!arr) { - arr = _upb_array_new(arena, type); + arr = _upb_array_new(arena, 4, elem_size_lg2); if (!arr) return NULL; *arr_ptr = arr; } @@ -135,22 +101,22 @@ static upb_array *getorcreate_array(upb_array **arr_ptr, upb_fieldtype_t type, } void *_upb_array_resize_fallback(upb_array **arr_ptr, size_t size, - upb_fieldtype_t type, upb_arena *arena) { - upb_array *arr = getorcreate_array(arr_ptr, type, arena); - return arr && _upb_array_resize(arr, size, arena) ? _upb_array_ptr(arr) : NULL; + int elem_size_lg2, upb_arena *arena) { + upb_array *arr = getorcreate_array(arr_ptr, elem_size_lg2, arena); + return arr && _upb_array_resize(arr, size, arena) ? _upb_array_ptr(arr) + : NULL; } bool _upb_array_append_fallback(upb_array **arr_ptr, const void *value, - upb_fieldtype_t type, upb_arena *arena) { - upb_array *arr = getorcreate_array(arr_ptr, type, arena); + int elem_size_lg2, upb_arena *arena) { + upb_array *arr = getorcreate_array(arr_ptr, elem_size_lg2, arena); size_t elem = arr->len; - int lg2 = _upb_fieldtype_to_sizelg2[type]; char *data; if (!arr || !_upb_array_resize(arr, elem + 1, arena)) return false; data = _upb_array_ptr(arr); - memcpy(data + (elem << lg2), value, 1 << lg2); + memcpy(data + (elem << elem_size_lg2), value, 1 << elem_size_lg2); return true; } diff --git a/upb/msg.h b/upb/msg.h index e06d3c7a5c..3f0f269945 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -199,17 +199,30 @@ UPB_INLINE void *_upb_array_ptr(upb_array *arr) { return (void*)_upb_array_constptr(arr); } -/* Creates a new array on the given arena. */ -upb_array *_upb_array_new(upb_arena *a, upb_fieldtype_t type); +UPB_INLINE uintptr_t _upb_tag_arrptr(void* ptr, int elem_size_lg2) { + UPB_ASSERT(elem_size_lg2 <= 4); + return (uintptr_t)ptr | (unsigned)elem_size_lg2; +} + +UPB_INLINE upb_array *_upb_array_new(upb_arena *a, size_t init_size, + int elem_size_lg2) { + const size_t bytes = sizeof(upb_array) + (init_size << elem_size_lg2); + upb_array *arr = (upb_array*)upb_arena_malloc(a, bytes); + if (!arr) return NULL; + arr->data = _upb_tag_arrptr(arr + 1, elem_size_lg2); + arr->len = 0; + arr->size = init_size; + return arr; +} /* Resizes the capacity of the array to be at least min_size. */ bool _upb_array_realloc(upb_array *arr, size_t min_size, upb_arena *arena); /* Fallback functions for when the accessors require a resize. */ void *_upb_array_resize_fallback(upb_array **arr_ptr, size_t size, - upb_fieldtype_t type, upb_arena *arena); + int elem_size_lg2, upb_arena *arena); bool _upb_array_append_fallback(upb_array **arr_ptr, const void *value, - upb_fieldtype_t type, upb_arena *arena); + int elem_size_lg2, upb_arena *arena); UPB_INLINE bool _upb_array_reserve(upb_array *arr, size_t size, upb_arena *arena) { @@ -249,28 +262,26 @@ UPB_INLINE void *_upb_array_mutable_accessor(void *msg, size_t ofs, } UPB_INLINE void *_upb_array_resize_accessor(void *msg, size_t ofs, size_t size, - upb_fieldtype_t type, + int elem_size_lg2, upb_arena *arena) { upb_array **arr_ptr = PTR_AT(msg, ofs, upb_array*); upb_array *arr = *arr_ptr; if (!arr || arr->size < size) { - return _upb_array_resize_fallback(arr_ptr, size, type, arena); + return _upb_array_resize_fallback(arr_ptr, size, elem_size_lg2, arena); } arr->len = size; return _upb_array_ptr(arr); } - UPB_INLINE bool _upb_array_append_accessor(void *msg, size_t ofs, - size_t elem_size, - upb_fieldtype_t type, + size_t elem_size, int elem_size_lg2, const void *value, upb_arena *arena) { upb_array **arr_ptr = PTR_AT(msg, ofs, upb_array*); upb_array *arr = *arr_ptr; void* ptr; if (!arr || arr->len == arr->size) { - return _upb_array_append_fallback(arr_ptr, value, type, arena); + return _upb_array_append_fallback(arr_ptr, value, elem_size_lg2, arena); } ptr = _upb_array_ptr(arr); memcpy(PTR_AT(ptr, arr->len * elem_size, char), value, elem_size); diff --git a/upb/reflection.c b/upb/reflection.c index 487241b2b5..db2589327a 100644 --- a/upb/reflection.c +++ b/upb/reflection.c @@ -48,6 +48,21 @@ static char _upb_fieldtype_to_mapsize[12] = { 0, /* UPB_TYPE_BYTES */ }; +static const char _upb_fieldtype_to_sizelg2[12] = { + 0, + 0, /* UPB_TYPE_BOOL */ + 2, /* UPB_TYPE_FLOAT */ + 2, /* UPB_TYPE_INT32 */ + 2, /* UPB_TYPE_UINT32 */ + 2, /* UPB_TYPE_ENUM */ + UPB_SIZE(2, 3), /* UPB_TYPE_MESSAGE */ + 3, /* UPB_TYPE_DOUBLE */ + 3, /* UPB_TYPE_INT64 */ + 3, /* UPB_TYPE_UINT64 */ + UPB_SIZE(3, 4), /* UPB_TYPE_STRING */ + UPB_SIZE(3, 4), /* UPB_TYPE_BYTES */ +}; + /** upb_msg *******************************************************************/ upb_msg *upb_msg_new(const upb_msgdef *m, upb_arena *a) { @@ -296,7 +311,7 @@ bool upb_msg_discardunknown(upb_msg *msg, const upb_msgdef *m, int maxdepth) { /** upb_array *****************************************************************/ upb_array *upb_array_new(upb_arena *a, upb_fieldtype_t type) { - return _upb_array_new(a, type); + return _upb_array_new(a, 4, _upb_fieldtype_to_sizelg2[type]); } size_t upb_array_size(const upb_array *arr) { diff --git a/upbc/generator.cc b/upbc/generator.cc index 72df0244aa..a463cb3566 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -231,28 +231,28 @@ std::string CTypeInternal(const protobuf::FieldDescriptor* field, } } -std::string UpbType(const protobuf::FieldDescriptor* field) { +std::string SizeLg2(const protobuf::FieldDescriptor* field) { switch (field->cpp_type()) { case protobuf::FieldDescriptor::CPPTYPE_MESSAGE: - return "UPB_TYPE_MESSAGE"; + return "UPB_SIZE(2, 3)"; case protobuf::FieldDescriptor::CPPTYPE_ENUM: - return "UPB_TYPE_ENUM"; + return std::to_string(2); case protobuf::FieldDescriptor::CPPTYPE_BOOL: - return "UPB_TYPE_BOOL"; + return std::to_string(1); case protobuf::FieldDescriptor::CPPTYPE_FLOAT: - return "UPB_TYPE_FLOAT"; + return std::to_string(2); case protobuf::FieldDescriptor::CPPTYPE_INT32: - return "UPB_TYPE_INT32"; + return std::to_string(2); case protobuf::FieldDescriptor::CPPTYPE_UINT32: - return "UPB_TYPE_UINT32"; + return std::to_string(2); case protobuf::FieldDescriptor::CPPTYPE_DOUBLE: - return "UPB_TYPE_DOUBLE"; + return std::to_string(3); case protobuf::FieldDescriptor::CPPTYPE_INT64: - return "UPB_TYPE_INT64"; + return std::to_string(3); case protobuf::FieldDescriptor::CPPTYPE_UINT64: - return "UPB_TYPE_UINT64"; + return std::to_string(3); case protobuf::FieldDescriptor::CPPTYPE_STRING: - return "UPB_TYPE_STRING"; + return "UPB_SIZE(3, 4)"; default: fprintf(stderr, "Unexpected type"); abort(); @@ -509,7 +509,7 @@ void GenerateMessageInHeader(const protobuf::Descriptor* message, Output& output "}\n", CType(field), msgname, field->name(), GetSizeInit(layout.GetFieldOffset(field)), - UpbType(field)); + SizeLg2(field)); if (field->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { output( "UPB_INLINE struct $0* $1_add_$2($1 *msg, upb_arena *arena) {\n" @@ -523,7 +523,7 @@ void GenerateMessageInHeader(const protobuf::Descriptor* message, Output& output MessageInit(field->message_type()), GetSizeInit(layout.GetFieldOffset(field)), GetSizeInit(MessageLayout::SizeOfUnwrapped(field).size), - UpbType(field)); + SizeLg2(field)); } else { output( "UPB_INLINE bool $1_add_$2($1 *msg, $0 val, upb_arena *arena) {\n" @@ -533,7 +533,7 @@ void GenerateMessageInHeader(const protobuf::Descriptor* message, Output& output CType(field), msgname, field->name(), GetSizeInit(layout.GetFieldOffset(field)), GetSizeInit(MessageLayout::SizeOfUnwrapped(field).size), - UpbType(field)); + SizeLg2(field)); } } else { // Non-repeated field. From b37f82b58bd3891ccc804488b432c8e48c319625 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 11 Oct 2020 20:31:05 -0700 Subject: [PATCH 36/88] Fixed compile error. --- upb/upb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/upb/upb.c b/upb/upb.c index 41f4463333..eb32ba2517 100644 --- a/upb/upb.c +++ b/upb/upb.c @@ -73,12 +73,12 @@ upb_alloc upb_alloc_global = {&upb_global_allocfunc}; /* Be conservative and choose 16 in case anyone is using SSE. */ -typedef struct mem_block { +struct mem_block { struct mem_block *next; uint32_t size; uint32_t cleanups; /* Data follows. */ -} mem_block; +}; typedef struct cleanup_ent { upb_cleanup_func *cleanup; From b393849bbd0af8cc83ea200143e121ef1de1137a Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 11 Oct 2020 21:18:09 -0700 Subject: [PATCH 37/88] Updated obsolete comment. --- upb/decode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upb/decode.c b/upb/decode.c index ce848140bb..32dda2f3c4 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -10,7 +10,7 @@ /* Must be last. */ #include "upb/port_def.inc" -/* Maps descriptor type -> upb field type. */ +/* Maps descriptor type -> elem_size_lg2. */ static const uint8_t desctype_to_elem_size_lg2[] = { -1, /* invalid descriptor type */ 3, /* DOUBLE */ From 4053805759dfc2c7ca8544e3ec328bb93b6bad35 Mon Sep 17 00:00:00 2001 From: Gerben Stavenga Date: Sun, 11 Oct 2020 21:56:23 -0700 Subject: [PATCH 38/88] Bugfixes --- upb/decode_fast.c | 77 ++++++++++++++++++----------------------------- upbc/generator.cc | 3 ++ 2 files changed, 33 insertions(+), 47 deletions(-) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 5a561b11ec..4af0d57b9c 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -87,9 +87,6 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, const size_t initial_len = 8; size_t need = (valbytes * initial_len) + sizeof(upb_array); if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < need)) { - *outarr = NULL; - *data = 0; - *end = NULL; return NULL; } arr = (void*)d->arena_ptr; @@ -262,40 +259,25 @@ const char *upb_pos_2bt(UPB_PARSE_PARAMS) { /* message fields *************************************************************/ -UPB_FORCEINLINE -bool fastdecode_boundscheck2(const char *ptr, unsigned len, const char *end) { - uintptr_t uptr = (uintptr_t)ptr; - uintptr_t uend = (uintptr_t)end; - uintptr_t res = uptr + len; - return res < uptr || res > uend; -} - UPB_NOINLINE static const char *fastdecode_lendelim_submsg(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits, const char* saved_limit) { - uint32_t len = (uint8_t)ptr[-1]; + size_t len = (uint8_t)ptr[-1]; if (UPB_UNLIKELY(len & 0x80)) { - ptr++; - uint32_t byte = (uint8_t)ptr[-1]; - len += (byte - 1) << 7; - if (UPB_UNLIKELY(byte & 0x80)) { + for (int i = 0; i < 3; i++) { ptr++; - uint32_t byte = (uint8_t)ptr[-1]; - len += (byte - 1) << 14; - if (UPB_UNLIKELY(byte & 0x80)) { - ptr++; - uint32_t byte = (uint8_t)ptr[-1]; - len += (byte - 1) << 21; - if (UPB_UNLIKELY(byte & 0x80)) { - ptr++; - uint32_t byte = (uint8_t)ptr[-1]; - len += (byte - 1) << 28; - if (UPB_UNLIKELY(byte >= 8)) return fastdecode_err(d); - } - } + size_t byte = (uint8_t)ptr[-1]; + len += (byte - 1) << (7 + 7 * i); + if (UPB_LIKELY((byte & 0x80) == 0)) goto done; } + ptr++; + size_t byte = (uint8_t)ptr[-1]; + // len is limited by 2gb not 4gb, hence 8 and not 16 as normally expected for a 32 bit varint. + if (UPB_UNLIKELY(byte >= 8)) return fastdecode_err(d); + len += (byte - 1) << 28; } - if (UPB_UNLIKELY(fastdecode_boundscheck2(ptr, len, saved_limit))) { +done: + if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, saved_limit))) { return fastdecode_err(d); } d->limit = ptr + len; @@ -318,11 +300,16 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, upb_array *arr; void *end; uint32_t submsg_idx = data; - submsg_idx >>= 16; asm("" : "+r" (submsg_idx)); + submsg_idx >>= 16; const upb_msglayout *subl = table->submsgs[submsg_idx]; submsg = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &arr, &end, sizeof(upb_msg *), card, true); + if (card == CARD_r) { + if (UPB_UNLIKELY(!submsg)) { + RETURN_GENERIC("need array resize\n"); + } + } if (card == CARD_s) { *(uint32_t*)msg |= hasbits >> 16; hasbits = 0; @@ -334,24 +321,20 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, again: if (card == CARD_r) { if (UPB_UNLIKELY(submsg == end)) { - if (UPB_LIKELY(arr != NULL)) { - size_t old_size = arr->size; - size_t old_bytes = old_size * sizeof(upb_msg*); - size_t new_size = old_size * 2; - size_t new_bytes = new_size * sizeof(upb_msg*); - char *old_ptr = _upb_array_ptr(arr); - if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < new_bytes)) { - goto repeated_generic; - } - memcpy(d->arena_ptr, old_ptr, old_bytes); - arr->size = new_size; - arr->data = _upb_array_tagptr(d->arena_ptr, 3); - submsg = (void*)(d->arena_ptr + (old_size * sizeof(upb_msg*))); - end = (void*)(d->arena_ptr + (new_size * sizeof(upb_msg*))); - d->arena_ptr += new_bytes; - } else { + size_t old_size = arr->size; + size_t old_bytes = old_size * sizeof(upb_msg*); + size_t new_size = old_size * 2; + size_t new_bytes = new_size * sizeof(upb_msg*); + char *old_ptr = _upb_array_ptr(arr); + if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < new_bytes)) { goto repeated_generic; } + memcpy(d->arena_ptr, old_ptr, old_bytes); + arr->size = new_size; + arr->data = _upb_array_tagptr(d->arena_ptr, 3); + submsg = (void*)(d->arena_ptr + (old_size * sizeof(upb_msg*))); + end = (void*)(d->arena_ptr + (new_size * sizeof(upb_msg*))); + d->arena_ptr += new_bytes; } } diff --git a/upbc/generator.cc b/upbc/generator.cc index 296b10f6c8..71dc7adcfa 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -795,6 +795,9 @@ void TryFillTableEntry(const protobuf::Descriptor* message, if (layout.HasHasbit(field)) { hasbit_index = layout.GetHasbitIndex(field); if (hasbit_index > 31) return; + // thas hasbits mask in the parser occupies bits 16-48 + // in the 64 bit register. + hasbit_index += 16; // account for the shifted hasbits } MessageLayout::Size data; From 3f719fa6b2ee842f4d97d9a5b903433235e05123 Mon Sep 17 00:00:00 2001 From: Gerben Stavenga Date: Mon, 12 Oct 2020 00:08:44 -0700 Subject: [PATCH 39/88] Bugfix: offsetting hasbits with 16 introduced a bug in calculating hasmasks. Removing extra <<16 shift in hasmask calculating and masking out the first 16 bits. This makes messages without hasbits work as well. --- upbc/generator.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/upbc/generator.cc b/upbc/generator.cc index 71dc7adcfa..52cfb30cf4 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -790,13 +790,13 @@ void TryFillTableEntry(const protobuf::Descriptor* message, uint16_t expected_tag = (num << 3) | wire_type; if (num > 15) expected_tag |= 0x100; MessageLayout::Size offset = layout.GetFieldOffset(field); - uint64_t hasbit_index = 0; + uint64_t hasbit_index = 0; // Zero means no hasbits. if (layout.HasHasbit(field)) { hasbit_index = layout.GetHasbitIndex(field); if (hasbit_index > 31) return; // thas hasbits mask in the parser occupies bits 16-48 - // in the 64 bit register. + // in the 64 bit register. hasbit_index += 16; // account for the shifted hasbits } @@ -811,9 +811,9 @@ void TryFillTableEntry(const protobuf::Descriptor* message, data.size32 |= idx << 16 | hasbit_index << 32; data.size64 |= idx << 16 | hasbit_index << 32; } else { - uint32_t hasbit_mask = 1U << hasbit_index; - data.size32 |= (uint64_t)hasbit_mask << 16; - data.size64 |= (uint64_t)hasbit_mask << 16; + uint64_t hasbit_mask = (1ull << hasbit_index) & -0x10000; + data.size32 |= (uint64_t)hasbit_mask; + data.size64 |= (uint64_t)hasbit_mask; } From 1abf7d418d55e8dff4495545559d7eac8bb20f93 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 12 Oct 2020 00:12:39 -0700 Subject: [PATCH 40/88] Added generated files. --- .../google/protobuf/descriptor.upb.c | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index 6489da2761..4b5c92c6b0 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -159,11 +159,11 @@ const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { UPB_SIZE(3377699720790034, 6755399441317906), UPB_SIZE(0, 0), UPB_SIZE(11258999068426274, 22517998136852514), - UPB_SIZE(12384898975268906, 24769797950537770), - UPB_SIZE(13510798882111538, 27021597764223026), - UPB_SIZE(14636698788954170, 29273397577908282), - UPB_SIZE(7881299348160578, 15762598696058946), - UPB_SIZE(9007199255068746, 18014398509809738), + UPB_SIZE(12384898975334442, 24769797950603306), + UPB_SIZE(13510798882373682, 27021597764485170), + UPB_SIZE(14636698789085242, 29273397578039354), + UPB_SIZE(7881385247440962, 15762684595339330), + UPB_SIZE(9007289449381962, 18014488704122954), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(5629499534737506, 11258999068950626), @@ -253,14 +253,14 @@ const upb_msglayout google_protobuf_DescriptorProto_msginit = { { UPB_SIZE(0, 0), UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(4503599627370514, 9007199254741010), + UPB_SIZE(4503599627632658, 9007199255003154), UPB_SIZE(5629499534213146, 11258999068426266), - UPB_SIZE(6755399441055778, 13510798882111522), - UPB_SIZE(7881299347898410, 15762598695796778), - UPB_SIZE(9007199254741042, 18014398509482034), - UPB_SIZE(3377699720659002, 6755399441186874), - UPB_SIZE(10133099161583682, 20266198323167298), - UPB_SIZE(11258999068426314, 22517998136852554), + UPB_SIZE(6755399441252386, 13510798882308130), + UPB_SIZE(7881299347963946, 15762598695862314), + UPB_SIZE(9007199255003186, 18014398509744178), + UPB_SIZE(3377777030266938, 6755476750794810), + UPB_SIZE(10133099161976898, 20266198323560514), + UPB_SIZE(11258999068557386, 22517998136983626), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -338,7 +338,7 @@ const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { UPB_SIZE(0, 0), UPB_SIZE(1125899906973704, 1125899906973704), UPB_SIZE(2251799813947408, 2251799813947408), - UPB_SIZE(3377699720724506, 4503599627567130), + UPB_SIZE(3377781324906522, 4503681231749146), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -596,7 +596,7 @@ const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { UPB_SIZE(4503599627632680, 4503599627632680), UPB_SIZE(14636698805731378, 20266198339944498), UPB_SIZE(16888498636193850, 24769797984092218), - UPB_SIZE(21392098230730818, 33776997205999682), + UPB_SIZE(21392214194126914, 33777113169395778), UPB_SIZE(7881299348947016, 7881299348947016), UPB_SIZE(19140298483433554, 29273397645017170), UPB_SIZE(0, 0), @@ -673,7 +673,7 @@ const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { { UPB_SIZE(0, 0), UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(3377699720658962, 6755399441186834), + UPB_SIZE(3377777029939218, 6755476750467090), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -761,8 +761,8 @@ const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { { UPB_SIZE(0, 0), UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(4503599627370514, 9007199254741010), - UPB_SIZE(3377699720658970, 6755399441186842), + UPB_SIZE(4503599627501586, 9007199254872082), + UPB_SIZE(3377777030004762, 6755476750532634), UPB_SIZE(5629499534213154, 11258999068426274), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -925,7 +925,7 @@ const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { UPB_SIZE(0, 0), UPB_SIZE(2251799813947402, 2251799813947402), UPB_SIZE(1125899906973712, 1125899906973712), - UPB_SIZE(4503599627567130, 6755399441252378), + UPB_SIZE(4503681231749146, 6755481045434394), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -1010,7 +1010,7 @@ const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { UPB_SIZE(0, 0), UPB_SIZE(1125899906973706, 2251799813816330), UPB_SIZE(4503599627370514, 9007199254741010), - UPB_SIZE(3377699720658970, 6755399441186842), + UPB_SIZE(3377777030004762, 6755476750532634), UPB_SIZE(0, 0), UPB_SIZE(0, 0), UPB_SIZE(0, 0), @@ -1098,7 +1098,7 @@ const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { UPB_SIZE(1125899907366922, 2251799814209546), UPB_SIZE(3377699721576466, 6755399442104338), UPB_SIZE(5629499536310298, 11258999070523418), - UPB_SIZE(7881299348291618, 15762598696189986), + UPB_SIZE(7881393837178914, 15762693185077282), UPB_SIZE(281474976841768, 281474976841768), UPB_SIZE(562949953683504, 562949953683504), UPB_SIZE(0, 0), From f2ddc15d765b87444faedd6e775dc27db4628d42 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 12 Oct 2020 09:31:39 -0700 Subject: [PATCH 41/88] Bugfix: initialize fastlimit and fastend. --- upb/decode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/upb/decode.c b/upb/decode.c index 3b00f91193..da6586cb65 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -648,6 +648,8 @@ bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, if (size == 0) return true; state.limit = buf + size; + state.fastlimit = state.limit - 16; + state.fastend = state.fastlimit; state.depth = 64; state.end_group = 0; state.arena.head = arena->head; From 1749082bbbeb76cb5de28fe721cb4fe0a8d94056 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 12 Oct 2020 10:56:13 -0700 Subject: [PATCH 42/88] Removed C99-ism. --- upb/decode_fast.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index fd87b1d83a..7b255fca67 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -157,7 +157,8 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, ptr += tagbytes + 1; val = (uint8_t)ptr[-1]; if (UPB_UNLIKELY(val & 0x80)) { - for (int i = 0; i < 8; i++) { + int i; + for (i = 0; i < 8; i++) { ptr++; uint64_t byte = (uint8_t)ptr[-1]; val += (byte - 1) << (7 + 7 * i); From f01efe8b647dd25b8a6b73755c3a94e2681c6b37 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 12 Oct 2020 11:07:22 -0700 Subject: [PATCH 43/88] Removed another C99-ism. --- upb/decode_fast.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 7b255fca67..cecafd485a 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -269,7 +269,8 @@ const char *fastdecode_lendelim_submsg(upb_decstate *d, const char *ptr, upb_msg const upb_msglayout *table, uint64_t hasbits, const char* saved_limit) { size_t len = (uint8_t)ptr[-1]; if (UPB_UNLIKELY(len & 0x80)) { - for (int i = 0; i < 3; i++) { + int i; + for (i = 0; i < 3; i++) { ptr++; size_t byte = (uint8_t)ptr[-1]; len += (byte - 1) << (7 + 7 * i); From 91eb09b1bc9341b2a25b39262aca30b45640fe0f Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 12 Oct 2020 18:44:31 -0700 Subject: [PATCH 44/88] Add a few comments. --- upb/decode.int.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/upb/decode.int.h b/upb/decode.int.h index 0bc1f148a0..7aa1eea454 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -9,8 +9,8 @@ typedef struct upb_decstate { const char *limit; /* End of delimited region or end of buffer. */ - const char *fastlimit; /* End of delimited region or end of buffer. */ - const char *fastend; + const char *fastend; /* The end of the entire buffer - 16 */ + const char *fastlimit; /* UPB_MIN(limit, fastend) */ upb_arena arena; int depth; uint32_t end_group; /* Set to field number of END_GROUP tag, if any. */ From a6dc88556d14b5e2991c19dc42b5448c2d90ed29 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 12 Oct 2020 20:42:18 -0700 Subject: [PATCH 45/88] Tables are compressed, but perf goes down to 2.44GB/s. --- BUILD | 1 + .../google/protobuf/descriptor.upb.c | 2129 +++-------------- upb/decode_fast.c | 10 +- upb/def.c | 12 +- upb/msg.h | 9 +- upbc/generator.cc | 26 +- 6 files changed, 328 insertions(+), 1859 deletions(-) diff --git a/BUILD b/BUILD index e1114a5fa6..5d66e34072 100644 --- a/BUILD +++ b/BUILD @@ -42,6 +42,7 @@ COPTS = CPPOPTS + [ # copybara:strip_for_google3_begin #"-pedantic", #"-Werror=pedantic", + "-std=gnu11", "-Wstrict-prototypes", # copybara:strip_end ] diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index 4b5c92c6b0..471d12d327 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -21,77 +21,14 @@ static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1] = }; const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { - { - &fastdecode_generic, - &upb_prm_1bt_max192b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(10, 10), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_FileDescriptorSet_submsgs[0], &google_protobuf_FileDescriptorSet__fields[0], + 8, UPB_SIZE(8, 8), 1, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prm_1bt_max192b, UPB_SIZE(10, 10)}, + }, }; static const upb_msglayout *const google_protobuf_FileDescriptorProto_submsgs[6] = { @@ -119,77 +56,28 @@ static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12] }; const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { - { - &fastdecode_generic, - &upb_pss_1bt, - &upb_pss_1bt, - &fastdecode_generic, - &upb_prm_1bt_max128b, - &upb_prm_1bt_max128b, - &upb_prm_1bt_max64b, - &upb_prm_1bt_max192b, - &upb_psm_1bt_max256b, - &upb_psm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(3377699720790034, 6755399441317906), - UPB_SIZE(0, 0), - UPB_SIZE(11258999068426274, 22517998136852514), - UPB_SIZE(12384898975334442, 24769797950603306), - UPB_SIZE(13510798882373682, 27021597764485170), - UPB_SIZE(14636698789085242, 29273397578039354), - UPB_SIZE(7881385247440962, 15762684595339330), - UPB_SIZE(9007289449381962, 18014488704122954), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(5629499534737506, 11258999068950626), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_FileDescriptorProto_submsgs[0], &google_protobuf_FileDescriptorProto__fields[0], + 120, UPB_SIZE(64, 128), 12, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, + {&upb_pss_1bt, UPB_SIZE(3377699720790034, 6755399441317906)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prm_1bt_max128b, UPB_SIZE(11258999068426274, 22517998136852514)}, + {&upb_prm_1bt_max128b, UPB_SIZE(12384898975334442, 24769797950603306)}, + {&upb_prm_1bt_max64b, UPB_SIZE(13510798882373682, 27021597764485170)}, + {&upb_prm_1bt_max192b, UPB_SIZE(14636698789085242, 29273397578039354)}, + {&upb_psm_1bt_max256b, UPB_SIZE(7881385247440962, 15762684595339330)}, + {&upb_psm_1bt_max64b, UPB_SIZE(9007289449381962, 18014488704122954)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(5629499534737506, 11258999068950626)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout *const google_protobuf_DescriptorProto_submsgs[7] = { @@ -216,77 +104,28 @@ static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10] = { }; const upb_msglayout google_protobuf_DescriptorProto_msginit = { - { - &fastdecode_generic, - &upb_pss_1bt, - &upb_prm_1bt_max192b, - &upb_prm_1bt_max128b, - &upb_prm_1bt_max128b, - &upb_prm_1bt_max64b, - &upb_prm_1bt_max192b, - &upb_psm_1bt_max64b, - &upb_prm_1bt_max64b, - &upb_prm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(4503599627632658, 9007199255003154), - UPB_SIZE(5629499534213146, 11258999068426266), - UPB_SIZE(6755399441252386, 13510798882308130), - UPB_SIZE(7881299347963946, 15762598695862314), - UPB_SIZE(9007199255003186, 18014398509744178), - UPB_SIZE(3377777030266938, 6755476750794810), - UPB_SIZE(10133099161976898, 20266198323560514), - UPB_SIZE(11258999068557386, 22517998136983626), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_DescriptorProto_submsgs[0], &google_protobuf_DescriptorProto__fields[0], + 120, UPB_SIZE(48, 96), 10, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, + {&upb_prm_1bt_max192b, UPB_SIZE(4503599627632658, 9007199255003154)}, + {&upb_prm_1bt_max128b, UPB_SIZE(5629499534213146, 11258999068426266)}, + {&upb_prm_1bt_max128b, UPB_SIZE(6755399441252386, 13510798882308130)}, + {&upb_prm_1bt_max64b, UPB_SIZE(7881299347963946, 15762598695862314)}, + {&upb_prm_1bt_max192b, UPB_SIZE(9007199255003186, 18014398509744178)}, + {&upb_psm_1bt_max64b, UPB_SIZE(3377777030266938, 6755476750794810)}, + {&upb_prm_1bt_max64b, UPB_SIZE(10133099161976898, 20266198323560514)}, + {&upb_prm_1bt_max64b, UPB_SIZE(11258999068557386, 22517998136983626)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout *const google_protobuf_DescriptorProto_ExtensionRange_submsgs[1] = { @@ -300,77 +139,16 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange_ }; const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { - { - &fastdecode_generic, - &upb_psv4_1bt, - &upb_psv4_1bt, - &upb_psm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973704, 1125899906973704), - UPB_SIZE(2251799813947408, 2251799813947408), - UPB_SIZE(3377781324906522, 4503681231749146), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0], &google_protobuf_DescriptorProto_ExtensionRange__fields[0], + 24, UPB_SIZE(16, 24), 3, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813947408, 2251799813947408)}, + {&upb_psm_1bt_max64b, UPB_SIZE(3377781324906522, 4503681231749146)}, + }, }; static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__fields[2] = { @@ -379,77 +157,16 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__ }; const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { - { - &fastdecode_generic, - &upb_psv4_1bt, - &upb_psv4_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973704, 1125899906973704), - UPB_SIZE(2251799813947408, 2251799813947408), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, NULL, &google_protobuf_DescriptorProto_ReservedRange__fields[0], + 24, UPB_SIZE(16, 16), 2, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813947408, 2251799813947408)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout *const google_protobuf_ExtensionRangeOptions_submsgs[1] = { @@ -461,77 +178,13 @@ static const upb_msglayout_field google_protobuf_ExtensionRangeOptions__fields[1 }; const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { - { - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_ExtensionRangeOptions_submsgs[0], &google_protobuf_ExtensionRangeOptions__fields[0], + 0, UPB_SIZE(8, 8), 1, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout *const google_protobuf_FieldDescriptorProto_submsgs[1] = { @@ -553,77 +206,44 @@ static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[11 }; const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { - { - &fastdecode_generic, - &upb_pss_1bt, - &upb_pss_1bt, - &upb_psv4_1bt, - &upb_psv4_1bt, - &upb_psv4_1bt, - &upb_pss_1bt, - &upb_pss_1bt, - &upb_psm_1bt_max64b, - &upb_psv4_1bt, - &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_2bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(10133099165777930, 11258999072620554), - UPB_SIZE(12384898983657490, 15762598704185362), - UPB_SIZE(6755399441580056, 6755399441580056), - UPB_SIZE(2251799813816352, 2251799813816352), - UPB_SIZE(4503599627632680, 4503599627632680), - UPB_SIZE(14636698805731378, 20266198339944498), - UPB_SIZE(16888498636193850, 24769797984092218), - UPB_SIZE(21392214194126914, 33777113169395778), - UPB_SIZE(7881299348947016, 7881299348947016), - UPB_SIZE(19140298483433554, 29273397645017170), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(9007199256838536, 9007199256838536), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_FieldDescriptorProto_submsgs[0], &google_protobuf_FieldDescriptorProto__fields[0], + 248, UPB_SIZE(80, 128), 11, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(10133099165777930, 11258999072620554)}, + {&upb_pss_1bt, UPB_SIZE(12384898983657490, 15762598704185362)}, + {&upb_psv4_1bt, UPB_SIZE(6755399441580056, 6755399441580056)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813816352, 2251799813816352)}, + {&upb_psv4_1bt, UPB_SIZE(4503599627632680, 4503599627632680)}, + {&upb_pss_1bt, UPB_SIZE(14636698805731378, 20266198339944498)}, + {&upb_pss_1bt, UPB_SIZE(16888498636193850, 24769797984092218)}, + {&upb_psm_1bt_max64b, UPB_SIZE(21392214194126914, 33777113169395778)}, + {&upb_psv4_1bt, UPB_SIZE(7881299348947016, 7881299348947016)}, + {&upb_pss_1bt, UPB_SIZE(19140298483433554, 29273397645017170)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_2bt, UPB_SIZE(9007199256838536, 9007199256838536)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout *const google_protobuf_OneofDescriptorProto_submsgs[1] = { @@ -636,77 +256,16 @@ static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2] }; const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { - { - &fastdecode_generic, - &upb_pss_1bt, - &upb_psm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(3377777029939218, 6755476750467090), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_OneofDescriptorProto_submsgs[0], &google_protobuf_OneofDescriptorProto__fields[0], + 24, UPB_SIZE(16, 32), 2, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, + {&upb_psm_1bt_max64b, UPB_SIZE(3377777029939218, 6755476750467090)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout *const google_protobuf_EnumDescriptorProto_submsgs[3] = { @@ -724,77 +283,20 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5] }; const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { - { - &fastdecode_generic, - &upb_pss_1bt, - &upb_prm_1bt_max64b, - &upb_psm_1bt_max64b, - &upb_prm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(4503599627501586, 9007199254872082), - UPB_SIZE(3377777030004762, 6755476750532634), - UPB_SIZE(5629499534213154, 11258999068426274), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_EnumDescriptorProto_submsgs[0], &google_protobuf_EnumDescriptorProto__fields[0], + 56, UPB_SIZE(32, 64), 5, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, + {&upb_prm_1bt_max64b, UPB_SIZE(4503599627501586, 9007199254872082)}, + {&upb_psm_1bt_max64b, UPB_SIZE(3377777030004762, 6755476750532634)}, + {&upb_prm_1bt_max64b, UPB_SIZE(5629499534213154, 11258999068426274)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[2] = { @@ -803,77 +305,16 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReserve }; const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { - { - &fastdecode_generic, - &upb_psv4_1bt, - &upb_psv4_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973704, 1125899906973704), - UPB_SIZE(2251799813947408, 2251799813947408), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, NULL, &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0], + 24, UPB_SIZE(16, 16), 2, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813947408, 2251799813947408)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout *const google_protobuf_EnumValueDescriptorProto_submsgs[1] = { @@ -887,77 +328,16 @@ static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__field }; const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { - { - &fastdecode_generic, - &upb_pss_1bt, - &upb_psv4_1bt, - &upb_psm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(2251799813947402, 2251799813947402), - UPB_SIZE(1125899906973712, 1125899906973712), - UPB_SIZE(4503681231749146, 6755481045434394), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_EnumValueDescriptorProto_submsgs[0], &google_protobuf_EnumValueDescriptorProto__fields[0], + 24, UPB_SIZE(24, 32), 3, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(2251799813947402, 2251799813947402)}, + {&upb_psv4_1bt, UPB_SIZE(1125899906973712, 1125899906973712)}, + {&upb_psm_1bt_max64b, UPB_SIZE(4503681231749146, 6755481045434394)}, + }, }; static const upb_msglayout *const google_protobuf_ServiceDescriptorProto_submsgs[2] = { @@ -972,77 +352,16 @@ static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[ }; const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { - { - &fastdecode_generic, - &upb_pss_1bt, - &upb_prm_1bt_max128b, - &upb_psm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(4503599627370514, 9007199254741010), - UPB_SIZE(3377777030004762, 6755476750532634), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_ServiceDescriptorProto_submsgs[0], &google_protobuf_ServiceDescriptorProto__fields[0], + 24, UPB_SIZE(24, 48), 3, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, + {&upb_prm_1bt_max128b, UPB_SIZE(4503599627370514, 9007199254741010)}, + {&upb_psm_1bt_max64b, UPB_SIZE(3377777030004762, 6755476750532634)}, + }, }; static const upb_msglayout *const google_protobuf_MethodDescriptorProto_submsgs[1] = { @@ -1059,77 +378,20 @@ static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6 }; const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { - { - &fastdecode_generic, - &upb_pss_1bt, - &upb_pss_1bt, - &upb_pss_1bt, - &upb_psm_1bt_max64b, - &upb_psb1_1bt, - &upb_psb1_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899907366922, 2251799814209546), - UPB_SIZE(3377699721576466, 6755399442104338), - UPB_SIZE(5629499536310298, 11258999070523418), - UPB_SIZE(7881393837178914, 15762693185077282), - UPB_SIZE(281474976841768, 281474976841768), - UPB_SIZE(562949953683504, 562949953683504), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_MethodDescriptorProto_submsgs[0], &google_protobuf_MethodDescriptorProto__fields[0], + 56, UPB_SIZE(32, 64), 6, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899907366922, 2251799814209546)}, + {&upb_pss_1bt, UPB_SIZE(3377699721576466, 6755399442104338)}, + {&upb_pss_1bt, UPB_SIZE(5629499536310298, 11258999070523418)}, + {&upb_psm_1bt_max64b, UPB_SIZE(7881393837178914, 15762693185077282)}, + {&upb_psb1_1bt, UPB_SIZE(281474976841768, 281474976841768)}, + {&upb_psb1_1bt, UPB_SIZE(562949953683504, 562949953683504)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout *const google_protobuf_FileOptions_submsgs[1] = { @@ -1161,77 +423,44 @@ static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { }; const upb_msglayout google_protobuf_FileOptions_msginit = { - { - &fastdecode_generic, - &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_pss_1bt, - &upb_psv4_1bt, - &upb_psb1_1bt, - &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_2bt, - &upb_psb1_2bt, - &upb_psb1_2bt, - &fastdecode_generic, - &upb_psb1_2bt, - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_2bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_2bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_2bt, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(7881299482116106, 9007199388958730), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(10133099430019138, 13510799150547010), - UPB_SIZE(2251799813816392, 2251799813816392), - UPB_SIZE(4503599627632720, 4503599627632720), - UPB_SIZE(12384899512139866, 18014399046352986), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(4785074604605824, 4785074604605824), - UPB_SIZE(5066549581840776, 5066549581840776), - UPB_SIZE(5348024559600016, 5348024559600016), - UPB_SIZE(0, 0), - UPB_SIZE(5629499538407840, 5629499538407840), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(5910974519312824, 5910974519312824), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(6192449504412120, 6192449504412120), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(6473924497900024, 6473924497900024), - }, &google_protobuf_FileOptions_submsgs[0], &google_protobuf_FileOptions__fields[0], + 248, UPB_SIZE(112, 208), 21, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(7881299482116106, 9007199388958730)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(10133099430019138, 13510799150547010)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813816392, 2251799813816392)}, + {&upb_psb1_1bt, UPB_SIZE(4503599627632720, 4503599627632720)}, + {&upb_pss_1bt, UPB_SIZE(12384899512139866, 18014399046352986)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_2bt, UPB_SIZE(4785074604605824, 4785074604605824)}, + {&upb_psb1_2bt, UPB_SIZE(5066549581840776, 5066549581840776)}, + {&upb_psb1_2bt, UPB_SIZE(5348024559600016, 5348024559600016)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_2bt, UPB_SIZE(5629499538407840, 5629499538407840)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_2bt, UPB_SIZE(5910974519312824, 5910974519312824)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_2bt, UPB_SIZE(6192449504412120, 6192449504412120)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_2bt, UPB_SIZE(6473924497900024, 6473924497900024)}, + }, }; static const upb_msglayout *const google_protobuf_MessageOptions_submsgs[1] = { @@ -1247,77 +476,20 @@ static const upb_msglayout_field google_protobuf_MessageOptions__fields[5] = { }; const upb_msglayout google_protobuf_MessageOptions_msginit = { - { - &fastdecode_generic, - &upb_psb1_1bt, - &upb_psb1_1bt, - &upb_psb1_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(281474976841736, 281474976841736), - UPB_SIZE(562949953683472, 562949953683472), - UPB_SIZE(844424930656280, 844424930656280), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(1125899907891256, 1125899907891256), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_MessageOptions_submsgs[0], &google_protobuf_MessageOptions__fields[0], + 56, UPB_SIZE(16, 16), 5, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_1bt, UPB_SIZE(281474976841736, 281474976841736)}, + {&upb_psb1_1bt, UPB_SIZE(562949953683472, 562949953683472)}, + {&upb_psb1_1bt, UPB_SIZE(844424930656280, 844424930656280)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_1bt, UPB_SIZE(1125899907891256, 1125899907891256)}, + }, }; static const upb_msglayout *const google_protobuf_FieldOptions_submsgs[1] = { @@ -1335,77 +507,28 @@ static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = { }; const upb_msglayout google_protobuf_FieldOptions_msginit = { - { - &fastdecode_generic, - &upb_psv4_1bt, - &upb_psb1_1bt, - &upb_psb1_1bt, - &fastdecode_generic, - &upb_psb1_1bt, - &upb_psv4_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(2251799813816328, 2251799813816328), - UPB_SIZE(6755399441580048, 6755399441580048), - UPB_SIZE(7036874418815000, 7036874418815000), - UPB_SIZE(0, 0), - UPB_SIZE(7318349396574248, 7318349396574248), - UPB_SIZE(4503599627632688, 4503599627632688), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(7599824375382096, 7599824375382096), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_FieldOptions_submsgs[0], &google_protobuf_FieldOptions__fields[0], + 120, UPB_SIZE(32, 40), 7, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813816328, 2251799813816328)}, + {&upb_psb1_1bt, UPB_SIZE(6755399441580048, 6755399441580048)}, + {&upb_psb1_1bt, UPB_SIZE(7036874418815000, 7036874418815000)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_1bt, UPB_SIZE(7318349396574248, 7318349396574248)}, + {&upb_psv4_1bt, UPB_SIZE(4503599627632688, 4503599627632688)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_1bt, UPB_SIZE(7599824375382096, 7599824375382096)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout *const google_protobuf_OneofOptions_submsgs[1] = { @@ -1417,77 +540,13 @@ static const upb_msglayout_field google_protobuf_OneofOptions__fields[1] = { }; const upb_msglayout google_protobuf_OneofOptions_msginit = { - { - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_OneofOptions_submsgs[0], &google_protobuf_OneofOptions__fields[0], + 0, UPB_SIZE(8, 8), 1, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout *const google_protobuf_EnumOptions_submsgs[1] = { @@ -1501,77 +560,16 @@ static const upb_msglayout_field google_protobuf_EnumOptions__fields[3] = { }; const upb_msglayout google_protobuf_EnumOptions_msginit = { - { - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_1bt, - &upb_psb1_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(281474976841744, 281474976841744), - UPB_SIZE(562949953683480, 562949953683480), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_EnumOptions_submsgs[0], &google_protobuf_EnumOptions__fields[0], + 24, UPB_SIZE(8, 16), 3, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_1bt, UPB_SIZE(281474976841744, 281474976841744)}, + {&upb_psb1_1bt, UPB_SIZE(562949953683480, 562949953683480)}, + }, }; static const upb_msglayout *const google_protobuf_EnumValueOptions_submsgs[1] = { @@ -1584,77 +582,14 @@ static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2] = { }; const upb_msglayout google_protobuf_EnumValueOptions_msginit = { - { - &fastdecode_generic, - &upb_psb1_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(281474976841736, 281474976841736), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_EnumValueOptions_submsgs[0], &google_protobuf_EnumValueOptions__fields[0], + 8, UPB_SIZE(8, 16), 2, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_1bt, UPB_SIZE(281474976841736, 281474976841736)}, + }, }; static const upb_msglayout *const google_protobuf_ServiceOptions_submsgs[1] = { @@ -1667,77 +602,13 @@ static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2] = { }; const upb_msglayout google_protobuf_ServiceOptions_msginit = { - { - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_ServiceOptions_submsgs[0], &google_protobuf_ServiceOptions__fields[0], + 0, UPB_SIZE(8, 16), 2, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout *const google_protobuf_MethodOptions_submsgs[1] = { @@ -1751,77 +622,13 @@ static const upb_msglayout_field google_protobuf_MethodOptions__fields[3] = { }; const upb_msglayout google_protobuf_MethodOptions_msginit = { - { - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_MethodOptions_submsgs[0], &google_protobuf_MethodOptions__fields[0], + 0, UPB_SIZE(24, 32), 3, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout *const google_protobuf_UninterpretedOption_submsgs[1] = { @@ -1839,77 +646,28 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption__fields[7] }; const upb_msglayout google_protobuf_UninterpretedOption_msginit = { - { - &fastdecode_generic, - &fastdecode_generic, - &upb_prm_1bt_max64b, - &upb_pss_1bt, - &upb_psv8_1bt, - &upb_psv8_1bt, - &fastdecode_generic, - &upb_pss_1bt, - &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(15762598695796754, 22517998136852498), - UPB_SIZE(9007199255789594, 9007199255789594), - UPB_SIZE(2251799813816352, 2251799813816352), - UPB_SIZE(4503599627632680, 4503599627632680), - UPB_SIZE(0, 0), - UPB_SIZE(11258999070523450, 13510798884208698), - UPB_SIZE(13510798886305858, 18014398513676354), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_UninterpretedOption_submsgs[0], &google_protobuf_UninterpretedOption__fields[0], + 120, UPB_SIZE(64, 96), 7, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prm_1bt_max64b, UPB_SIZE(15762598695796754, 22517998136852498)}, + {&upb_pss_1bt, UPB_SIZE(9007199255789594, 9007199255789594)}, + {&upb_psv8_1bt, UPB_SIZE(2251799813816352, 2251799813816352)}, + {&upb_psv8_1bt, UPB_SIZE(4503599627632680, 4503599627632680)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(11258999070523450, 13510798884208698)}, + {&upb_pss_1bt, UPB_SIZE(13510798886305858, 18014398513676354)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__fields[2] = { @@ -1918,77 +676,16 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__f }; const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { - { - &fastdecode_generic, - &upb_pss_1bt, - &upb_psb1_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899907104778, 2251799813947402), - UPB_SIZE(281474976841744, 281474976841744), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, NULL, &google_protobuf_UninterpretedOption_NamePart__fields[0], + 24, UPB_SIZE(16, 32), 2, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899907104778, 2251799813947402)}, + {&upb_psb1_1bt, UPB_SIZE(281474976841744, 281474976841744)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout *const google_protobuf_SourceCodeInfo_submsgs[1] = { @@ -2000,77 +697,14 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1] = { }; const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { - { - &fastdecode_generic, - &upb_prm_1bt_max128b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(10, 10), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_SourceCodeInfo_submsgs[0], &google_protobuf_SourceCodeInfo__fields[0], + 8, UPB_SIZE(8, 8), 1, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prm_1bt_max128b, UPB_SIZE(10, 10)}, + }, }; static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields[5] = { @@ -2082,77 +716,20 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields }; const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { - { - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_pss_1bt, - &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973722, 2251799813816346), - UPB_SIZE(3377699720790050, 6755399441317922), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, NULL, &google_protobuf_SourceCodeInfo_Location__fields[0], + 56, UPB_SIZE(32, 64), 5, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899906973722, 2251799813816346)}, + {&upb_pss_1bt, UPB_SIZE(3377699720790050, 6755399441317922)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; static const upb_msglayout *const google_protobuf_GeneratedCodeInfo_submsgs[1] = { @@ -2164,77 +741,14 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1] = }; const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { - { - &fastdecode_generic, - &upb_prm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(10, 10), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, &google_protobuf_GeneratedCodeInfo_submsgs[0], &google_protobuf_GeneratedCodeInfo__fields[0], + 8, UPB_SIZE(8, 8), 1, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prm_1bt_max64b, UPB_SIZE(10, 10)}, + }, }; static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__fields[4] = { @@ -2245,77 +759,20 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__f }; const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { - { - &fastdecode_generic, - &fastdecode_generic, - &upb_pss_1bt, - &upb_psv4_1bt, - &upb_psv4_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(3377699721052178, 4503599627894802), - UPB_SIZE(1125899906973720, 1125899906973720), - UPB_SIZE(2251799813947424, 2251799813947424), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - }, NULL, &google_protobuf_GeneratedCodeInfo_Annotation__fields[0], + 56, UPB_SIZE(24, 48), 4, false, + { + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(3377699721052178, 4503599627894802)}, + {&upb_psv4_1bt, UPB_SIZE(1125899906973720, 1125899906973720)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813947424, 2251799813947424)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, }; #include "upb/port_undef.inc" diff --git a/upb/decode_fast.c b/upb/decode_fast.c index e12b32a515..7db98eafec 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -28,9 +28,11 @@ const char *fastdecode_tag_dispatch(upb_decstate *d, const char *ptr, upb_msg *m const upb_msglayout *table, uint64_t hasbits, uint32_t tag) { uint64_t data; size_t idx; - idx = (tag & 0xf8) >> 3; - data = table->field_data[idx] ^ tag; - return table->field_parser[idx](UPB_PARSE_ARGS); + idx = (tag & table->table_mask); + __builtin_assume((idx & 7) == 0); + idx >>= 3; + data = table->fasttable[idx].field_data ^ tag; + return table->fasttable[idx].field_parser(UPB_PARSE_ARGS); } UPB_FORCEINLINE @@ -40,7 +42,7 @@ uint32_t fastdecode_load_tag(const char* ptr) { return tag; } -UPB_FORCEINLINE +UPB_NOINLINE const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits) { if (UPB_UNLIKELY(ptr >= d->fastlimit)) { diff --git a/upb/def.c b/upb/def.c index 65c9e02d1a..5b5f9e4d04 100644 --- a/upb/def.c +++ b/upb/def.c @@ -940,9 +940,8 @@ static bool make_layout(const upb_symtab *symtab, const upb_msgdef *m) { const upb_msglayout **submsgs; upb_msglayout_field *fields; upb_alloc *alloc = upb_arena_alloc(symtab->arena); - size_t i; - memset(l, 0, sizeof(*l)); + memset(l, 0, sizeof(*l) + sizeof(_upb_fasttable_entry)); fields = upb_malloc(alloc, upb_msgdef_numfields(m) * sizeof(*fields)); submsgs = upb_malloc(alloc, submsg_count * sizeof(*submsgs)); @@ -956,10 +955,10 @@ static bool make_layout(const upb_symtab *symtab, const upb_msgdef *m) { l->field_count = upb_msgdef_numfields(m); l->fields = fields; l->submsgs = submsgs; + l->table_mask = 0; - for (i = 0; i < 32; i++) { - l->field_parser[i] = &fastdecode_generic; - } + l->fasttable[0].field_parser = &fastdecode_generic; + l->fasttable[0].field_data = 0; if (upb_msgdef_mapentry(m)) { /* TODO(haberman): refactor this method so this special case is more @@ -1722,7 +1721,8 @@ static bool create_msgdef(symtab_addctx *ctx, const char *prefix, ctx->layouts++; } else { /* Allocate now (to allow cross-linking), populate later. */ - m->layout = upb_malloc(ctx->alloc, sizeof(*m->layout)); + m->layout = upb_malloc(ctx->alloc, + sizeof(*m->layout) + sizeof(_upb_fasttable_entry)); } oneofs = google_protobuf_DescriptorProto_oneof_decl(msg_proto, &n); diff --git a/upb/msg.h b/upb/msg.h index 1bc934204a..55f523e98a 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -54,16 +54,21 @@ typedef const char *_upb_field_parser(struct upb_decstate *d, const char *ptr, const struct upb_msglayout *table, uint64_t hasbits, uint64_t data); +typedef struct { + _upb_field_parser *field_parser; + uint64_t field_data; +} _upb_fasttable_entry; + typedef struct upb_msglayout { - _upb_field_parser *field_parser[32]; - uint64_t field_data[32]; const struct upb_msglayout *const* submsgs; const upb_msglayout_field *fields; + uint32_t table_mask; /* Must be aligned to sizeof(void*). Doesn't include internal members like * unknown fields, extension dict, pointer to msglayout, etc. */ uint16_t size; uint16_t field_count; bool extendable; + _upb_fasttable_entry fasttable[]; } upb_msglayout; /** upb_msg *******************************************************************/ diff --git a/upbc/generator.cc b/upbc/generator.cc index 1409ee3c79..0bd474cd41 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -857,11 +857,19 @@ void TryFillTableEntry(const protobuf::Descriptor* message, std::vector FastDecodeTable(const protobuf::Descriptor* message, const MessageLayout& layout) { + int table_size = 1; + for (int i = 0; i < message->field_count(); i++) { + int num = message->field(i)->number(); + while (num >= table_size && num < 32) { + table_size *= 2; + } + } + std::vector table; MessageLayout::Size empty_size; empty_size.size32 = 0; empty_size.size64 = 0; - for (int i = 0; i < 32; i++) { + for (int i = 0; i < table_size; i++) { table.emplace_back(TableEntry{"fastdecode_generic", empty_size}); TryFillTableEntry(message, layout, i, table.back()); } @@ -963,22 +971,18 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output) { std::vector table = FastDecodeTable(message, layout); output("const upb_msglayout $0 = {\n", MessageInit(message)); - output(" {\n"); - for (const auto& ent : table) { - output(" &$0,\n", ent.first); - } - output(" },\n"); - output(" {\n"); - for (const auto& ent : table) { - output(" $0,\n", GetSizeInit(ent.second)); - } - output(" },\n"); output(" $0,\n", submsgs_array_ref); output(" $0,\n", fields_array_ref); + output(" $0,\n", (table.size() - 1) << 3); output(" $0, $1, $2,\n", GetSizeInit(layout.message_size()), field_number_order.size(), "false" // TODO: extendable ); + output(" {\n"); + for (const auto& ent : table) { + output(" {&$0, $1},\n", ent.first, GetSizeInit(ent.second)); + } + output(" },\n"); output("};\n\n"); } From 8ed6b2fe854bdeacddd242f2246483d4c264eb31 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 13 Oct 2020 09:25:25 -0700 Subject: [PATCH 46/88] Stored mask in the table pointer. --- upb/decode.c | 7 ++++--- upb/decode.int.h | 2 +- upb/decode_fast.c | 34 +++++++++++++++++++--------------- upb/decode_fast.h | 10 +++++----- upb/msg.h | 5 ++--- 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/upb/decode.c b/upb/decode.c index da6586cb65..11a30faa38 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -613,13 +613,13 @@ static decode_parseret decode_field(upb_decstate *d, const char *ptr, UPB_NOINLINE const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, - const upb_msglayout *table, uint64_t hasbits, + intptr_t table, uint64_t hasbits, uint64_t data) { decode_parseret ret; *(uint32_t*)msg |= hasbits >> 16; /* Sync hasbits. */ (void)data; if (ptr == d->limit) return ptr; - ret = decode_field(d, ptr, msg, table); + ret = decode_field(d, ptr, msg, (const upb_msglayout *)(table >> 8)); if (ret.group_end) return ptr; return fastdecode_dispatch(d, ret.ptr, msg, table, hasbits); } @@ -628,7 +628,8 @@ UPB_NOINLINE static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *layout) { if (msg) { - ptr = fastdecode_dispatch(d, ptr, msg, layout, 0); + ptr = fastdecode_dispatch(d, ptr, msg, + ((intptr_t)layout << 8) | layout->table_mask, 0); } else { while (ptr < d->limit) { decode_parseret ret = decode_field(d, ptr, msg, layout); diff --git a/upb/decode.int.h b/upb/decode.int.h index 7aa1eea454..c8f75c73f9 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -18,7 +18,7 @@ typedef struct upb_decstate { } upb_decstate; const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, - const upb_msglayout *table, uint64_t hasbits); + intptr_t table, uint64_t hasbits); const char *fastdecode_err(upb_decstate *d); diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 7db98eafec..37361679fd 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -7,8 +7,8 @@ /* Must be last. */ #include "upb/port_def.inc" -#define UPB_PARSE_PARAMS \ - upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, \ +#define UPB_PARSE_PARAMS \ + upb_decstate *d, const char *ptr, upb_msg *msg, intptr_t table, \ uint64_t hasbits, uint64_t data #define UPB_PARSE_ARGS d, ptr, msg, table, hasbits, data @@ -24,15 +24,17 @@ typedef enum { } upb_card; UPB_FORCEINLINE -const char *fastdecode_tag_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, - const upb_msglayout *table, uint64_t hasbits, uint32_t tag) { +const char *fastdecode_tag_dispatch(upb_decstate *d, const char *ptr, + upb_msg *msg, intptr_t table, + uint64_t hasbits, uint32_t tag) { + const upb_msglayout *table_p = (void*)(table >> 8); + uint8_t mask = table; uint64_t data; - size_t idx; - idx = (tag & table->table_mask); + size_t idx = tag & mask; __builtin_assume((idx & 7) == 0); idx >>= 3; - data = table->fasttable[idx].field_data ^ tag; - return table->fasttable[idx].field_parser(UPB_PARSE_ARGS); + data = table_p->fasttable[idx].field_data ^ tag; + return table_p->fasttable[idx].field_parser(UPB_PARSE_ARGS); } UPB_FORCEINLINE @@ -42,9 +44,9 @@ uint32_t fastdecode_load_tag(const char* ptr) { return tag; } -UPB_NOINLINE +UPB_FORCEINLINE const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, - const upb_msglayout *table, uint64_t hasbits) { + intptr_t table, uint64_t hasbits) { if (UPB_UNLIKELY(ptr >= d->fastlimit)) { if (UPB_LIKELY(ptr == d->limit)) { *(uint32_t*)msg |= hasbits >> 16; /* Sync hasbits. */ @@ -265,9 +267,9 @@ const char *upb_pos_2bt(UPB_PARSE_PARAMS) { /* message fields *************************************************************/ -UPB_NOINLINE static -const char *fastdecode_lendelim_submsg(upb_decstate *d, const char *ptr, upb_msg *msg, - const upb_msglayout *table, uint64_t hasbits, const char* saved_limit) { +UPB_NOINLINE static const char *fastdecode_lendelim_submsg( + upb_decstate *d, const char *ptr, upb_msg *msg, intptr_t table, + uint64_t hasbits, const char *saved_limit) { size_t len = (uint8_t)ptr[-1]; if (UPB_UNLIKELY(len & 0x80)) { int i; @@ -308,7 +310,9 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, void *end; uint32_t submsg_idx = data; submsg_idx >>= 16; - const upb_msglayout *subl = table->submsgs[submsg_idx]; + const upb_msglayout *table_p = (void*)(table >> 8); + const upb_msglayout *subl = table_p->submsgs[submsg_idx]; + intptr_t subt = (intptr_t)subl << 8 | subl->table_mask; submsg = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &arr, &end, sizeof(upb_msg *), card, true); @@ -344,7 +348,7 @@ again: ptr += tagbytes + 1; - ptr = fastdecode_lendelim_submsg(d, ptr, child, subl, 0, saved_limit); + ptr = fastdecode_lendelim_submsg(d, ptr, child, subt, 0, saved_limit); if (UPB_UNLIKELY(ptr != d->limit || d->end_group != 0)) { return fastdecode_err(d); diff --git a/upb/decode_fast.h b/upb/decode_fast.h index 47ca1bc4ba..104ef77aef 100644 --- a/upb/decode_fast.h +++ b/upb/decode_fast.h @@ -7,12 +7,12 @@ struct upb_decstate; const char *fastdecode_generic(struct upb_decstate *d, const char *ptr, - upb_msg *msg, const upb_msglayout *table, - uint64_t hasbits, uint64_t data); + upb_msg *msg, intptr_t table, uint64_t hasbits, + uint64_t data); -#define UPB_PARSE_PARAMS \ - struct upb_decstate *d, const char *ptr, upb_msg *msg, \ - const upb_msglayout *table, uint64_t hasbits, uint64_t data +#define UPB_PARSE_PARAMS \ + struct upb_decstate *d, const char *ptr, upb_msg *msg, intptr_t table, \ + uint64_t hasbits, uint64_t data #define F(card, type, valbytes, tagbytes) \ const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS); diff --git a/upb/msg.h b/upb/msg.h index 55f523e98a..a6ae8aea9c 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -50,8 +50,7 @@ struct upb_msglayout; struct upb_decstate; typedef const char *_upb_field_parser(struct upb_decstate *d, const char *ptr, - upb_msg *msg, - const struct upb_msglayout *table, + upb_msg *msg, intptr_t table, uint64_t hasbits, uint64_t data); typedef struct { @@ -62,7 +61,7 @@ typedef struct { typedef struct upb_msglayout { const struct upb_msglayout *const* submsgs; const upb_msglayout_field *fields; - uint32_t table_mask; + uint8_t table_mask; /* Must be aligned to sizeof(void*). Doesn't include internal members like * unknown fields, extension dict, pointer to msglayout, etc. */ uint16_t size; From b95f2179967a7cc54e9a13abfa04822ac095d0c3 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 13 Oct 2020 09:31:50 -0700 Subject: [PATCH 47/88] A little speed boost, now hitting 2.51GB/s. --- upb/decode.int.h | 4 +--- upb/decode_fast.c | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/upb/decode.int.h b/upb/decode.int.h index c8f75c73f9..f35066a47a 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -23,9 +23,7 @@ const char *fastdecode_err(upb_decstate *d); UPB_INLINE -upb_msg *decode_newmsg_ceil(upb_decstate *d, const upb_msglayout *l, - int msg_ceil_bytes) { - size_t size = l->size + sizeof(upb_msg_internal); +upb_msg *decode_newmsg_ceil(upb_decstate *d, size_t size, int msg_ceil_bytes) { char *msg_data; if (UPB_LIKELY(msg_ceil_bytes > 0 && _upb_arenahas(&d->arena, msg_ceil_bytes))) { UPB_ASSERT(size <= (size_t)msg_ceil_bytes); diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 37361679fd..4d133b2531 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -313,6 +313,7 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, const upb_msglayout *table_p = (void*)(table >> 8); const upb_msglayout *subl = table_p->submsgs[submsg_idx]; intptr_t subt = (intptr_t)subl << 8 | subl->table_mask; + size_t submsg_size = subl->size + sizeof(upb_msg_internal); submsg = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &arr, &end, sizeof(upb_msg *), card, true); @@ -343,7 +344,7 @@ again: upb_msg* child = *submsg; if (card == CARD_r || UPB_LIKELY(!child)) { - *submsg = child = decode_newmsg_ceil(d, subl, msg_ceil_bytes); + *submsg = child = decode_newmsg_ceil(d, submsg_size, msg_ceil_bytes); } ptr += tagbytes + 1; From bca7edac8c62919bd8ba31436a4cebe15ef64e47 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 13 Oct 2020 10:01:17 -0700 Subject: [PATCH 48/88] Cleaned up table compression a bit. --- .../google/protobuf/descriptor.upb.c | 81 +++++++------------ upb/decode.c | 5 +- upb/decode.int.h | 9 +++ upb/decode_fast.c | 6 +- upb/msg.h | 2 +- upbc/generator.cc | 6 +- 6 files changed, 45 insertions(+), 64 deletions(-) diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index 471d12d327..3690b28bc8 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -23,8 +23,7 @@ static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1] = const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { &google_protobuf_FileDescriptorSet_submsgs[0], &google_protobuf_FileDescriptorSet__fields[0], - 8, - UPB_SIZE(8, 8), 1, false, + UPB_SIZE(8, 8), 1, false, 8, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_prm_1bt_max192b, UPB_SIZE(10, 10)}, @@ -58,8 +57,7 @@ static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12] const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { &google_protobuf_FileDescriptorProto_submsgs[0], &google_protobuf_FileDescriptorProto__fields[0], - 120, - UPB_SIZE(64, 128), 12, false, + UPB_SIZE(64, 128), 12, false, 120, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, @@ -106,8 +104,7 @@ static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10] = { const upb_msglayout google_protobuf_DescriptorProto_msginit = { &google_protobuf_DescriptorProto_submsgs[0], &google_protobuf_DescriptorProto__fields[0], - 120, - UPB_SIZE(48, 96), 10, false, + UPB_SIZE(48, 96), 10, false, 120, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, @@ -141,8 +138,7 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange_ const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0], &google_protobuf_DescriptorProto_ExtensionRange__fields[0], - 24, - UPB_SIZE(16, 24), 3, false, + UPB_SIZE(16, 24), 3, false, 24, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, @@ -159,8 +155,7 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__ const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { NULL, &google_protobuf_DescriptorProto_ReservedRange__fields[0], - 24, - UPB_SIZE(16, 16), 2, false, + UPB_SIZE(16, 16), 2, false, 24, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, @@ -180,8 +175,7 @@ static const upb_msglayout_field google_protobuf_ExtensionRangeOptions__fields[1 const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { &google_protobuf_ExtensionRangeOptions_submsgs[0], &google_protobuf_ExtensionRangeOptions__fields[0], - 0, - UPB_SIZE(8, 8), 1, false, + UPB_SIZE(8, 8), 1, false, 0, { {&fastdecode_generic, UPB_SIZE(0, 0)}, }, @@ -208,8 +202,7 @@ static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[11 const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { &google_protobuf_FieldDescriptorProto_submsgs[0], &google_protobuf_FieldDescriptorProto__fields[0], - 248, - UPB_SIZE(80, 128), 11, false, + UPB_SIZE(80, 128), 11, false, 248, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_pss_1bt, UPB_SIZE(10133099165777930, 11258999072620554)}, @@ -258,8 +251,7 @@ static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2] const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { &google_protobuf_OneofDescriptorProto_submsgs[0], &google_protobuf_OneofDescriptorProto__fields[0], - 24, - UPB_SIZE(16, 32), 2, false, + UPB_SIZE(16, 32), 2, false, 24, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, @@ -285,8 +277,7 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5] const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { &google_protobuf_EnumDescriptorProto_submsgs[0], &google_protobuf_EnumDescriptorProto__fields[0], - 56, - UPB_SIZE(32, 64), 5, false, + UPB_SIZE(32, 64), 5, false, 56, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, @@ -307,8 +298,7 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReserve const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { NULL, &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0], - 24, - UPB_SIZE(16, 16), 2, false, + UPB_SIZE(16, 16), 2, false, 24, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, @@ -330,8 +320,7 @@ static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__field const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { &google_protobuf_EnumValueDescriptorProto_submsgs[0], &google_protobuf_EnumValueDescriptorProto__fields[0], - 24, - UPB_SIZE(24, 32), 3, false, + UPB_SIZE(24, 32), 3, false, 24, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_pss_1bt, UPB_SIZE(2251799813947402, 2251799813947402)}, @@ -354,8 +343,7 @@ static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[ const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { &google_protobuf_ServiceDescriptorProto_submsgs[0], &google_protobuf_ServiceDescriptorProto__fields[0], - 24, - UPB_SIZE(24, 48), 3, false, + UPB_SIZE(24, 48), 3, false, 24, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, @@ -380,8 +368,7 @@ static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6 const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { &google_protobuf_MethodDescriptorProto_submsgs[0], &google_protobuf_MethodDescriptorProto__fields[0], - 56, - UPB_SIZE(32, 64), 6, false, + UPB_SIZE(32, 64), 6, false, 56, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_pss_1bt, UPB_SIZE(1125899907366922, 2251799814209546)}, @@ -425,8 +412,7 @@ static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { const upb_msglayout google_protobuf_FileOptions_msginit = { &google_protobuf_FileOptions_submsgs[0], &google_protobuf_FileOptions__fields[0], - 248, - UPB_SIZE(112, 208), 21, false, + UPB_SIZE(112, 208), 21, false, 248, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_pss_1bt, UPB_SIZE(7881299482116106, 9007199388958730)}, @@ -478,8 +464,7 @@ static const upb_msglayout_field google_protobuf_MessageOptions__fields[5] = { const upb_msglayout google_protobuf_MessageOptions_msginit = { &google_protobuf_MessageOptions_submsgs[0], &google_protobuf_MessageOptions__fields[0], - 56, - UPB_SIZE(16, 16), 5, false, + UPB_SIZE(16, 16), 5, false, 56, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_psb1_1bt, UPB_SIZE(281474976841736, 281474976841736)}, @@ -509,8 +494,7 @@ static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = { const upb_msglayout google_protobuf_FieldOptions_msginit = { &google_protobuf_FieldOptions_submsgs[0], &google_protobuf_FieldOptions__fields[0], - 120, - UPB_SIZE(32, 40), 7, false, + UPB_SIZE(32, 40), 7, false, 120, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_psv4_1bt, UPB_SIZE(2251799813816328, 2251799813816328)}, @@ -542,8 +526,7 @@ static const upb_msglayout_field google_protobuf_OneofOptions__fields[1] = { const upb_msglayout google_protobuf_OneofOptions_msginit = { &google_protobuf_OneofOptions_submsgs[0], &google_protobuf_OneofOptions__fields[0], - 0, - UPB_SIZE(8, 8), 1, false, + UPB_SIZE(8, 8), 1, false, 0, { {&fastdecode_generic, UPB_SIZE(0, 0)}, }, @@ -562,8 +545,7 @@ static const upb_msglayout_field google_protobuf_EnumOptions__fields[3] = { const upb_msglayout google_protobuf_EnumOptions_msginit = { &google_protobuf_EnumOptions_submsgs[0], &google_protobuf_EnumOptions__fields[0], - 24, - UPB_SIZE(8, 16), 3, false, + UPB_SIZE(8, 16), 3, false, 24, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, @@ -584,8 +566,7 @@ static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2] = { const upb_msglayout google_protobuf_EnumValueOptions_msginit = { &google_protobuf_EnumValueOptions_submsgs[0], &google_protobuf_EnumValueOptions__fields[0], - 8, - UPB_SIZE(8, 16), 2, false, + UPB_SIZE(8, 16), 2, false, 8, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_psb1_1bt, UPB_SIZE(281474976841736, 281474976841736)}, @@ -604,8 +585,7 @@ static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2] = { const upb_msglayout google_protobuf_ServiceOptions_msginit = { &google_protobuf_ServiceOptions_submsgs[0], &google_protobuf_ServiceOptions__fields[0], - 0, - UPB_SIZE(8, 16), 2, false, + UPB_SIZE(8, 16), 2, false, 0, { {&fastdecode_generic, UPB_SIZE(0, 0)}, }, @@ -624,8 +604,7 @@ static const upb_msglayout_field google_protobuf_MethodOptions__fields[3] = { const upb_msglayout google_protobuf_MethodOptions_msginit = { &google_protobuf_MethodOptions_submsgs[0], &google_protobuf_MethodOptions__fields[0], - 0, - UPB_SIZE(24, 32), 3, false, + UPB_SIZE(24, 32), 3, false, 0, { {&fastdecode_generic, UPB_SIZE(0, 0)}, }, @@ -648,8 +627,7 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption__fields[7] const upb_msglayout google_protobuf_UninterpretedOption_msginit = { &google_protobuf_UninterpretedOption_submsgs[0], &google_protobuf_UninterpretedOption__fields[0], - 120, - UPB_SIZE(64, 96), 7, false, + UPB_SIZE(64, 96), 7, false, 120, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, @@ -678,8 +656,7 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__f const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { NULL, &google_protobuf_UninterpretedOption_NamePart__fields[0], - 24, - UPB_SIZE(16, 32), 2, false, + UPB_SIZE(16, 32), 2, false, 24, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_pss_1bt, UPB_SIZE(1125899907104778, 2251799813947402)}, @@ -699,8 +676,7 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1] = { const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { &google_protobuf_SourceCodeInfo_submsgs[0], &google_protobuf_SourceCodeInfo__fields[0], - 8, - UPB_SIZE(8, 8), 1, false, + UPB_SIZE(8, 8), 1, false, 8, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_prm_1bt_max128b, UPB_SIZE(10, 10)}, @@ -718,8 +694,7 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { NULL, &google_protobuf_SourceCodeInfo_Location__fields[0], - 56, - UPB_SIZE(32, 64), 5, false, + UPB_SIZE(32, 64), 5, false, 56, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, @@ -743,8 +718,7 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1] = const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { &google_protobuf_GeneratedCodeInfo_submsgs[0], &google_protobuf_GeneratedCodeInfo__fields[0], - 8, - UPB_SIZE(8, 8), 1, false, + UPB_SIZE(8, 8), 1, false, 8, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_prm_1bt_max64b, UPB_SIZE(10, 10)}, @@ -761,8 +735,7 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__f const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { NULL, &google_protobuf_GeneratedCodeInfo_Annotation__fields[0], - 56, - UPB_SIZE(24, 48), 4, false, + UPB_SIZE(24, 48), 4, false, 56, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, diff --git a/upb/decode.c b/upb/decode.c index 11a30faa38..eb40f67ca9 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -619,7 +619,7 @@ const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, *(uint32_t*)msg |= hasbits >> 16; /* Sync hasbits. */ (void)data; if (ptr == d->limit) return ptr; - ret = decode_field(d, ptr, msg, (const upb_msglayout *)(table >> 8)); + ret = decode_field(d, ptr, msg, decode_totablep(table)); if (ret.group_end) return ptr; return fastdecode_dispatch(d, ret.ptr, msg, table, hasbits); } @@ -628,8 +628,7 @@ UPB_NOINLINE static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *layout) { if (msg) { - ptr = fastdecode_dispatch(d, ptr, msg, - ((intptr_t)layout << 8) | layout->table_mask, 0); + ptr = fastdecode_dispatch(d, ptr, msg, decode_totable(layout), 0); } else { while (ptr < d->limit) { decode_parseret ret = decode_field(d, ptr, msg, layout); diff --git a/upb/decode.int.h b/upb/decode.int.h index f35066a47a..2b881bdc06 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -21,6 +21,15 @@ const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, intptr_t table, uint64_t hasbits); const char *fastdecode_err(upb_decstate *d); +/* x86-64 pointers always have the high 16 bits matching. So we can shift + * left 8 and right 8 without loss of information. */ +UPB_INLINE intptr_t decode_totable(const upb_msglayout *tablep) { + return ((intptr_t)tablep << 8) | tablep->table_mask; +} + +UPB_INLINE const upb_msglayout *decode_totablep(intptr_t table) { + return (void*)(table >> 8); +} UPB_INLINE upb_msg *decode_newmsg_ceil(upb_decstate *d, size_t size, int msg_ceil_bytes) { diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 4d133b2531..3ab1023b96 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -27,7 +27,7 @@ UPB_FORCEINLINE const char *fastdecode_tag_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, intptr_t table, uint64_t hasbits, uint32_t tag) { - const upb_msglayout *table_p = (void*)(table >> 8); + const upb_msglayout *table_p = decode_totablep(table); uint8_t mask = table; uint64_t data; size_t idx = tag & mask; @@ -310,9 +310,9 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, void *end; uint32_t submsg_idx = data; submsg_idx >>= 16; - const upb_msglayout *table_p = (void*)(table >> 8); + const upb_msglayout *table_p = decode_totablep(table); const upb_msglayout *subl = table_p->submsgs[submsg_idx]; - intptr_t subt = (intptr_t)subl << 8 | subl->table_mask; + intptr_t subt = decode_totable(subl); size_t submsg_size = subl->size + sizeof(upb_msg_internal); submsg = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &arr, &end, sizeof(upb_msg *), card, true); diff --git a/upb/msg.h b/upb/msg.h index a6ae8aea9c..8a542842e1 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -61,12 +61,12 @@ typedef struct { typedef struct upb_msglayout { const struct upb_msglayout *const* submsgs; const upb_msglayout_field *fields; - uint8_t table_mask; /* Must be aligned to sizeof(void*). Doesn't include internal members like * unknown fields, extension dict, pointer to msglayout, etc. */ uint16_t size; uint16_t field_count; bool extendable; + uint8_t table_mask; _upb_fasttable_entry fasttable[]; } upb_msglayout; diff --git a/upbc/generator.cc b/upbc/generator.cc index 0bd474cd41..13f41d151d 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -973,10 +973,10 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output) { output("const upb_msglayout $0 = {\n", MessageInit(message)); output(" $0,\n", submsgs_array_ref); output(" $0,\n", fields_array_ref); - output(" $0,\n", (table.size() - 1) << 3); - output(" $0, $1, $2,\n", GetSizeInit(layout.message_size()), + output(" $0, $1, $2, $3,\n", GetSizeInit(layout.message_size()), field_number_order.size(), - "false" // TODO: extendable + "false", // TODO: extendable + (table.size() - 1) << 3 ); output(" {\n"); for (const auto& ent : table) { From 75edd3e59c397ddbe0f45e59d952a1d8abc26b20 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 13 Oct 2020 11:18:17 -0700 Subject: [PATCH 49/88] Changed to use table pairs, seems to ever-so-slightly regress. --- .../google/protobuf/descriptor.upb.c | 2646 ++++++----------- upb/decode_fast.c | 6 +- upb/def.c | 2 +- upb/msg.h | 8 +- upbc/generator.cc | 7 +- 5 files changed, 875 insertions(+), 1794 deletions(-) diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index 4b5c92c6b0..242d1bdf36 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -22,72 +22,38 @@ static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1] = const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { { - &fastdecode_generic, - &upb_prm_1bt_max192b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(10, 10), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prm_1bt_max192b, UPB_SIZE(10, 10)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_FileDescriptorSet_submsgs[0], &google_protobuf_FileDescriptorSet__fields[0], @@ -120,72 +86,38 @@ static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12] const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { { - &fastdecode_generic, - &upb_pss_1bt, - &upb_pss_1bt, - &fastdecode_generic, - &upb_prm_1bt_max128b, - &upb_prm_1bt_max128b, - &upb_prm_1bt_max64b, - &upb_prm_1bt_max192b, - &upb_psm_1bt_max256b, - &upb_psm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(3377699720790034, 6755399441317906), - UPB_SIZE(0, 0), - UPB_SIZE(11258999068426274, 22517998136852514), - UPB_SIZE(12384898975334442, 24769797950603306), - UPB_SIZE(13510798882373682, 27021597764485170), - UPB_SIZE(14636698789085242, 29273397578039354), - UPB_SIZE(7881385247440962, 15762684595339330), - UPB_SIZE(9007289449381962, 18014488704122954), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(5629499534737506, 11258999068950626), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, + {&upb_pss_1bt, UPB_SIZE(3377699720790034, 6755399441317906)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prm_1bt_max128b, UPB_SIZE(11258999068426274, 22517998136852514)}, + {&upb_prm_1bt_max128b, UPB_SIZE(12384898975334442, 24769797950603306)}, + {&upb_prm_1bt_max64b, UPB_SIZE(13510798882373682, 27021597764485170)}, + {&upb_prm_1bt_max192b, UPB_SIZE(14636698789085242, 29273397578039354)}, + {&upb_psm_1bt_max256b, UPB_SIZE(7881385247440962, 15762684595339330)}, + {&upb_psm_1bt_max64b, UPB_SIZE(9007289449381962, 18014488704122954)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(5629499534737506, 11258999068950626)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_FileDescriptorProto_submsgs[0], &google_protobuf_FileDescriptorProto__fields[0], @@ -217,72 +149,38 @@ static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10] = { const upb_msglayout google_protobuf_DescriptorProto_msginit = { { - &fastdecode_generic, - &upb_pss_1bt, - &upb_prm_1bt_max192b, - &upb_prm_1bt_max128b, - &upb_prm_1bt_max128b, - &upb_prm_1bt_max64b, - &upb_prm_1bt_max192b, - &upb_psm_1bt_max64b, - &upb_prm_1bt_max64b, - &upb_prm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(4503599627632658, 9007199255003154), - UPB_SIZE(5629499534213146, 11258999068426266), - UPB_SIZE(6755399441252386, 13510798882308130), - UPB_SIZE(7881299347963946, 15762598695862314), - UPB_SIZE(9007199255003186, 18014398509744178), - UPB_SIZE(3377777030266938, 6755476750794810), - UPB_SIZE(10133099161976898, 20266198323560514), - UPB_SIZE(11258999068557386, 22517998136983626), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, + {&upb_prm_1bt_max192b, UPB_SIZE(4503599627632658, 9007199255003154)}, + {&upb_prm_1bt_max128b, UPB_SIZE(5629499534213146, 11258999068426266)}, + {&upb_prm_1bt_max128b, UPB_SIZE(6755399441252386, 13510798882308130)}, + {&upb_prm_1bt_max64b, UPB_SIZE(7881299347963946, 15762598695862314)}, + {&upb_prm_1bt_max192b, UPB_SIZE(9007199255003186, 18014398509744178)}, + {&upb_psm_1bt_max64b, UPB_SIZE(3377777030266938, 6755476750794810)}, + {&upb_prm_1bt_max64b, UPB_SIZE(10133099161976898, 20266198323560514)}, + {&upb_prm_1bt_max64b, UPB_SIZE(11258999068557386, 22517998136983626)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_DescriptorProto_submsgs[0], &google_protobuf_DescriptorProto__fields[0], @@ -301,72 +199,38 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange_ const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { { - &fastdecode_generic, - &upb_psv4_1bt, - &upb_psv4_1bt, - &upb_psm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973704, 1125899906973704), - UPB_SIZE(2251799813947408, 2251799813947408), - UPB_SIZE(3377781324906522, 4503681231749146), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813947408, 2251799813947408)}, + {&upb_psm_1bt_max64b, UPB_SIZE(3377781324906522, 4503681231749146)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0], &google_protobuf_DescriptorProto_ExtensionRange__fields[0], @@ -380,72 +244,38 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__ const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { { - &fastdecode_generic, - &upb_psv4_1bt, - &upb_psv4_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973704, 1125899906973704), - UPB_SIZE(2251799813947408, 2251799813947408), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813947408, 2251799813947408)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, NULL, &google_protobuf_DescriptorProto_ReservedRange__fields[0], @@ -462,72 +292,38 @@ static const upb_msglayout_field google_protobuf_ExtensionRangeOptions__fields[1 const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { { - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_ExtensionRangeOptions_submsgs[0], &google_protobuf_ExtensionRangeOptions__fields[0], @@ -554,72 +350,38 @@ static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[11 const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { { - &fastdecode_generic, - &upb_pss_1bt, - &upb_pss_1bt, - &upb_psv4_1bt, - &upb_psv4_1bt, - &upb_psv4_1bt, - &upb_pss_1bt, - &upb_pss_1bt, - &upb_psm_1bt_max64b, - &upb_psv4_1bt, - &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_2bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(10133099165777930, 11258999072620554), - UPB_SIZE(12384898983657490, 15762598704185362), - UPB_SIZE(6755399441580056, 6755399441580056), - UPB_SIZE(2251799813816352, 2251799813816352), - UPB_SIZE(4503599627632680, 4503599627632680), - UPB_SIZE(14636698805731378, 20266198339944498), - UPB_SIZE(16888498636193850, 24769797984092218), - UPB_SIZE(21392214194126914, 33777113169395778), - UPB_SIZE(7881299348947016, 7881299348947016), - UPB_SIZE(19140298483433554, 29273397645017170), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(9007199256838536, 9007199256838536), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(10133099165777930, 11258999072620554)}, + {&upb_pss_1bt, UPB_SIZE(12384898983657490, 15762598704185362)}, + {&upb_psv4_1bt, UPB_SIZE(6755399441580056, 6755399441580056)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813816352, 2251799813816352)}, + {&upb_psv4_1bt, UPB_SIZE(4503599627632680, 4503599627632680)}, + {&upb_pss_1bt, UPB_SIZE(14636698805731378, 20266198339944498)}, + {&upb_pss_1bt, UPB_SIZE(16888498636193850, 24769797984092218)}, + {&upb_psm_1bt_max64b, UPB_SIZE(21392214194126914, 33777113169395778)}, + {&upb_psv4_1bt, UPB_SIZE(7881299348947016, 7881299348947016)}, + {&upb_pss_1bt, UPB_SIZE(19140298483433554, 29273397645017170)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_2bt, UPB_SIZE(9007199256838536, 9007199256838536)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_FieldDescriptorProto_submsgs[0], &google_protobuf_FieldDescriptorProto__fields[0], @@ -637,72 +399,38 @@ static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2] const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { { - &fastdecode_generic, - &upb_pss_1bt, - &upb_psm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(3377777029939218, 6755476750467090), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, + {&upb_psm_1bt_max64b, UPB_SIZE(3377777029939218, 6755476750467090)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_OneofDescriptorProto_submsgs[0], &google_protobuf_OneofDescriptorProto__fields[0], @@ -725,72 +453,38 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5] const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { { - &fastdecode_generic, - &upb_pss_1bt, - &upb_prm_1bt_max64b, - &upb_psm_1bt_max64b, - &upb_prm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(4503599627501586, 9007199254872082), - UPB_SIZE(3377777030004762, 6755476750532634), - UPB_SIZE(5629499534213154, 11258999068426274), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, + {&upb_prm_1bt_max64b, UPB_SIZE(4503599627501586, 9007199254872082)}, + {&upb_psm_1bt_max64b, UPB_SIZE(3377777030004762, 6755476750532634)}, + {&upb_prm_1bt_max64b, UPB_SIZE(5629499534213154, 11258999068426274)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_EnumDescriptorProto_submsgs[0], &google_protobuf_EnumDescriptorProto__fields[0], @@ -804,72 +498,38 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReserve const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { { - &fastdecode_generic, - &upb_psv4_1bt, - &upb_psv4_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973704, 1125899906973704), - UPB_SIZE(2251799813947408, 2251799813947408), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813947408, 2251799813947408)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, NULL, &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0], @@ -888,72 +548,38 @@ static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__field const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { { - &fastdecode_generic, - &upb_pss_1bt, - &upb_psv4_1bt, - &upb_psm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(2251799813947402, 2251799813947402), - UPB_SIZE(1125899906973712, 1125899906973712), - UPB_SIZE(4503681231749146, 6755481045434394), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(2251799813947402, 2251799813947402)}, + {&upb_psv4_1bt, UPB_SIZE(1125899906973712, 1125899906973712)}, + {&upb_psm_1bt_max64b, UPB_SIZE(4503681231749146, 6755481045434394)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_EnumValueDescriptorProto_submsgs[0], &google_protobuf_EnumValueDescriptorProto__fields[0], @@ -973,72 +599,38 @@ static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[ const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { { - &fastdecode_generic, - &upb_pss_1bt, - &upb_prm_1bt_max128b, - &upb_psm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973706, 2251799813816330), - UPB_SIZE(4503599627370514, 9007199254741010), - UPB_SIZE(3377777030004762, 6755476750532634), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, + {&upb_prm_1bt_max128b, UPB_SIZE(4503599627370514, 9007199254741010)}, + {&upb_psm_1bt_max64b, UPB_SIZE(3377777030004762, 6755476750532634)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_ServiceDescriptorProto_submsgs[0], &google_protobuf_ServiceDescriptorProto__fields[0], @@ -1060,72 +652,38 @@ static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6 const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { { - &fastdecode_generic, - &upb_pss_1bt, - &upb_pss_1bt, - &upb_pss_1bt, - &upb_psm_1bt_max64b, - &upb_psb1_1bt, - &upb_psb1_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899907366922, 2251799814209546), - UPB_SIZE(3377699721576466, 6755399442104338), - UPB_SIZE(5629499536310298, 11258999070523418), - UPB_SIZE(7881393837178914, 15762693185077282), - UPB_SIZE(281474976841768, 281474976841768), - UPB_SIZE(562949953683504, 562949953683504), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899907366922, 2251799814209546)}, + {&upb_pss_1bt, UPB_SIZE(3377699721576466, 6755399442104338)}, + {&upb_pss_1bt, UPB_SIZE(5629499536310298, 11258999070523418)}, + {&upb_psm_1bt_max64b, UPB_SIZE(7881393837178914, 15762693185077282)}, + {&upb_psb1_1bt, UPB_SIZE(281474976841768, 281474976841768)}, + {&upb_psb1_1bt, UPB_SIZE(562949953683504, 562949953683504)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_MethodDescriptorProto_submsgs[0], &google_protobuf_MethodDescriptorProto__fields[0], @@ -1162,72 +720,38 @@ static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { const upb_msglayout google_protobuf_FileOptions_msginit = { { - &fastdecode_generic, - &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_pss_1bt, - &upb_psv4_1bt, - &upb_psb1_1bt, - &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_2bt, - &upb_psb1_2bt, - &upb_psb1_2bt, - &fastdecode_generic, - &upb_psb1_2bt, - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_2bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_2bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_2bt, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(7881299482116106, 9007199388958730), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(10133099430019138, 13510799150547010), - UPB_SIZE(2251799813816392, 2251799813816392), - UPB_SIZE(4503599627632720, 4503599627632720), - UPB_SIZE(12384899512139866, 18014399046352986), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(4785074604605824, 4785074604605824), - UPB_SIZE(5066549581840776, 5066549581840776), - UPB_SIZE(5348024559600016, 5348024559600016), - UPB_SIZE(0, 0), - UPB_SIZE(5629499538407840, 5629499538407840), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(5910974519312824, 5910974519312824), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(6192449504412120, 6192449504412120), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(6473924497900024, 6473924497900024), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(7881299482116106, 9007199388958730)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(10133099430019138, 13510799150547010)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813816392, 2251799813816392)}, + {&upb_psb1_1bt, UPB_SIZE(4503599627632720, 4503599627632720)}, + {&upb_pss_1bt, UPB_SIZE(12384899512139866, 18014399046352986)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_2bt, UPB_SIZE(4785074604605824, 4785074604605824)}, + {&upb_psb1_2bt, UPB_SIZE(5066549581840776, 5066549581840776)}, + {&upb_psb1_2bt, UPB_SIZE(5348024559600016, 5348024559600016)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_2bt, UPB_SIZE(5629499538407840, 5629499538407840)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_2bt, UPB_SIZE(5910974519312824, 5910974519312824)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_2bt, UPB_SIZE(6192449504412120, 6192449504412120)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_2bt, UPB_SIZE(6473924497900024, 6473924497900024)}, }, &google_protobuf_FileOptions_submsgs[0], &google_protobuf_FileOptions__fields[0], @@ -1248,72 +772,38 @@ static const upb_msglayout_field google_protobuf_MessageOptions__fields[5] = { const upb_msglayout google_protobuf_MessageOptions_msginit = { { - &fastdecode_generic, - &upb_psb1_1bt, - &upb_psb1_1bt, - &upb_psb1_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(281474976841736, 281474976841736), - UPB_SIZE(562949953683472, 562949953683472), - UPB_SIZE(844424930656280, 844424930656280), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(1125899907891256, 1125899907891256), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_1bt, UPB_SIZE(281474976841736, 281474976841736)}, + {&upb_psb1_1bt, UPB_SIZE(562949953683472, 562949953683472)}, + {&upb_psb1_1bt, UPB_SIZE(844424930656280, 844424930656280)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_1bt, UPB_SIZE(1125899907891256, 1125899907891256)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_MessageOptions_submsgs[0], &google_protobuf_MessageOptions__fields[0], @@ -1336,72 +826,38 @@ static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = { const upb_msglayout google_protobuf_FieldOptions_msginit = { { - &fastdecode_generic, - &upb_psv4_1bt, - &upb_psb1_1bt, - &upb_psb1_1bt, - &fastdecode_generic, - &upb_psb1_1bt, - &upb_psv4_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(2251799813816328, 2251799813816328), - UPB_SIZE(6755399441580048, 6755399441580048), - UPB_SIZE(7036874418815000, 7036874418815000), - UPB_SIZE(0, 0), - UPB_SIZE(7318349396574248, 7318349396574248), - UPB_SIZE(4503599627632688, 4503599627632688), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(7599824375382096, 7599824375382096), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813816328, 2251799813816328)}, + {&upb_psb1_1bt, UPB_SIZE(6755399441580048, 6755399441580048)}, + {&upb_psb1_1bt, UPB_SIZE(7036874418815000, 7036874418815000)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_1bt, UPB_SIZE(7318349396574248, 7318349396574248)}, + {&upb_psv4_1bt, UPB_SIZE(4503599627632688, 4503599627632688)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_1bt, UPB_SIZE(7599824375382096, 7599824375382096)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_FieldOptions_submsgs[0], &google_protobuf_FieldOptions__fields[0], @@ -1418,72 +874,38 @@ static const upb_msglayout_field google_protobuf_OneofOptions__fields[1] = { const upb_msglayout google_protobuf_OneofOptions_msginit = { { - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_OneofOptions_submsgs[0], &google_protobuf_OneofOptions__fields[0], @@ -1502,72 +924,38 @@ static const upb_msglayout_field google_protobuf_EnumOptions__fields[3] = { const upb_msglayout google_protobuf_EnumOptions_msginit = { { - &fastdecode_generic, - &fastdecode_generic, - &upb_psb1_1bt, - &upb_psb1_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(281474976841744, 281474976841744), - UPB_SIZE(562949953683480, 562949953683480), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_1bt, UPB_SIZE(281474976841744, 281474976841744)}, + {&upb_psb1_1bt, UPB_SIZE(562949953683480, 562949953683480)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_EnumOptions_submsgs[0], &google_protobuf_EnumOptions__fields[0], @@ -1585,72 +973,38 @@ static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2] = { const upb_msglayout google_protobuf_EnumValueOptions_msginit = { { - &fastdecode_generic, - &upb_psb1_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(281474976841736, 281474976841736), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psb1_1bt, UPB_SIZE(281474976841736, 281474976841736)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_EnumValueOptions_submsgs[0], &google_protobuf_EnumValueOptions__fields[0], @@ -1668,72 +1022,38 @@ static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2] = { const upb_msglayout google_protobuf_ServiceOptions_msginit = { { - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_ServiceOptions_submsgs[0], &google_protobuf_ServiceOptions__fields[0], @@ -1752,72 +1072,38 @@ static const upb_msglayout_field google_protobuf_MethodOptions__fields[3] = { const upb_msglayout google_protobuf_MethodOptions_msginit = { { - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_MethodOptions_submsgs[0], &google_protobuf_MethodOptions__fields[0], @@ -1840,72 +1126,38 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption__fields[7] const upb_msglayout google_protobuf_UninterpretedOption_msginit = { { - &fastdecode_generic, - &fastdecode_generic, - &upb_prm_1bt_max64b, - &upb_pss_1bt, - &upb_psv8_1bt, - &upb_psv8_1bt, - &fastdecode_generic, - &upb_pss_1bt, - &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(15762598695796754, 22517998136852498), - UPB_SIZE(9007199255789594, 9007199255789594), - UPB_SIZE(2251799813816352, 2251799813816352), - UPB_SIZE(4503599627632680, 4503599627632680), - UPB_SIZE(0, 0), - UPB_SIZE(11258999070523450, 13510798884208698), - UPB_SIZE(13510798886305858, 18014398513676354), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prm_1bt_max64b, UPB_SIZE(15762598695796754, 22517998136852498)}, + {&upb_pss_1bt, UPB_SIZE(9007199255789594, 9007199255789594)}, + {&upb_psv8_1bt, UPB_SIZE(2251799813816352, 2251799813816352)}, + {&upb_psv8_1bt, UPB_SIZE(4503599627632680, 4503599627632680)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(11258999070523450, 13510798884208698)}, + {&upb_pss_1bt, UPB_SIZE(13510798886305858, 18014398513676354)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_UninterpretedOption_submsgs[0], &google_protobuf_UninterpretedOption__fields[0], @@ -1919,72 +1171,38 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__f const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { { - &fastdecode_generic, - &upb_pss_1bt, - &upb_psb1_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(1125899907104778, 2251799813947402), - UPB_SIZE(281474976841744, 281474976841744), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899907104778, 2251799813947402)}, + {&upb_psb1_1bt, UPB_SIZE(281474976841744, 281474976841744)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, NULL, &google_protobuf_UninterpretedOption_NamePart__fields[0], @@ -2001,72 +1219,38 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1] = { const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { { - &fastdecode_generic, - &upb_prm_1bt_max128b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(10, 10), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prm_1bt_max128b, UPB_SIZE(10, 10)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_SourceCodeInfo_submsgs[0], &google_protobuf_SourceCodeInfo__fields[0], @@ -2083,72 +1267,38 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { { - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &upb_pss_1bt, - &upb_pss_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(1125899906973722, 2251799813816346), - UPB_SIZE(3377699720790050, 6755399441317922), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(1125899906973722, 2251799813816346)}, + {&upb_pss_1bt, UPB_SIZE(3377699720790050, 6755399441317922)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, NULL, &google_protobuf_SourceCodeInfo_Location__fields[0], @@ -2165,72 +1315,38 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1] = const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { { - &fastdecode_generic, - &upb_prm_1bt_max64b, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(10, 10), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prm_1bt_max64b, UPB_SIZE(10, 10)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, &google_protobuf_GeneratedCodeInfo_submsgs[0], &google_protobuf_GeneratedCodeInfo__fields[0], @@ -2246,72 +1362,38 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__f const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { { - &fastdecode_generic, - &fastdecode_generic, - &upb_pss_1bt, - &upb_psv4_1bt, - &upb_psv4_1bt, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - }, - { - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(3377699721052178, 4503599627894802), - UPB_SIZE(1125899906973720, 1125899906973720), - UPB_SIZE(2251799813947424, 2251799813947424), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), - UPB_SIZE(0, 0), + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_pss_1bt, UPB_SIZE(3377699721052178, 4503599627894802)}, + {&upb_psv4_1bt, UPB_SIZE(1125899906973720, 1125899906973720)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813947424, 2251799813947424)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&fastdecode_generic, UPB_SIZE(0, 0)}, }, NULL, &google_protobuf_GeneratedCodeInfo_Annotation__fields[0], diff --git a/upb/decode_fast.c b/upb/decode_fast.c index e12b32a515..1b5aba9bd4 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -29,8 +29,8 @@ const char *fastdecode_tag_dispatch(upb_decstate *d, const char *ptr, upb_msg *m uint64_t data; size_t idx; idx = (tag & 0xf8) >> 3; - data = table->field_data[idx] ^ tag; - return table->field_parser[idx](UPB_PARSE_ARGS); + data = table->fasttable[idx].field_data ^ tag; + return table->fasttable[idx].field_parser(UPB_PARSE_ARGS); } UPB_FORCEINLINE @@ -40,7 +40,7 @@ uint32_t fastdecode_load_tag(const char* ptr) { return tag; } -UPB_FORCEINLINE +UPB_NOINLINE const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits) { if (UPB_UNLIKELY(ptr >= d->fastlimit)) { diff --git a/upb/def.c b/upb/def.c index 65c9e02d1a..9496476546 100644 --- a/upb/def.c +++ b/upb/def.c @@ -958,7 +958,7 @@ static bool make_layout(const upb_symtab *symtab, const upb_msgdef *m) { l->submsgs = submsgs; for (i = 0; i < 32; i++) { - l->field_parser[i] = &fastdecode_generic; + l->fasttable[i].field_parser = &fastdecode_generic; } if (upb_msgdef_mapentry(m)) { diff --git a/upb/msg.h b/upb/msg.h index 1bc934204a..bfc71a2658 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -54,9 +54,13 @@ typedef const char *_upb_field_parser(struct upb_decstate *d, const char *ptr, const struct upb_msglayout *table, uint64_t hasbits, uint64_t data); +typedef struct _upb_table_pair { + _upb_field_parser *field_parser; + uint64_t field_data; +} _upb_table_pair; + typedef struct upb_msglayout { - _upb_field_parser *field_parser[32]; - uint64_t field_data[32]; + _upb_table_pair fasttable[32]; const struct upb_msglayout *const* submsgs; const upb_msglayout_field *fields; /* Must be aligned to sizeof(void*). Doesn't include internal members like diff --git a/upbc/generator.cc b/upbc/generator.cc index 1409ee3c79..40c770c6b5 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -965,12 +965,7 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output) { output("const upb_msglayout $0 = {\n", MessageInit(message)); output(" {\n"); for (const auto& ent : table) { - output(" &$0,\n", ent.first); - } - output(" },\n"); - output(" {\n"); - for (const auto& ent : table) { - output(" $0,\n", GetSizeInit(ent.second)); + output(" {&$0, $1},\n", ent.first, GetSizeInit(ent.second)); } output(" },\n"); output(" $0,\n", submsgs_array_ref); From 5b0c5c7d4a3027f50d5f47a728a9be9fdd7a0f6e Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 13 Oct 2020 11:34:10 -0700 Subject: [PATCH 50/88] Dispatch inline. --- upb/decode_fast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 1b5aba9bd4..a1737f10e0 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -40,7 +40,7 @@ uint32_t fastdecode_load_tag(const char* ptr) { return tag; } -UPB_NOINLINE +UPB_FORCEINLINE const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits) { if (UPB_UNLIKELY(ptr >= d->fastlimit)) { From 1c8c16b9b121d4338f124cb59981e7a3328c4190 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 15 Oct 2020 11:57:18 -0700 Subject: [PATCH 51/88] Use quoted include. --- benchmark.py | 2 +- upb/json_decode.c | 2 +- upbc/main.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmark.py b/benchmark.py index 70a3cce118..55b682bc93 100755 --- a/benchmark.py +++ b/benchmark.py @@ -53,7 +53,7 @@ def Benchmark(outbase, bench_cpu=True, runs=12): baseline = "master" -bench_cpu = True +bench_cpu = False if len(sys.argv) > 1: baseline = sys.argv[1] diff --git a/upb/json_decode.c b/upb/json_decode.c index 15d305bb31..b02419328a 100644 --- a/upb/json_decode.c +++ b/upb/json_decode.c @@ -909,7 +909,7 @@ static void jsondec_field(jsondec *d, upb_msg *msg, const upb_msgdef *m) { return; } - if (upb_fielddef_containingoneof(f) && + if (upb_fielddef_realcontainingoneof(f) && upb_msg_whichoneof(msg, upb_fielddef_containingoneof(f))) { jsondec_err(d, "More than one field for this oneof."); } diff --git a/upbc/main.cc b/upbc/main.cc index a9682a9c1a..3a38937797 100644 --- a/upbc/main.cc +++ b/upbc/main.cc @@ -1,5 +1,5 @@ -#include +#include "google/protobuf/compiler/plugin.h" #include "upbc/generator.h" From b9f1b67d0776e91d7c6156b5136a65379a5e416a Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 15 Oct 2020 11:57:57 -0700 Subject: [PATCH 52/88] Use quoted include. --- upbc/main.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upbc/main.cc b/upbc/main.cc index a9682a9c1a..3a38937797 100644 --- a/upbc/main.cc +++ b/upbc/main.cc @@ -1,5 +1,5 @@ -#include +#include "google/protobuf/compiler/plugin.h" #include "upbc/generator.h" From 44a713084593061fc109ae085c475e17b5180ae2 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 15 Oct 2020 16:18:24 -0700 Subject: [PATCH 53/88] Used the correct copy of the protos in the benchmark. --- tests/benchmark.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/benchmark.cc b/tests/benchmark.cc index 3a0c6d76ec..84034768ad 100644 --- a/tests/benchmark.cc +++ b/tests/benchmark.cc @@ -76,9 +76,9 @@ static void BM_ParseDescriptor_Upb(benchmark::State& state) { size_t bytes = 0; for (auto _ : state) { upb_arena* arena = upb_arena_new(); - google_protobuf_FileDescriptorProto* set = - google_protobuf_FileDescriptorProto_parse(descriptor.data, - descriptor.size, arena); + upb_benchmark_FileDescriptorProto* set = + upb_benchmark_FileDescriptorProto_parse(descriptor.data, + descriptor.size, arena); if (!set) { printf("Failed to parse.\n"); exit(1); @@ -94,9 +94,9 @@ static void BM_ParseDescriptor_Upb_LargeInitialBlock(benchmark::State& state) { size_t bytes = 0; for (auto _ : state) { upb_arena* arena = upb_arena_init(buf, sizeof(buf), NULL); - google_protobuf_FileDescriptorProto* set = - google_protobuf_FileDescriptorProto_parse(descriptor.data, - descriptor.size, arena); + upb_benchmark_FileDescriptorProto* set = + upb_benchmark_FileDescriptorProto_parse(descriptor.data, + descriptor.size, arena); if (!set) { printf("Failed to parse.\n"); exit(1); From c2901eeee1bdca434fa96d45d4a431765e6979e6 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 15 Oct 2020 16:26:00 -0700 Subject: [PATCH 54/88] Added missing #includes (caught by Blaze). --- upb/decode.int.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/upb/decode.int.h b/upb/decode.int.h index 7aa1eea454..ab1982ef56 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -2,6 +2,9 @@ #ifndef UPB_DECODE_INT_H_ #define UPB_DECODE_INT_H_ +#include + +#include "upb/msg.h" #include "upb/upb.int.h" /* Must be last. */ From 2a574d3d0153accbf1887196b34bf348f83552c1 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 15 Oct 2020 19:58:07 -0700 Subject: [PATCH 55/88] Added a bunch of comments for readability. --- upb/decode.h | 6 --- upb/decode.int.h | 24 ++--------- upb/decode_fast.c | 106 ++++++++++++++++++++++++++++++---------------- upb/decode_fast.h | 5 +++ upb/def.c | 2 + 5 files changed, 81 insertions(+), 62 deletions(-) diff --git a/upb/decode.h b/upb/decode.h index a13e39b47c..650418c1ce 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -5,12 +5,8 @@ #ifndef UPB_DECODE_H_ #define UPB_DECODE_H_ -#include - #include "upb/msg.h" -#include "upb/port_def.inc" - #ifdef __cplusplus extern "C" { #endif @@ -23,6 +19,4 @@ bool upb_decode(const char *buf, size_t size, upb_msg *msg, } /* extern "C" */ #endif -#include "upb/port_undef.inc" - #endif /* UPB_DECODE_H_ */ diff --git a/upb/decode.int.h b/upb/decode.int.h index ab1982ef56..4a7c70385a 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -1,3 +1,7 @@ +/* +** Internal implementation details of the decoder that are shared between +** decode.c and decode_fast.c. +*/ #ifndef UPB_DECODE_INT_H_ #define UPB_DECODE_INT_H_ @@ -24,26 +28,6 @@ const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits); const char *fastdecode_err(upb_decstate *d); - -UPB_INLINE -upb_msg *decode_newmsg_ceil(upb_decstate *d, const upb_msglayout *l, - int msg_ceil_bytes) { - size_t size = l->size + sizeof(upb_msg_internal); - char *msg_data; - if (UPB_LIKELY(msg_ceil_bytes > 0 && _upb_arenahas(&d->arena, msg_ceil_bytes))) { - UPB_ASSERT(size <= (size_t)msg_ceil_bytes); - msg_data = d->arena.head.ptr; - d->arena.head.ptr += size; - UPB_UNPOISON_MEMORY_REGION(msg_data, msg_ceil_bytes); - memset(msg_data, 0, msg_ceil_bytes); - UPB_POISON_MEMORY_REGION(msg_data + size, msg_ceil_bytes - size); - } else { - msg_data = (char*)upb_arena_malloc(&d->arena, size); - memset(msg_data, 0, size); - } - return msg_data + sizeof(upb_msg_internal); -} - #include "upb/port_undef.inc" #endif /* UPB_DECODE_INT_H_ */ diff --git a/upb/decode_fast.c b/upb/decode_fast.c index a1737f10e0..1ad94684bf 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -1,3 +1,8 @@ +// Fast decoder: ~3x the speed of decode.c, but x86-64 specific. +// Also the table size grows by 2x. +// +// Could potentially be ported to ARM64 or other 64-bit archs that pass at +// least six arguments in registers. #include "upb/decode_fast.h" @@ -7,6 +12,8 @@ /* Must be last. */ #include "upb/port_def.inc" +// The standard set of arguments passed to each parsing function. +// Thanks to x86-64 calling conventions, these will stay in registers. #define UPB_PARSE_PARAMS \ upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, \ uint64_t hasbits, uint64_t data @@ -23,18 +30,44 @@ typedef enum { CARD_r = 2 /* Repeated */ } upb_card; +UPB_INLINE +upb_msg *decode_newmsg_ceil(upb_decstate *d, const upb_msglayout *l, + int msg_ceil_bytes) { + size_t size = l->size + sizeof(upb_msg_internal); + char *msg_data; + if (UPB_LIKELY(msg_ceil_bytes > 0 && _upb_arenahas(&d->arena, msg_ceil_bytes))) { + UPB_ASSERT(size <= (size_t)msg_ceil_bytes); + msg_data = d->arena.head.ptr; + d->arena.head.ptr += size; + UPB_UNPOISON_MEMORY_REGION(msg_data, msg_ceil_bytes); + memset(msg_data, 0, msg_ceil_bytes); + UPB_POISON_MEMORY_REGION(msg_data + size, msg_ceil_bytes - size); + } else { + msg_data = (char*)upb_arena_malloc(&d->arena, size); + memset(msg_data, 0, size); + } + return msg_data + sizeof(upb_msg_internal); +} + UPB_FORCEINLINE -const char *fastdecode_tag_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, - const upb_msglayout *table, uint64_t hasbits, uint32_t tag) { - uint64_t data; - size_t idx; - idx = (tag & 0xf8) >> 3; - data = table->fasttable[idx].field_data ^ tag; +static const char *fastdecode_tagdispatch(upb_decstate *d, const char *ptr, + upb_msg *msg, + const upb_msglayout *table, + uint64_t hasbits, uint32_t tag) { + // Get 5 bits of field number (we pretend the continuation bit is a data bit, + // speculating that the second byte, if any, will be 0x01). + size_t idx = (tag & 0xf8) >> 3; + + // Xor the actual tag with the expected tag (in the low bytes of the table) + // so that the field parser can verify the tag by comparing with zero. + uint64_t data = table->fasttable[idx].field_data ^ tag; + + // Jump to the specialized field parser function. return table->fasttable[idx].field_parser(UPB_PARSE_ARGS); } UPB_FORCEINLINE -uint32_t fastdecode_load_tag(const char* ptr) { +static uint32_t fastdecode_loadtag(const char *ptr) { uint16_t tag; memcpy(&tag, ptr, 2); return tag; @@ -45,13 +78,19 @@ const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits) { if (UPB_UNLIKELY(ptr >= d->fastlimit)) { if (UPB_LIKELY(ptr == d->limit)) { - *(uint32_t*)msg |= hasbits >> 16; /* Sync hasbits. */ + // Parse is finished. + *(uint32_t*)msg |= hasbits >> 16; // Sync hasbits. return ptr; } + // We are within 16 bytes of end-of-buffer, so we can't use fast parsing + // functions anymore (they will read up to 16b without bounds checks). uint64_t data = 0; RETURN_GENERIC("dispatch hit end\n"); } - return fastdecode_tag_dispatch(d, ptr, msg, table, hasbits, fastdecode_load_tag(ptr)); + + // Read two bytes of tag data (for a one-byte tag, the high byte is junk). + uint16_t tag = fastdecode_loadtag(ptr); + return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, tag); } UPB_FORCEINLINE @@ -74,6 +113,7 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, switch (card) { case CARD_s: + // Set hasbit and return pointer to scalar field. if (hasbit_is_idx) { *hasbits |= 1ull << ((*data >> 32) & 63); } else { @@ -81,31 +121,24 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, } return field; case CARD_r: { + // Get pointer to upb_array and allocate/expand if necessary. uint8_t elem_size_lg2 = __builtin_ctz(valbytes); upb_array **arr_p = field; upb_array *arr; + char *begin; *hasbits >>= 16; *(uint32_t*)msg |= *hasbits; *hasbits = 0; if (UPB_LIKELY(!*arr_p)) { - const size_t initial_len = 8; - size_t need = (valbytes * initial_len) + sizeof(upb_array); - if (!hasbit_is_idx && UPB_UNLIKELY(!_upb_arenahas(&d->arena, need))) { - return NULL; - } - arr = upb_arena_malloc(&d->arena, need); - field = arr + 1; - arr->data = _upb_array_tagptr(field, elem_size_lg2); + arr = _upb_array_new(&d->arena, 8, elem_size_lg2); *arr_p = arr; - arr->size = initial_len; - *end = (char*)field + (arr->size * valbytes); } else { arr = *arr_p; - field = _upb_array_ptr(arr); - *end = (char*)field + (arr->size * valbytes); - field = (char*)field + (arr->len * valbytes); } - *data = fastdecode_load_tag(ptr); + begin = _upb_array_ptr(arr); + field = begin + (arr->len * valbytes); + *end = begin + (arr->size * valbytes); + *data = fastdecode_loadtag(ptr); *outarr = arr; return field; } @@ -124,11 +157,8 @@ static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, /* varint fields **************************************************************/ -#ifdef __BMI2__ -#include -#endif - -UPB_FORCEINLINE uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigzag) { +UPB_FORCEINLINE +static uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigzag) { if (valbytes == 1) { return val != 0; } else if (zigzag) { @@ -215,7 +245,8 @@ TAGBYTES(o) /* string fields **************************************************************/ UPB_FORCEINLINE -bool fastdecode_boundscheck(const char *ptr, size_t len, const char *end) { +static bool fastdecode_boundscheck(const char *ptr, size_t len, + const char *end) { uintptr_t uptr = (uintptr_t)ptr; uintptr_t uend = (uintptr_t)end; uintptr_t res = uptr + len; @@ -263,9 +294,11 @@ const char *upb_pos_2bt(UPB_PARSE_PARAMS) { /* message fields *************************************************************/ -UPB_NOINLINE static -const char *fastdecode_lendelim_submsg(upb_decstate *d, const char *ptr, upb_msg *msg, - const upb_msglayout *table, uint64_t hasbits, const char* saved_limit) { +UPB_NOINLINE +static const char *fastdecode_tosubmsg(upb_decstate *d, const char *ptr, + upb_msg *msg, const upb_msglayout *table, + uint64_t hasbits, + const char *saved_limit) { size_t len = (uint8_t)ptr[-1]; if (UPB_UNLIKELY(len & 0x80)) { int i; @@ -277,7 +310,8 @@ const char *fastdecode_lendelim_submsg(upb_decstate *d, const char *ptr, upb_msg } ptr++; size_t byte = (uint8_t)ptr[-1]; - // len is limited by 2gb not 4gb, hence 8 and not 16 as normally expected for a 32 bit varint. + // len is limited by 2gb not 4gb, hence 8 and not 16 as normally expected + // for a 32 bit varint. if (UPB_UNLIKELY(byte >= 8)) return fastdecode_err(d); len += (byte - 1) << 28; } @@ -342,7 +376,7 @@ again: ptr += tagbytes + 1; - ptr = fastdecode_lendelim_submsg(d, ptr, child, subl, 0, saved_limit); + ptr = fastdecode_tosubmsg(d, ptr, child, subl, 0, saved_limit); if (UPB_UNLIKELY(ptr != d->limit || d->end_group != 0)) { return fastdecode_err(d); @@ -351,7 +385,7 @@ again: if (card == CARD_r) { submsg++; if (UPB_LIKELY(ptr < saved_fastlimit)) { - uint32_t tag = fastdecode_load_tag(ptr); + uint32_t tag = fastdecode_loadtag(ptr); if (tagbytes == 1) { if ((uint8_t)tag == (uint8_t)data) goto again; } else { @@ -361,7 +395,7 @@ again: d->limit = saved_limit; d->fastlimit = saved_fastlimit; d->depth++; - return fastdecode_tag_dispatch(d, ptr, msg, table, hasbits, tag); + return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, tag); } else { if (ptr == saved_limit) { arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); diff --git a/upb/decode_fast.h b/upb/decode_fast.h index 47ca1bc4ba..bb0f14d721 100644 --- a/upb/decode_fast.h +++ b/upb/decode_fast.h @@ -1,3 +1,8 @@ +// These are the specialized field parser functions for the fast parser. +// Generated tables will refer to these by name. +// +// Here we follow the same pattern of macros used in decode_fast.c to declare +// all of the variants. #ifndef UPB_DECODE_FAST_H_ #define UPB_DECODE_FAST_H_ diff --git a/upb/def.c b/upb/def.c index 9496476546..0b59667a09 100644 --- a/upb/def.c +++ b/upb/def.c @@ -957,6 +957,8 @@ static bool make_layout(const upb_symtab *symtab, const upb_msgdef *m) { l->fields = fields; l->submsgs = submsgs; + /* TODO(haberman): initialize fast tables so that reflection-based parsing + * can get the same speeds as linked-in types. */ for (i = 0; i < 32; i++) { l->fasttable[i].field_parser = &fastdecode_generic; } From 3238821315a2866c3892e1f7336593e1dab9d9a2 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 15 Oct 2020 20:01:50 -0700 Subject: [PATCH 56/88] Gave fast table entry a nicer name. --- upb/msg.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/upb/msg.h b/upb/msg.h index 06787506d5..8c87b42154 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -46,21 +46,21 @@ typedef struct { uint8_t label; /* google.protobuf.Label or _UPB_LABEL_* above. */ } upb_msglayout_field; -struct upb_msglayout; struct upb_decstate; +struct upb_msglayout; typedef const char *_upb_field_parser(struct upb_decstate *d, const char *ptr, upb_msg *msg, const struct upb_msglayout *table, uint64_t hasbits, uint64_t data); -typedef struct _upb_table_pair { +typedef struct { _upb_field_parser *field_parser; uint64_t field_data; -} _upb_table_pair; +} _upb_fasttable_entry; typedef struct upb_msglayout { - _upb_table_pair fasttable[32]; + _upb_fasttable_entry fasttable[32]; const struct upb_msglayout *const* submsgs; const upb_msglayout_field *fields; /* Must be aligned to sizeof(void*). Doesn't include internal members like From bf8e08074c3b6cafa1db0fb32405584dd9fa3869 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 15 Oct 2020 20:32:40 -0700 Subject: [PATCH 57/88] Added a few more comments. --- upb/decode.h | 1 - upb/decode.int.h | 8 ++++++++ upb/decode_fast.h | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/upb/decode.h b/upb/decode.h index 650418c1ce..9de8638de5 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -14,7 +14,6 @@ extern "C" { bool upb_decode(const char *buf, size_t size, upb_msg *msg, const upb_msglayout *l, upb_arena *arena); - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/upb/decode.int.h b/upb/decode.int.h index 4a7c70385a..c49521fa21 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -26,6 +26,14 @@ typedef struct upb_decstate { const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits); + +/* Error function that will abort decoding with longjmp(). We can't declare this + * UPB_NORETURN, even though it is appropriate, because if we do then compilers + * will "helpfully" refuse to tailcall to it + * (see: https://stackoverflow.com/a/55657013), which will defeat a major goal + * of our optimizations. That is also why we must declare it in a separate file, + * otherwise the compiler will see that it calls longjmp() and deduce that it is + * noreturn. */ const char *fastdecode_err(upb_decstate *d); #include "upb/port_undef.inc" diff --git a/upb/decode_fast.h b/upb/decode_fast.h index bb0f14d721..67315206eb 100644 --- a/upb/decode_fast.h +++ b/upb/decode_fast.h @@ -11,6 +11,8 @@ struct upb_decstate; +// The fallback, generic parsing function that can handle any field type. +// This just uses the regular (non-fast) parser to parse a single field. const char *fastdecode_generic(struct upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits, uint64_t data); From eb8e6de8b70f075921140cd2fdcc7732b2860567 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 15 Oct 2020 20:40:02 -0700 Subject: [PATCH 58/88] Regenerated source files. --- .../google/protobuf/descriptor.upb.c | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index e5d8f76d18..0b0a748406 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -93,7 +93,7 @@ const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { {&upb_prm_1bt_max128b, UPB_SIZE(11258999068426274, 22517998136852514)}, {&upb_prm_1bt_max128b, UPB_SIZE(12384898975334442, 24769797950603306)}, {&upb_prm_1bt_max64b, UPB_SIZE(13510798882373682, 27021597764485170)}, - {&upb_prm_1bt_max192b, UPB_SIZE(14636698789085242, 29273397578039354)}, + {&upb_prm_1bt_max128b, UPB_SIZE(14636698789085242, 29273397578039354)}, {&upb_psm_1bt_max256b, UPB_SIZE(7881385247440962, 15762684595339330)}, {&upb_psm_1bt_max64b, UPB_SIZE(9007289449381962, 18014488704122954)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, @@ -151,11 +151,11 @@ const upb_msglayout google_protobuf_DescriptorProto_msginit = { { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, - {&upb_prm_1bt_max192b, UPB_SIZE(4503599627632658, 9007199255003154)}, + {&upb_prm_1bt_max128b, UPB_SIZE(4503599627632658, 9007199255003154)}, {&upb_prm_1bt_max128b, UPB_SIZE(5629499534213146, 11258999068426266)}, {&upb_prm_1bt_max128b, UPB_SIZE(6755399441252386, 13510798882308130)}, {&upb_prm_1bt_max64b, UPB_SIZE(7881299347963946, 15762598695862314)}, - {&upb_prm_1bt_max192b, UPB_SIZE(9007199255003186, 18014398509744178)}, + {&upb_prm_1bt_max128b, UPB_SIZE(9007199255003186, 18014398509744178)}, {&upb_psm_1bt_max64b, UPB_SIZE(3377777030266938, 6755476750794810)}, {&upb_prm_1bt_max64b, UPB_SIZE(10133099161976898, 20266198323560514)}, {&upb_prm_1bt_max64b, UPB_SIZE(11258999068557386, 22517998136983626)}, @@ -351,23 +351,23 @@ static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[11 const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { { {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(10133099165777930, 11258999072620554)}, - {&upb_pss_1bt, UPB_SIZE(12384898983657490, 15762598704185362)}, - {&upb_psv4_1bt, UPB_SIZE(6755399441580056, 6755399441580056)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813816352, 2251799813816352)}, - {&upb_psv4_1bt, UPB_SIZE(4503599627632680, 4503599627632680)}, - {&upb_pss_1bt, UPB_SIZE(14636698805731378, 20266198339944498)}, - {&upb_pss_1bt, UPB_SIZE(16888498636193850, 24769797984092218)}, - {&upb_psm_1bt_max64b, UPB_SIZE(21392214194126914, 33777113169395778)}, - {&upb_psv4_1bt, UPB_SIZE(7881299348947016, 7881299348947016)}, - {&upb_pss_1bt, UPB_SIZE(19140298483433554, 29273397645017170)}, + {&upb_pss_1bt, UPB_SIZE(6755399445250058, 6755399445250058)}, + {&upb_pss_1bt, UPB_SIZE(9007199263129618, 11258999076814866)}, + {&upb_psv4_1bt, UPB_SIZE(3377699721052184, 3377699721052184)}, + {&upb_psv4_1bt, UPB_SIZE(1125899906973728, 1125899906973728)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813947432, 2251799813947432)}, + {&upb_pss_1bt, UPB_SIZE(11258999085203506, 15762598712574002)}, + {&upb_pss_1bt, UPB_SIZE(13510798915665978, 20266198356721722)}, + {&upb_psm_1bt_max64b, UPB_SIZE(18014514473599042, 29273513542025282)}, + {&upb_psv4_1bt, UPB_SIZE(4503599628419144, 4503599628419144)}, + {&upb_pss_1bt, UPB_SIZE(15762598762905682, 24769798017646674)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(9007199256838536, 9007199256838536)}, + {&upb_psb1_2bt, UPB_SIZE(5629499536310664, 5629499536310664)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, @@ -721,37 +721,37 @@ static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { const upb_msglayout google_protobuf_FileOptions_msginit = { { {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(7881299482116106, 9007199388958730)}, + {&upb_pss_1bt, UPB_SIZE(5629499668430858, 6755399575273482)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(10133099430019138, 13510799150547010)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813816392, 2251799813816392)}, - {&upb_psb1_1bt, UPB_SIZE(4503599627632720, 4503599627632720)}, - {&upb_pss_1bt, UPB_SIZE(12384899512139866, 18014399046352986)}, + {&upb_pss_1bt, UPB_SIZE(7881299616333890, 11258999336861762)}, + {&upb_psv4_1bt, UPB_SIZE(1125899906973768, 1125899906973768)}, + {&upb_psb1_1bt, UPB_SIZE(2251799813947472, 2251799813947472)}, + {&upb_pss_1bt, UPB_SIZE(10133099698454618, 15762599232667738)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(4785074604605824, 4785074604605824)}, - {&upb_psb1_2bt, UPB_SIZE(5066549581840776, 5066549581840776)}, - {&upb_psb1_2bt, UPB_SIZE(5348024559600016, 5348024559600016)}, + {&upb_psb1_2bt, UPB_SIZE(2533274790920576, 2533274790920576)}, + {&upb_psb1_2bt, UPB_SIZE(2814749768155528, 2814749768155528)}, + {&upb_psb1_2bt, UPB_SIZE(3096224745914768, 3096224745914768)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(5629499538407840, 5629499538407840)}, + {&upb_psb1_2bt, UPB_SIZE(3377699724722592, 3377699724722592)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(5910974519312824, 5910974519312824)}, + {&upb_psb1_2bt, UPB_SIZE(3659174705627576, 3659174705627576)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(6192449504412120, 6192449504412120)}, + {&upb_psb1_2bt, UPB_SIZE(3940649690726872, 3940649690726872)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(6473924497900024, 6473924497900024)}, + {&upb_psb1_2bt, UPB_SIZE(4222124684214776, 4222124684214776)}, }, &google_protobuf_FileOptions_submsgs[0], &google_protobuf_FileOptions__fields[0], @@ -827,16 +827,16 @@ static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = { const upb_msglayout google_protobuf_FieldOptions_msginit = { { {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813816328, 2251799813816328)}, - {&upb_psb1_1bt, UPB_SIZE(6755399441580048, 6755399441580048)}, - {&upb_psb1_1bt, UPB_SIZE(7036874418815000, 7036874418815000)}, + {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, + {&upb_psb1_1bt, UPB_SIZE(3377699721052176, 3377699721052176)}, + {&upb_psb1_1bt, UPB_SIZE(3659174698287128, 3659174698287128)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_1bt, UPB_SIZE(7318349396574248, 7318349396574248)}, - {&upb_psv4_1bt, UPB_SIZE(4503599627632688, 4503599627632688)}, + {&upb_psb1_1bt, UPB_SIZE(3940649676046376, 3940649676046376)}, + {&upb_psv4_1bt, UPB_SIZE(2251799813947440, 2251799813947440)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_1bt, UPB_SIZE(7599824375382096, 7599824375382096)}, + {&upb_psb1_1bt, UPB_SIZE(4222124654854224, 4222124654854224)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, @@ -861,7 +861,7 @@ const upb_msglayout google_protobuf_FieldOptions_msginit = { }, &google_protobuf_FieldOptions_submsgs[0], &google_protobuf_FieldOptions__fields[0], - UPB_SIZE(20, 24), 7, false, + UPB_SIZE(24, 24), 7, false, }; static const upb_msglayout *const google_protobuf_OneofOptions_submsgs[1] = { From c0c9b5a168a40096c8630ebe6f8876936dd4088c Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 15 Oct 2020 20:41:10 -0700 Subject: [PATCH 59/88] Regenerated generated code. --- .../google/protobuf/descriptor.upb.c | 1063 +---------------- 1 file changed, 32 insertions(+), 1031 deletions(-) diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index ba262c75f8..9a412110df 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -21,43 +21,6 @@ static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1] = }; const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_prm_1bt_max192b, UPB_SIZE(10, 10)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_FileDescriptorSet_submsgs[0], &google_protobuf_FileDescriptorSet__fields[0], UPB_SIZE(8, 8), 1, false, 8, @@ -92,43 +55,6 @@ static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12] }; const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, - {&upb_pss_1bt, UPB_SIZE(3377699720790034, 6755399441317906)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_prm_1bt_max128b, UPB_SIZE(11258999068426274, 22517998136852514)}, - {&upb_prm_1bt_max128b, UPB_SIZE(12384898975334442, 24769797950603306)}, - {&upb_prm_1bt_max64b, UPB_SIZE(13510798882373682, 27021597764485170)}, - {&upb_prm_1bt_max192b, UPB_SIZE(14636698789085242, 29273397578039354)}, - {&upb_psm_1bt_max256b, UPB_SIZE(7881385247440962, 15762684595339330)}, - {&upb_psm_1bt_max64b, UPB_SIZE(9007289449381962, 18014488704122954)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(5629499534737506, 11258999068950626)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_FileDescriptorProto_submsgs[0], &google_protobuf_FileDescriptorProto__fields[0], UPB_SIZE(64, 128), 12, false, 120, @@ -176,43 +102,6 @@ static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10] = { }; const upb_msglayout google_protobuf_DescriptorProto_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, - {&upb_prm_1bt_max192b, UPB_SIZE(4503599627632658, 9007199255003154)}, - {&upb_prm_1bt_max128b, UPB_SIZE(5629499534213146, 11258999068426266)}, - {&upb_prm_1bt_max128b, UPB_SIZE(6755399441252386, 13510798882308130)}, - {&upb_prm_1bt_max64b, UPB_SIZE(7881299347963946, 15762598695862314)}, - {&upb_prm_1bt_max192b, UPB_SIZE(9007199255003186, 18014398509744178)}, - {&upb_psm_1bt_max64b, UPB_SIZE(3377777030266938, 6755476750794810)}, - {&upb_prm_1bt_max64b, UPB_SIZE(10133099161976898, 20266198323560514)}, - {&upb_prm_1bt_max64b, UPB_SIZE(11258999068557386, 22517998136983626)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_DescriptorProto_submsgs[0], &google_protobuf_DescriptorProto__fields[0], UPB_SIZE(48, 96), 10, false, 120, @@ -247,43 +136,6 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange_ }; const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813947408, 2251799813947408)}, - {&upb_psm_1bt_max64b, UPB_SIZE(3377781324906522, 4503681231749146)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0], &google_protobuf_DescriptorProto_ExtensionRange__fields[0], UPB_SIZE(16, 24), 3, false, 24, @@ -301,43 +153,6 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__ }; const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813947408, 2251799813947408)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table NULL, &google_protobuf_DescriptorProto_ReservedRange__fields[0], UPB_SIZE(16, 16), 2, false, 24, @@ -358,43 +173,6 @@ static const upb_msglayout_field google_protobuf_ExtensionRangeOptions__fields[1 }; const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_ExtensionRangeOptions_submsgs[0], &google_protobuf_ExtensionRangeOptions__fields[0], UPB_SIZE(8, 8), 1, false, 0, @@ -422,43 +200,6 @@ static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[11 }; const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(10133099165777930, 11258999072620554)}, - {&upb_pss_1bt, UPB_SIZE(12384898983657490, 15762598704185362)}, - {&upb_psv4_1bt, UPB_SIZE(6755399441580056, 6755399441580056)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813816352, 2251799813816352)}, - {&upb_psv4_1bt, UPB_SIZE(4503599627632680, 4503599627632680)}, - {&upb_pss_1bt, UPB_SIZE(14636698805731378, 20266198339944498)}, - {&upb_pss_1bt, UPB_SIZE(16888498636193850, 24769797984092218)}, - {&upb_psm_1bt_max64b, UPB_SIZE(21392214194126914, 33777113169395778)}, - {&upb_psv4_1bt, UPB_SIZE(7881299348947016, 7881299348947016)}, - {&upb_pss_1bt, UPB_SIZE(19140298483433554, 29273397645017170)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(9007199256838536, 9007199256838536)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_FieldDescriptorProto_submsgs[0], &google_protobuf_FieldDescriptorProto__fields[0], UPB_SIZE(72, 112), 11, false, 248, @@ -508,115 +249,41 @@ static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2] }; const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { -<<<<<<< HEAD -======= + &google_protobuf_OneofDescriptorProto_submsgs[0], + &google_protobuf_OneofDescriptorProto__fields[0], + UPB_SIZE(16, 32), 2, false, 24, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, {&upb_psm_1bt_max64b, UPB_SIZE(3377777029939218, 6755476750467090)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, + }, +}; + +static const upb_msglayout *const google_protobuf_EnumDescriptorProto_submsgs[3] = { + &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, + &google_protobuf_EnumOptions_msginit, + &google_protobuf_EnumValueDescriptorProto_msginit, +}; + +static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5] = { + {1, UPB_SIZE(4, 8), 1, 0, 12, 1}, + {2, UPB_SIZE(16, 32), 0, 2, 11, 3}, + {3, UPB_SIZE(12, 24), 2, 1, 11, 1}, + {4, UPB_SIZE(20, 40), 0, 0, 11, 3}, + {5, UPB_SIZE(24, 48), 0, 0, 12, 3}, +}; + +const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { + &google_protobuf_EnumDescriptorProto_submsgs[0], + &google_protobuf_EnumDescriptorProto__fields[0], + UPB_SIZE(32, 64), 5, false, 56, + { {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table - &google_protobuf_OneofDescriptorProto_submsgs[0], - &google_protobuf_OneofDescriptorProto__fields[0], - UPB_SIZE(16, 32), 2, false, 24, - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, - {&upb_psm_1bt_max64b, UPB_SIZE(3377777029939218, 6755476750467090)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, -}; - -static const upb_msglayout *const google_protobuf_EnumDescriptorProto_submsgs[3] = { - &google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit, - &google_protobuf_EnumOptions_msginit, - &google_protobuf_EnumValueDescriptorProto_msginit, -}; - -static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5] = { - {1, UPB_SIZE(4, 8), 1, 0, 12, 1}, - {2, UPB_SIZE(16, 32), 0, 2, 11, 3}, - {3, UPB_SIZE(12, 24), 2, 1, 11, 1}, - {4, UPB_SIZE(20, 40), 0, 0, 11, 3}, - {5, UPB_SIZE(24, 48), 0, 0, 12, 3}, -}; - -const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, - {&upb_prm_1bt_max64b, UPB_SIZE(4503599627501586, 9007199254872082)}, - {&upb_psm_1bt_max64b, UPB_SIZE(3377777030004762, 6755476750532634)}, - {&upb_prm_1bt_max64b, UPB_SIZE(5629499534213154, 11258999068426274)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table - &google_protobuf_EnumDescriptorProto_submsgs[0], - &google_protobuf_EnumDescriptorProto__fields[0], - UPB_SIZE(32, 64), 5, false, 56, - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, - {&upb_prm_1bt_max64b, UPB_SIZE(4503599627501586, 9007199254872082)}, - {&upb_psm_1bt_max64b, UPB_SIZE(3377777030004762, 6755476750532634)}, - {&upb_prm_1bt_max64b, UPB_SIZE(5629499534213154, 11258999068426274)}, + {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, + {&upb_prm_1bt_max64b, UPB_SIZE(4503599627501586, 9007199254872082)}, + {&upb_psm_1bt_max64b, UPB_SIZE(3377777030004762, 6755476750532634)}, + {&upb_prm_1bt_max64b, UPB_SIZE(5629499534213154, 11258999068426274)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, @@ -629,43 +296,6 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReserve }; const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813947408, 2251799813947408)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table NULL, &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0], UPB_SIZE(16, 16), 2, false, 24, @@ -688,43 +318,6 @@ static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__field }; const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(2251799813947402, 2251799813947402)}, - {&upb_psv4_1bt, UPB_SIZE(1125899906973712, 1125899906973712)}, - {&upb_psm_1bt_max64b, UPB_SIZE(4503681231749146, 6755481045434394)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_EnumValueDescriptorProto_submsgs[0], &google_protobuf_EnumValueDescriptorProto__fields[0], UPB_SIZE(24, 32), 3, false, 24, @@ -748,43 +341,6 @@ static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[ }; const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, - {&upb_prm_1bt_max128b, UPB_SIZE(4503599627370514, 9007199254741010)}, - {&upb_psm_1bt_max64b, UPB_SIZE(3377777030004762, 6755476750532634)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_ServiceDescriptorProto_submsgs[0], &google_protobuf_ServiceDescriptorProto__fields[0], UPB_SIZE(24, 48), 3, false, 24, @@ -810,43 +366,6 @@ static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6 }; const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899907366922, 2251799814209546)}, - {&upb_pss_1bt, UPB_SIZE(3377699721576466, 6755399442104338)}, - {&upb_pss_1bt, UPB_SIZE(5629499536310298, 11258999070523418)}, - {&upb_psm_1bt_max64b, UPB_SIZE(7881393837178914, 15762693185077282)}, - {&upb_psb1_1bt, UPB_SIZE(281474976841768, 281474976841768)}, - {&upb_psb1_1bt, UPB_SIZE(562949953683504, 562949953683504)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_MethodDescriptorProto_submsgs[0], &google_protobuf_MethodDescriptorProto__fields[0], UPB_SIZE(32, 64), 6, false, 56, @@ -891,43 +410,6 @@ static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { }; const upb_msglayout google_protobuf_FileOptions_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(7881299482116106, 9007199388958730)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(10133099430019138, 13510799150547010)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813816392, 2251799813816392)}, - {&upb_psb1_1bt, UPB_SIZE(4503599627632720, 4503599627632720)}, - {&upb_pss_1bt, UPB_SIZE(12384899512139866, 18014399046352986)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(4785074604605824, 4785074604605824)}, - {&upb_psb1_2bt, UPB_SIZE(5066549581840776, 5066549581840776)}, - {&upb_psb1_2bt, UPB_SIZE(5348024559600016, 5348024559600016)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(5629499538407840, 5629499538407840)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(5910974519312824, 5910974519312824)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(6192449504412120, 6192449504412120)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(6473924497900024, 6473924497900024)}, - }, ->>>>>>> fastest-table &google_protobuf_FileOptions_submsgs[0], &google_protobuf_FileOptions__fields[0], UPB_SIZE(104, 192), 21, false, 248, @@ -980,46 +462,9 @@ static const upb_msglayout_field google_protobuf_MessageOptions__fields[5] = { }; const upb_msglayout google_protobuf_MessageOptions_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_1bt, UPB_SIZE(281474976841736, 281474976841736)}, - {&upb_psb1_1bt, UPB_SIZE(562949953683472, 562949953683472)}, - {&upb_psb1_1bt, UPB_SIZE(844424930656280, 844424930656280)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_1bt, UPB_SIZE(1125899907891256, 1125899907891256)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table - &google_protobuf_MessageOptions_submsgs[0], - &google_protobuf_MessageOptions__fields[0], - UPB_SIZE(16, 16), 5, false, 56, + &google_protobuf_MessageOptions_submsgs[0], + &google_protobuf_MessageOptions__fields[0], + UPB_SIZE(16, 16), 5, false, 56, { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_psb1_1bt, UPB_SIZE(281474976841736, 281474976841736)}, @@ -1047,43 +492,6 @@ static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = { }; const upb_msglayout google_protobuf_FieldOptions_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813816328, 2251799813816328)}, - {&upb_psb1_1bt, UPB_SIZE(6755399441580048, 6755399441580048)}, - {&upb_psb1_1bt, UPB_SIZE(7036874418815000, 7036874418815000)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_1bt, UPB_SIZE(7318349396574248, 7318349396574248)}, - {&upb_psv4_1bt, UPB_SIZE(4503599627632688, 4503599627632688)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_1bt, UPB_SIZE(7599824375382096, 7599824375382096)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_FieldOptions_submsgs[0], &google_protobuf_FieldOptions__fields[0], UPB_SIZE(24, 24), 7, false, 120, @@ -1116,43 +524,6 @@ static const upb_msglayout_field google_protobuf_OneofOptions__fields[1] = { }; const upb_msglayout google_protobuf_OneofOptions_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_OneofOptions_submsgs[0], &google_protobuf_OneofOptions__fields[0], UPB_SIZE(8, 8), 1, false, 0, @@ -1172,43 +543,6 @@ static const upb_msglayout_field google_protobuf_EnumOptions__fields[3] = { }; const upb_msglayout google_protobuf_EnumOptions_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_1bt, UPB_SIZE(281474976841744, 281474976841744)}, - {&upb_psb1_1bt, UPB_SIZE(562949953683480, 562949953683480)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_EnumOptions_submsgs[0], &google_protobuf_EnumOptions__fields[0], UPB_SIZE(8, 16), 3, false, 24, @@ -1230,43 +564,6 @@ static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2] = { }; const upb_msglayout google_protobuf_EnumValueOptions_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_1bt, UPB_SIZE(281474976841736, 281474976841736)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_EnumValueOptions_submsgs[0], &google_protobuf_EnumValueOptions__fields[0], UPB_SIZE(8, 16), 2, false, 8, @@ -1286,43 +583,6 @@ static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2] = { }; const upb_msglayout google_protobuf_ServiceOptions_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_ServiceOptions_submsgs[0], &google_protobuf_ServiceOptions__fields[0], UPB_SIZE(8, 16), 2, false, 0, @@ -1342,43 +602,6 @@ static const upb_msglayout_field google_protobuf_MethodOptions__fields[3] = { }; const upb_msglayout google_protobuf_MethodOptions_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_MethodOptions_submsgs[0], &google_protobuf_MethodOptions__fields[0], UPB_SIZE(16, 24), 3, false, 0, @@ -1402,43 +625,6 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption__fields[7] }; const upb_msglayout google_protobuf_UninterpretedOption_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_prm_1bt_max64b, UPB_SIZE(15762598695796754, 22517998136852498)}, - {&upb_pss_1bt, UPB_SIZE(9007199255789594, 9007199255789594)}, - {&upb_psv8_1bt, UPB_SIZE(2251799813816352, 2251799813816352)}, - {&upb_psv8_1bt, UPB_SIZE(4503599627632680, 4503599627632680)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(11258999070523450, 13510798884208698)}, - {&upb_pss_1bt, UPB_SIZE(13510798886305858, 18014398513676354)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_UninterpretedOption_submsgs[0], &google_protobuf_UninterpretedOption__fields[0], UPB_SIZE(64, 96), 7, false, 120, @@ -1468,43 +654,6 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__f }; const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899907104778, 2251799813947402)}, - {&upb_psb1_1bt, UPB_SIZE(281474976841744, 281474976841744)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table NULL, &google_protobuf_UninterpretedOption_NamePart__fields[0], UPB_SIZE(16, 32), 2, false, 24, @@ -1525,43 +674,6 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1] = { }; const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_prm_1bt_max128b, UPB_SIZE(10, 10)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_SourceCodeInfo_submsgs[0], &google_protobuf_SourceCodeInfo__fields[0], UPB_SIZE(8, 8), 1, false, 8, @@ -1580,43 +692,6 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields }; const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899906973722, 2251799813816346)}, - {&upb_pss_1bt, UPB_SIZE(3377699720790050, 6755399441317922)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table NULL, &google_protobuf_SourceCodeInfo_Location__fields[0], UPB_SIZE(32, 64), 5, false, 56, @@ -1641,43 +716,6 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1] = }; const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_prm_1bt_max64b, UPB_SIZE(10, 10)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table &google_protobuf_GeneratedCodeInfo_submsgs[0], &google_protobuf_GeneratedCodeInfo__fields[0], UPB_SIZE(8, 8), 1, false, 8, @@ -1695,43 +733,6 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__f }; const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { -<<<<<<< HEAD -======= - { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(3377699721052178, 4503599627894802)}, - {&upb_psv4_1bt, UPB_SIZE(1125899906973720, 1125899906973720)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813947424, 2251799813947424)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - }, ->>>>>>> fastest-table NULL, &google_protobuf_GeneratedCodeInfo_Annotation__fields[0], UPB_SIZE(24, 48), 4, false, 56, From d0e4b688c60e7ae178911290f0eb0f0144d818b8 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 15 Oct 2020 20:59:52 -0700 Subject: [PATCH 60/88] Shorten name of kAliasString, so benchmark results don't wrap. --- tests/benchmark.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/benchmark.cc b/tests/benchmark.cc index c608572764..c27c8514ac 100644 --- a/tests/benchmark.cc +++ b/tests/benchmark.cc @@ -149,7 +149,7 @@ using FileDescSV = ::upb_benchmark::sv::FileDescriptorProto; const protobuf::MessageLite::ParseFlags kMergePartial = protobuf::MessageLite::ParseFlags::kMergePartial; -const protobuf::MessageLite::ParseFlags kAliasStrings = +const protobuf::MessageLite::ParseFlags kAlias = protobuf::MessageLite::ParseFlags::kMergePartialWithAliasing; template class Factory, @@ -175,9 +175,9 @@ BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDesc, WithInitialBlock); //BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, NoArena); //BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, WithArena); BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, WithInitialBlock); -//BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, NoArena, kAliasStrings); -//BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, WithArena, kAliasStrings); -BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, WithInitialBlock, kAliasStrings); +//BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, NoArena, kAlias); +//BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, WithArena, kAlias); +BENCHMARK_TEMPLATE(BM_Parse_Proto2, FileDescSV, WithInitialBlock, kAlias); static void BM_SerializeDescriptor_Proto2(benchmark::State& state) { size_t bytes = 0; From 9e68ec033fccc5b05638f399cf8b65d22936e8b5 Mon Sep 17 00:00:00 2001 From: gerben-s Date: Fri, 16 Oct 2020 14:55:28 -0700 Subject: [PATCH 61/88] Add repeated varints and fixed parsers --- BUILD | 1 + .../google/protobuf/descriptor.upb.c | 14 +- upb/decode.c | 4 +- upb/decode.int.h | 39 ++- upb/decode_fast.c | 273 +++++++++++++----- upb/decode_fast.h | 10 +- upb/def.c | 1 + upbc/generator.cc | 21 +- 8 files changed, 273 insertions(+), 90 deletions(-) diff --git a/BUILD b/BUILD index d74b66120a..59c61f9df2 100644 --- a/BUILD +++ b/BUILD @@ -41,6 +41,7 @@ CPPOPTS = [ COPTS = CPPOPTS + [ # copybara:strip_for_google3_begin #"-pedantic", + #"-Wno-gnu-flexible-array-initializer", #"-Werror=pedantic", "-std=gnu11", "-Wstrict-prototypes", diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index 9a412110df..7c880f9be7 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -62,15 +62,15 @@ const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, {&upb_pss_1bt, UPB_SIZE(3377699720790034, 6755399441317906)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prs_1bt, UPB_SIZE(10133099161583642, 20266198323167258)}, {&upb_prm_1bt_max128b, UPB_SIZE(11258999068426274, 22517998136852514)}, {&upb_prm_1bt_max128b, UPB_SIZE(12384898975334442, 24769797950603306)}, {&upb_prm_1bt_max64b, UPB_SIZE(13510798882373682, 27021597764485170)}, {&upb_prm_1bt_max128b, UPB_SIZE(14636698789085242, 29273397578039354)}, {&upb_psm_1bt_max256b, UPB_SIZE(7881385247440962, 15762684595339330)}, {&upb_psm_1bt_max64b, UPB_SIZE(9007289449381962, 18014488704122954)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prv4_1bt, UPB_SIZE(15762598695796816, 31525197391593552)}, + {&upb_prv4_1bt, UPB_SIZE(16888498602639448, 33776997205278808)}, {&upb_pss_1bt, UPB_SIZE(5629499534737506, 11258999068950626)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, @@ -116,7 +116,7 @@ const upb_msglayout google_protobuf_DescriptorProto_msginit = { {&upb_psm_1bt_max64b, UPB_SIZE(3377777030266938, 6755476750794810)}, {&upb_prm_1bt_max64b, UPB_SIZE(10133099161976898, 20266198323560514)}, {&upb_prm_1bt_max64b, UPB_SIZE(11258999068557386, 22517998136983626)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prs_1bt, UPB_SIZE(12384898975268946, 24769797950537810)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, @@ -284,7 +284,7 @@ const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { {&upb_prm_1bt_max64b, UPB_SIZE(4503599627501586, 9007199254872082)}, {&upb_psm_1bt_max64b, UPB_SIZE(3377777030004762, 6755476750532634)}, {&upb_prm_1bt_max64b, UPB_SIZE(5629499534213154, 11258999068426274)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prs_1bt, UPB_SIZE(6755399441055786, 13510798882111530)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, }, @@ -635,7 +635,7 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { {&upb_pss_1bt, UPB_SIZE(9007199255789594, 9007199255789594)}, {&upb_psv8_1bt, UPB_SIZE(2251799813816352, 2251799813816352)}, {&upb_psv8_1bt, UPB_SIZE(4503599627632680, 4503599627632680)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psf8_1bt, UPB_SIZE(6755399441580081, 6755399441580081)}, {&upb_pss_1bt, UPB_SIZE(11258999070523450, 13510798884208698)}, {&upb_pss_1bt, UPB_SIZE(13510798886305858, 18014398513676354)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, @@ -702,7 +702,7 @@ const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { {&upb_pss_1bt, UPB_SIZE(1125899906973722, 2251799813816346)}, {&upb_pss_1bt, UPB_SIZE(3377699720790050, 6755399441317922)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prs_1bt, UPB_SIZE(7881299347898418, 15762598695796786)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, }, }; diff --git a/upb/decode.c b/upb/decode.c index eb40f67ca9..5c32c26fe2 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -627,8 +627,8 @@ const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, UPB_NOINLINE static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *layout) { - if (msg) { - ptr = fastdecode_dispatch(d, ptr, msg, decode_totable(layout), 0); + if (msg && layout->table_mask != (unsigned char)-1) { + ptr = fastdecode_dispatch(d, ptr, msg, decode_totable(layout), 0); } else { while (ptr < d->limit) { decode_parseret ret = decode_field(d, ptr, msg, layout); diff --git a/upb/decode.int.h b/upb/decode.int.h index bcaf0c073b..981a2b8cbe 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -10,6 +10,7 @@ #include "upb/msg.h" #include "upb/upb.int.h" +#include "upb/decode_fast.h" /* Must be last. */ #include "upb/port_def.inc" @@ -24,9 +25,6 @@ typedef struct upb_decstate { jmp_buf err; } upb_decstate; -const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, - intptr_t table, uint64_t hasbits); - /* Error function that will abort decoding with longjmp(). We can't declare this * UPB_NORETURN, even though it is appropriate, because if we do then compilers * will "helpfully" refuse to tailcall to it @@ -46,6 +44,41 @@ UPB_INLINE const upb_msglayout *decode_totablep(intptr_t table) { return (void*)(table >> 8); } +UPB_FORCEINLINE static +const char *fastdecode_tagdispatch(upb_decstate *d, const char *ptr, + upb_msg *msg, intptr_t table, + uint64_t hasbits, uint32_t tag) { + const upb_msglayout *table_p = decode_totablep(table); + uint8_t mask = table; + uint64_t data; + size_t idx = tag & mask; + __builtin_assume((idx & 7) == 0); + idx >>= 3; + data = table_p->fasttable[idx].field_data ^ tag; + return table_p->fasttable[idx].field_parser(d, ptr, msg, table, hasbits, data); +} + +UPB_FORCEINLINE static +uint32_t fastdecode_loadtag(const char* ptr) { + uint16_t tag; + memcpy(&tag, ptr, 2); + return tag; +} + +UPB_FORCEINLINE static +const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, + intptr_t table, uint64_t hasbits) { + if (UPB_UNLIKELY(ptr >= d->fastlimit)) { + if (UPB_LIKELY(ptr == d->limit)) { + *(uint32_t*)msg |= hasbits >> 16; /* Sync hasbits. */ + return ptr; + } + uint64_t data = 0; + return fastdecode_generic(d, ptr, msg, table, hasbits, data); + } + return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, fastdecode_loadtag(ptr)); +} + #include "upb/port_undef.inc" #endif /* UPB_DECODE_INT_H_ */ diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 773e2e78fd..9ba1c76d06 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -47,50 +47,6 @@ upb_msg *decode_newmsg_ceil(upb_decstate *d, size_t size, int msg_ceil_bytes) { return msg_data + sizeof(upb_msg_internal); } -UPB_FORCEINLINE -const char *fastdecode_tagdispatch(upb_decstate *d, const char *ptr, - upb_msg *msg, intptr_t table, - uint64_t hasbits, uint32_t tag) { - const upb_msglayout *table_p = decode_totablep(table); - uint8_t mask = table; - - // Get N bits of field number, based on the message table size. - size_t idx = tag & mask; - __builtin_assume((idx & 7) == 0); - idx >>= 3; - uint64_t data = table_p->fasttable[idx].field_data ^ tag; - - // Jump to the specialized field parser function. - return table_p->fasttable[idx].field_parser(UPB_PARSE_ARGS); -} - -UPB_FORCEINLINE -static uint32_t fastdecode_loadtag(const char *ptr) { - uint16_t tag; - memcpy(&tag, ptr, 2); - return tag; -} - -UPB_FORCEINLINE -const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, - intptr_t table, uint64_t hasbits) { - if (UPB_UNLIKELY(ptr >= d->fastlimit)) { - if (UPB_LIKELY(ptr == d->limit)) { - // Parse is finished. - *(uint32_t*)msg |= hasbits >> 16; // Sync hasbits. - return ptr; - } - // We are within 16 bytes of end-of-buffer, so we can't use fast parsing - // functions anymore (they will read up to 16b without bounds checks). - uint64_t data = 0; - RETURN_GENERIC("dispatch hit end\n"); - } - - // Read two bytes of tag data (for a one-byte tag, the high byte is junk). - uint16_t tag = fastdecode_loadtag(ptr); - return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, tag); -} - UPB_FORCEINLINE static bool fastdecode_checktag(uint64_t data, int tagbytes) { if (tagbytes == 1) { @@ -145,14 +101,6 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, } } -UPB_FORCEINLINE -static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, - uint64_t *data, uint64_t *hasbits, - int valbytes, upb_card card) { - return fastdecode_getfield_ofs(d, ptr, msg, data, hasbits, NULL, NULL, - valbytes, card, false); -} - /* varint fields **************************************************************/ UPB_FORCEINLINE @@ -179,8 +127,33 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { RETURN_GENERIC("varint field tag mismatch\n"); } - dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, valbytes, - card); + + upb_array* arr; + void* end; + dst = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &arr, &end, + valbytes, card, false); + if (card == CARD_r) { + if (UPB_UNLIKELY(!dst)) { + RETURN_GENERIC("need array resize\n"); + } + } + +again: + if (card == CARD_r) { + if (UPB_UNLIKELY(dst == end)) { + size_t old_size = arr->size; + size_t old_bytes = old_size * valbytes; + size_t new_size = old_size * 2; + size_t new_bytes = new_size * valbytes; + char *old_ptr = _upb_array_ptr(arr); + char *new_ptr = upb_arena_realloc(&d->arena, old_ptr, old_bytes, new_bytes); + arr->size = new_size; + arr->data = _upb_array_tagptr(new_ptr, 3); + dst = (void*)(new_ptr + (old_size * valbytes)); + end = (void*)(new_ptr + (new_size * valbytes)); + } + } + ptr += tagbytes + 1; val = (uint8_t)ptr[-1]; if (UPB_UNLIKELY(val & 0x80)) { @@ -193,12 +166,32 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, } ptr++; uint64_t byte = (uint8_t)ptr[-1]; - if (byte > 1) return fastdecode_err(d); + if (byte > 1) { + return fastdecode_err(d); + } val += (byte - 1) << 63; } done: val = fastdecode_munge(val, valbytes, zigzag); memcpy(dst, &val, valbytes); + + if (card == CARD_r) { + dst = (char*)dst + valbytes; + if (UPB_LIKELY(ptr < d->fastlimit)) { + uint32_t tag = fastdecode_loadtag(ptr); + if (tagbytes == 1) { + if ((uint8_t)tag == (uint8_t)data) goto again; + } else { + if ((uint16_t)tag == (uint16_t)data) goto again; + } + arr->len = (size_t)((char*)dst - (char*)_upb_array_ptr(arr)) / valbytes; + return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, tag); + } else { + arr->len = (size_t)((char*)dst - (char*)_upb_array_ptr(arr)) / valbytes; + RETURN_GENERIC("repeated generic"); + } + } + return fastdecode_dispatch(d, ptr, msg, table, hasbits); } @@ -228,14 +221,94 @@ done: TAGBYTES(s) TAGBYTES(o) -/* TAGBYTES(r) */ +TAGBYTES(r) #undef z_ZZ #undef b_ZZ #undef v_ZZ -#undef o_ONEOF -#undef s_ONEOF -#undef r_ONEOF +#undef F +#undef TYPES +#undef TAGBYTES + +/* fixed fields ***************************************************************/ + +UPB_FORCEINLINE +static const char *fastdecode_fixed(UPB_PARSE_PARAMS, int tagbytes, + int valbytes, upb_card card) { + void *dst; + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + RETURN_GENERIC("varint field tag mismatch\n"); + } + upb_array* arr; + void* end; + dst = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &arr, &end, + valbytes, card, false); + if (card == CARD_r) { + if (UPB_UNLIKELY(!dst)) { + RETURN_GENERIC("need array resize\n"); + } + } + +again: + if (card == CARD_r) { + if (UPB_UNLIKELY(dst == end)) { + size_t old_size = arr->size; + size_t old_bytes = old_size * valbytes; + size_t new_size = old_size * 2; + size_t new_bytes = new_size * valbytes; + char *old_ptr = _upb_array_ptr(arr); + char *new_ptr = upb_arena_realloc(&d->arena, old_ptr, old_bytes, new_bytes); + arr->size = new_size; + arr->data = _upb_array_tagptr(new_ptr, 3); + dst = (void*)(new_ptr + (old_size * valbytes)); + end = (void*)(new_ptr + (new_size * valbytes)); + } + } + + ptr += tagbytes; + memcpy(dst, ptr, valbytes); + ptr += valbytes; + + if (card == CARD_r) { + dst = (char*)dst + valbytes; + if (UPB_LIKELY(ptr < d->fastlimit)) { + uint32_t tag = fastdecode_loadtag(ptr); + if (tagbytes == 1) { + if ((uint8_t)tag == (uint8_t)data) goto again; + } else { + if ((uint16_t)tag == (uint16_t)data) goto again; + } + arr->len = (size_t)((char*)dst - (char*)_upb_array_ptr(arr)) / valbytes; + return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, tag); + } else { + arr->len = (size_t)((char*)dst - (char*)_upb_array_ptr(arr)) / valbytes; + RETURN_GENERIC("repeated generic"); + } + } + + return fastdecode_dispatch(d, ptr, msg, table, hasbits); +} + +/* Generate all varint functions. + * {s,o,r} x {b1,v4,z4,v8,z8} x {1bt,2bt} */ + +#define F(card, type, valbytes, tagbytes) \ + const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ + return fastdecode_fixed(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card); \ + } + +#define TYPES(card, tagbytes) \ + F(card, f, 4, tagbytes) \ + F(card, f, 8, tagbytes) + +#define TAGBYTES(card) \ + TYPES(card, 1) \ + TYPES(card, 2) + +TAGBYTES(s) +TAGBYTES(o) +TAGBYTES(r) + #undef F #undef TYPES #undef TAGBYTES @@ -261,35 +334,92 @@ static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, RETURN_GENERIC("string field tag mismatch\n"); } - dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, - sizeof(upb_strview), card); + upb_array* arr; + void* end; + dst = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &arr, &end, + sizeof(upb_strview), card, false); + if (card == CARD_r) { + if (UPB_UNLIKELY(!dst)) { + RETURN_GENERIC("need array resize\n"); + } + } + +again: + if (card == CARD_r) { + if (UPB_UNLIKELY(dst == end)) { + size_t old_size = arr->size; + size_t old_bytes = old_size * sizeof(upb_strview); + size_t new_size = old_size * 2; + size_t new_bytes = new_size * sizeof(upb_strview); + char *old_ptr = _upb_array_ptr(arr); + char *new_ptr = upb_arena_realloc(&d->arena, old_ptr, old_bytes, new_bytes); + arr->size = new_size; + arr->data = _upb_array_tagptr(new_ptr, 3); + dst = (void*)(new_ptr + (old_size * sizeof(upb_strview*))); + end = (void*)(new_ptr + (new_size * sizeof(upb_strview*))); + } + } + len = (int8_t)ptr[tagbytes]; str = ptr + tagbytes + 1; dst->data = str; dst->size = len; + ptr = str + len; if (UPB_UNLIKELY(fastdecode_boundscheck(str, len, d->limit))) { dst->size = 0; - RETURN_GENERIC("string field len >1 byte\n"); + goto generic; + } + if (card == CARD_r) { + dst++; + if (UPB_LIKELY(ptr < d->fastlimit)) { + uint32_t tag = fastdecode_loadtag(ptr); + if (tagbytes == 1) { + if ((uint8_t)tag == (uint8_t)data) goto again; + } else { + if ((uint16_t)tag == (uint16_t)data) goto again; + } + arr->len = dst - (upb_strview*)_upb_array_ptr(arr); + return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, tag); + } else { + goto generic; + } + } + if (card == CARD_r) { + arr->len = dst - (upb_strview*)_upb_array_ptr(arr); + } + return fastdecode_dispatch(d, ptr, msg, table, hasbits); + +generic: + if (card == CARD_r) { + arr->len = dst - (upb_strview*)_upb_array_ptr(arr); } - return fastdecode_dispatch(d, str + len, msg, table, hasbits); + RETURN_GENERIC("repeated generic"); } const char *upb_pss_1bt(UPB_PARSE_PARAMS) { return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_s); } -const char *upb_pos_1bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_o); -} - const char *upb_pss_2bt(UPB_PARSE_PARAMS) { return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_s); } +const char *upb_pos_1bt(UPB_PARSE_PARAMS) { + return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_o); +} + const char *upb_pos_2bt(UPB_PARSE_PARAMS) { return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_o); } +const char *upb_prs_1bt(UPB_PARSE_PARAMS) { + return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_r); +} + +const char *upb_prs_2bt(UPB_PARSE_PARAMS) { + return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_r); +} + /* message fields *************************************************************/ UPB_NOINLINE @@ -350,6 +480,12 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, hasbits = 0; } + if (card == CARD_r) { + if (UPB_UNLIKELY(!submsg)) { + RETURN_GENERIC("need array resize\n"); + } + } + const char *saved_limit = d->limit; const char *saved_fastlimit = d->fastlimit; @@ -368,7 +504,7 @@ again: end = (void*)(new_ptr + (new_size * sizeof(upb_msg*))); } } - + upb_msg* child = *submsg; if (card == CARD_r || UPB_LIKELY(!child)) { @@ -413,7 +549,6 @@ again: d->depth++; return fastdecode_dispatch(d, ptr, msg, table, hasbits); - repeated_generic: arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); d->limit = saved_limit; diff --git a/upb/decode_fast.h b/upb/decode_fast.h index 441b6aa340..335e83745b 100644 --- a/upb/decode_fast.h +++ b/upb/decode_fast.h @@ -29,20 +29,24 @@ const char *fastdecode_generic(struct upb_decstate *d, const char *ptr, F(card, v, 4, tagbytes) \ F(card, v, 8, tagbytes) \ F(card, z, 4, tagbytes) \ - F(card, z, 8, tagbytes) + F(card, z, 8, tagbytes) \ + F(card, f, 4, tagbytes) \ + F(card, f, 8, tagbytes) #define TAGBYTES(card) \ TYPES(card, 1) \ TYPES(card, 2) TAGBYTES(s) -TAGBYTES(o) -/* TAGBYTES(r) */ +// TAGBYTES(o) +TAGBYTES(r) const char *upb_pss_1bt(UPB_PARSE_PARAMS); const char *upb_pss_2bt(UPB_PARSE_PARAMS); const char *upb_pos_1bt(UPB_PARSE_PARAMS); const char *upb_pos_2bt(UPB_PARSE_PARAMS); +const char *upb_prs_1bt(UPB_PARSE_PARAMS); +const char *upb_prs_2bt(UPB_PARSE_PARAMS); #undef F #undef TYPES diff --git a/upb/def.c b/upb/def.c index c392781331..f1c4e3f0d2 100644 --- a/upb/def.c +++ b/upb/def.c @@ -6,6 +6,7 @@ #include #include #include "google/protobuf/descriptor.upb.h" +#include "upb/decode.int.h" #include "upb/port_def.inc" diff --git a/upbc/generator.cc b/upbc/generator.cc index 5dbf0206a6..b374c4aef9 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -777,18 +777,27 @@ void TryFillTableEntry(const protobuf::Descriptor* message, type = "m"; wire_type = 2; break; + case protobuf::FieldDescriptor::TYPE_FIXED32: + case protobuf::FieldDescriptor::TYPE_SFIXED32: + case protobuf::FieldDescriptor::TYPE_FLOAT: + type = "f4"; + wire_type = 5; + break; + case protobuf::FieldDescriptor::TYPE_FIXED64: + case protobuf::FieldDescriptor::TYPE_SFIXED64: + case protobuf::FieldDescriptor::TYPE_DOUBLE: + type = "f8"; + wire_type = 1; + break; default: return; // Not supported yet. } switch (field->label()) { case protobuf::FieldDescriptor::LABEL_REPEATED: - if (field->type() == protobuf::FieldDescriptor::TYPE_MESSAGE) { - cardinality = "r"; - break; - } else { - return; // Not supported yet. - } + if (field->is_packed()) return; // Packed fields are not supported + cardinality = "r"; + break; case protobuf::FieldDescriptor::LABEL_OPTIONAL: case protobuf::FieldDescriptor::LABEL_REQUIRED: if (field->real_containing_oneof()) { From a345af9883f6a16022c7599807258ab37d9d6158 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 18 Oct 2020 13:39:13 -0700 Subject: [PATCH 62/88] Added a codegen parameter for whether fasttables are generated or not. Example: $ CC=clang bazel build -c opt --copt=-g benchmarks:benchmark --//:fasttable_enabled=false INFO: Build option --//:fasttable_enabled has changed, discarding analysis cache. INFO: Analyzed target //benchmarks:benchmark (0 packages loaded, 913 targets configured). INFO: Found 1 target... Target //benchmarks:benchmark up-to-date: bazel-bin/benchmarks/benchmark INFO: Elapsed time: 0.760s, Critical Path: 0.58s INFO: 7 processes: 1 internal, 6 linux-sandbox. INFO: Build completed successfully, 7 total actions $ bazel-bin/benchmarks/benchmark --benchmark_filter=BM_Parse_Upb ------------------------------------------------------------------------------ Benchmark Time CPU Iterations ------------------------------------------------------------------------------ BM_Parse_Upb_FileDesc_WithArena 10985 ns 10984 ns 63567 651.857MB/s BM_Parse_Upb_FileDesc_WithInitialBlock 10556 ns 10554 ns 66138 678.458MB/s $ CC=clang bazel build -c opt --copt=-g benchmarks:benchmark --//:fasttable_enabled=true INFO: Build option --//:fasttable_enabled has changed, discarding analysis cache. INFO: Analyzed target //benchmarks:benchmark (0 packages loaded, 913 targets configured). INFO: Found 1 target... Target //benchmarks:benchmark up-to-date: bazel-bin/benchmarks/benchmark INFO: Elapsed time: 0.744s, Critical Path: 0.58s INFO: 7 processes: 1 internal, 6 linux-sandbox. INFO: Build completed successfully, 7 total actions $ bazel-bin/benchmarks/benchmark --benchmark_filter=BM_Parse_Upb ------------------------------------------------------------------------------ Benchmark Time CPU Iterations ------------------------------------------------------------------------------ BM_Parse_Upb_FileDesc_WithArena 3284 ns 3284 ns 213495 2.1293GB/s BM_Parse_Upb_FileDesc_WithInitialBlock 2882 ns 2882 ns 243069 2.4262GB/s Biggest unknown is whether this parameter should default to true or false. --- BUILD | 7 +++++++ bazel/upb_proto_library.bzl | 28 +++++++++++++++++++++++++++- cmake/make_cmakelists.py | 3 +++ upbc/generator.cc | 18 +++++++++++++----- 4 files changed, 50 insertions(+), 6 deletions(-) diff --git a/BUILD b/BUILD index b5efeb2dae..3789b98f42 100644 --- a/BUILD +++ b/BUILD @@ -5,6 +5,7 @@ load( ) load( "//bazel:upb_proto_library.bzl", + "upb_fasttable_enabled", "upb_proto_library", "upb_proto_reflection_library", ) @@ -35,6 +36,12 @@ config_setting( constraint_values = ["@bazel_tools//platforms:windows"], ) +upb_fasttable_enabled( + name = "fasttable_enabled", + build_setting_default = True, + visibility = ["//visibility:public"], +) + # Public C/C++ libraries ####################################################### cc_library( diff --git a/bazel/upb_proto_library.bzl b/bazel/upb_proto_library.bzl index c09cb3d127..6c56293b52 100644 --- a/bazel/upb_proto_library.bzl +++ b/bazel/upb_proto_library.bzl @@ -106,6 +106,28 @@ def _cc_library_func(ctx, name, hdrs, srcs, dep_ccinfos): linking_context = linking_context, ) +# Build setting for whether fasttable code generation is enabled ############### + +_FastTableEnabled = provider( + fields = { + "enabled": "whether fasttable is enabled", + }, +) + +def fasttable_enabled_impl(ctx): + raw_setting = ctx.build_setting_value + + if raw_setting: + # TODO(haberman): check that the target CPU supports fasttable. + pass + + return _FastTableEnabled(enabled = raw_setting) + +upb_fasttable_enabled = rule( + implementation = fasttable_enabled_impl, + build_setting = config.bool(flag = True) +) + # upb_proto_library / upb_proto_reflection_library shared code ################# GeneratedSrcsInfo = provider( @@ -127,6 +149,8 @@ def _compile_upb_protos(ctx, proto_info, proto_sources, ext): srcs = [_generate_output_file(ctx, name, ext + ".c") for name in proto_sources] hdrs = [_generate_output_file(ctx, name, ext + ".h") for name in proto_sources] transitive_sets = proto_info.transitive_descriptor_sets.to_list() + fasttable_enabled = ctx.attr._fasttable_enabled[_FastTableEnabled].enabled + codegen_params = "fasttable:" if fasttable_enabled else "" ctx.actions.run( inputs = depset( direct = [proto_info.direct_descriptor_set], @@ -136,7 +160,7 @@ def _compile_upb_protos(ctx, proto_info, proto_sources, ext): outputs = srcs + hdrs, executable = ctx.executable._protoc, arguments = [ - "--upb_out=" + _get_real_root(srcs[0]), + "--upb_out=" + codegen_params + _get_real_root(srcs[0]), "--plugin=protoc-gen-upb=" + ctx.executable._upbc.path, "--descriptor_set_in=" + ctx.configuration.host_path_separator.join([f.path for f in transitive_sets]), ] + @@ -240,6 +264,7 @@ _upb_proto_library_aspect = aspect( "//:upb", ]), "_ext": attr.string(default = ".upb"), + "_fasttable_enabled": attr.label(default = "//:fasttable_enabled") }), implementation = _upb_proto_library_aspect_impl, provides = [ @@ -295,6 +320,7 @@ _upb_proto_reflection_library_aspect = aspect( ], ), "_ext": attr.string(default = ".upbdefs"), + "_fasttable_enabled": attr.label(default = "//:fasttable_enabled") }), implementation = _upb_proto_reflection_library_aspect_impl, provides = [ diff --git a/cmake/make_cmakelists.py b/cmake/make_cmakelists.py index 3582d0543a..a750717326 100755 --- a/cmake/make_cmakelists.py +++ b/cmake/make_cmakelists.py @@ -141,6 +141,9 @@ class BuildFileFunctions(object): def config_setting(self, **kwargs): pass + def upb_fasttable_enabled(self, **kwargs): + pass + def select(self, arg_dict): return [] diff --git a/upbc/generator.cc b/upbc/generator.cc index b374c4aef9..f34858203e 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -883,7 +883,8 @@ std::vector FastDecodeTable(const protobuf::Descriptor* message, return table; } -void WriteSource(const protobuf::FileDescriptor* file, Output& output) { +void WriteSource(const protobuf::FileDescriptor* file, Output& output, + bool fasttable_enabled) { EmitFileWarning(file, output); output( @@ -975,7 +976,13 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output) { output("};\n\n"); } - std::vector table = FastDecodeTable(message, layout); + std::vector table; + uint8_t table_mask = -1; + + if (fasttable_enabled) { + table = FastDecodeTable(message, layout); + table_mask = (table.size() - 1) << 3; + } output("const upb_msglayout $0 = {\n", MessageInit(message)); output(" $0,\n", submsgs_array_ref); @@ -983,7 +990,7 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output) { output(" $0, $1, $2, $3,\n", GetSizeInit(layout.message_size()), field_number_order.size(), "false", // TODO: extendable - (table.size() - 1) << 3 + table_mask ); output(" {\n"); for (const auto& ent : table) { @@ -1120,14 +1127,15 @@ void WriteDefSource(const protobuf::FileDescriptor* file, Output& output) { } bool Generator::Generate(const protobuf::FileDescriptor* file, - const std::string& /* parameter */, + const std::string& parameter, protoc::GeneratorContext* context, std::string* /* error */) const { + bool fasttable_enabled = parameter == "fasttable"; Output h_output(context->Open(HeaderFilename(file->name()))); WriteHeader(file, h_output); Output c_output(context->Open(SourceFilename(file->name()))); - WriteSource(file, c_output); + WriteSource(file, c_output, fasttable_enabled); Output h_def_output(context->Open(DefHeaderFilename(file->name()))); WriteDefHeader(file, h_def_output); From d5f5db2729d7ad34ab190519a3d829e2a56cd844 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 21 Oct 2020 20:10:15 -0700 Subject: [PATCH 63/88] Put string-copying field parser into a separate function. This helps to regain a bit of lost perf. Now at 2.3GB/s. --- upb/decode_fast.c | 70 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 21 deletions(-) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index c8961d77eb..e77e85947e 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -19,9 +19,9 @@ #define UPB_PARSE_ARGS d, ptr, msg, table, hasbits, data -#define RETURN_GENERIC(msg) \ - /* fprintf(stderr, msg); */ \ - return fastdecode_generic(UPB_PARSE_ARGS); +#define RETURN_GENERIC(m) \ + /* fprintf(stderr, m); */ \ + return fastdecode_generic(d, ptr, msg, table, hasbits, 0); typedef enum { CARD_s = 0, /* Singular (optional, non-repeated) */ @@ -264,26 +264,37 @@ static bool fastdecode_boundscheck(const char *ptr, size_t len, return res < uptr || res > uend; } -UPB_NOINLINE +typedef const char *fastdecode_copystr_func(struct upb_decstate *d, + const char *ptr, upb_msg *msg, + const upb_msglayout *table, + uint64_t hasbits, upb_strview *dst); + +UPB_FORCEINLINE static const char *fastdecode_copystring(struct upb_decstate *d, - size_t len, upb_msg *msg, + const char *ptr, upb_msg *msg, const upb_msglayout *table, - uint64_t hasbits, upb_strview *str) { - char *ptr = (char*)str->data; + uint64_t hasbits, upb_strview *dst, + int tagbytes) { + int64_t len = (int8_t)*ptr; + ptr++; + if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit_ptr))) { + ptr -= tagbytes + 1; + RETURN_GENERIC("string field len >1 byte\n"); + } char *data = upb_arena_malloc(&d->arena, len); if (!data) { return fastdecode_err(d); } memcpy(data, ptr, len); - str->data = data; + dst->data = data; + dst->size = len; return fastdecode_dispatch(d, ptr + len, msg, table, hasbits); } UPB_FORCEINLINE static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, - upb_card card) { + upb_card card, fastdecode_copystr_func *func) { upb_strview *dst; - const char *str; int64_t len; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { RETURN_GENERIC("string field tag mismatch\n"); @@ -291,34 +302,51 @@ static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, sizeof(upb_strview), card); + if (UPB_UNLIKELY(!d->alias)) { + return func(d, ptr + tagbytes, msg, table, hasbits, dst); + } + + len = (int8_t)ptr[tagbytes]; - str = ptr + tagbytes + 1; - dst->data = str; + ptr += tagbytes + 1; + dst->data = ptr; dst->size = len; - if (UPB_UNLIKELY(fastdecode_boundscheck(str, len, d->limit_ptr))) { + if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit_ptr))) { dst->size = 0; + ptr -= tagbytes + 1; RETURN_GENERIC("string field len >1 byte\n"); } - if (!d->alias) { - return fastdecode_copystring(d, len, msg, table, hasbits, dst); - } - return fastdecode_dispatch(d, str + len, msg, table, hasbits); + return fastdecode_dispatch(d, ptr + len, msg, table, hasbits); +} + +UPB_NOINLINE +static const char *upb_copystr_1bt(upb_decstate *d, const char *ptr, + upb_msg *msg, const upb_msglayout *table, + uint64_t hasbits, upb_strview *dst) { + return fastdecode_copystring(d, ptr, msg, table, hasbits, dst, 1); +} + +UPB_NOINLINE +static const char *upb_copystr_2bt(upb_decstate *d, const char *ptr, upb_msg *msg, + const upb_msglayout *table, uint64_t hasbits, + upb_strview *dst) { + return fastdecode_copystring(d, ptr, msg, table, hasbits, dst, 2); } const char *upb_pss_1bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_s); + return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_s, &upb_copystr_1bt); } const char *upb_pos_1bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_o); + return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_o, &upb_copystr_1bt); } const char *upb_pss_2bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_s); + return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_s, &upb_copystr_2bt); } const char *upb_pos_2bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_o); + return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_o, &upb_copystr_2bt); } /* message fields *************************************************************/ From 199c914295bed3fa53c3a8e1c0a81b7452095080 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 21 Oct 2020 23:56:33 -0700 Subject: [PATCH 64/88] Simplify push/pop when msg fits in the current buffer. --- upb/decode.c | 13 +++++++++++++ upb/decode.int.h | 15 --------------- upb/decode_fast.c | 36 +++++++++++++++++++++++++++++++++--- 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/upb/decode.c b/upb/decode.c index 3dc5516cfe..2715a0f5ef 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -234,6 +234,19 @@ static const char *decode_varint64(upb_decstate *d, const char *ptr, } } +static int decode_pushlimit(upb_decstate *d, const char *ptr, int size) { + int limit = size + (int)(ptr - d->end); + int delta = d->limit - limit; + d->limit = limit; + d->limit_ptr = d->end + UPB_MIN(0, limit); + return delta; +} + +static void decode_poplimit(upb_decstate *d, int saved_delta) { + d->limit += saved_delta; + d->limit_ptr = d->end + UPB_MIN(0, d->limit); +} + UPB_FORCEINLINE static const char *decode_varint32(upb_decstate *d, const char *ptr, uint32_t *val) { diff --git a/upb/decode.int.h b/upb/decode.int.h index b9134a436c..e8cb28f697 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -74,21 +74,6 @@ bool decode_isdone(upb_decstate *d, const char **ptr) { } } -UPB_INLINE -int decode_pushlimit(upb_decstate *d, const char *ptr, int size) { - int limit = size + (int)(ptr - d->end); - int delta = d->limit - limit; - d->limit = limit; - d->limit_ptr = d->end + UPB_MIN(0, limit); - return delta; -} - -UPB_INLINE -void decode_poplimit(upb_decstate *d, int saved_delta) { - d->limit += saved_delta; - d->limit_ptr = d->end + UPB_MIN(0, d->limit); -} - #include "upb/port_undef.inc" #endif /* UPB_DECODE_INT_H_ */ diff --git a/upb/decode_fast.c b/upb/decode_fast.c index e77e85947e..40232a5c6d 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -48,6 +48,37 @@ upb_msg *decode_newmsg_ceil(upb_decstate *d, const upb_msglayout *l, return msg_data + sizeof(upb_msg_internal); } +typedef struct { + const char *limit_ptr; + int val; /* If <=0, the old limit, else a delta */ +} fastdecode_savedlimit; + +static fastdecode_savedlimit fastdecode_pushlimit(upb_decstate *d, + const char *ptr, int size) { + fastdecode_savedlimit saved; + int limit = size + (int)(ptr - d->end); + if (UPB_LIKELY(limit <= 0)) { + saved.limit_ptr = d->limit_ptr; + saved.val = d->limit; + d->limit_ptr = ptr + size; + } else { + saved.limit_ptr = NULL; + saved.val = d->limit - limit; + } + d->limit = limit; + return saved; +} + +static void fastdecode_poplimit(upb_decstate *d, fastdecode_savedlimit saved) { + if (UPB_LIKELY(saved.limit_ptr != NULL)) { + d->limit_ptr = saved.limit_ptr; + d->limit = saved.val; + } else { + d->limit += saved.val; + d->limit_ptr = d->end + UPB_MIN(0, d->limit); + } +} + UPB_FORCEINLINE static const char *fastdecode_tagdispatch(upb_decstate *d, const char *ptr, upb_msg *msg, @@ -399,7 +430,6 @@ again: ptr += tagbytes + 1; size_t len = (uint8_t)ptr[-1]; - int saved_delta; if (UPB_UNLIKELY(len & 0x80)) { int i; for (i = 0; i < 3; i++) { @@ -419,9 +449,9 @@ done: if (ptr - d->end + (int)len > d->limit) { return fastdecode_err(d); } - saved_delta = decode_pushlimit(d, ptr, len); + fastdecode_savedlimit saved = fastdecode_pushlimit(d, ptr, len); ptr = fastdecode_dispatch(d, ptr, child, subl, 0); - decode_poplimit(d, saved_delta); + fastdecode_poplimit(d, saved); if (UPB_UNLIKELY(d->end_group != 0)) { return fastdecode_err(d); } From f3a2a793491fd92608465c141b26d88035f7f319 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 22 Oct 2020 02:26:57 -0700 Subject: [PATCH 65/88] More optimization, back up to 2.56GB/s. --- upb/decode.c | 13 ------- upb/decode.int.h | 23 +++++++++++- upb/decode_fast.c | 96 +++++++++++++++++++++++++---------------------- 3 files changed, 73 insertions(+), 59 deletions(-) diff --git a/upb/decode.c b/upb/decode.c index 2715a0f5ef..3dc5516cfe 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -234,19 +234,6 @@ static const char *decode_varint64(upb_decstate *d, const char *ptr, } } -static int decode_pushlimit(upb_decstate *d, const char *ptr, int size) { - int limit = size + (int)(ptr - d->end); - int delta = d->limit - limit; - d->limit = limit; - d->limit_ptr = d->end + UPB_MIN(0, limit); - return delta; -} - -static void decode_poplimit(upb_decstate *d, int saved_delta) { - d->limit += saved_delta; - d->limit_ptr = d->end + UPB_MIN(0, d->limit); -} - UPB_FORCEINLINE static const char *decode_varint32(upb_decstate *d, const char *ptr, uint32_t *val) { diff --git a/upb/decode.int.h b/upb/decode.int.h index e8cb28f697..1145967b42 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -46,6 +46,7 @@ const char *decode_isdonefallback_inl(upb_decstate *d, const char *ptr, int overrun) { if (overrun < d->limit) { /* Need to copy remaining data into patch buffer. */ + UPB_ASSERT(overrun >= 0); UPB_ASSERT(overrun < 16); memset(d->patch + 16, 0, 16); memcpy(d->patch, d->end, 16); @@ -62,7 +63,8 @@ const char *decode_isdonefallback_inl(upb_decstate *d, const char *ptr, } UPB_INLINE -bool decode_isdone(upb_decstate *d, const char **ptr) { +bool decode_isdone_limit(upb_decstate *d, const char **ptr, + const char *limit_ptr) { int overrun = *ptr - d->end; if (UPB_LIKELY(*ptr < d->limit_ptr)) { return false; @@ -74,6 +76,25 @@ bool decode_isdone(upb_decstate *d, const char **ptr) { } } +UPB_INLINE +bool decode_isdone(upb_decstate *d, const char **ptr) { + return decode_isdone_limit(d, ptr, d->limit_ptr); +} + +UPB_INLINE int decode_pushlimit(upb_decstate *d, const char *ptr, int size) { + int limit = size + (int)(ptr - d->end); + int delta = d->limit - limit; + d->limit = limit; + d->limit_ptr = d->end + UPB_MIN(0, limit); + return delta; +} + +UPB_INLINE void decode_poplimit(upb_decstate *d, int saved_delta) { + d->limit += saved_delta; + d->limit_ptr = d->end + UPB_MIN(0, d->limit); + UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); +} + #include "upb/port_undef.inc" #endif /* UPB_DECODE_INT_H_ */ diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 40232a5c6d..a93708c07c 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -53,32 +53,6 @@ typedef struct { int val; /* If <=0, the old limit, else a delta */ } fastdecode_savedlimit; -static fastdecode_savedlimit fastdecode_pushlimit(upb_decstate *d, - const char *ptr, int size) { - fastdecode_savedlimit saved; - int limit = size + (int)(ptr - d->end); - if (UPB_LIKELY(limit <= 0)) { - saved.limit_ptr = d->limit_ptr; - saved.val = d->limit; - d->limit_ptr = ptr + size; - } else { - saved.limit_ptr = NULL; - saved.val = d->limit - limit; - } - d->limit = limit; - return saved; -} - -static void fastdecode_poplimit(upb_decstate *d, fastdecode_savedlimit saved) { - if (UPB_LIKELY(saved.limit_ptr != NULL)) { - d->limit_ptr = saved.limit_ptr; - d->limit = saved.val; - } else { - d->limit += saved.val; - d->limit_ptr = d->end + UPB_MIN(0, d->limit); - } -} - UPB_FORCEINLINE static const char *fastdecode_tagdispatch(upb_decstate *d, const char *ptr, upb_msg *msg, @@ -382,6 +356,23 @@ const char *upb_pos_2bt(UPB_PARSE_PARAMS) { /* message fields *************************************************************/ +UPB_NOINLINE +static const char *fastdecode_longsubmsg(upb_decstate *d, const char *ptr, + upb_msg *msg, + const upb_msglayout *table, + size_t len) { + return ptr; +} + +UPB_FORCEINLINE +static bool fastdecode_boundscheck2(const char *ptr, size_t len, + const char *end) { + uintptr_t uptr = (uintptr_t)ptr; + uintptr_t uend = (uintptr_t)end; + uintptr_t res = uptr + len; + return res < uptr || res > uend; +} + UPB_FORCEINLINE static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, int msg_ceil_bytes, upb_card card) { @@ -429,29 +420,44 @@ again: } ptr += tagbytes + 1; - size_t len = (uint8_t)ptr[-1]; - if (UPB_UNLIKELY(len & 0x80)) { - int i; - for (i = 0; i < 3; i++) { + int64_t len = (int8_t)ptr[-1]; + if (fastdecode_boundscheck2(ptr, len, d->limit_ptr)) { + if (UPB_UNLIKELY(len & 0x80)) { + len &= 0xff; + int i; + for (i = 0; i < 3; i++) { + ptr++; + size_t byte = (uint8_t)ptr[-1]; + len += (byte - 1) << (7 + 7 * i); + if (UPB_LIKELY((byte & 0x80) == 0)) goto done; + } ptr++; size_t byte = (uint8_t)ptr[-1]; - len += (byte - 1) << (7 + 7 * i); - if (UPB_LIKELY((byte & 0x80) == 0)) goto done; + // len is limited by 2gb not 4gb, hence 8 and not 16 as normally expected + // for a 32 bit varint. + if (UPB_UNLIKELY(byte >= 8)) return fastdecode_err(d); + len += (byte - 1) << 28; } - ptr++; - size_t byte = (uint8_t)ptr[-1]; - // len is limited by 2gb not 4gb, hence 8 and not 16 as normally expected - // for a 32 bit varint. - if (UPB_UNLIKELY(byte >= 8)) return fastdecode_err(d); - len += (byte - 1) << 28; - } -done: - if (ptr - d->end + (int)len > d->limit) { - return fastdecode_err(d); + done: + if (ptr - d->end + (int)len > d->limit) { + return fastdecode_err(d); + } + int delta = decode_pushlimit(d, ptr, len); + ptr = fastdecode_dispatch(d, ptr, child, subl, 0); + decode_poplimit(d, delta); + } else { + UPB_ASSERT(d->limit_ptr - ptr >= len); + UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); + const char *saved_limit_ptr = d->limit_ptr; + int saved_limit = d->limit; + d->limit_ptr = ptr + len; + d->limit = d->limit_ptr - d->end; + UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); + ptr = fastdecode_dispatch(d, ptr, child, subl, 0); + d->limit_ptr = saved_limit_ptr; + d->limit = saved_limit; + UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); } - fastdecode_savedlimit saved = fastdecode_pushlimit(d, ptr, len); - ptr = fastdecode_dispatch(d, ptr, child, subl, 0); - fastdecode_poplimit(d, saved); if (UPB_UNLIKELY(d->end_group != 0)) { return fastdecode_err(d); } From d81ba58215752aadb3dec5b24e201505aae30266 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 22 Oct 2020 11:01:42 -0700 Subject: [PATCH 66/88] Optimized short string copying. This sped up the alias=false case: Before: ------------------------------------------------------------------------------ Benchmark Time CPU Iterations ------------------------------------------------------------------------------ BM_Parse_Upb_FileDesc_WithInitialBlock 4562 ns 4562 ns 153251 1.53276GB/s Performance counter stats for 'bazel-bin/benchmarks/benchmark --benchmark_filter=BM_Parse_Upb_FileDesc_WithInitialBlock': 1,216.65 msec task-clock # 0.936 CPUs utilized 6 context-switches # 0.005 K/sec 0 cpu-migrations # 0.000 K/sec 200 page-faults # 0.164 K/sec 4,490,925,650 cycles # 3.691 GHz 16,516,403,731 instructions # 3.68 insn per cycle 2,828,536,650 branches # 2324.861 M/sec 5,425,830 branch-misses # 0.19% of all branches 1.300178903 seconds time elapsed 1.211475000 seconds user 0.072207000 seconds sys After: ------------------------------------------------------------------------------ Benchmark Time CPU Iterations ------------------------------------------------------------------------------ BM_Parse_Upb_FileDesc_WithInitialBlock 3587 ns 3587 ns 195749 1.94935GB/s Performance counter stats for 'bazel-bin/benchmarks/benchmark --benchmark_filter=BM_Parse_Upb_FileDesc_WithInitialBlock': 1,109.69 msec task-clock # 0.930 CPUs utilized 5 context-switches # 0.005 K/sec 0 cpu-migrations # 0.000 K/sec 198 page-faults # 0.178 K/sec 4,094,010,257 cycles # 3.689 GHz 15,672,677,812 instructions # 3.83 insn per cycle 2,589,291,160 branches # 2333.346 M/sec 3,306,386 branch-misses # 0.13% of all branches 1.193221789 seconds time elapsed 1.102538000 seconds user 0.072166000 seconds sys --- benchmarks/compare.py | 2 +- upb/decode_fast.c | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/benchmarks/compare.py b/benchmarks/compare.py index ad8a1901e8..0bfa3db7c3 100755 --- a/benchmarks/compare.py +++ b/benchmarks/compare.py @@ -53,7 +53,7 @@ def Benchmark(outbase, bench_cpu=True, runs=12): baseline = "master" -bench_cpu = True +bench_cpu = False if len(sys.argv) > 1: baseline = sys.argv[1] diff --git a/upb/decode_fast.c b/upb/decode_fast.c index a93708c07c..c8cdf97c48 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -48,11 +48,6 @@ upb_msg *decode_newmsg_ceil(upb_decstate *d, const upb_msglayout *l, return msg_data + sizeof(upb_msg_internal); } -typedef struct { - const char *limit_ptr; - int val; /* If <=0, the old limit, else a delta */ -} fastdecode_savedlimit; - UPB_FORCEINLINE static const char *fastdecode_tagdispatch(upb_decstate *d, const char *ptr, upb_msg *msg, @@ -308,10 +303,23 @@ static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, sizeof(upb_strview), card); if (UPB_UNLIKELY(!d->alias)) { - return func(d, ptr + tagbytes, msg, table, hasbits, dst); + len = (uint8_t)ptr[tagbytes]; + if (UPB_UNLIKELY(len > 15 - tagbytes || !_upb_arenahas(&d->arena, 16))) { + return func(d, ptr + tagbytes, msg, table, hasbits, dst); + } + char *data = d->arena.head.ptr; + d->arena.head.ptr += 16; + UPB_UNPOISON_MEMORY_REGION(data, 16); + memcpy(data, ptr, 16); + UPB_ASSERT(tagbytes + 1 + len <= 16); + ptr += tagbytes + 1; + dst->data = data + tagbytes + 1; + dst->size = len; + UPB_POISON_MEMORY_REGION(data, 1); + UPB_POISON_MEMORY_REGION(data + 1 + len, 16 - len - 1); + return fastdecode_dispatch(d, ptr + len, msg, table, hasbits); } - len = (int8_t)ptr[tagbytes]; ptr += tagbytes + 1; dst->data = ptr; @@ -356,14 +364,6 @@ const char *upb_pos_2bt(UPB_PARSE_PARAMS) { /* message fields *************************************************************/ -UPB_NOINLINE -static const char *fastdecode_longsubmsg(upb_decstate *d, const char *ptr, - upb_msg *msg, - const upb_msglayout *table, - size_t len) { - return ptr; -} - UPB_FORCEINLINE static bool fastdecode_boundscheck2(const char *ptr, size_t len, const char *end) { From e2c709e0476071d7b9137f53f5566e792d90fcea Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 23 Oct 2020 16:38:02 -0700 Subject: [PATCH 67/88] Repeated string and primitive support. Much of the code was adapted from Gerben's code in: https://github.com/protocolbuffers/upb/pull/322/commits/63330311951f0d659e6ed0d98b3a4adb304b5d17 --- cmake/google/protobuf/descriptor.upb.c | 14 +- tests/test_generated_code.c | 6 +- upb/decode.int.h | 1 + upb/decode_fast.c | 581 ++++++++++++++++++------- upb/decode_fast.h | 32 +- upb/upb.c | 6 +- upb/upb.h | 8 +- upbc/generator.cc | 17 +- 8 files changed, 481 insertions(+), 184 deletions(-) diff --git a/cmake/google/protobuf/descriptor.upb.c b/cmake/google/protobuf/descriptor.upb.c index 0b0a748406..5a005b6ed5 100644 --- a/cmake/google/protobuf/descriptor.upb.c +++ b/cmake/google/protobuf/descriptor.upb.c @@ -89,15 +89,15 @@ const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { {&fastdecode_generic, UPB_SIZE(0, 0)}, {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, {&upb_pss_1bt, UPB_SIZE(3377699720790034, 6755399441317906)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prs_1bt, UPB_SIZE(10133099161583642, 20266198323167258)}, {&upb_prm_1bt_max128b, UPB_SIZE(11258999068426274, 22517998136852514)}, {&upb_prm_1bt_max128b, UPB_SIZE(12384898975334442, 24769797950603306)}, {&upb_prm_1bt_max64b, UPB_SIZE(13510798882373682, 27021597764485170)}, {&upb_prm_1bt_max128b, UPB_SIZE(14636698789085242, 29273397578039354)}, {&upb_psm_1bt_max256b, UPB_SIZE(7881385247440962, 15762684595339330)}, {&upb_psm_1bt_max64b, UPB_SIZE(9007289449381962, 18014488704122954)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prv4_1bt, UPB_SIZE(15762598695796816, 31525197391593552)}, + {&upb_prv4_1bt, UPB_SIZE(16888498602639448, 33776997205278808)}, {&upb_pss_1bt, UPB_SIZE(5629499534737506, 11258999068950626)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, @@ -159,7 +159,7 @@ const upb_msglayout google_protobuf_DescriptorProto_msginit = { {&upb_psm_1bt_max64b, UPB_SIZE(3377777030266938, 6755476750794810)}, {&upb_prm_1bt_max64b, UPB_SIZE(10133099161976898, 20266198323560514)}, {&upb_prm_1bt_max64b, UPB_SIZE(11258999068557386, 22517998136983626)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prs_1bt, UPB_SIZE(12384898975268946, 24769797950537810)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, @@ -458,7 +458,7 @@ const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { {&upb_prm_1bt_max64b, UPB_SIZE(4503599627501586, 9007199254872082)}, {&upb_psm_1bt_max64b, UPB_SIZE(3377777030004762, 6755476750532634)}, {&upb_prm_1bt_max64b, UPB_SIZE(5629499534213154, 11258999068426274)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prs_1bt, UPB_SIZE(6755399441055786, 13510798882111530)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, @@ -1132,7 +1132,7 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { {&upb_pss_1bt, UPB_SIZE(9007199255789594, 9007199255789594)}, {&upb_psv8_1bt, UPB_SIZE(2251799813816352, 2251799813816352)}, {&upb_psv8_1bt, UPB_SIZE(4503599627632680, 4503599627632680)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_psf8_1bt, UPB_SIZE(6755399441580080, 6755399441580080)}, {&upb_pss_1bt, UPB_SIZE(11258999070523450, 13510798884208698)}, {&upb_pss_1bt, UPB_SIZE(13510798886305858, 18014398513676354)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, @@ -1273,7 +1273,7 @@ const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { {&upb_pss_1bt, UPB_SIZE(1125899906973722, 2251799813816346)}, {&upb_pss_1bt, UPB_SIZE(3377699720790050, 6755399441317922)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {&upb_prs_1bt, UPB_SIZE(7881299347898418, 15762598695796786)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, {&fastdecode_generic, UPB_SIZE(0, 0)}, diff --git a/tests/test_generated_code.c b/tests/test_generated_code.c index c6f024a61f..98f224372e 100644 --- a/tests/test_generated_code.c +++ b/tests/test_generated_code.c @@ -30,6 +30,7 @@ static void test_scalars() { protobuf_test_messages_proto3_TestAllTypesProto3_new(arena); protobuf_test_messages_proto3_TestAllTypesProto3 *msg2; upb_strview serialized; + upb_strview val; protobuf_test_messages_proto3_TestAllTypesProto3_set_optional_int32(msg, 10); protobuf_test_messages_proto3_TestAllTypesProto3_set_optional_int64(msg, 20); @@ -61,9 +62,8 @@ static void test_scalars() { msg2) == 60.6); ASSERT(protobuf_test_messages_proto3_TestAllTypesProto3_optional_bool( msg2) == 1); - ASSERT(upb_strview_eql( - protobuf_test_messages_proto3_TestAllTypesProto3_optional_string(msg2), - test_str_view)); + val = protobuf_test_messages_proto3_TestAllTypesProto3_optional_string(msg2); + ASSERT(upb_strview_eql(val, test_str_view)); upb_arena_free(arena); } diff --git a/upb/decode.int.h b/upb/decode.int.h index 1145967b42..def8b5c164 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -58,6 +58,7 @@ const char *decode_isdonefallback_inl(upb_decstate *d, const char *ptr, UPB_ASSERT(ptr < d->limit_ptr); return ptr; } else { + /* Parse error: we read past our limit. */ return NULL; } } diff --git a/upb/decode_fast.c b/upb/decode_fast.c index c8cdf97c48..f831e9112c 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -29,25 +29,6 @@ typedef enum { CARD_r = 2 /* Repeated */ } upb_card; -UPB_INLINE -upb_msg *decode_newmsg_ceil(upb_decstate *d, const upb_msglayout *l, - int msg_ceil_bytes) { - size_t size = l->size + sizeof(upb_msg_internal); - char *msg_data; - if (UPB_LIKELY(msg_ceil_bytes > 0 && _upb_arenahas(&d->arena, msg_ceil_bytes))) { - UPB_ASSERT(size <= (size_t)msg_ceil_bytes); - msg_data = d->arena.head.ptr; - d->arena.head.ptr += size; - UPB_UNPOISON_MEMORY_REGION(msg_data, msg_ceil_bytes); - memset(msg_data, 0, msg_ceil_bytes); - UPB_POISON_MEMORY_REGION(msg_data + size, msg_ceil_bytes - size); - } else { - msg_data = (char*)upb_arena_malloc(&d->arena, size); - memset(msg_data, 0, size); - } - return msg_data + sizeof(upb_msg_internal); -} - UPB_FORCEINLINE static const char *fastdecode_tagdispatch(upb_decstate *d, const char *ptr, upb_msg *msg, @@ -113,12 +94,105 @@ static bool fastdecode_checktag(uint64_t data, int tagbytes) { } } +UPB_FORCEINLINE +static const char *fastdecode_longsize(const char *ptr, int *size) { + UPB_ASSERT(*size & 0x80); + *size &= 0xff; + for (int i = 0; i < 3; i++) { + ptr++; + size_t byte = (uint8_t)ptr[-1]; + *size += (byte - 1) << (7 + 7 * i); + if (UPB_LIKELY((byte & 0x80) == 0)) return ptr; + } + ptr++; + size_t byte = (uint8_t)ptr[-1]; + // len is limited by 2gb not 4gb, hence 8 and not 16 as normally expected + // for a 32 bit varint. + if (UPB_UNLIKELY(byte >= 8)) return NULL; + *size += (byte - 1) << 28; + return ptr; +} + +/* singular, oneof, repeated field handling ***********************************/ + +typedef struct { + upb_array *arr; + void *end; +} fastdecode_arr; + +typedef enum { + FD_NEXT_ATLIMIT, + FD_NEXT_SAMEFIELD, + FD_NEXT_OTHERFIELD +} fastdecode_next; + +typedef struct { + void *dst; + fastdecode_next next; + uint32_t tag; +} fastdecode_nextret; + +UPB_FORCEINLINE +static void *fastdecode_resizearr(upb_decstate *d, void *dst, + fastdecode_arr *farr, int valbytes) { + if (UPB_UNLIKELY(dst == farr->end)) { + size_t old_size = farr->arr->size; + size_t old_bytes = old_size * valbytes; + size_t new_size = old_size * 2; + size_t new_bytes = new_size * valbytes; + char *old_ptr = _upb_array_ptr(farr->arr); + char *new_ptr = upb_arena_realloc(&d->arena, old_ptr, old_bytes, new_bytes); + farr->arr->size = new_size; + farr->arr->data = _upb_array_tagptr(new_ptr, 3); + dst = (void*)(new_ptr + (old_size * valbytes)); + farr->end = (void*)(new_ptr + (new_size * valbytes)); + } + return dst; +} + +UPB_FORCEINLINE +static bool fastdecode_tagmatch(uint32_t tag, uint64_t data, int tagbytes) { + if (tagbytes == 1) { + return (uint8_t)tag == (uint8_t)data; + } else { + return (uint16_t)tag == (uint16_t)data; + } +} + +UPB_FORCEINLINE +static fastdecode_nextret fastdecode_nextrepeated(upb_decstate *d, void *dst, + const char **ptr, + fastdecode_arr *farr, + uint64_t data, int tagbytes, + int valbytes) { + fastdecode_nextret ret; + dst = (char *)dst + valbytes; + + if (UPB_LIKELY(!decode_isdone(d, ptr))) { + ret.tag = fastdecode_loadtag(*ptr); + if (fastdecode_tagmatch(ret.tag, data, tagbytes)) { + ret.next = FD_NEXT_SAMEFIELD; + } else { + farr->arr->len = + (size_t)((char *)dst - (char *)_upb_array_ptr(farr->arr)) / valbytes; + ret.next = FD_NEXT_OTHERFIELD; + } + } else { + farr->arr->len = + (size_t)((char *)dst - (char *)_upb_array_ptr(farr->arr)) / valbytes; + ret.next = FD_NEXT_ATLIMIT; + } + + ret.dst = dst; + return ret; +} + UPB_FORCEINLINE static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, upb_msg *msg, uint64_t *data, - uint64_t *hasbits, upb_array **outarr, - void **end, int valbytes, - upb_card card, bool hasbit_is_idx) { + uint64_t *hasbits, fastdecode_arr *farr, + int valbytes, upb_card card, + bool hasbit_is_idx) { size_t ofs = *data >> 48; void *field = (char *)msg + ofs; @@ -135,22 +209,20 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, // Get pointer to upb_array and allocate/expand if necessary. uint8_t elem_size_lg2 = __builtin_ctz(valbytes); upb_array **arr_p = field; - upb_array *arr; char *begin; *hasbits >>= 16; *(uint32_t*)msg |= *hasbits; *hasbits = 0; if (UPB_LIKELY(!*arr_p)) { - arr = _upb_array_new(&d->arena, 8, elem_size_lg2); - *arr_p = arr; + farr->arr = _upb_array_new(&d->arena, 8, elem_size_lg2); + *arr_p = farr->arr; } else { - arr = *arr_p; + farr->arr = *arr_p; } - begin = _upb_array_ptr(arr); - field = begin + (arr->len * valbytes); - *end = begin + (arr->size * valbytes); + begin = _upb_array_ptr(farr->arr); + field = begin + (farr->arr->len * valbytes); + farr->end = begin + (farr->arr->size * valbytes); *data = fastdecode_loadtag(ptr); - *outarr = arr; return field; } default: @@ -158,14 +230,6 @@ static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, } } -UPB_FORCEINLINE -static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, - uint64_t *data, uint64_t *hasbits, - int valbytes, upb_card card) { - return fastdecode_getfield_ofs(d, ptr, msg, data, hasbits, NULL, NULL, - valbytes, card, false); -} - /* varint fields **************************************************************/ UPB_FORCEINLINE @@ -189,11 +253,25 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, int valbytes, upb_card card, bool zigzag) { uint64_t val; void *dst; + fastdecode_arr farr; + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { RETURN_GENERIC("varint field tag mismatch\n"); } - dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, valbytes, - card); + + dst = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &farr, valbytes, + card, false); + if (card == CARD_r) { + if (UPB_UNLIKELY(!dst)) { + RETURN_GENERIC("need array resize\n"); + } + } + +again: + if (card == CARD_r) { + dst = fastdecode_resizearr(d, dst, &farr, valbytes); + } + ptr += tagbytes + 1; val = (uint8_t)ptr[-1]; if (UPB_UNLIKELY(val & 0x80)) { @@ -206,12 +284,30 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, } ptr++; uint64_t byte = (uint8_t)ptr[-1]; - if (byte > 1) return fastdecode_err(d); + if (byte > 1) { + return fastdecode_err(d); + } val += (byte - 1) << 63; } + done: val = fastdecode_munge(val, valbytes, zigzag); memcpy(dst, &val, valbytes); + + if (card == CARD_r) { + fastdecode_nextret ret = + fastdecode_nextrepeated(d, dst, &ptr, &farr, data, tagbytes, valbytes); + switch (ret.next) { + case FD_NEXT_SAMEFIELD: + dst = ret.dst; + goto again; + case FD_NEXT_OTHERFIELD: + return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, ret.tag); + case FD_NEXT_ATLIMIT: + return ptr; + } + } + return fastdecode_dispatch(d, ptr, msg, table, hasbits); } @@ -219,7 +315,7 @@ done: #define b_ZZ false #define v_ZZ false -/* Generate all varint functions. +/* Generate all combinations: * {s,o,r} x {b1,v4,z4,v8,z8} x {1bt,2bt} */ #define F(card, type, valbytes, tagbytes) \ @@ -241,7 +337,7 @@ done: TAGBYTES(s) TAGBYTES(o) -/* TAGBYTES(r) */ +TAGBYTES(r) #undef z_ZZ #undef b_ZZ @@ -253,6 +349,78 @@ TAGBYTES(o) #undef TYPES #undef TAGBYTES + +/* fixed fields ***************************************************************/ + +UPB_FORCEINLINE +static const char *fastdecode_fixed(UPB_PARSE_PARAMS, int tagbytes, + int valbytes, upb_card card) { + void *dst; + fastdecode_arr farr; + + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + RETURN_GENERIC("fixed field tag mismatch\n"); + } + + dst = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &farr, valbytes, + card, false); + if (card == CARD_r) { + if (UPB_UNLIKELY(!dst)) { + RETURN_GENERIC("couldn't allocate array in arena\n"); + } + } + + +again: + if (card == CARD_r) { + dst = fastdecode_resizearr(d, dst, &farr, valbytes); + } + + ptr += tagbytes; + memcpy(dst, ptr, valbytes); + ptr += valbytes; + + if (card == CARD_r) { + fastdecode_nextret ret = fastdecode_nextrepeated( + d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_msg *)); + switch (ret.next) { + case FD_NEXT_SAMEFIELD: + dst = ret.dst; + goto again; + case FD_NEXT_OTHERFIELD: + return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, ret.tag); + case FD_NEXT_ATLIMIT: + return ptr; + } + } + + return fastdecode_dispatch(d, ptr, msg, table, hasbits); +} + +/* Generate all combinations: + * {s,o,r} x {f4,f8} x {1bt,2bt} */ + +#define F(card, valbytes, tagbytes) \ + const char *upb_p##card##f##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ + return fastdecode_fixed(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card); \ + } + +#define TYPES(card, tagbytes) \ + F(card, 4, tagbytes) \ + F(card, 8, tagbytes) + +#define TAGBYTES(card) \ + TYPES(card, 1) \ + TYPES(card, 2) + +TAGBYTES(s) +TAGBYTES(o) +TAGBYTES(r) + +#undef F +#undef TYPES +#undef TAGBYTES + /* string fields **************************************************************/ UPB_FORCEINLINE @@ -269,110 +437,230 @@ typedef const char *fastdecode_copystr_func(struct upb_decstate *d, const upb_msglayout *table, uint64_t hasbits, upb_strview *dst); -UPB_FORCEINLINE -static const char *fastdecode_copystring(struct upb_decstate *d, +UPB_NOINLINE +static const char *fastdecode_longstring(struct upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, - uint64_t hasbits, upb_strview *dst, - int tagbytes) { - int64_t len = (int8_t)*ptr; + uint64_t hasbits, upb_strview *dst) { + int size = (uint8_t)ptr[0]; // Could plumb through hasbits. ptr++; - if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit_ptr))) { - ptr -= tagbytes + 1; - RETURN_GENERIC("string field len >1 byte\n"); + if (size & 0x80) { + ptr = fastdecode_longsize(ptr, &size); } - char *data = upb_arena_malloc(&d->arena, len); - if (!data) { + + if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->limit_ptr))) { + dst->size = 0; return fastdecode_err(d); } - memcpy(data, ptr, len); + + if (d->alias) { + dst->data = ptr; + dst->size = size; + } else { + char *data = upb_arena_malloc(&d->arena, size); + if (!data) { + return fastdecode_err(d); + } + memcpy(data, ptr, size); + dst->data = data; + dst->size = size; + } + + return fastdecode_dispatch(d, ptr + size, msg, table, hasbits); +} + +UPB_FORCEINLINE +static void fastdecode_docopy(upb_decstate *d, const char *ptr, uint32_t size, + int copy, char *data, upb_strview *dst) { + UPB_UNPOISON_MEMORY_REGION(data, copy); + memcpy(data, ptr, copy); + UPB_POISON_MEMORY_REGION(data + size, copy - size); dst->data = data; - dst->size = len; - return fastdecode_dispatch(d, ptr + len, msg, table, hasbits); + d->arena.head.ptr += copy; +} + +UPB_FORCEINLINE +static const char *fastdecode_copystring(UPB_PARSE_PARAMS, int tagbytes, + upb_card card) { + upb_strview *dst; + fastdecode_arr farr; + int64_t size; + size_t arena_has; + size_t common_has; + char *buf; + + UPB_ASSERT(!d->alias); + UPB_ASSERT(fastdecode_checktag(data, tagbytes)); + + dst = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &farr, + sizeof(upb_strview), card, false); + +again: + if (card == CARD_r) { + dst = fastdecode_resizearr(d, dst, &farr, sizeof(upb_strview)); + } + + size = (uint8_t)ptr[tagbytes]; + ptr += tagbytes + 1; + dst->size = size; + + if (UPB_UNLIKELY(size == 0)) { + goto done; + } else if (UPB_UNLIKELY(size > 127)) { + goto longstr; + } + + buf = d->arena.head.ptr; + arena_has = _upb_arenahas(&d->arena); + common_has = UPB_MIN(arena_has, (d->end - ptr) + 16); + + if (UPB_LIKELY(size <= 15 - tagbytes)) { + if (arena_has < 16) goto longstr; + memcpy(buf, ptr - tagbytes - 1, 16); + dst->data = buf + tagbytes + 1; + d->arena.head.ptr += 16; + } else if (UPB_LIKELY(size <= 32)) { + if (UPB_UNLIKELY(common_has < 32)) goto longstr; + fastdecode_docopy(d, ptr, size, 32, buf, dst); + } else if (UPB_LIKELY(size <= 64 && common_has >= 64)) { + if (UPB_UNLIKELY(common_has < 64)) goto longstr; + fastdecode_docopy(d, ptr, size, 64, buf, dst); + } else { + if (UPB_UNLIKELY(common_has < 128)) goto longstr; + fastdecode_docopy(d, ptr, size, 128, buf, dst); + } + + ptr += size; + +done: + if (card == CARD_r) { + fastdecode_nextret ret = fastdecode_nextrepeated( + d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_strview)); + switch (ret.next) { + case FD_NEXT_SAMEFIELD: + dst = ret.dst; + goto again; + case FD_NEXT_OTHERFIELD: + return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, ret.tag); + case FD_NEXT_ATLIMIT: + return ptr; + } + } + + return fastdecode_dispatch(d, ptr, msg, table, hasbits); + +longstr: + ptr--; + return fastdecode_longstring(d, ptr, msg, table, hasbits, dst); } UPB_FORCEINLINE static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, - upb_card card, fastdecode_copystr_func *func) { + upb_card card, + _upb_field_parser *copyfunc) { upb_strview *dst; - int64_t len; + fastdecode_arr farr; + int64_t size; + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { RETURN_GENERIC("string field tag mismatch\n"); } - dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, - sizeof(upb_strview), card); if (UPB_UNLIKELY(!d->alias)) { - len = (uint8_t)ptr[tagbytes]; - if (UPB_UNLIKELY(len > 15 - tagbytes || !_upb_arenahas(&d->arena, 16))) { - return func(d, ptr + tagbytes, msg, table, hasbits, dst); - } - char *data = d->arena.head.ptr; - d->arena.head.ptr += 16; - UPB_UNPOISON_MEMORY_REGION(data, 16); - memcpy(data, ptr, 16); - UPB_ASSERT(tagbytes + 1 + len <= 16); - ptr += tagbytes + 1; - dst->data = data + tagbytes + 1; - dst->size = len; - UPB_POISON_MEMORY_REGION(data, 1); - UPB_POISON_MEMORY_REGION(data + 1 + len, 16 - len - 1); - return fastdecode_dispatch(d, ptr + len, msg, table, hasbits); - } - - len = (int8_t)ptr[tagbytes]; + return copyfunc(UPB_PARSE_ARGS); + } + + dst = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &farr, + sizeof(upb_strview), card, false); + +again: + if (card == CARD_r) { + dst = fastdecode_resizearr(d, dst, &farr, sizeof(upb_strview)); + } + + size = (int8_t)ptr[tagbytes]; ptr += tagbytes + 1; dst->data = ptr; - dst->size = len; - if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit_ptr))) { - dst->size = 0; - ptr -= tagbytes + 1; - RETURN_GENERIC("string field len >1 byte\n"); + dst->size = size; + + if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->end))) { + return fastdecode_longstring(d, ptr, msg, table, hasbits, dst); } - return fastdecode_dispatch(d, ptr + len, msg, table, hasbits); -} -UPB_NOINLINE -static const char *upb_copystr_1bt(upb_decstate *d, const char *ptr, - upb_msg *msg, const upb_msglayout *table, - uint64_t hasbits, upb_strview *dst) { - return fastdecode_copystring(d, ptr, msg, table, hasbits, dst, 1); -} + ptr += size; -UPB_NOINLINE -static const char *upb_copystr_2bt(upb_decstate *d, const char *ptr, upb_msg *msg, - const upb_msglayout *table, uint64_t hasbits, - upb_strview *dst) { - return fastdecode_copystring(d, ptr, msg, table, hasbits, dst, 2); -} + if (card == CARD_r) { + fastdecode_nextret ret = fastdecode_nextrepeated( + d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_strview)); + switch (ret.next) { + case FD_NEXT_SAMEFIELD: + dst = ret.dst; + goto again; + case FD_NEXT_OTHERFIELD: + return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, ret.tag); + case FD_NEXT_ATLIMIT: + return ptr; + } + } -const char *upb_pss_1bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_s, &upb_copystr_1bt); + return fastdecode_dispatch(d, ptr, msg, table, hasbits); } -const char *upb_pos_1bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_o, &upb_copystr_1bt); -} +/* Generate all combinations: + * {p,c} x {s,o,r} x {1bt,2bt} */ + +#define F(card, tagbytes) \ + UPB_NOINLINE \ + const char *upb_c##card##s_##tagbytes##bt(UPB_PARSE_PARAMS) { \ + return fastdecode_copystring(UPB_PARSE_ARGS, tagbytes, CARD_##card); \ + } \ + const char *upb_p##card##s_##tagbytes##bt(UPB_PARSE_PARAMS) { \ + return fastdecode_string(UPB_PARSE_ARGS, tagbytes, CARD_##card, \ + &upb_c##card##s_##tagbytes##bt); \ + } -const char *upb_pss_2bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_s, &upb_copystr_2bt); -} +#define TAGBYTES(card) \ + F(card, 1) \ + F(card, 2) -const char *upb_pos_2bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_o, &upb_copystr_2bt); -} +TAGBYTES(s) +TAGBYTES(o) +TAGBYTES(r) + +#undef F +#undef TAGBYTES /* message fields *************************************************************/ UPB_FORCEINLINE static bool fastdecode_boundscheck2(const char *ptr, size_t len, - const char *end) { + const char *end) { uintptr_t uptr = (uintptr_t)ptr; uintptr_t uend = (uintptr_t)end; uintptr_t res = uptr + len; return res < uptr || res > uend; } +UPB_INLINE +upb_msg *decode_newmsg_ceil(upb_decstate *d, const upb_msglayout *l, + int msg_ceil_bytes) { + size_t size = l->size + sizeof(upb_msg_internal); + char *msg_data; + if (UPB_LIKELY(msg_ceil_bytes > 0 && + _upb_arenahas(&d->arena) >= msg_ceil_bytes)) { + UPB_ASSERT(size <= (size_t)msg_ceil_bytes); + msg_data = d->arena.head.ptr; + d->arena.head.ptr += size; + UPB_UNPOISON_MEMORY_REGION(msg_data, msg_ceil_bytes); + memset(msg_data, 0, msg_ceil_bytes); + UPB_POISON_MEMORY_REGION(msg_data + size, msg_ceil_bytes - size); + } else { + msg_data = (char*)upb_arena_malloc(&d->arena, size); + memset(msg_data, 0, size); + } + return msg_data + sizeof(upb_msg_internal); +} + UPB_FORCEINLINE static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, int msg_ceil_bytes, upb_card card) { @@ -384,12 +672,12 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, if (--d->depth == 0) return fastdecode_err(d); upb_msg **submsg; - upb_array *arr; - void *end; uint32_t submsg_idx = data; submsg_idx >>= 16; const upb_msglayout *subl = table->submsgs[submsg_idx]; - submsg = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &arr, &end, + fastdecode_arr farr; + + submsg = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &farr, sizeof(upb_msg *), card, true); if (card == CARD_s) { @@ -399,18 +687,7 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, again: if (card == CARD_r) { - if (UPB_UNLIKELY(submsg == end)) { - size_t old_size = arr->size; - size_t old_bytes = old_size * sizeof(upb_msg*); - size_t new_size = old_size * 2; - size_t new_bytes = new_size * sizeof(upb_msg*); - char *old_ptr = _upb_array_ptr(arr); - char *new_ptr = upb_arena_realloc(&d->arena, old_ptr, old_bytes, new_bytes); - arr->size = new_size; - arr->data = _upb_array_tagptr(new_ptr, 3); - submsg = (void*)(new_ptr + (old_size * sizeof(upb_msg*))); - end = (void*)(new_ptr + (new_size * sizeof(upb_msg*))); - } + submsg = fastdecode_resizearr(d, submsg, &farr, sizeof(upb_msg*)); } upb_msg* child = *submsg; @@ -420,34 +697,29 @@ again: } ptr += tagbytes + 1; - int64_t len = (int8_t)ptr[-1]; + int len = (int8_t)ptr[-1]; if (fastdecode_boundscheck2(ptr, len, d->limit_ptr)) { + // Slow case: Sub-message is >=128 bytes and/or exceeds the current buffer. + // If it exceeds the buffer limit, limit/limit_ptr will change during + // sub-message parsing, so we need to preserve delta, not limit. if (UPB_UNLIKELY(len & 0x80)) { - len &= 0xff; - int i; - for (i = 0; i < 3; i++) { - ptr++; - size_t byte = (uint8_t)ptr[-1]; - len += (byte - 1) << (7 + 7 * i); - if (UPB_LIKELY((byte & 0x80) == 0)) goto done; + // Size varint >1 byte (length >= 128). + ptr = fastdecode_longsize(ptr, &len); + if (!ptr) { + // Corrupt wire format: size exceeded INT_MAX. + return fastdecode_err(d); } - ptr++; - size_t byte = (uint8_t)ptr[-1]; - // len is limited by 2gb not 4gb, hence 8 and not 16 as normally expected - // for a 32 bit varint. - if (UPB_UNLIKELY(byte >= 8)) return fastdecode_err(d); - len += (byte - 1) << 28; } - done: if (ptr - d->end + (int)len > d->limit) { + // Corrupt wire format: invalid limit. return fastdecode_err(d); } int delta = decode_pushlimit(d, ptr, len); ptr = fastdecode_dispatch(d, ptr, child, subl, 0); decode_poplimit(d, delta); } else { - UPB_ASSERT(d->limit_ptr - ptr >= len); - UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); + // Fast case: Sub-message is <128 bytes and fits in the current buffer. + // This means we can preserve limit/limit_ptr verbatim. const char *saved_limit_ptr = d->limit_ptr; int saved_limit = d->limit; d->limit_ptr = ptr + len; @@ -463,21 +735,18 @@ again: } if (card == CARD_r) { - submsg++; - if (UPB_LIKELY(!decode_isdone(d, &ptr))) { - uint32_t tag = fastdecode_loadtag(ptr); - if (tagbytes == 1) { - if ((uint8_t)tag == (uint8_t)data) goto again; - } else { - if ((uint16_t)tag == (uint16_t)data) goto again; - } - arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); - d->depth++; - return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, tag); - } else { - arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); - d->depth++; - return ptr; + fastdecode_nextret ret = fastdecode_nextrepeated( + d, submsg, &ptr, &farr, data, tagbytes, sizeof(upb_msg *)); + switch (ret.next) { + case FD_NEXT_SAMEFIELD: + submsg = ret.dst; + goto again; + case FD_NEXT_OTHERFIELD: + d->depth++; + return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, ret.tag); + case FD_NEXT_ATLIMIT: + d->depth++; + return ptr; } } diff --git a/upb/decode_fast.h b/upb/decode_fast.h index 67315206eb..e59e27108e 100644 --- a/upb/decode_fast.h +++ b/upb/decode_fast.h @@ -21,6 +21,8 @@ const char *fastdecode_generic(struct upb_decstate *d, const char *ptr, struct upb_decstate *d, const char *ptr, upb_msg *msg, \ const upb_msglayout *table, uint64_t hasbits, uint64_t data +/* primitive fields ***********************************************************/ + #define F(card, type, valbytes, tagbytes) \ const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS); @@ -29,7 +31,9 @@ const char *fastdecode_generic(struct upb_decstate *d, const char *ptr, F(card, v, 4, tagbytes) \ F(card, v, 8, tagbytes) \ F(card, z, 4, tagbytes) \ - F(card, z, 8, tagbytes) + F(card, z, 8, tagbytes) \ + F(card, f, 4, tagbytes) \ + F(card, f, 8, tagbytes) #define TAGBYTES(card) \ TYPES(card, 1) \ @@ -37,17 +41,31 @@ const char *fastdecode_generic(struct upb_decstate *d, const char *ptr, TAGBYTES(s) TAGBYTES(o) -/* TAGBYTES(r) */ - -const char *upb_pss_1bt(UPB_PARSE_PARAMS); -const char *upb_pss_2bt(UPB_PARSE_PARAMS); -const char *upb_pos_1bt(UPB_PARSE_PARAMS); -const char *upb_pos_2bt(UPB_PARSE_PARAMS); +TAGBYTES(r) #undef F #undef TYPES #undef TAGBYTES +/* string fields **************************************************************/ + +#define F(card, tagbytes) \ + const char *upb_p##card##s_##tagbytes##bt(UPB_PARSE_PARAMS); \ + const char *upb_c##card##s_##tagbytes##bt(UPB_PARSE_PARAMS); + +#define TAGBYTES(card) \ + F(card, 1) \ + F(card, 2) + +TAGBYTES(s) +TAGBYTES(o) +TAGBYTES(r) + +#undef F +#undef TAGBYTES + +/* sub-message fields *********************************************************/ + #define F(card, tagbytes, size_ceil, ceil_arg) \ const char *upb_p##card##m_##tagbytes##bt_max##size_ceil##b(UPB_PARSE_PARAMS); diff --git a/upb/upb.c b/upb/upb.c index e0d34b54b4..e3acbda0c5 100644 --- a/upb/upb.c +++ b/upb/upb.c @@ -129,7 +129,7 @@ static bool upb_arena_allocblock(upb_arena *a, size_t size) { void *_upb_arena_slowmalloc(upb_arena *a, size_t size) { if (!upb_arena_allocblock(a, size)) return NULL; /* Out of memory. */ - UPB_ASSERT(_upb_arenahas(a, size)); + UPB_ASSERT(_upb_arenahas(a) >= size); return upb_arena_malloc(a, size); } @@ -224,9 +224,9 @@ void upb_arena_free(upb_arena *a) { bool upb_arena_addcleanup(upb_arena *a, void *ud, upb_cleanup_func *func) { cleanup_ent *ent; - if (!a->cleanups || !_upb_arenahas(a, sizeof(cleanup_ent))) { + if (!a->cleanups || _upb_arenahas(a) < sizeof(cleanup_ent)) { if (!upb_arena_allocblock(a, 128)) return false; /* Out of memory. */ - UPB_ASSERT(_upb_arenahas(a, sizeof(cleanup_ent))); + UPB_ASSERT(_upb_arenahas(a) >= sizeof(cleanup_ent)); } a->head.end -= sizeof(cleanup_ent); diff --git a/upb/upb.h b/upb/upb.h index 85205a5a76..54ca705b8b 100644 --- a/upb/upb.h +++ b/upb/upb.h @@ -161,9 +161,9 @@ void *_upb_arena_slowmalloc(upb_arena *a, size_t size); UPB_INLINE upb_alloc *upb_arena_alloc(upb_arena *a) { return (upb_alloc*)a; } -UPB_INLINE bool _upb_arenahas(upb_arena *a, size_t size) { +UPB_INLINE size_t _upb_arenahas(upb_arena *a) { _upb_arena_head *h = (_upb_arena_head*)a; - return (size_t)(h->end - h->ptr) >= size; + return (size_t)(h->end - h->ptr); } UPB_INLINE void *upb_arena_malloc(upb_arena *a, size_t size) { @@ -171,7 +171,7 @@ UPB_INLINE void *upb_arena_malloc(upb_arena *a, size_t size) { void* ret; size = UPB_ALIGN_MALLOC(size); - if (UPB_UNLIKELY(!_upb_arenahas(a, size))) { + if (UPB_UNLIKELY(_upb_arenahas(a) < size)) { return _upb_arena_slowmalloc(a, size); } @@ -182,7 +182,7 @@ UPB_INLINE void *upb_arena_malloc(upb_arena *a, size_t size) { #if UPB_ASAN { size_t guard_size = 32; - if (_upb_arenahas(a, guard_size)) { + if (_upb_arenahas(a) >= guard_size) { h->ptr += guard_size; } else { h->ptr = h->end; diff --git a/upbc/generator.cc b/upbc/generator.cc index f538a17738..454d4d1a51 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -759,6 +759,16 @@ void TryFillTableEntry(const protobuf::Descriptor* message, case protobuf::FieldDescriptor::TYPE_UINT64: type = "v8"; break; + case protobuf::FieldDescriptor::TYPE_FIXED32: + case protobuf::FieldDescriptor::TYPE_SFIXED32: + case protobuf::FieldDescriptor::TYPE_FLOAT: + type = "f4"; + break; + case protobuf::FieldDescriptor::TYPE_FIXED64: + case protobuf::FieldDescriptor::TYPE_SFIXED64: + case protobuf::FieldDescriptor::TYPE_DOUBLE: + type = "f8"; + break; case protobuf::FieldDescriptor::TYPE_SINT32: type = "z4"; break; @@ -783,12 +793,11 @@ void TryFillTableEntry(const protobuf::Descriptor* message, switch (field->label()) { case protobuf::FieldDescriptor::LABEL_REPEATED: - if (field->type() == protobuf::FieldDescriptor::TYPE_MESSAGE) { - cardinality = "r"; - break; - } else { + cardinality = "r"; + if (field->is_packed()) { return; // Not supported yet. } + break; case protobuf::FieldDescriptor::LABEL_OPTIONAL: case protobuf::FieldDescriptor::LABEL_REQUIRED: if (field->real_containing_oneof()) { From 7ffa9c181a0e34b1038c146db80dc0020cfc21d3 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 23 Oct 2020 16:57:57 -0700 Subject: [PATCH 68/88] Fixed some small bugs and performance problems in string copying. Before this CL, with alias=false: ------------------------------------------------------------------------------ Benchmark Time CPU Iterations ------------------------------------------------------------------------------ BM_Parse_Upb_FileDesc_WithInitialBlock 3715 ns 3715 ns 188916 1.88206GB/s Performance counter stats for 'bazel-bin/benchmarks/benchmark --benchmark_filter=BM_Parse_Upb_FileDesc_WithInitialBlock': 1,122.92 msec task-clock # 0.979 CPUs utilized 3 context-switches # 0.003 K/sec 0 cpu-migrations # 0.000 K/sec 196 page-faults # 0.175 K/sec 4,144,746,717 cycles # 3.691 GHz 15,351,966,804 instructions # 3.70 insn per cycle 2,590,281,905 branches # 2306.728 M/sec 2,996,157 branch-misses # 0.12% of all branches 1.146615328 seconds time elapsed 1.115578000 seconds user 0.008025000 seconds sys After this CL: ------------------------------------------------------------------------------ Benchmark Time CPU Iterations ------------------------------------------------------------------------------ BM_Parse_Upb_FileDesc_WithInitialBlock 3554 ns 3554 ns 197527 1.9674GB/s Performance counter stats for 'bazel-bin/benchmarks/benchmark --benchmark_filter=BM_Parse_Upb_FileDesc_WithInitialBlock': 1,105.34 msec task-clock # 0.982 CPUs utilized 3 context-switches # 0.003 K/sec 0 cpu-migrations # 0.000 K/sec 197 page-faults # 0.178 K/sec 4,077,736,892 cycles # 3.689 GHz 15,442,709,352 instructions # 3.79 insn per cycle 2,435,131,301 branches # 2203.068 M/sec 2,643,775 branch-misses # 0.11% of all branches 1.125393845 seconds time elapsed 1.097770000 seconds user 0.008012000 seconds sys --- upb/decode_fast.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index f831e9112c..82c030c4cd 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -472,11 +472,11 @@ static const char *fastdecode_longstring(struct upb_decstate *d, UPB_FORCEINLINE static void fastdecode_docopy(upb_decstate *d, const char *ptr, uint32_t size, int copy, char *data, upb_strview *dst) { + d->arena.head.ptr += copy; UPB_UNPOISON_MEMORY_REGION(data, copy); memcpy(data, ptr, copy); UPB_POISON_MEMORY_REGION(data + size, copy - size); dst->data = data; - d->arena.head.ptr += copy; } UPB_FORCEINLINE @@ -504,35 +504,30 @@ again: ptr += tagbytes + 1; dst->size = size; - if (UPB_UNLIKELY(size == 0)) { - goto done; - } else if (UPB_UNLIKELY(size > 127)) { - goto longstr; - } - buf = d->arena.head.ptr; arena_has = _upb_arenahas(&d->arena); common_has = UPB_MIN(arena_has, (d->end - ptr) + 16); if (UPB_LIKELY(size <= 15 - tagbytes)) { if (arena_has < 16) goto longstr; + d->arena.head.ptr += 16; memcpy(buf, ptr - tagbytes - 1, 16); dst->data = buf + tagbytes + 1; - d->arena.head.ptr += 16; } else if (UPB_LIKELY(size <= 32)) { if (UPB_UNLIKELY(common_has < 32)) goto longstr; fastdecode_docopy(d, ptr, size, 32, buf, dst); - } else if (UPB_LIKELY(size <= 64 && common_has >= 64)) { + } else if (UPB_LIKELY(size <= 64)) { if (UPB_UNLIKELY(common_has < 64)) goto longstr; fastdecode_docopy(d, ptr, size, 64, buf, dst); - } else { + } else if (UPB_LIKELY(size <= 128)) { if (UPB_UNLIKELY(common_has < 128)) goto longstr; fastdecode_docopy(d, ptr, size, 128, buf, dst); + } else { + goto longstr; } ptr += size; -done: if (card == CARD_r) { fastdecode_nextret ret = fastdecode_nextrepeated( d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_strview)); From e3e797b680654b50ae644b06295cd51bb923ea74 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 23 Oct 2020 22:47:18 -0700 Subject: [PATCH 69/88] Added fasttable support for oneofs. --- cmake/google/protobuf/descriptor.upb.c | 1728 ++++++++++++------------ tests/conformance_upb.c | 1 + upb/decode.c | 2 +- upb/decode_fast.c | 57 +- upb/msg.h | 2 +- upbc/generator.cc | 70 +- 6 files changed, 937 insertions(+), 923 deletions(-) diff --git a/cmake/google/protobuf/descriptor.upb.c b/cmake/google/protobuf/descriptor.upb.c index 5a005b6ed5..70978297c6 100644 --- a/cmake/google/protobuf/descriptor.upb.c +++ b/cmake/google/protobuf/descriptor.upb.c @@ -22,38 +22,38 @@ static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1] = const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_prm_1bt_max192b, UPB_SIZE(10, 10)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x000000003f00000a, &upb_prm_1bt_max192b}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_FileDescriptorSet_submsgs[0], &google_protobuf_FileDescriptorSet__fields[0], @@ -86,38 +86,38 @@ static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12] const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, - {&upb_pss_1bt, UPB_SIZE(3377699720790034, 6755399441317906)}, - {&upb_prs_1bt, UPB_SIZE(10133099161583642, 20266198323167258)}, - {&upb_prm_1bt_max128b, UPB_SIZE(11258999068426274, 22517998136852514)}, - {&upb_prm_1bt_max128b, UPB_SIZE(12384898975334442, 24769797950603306)}, - {&upb_prm_1bt_max64b, UPB_SIZE(13510798882373682, 27021597764485170)}, - {&upb_prm_1bt_max128b, UPB_SIZE(14636698789085242, 29273397578039354)}, - {&upb_psm_1bt_max256b, UPB_SIZE(7881385247440962, 15762684595339330)}, - {&upb_psm_1bt_max64b, UPB_SIZE(9007289449381962, 18014488704122954)}, - {&upb_prv4_1bt, UPB_SIZE(15762598695796816, 31525197391593552)}, - {&upb_prv4_1bt, UPB_SIZE(16888498602639448, 33776997205278808)}, - {&upb_pss_1bt, UPB_SIZE(5629499534737506, 11258999068950626)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x000800000100000a, &upb_pss_1bt}, + {0x0018000002000012, &upb_pss_1bt}, + {0x004800003f00001a, &upb_prs_1bt}, + {0x005000003f000022, &upb_prm_1bt_max128b}, + {0x005800003f01002a, &upb_prm_1bt_max128b}, + {0x006000003f040032, &upb_prm_1bt_max64b}, + {0x006800003f02003a, &upb_prm_1bt_max128b}, + {0x0038000004030042, &upb_psm_1bt_max256b}, + {0x004000000505004a, &upb_psm_1bt_max64b}, + {0x007000003f000050, &upb_prv4_1bt}, + {0x007800003f000058, &upb_prv4_1bt}, + {0x0028000003000062, &upb_pss_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_FileDescriptorProto_submsgs[0], &google_protobuf_FileDescriptorProto__fields[0], @@ -149,38 +149,38 @@ static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10] = { const upb_msglayout google_protobuf_DescriptorProto_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, - {&upb_prm_1bt_max128b, UPB_SIZE(4503599627632658, 9007199255003154)}, - {&upb_prm_1bt_max128b, UPB_SIZE(5629499534213146, 11258999068426266)}, - {&upb_prm_1bt_max128b, UPB_SIZE(6755399441252386, 13510798882308130)}, - {&upb_prm_1bt_max64b, UPB_SIZE(7881299347963946, 15762598695862314)}, - {&upb_prm_1bt_max128b, UPB_SIZE(9007199255003186, 18014398509744178)}, - {&upb_psm_1bt_max64b, UPB_SIZE(3377777030266938, 6755476750794810)}, - {&upb_prm_1bt_max64b, UPB_SIZE(10133099161976898, 20266198323560514)}, - {&upb_prm_1bt_max64b, UPB_SIZE(11258999068557386, 22517998136983626)}, - {&upb_prs_1bt, UPB_SIZE(12384898975268946, 24769797950537810)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x000800000100000a, &upb_pss_1bt}, + {0x002000003f040012, &upb_prm_1bt_max128b}, + {0x002800003f00001a, &upb_prm_1bt_max128b}, + {0x003000003f030022, &upb_prm_1bt_max128b}, + {0x003800003f01002a, &upb_prm_1bt_max64b}, + {0x004000003f040032, &upb_prm_1bt_max128b}, + {0x001800000205003a, &upb_psm_1bt_max64b}, + {0x004800003f060042, &upb_prm_1bt_max64b}, + {0x005000003f02004a, &upb_prm_1bt_max64b}, + {0x005800003f000052, &upb_prs_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_DescriptorProto_submsgs[0], &google_protobuf_DescriptorProto__fields[0], @@ -199,38 +199,38 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange_ const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813947408, 2251799813947408)}, - {&upb_psm_1bt_max64b, UPB_SIZE(3377781324906522, 4503681231749146)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x0004000001000008, &upb_psv4_1bt}, + {0x0008000002000010, &upb_psv4_1bt}, + {0x001000000300001a, &upb_psm_1bt_max64b}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0], &google_protobuf_DescriptorProto_ExtensionRange__fields[0], @@ -244,38 +244,38 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__ const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813947408, 2251799813947408)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x0004000001000008, &upb_psv4_1bt}, + {0x0008000002000010, &upb_psv4_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, NULL, &google_protobuf_DescriptorProto_ReservedRange__fields[0], @@ -292,38 +292,38 @@ static const upb_msglayout_field google_protobuf_ExtensionRangeOptions__fields[1 const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_ExtensionRangeOptions_submsgs[0], &google_protobuf_ExtensionRangeOptions__fields[0], @@ -350,38 +350,38 @@ static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[11 const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(6755399445250058, 6755399445250058)}, - {&upb_pss_1bt, UPB_SIZE(9007199263129618, 11258999076814866)}, - {&upb_psv4_1bt, UPB_SIZE(3377699721052184, 3377699721052184)}, - {&upb_psv4_1bt, UPB_SIZE(1125899906973728, 1125899906973728)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813947432, 2251799813947432)}, - {&upb_pss_1bt, UPB_SIZE(11258999085203506, 15762598712574002)}, - {&upb_pss_1bt, UPB_SIZE(13510798915665978, 20266198356721722)}, - {&upb_psm_1bt_max64b, UPB_SIZE(18014514473599042, 29273513542025282)}, - {&upb_psv4_1bt, UPB_SIZE(4503599628419144, 4503599628419144)}, - {&upb_pss_1bt, UPB_SIZE(15762598762905682, 24769798017646674)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(5629499536310664, 5629499536310664)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x001800000600000a, &upb_pss_1bt}, + {0x0028000007000012, &upb_pss_1bt}, + {0x000c000003000018, &upb_psv4_1bt}, + {0x0004000001000020, &upb_psv4_1bt}, + {0x0008000002000028, &upb_psv4_1bt}, + {0x0038000008000032, &upb_pss_1bt}, + {0x004800000900003a, &upb_pss_1bt}, + {0x006800000b000042, &upb_psm_1bt_max64b}, + {0x0010000004000048, &upb_psv4_1bt}, + {0x005800000a000052, &upb_pss_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0014000005000188, &upb_psb1_2bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_FieldDescriptorProto_submsgs[0], &google_protobuf_FieldDescriptorProto__fields[0], @@ -399,38 +399,38 @@ static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2] const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, - {&upb_psm_1bt_max64b, UPB_SIZE(3377777029939218, 6755476750467090)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x000800000100000a, &upb_pss_1bt}, + {0x0018000002000012, &upb_psm_1bt_max64b}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_OneofDescriptorProto_submsgs[0], &google_protobuf_OneofDescriptorProto__fields[0], @@ -453,38 +453,38 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5] const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, - {&upb_prm_1bt_max64b, UPB_SIZE(4503599627501586, 9007199254872082)}, - {&upb_psm_1bt_max64b, UPB_SIZE(3377777030004762, 6755476750532634)}, - {&upb_prm_1bt_max64b, UPB_SIZE(5629499534213154, 11258999068426274)}, - {&upb_prs_1bt, UPB_SIZE(6755399441055786, 13510798882111530)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x000800000100000a, &upb_pss_1bt}, + {0x002000003f020012, &upb_prm_1bt_max64b}, + {0x001800000201001a, &upb_psm_1bt_max64b}, + {0x002800003f000022, &upb_prm_1bt_max64b}, + {0x003000003f00002a, &upb_prs_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_EnumDescriptorProto_submsgs[0], &google_protobuf_EnumDescriptorProto__fields[0], @@ -498,38 +498,38 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReserve const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813947408, 2251799813947408)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x0004000001000008, &upb_psv4_1bt}, + {0x0008000002000010, &upb_psv4_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, NULL, &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0], @@ -548,38 +548,38 @@ static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__field const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(2251799813947402, 2251799813947402)}, - {&upb_psv4_1bt, UPB_SIZE(1125899906973712, 1125899906973712)}, - {&upb_psm_1bt_max64b, UPB_SIZE(4503681231749146, 6755481045434394)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x000800000200000a, &upb_pss_1bt}, + {0x0004000001000010, &upb_psv4_1bt}, + {0x001800000300001a, &upb_psm_1bt_max64b}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_EnumValueDescriptorProto_submsgs[0], &google_protobuf_EnumValueDescriptorProto__fields[0], @@ -599,38 +599,38 @@ static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[ const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899906973706, 2251799813816330)}, - {&upb_prm_1bt_max128b, UPB_SIZE(4503599627370514, 9007199254741010)}, - {&upb_psm_1bt_max64b, UPB_SIZE(3377777030004762, 6755476750532634)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x000800000100000a, &upb_pss_1bt}, + {0x002000003f000012, &upb_prm_1bt_max128b}, + {0x001800000201001a, &upb_psm_1bt_max64b}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_ServiceDescriptorProto_submsgs[0], &google_protobuf_ServiceDescriptorProto__fields[0], @@ -652,38 +652,38 @@ static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6 const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899907366922, 2251799814209546)}, - {&upb_pss_1bt, UPB_SIZE(3377699721576466, 6755399442104338)}, - {&upb_pss_1bt, UPB_SIZE(5629499536310298, 11258999070523418)}, - {&upb_psm_1bt_max64b, UPB_SIZE(7881393837178914, 15762693185077282)}, - {&upb_psb1_1bt, UPB_SIZE(281474976841768, 281474976841768)}, - {&upb_psb1_1bt, UPB_SIZE(562949953683504, 562949953683504)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x000800000300000a, &upb_pss_1bt}, + {0x0018000004000012, &upb_pss_1bt}, + {0x002800000500001a, &upb_pss_1bt}, + {0x0038000006000022, &upb_psm_1bt_max64b}, + {0x0001000001000028, &upb_psb1_1bt}, + {0x0002000002000030, &upb_psb1_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_MethodDescriptorProto_submsgs[0], &google_protobuf_MethodDescriptorProto__fields[0], @@ -720,38 +720,38 @@ static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { const upb_msglayout google_protobuf_FileOptions_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(5629499668430858, 6755399575273482)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(7881299616333890, 11258999336861762)}, - {&upb_psv4_1bt, UPB_SIZE(1125899906973768, 1125899906973768)}, - {&upb_psb1_1bt, UPB_SIZE(2251799813947472, 2251799813947472)}, - {&upb_pss_1bt, UPB_SIZE(10133099698454618, 15762599232667738)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(2533274790920576, 2533274790920576)}, - {&upb_psb1_2bt, UPB_SIZE(2814749768155528, 2814749768155528)}, - {&upb_psb1_2bt, UPB_SIZE(3096224745914768, 3096224745914768)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(3377699724722592, 3377699724722592)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(3659174705627576, 3659174705627576)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(3940649690726872, 3940649690726872)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_2bt, UPB_SIZE(4222124684214776, 4222124684214776)}, + {0x0000000000000000, &fastdecode_generic}, + {0x001800000b00000a, &upb_pss_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x002800000c000042, &upb_pss_1bt}, + {0x0004000001000048, &upb_psv4_1bt}, + {0x0008000002000050, &upb_psb1_1bt}, + {0x003800000d00005a, &upb_pss_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0009000003000180, &upb_psb1_2bt}, + {0x000a000004000188, &upb_psb1_2bt}, + {0x000b000005000190, &upb_psb1_2bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x000c0000060001a0, &upb_psb1_2bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x000d0000070001b8, &upb_psb1_2bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x000e0000080001d8, &upb_psb1_2bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x000f0000090001f8, &upb_psb1_2bt}, }, &google_protobuf_FileOptions_submsgs[0], &google_protobuf_FileOptions__fields[0], @@ -772,38 +772,38 @@ static const upb_msglayout_field google_protobuf_MessageOptions__fields[5] = { const upb_msglayout google_protobuf_MessageOptions_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_1bt, UPB_SIZE(281474976841736, 281474976841736)}, - {&upb_psb1_1bt, UPB_SIZE(562949953683472, 562949953683472)}, - {&upb_psb1_1bt, UPB_SIZE(844424930656280, 844424930656280)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_1bt, UPB_SIZE(1125899907891256, 1125899907891256)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x0001000001000008, &upb_psb1_1bt}, + {0x0002000002000010, &upb_psb1_1bt}, + {0x0003000003000018, &upb_psb1_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0004000004000038, &upb_psb1_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_MessageOptions_submsgs[0], &google_protobuf_MessageOptions__fields[0], @@ -826,38 +826,38 @@ static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = { const upb_msglayout google_protobuf_FieldOptions_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psv4_1bt, UPB_SIZE(1125899906973704, 1125899906973704)}, - {&upb_psb1_1bt, UPB_SIZE(3377699721052176, 3377699721052176)}, - {&upb_psb1_1bt, UPB_SIZE(3659174698287128, 3659174698287128)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_1bt, UPB_SIZE(3940649676046376, 3940649676046376)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813947440, 2251799813947440)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_1bt, UPB_SIZE(4222124654854224, 4222124654854224)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x0004000001000008, &upb_psv4_1bt}, + {0x000c000003000010, &upb_psb1_1bt}, + {0x000d000004000018, &upb_psb1_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x000e000005000028, &upb_psb1_1bt}, + {0x0008000002000030, &upb_psv4_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x000f000006000050, &upb_psb1_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_FieldOptions_submsgs[0], &google_protobuf_FieldOptions__fields[0], @@ -874,38 +874,38 @@ static const upb_msglayout_field google_protobuf_OneofOptions__fields[1] = { const upb_msglayout google_protobuf_OneofOptions_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_OneofOptions_submsgs[0], &google_protobuf_OneofOptions__fields[0], @@ -924,38 +924,38 @@ static const upb_msglayout_field google_protobuf_EnumOptions__fields[3] = { const upb_msglayout google_protobuf_EnumOptions_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_1bt, UPB_SIZE(281474976841744, 281474976841744)}, - {&upb_psb1_1bt, UPB_SIZE(562949953683480, 562949953683480)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0001000001000010, &upb_psb1_1bt}, + {0x0002000002000018, &upb_psb1_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_EnumOptions_submsgs[0], &google_protobuf_EnumOptions__fields[0], @@ -973,38 +973,38 @@ static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2] = { const upb_msglayout google_protobuf_EnumValueOptions_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_psb1_1bt, UPB_SIZE(281474976841736, 281474976841736)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x0001000001000008, &upb_psb1_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_EnumValueOptions_submsgs[0], &google_protobuf_EnumValueOptions__fields[0], @@ -1022,38 +1022,38 @@ static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2] = { const upb_msglayout google_protobuf_ServiceOptions_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_ServiceOptions_submsgs[0], &google_protobuf_ServiceOptions__fields[0], @@ -1072,38 +1072,38 @@ static const upb_msglayout_field google_protobuf_MethodOptions__fields[3] = { const upb_msglayout google_protobuf_MethodOptions_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_MethodOptions_submsgs[0], &google_protobuf_MethodOptions__fields[0], @@ -1126,38 +1126,38 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption__fields[7] const upb_msglayout google_protobuf_UninterpretedOption_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_prm_1bt_max64b, UPB_SIZE(15762598695796754, 22517998136852498)}, - {&upb_pss_1bt, UPB_SIZE(9007199255789594, 9007199255789594)}, - {&upb_psv8_1bt, UPB_SIZE(2251799813816352, 2251799813816352)}, - {&upb_psv8_1bt, UPB_SIZE(4503599627632680, 4503599627632680)}, - {&upb_psf8_1bt, UPB_SIZE(6755399441580080, 6755399441580080)}, - {&upb_pss_1bt, UPB_SIZE(11258999070523450, 13510798884208698)}, - {&upb_pss_1bt, UPB_SIZE(13510798886305858, 18014398513676354)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x005000003f000012, &upb_prm_1bt_max64b}, + {0x002000000400001a, &upb_pss_1bt}, + {0x0008000001000020, &upb_psv8_1bt}, + {0x0010000002000028, &upb_psv8_1bt}, + {0x0018000003000030, &upb_psf8_1bt}, + {0x003000000500003a, &upb_pss_1bt}, + {0x0040000006000042, &upb_pss_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_UninterpretedOption_submsgs[0], &google_protobuf_UninterpretedOption__fields[0], @@ -1171,38 +1171,38 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__f const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899907104778, 2251799813947402)}, - {&upb_psb1_1bt, UPB_SIZE(281474976841744, 281474976841744)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x000800000200000a, &upb_pss_1bt}, + {0x0001000001000010, &upb_psb1_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, NULL, &google_protobuf_UninterpretedOption_NamePart__fields[0], @@ -1219,38 +1219,38 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1] = { const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_prm_1bt_max128b, UPB_SIZE(10, 10)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x000000003f00000a, &upb_prm_1bt_max128b}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_SourceCodeInfo_submsgs[0], &google_protobuf_SourceCodeInfo__fields[0], @@ -1267,38 +1267,38 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(1125899906973722, 2251799813816346)}, - {&upb_pss_1bt, UPB_SIZE(3377699720790050, 6755399441317922)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_prs_1bt, UPB_SIZE(7881299347898418, 15762598695796786)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x000800000100001a, &upb_pss_1bt}, + {0x0018000002000022, &upb_pss_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x003800003f000032, &upb_prs_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, NULL, &google_protobuf_SourceCodeInfo_Location__fields[0], @@ -1315,38 +1315,38 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1] = const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_prm_1bt_max64b, UPB_SIZE(10, 10)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x000000003f00000a, &upb_prm_1bt_max64b}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, &google_protobuf_GeneratedCodeInfo_submsgs[0], &google_protobuf_GeneratedCodeInfo__fields[0], @@ -1362,38 +1362,38 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__f const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { { - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&upb_pss_1bt, UPB_SIZE(3377699721052178, 4503599627894802)}, - {&upb_psv4_1bt, UPB_SIZE(1125899906973720, 1125899906973720)}, - {&upb_psv4_1bt, UPB_SIZE(2251799813947424, 2251799813947424)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, - {&fastdecode_generic, UPB_SIZE(0, 0)}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0010000003000012, &upb_pss_1bt}, + {0x0004000001000018, &upb_psv4_1bt}, + {0x0008000002000020, &upb_psv4_1bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, }, NULL, &google_protobuf_GeneratedCodeInfo_Annotation__fields[0], diff --git a/tests/conformance_upb.c b/tests/conformance_upb.c index fe9f5224e5..8d04b29486 100644 --- a/tests/conformance_upb.c +++ b/tests/conformance_upb.c @@ -286,6 +286,7 @@ int main(void) { if (!DoTestIo(symtab)) { fprintf(stderr, "conformance_upb: received EOF from test runner " "after %d tests, exiting\n", test_count); + upb_symtab_free(symtab); return 0; } } diff --git a/upb/decode.c b/upb/decode.c index 3dc5516cfe..014d5f741b 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -640,7 +640,7 @@ const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits, uint64_t data) { decode_parseret ret; - *(uint32_t*)msg |= hasbits >> 16; /* Sync hasbits. */ + *(uint32_t*)msg |= hasbits; /* Sync hasbits. */ (void)data; if (decode_isdone(d, &ptr)) return ptr; ret = decode_field(d, ptr, msg, table); diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 82c030c4cd..55eb3d5c3e 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -73,7 +73,7 @@ const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, int overrun = ptr - d->end; if (UPB_LIKELY(overrun == d->limit)) { // Parse is finished. - *(uint32_t*)msg |= hasbits >> 16; // Sync hasbits. + *(uint32_t*)msg |= hasbits; // Sync hasbits. return ptr; } else { return fastdecode_isdonefallback(d, ptr, msg, table, hasbits, overrun); @@ -188,29 +188,32 @@ static fastdecode_nextret fastdecode_nextrepeated(upb_decstate *d, void *dst, } UPB_FORCEINLINE -static void *fastdecode_getfield_ofs(upb_decstate *d, const char *ptr, - upb_msg *msg, uint64_t *data, - uint64_t *hasbits, fastdecode_arr *farr, - int valbytes, upb_card card, - bool hasbit_is_idx) { +static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, + uint64_t *data, uint64_t *hasbits, + fastdecode_arr *farr, int valbytes, + upb_card card) { size_t ofs = *data >> 48; void *field = (char *)msg + ofs; switch (card) { - case CARD_s: + case CARD_s: { + uint8_t hasbit_index = *data >> 24; // Set hasbit and return pointer to scalar field. - if (hasbit_is_idx) { - *hasbits |= 1ull << ((*data >> 32) & 63); - } else { - *hasbits |= *data; - } + *hasbits |= 1ull << hasbit_index; + return field; + } + case CARD_o: { + uint16_t case_ofs = *data >> 32; + uint32_t *oneof_case = UPB_PTR_AT(msg, case_ofs, uint32_t); + uint8_t field_number = *data >> 24; + *oneof_case = field_number; return field; + } case CARD_r: { // Get pointer to upb_array and allocate/expand if necessary. uint8_t elem_size_lg2 = __builtin_ctz(valbytes); upb_array **arr_p = field; char *begin; - *hasbits >>= 16; *(uint32_t*)msg |= *hasbits; *hasbits = 0; if (UPB_LIKELY(!*arr_p)) { @@ -259,8 +262,8 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, RETURN_GENERIC("varint field tag mismatch\n"); } - dst = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &farr, valbytes, - card, false); + dst = + fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, valbytes, card); if (card == CARD_r) { if (UPB_UNLIKELY(!dst)) { RETURN_GENERIC("need array resize\n"); @@ -362,8 +365,8 @@ static const char *fastdecode_fixed(UPB_PARSE_PARAMS, int tagbytes, RETURN_GENERIC("fixed field tag mismatch\n"); } - dst = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &farr, valbytes, - card, false); + dst = + fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, valbytes, card); if (card == CARD_r) { if (UPB_UNLIKELY(!dst)) { RETURN_GENERIC("couldn't allocate array in arena\n"); @@ -473,10 +476,10 @@ UPB_FORCEINLINE static void fastdecode_docopy(upb_decstate *d, const char *ptr, uint32_t size, int copy, char *data, upb_strview *dst) { d->arena.head.ptr += copy; + dst->data = data; UPB_UNPOISON_MEMORY_REGION(data, copy); memcpy(data, ptr, copy); UPB_POISON_MEMORY_REGION(data + size, copy - size); - dst->data = data; } UPB_FORCEINLINE @@ -492,8 +495,8 @@ static const char *fastdecode_copystring(UPB_PARSE_PARAMS, int tagbytes, UPB_ASSERT(!d->alias); UPB_ASSERT(fastdecode_checktag(data, tagbytes)); - dst = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &farr, - sizeof(upb_strview), card, false); + dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, + sizeof(upb_strview), card); again: if (card == CARD_r) { @@ -565,8 +568,8 @@ static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, return copyfunc(UPB_PARSE_ARGS); } - dst = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &farr, - sizeof(upb_strview), card, false); + dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, + sizeof(upb_strview), card); again: if (card == CARD_r) { @@ -579,6 +582,7 @@ again: dst->size = size; if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->end))) { + ptr--; return fastdecode_longstring(d, ptr, msg, table, hasbits, dst); } @@ -667,16 +671,15 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, if (--d->depth == 0) return fastdecode_err(d); upb_msg **submsg; - uint32_t submsg_idx = data; - submsg_idx >>= 16; + uint32_t submsg_idx = (data >> 16) & 0xff; const upb_msglayout *subl = table->submsgs[submsg_idx]; fastdecode_arr farr; - submsg = fastdecode_getfield_ofs(d, ptr, msg, &data, &hasbits, &farr, - sizeof(upb_msg *), card, true); + submsg = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, + sizeof(upb_msg *), card); if (card == CARD_s) { - *(uint32_t*)msg |= hasbits >> 16; + *(uint32_t*)msg |= hasbits; hasbits = 0; } diff --git a/upb/msg.h b/upb/msg.h index 8c87b42154..cd5fcb3672 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -55,8 +55,8 @@ typedef const char *_upb_field_parser(struct upb_decstate *d, const char *ptr, uint64_t hasbits, uint64_t data); typedef struct { - _upb_field_parser *field_parser; uint64_t field_data; + _upb_field_parser *field_parser; } _upb_fasttable_entry; typedef struct upb_msglayout { diff --git a/upbc/generator.cc b/upbc/generator.cc index 454d4d1a51..1a294371a4 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -736,7 +736,7 @@ struct SubmsgArray { absl::flat_hash_map indexes_; }; -typedef std::pair TableEntry; +typedef std::pair TableEntry; void TryFillTableEntry(const protobuf::Descriptor* message, const MessageLayout& layout, int num, TableEntry& ent) { @@ -801,7 +801,7 @@ void TryFillTableEntry(const protobuf::Descriptor* message, case protobuf::FieldDescriptor::LABEL_OPTIONAL: case protobuf::FieldDescriptor::LABEL_REQUIRED: if (field->real_containing_oneof()) { - return; // Not supported yet. + cardinality = "o"; } else { cardinality = "s"; } @@ -811,37 +811,49 @@ void TryFillTableEntry(const protobuf::Descriptor* message, uint16_t expected_tag = (num << 3) | wire_type; if (num > 15) expected_tag |= 0x100; MessageLayout::Size offset = layout.GetFieldOffset(field); - uint64_t hasbit_index = 0; // Zero means no hasbits. - - if (layout.HasHasbit(field)) { - hasbit_index = layout.GetHasbitIndex(field); - if (hasbit_index > 31) return; - // thas hasbits mask in the parser occupies bits 16-48 - // in the 64 bit register. - hasbit_index += 16; // account for the shifted hasbits - } - - MessageLayout::Size data; - data.size32 = ((uint64_t)offset.size32 << 48) | expected_tag; - data.size64 = ((uint64_t)offset.size64 << 48) | expected_tag; - - if (field->type() == protobuf::FieldDescriptor::TYPE_MESSAGE) { - SubmsgArray submsg_array(message); - uint64_t idx = submsg_array.GetIndex(field); - data.size32 |= idx << 16 | hasbit_index << 32; - data.size64 |= idx << 16 | hasbit_index << 32; + // Data is: + // + // 48 32 16 0 + // |--------|--------|--------|--------|--------|--------|--------|--------| + // | offset (16) |case offset (16) |presence| submsg | exp. tag (16) | + // |--------|--------|--------|--------|--------|--------|--------|--------| + // + // - |presence| is either hasbit index or field number for oneofs. + + uint64_t data = offset.size64 << 48 | expected_tag; + + if (field->is_repeated()) { + // No hasbit/oneof-related fields. + } if (field->real_containing_oneof()) { + MessageLayout::Size case_offset = + layout.GetOneofCaseOffset(field->real_containing_oneof()); + if (case_offset.size64 > 0xffff) return; + assert(field->number() < 256); + data |= field->number() << 24; + data |= case_offset.size64 << 32; } else { - uint64_t hasbit_mask = (1ull << hasbit_index) & -0x10000; - data.size32 |= (uint64_t)hasbit_mask; - data.size64 |= (uint64_t)hasbit_mask; + uint64_t hasbit_index = 63; // No hasbit (set a high, unused bit). + if (layout.HasHasbit(field)) { + hasbit_index = layout.GetHasbitIndex(field); + if (hasbit_index > 31) return; + } + data |= hasbit_index << 24; } + if (field->cpp_type() == protobuf::FieldDescriptor::CPPTYPE_MESSAGE) { + SubmsgArray submsg_array(message); + uint64_t idx = submsg_array.GetIndex(field); + if (idx > 255) return; + data |= idx << 16; - if (field->type() == protobuf::FieldDescriptor::TYPE_MESSAGE) { std::string size_ceil = "max"; size_t size = SIZE_MAX; if (field->message_type()->file() == field->file()) { + // We can only be guaranteed the size of the sub-message if it is in the + // same file as us. We could relax this to increase the speed of + // cross-file sub-message parsing if we are comfortable requiring that + // users compile all messages at the same time. MessageLayout sub_layout(field->message_type()); size = sub_layout.message_size().size64 + 8; } @@ -865,11 +877,8 @@ void TryFillTableEntry(const protobuf::Descriptor* message, std::vector FastDecodeTable(const protobuf::Descriptor* message, const MessageLayout& layout) { std::vector table; - MessageLayout::Size empty_size; - empty_size.size32 = 0; - empty_size.size64 = 0; for (int i = 0; i < 32; i++) { - table.emplace_back(TableEntry{"fastdecode_generic", empty_size}); + table.emplace_back(TableEntry{"fastdecode_generic", 0}); TryFillTableEntry(message, layout, i, table.back()); } return table; @@ -972,7 +981,8 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output) { output("const upb_msglayout $0 = {\n", MessageInit(message)); output(" {\n"); for (const auto& ent : table) { - output(" {&$0, $1},\n", ent.first, GetSizeInit(ent.second)); + output(" {0x$1, &$0},\n", ent.first, + absl::StrCat(absl::Hex(ent.second, absl::kZeroPad16))); } output(" },\n"); output(" $0,\n", submsgs_array_ref); From 86d9908c55011c10135193023576d35bc9b7a42c Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sat, 24 Oct 2020 23:13:13 -0700 Subject: [PATCH 70/88] Fastdecode support for packed fields. This is not very optimized yet. There is a lot of room to optimize it further. --- cmake/google/protobuf/descriptor.upb.c | 8 +- tests/bindings/lua/test.proto | 16 + tests/bindings/lua/test_upb.lua | 59 ++++ upb/decode_fast.c | 413 ++++++++++++++++++------- upb/decode_fast.h | 1 + upbc/generator.cc | 8 +- 6 files changed, 393 insertions(+), 112 deletions(-) diff --git a/cmake/google/protobuf/descriptor.upb.c b/cmake/google/protobuf/descriptor.upb.c index 70978297c6..4129350f81 100644 --- a/cmake/google/protobuf/descriptor.upb.c +++ b/cmake/google/protobuf/descriptor.upb.c @@ -1132,7 +1132,7 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { {0x002000000400001a, &upb_pss_1bt}, {0x0008000001000020, &upb_psv8_1bt}, {0x0010000002000028, &upb_psv8_1bt}, - {0x0018000003000030, &upb_psf8_1bt}, + {0x0018000003000031, &upb_psf8_1bt}, {0x003000000500003a, &upb_pss_1bt}, {0x0040000006000042, &upb_pss_1bt}, {0x0000000000000000, &fastdecode_generic}, @@ -1268,8 +1268,8 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { { {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, + {0x002800003f00000a, &upb_ppv4_1bt}, + {0x003000003f000012, &upb_ppv4_1bt}, {0x000800000100001a, &upb_pss_1bt}, {0x0018000002000022, &upb_pss_1bt}, {0x0000000000000000, &fastdecode_generic}, @@ -1363,7 +1363,7 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__f const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { { {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, + {0x002000003f00000a, &upb_ppv4_1bt}, {0x0010000003000012, &upb_pss_1bt}, {0x0004000001000018, &upb_psv4_1bt}, {0x0008000002000020, &upb_psv4_1bt}, diff --git a/tests/bindings/lua/test.proto b/tests/bindings/lua/test.proto index c4b7e9c3db..2803835da5 100644 --- a/tests/bindings/lua/test.proto +++ b/tests/bindings/lua/test.proto @@ -6,3 +6,19 @@ package upb_test; message MapTest { map map_string_double = 1; } + +message PackedTest { + repeated bool bool_packed = 1 [packed = true]; + repeated int32 i32_packed = 2 [packed = true]; + repeated int64 i64_packed = 3 [packed = true]; + repeated fixed32 f32_packed = 4 [packed = true]; + repeated fixed64 f64_packed = 5 [packed = true]; +} + +message UnpackedTest { + repeated bool bool_packed = 1 [packed = false]; + repeated int32 i32_packed = 2 [packed = false]; + repeated int64 i64_packed = 3 [packed = false]; + repeated fixed32 f32_packed = 4 [packed = false]; + repeated fixed64 f64_packed = 5 [packed = false]; +} diff --git a/tests/bindings/lua/test_upb.lua b/tests/bindings/lua/test_upb.lua index 7573539a6b..b649f6043f 100644 --- a/tests/bindings/lua/test_upb.lua +++ b/tests/bindings/lua/test_upb.lua @@ -133,6 +133,65 @@ function test_string_double_map() assert_equal(2.5, msg2.map_string_double["two point five"]) end +function test_string_double_map() + local function fill_msg(msg) + msg.i32_packed[1] = 100 + msg.i32_packed[2] = 200 + msg.i32_packed[3] = 50000 + + msg.i64_packed[1] = 101 + msg.i64_packed[2] = 201 + msg.i64_packed[3] = 50001 + + msg.f32_packed[1] = 102 + msg.f32_packed[2] = 202 + msg.f32_packed[3] = 50002 + + msg.f64_packed[1] = 103 + msg.f64_packed[2] = 203 + msg.f64_packed[3] = 50003 + end + + local function check_msg(msg) + assert_equal(100, msg.i32_packed[1]) + assert_equal(200, msg.i32_packed[2]) + assert_equal(50000, msg.i32_packed[3]) + assert_equal(3, #msg.i32_packed) + + assert_equal(101, msg.i64_packed[1]) + assert_equal(201, msg.i64_packed[2]) + assert_equal(50001, msg.i64_packed[3]) + assert_equal(3, #msg.i64_packed) + + assert_equal(102, msg.f32_packed[1]) + assert_equal(202, msg.f32_packed[2]) + assert_equal(50002, msg.f32_packed[3]) + assert_equal(3, #msg.f32_packed) + + assert_equal(103, msg.f64_packed[1]) + assert_equal(203, msg.f64_packed[2]) + assert_equal(50003, msg.f64_packed[3]) + assert_equal(3, #msg.f64_packed) + end + + local msg = upb_test.PackedTest() + fill_msg(msg) + check_msg(msg) + + local serialized_packed = upb.encode(msg) + local msg2 = upb.decode(upb_test.PackedTest, serialized_packed) + local msg3 = upb.decode(upb_test.UnpackedTest, serialized_packed) + check_msg(msg2) + check_msg(msg3) + + serialized_unpacked = upb.encode(msg3) + local msg4 = upb.decode(upb_test.PackedTest, serialized_unpacked) + local msg5 = upb.decode(upb_test.PackedTest, serialized_unpacked) + check_msg(msg4) + check_msg(msg5) + +end + function test_msg_string_map() msg = test_messages_proto3.TestAllTypesProto3() msg.map_string_string["foo"] = "bar" diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 55eb3d5c3e..e2252ed54f 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -3,6 +3,10 @@ // // Could potentially be ported to ARM64 or other 64-bit archs that pass at // least six arguments in registers. +// +// The overall design is to create specialized functions for every possible +// field type (eg. oneof boolean field with a 1 byte tag) and then dispatch +// to the specialized function as quickly as possible. #include "upb/decode_fast.h" @@ -26,7 +30,8 @@ typedef enum { CARD_s = 0, /* Singular (optional, non-repeated) */ CARD_o = 1, /* Oneof */ - CARD_r = 2 /* Repeated */ + CARD_r = 2, /* Repeated */ + CARD_p = 3 /* Packed Repeated */ } upb_card; UPB_FORCEINLINE @@ -113,6 +118,72 @@ static const char *fastdecode_longsize(const char *ptr, int *size) { return ptr; } +UPB_FORCEINLINE +static bool fastdecode_boundscheck(const char *ptr, size_t len, + const char *end) { + uintptr_t uptr = (uintptr_t)ptr; + uintptr_t uend = (uintptr_t)end + 16; + uintptr_t res = uptr + len; + return res < uptr || res > uend; +} + +UPB_FORCEINLINE +static bool fastdecode_boundscheck2(const char *ptr, size_t len, + const char *end) { + // This is one extra branch compared to the more normal: + // return (size_t)(end - ptr) < size; + // However it is one less computation if we are just about to use "ptr + len": + // https://godbolt.org/z/35YGPz + // In microbenchmarks this shows an overall 4% improvement. + uintptr_t uptr = (uintptr_t)ptr; + uintptr_t uend = (uintptr_t)end; + uintptr_t res = uptr + len; + return res < uptr || res > uend; +} + +typedef const char *fastdecode_delimfunc(upb_decstate *d, const char *ptr, + void *ctx); + +UPB_FORCEINLINE +static const char *fastdecode_delimited(upb_decstate *d, const char *ptr, + fastdecode_delimfunc *func, void *ctx) { + ptr++; + int len = (int8_t)ptr[-1]; + if (fastdecode_boundscheck2(ptr, len, d->limit_ptr)) { + // Slow case: Sub-message is >=128 bytes and/or exceeds the current buffer. + // If it exceeds the buffer limit, limit/limit_ptr will change during + // sub-message parsing, so we need to preserve delta, not limit. + if (UPB_UNLIKELY(len & 0x80)) { + // Size varint >1 byte (length >= 128). + ptr = fastdecode_longsize(ptr, &len); + if (!ptr) { + // Corrupt wire format: size exceeded INT_MAX. + return NULL; + } + } + if (ptr - d->end + (int)len > d->limit) { + // Corrupt wire format: invalid limit. + return NULL; + } + int delta = decode_pushlimit(d, ptr, len); + ptr = func(d, ptr, ctx); + decode_poplimit(d, delta); + } else { + // Fast case: Sub-message is <128 bytes and fits in the current buffer. + // This means we can preserve limit/limit_ptr verbatim. + const char *saved_limit_ptr = d->limit_ptr; + int saved_limit = d->limit; + d->limit_ptr = ptr + len; + d->limit = d->limit_ptr - d->end; + UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); + ptr = func(d, ptr, ctx); + d->limit_ptr = saved_limit_ptr; + d->limit = saved_limit; + UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); + } + return ptr; +} + /* singular, oneof, repeated field handling ***********************************/ typedef struct { @@ -142,8 +213,9 @@ static void *fastdecode_resizearr(upb_decstate *d, void *dst, size_t new_bytes = new_size * valbytes; char *old_ptr = _upb_array_ptr(farr->arr); char *new_ptr = upb_arena_realloc(&d->arena, old_ptr, old_bytes, new_bytes); + uint8_t elem_size_lg2 = __builtin_ctz(valbytes); farr->arr->size = new_size; - farr->arr->data = _upb_array_tagptr(new_ptr, 3); + farr->arr->data = _upb_array_tagptr(new_ptr, elem_size_lg2); dst = (void*)(new_ptr + (old_size * valbytes)); farr->end = (void*)(new_ptr + (new_size * valbytes)); } @@ -159,6 +231,13 @@ static bool fastdecode_tagmatch(uint32_t tag, uint64_t data, int tagbytes) { } } +UPB_FORCEINLINE +static void fastdecode_commitarr(void *dst, fastdecode_arr *farr, + int valbytes) { + farr->arr->len = + (size_t)((char *)dst - (char *)_upb_array_ptr(farr->arr)) / valbytes; +} + UPB_FORCEINLINE static fastdecode_nextret fastdecode_nextrepeated(upb_decstate *d, void *dst, const char **ptr, @@ -173,13 +252,11 @@ static fastdecode_nextret fastdecode_nextrepeated(upb_decstate *d, void *dst, if (fastdecode_tagmatch(ret.tag, data, tagbytes)) { ret.next = FD_NEXT_SAMEFIELD; } else { - farr->arr->len = - (size_t)((char *)dst - (char *)_upb_array_ptr(farr->arr)) / valbytes; + fastdecode_commitarr(dst, farr, valbytes); ret.next = FD_NEXT_OTHERFIELD; } } else { - farr->arr->len = - (size_t)((char *)dst - (char *)_upb_array_ptr(farr->arr)) / valbytes; + fastdecode_commitarr(dst, farr, valbytes); ret.next = FD_NEXT_ATLIMIT; } @@ -187,32 +264,35 @@ static fastdecode_nextret fastdecode_nextrepeated(upb_decstate *d, void *dst, return ret; } +UPB_FORCEINLINE +static void *fastdecode_fieldmem(upb_msg *msg, uint64_t data) { + size_t ofs = data >> 48; + return (char *)msg + ofs; +} + UPB_FORCEINLINE static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, uint64_t *data, uint64_t *hasbits, fastdecode_arr *farr, int valbytes, upb_card card) { - size_t ofs = *data >> 48; - void *field = (char *)msg + ofs; - switch (card) { case CARD_s: { uint8_t hasbit_index = *data >> 24; // Set hasbit and return pointer to scalar field. *hasbits |= 1ull << hasbit_index; - return field; + return fastdecode_fieldmem(msg, *data); } case CARD_o: { uint16_t case_ofs = *data >> 32; uint32_t *oneof_case = UPB_PTR_AT(msg, case_ofs, uint32_t); uint8_t field_number = *data >> 24; *oneof_case = field_number; - return field; + return fastdecode_fieldmem(msg, *data); } case CARD_r: { // Get pointer to upb_array and allocate/expand if necessary. uint8_t elem_size_lg2 = __builtin_ctz(valbytes); - upb_array **arr_p = field; + upb_array **arr_p = fastdecode_fieldmem(msg, *data); char *begin; *(uint32_t*)msg |= *hasbits; *hasbits = 0; @@ -223,16 +303,21 @@ static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, farr->arr = *arr_p; } begin = _upb_array_ptr(farr->arr); - field = begin + (farr->arr->len * valbytes); farr->end = begin + (farr->arr->size * valbytes); *data = fastdecode_loadtag(ptr); - return field; + return begin + (farr->arr->len * valbytes); } default: UPB_UNREACHABLE(); } } +UPB_FORCEINLINE +static bool fastdecode_flippacked(uint64_t *data, int tagbytes) { + *data ^= (0x2 ^ 0x0); // Patch data to match packed wiretype. + return fastdecode_checktag(*data, tagbytes); +} + /* varint fields **************************************************************/ UPB_FORCEINLINE @@ -252,13 +337,42 @@ static uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigzag) { } UPB_FORCEINLINE -static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, - int valbytes, upb_card card, bool zigzag) { +static const char *fastdecode_varint64(const char *ptr, uint64_t *val) { + ptr++; + *val = (uint8_t)ptr[-1]; + if (UPB_UNLIKELY(*val & 0x80)) { + int i; + for (i = 0; i < 8; i++) { + ptr++; + uint64_t byte = (uint8_t)ptr[-1]; + *val += (byte - 1) << (7 + 7 * i); + if (UPB_LIKELY((byte & 0x80) == 0)) goto done; + } + ptr++; + uint64_t byte = (uint8_t)ptr[-1]; + if (byte > 1) { + return NULL; + } + *val += (byte - 1) << 63; + } +done: + __builtin_assume(ptr != NULL); + return ptr; +} + +UPB_FORCEINLINE +static const char *fastdecode_unpackedvarint(UPB_PARSE_PARAMS, int tagbytes, + int valbytes, upb_card card, + bool zigzag, + _upb_field_parser *packed) { uint64_t val; void *dst; fastdecode_arr farr; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + if (card == CARD_r && fastdecode_flippacked(&data, tagbytes)) { + return packed(UPB_PARSE_ARGS); + } RETURN_GENERIC("varint field tag mismatch\n"); } @@ -275,25 +389,9 @@ again: dst = fastdecode_resizearr(d, dst, &farr, valbytes); } - ptr += tagbytes + 1; - val = (uint8_t)ptr[-1]; - if (UPB_UNLIKELY(val & 0x80)) { - int i; - for (i = 0; i < 8; i++) { - ptr++; - uint64_t byte = (uint8_t)ptr[-1]; - val += (byte - 1) << (7 + 7 * i); - if (UPB_LIKELY((byte & 0x80) == 0)) goto done; - } - ptr++; - uint64_t byte = (uint8_t)ptr[-1]; - if (byte > 1) { - return fastdecode_err(d); - } - val += (byte - 1) << 63; - } - -done: + ptr += tagbytes; + ptr = fastdecode_varint64(ptr, &val); + if (ptr == NULL) return fastdecode_err(d); val = fastdecode_munge(val, valbytes, zigzag); memcpy(dst, &val, valbytes); @@ -314,17 +412,90 @@ done: return fastdecode_dispatch(d, ptr, msg, table, hasbits); } +typedef struct { + uint8_t valbytes; + bool zigzag; + void *dst; + fastdecode_arr farr; +} fastdecode_varintdata; + +UPB_FORCEINLINE +static const char *fastdecode_topackedvarint(upb_decstate *d, const char *ptr, + void *ctx) { + fastdecode_varintdata *data = ctx; + void *dst = data->dst; + uint64_t val; + + while (!decode_isdone(d, &ptr)) { + dst = fastdecode_resizearr(d, dst, &data->farr, data->valbytes); + ptr = fastdecode_varint64(ptr, &val); + if (ptr == NULL) return NULL; + val = fastdecode_munge(val, data->valbytes, data->zigzag); + memcpy(dst, &val, data->valbytes); + dst = (char *)dst + data->valbytes; + } + + fastdecode_commitarr(dst, &data->farr, data->valbytes); + return ptr; +} + +UPB_FORCEINLINE +static const char *fastdecode_packedvarint(UPB_PARSE_PARAMS, int tagbytes, + int valbytes, bool zigzag, + _upb_field_parser *unpacked) { + fastdecode_varintdata ctx = {valbytes, zigzag}; + + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + if (fastdecode_flippacked(&data, tagbytes)) { + return unpacked(UPB_PARSE_ARGS); + } else { + RETURN_GENERIC("varint field tag mismatch\n"); + } + } + + ctx.dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &ctx.farr, + valbytes, CARD_r); + if (UPB_UNLIKELY(!ctx.dst)) { + RETURN_GENERIC("need array resize\n"); + } + + ptr += tagbytes; + ptr = fastdecode_delimited(d, ptr, &fastdecode_topackedvarint, &ctx); + + if (UPB_UNLIKELY(ptr == NULL)) { + return fastdecode_err(d); + } + + return fastdecode_dispatch(d, ptr, msg, table, hasbits); +} + +UPB_FORCEINLINE +static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, + int valbytes, upb_card card, bool zigzag, + _upb_field_parser *unpacked, + _upb_field_parser *packed) { + if (card == CARD_p) { + return fastdecode_packedvarint(UPB_PARSE_ARGS, tagbytes, valbytes, zigzag, + unpacked); + } else { + return fastdecode_unpackedvarint(UPB_PARSE_ARGS, tagbytes, valbytes, card, + zigzag, packed); + } +} + #define z_ZZ true #define b_ZZ false #define v_ZZ false /* Generate all combinations: - * {s,o,r} x {b1,v4,z4,v8,z8} x {1bt,2bt} */ + * {s,o,r,p} x {b1,v4,z4,v8,z8} x {1bt,2bt} */ #define F(card, type, valbytes, tagbytes) \ const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ return fastdecode_varint(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card, \ - type##_ZZ); \ + type##_ZZ, \ + &upb_pr##type##valbytes##_##tagbytes##bt, \ + &upb_pp##type##valbytes##_##tagbytes##bt); \ } #define TYPES(card, tagbytes) \ @@ -341,6 +512,7 @@ done: TAGBYTES(s) TAGBYTES(o) TAGBYTES(r) +TAGBYTES(p) #undef z_ZZ #undef b_ZZ @@ -356,12 +528,16 @@ TAGBYTES(r) /* fixed fields ***************************************************************/ UPB_FORCEINLINE -static const char *fastdecode_fixed(UPB_PARSE_PARAMS, int tagbytes, - int valbytes, upb_card card) { +static const char *fastdecode_unpackedfixed(UPB_PARSE_PARAMS, int tagbytes, + int valbytes, upb_card card, + _upb_field_parser *packed) { void *dst; fastdecode_arr farr; if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + if (card == CARD_r && fastdecode_flippacked(&data, tagbytes)) { + return packed(UPB_PARSE_ARGS); + } RETURN_GENERIC("fixed field tag mismatch\n"); } @@ -400,12 +576,71 @@ again: return fastdecode_dispatch(d, ptr, msg, table, hasbits); } +UPB_FORCEINLINE +static const char *fastdecode_packedfixed(UPB_PARSE_PARAMS, int tagbytes, + int valbytes, + _upb_field_parser *unpacked) { + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + if (fastdecode_flippacked(&data, tagbytes)) { + return unpacked(UPB_PARSE_ARGS); + } else { + RETURN_GENERIC("varint field tag mismatch\n"); + } + } + + int size = (uint8_t)ptr[0]; + ptr++; + if (size & 0x80) { + ptr = fastdecode_longsize(ptr, &size); + } + + if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->limit_ptr)) || + (size % valbytes) != 0) { + return fastdecode_err(d); + } + + upb_array **arr_p = fastdecode_fieldmem(msg, data); + upb_array *arr = *arr_p; + uint8_t elem_size_lg2 = __builtin_ctz(valbytes); + int elems = size / valbytes; + + if (UPB_LIKELY(!arr)) { + *arr_p = arr = _upb_array_new(&d->arena, elems, elem_size_lg2); + if (!arr) { + return fastdecode_err(d); + } + } else { + _upb_array_resize(arr, elems, &d->arena); + } + + char *dst = _upb_array_ptr(arr); + memcpy(dst, ptr, size); + arr->len = elems; + + return fastdecode_dispatch(d, ptr + size, msg, table, hasbits); +} + + +static const char *fastdecode_fixed(UPB_PARSE_PARAMS, int tagbytes, + int valbytes, upb_card card, + _upb_field_parser *unpacked, + _upb_field_parser *packed) { + if (card == CARD_p) { + return fastdecode_packedfixed(UPB_PARSE_ARGS, tagbytes, valbytes, unpacked); + } else { + return fastdecode_unpackedfixed(UPB_PARSE_ARGS, tagbytes, valbytes, card, + packed); + } +} + /* Generate all combinations: - * {s,o,r} x {f4,f8} x {1bt,2bt} */ + * {s,o,r,p} x {f4,f8} x {1bt,2bt} */ -#define F(card, valbytes, tagbytes) \ - const char *upb_p##card##f##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ - return fastdecode_fixed(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card); \ +#define F(card, valbytes, tagbytes) \ + const char *upb_p##card##f##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ + return fastdecode_fixed(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card, \ + &upb_ppf##valbytes##_##tagbytes##bt, \ + &upb_prf##valbytes##_##tagbytes##bt); \ } #define TYPES(card, tagbytes) \ @@ -419,6 +654,7 @@ again: TAGBYTES(s) TAGBYTES(o) TAGBYTES(r) +TAGBYTES(p) #undef F #undef TYPES @@ -426,15 +662,6 @@ TAGBYTES(r) /* string fields **************************************************************/ -UPB_FORCEINLINE -static bool fastdecode_boundscheck(const char *ptr, size_t len, - const char *end) { - uintptr_t uptr = (uintptr_t)ptr; - uintptr_t uend = (uintptr_t)end + 16; - uintptr_t res = uptr + len; - return res < uptr || res > uend; -} - typedef const char *fastdecode_copystr_func(struct upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, @@ -631,15 +858,6 @@ TAGBYTES(r) /* message fields *************************************************************/ -UPB_FORCEINLINE -static bool fastdecode_boundscheck2(const char *ptr, size_t len, - const char *end) { - uintptr_t uptr = (uintptr_t)ptr; - uintptr_t uend = (uintptr_t)end; - uintptr_t res = uptr + len; - return res < uptr || res > uend; -} - UPB_INLINE upb_msg *decode_newmsg_ceil(upb_decstate *d, const upb_msglayout *l, int msg_ceil_bytes) { @@ -660,6 +878,20 @@ upb_msg *decode_newmsg_ceil(upb_decstate *d, const upb_msglayout *l, return msg_data + sizeof(upb_msg_internal); } +typedef struct { + const upb_msglayout *layout; + upb_msg *msg; +} fastdecode_submsgdata; + +UPB_FORCEINLINE +static const char *fastdecode_tosubmsg(upb_decstate *d, const char *ptr, + void *ctx) { + fastdecode_submsgdata *submsg = ctx; + ptr = fastdecode_dispatch(d, ptr, submsg->msg, submsg->layout, 0); + __builtin_assume(ptr != NULL); + return ptr; +} + UPB_FORCEINLINE static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, int msg_ceil_bytes, upb_card card) { @@ -670,13 +902,13 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, if (--d->depth == 0) return fastdecode_err(d); - upb_msg **submsg; + upb_msg **dst; uint32_t submsg_idx = (data >> 16) & 0xff; - const upb_msglayout *subl = table->submsgs[submsg_idx]; + fastdecode_submsgdata submsg = {table->submsgs[submsg_idx]}; fastdecode_arr farr; - submsg = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, - sizeof(upb_msg *), card); + dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, &farr, + sizeof(upb_msg *), card); if (card == CARD_s) { *(uint32_t*)msg |= hasbits; @@ -685,59 +917,28 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, again: if (card == CARD_r) { - submsg = fastdecode_resizearr(d, submsg, &farr, sizeof(upb_msg*)); + dst = fastdecode_resizearr(d, dst, &farr, sizeof(upb_msg*)); } - upb_msg* child = *submsg; + submsg.msg = *dst; - if (card == CARD_r || UPB_LIKELY(!child)) { - *submsg = child = decode_newmsg_ceil(d, subl, msg_ceil_bytes); + if (card == CARD_r || UPB_LIKELY(!submsg.msg)) { + *dst = submsg.msg = decode_newmsg_ceil(d, submsg.layout, msg_ceil_bytes); } - ptr += tagbytes + 1; - int len = (int8_t)ptr[-1]; - if (fastdecode_boundscheck2(ptr, len, d->limit_ptr)) { - // Slow case: Sub-message is >=128 bytes and/or exceeds the current buffer. - // If it exceeds the buffer limit, limit/limit_ptr will change during - // sub-message parsing, so we need to preserve delta, not limit. - if (UPB_UNLIKELY(len & 0x80)) { - // Size varint >1 byte (length >= 128). - ptr = fastdecode_longsize(ptr, &len); - if (!ptr) { - // Corrupt wire format: size exceeded INT_MAX. - return fastdecode_err(d); - } - } - if (ptr - d->end + (int)len > d->limit) { - // Corrupt wire format: invalid limit. - return fastdecode_err(d); - } - int delta = decode_pushlimit(d, ptr, len); - ptr = fastdecode_dispatch(d, ptr, child, subl, 0); - decode_poplimit(d, delta); - } else { - // Fast case: Sub-message is <128 bytes and fits in the current buffer. - // This means we can preserve limit/limit_ptr verbatim. - const char *saved_limit_ptr = d->limit_ptr; - int saved_limit = d->limit; - d->limit_ptr = ptr + len; - d->limit = d->limit_ptr - d->end; - UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); - ptr = fastdecode_dispatch(d, ptr, child, subl, 0); - d->limit_ptr = saved_limit_ptr; - d->limit = saved_limit; - UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); - } - if (UPB_UNLIKELY(d->end_group != 0)) { + ptr += tagbytes; + ptr = fastdecode_delimited(d, ptr, fastdecode_tosubmsg, &submsg); + + if (UPB_UNLIKELY(ptr == NULL || d->end_group != 0)) { return fastdecode_err(d); } if (card == CARD_r) { fastdecode_nextret ret = fastdecode_nextrepeated( - d, submsg, &ptr, &farr, data, tagbytes, sizeof(upb_msg *)); + d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_msg *)); switch (ret.next) { case FD_NEXT_SAMEFIELD: - submsg = ret.dst; + dst = ret.dst; goto again; case FD_NEXT_OTHERFIELD: d->depth++; diff --git a/upb/decode_fast.h b/upb/decode_fast.h index e59e27108e..301010c6bb 100644 --- a/upb/decode_fast.h +++ b/upb/decode_fast.h @@ -42,6 +42,7 @@ const char *fastdecode_generic(struct upb_decstate *d, const char *ptr, TAGBYTES(s) TAGBYTES(o) TAGBYTES(r) +TAGBYTES(p) #undef F #undef TYPES diff --git a/upbc/generator.cc b/upbc/generator.cc index 1a294371a4..6005e25146 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -763,11 +763,13 @@ void TryFillTableEntry(const protobuf::Descriptor* message, case protobuf::FieldDescriptor::TYPE_SFIXED32: case protobuf::FieldDescriptor::TYPE_FLOAT: type = "f4"; + wire_type = 5; break; case protobuf::FieldDescriptor::TYPE_FIXED64: case protobuf::FieldDescriptor::TYPE_SFIXED64: case protobuf::FieldDescriptor::TYPE_DOUBLE: type = "f8"; + wire_type = 1; break; case protobuf::FieldDescriptor::TYPE_SINT32: type = "z4"; @@ -793,9 +795,11 @@ void TryFillTableEntry(const protobuf::Descriptor* message, switch (field->label()) { case protobuf::FieldDescriptor::LABEL_REPEATED: - cardinality = "r"; if (field->is_packed()) { - return; // Not supported yet. + cardinality = "p"; + wire_type = 2; + } else { + cardinality = "r"; } break; case protobuf::FieldDescriptor::LABEL_OPTIONAL: From 021db6fcd57f2e27fe5801d55771d19464c31929 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 25 Oct 2020 10:44:39 -0700 Subject: [PATCH 71/88] Allow larger tags into the table if they are unique mod 31. Also fixed a bug with fixed packed in decode_fast.c. --- cmake/google/protobuf/descriptor.upb.c | 30 ++++++++-------- upb/decode_fast.c | 1 + upbc/generator.cc | 48 ++++++++++++++++++-------- 3 files changed, 49 insertions(+), 30 deletions(-) diff --git a/cmake/google/protobuf/descriptor.upb.c b/cmake/google/protobuf/descriptor.upb.c index 4129350f81..60e0c42f8c 100644 --- a/cmake/google/protobuf/descriptor.upb.c +++ b/cmake/google/protobuf/descriptor.upb.c @@ -299,7 +299,7 @@ const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, + {0x000000003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -724,16 +724,16 @@ const upb_msglayout google_protobuf_FileOptions_msginit = { {0x001800000b00000a, &upb_pss_1bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, + {0x004800000e0002a2, &upb_pss_2bt}, + {0x005800000f0002aa, &upb_pss_2bt}, {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, + {0x00680000100002ba, &upb_pss_2bt}, {0x002800000c000042, &upb_pss_1bt}, {0x0004000001000048, &upb_psv4_1bt}, {0x0008000002000050, &upb_psb1_1bt}, {0x003800000d00005a, &upb_pss_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, + {0x00980000130002e2, &upb_pss_2bt}, + {0x00a80000140002ea, &upb_pss_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0009000003000180, &upb_psb1_2bt}, @@ -833,7 +833,7 @@ const upb_msglayout google_protobuf_FieldOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x000e000005000028, &upb_psb1_1bt}, {0x0008000002000030, &upb_psv4_1bt}, - {0x0000000000000000, &fastdecode_generic}, + {0x001000003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x000f000006000050, &upb_psb1_1bt}, @@ -881,7 +881,7 @@ const upb_msglayout google_protobuf_OneofOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, + {0x000000003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -931,7 +931,7 @@ const upb_msglayout google_protobuf_EnumOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, + {0x000800003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -980,7 +980,7 @@ const upb_msglayout google_protobuf_EnumValueOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, + {0x000800003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -1023,13 +1023,13 @@ static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2] = { const upb_msglayout google_protobuf_ServiceOptions_msginit = { { {0x0000000000000000, &fastdecode_generic}, + {0x0001000001000288, &upb_psb1_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, + {0x000800003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -1073,13 +1073,13 @@ static const upb_msglayout_field google_protobuf_MethodOptions__fields[3] = { const upb_msglayout google_protobuf_MethodOptions_msginit = { { {0x0000000000000000, &fastdecode_generic}, + {0x0008000002000288, &upb_psb1_2bt}, + {0x0004000001000290, &upb_psv4_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, + {0x001000003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, diff --git a/upb/decode_fast.c b/upb/decode_fast.c index e2252ed54f..7590b816eb 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -588,6 +588,7 @@ static const char *fastdecode_packedfixed(UPB_PARSE_PARAMS, int tagbytes, } } + ptr += tagbytes; int size = (uint8_t)ptr[0]; ptr++; if (size & 0x80) { diff --git a/upbc/generator.cc b/upbc/generator.cc index 6005e25146..4a6cce2a7e 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -739,13 +739,13 @@ struct SubmsgArray { typedef std::pair TableEntry; void TryFillTableEntry(const protobuf::Descriptor* message, - const MessageLayout& layout, int num, TableEntry& ent) { - const protobuf::FieldDescriptor* field = message->FindFieldByNumber(num); - if (!field) return; - + const MessageLayout& layout, + const protobuf::FieldDescriptor* field, + TableEntry& ent) { std::string type = ""; std::string cardinality = ""; - uint8_t wire_type = 0; + protobuf::internal::WireFormatLite::WireType wire_type = + protobuf::internal::WireFormatLite::WIRETYPE_VARINT; switch (field->type()) { case protobuf::FieldDescriptor::TYPE_BOOL: type = "b1"; @@ -763,13 +763,13 @@ void TryFillTableEntry(const protobuf::Descriptor* message, case protobuf::FieldDescriptor::TYPE_SFIXED32: case protobuf::FieldDescriptor::TYPE_FLOAT: type = "f4"; - wire_type = 5; + wire_type = protobuf::internal::WireFormatLite::WIRETYPE_FIXED32; break; case protobuf::FieldDescriptor::TYPE_FIXED64: case protobuf::FieldDescriptor::TYPE_SFIXED64: case protobuf::FieldDescriptor::TYPE_DOUBLE: type = "f8"; - wire_type = 1; + wire_type = protobuf::internal::WireFormatLite::WIRETYPE_FIXED64; break; case protobuf::FieldDescriptor::TYPE_SINT32: type = "z4"; @@ -780,14 +780,14 @@ void TryFillTableEntry(const protobuf::Descriptor* message, case protobuf::FieldDescriptor::TYPE_STRING: case protobuf::FieldDescriptor::TYPE_BYTES: type = "s"; - wire_type = 2; + wire_type = protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED; break; case protobuf::FieldDescriptor::TYPE_MESSAGE: if (field->is_map()) { return; // Not supported yet (ever?). } type = "m"; - wire_type = 2; + wire_type = protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED; break; default: return; // Not supported yet. @@ -797,7 +797,8 @@ void TryFillTableEntry(const protobuf::Descriptor* message, case protobuf::FieldDescriptor::LABEL_REPEATED: if (field->is_packed()) { cardinality = "p"; - wire_type = 2; + wire_type = + protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED; } else { cardinality = "r"; } @@ -812,8 +813,17 @@ void TryFillTableEntry(const protobuf::Descriptor* message, break; } - uint16_t expected_tag = (num << 3) | wire_type; - if (num > 15) expected_tag |= 0x100; + uint32_t unencoded_tag = + protobuf::internal::WireFormatLite::MakeTag(field->number(), wire_type); + uint8_t tag_bytes[10] = {0}; + protobuf::io::CodedOutputStream::WriteVarint32ToArray(unencoded_tag, + tag_bytes); + uint64_t expected_tag = 0; + memcpy(&expected_tag, tag_bytes, sizeof(expected_tag)); + if (expected_tag > 0x7fff) { + // Tag is >2 bytes. + return; + } MessageLayout::Size offset = layout.GetFieldOffset(field); // Data is: @@ -869,11 +879,11 @@ void TryFillTableEntry(const protobuf::Descriptor* message, } } ent.first = absl::Substitute("upb_p$0$1_$2bt_max$3b", cardinality, type, - (num > 15) ? "2" : "1", size_ceil); + expected_tag > 0xff ? "2" : "1", size_ceil); } else { ent.first = absl::Substitute("upb_p$0$1_$2bt", cardinality, type, - (num > 15) ? "2" : "1"); + expected_tag > 0xff ? "2" : "1"); } ent.second = data; } @@ -883,7 +893,15 @@ std::vector FastDecodeTable(const protobuf::Descriptor* message, std::vector table; for (int i = 0; i < 32; i++) { table.emplace_back(TableEntry{"fastdecode_generic", 0}); - TryFillTableEntry(message, layout, i, table.back()); + } + for (int i = 0; i < message->field_count(); i++) { + const protobuf::FieldDescriptor* field = message->field(i); + int slot = field->number() & 31; + if (table[slot].first != "fastdecode_generic") { + // This slot is already populated by another field. + continue; + } + TryFillTableEntry(message, layout, field, table[slot]); } return table; } From 3eba47914bdb980a6d244fbfb85c9569a8bbc493 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 25 Oct 2020 11:31:54 -0700 Subject: [PATCH 72/88] Allocate hasbits and table slots in "hotness" order. Without a profile, we assume that fields with smaller numbers are hotter. --- cmake/google/protobuf/descriptor.upb.c | 206 ++++++++++++------------ cmake/google/protobuf/descriptor.upb.h | 212 ++++++++++++------------- upbc/generator.cc | 11 +- upbc/message_layout.cc | 2 +- upbc/message_layout.h | 17 ++ 5 files changed, 232 insertions(+), 216 deletions(-) diff --git a/cmake/google/protobuf/descriptor.upb.c b/cmake/google/protobuf/descriptor.upb.c index 60e0c42f8c..1e43d3aa3b 100644 --- a/cmake/google/protobuf/descriptor.upb.c +++ b/cmake/google/protobuf/descriptor.upb.c @@ -77,11 +77,11 @@ static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12] {5, UPB_SIZE(44, 88), 0, 1, 11, 3}, {6, UPB_SIZE(48, 96), 0, 4, 11, 3}, {7, UPB_SIZE(52, 104), 0, 2, 11, 3}, - {8, UPB_SIZE(28, 56), 4, 3, 11, 1}, - {9, UPB_SIZE(32, 64), 5, 5, 11, 1}, + {8, UPB_SIZE(28, 56), 3, 3, 11, 1}, + {9, UPB_SIZE(32, 64), 4, 5, 11, 1}, {10, UPB_SIZE(56, 112), 0, 0, 5, 3}, {11, UPB_SIZE(60, 120), 0, 0, 5, 3}, - {12, UPB_SIZE(20, 40), 3, 0, 12, 1}, + {12, UPB_SIZE(20, 40), 5, 0, 12, 1}, }; const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { @@ -94,11 +94,11 @@ const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { {0x005800003f01002a, &upb_prm_1bt_max128b}, {0x006000003f040032, &upb_prm_1bt_max64b}, {0x006800003f02003a, &upb_prm_1bt_max128b}, - {0x0038000004030042, &upb_psm_1bt_max256b}, - {0x004000000505004a, &upb_psm_1bt_max64b}, + {0x0038000003030042, &upb_psm_1bt_max256b}, + {0x004000000405004a, &upb_psm_1bt_max64b}, {0x007000003f000050, &upb_prv4_1bt}, {0x007800003f000058, &upb_prv4_1bt}, - {0x0028000003000062, &upb_pss_1bt}, + {0x0028000005000062, &upb_pss_1bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -335,31 +335,31 @@ static const upb_msglayout *const google_protobuf_FieldDescriptorProto_submsgs[1 }; static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[11] = { - {1, UPB_SIZE(24, 24), 6, 0, 12, 1}, - {2, UPB_SIZE(32, 40), 7, 0, 12, 1}, + {1, UPB_SIZE(24, 24), 1, 0, 12, 1}, + {2, UPB_SIZE(32, 40), 2, 0, 12, 1}, {3, UPB_SIZE(12, 12), 3, 0, 5, 1}, - {4, UPB_SIZE(4, 4), 1, 0, 14, 1}, - {5, UPB_SIZE(8, 8), 2, 0, 14, 1}, - {6, UPB_SIZE(40, 56), 8, 0, 12, 1}, - {7, UPB_SIZE(48, 72), 9, 0, 12, 1}, - {8, UPB_SIZE(64, 104), 11, 0, 11, 1}, - {9, UPB_SIZE(16, 16), 4, 0, 5, 1}, + {4, UPB_SIZE(4, 4), 4, 0, 14, 1}, + {5, UPB_SIZE(8, 8), 5, 0, 14, 1}, + {6, UPB_SIZE(40, 56), 6, 0, 12, 1}, + {7, UPB_SIZE(48, 72), 7, 0, 12, 1}, + {8, UPB_SIZE(64, 104), 8, 0, 11, 1}, + {9, UPB_SIZE(16, 16), 9, 0, 5, 1}, {10, UPB_SIZE(56, 88), 10, 0, 12, 1}, - {17, UPB_SIZE(20, 20), 5, 0, 8, 1}, + {17, UPB_SIZE(20, 20), 11, 0, 8, 1}, }; const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { { {0x0000000000000000, &fastdecode_generic}, - {0x001800000600000a, &upb_pss_1bt}, - {0x0028000007000012, &upb_pss_1bt}, + {0x001800000100000a, &upb_pss_1bt}, + {0x0028000002000012, &upb_pss_1bt}, {0x000c000003000018, &upb_psv4_1bt}, - {0x0004000001000020, &upb_psv4_1bt}, - {0x0008000002000028, &upb_psv4_1bt}, - {0x0038000008000032, &upb_pss_1bt}, - {0x004800000900003a, &upb_pss_1bt}, - {0x006800000b000042, &upb_psm_1bt_max64b}, - {0x0010000004000048, &upb_psv4_1bt}, + {0x0004000004000020, &upb_psv4_1bt}, + {0x0008000005000028, &upb_psv4_1bt}, + {0x0038000006000032, &upb_pss_1bt}, + {0x004800000700003a, &upb_pss_1bt}, + {0x0068000008000042, &upb_psm_1bt_max64b}, + {0x0010000009000048, &upb_psv4_1bt}, {0x005800000a000052, &upb_pss_1bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -367,7 +367,7 @@ const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x0014000005000188, &upb_psb1_2bt}, + {0x001400000b000188, &upb_psb1_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -541,16 +541,16 @@ static const upb_msglayout *const google_protobuf_EnumValueDescriptorProto_subms }; static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__fields[3] = { - {1, UPB_SIZE(8, 8), 2, 0, 12, 1}, - {2, UPB_SIZE(4, 4), 1, 0, 5, 1}, + {1, UPB_SIZE(8, 8), 1, 0, 12, 1}, + {2, UPB_SIZE(4, 4), 2, 0, 5, 1}, {3, UPB_SIZE(16, 24), 3, 0, 11, 1}, }; const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { { {0x0000000000000000, &fastdecode_generic}, - {0x000800000200000a, &upb_pss_1bt}, - {0x0004000001000010, &upb_psv4_1bt}, + {0x000800000100000a, &upb_pss_1bt}, + {0x0004000002000010, &upb_psv4_1bt}, {0x001800000300001a, &upb_psm_1bt_max64b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -642,23 +642,23 @@ static const upb_msglayout *const google_protobuf_MethodDescriptorProto_submsgs[ }; static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6] = { - {1, UPB_SIZE(4, 8), 3, 0, 12, 1}, - {2, UPB_SIZE(12, 24), 4, 0, 12, 1}, - {3, UPB_SIZE(20, 40), 5, 0, 12, 1}, - {4, UPB_SIZE(28, 56), 6, 0, 11, 1}, - {5, UPB_SIZE(1, 1), 1, 0, 8, 1}, - {6, UPB_SIZE(2, 2), 2, 0, 8, 1}, + {1, UPB_SIZE(4, 8), 1, 0, 12, 1}, + {2, UPB_SIZE(12, 24), 2, 0, 12, 1}, + {3, UPB_SIZE(20, 40), 3, 0, 12, 1}, + {4, UPB_SIZE(28, 56), 4, 0, 11, 1}, + {5, UPB_SIZE(1, 1), 5, 0, 8, 1}, + {6, UPB_SIZE(2, 2), 6, 0, 8, 1}, }; const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { { {0x0000000000000000, &fastdecode_generic}, - {0x000800000300000a, &upb_pss_1bt}, - {0x0018000004000012, &upb_pss_1bt}, - {0x002800000500001a, &upb_pss_1bt}, - {0x0038000006000022, &upb_psm_1bt_max64b}, - {0x0001000001000028, &upb_psb1_1bt}, - {0x0002000002000030, &upb_psb1_1bt}, + {0x000800000100000a, &upb_pss_1bt}, + {0x0018000002000012, &upb_pss_1bt}, + {0x002800000300001a, &upb_pss_1bt}, + {0x0038000004000022, &upb_psm_1bt_max64b}, + {0x0001000005000028, &upb_psb1_1bt}, + {0x0002000006000030, &upb_psb1_1bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -695,24 +695,24 @@ static const upb_msglayout *const google_protobuf_FileOptions_submsgs[1] = { }; static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { - {1, UPB_SIZE(20, 24), 11, 0, 12, 1}, - {8, UPB_SIZE(28, 40), 12, 0, 12, 1}, - {9, UPB_SIZE(4, 4), 1, 0, 14, 1}, - {10, UPB_SIZE(8, 8), 2, 0, 8, 1}, - {11, UPB_SIZE(36, 56), 13, 0, 12, 1}, - {16, UPB_SIZE(9, 9), 3, 0, 8, 1}, - {17, UPB_SIZE(10, 10), 4, 0, 8, 1}, - {18, UPB_SIZE(11, 11), 5, 0, 8, 1}, - {20, UPB_SIZE(12, 12), 6, 0, 8, 1}, - {23, UPB_SIZE(13, 13), 7, 0, 8, 1}, - {27, UPB_SIZE(14, 14), 8, 0, 8, 1}, - {31, UPB_SIZE(15, 15), 9, 0, 8, 1}, - {36, UPB_SIZE(44, 72), 14, 0, 12, 1}, - {37, UPB_SIZE(52, 88), 15, 0, 12, 1}, - {39, UPB_SIZE(60, 104), 16, 0, 12, 1}, - {40, UPB_SIZE(68, 120), 17, 0, 12, 1}, - {41, UPB_SIZE(76, 136), 18, 0, 12, 1}, - {42, UPB_SIZE(16, 16), 10, 0, 8, 1}, + {1, UPB_SIZE(20, 24), 1, 0, 12, 1}, + {8, UPB_SIZE(28, 40), 2, 0, 12, 1}, + {9, UPB_SIZE(4, 4), 3, 0, 14, 1}, + {10, UPB_SIZE(8, 8), 4, 0, 8, 1}, + {11, UPB_SIZE(36, 56), 5, 0, 12, 1}, + {16, UPB_SIZE(9, 9), 6, 0, 8, 1}, + {17, UPB_SIZE(10, 10), 7, 0, 8, 1}, + {18, UPB_SIZE(11, 11), 8, 0, 8, 1}, + {20, UPB_SIZE(12, 12), 9, 0, 8, 1}, + {23, UPB_SIZE(13, 13), 10, 0, 8, 1}, + {27, UPB_SIZE(14, 14), 11, 0, 8, 1}, + {31, UPB_SIZE(15, 15), 12, 0, 8, 1}, + {36, UPB_SIZE(44, 72), 13, 0, 12, 1}, + {37, UPB_SIZE(52, 88), 14, 0, 12, 1}, + {39, UPB_SIZE(60, 104), 15, 0, 12, 1}, + {40, UPB_SIZE(68, 120), 16, 0, 12, 1}, + {41, UPB_SIZE(76, 136), 17, 0, 12, 1}, + {42, UPB_SIZE(16, 16), 18, 0, 8, 1}, {44, UPB_SIZE(84, 152), 19, 0, 12, 1}, {45, UPB_SIZE(92, 168), 20, 0, 12, 1}, {999, UPB_SIZE(100, 184), 0, 0, 11, 3}, @@ -721,37 +721,37 @@ static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { const upb_msglayout google_protobuf_FileOptions_msginit = { { {0x0000000000000000, &fastdecode_generic}, - {0x001800000b00000a, &upb_pss_1bt}, + {0x001800000100000a, &upb_pss_1bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x004800000e0002a2, &upb_pss_2bt}, - {0x005800000f0002aa, &upb_pss_2bt}, + {0x004800000d0002a2, &upb_pss_2bt}, + {0x005800000e0002aa, &upb_pss_2bt}, {0x0000000000000000, &fastdecode_generic}, - {0x00680000100002ba, &upb_pss_2bt}, - {0x002800000c000042, &upb_pss_1bt}, - {0x0004000001000048, &upb_psv4_1bt}, - {0x0008000002000050, &upb_psb1_1bt}, - {0x003800000d00005a, &upb_pss_1bt}, + {0x006800000f0002ba, &upb_pss_2bt}, + {0x0028000002000042, &upb_pss_1bt}, + {0x0004000003000048, &upb_psv4_1bt}, + {0x0008000004000050, &upb_psb1_1bt}, + {0x003800000500005a, &upb_pss_1bt}, {0x00980000130002e2, &upb_pss_2bt}, {0x00a80000140002ea, &upb_pss_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x0009000003000180, &upb_psb1_2bt}, - {0x000a000004000188, &upb_psb1_2bt}, - {0x000b000005000190, &upb_psb1_2bt}, + {0x0009000006000180, &upb_psb1_2bt}, + {0x000a000007000188, &upb_psb1_2bt}, + {0x000b000008000190, &upb_psb1_2bt}, {0x0000000000000000, &fastdecode_generic}, - {0x000c0000060001a0, &upb_psb1_2bt}, + {0x000c0000090001a0, &upb_psb1_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x000d0000070001b8, &upb_psb1_2bt}, + {0x000d00000a0001b8, &upb_psb1_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x000e0000080001d8, &upb_psb1_2bt}, + {0x000e00000b0001d8, &upb_psb1_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x000f0000090001f8, &upb_psb1_2bt}, + {0x000f00000c0001f8, &upb_psb1_2bt}, }, &google_protobuf_FileOptions_submsgs[0], &google_protobuf_FileOptions__fields[0], @@ -816,10 +816,10 @@ static const upb_msglayout *const google_protobuf_FieldOptions_submsgs[1] = { static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = { {1, UPB_SIZE(4, 4), 1, 0, 14, 1}, - {2, UPB_SIZE(12, 12), 3, 0, 8, 1}, - {3, UPB_SIZE(13, 13), 4, 0, 8, 1}, - {5, UPB_SIZE(14, 14), 5, 0, 8, 1}, - {6, UPB_SIZE(8, 8), 2, 0, 14, 1}, + {2, UPB_SIZE(12, 12), 2, 0, 8, 1}, + {3, UPB_SIZE(13, 13), 3, 0, 8, 1}, + {5, UPB_SIZE(14, 14), 4, 0, 8, 1}, + {6, UPB_SIZE(8, 8), 5, 0, 14, 1}, {10, UPB_SIZE(15, 15), 6, 0, 8, 1}, {999, UPB_SIZE(16, 16), 0, 0, 11, 3}, }; @@ -828,11 +828,11 @@ const upb_msglayout google_protobuf_FieldOptions_msginit = { { {0x0000000000000000, &fastdecode_generic}, {0x0004000001000008, &upb_psv4_1bt}, - {0x000c000003000010, &upb_psb1_1bt}, - {0x000d000004000018, &upb_psb1_1bt}, + {0x000c000002000010, &upb_psb1_1bt}, + {0x000d000003000018, &upb_psb1_1bt}, {0x0000000000000000, &fastdecode_generic}, - {0x000e000005000028, &upb_psb1_1bt}, - {0x0008000002000030, &upb_psv4_1bt}, + {0x000e000004000028, &upb_psb1_1bt}, + {0x0008000005000030, &upb_psv4_1bt}, {0x001000003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -1065,16 +1065,16 @@ static const upb_msglayout *const google_protobuf_MethodOptions_submsgs[1] = { }; static const upb_msglayout_field google_protobuf_MethodOptions__fields[3] = { - {33, UPB_SIZE(8, 8), 2, 0, 8, 1}, - {34, UPB_SIZE(4, 4), 1, 0, 14, 1}, + {33, UPB_SIZE(8, 8), 1, 0, 8, 1}, + {34, UPB_SIZE(4, 4), 2, 0, 14, 1}, {999, UPB_SIZE(12, 16), 0, 0, 11, 3}, }; const upb_msglayout google_protobuf_MethodOptions_msginit = { { {0x0000000000000000, &fastdecode_generic}, - {0x0008000002000288, &upb_psb1_2bt}, - {0x0004000001000290, &upb_psv4_2bt}, + {0x0008000001000288, &upb_psb1_2bt}, + {0x0004000002000290, &upb_psv4_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -1116,10 +1116,10 @@ static const upb_msglayout *const google_protobuf_UninterpretedOption_submsgs[1] static const upb_msglayout_field google_protobuf_UninterpretedOption__fields[7] = { {2, UPB_SIZE(56, 80), 0, 0, 11, 3}, - {3, UPB_SIZE(32, 32), 4, 0, 12, 1}, - {4, UPB_SIZE(8, 8), 1, 0, 4, 1}, - {5, UPB_SIZE(16, 16), 2, 0, 3, 1}, - {6, UPB_SIZE(24, 24), 3, 0, 1, 1}, + {3, UPB_SIZE(32, 32), 1, 0, 12, 1}, + {4, UPB_SIZE(8, 8), 2, 0, 4, 1}, + {5, UPB_SIZE(16, 16), 3, 0, 3, 1}, + {6, UPB_SIZE(24, 24), 4, 0, 1, 1}, {7, UPB_SIZE(40, 48), 5, 0, 12, 1}, {8, UPB_SIZE(48, 64), 6, 0, 12, 1}, }; @@ -1129,10 +1129,10 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x005000003f000012, &upb_prm_1bt_max64b}, - {0x002000000400001a, &upb_pss_1bt}, - {0x0008000001000020, &upb_psv8_1bt}, - {0x0010000002000028, &upb_psv8_1bt}, - {0x0018000003000031, &upb_psf8_1bt}, + {0x002000000100001a, &upb_pss_1bt}, + {0x0008000002000020, &upb_psv8_1bt}, + {0x0010000003000028, &upb_psv8_1bt}, + {0x0018000004000031, &upb_psf8_1bt}, {0x003000000500003a, &upb_pss_1bt}, {0x0040000006000042, &upb_pss_1bt}, {0x0000000000000000, &fastdecode_generic}, @@ -1165,15 +1165,15 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { }; static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__fields[2] = { - {1, UPB_SIZE(4, 8), 2, 0, 12, 2}, - {2, UPB_SIZE(1, 1), 1, 0, 8, 2}, + {1, UPB_SIZE(4, 8), 1, 0, 12, 2}, + {2, UPB_SIZE(1, 1), 2, 0, 8, 2}, }; const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { { {0x0000000000000000, &fastdecode_generic}, - {0x000800000200000a, &upb_pss_1bt}, - {0x0001000001000010, &upb_psb1_1bt}, + {0x000800000100000a, &upb_pss_1bt}, + {0x0001000002000010, &upb_psb1_1bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -1355,18 +1355,18 @@ const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__fields[4] = { {1, UPB_SIZE(20, 32), 0, 0, 5, _UPB_LABEL_PACKED}, - {2, UPB_SIZE(12, 16), 3, 0, 12, 1}, - {3, UPB_SIZE(4, 4), 1, 0, 5, 1}, - {4, UPB_SIZE(8, 8), 2, 0, 5, 1}, + {2, UPB_SIZE(12, 16), 1, 0, 12, 1}, + {3, UPB_SIZE(4, 4), 2, 0, 5, 1}, + {4, UPB_SIZE(8, 8), 3, 0, 5, 1}, }; const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { { {0x0000000000000000, &fastdecode_generic}, {0x002000003f00000a, &upb_ppv4_1bt}, - {0x0010000003000012, &upb_pss_1bt}, - {0x0004000001000018, &upb_psv4_1bt}, - {0x0008000002000020, &upb_psv4_1bt}, + {0x0010000001000012, &upb_pss_1bt}, + {0x0004000002000018, &upb_psv4_1bt}, + {0x0008000003000020, &upb_psv4_1bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, diff --git a/cmake/google/protobuf/descriptor.upb.h b/cmake/google/protobuf/descriptor.upb.h index aa35271a26..ccb902ba12 100644 --- a/cmake/google/protobuf/descriptor.upb.h +++ b/cmake/google/protobuf/descriptor.upb.h @@ -212,13 +212,13 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_has_service(const google_pro UPB_INLINE const google_protobuf_ServiceDescriptorProto* const* google_protobuf_FileDescriptorProto_service(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_ServiceDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(48, 96), len); } UPB_INLINE bool google_protobuf_FileDescriptorProto_has_extension(const google_protobuf_FileDescriptorProto *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(52, 104)); } UPB_INLINE const google_protobuf_FieldDescriptorProto* const* google_protobuf_FileDescriptorProto_extension(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (const google_protobuf_FieldDescriptorProto* const*)_upb_array_accessor(msg, UPB_SIZE(52, 104), len); } -UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 4); } +UPB_INLINE bool google_protobuf_FileDescriptorProto_has_options(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 3); } UPB_INLINE const google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_options(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(28, 56), const google_protobuf_FileOptions*); } -UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 5); } +UPB_INLINE bool google_protobuf_FileDescriptorProto_has_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 4); } UPB_INLINE const google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_source_code_info(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(32, 64), const google_protobuf_SourceCodeInfo*); } UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_public_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(56, 112), len); } UPB_INLINE int32_t const* google_protobuf_FileDescriptorProto_weak_dependency(const google_protobuf_FileDescriptorProto *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(60, 120), len); } -UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 3); } +UPB_INLINE bool google_protobuf_FileDescriptorProto_has_syntax(const google_protobuf_FileDescriptorProto *msg) { return _upb_hasbit(msg, 5); } UPB_INLINE upb_strview google_protobuf_FileDescriptorProto_syntax(const google_protobuf_FileDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview); } UPB_INLINE void google_protobuf_FileDescriptorProto_set_name(google_protobuf_FileDescriptorProto *msg, upb_strview value) { @@ -292,7 +292,7 @@ UPB_INLINE struct google_protobuf_FieldDescriptorProto* google_protobuf_FileDesc return sub; } UPB_INLINE void google_protobuf_FileDescriptorProto_set_options(google_protobuf_FileDescriptorProto *msg, google_protobuf_FileOptions* value) { - _upb_sethas(msg, 4); + _upb_sethas(msg, 3); *UPB_PTR_AT(msg, UPB_SIZE(28, 56), google_protobuf_FileOptions*) = value; } UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorProto_mutable_options(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { @@ -305,7 +305,7 @@ UPB_INLINE struct google_protobuf_FileOptions* google_protobuf_FileDescriptorPro return sub; } UPB_INLINE void google_protobuf_FileDescriptorProto_set_source_code_info(google_protobuf_FileDescriptorProto *msg, google_protobuf_SourceCodeInfo* value) { - _upb_sethas(msg, 5); + _upb_sethas(msg, 4); *UPB_PTR_AT(msg, UPB_SIZE(32, 64), google_protobuf_SourceCodeInfo*) = value; } UPB_INLINE struct google_protobuf_SourceCodeInfo* google_protobuf_FileDescriptorProto_mutable_source_code_info(google_protobuf_FileDescriptorProto *msg, upb_arena *arena) { @@ -338,7 +338,7 @@ UPB_INLINE bool google_protobuf_FileDescriptorProto_add_weak_dependency(google_p arena); } UPB_INLINE void google_protobuf_FileDescriptorProto_set_syntax(google_protobuf_FileDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 3); + _upb_sethas(msg, 5); *UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview) = value; } @@ -611,35 +611,35 @@ UPB_INLINE char *google_protobuf_FieldDescriptorProto_serialize(const google_pro return upb_encode(msg, &google_protobuf_FieldDescriptorProto_msginit, arena, len); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 6); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 1); } UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_name(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(24, 24), upb_strview); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 7); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_extendee(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 2); } UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_extendee(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(32, 40), upb_strview); } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_number(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 3); } UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_number(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 12), int32_t); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 1); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_label(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 4); } UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_label(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 2); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 5); } UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_type(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 8); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_type_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 6); } UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_type_name(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(40, 56), upb_strview); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 9); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_default_value(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 7); } UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_default_value(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(48, 72), upb_strview); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 11); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_options(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 8); } UPB_INLINE const google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_options(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(64, 104), const google_protobuf_FieldOptions*); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 4); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 9); } UPB_INLINE int32_t google_protobuf_FieldDescriptorProto_oneof_index(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 16), int32_t); } UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_json_name(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 10); } UPB_INLINE upb_strview google_protobuf_FieldDescriptorProto_json_name(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(56, 88), upb_strview); } -UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 5); } +UPB_INLINE bool google_protobuf_FieldDescriptorProto_has_proto3_optional(const google_protobuf_FieldDescriptorProto *msg) { return _upb_hasbit(msg, 11); } UPB_INLINE bool google_protobuf_FieldDescriptorProto_proto3_optional(const google_protobuf_FieldDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(20, 20), bool); } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 6); + _upb_sethas(msg, 1); *UPB_PTR_AT(msg, UPB_SIZE(24, 24), upb_strview) = value; } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_extendee(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 7); + _upb_sethas(msg, 2); *UPB_PTR_AT(msg, UPB_SIZE(32, 40), upb_strview) = value; } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_FieldDescriptorProto *msg, int32_t value) { @@ -647,23 +647,23 @@ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_number(google_protobuf_ *UPB_PTR_AT(msg, UPB_SIZE(12, 12), int32_t) = value; } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_label(google_protobuf_FieldDescriptorProto *msg, int32_t value) { - _upb_sethas(msg, 1); + _upb_sethas(msg, 4); *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value; } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type(google_protobuf_FieldDescriptorProto *msg, int32_t value) { - _upb_sethas(msg, 2); + _upb_sethas(msg, 5); *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value; } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_type_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 8); + _upb_sethas(msg, 6); *UPB_PTR_AT(msg, UPB_SIZE(40, 56), upb_strview) = value; } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_default_value(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 9); + _upb_sethas(msg, 7); *UPB_PTR_AT(msg, UPB_SIZE(48, 72), upb_strview) = value; } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_options(google_protobuf_FieldDescriptorProto *msg, google_protobuf_FieldOptions* value) { - _upb_sethas(msg, 11); + _upb_sethas(msg, 8); *UPB_PTR_AT(msg, UPB_SIZE(64, 104), google_protobuf_FieldOptions*) = value; } UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorProto_mutable_options(google_protobuf_FieldDescriptorProto *msg, upb_arena *arena) { @@ -676,7 +676,7 @@ UPB_INLINE struct google_protobuf_FieldOptions* google_protobuf_FieldDescriptorP return sub; } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_oneof_index(google_protobuf_FieldDescriptorProto *msg, int32_t value) { - _upb_sethas(msg, 4); + _upb_sethas(msg, 9); *UPB_PTR_AT(msg, UPB_SIZE(16, 16), int32_t) = value; } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protobuf_FieldDescriptorProto *msg, upb_strview value) { @@ -684,7 +684,7 @@ UPB_INLINE void google_protobuf_FieldDescriptorProto_set_json_name(google_protob *UPB_PTR_AT(msg, UPB_SIZE(56, 88), upb_strview) = value; } UPB_INLINE void google_protobuf_FieldDescriptorProto_set_proto3_optional(google_protobuf_FieldDescriptorProto *msg, bool value) { - _upb_sethas(msg, 5); + _upb_sethas(msg, 11); *UPB_PTR_AT(msg, UPB_SIZE(20, 20), bool) = value; } @@ -845,19 +845,19 @@ UPB_INLINE char *google_protobuf_EnumValueDescriptorProto_serialize(const google return upb_encode(msg, &google_protobuf_EnumValueDescriptorProto_msginit, arena, len); } -UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_hasbit(msg, 2); } +UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_name(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_hasbit(msg, 1); } UPB_INLINE upb_strview google_protobuf_EnumValueDescriptorProto_name(const google_protobuf_EnumValueDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), upb_strview); } -UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_hasbit(msg, 1); } +UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_number(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_hasbit(msg, 2); } UPB_INLINE int32_t google_protobuf_EnumValueDescriptorProto_number(const google_protobuf_EnumValueDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); } UPB_INLINE bool google_protobuf_EnumValueDescriptorProto_has_options(const google_protobuf_EnumValueDescriptorProto *msg) { return _upb_hasbit(msg, 3); } UPB_INLINE const google_protobuf_EnumValueOptions* google_protobuf_EnumValueDescriptorProto_options(const google_protobuf_EnumValueDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 24), const google_protobuf_EnumValueOptions*); } UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_name(google_protobuf_EnumValueDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 2); + _upb_sethas(msg, 1); *UPB_PTR_AT(msg, UPB_SIZE(8, 8), upb_strview) = value; } UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_number(google_protobuf_EnumValueDescriptorProto *msg, int32_t value) { - _upb_sethas(msg, 1); + _upb_sethas(msg, 2); *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value; } UPB_INLINE void google_protobuf_EnumValueDescriptorProto_set_options(google_protobuf_EnumValueDescriptorProto *msg, google_protobuf_EnumValueOptions* value) { @@ -940,33 +940,33 @@ UPB_INLINE char *google_protobuf_MethodDescriptorProto_serialize(const google_pr return upb_encode(msg, &google_protobuf_MethodDescriptorProto_msginit, arena, len); } -UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 3); } +UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_name(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 1); } UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_name(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); } -UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 4); } +UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_input_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 2); } UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_input_type(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview); } -UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 5); } +UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_output_type(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 3); } UPB_INLINE upb_strview google_protobuf_MethodDescriptorProto_output_type(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview); } -UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 6); } +UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_options(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 4); } UPB_INLINE const google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_options(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(28, 56), const google_protobuf_MethodOptions*); } -UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 1); } +UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 5); } UPB_INLINE bool google_protobuf_MethodDescriptorProto_client_streaming(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); } -UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 2); } +UPB_INLINE bool google_protobuf_MethodDescriptorProto_has_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return _upb_hasbit(msg, 6); } UPB_INLINE bool google_protobuf_MethodDescriptorProto_server_streaming(const google_protobuf_MethodDescriptorProto *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool); } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_name(google_protobuf_MethodDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 3); + _upb_sethas(msg, 1); *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value; } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_input_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 4); + _upb_sethas(msg, 2); *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview) = value; } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_output_type(google_protobuf_MethodDescriptorProto *msg, upb_strview value) { - _upb_sethas(msg, 5); + _upb_sethas(msg, 3); *UPB_PTR_AT(msg, UPB_SIZE(20, 40), upb_strview) = value; } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_options(google_protobuf_MethodDescriptorProto *msg, google_protobuf_MethodOptions* value) { - _upb_sethas(msg, 6); + _upb_sethas(msg, 4); *UPB_PTR_AT(msg, UPB_SIZE(28, 56), google_protobuf_MethodOptions*) = value; } UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescriptorProto_mutable_options(google_protobuf_MethodDescriptorProto *msg, upb_arena *arena) { @@ -979,11 +979,11 @@ UPB_INLINE struct google_protobuf_MethodOptions* google_protobuf_MethodDescripto return sub; } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_client_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { - _upb_sethas(msg, 1); + _upb_sethas(msg, 5); *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value; } UPB_INLINE void google_protobuf_MethodDescriptorProto_set_server_streaming(google_protobuf_MethodDescriptorProto *msg, bool value) { - _upb_sethas(msg, 2); + _upb_sethas(msg, 6); *UPB_PTR_AT(msg, UPB_SIZE(2, 2), bool) = value; } @@ -1001,41 +1001,41 @@ UPB_INLINE char *google_protobuf_FileOptions_serialize(const google_protobuf_Fil return upb_encode(msg, &google_protobuf_FileOptions_msginit, arena, len); } -UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 11); } +UPB_INLINE bool google_protobuf_FileOptions_has_java_package(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 1); } UPB_INLINE upb_strview google_protobuf_FileOptions_java_package(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(20, 24), upb_strview); } -UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 12); } +UPB_INLINE bool google_protobuf_FileOptions_has_java_outer_classname(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 2); } UPB_INLINE upb_strview google_protobuf_FileOptions_java_outer_classname(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(28, 40), upb_strview); } -UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 1); } +UPB_INLINE bool google_protobuf_FileOptions_has_optimize_for(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 3); } UPB_INLINE int32_t google_protobuf_FileOptions_optimize_for(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); } -UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 2); } +UPB_INLINE bool google_protobuf_FileOptions_has_java_multiple_files(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 4); } UPB_INLINE bool google_protobuf_FileOptions_java_multiple_files(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), bool); } -UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 13); } +UPB_INLINE bool google_protobuf_FileOptions_has_go_package(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 5); } UPB_INLINE upb_strview google_protobuf_FileOptions_go_package(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(36, 56), upb_strview); } -UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 3); } +UPB_INLINE bool google_protobuf_FileOptions_has_cc_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 6); } UPB_INLINE bool google_protobuf_FileOptions_cc_generic_services(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(9, 9), bool); } -UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 4); } +UPB_INLINE bool google_protobuf_FileOptions_has_java_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 7); } UPB_INLINE bool google_protobuf_FileOptions_java_generic_services(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(10, 10), bool); } -UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 5); } +UPB_INLINE bool google_protobuf_FileOptions_has_py_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 8); } UPB_INLINE bool google_protobuf_FileOptions_py_generic_services(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(11, 11), bool); } -UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 6); } +UPB_INLINE bool google_protobuf_FileOptions_has_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 9); } UPB_INLINE bool google_protobuf_FileOptions_java_generate_equals_and_hash(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 12), bool); } -UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 7); } +UPB_INLINE bool google_protobuf_FileOptions_has_deprecated(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 10); } UPB_INLINE bool google_protobuf_FileOptions_deprecated(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(13, 13), bool); } -UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 8); } +UPB_INLINE bool google_protobuf_FileOptions_has_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 11); } UPB_INLINE bool google_protobuf_FileOptions_java_string_check_utf8(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(14, 14), bool); } -UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 9); } +UPB_INLINE bool google_protobuf_FileOptions_has_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 12); } UPB_INLINE bool google_protobuf_FileOptions_cc_enable_arenas(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(15, 15), bool); } -UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 14); } +UPB_INLINE bool google_protobuf_FileOptions_has_objc_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 13); } UPB_INLINE upb_strview google_protobuf_FileOptions_objc_class_prefix(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(44, 72), upb_strview); } -UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 15); } +UPB_INLINE bool google_protobuf_FileOptions_has_csharp_namespace(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 14); } UPB_INLINE upb_strview google_protobuf_FileOptions_csharp_namespace(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(52, 88), upb_strview); } -UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 16); } +UPB_INLINE bool google_protobuf_FileOptions_has_swift_prefix(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 15); } UPB_INLINE upb_strview google_protobuf_FileOptions_swift_prefix(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(60, 104), upb_strview); } -UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 17); } +UPB_INLINE bool google_protobuf_FileOptions_has_php_class_prefix(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 16); } UPB_INLINE upb_strview google_protobuf_FileOptions_php_class_prefix(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(68, 120), upb_strview); } -UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 18); } +UPB_INLINE bool google_protobuf_FileOptions_has_php_namespace(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 17); } UPB_INLINE upb_strview google_protobuf_FileOptions_php_namespace(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(76, 136), upb_strview); } -UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 10); } +UPB_INLINE bool google_protobuf_FileOptions_has_php_generic_services(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 18); } UPB_INLINE bool google_protobuf_FileOptions_php_generic_services(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 16), bool); } UPB_INLINE bool google_protobuf_FileOptions_has_php_metadata_namespace(const google_protobuf_FileOptions *msg) { return _upb_hasbit(msg, 19); } UPB_INLINE upb_strview google_protobuf_FileOptions_php_metadata_namespace(const google_protobuf_FileOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(84, 152), upb_strview); } @@ -1045,75 +1045,75 @@ UPB_INLINE bool google_protobuf_FileOptions_has_uninterpreted_option(const googl UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_FileOptions_uninterpreted_option(const google_protobuf_FileOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(100, 184), len); } UPB_INLINE void google_protobuf_FileOptions_set_java_package(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 11); + _upb_sethas(msg, 1); *UPB_PTR_AT(msg, UPB_SIZE(20, 24), upb_strview) = value; } UPB_INLINE void google_protobuf_FileOptions_set_java_outer_classname(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 12); + _upb_sethas(msg, 2); *UPB_PTR_AT(msg, UPB_SIZE(28, 40), upb_strview) = value; } UPB_INLINE void google_protobuf_FileOptions_set_optimize_for(google_protobuf_FileOptions *msg, int32_t value) { - _upb_sethas(msg, 1); + _upb_sethas(msg, 3); *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value; } UPB_INLINE void google_protobuf_FileOptions_set_java_multiple_files(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 2); + _upb_sethas(msg, 4); *UPB_PTR_AT(msg, UPB_SIZE(8, 8), bool) = value; } UPB_INLINE void google_protobuf_FileOptions_set_go_package(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 13); + _upb_sethas(msg, 5); *UPB_PTR_AT(msg, UPB_SIZE(36, 56), upb_strview) = value; } UPB_INLINE void google_protobuf_FileOptions_set_cc_generic_services(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 3); + _upb_sethas(msg, 6); *UPB_PTR_AT(msg, UPB_SIZE(9, 9), bool) = value; } UPB_INLINE void google_protobuf_FileOptions_set_java_generic_services(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 4); + _upb_sethas(msg, 7); *UPB_PTR_AT(msg, UPB_SIZE(10, 10), bool) = value; } UPB_INLINE void google_protobuf_FileOptions_set_py_generic_services(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 5); + _upb_sethas(msg, 8); *UPB_PTR_AT(msg, UPB_SIZE(11, 11), bool) = value; } UPB_INLINE void google_protobuf_FileOptions_set_java_generate_equals_and_hash(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 6); + _upb_sethas(msg, 9); *UPB_PTR_AT(msg, UPB_SIZE(12, 12), bool) = value; } UPB_INLINE void google_protobuf_FileOptions_set_deprecated(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 7); + _upb_sethas(msg, 10); *UPB_PTR_AT(msg, UPB_SIZE(13, 13), bool) = value; } UPB_INLINE void google_protobuf_FileOptions_set_java_string_check_utf8(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 8); + _upb_sethas(msg, 11); *UPB_PTR_AT(msg, UPB_SIZE(14, 14), bool) = value; } UPB_INLINE void google_protobuf_FileOptions_set_cc_enable_arenas(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 9); + _upb_sethas(msg, 12); *UPB_PTR_AT(msg, UPB_SIZE(15, 15), bool) = value; } UPB_INLINE void google_protobuf_FileOptions_set_objc_class_prefix(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 14); + _upb_sethas(msg, 13); *UPB_PTR_AT(msg, UPB_SIZE(44, 72), upb_strview) = value; } UPB_INLINE void google_protobuf_FileOptions_set_csharp_namespace(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 15); + _upb_sethas(msg, 14); *UPB_PTR_AT(msg, UPB_SIZE(52, 88), upb_strview) = value; } UPB_INLINE void google_protobuf_FileOptions_set_swift_prefix(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 16); + _upb_sethas(msg, 15); *UPB_PTR_AT(msg, UPB_SIZE(60, 104), upb_strview) = value; } UPB_INLINE void google_protobuf_FileOptions_set_php_class_prefix(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 17); + _upb_sethas(msg, 16); *UPB_PTR_AT(msg, UPB_SIZE(68, 120), upb_strview) = value; } UPB_INLINE void google_protobuf_FileOptions_set_php_namespace(google_protobuf_FileOptions *msg, upb_strview value) { - _upb_sethas(msg, 18); + _upb_sethas(msg, 17); *UPB_PTR_AT(msg, UPB_SIZE(76, 136), upb_strview) = value; } UPB_INLINE void google_protobuf_FileOptions_set_php_generic_services(google_protobuf_FileOptions *msg, bool value) { - _upb_sethas(msg, 10); + _upb_sethas(msg, 18); *UPB_PTR_AT(msg, UPB_SIZE(16, 16), bool) = value; } UPB_INLINE void google_protobuf_FileOptions_set_php_metadata_namespace(google_protobuf_FileOptions *msg, upb_strview value) { @@ -1209,13 +1209,13 @@ UPB_INLINE char *google_protobuf_FieldOptions_serialize(const google_protobuf_Fi UPB_INLINE bool google_protobuf_FieldOptions_has_ctype(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 1); } UPB_INLINE int32_t google_protobuf_FieldOptions_ctype(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); } -UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 3); } +UPB_INLINE bool google_protobuf_FieldOptions_has_packed(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 2); } UPB_INLINE bool google_protobuf_FieldOptions_packed(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 12), bool); } -UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 4); } +UPB_INLINE bool google_protobuf_FieldOptions_has_deprecated(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 3); } UPB_INLINE bool google_protobuf_FieldOptions_deprecated(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(13, 13), bool); } -UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 5); } +UPB_INLINE bool google_protobuf_FieldOptions_has_lazy(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 4); } UPB_INLINE bool google_protobuf_FieldOptions_lazy(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(14, 14), bool); } -UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 2); } +UPB_INLINE bool google_protobuf_FieldOptions_has_jstype(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 5); } UPB_INLINE int32_t google_protobuf_FieldOptions_jstype(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); } UPB_INLINE bool google_protobuf_FieldOptions_has_weak(const google_protobuf_FieldOptions *msg) { return _upb_hasbit(msg, 6); } UPB_INLINE bool google_protobuf_FieldOptions_weak(const google_protobuf_FieldOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(15, 15), bool); } @@ -1227,19 +1227,19 @@ UPB_INLINE void google_protobuf_FieldOptions_set_ctype(google_protobuf_FieldOpti *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value; } UPB_INLINE void google_protobuf_FieldOptions_set_packed(google_protobuf_FieldOptions *msg, bool value) { - _upb_sethas(msg, 3); + _upb_sethas(msg, 2); *UPB_PTR_AT(msg, UPB_SIZE(12, 12), bool) = value; } UPB_INLINE void google_protobuf_FieldOptions_set_deprecated(google_protobuf_FieldOptions *msg, bool value) { - _upb_sethas(msg, 4); + _upb_sethas(msg, 3); *UPB_PTR_AT(msg, UPB_SIZE(13, 13), bool) = value; } UPB_INLINE void google_protobuf_FieldOptions_set_lazy(google_protobuf_FieldOptions *msg, bool value) { - _upb_sethas(msg, 5); + _upb_sethas(msg, 4); *UPB_PTR_AT(msg, UPB_SIZE(14, 14), bool) = value; } UPB_INLINE void google_protobuf_FieldOptions_set_jstype(google_protobuf_FieldOptions *msg, int32_t value) { - _upb_sethas(msg, 2); + _upb_sethas(msg, 5); *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value; } UPB_INLINE void google_protobuf_FieldOptions_set_weak(google_protobuf_FieldOptions *msg, bool value) { @@ -1422,19 +1422,19 @@ UPB_INLINE char *google_protobuf_MethodOptions_serialize(const google_protobuf_M return upb_encode(msg, &google_protobuf_MethodOptions_msginit, arena, len); } -UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions *msg) { return _upb_hasbit(msg, 2); } +UPB_INLINE bool google_protobuf_MethodOptions_has_deprecated(const google_protobuf_MethodOptions *msg) { return _upb_hasbit(msg, 1); } UPB_INLINE bool google_protobuf_MethodOptions_deprecated(const google_protobuf_MethodOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), bool); } -UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions *msg) { return _upb_hasbit(msg, 1); } +UPB_INLINE bool google_protobuf_MethodOptions_has_idempotency_level(const google_protobuf_MethodOptions *msg) { return _upb_hasbit(msg, 2); } UPB_INLINE int32_t google_protobuf_MethodOptions_idempotency_level(const google_protobuf_MethodOptions *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); } UPB_INLINE bool google_protobuf_MethodOptions_has_uninterpreted_option(const google_protobuf_MethodOptions *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(12, 16)); } UPB_INLINE const google_protobuf_UninterpretedOption* const* google_protobuf_MethodOptions_uninterpreted_option(const google_protobuf_MethodOptions *msg, size_t *len) { return (const google_protobuf_UninterpretedOption* const*)_upb_array_accessor(msg, UPB_SIZE(12, 16), len); } UPB_INLINE void google_protobuf_MethodOptions_set_deprecated(google_protobuf_MethodOptions *msg, bool value) { - _upb_sethas(msg, 2); + _upb_sethas(msg, 1); *UPB_PTR_AT(msg, UPB_SIZE(8, 8), bool) = value; } UPB_INLINE void google_protobuf_MethodOptions_set_idempotency_level(google_protobuf_MethodOptions *msg, int32_t value) { - _upb_sethas(msg, 1); + _upb_sethas(msg, 2); *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value; } UPB_INLINE google_protobuf_UninterpretedOption** google_protobuf_MethodOptions_mutable_uninterpreted_option(google_protobuf_MethodOptions *msg, size_t *len) { @@ -1467,13 +1467,13 @@ UPB_INLINE char *google_protobuf_UninterpretedOption_serialize(const google_prot UPB_INLINE bool google_protobuf_UninterpretedOption_has_name(const google_protobuf_UninterpretedOption *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(56, 80)); } UPB_INLINE const google_protobuf_UninterpretedOption_NamePart* const* google_protobuf_UninterpretedOption_name(const google_protobuf_UninterpretedOption *msg, size_t *len) { return (const google_protobuf_UninterpretedOption_NamePart* const*)_upb_array_accessor(msg, UPB_SIZE(56, 80), len); } -UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 4); } +UPB_INLINE bool google_protobuf_UninterpretedOption_has_identifier_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 1); } UPB_INLINE upb_strview google_protobuf_UninterpretedOption_identifier_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(32, 32), upb_strview); } -UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 1); } +UPB_INLINE bool google_protobuf_UninterpretedOption_has_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 2); } UPB_INLINE uint64_t google_protobuf_UninterpretedOption_positive_int_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), uint64_t); } -UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 2); } +UPB_INLINE bool google_protobuf_UninterpretedOption_has_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 3); } UPB_INLINE int64_t google_protobuf_UninterpretedOption_negative_int_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 16), int64_t); } -UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 3); } +UPB_INLINE bool google_protobuf_UninterpretedOption_has_double_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 4); } UPB_INLINE double google_protobuf_UninterpretedOption_double_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(24, 24), double); } UPB_INLINE bool google_protobuf_UninterpretedOption_has_string_value(const google_protobuf_UninterpretedOption *msg) { return _upb_hasbit(msg, 5); } UPB_INLINE upb_strview google_protobuf_UninterpretedOption_string_value(const google_protobuf_UninterpretedOption *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(40, 48), upb_strview); } @@ -1494,19 +1494,19 @@ UPB_INLINE struct google_protobuf_UninterpretedOption_NamePart* google_protobuf_ return sub; } UPB_INLINE void google_protobuf_UninterpretedOption_set_identifier_value(google_protobuf_UninterpretedOption *msg, upb_strview value) { - _upb_sethas(msg, 4); + _upb_sethas(msg, 1); *UPB_PTR_AT(msg, UPB_SIZE(32, 32), upb_strview) = value; } UPB_INLINE void google_protobuf_UninterpretedOption_set_positive_int_value(google_protobuf_UninterpretedOption *msg, uint64_t value) { - _upb_sethas(msg, 1); + _upb_sethas(msg, 2); *UPB_PTR_AT(msg, UPB_SIZE(8, 8), uint64_t) = value; } UPB_INLINE void google_protobuf_UninterpretedOption_set_negative_int_value(google_protobuf_UninterpretedOption *msg, int64_t value) { - _upb_sethas(msg, 2); + _upb_sethas(msg, 3); *UPB_PTR_AT(msg, UPB_SIZE(16, 16), int64_t) = value; } UPB_INLINE void google_protobuf_UninterpretedOption_set_double_value(google_protobuf_UninterpretedOption *msg, double value) { - _upb_sethas(msg, 3); + _upb_sethas(msg, 4); *UPB_PTR_AT(msg, UPB_SIZE(24, 24), double) = value; } UPB_INLINE void google_protobuf_UninterpretedOption_set_string_value(google_protobuf_UninterpretedOption *msg, upb_strview value) { @@ -1532,17 +1532,17 @@ UPB_INLINE char *google_protobuf_UninterpretedOption_NamePart_serialize(const go return upb_encode(msg, &google_protobuf_UninterpretedOption_NamePart_msginit, arena, len); } -UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_hasbit(msg, 2); } +UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_hasbit(msg, 1); } UPB_INLINE upb_strview google_protobuf_UninterpretedOption_NamePart_name_part(const google_protobuf_UninterpretedOption_NamePart *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); } -UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_hasbit(msg, 1); } +UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_has_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return _upb_hasbit(msg, 2); } UPB_INLINE bool google_protobuf_UninterpretedOption_NamePart_is_extension(const google_protobuf_UninterpretedOption_NamePart *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool); } UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_name_part(google_protobuf_UninterpretedOption_NamePart *msg, upb_strview value) { - _upb_sethas(msg, 2); + _upb_sethas(msg, 1); *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value; } UPB_INLINE void google_protobuf_UninterpretedOption_NamePart_set_is_extension(google_protobuf_UninterpretedOption_NamePart *msg, bool value) { - _upb_sethas(msg, 1); + _upb_sethas(msg, 2); *UPB_PTR_AT(msg, UPB_SIZE(1, 1), bool) = value; } @@ -1684,11 +1684,11 @@ UPB_INLINE char *google_protobuf_GeneratedCodeInfo_Annotation_serialize(const go } UPB_INLINE int32_t const* google_protobuf_GeneratedCodeInfo_Annotation_path(const google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t *len) { return (int32_t const*)_upb_array_accessor(msg, UPB_SIZE(20, 32), len); } -UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_hasbit(msg, 3); } +UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_hasbit(msg, 1); } UPB_INLINE upb_strview google_protobuf_GeneratedCodeInfo_Annotation_source_file(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 16), upb_strview); } -UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_hasbit(msg, 1); } +UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_hasbit(msg, 2); } UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_begin(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t); } -UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_hasbit(msg, 2); } +UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_has_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return _upb_hasbit(msg, 3); } UPB_INLINE int32_t google_protobuf_GeneratedCodeInfo_Annotation_end(const google_protobuf_GeneratedCodeInfo_Annotation *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t); } UPB_INLINE int32_t* google_protobuf_GeneratedCodeInfo_Annotation_mutable_path(google_protobuf_GeneratedCodeInfo_Annotation *msg, size_t *len) { @@ -1702,15 +1702,15 @@ UPB_INLINE bool google_protobuf_GeneratedCodeInfo_Annotation_add_path(google_pro arena); } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_source_file(google_protobuf_GeneratedCodeInfo_Annotation *msg, upb_strview value) { - _upb_sethas(msg, 3); + _upb_sethas(msg, 1); *UPB_PTR_AT(msg, UPB_SIZE(12, 16), upb_strview) = value; } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_begin(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { - _upb_sethas(msg, 1); + _upb_sethas(msg, 2); *UPB_PTR_AT(msg, UPB_SIZE(4, 4), int32_t) = value; } UPB_INLINE void google_protobuf_GeneratedCodeInfo_Annotation_set_end(google_protobuf_GeneratedCodeInfo_Annotation *msg, int32_t value) { - _upb_sethas(msg, 2); + _upb_sethas(msg, 3); *UPB_PTR_AT(msg, UPB_SIZE(8, 8), int32_t) = value; } diff --git a/upbc/generator.cc b/upbc/generator.cc index 4a6cce2a7e..0cb66a29f3 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -140,16 +140,16 @@ std::vector SortedEnums( std::vector FieldNumberOrder( const protobuf::Descriptor* message) { - std::vector messages; + std::vector fields; for (int i = 0; i < message->field_count(); i++) { - messages.push_back(message->field(i)); + fields.push_back(message->field(i)); } - std::sort(messages.begin(), messages.end(), + std::sort(fields.begin(), fields.end(), [](const protobuf::FieldDescriptor* a, const protobuf::FieldDescriptor* b) { return a->number() < b->number(); }); - return messages; + return fields; } std::vector SortedSubmessages( @@ -894,8 +894,7 @@ std::vector FastDecodeTable(const protobuf::Descriptor* message, for (int i = 0; i < 32; i++) { table.emplace_back(TableEntry{"fastdecode_generic", 0}); } - for (int i = 0; i < message->field_count(); i++) { - const protobuf::FieldDescriptor* field = message->field(i); + for (const auto field : FieldHotnessOrder(message)) { int slot = field->number() & 31; if (table[slot].first != "fastdecode_generic") { // This slot is already populated by another field. diff --git a/upbc/message_layout.cc b/upbc/message_layout.cc index 988c384100..3d35448bc8 100644 --- a/upbc/message_layout.cc +++ b/upbc/message_layout.cc @@ -143,7 +143,7 @@ void MessageLayout::PlaceNonOneofFields( // Place/count hasbits. int hasbit_count = 0; - for (auto field : field_order) { + for (auto field : FieldHotnessOrder(descriptor)) { if (HasHasbit(field)) { // We don't use hasbit 0, so that 0 can indicate "no presence" in the // table. This wastes one hasbit, but we don't worry about it for now. diff --git a/upbc/message_layout.h b/upbc/message_layout.h index c2446a0865..f257a963da 100644 --- a/upbc/message_layout.h +++ b/upbc/message_layout.h @@ -102,6 +102,23 @@ class MessageLayout { Size size_; }; +// Returns fields in order of "hotness", eg. how frequently they appear in +// serialized payloads. Ideally this will use a profile. When we don't have +// that, we assume that fields with smaller numbers are used more frequently. +inline std::vector FieldHotnessOrder( + const google::protobuf::Descriptor* message) { + std::vector fields; + for (int i = 0; i < message->field_count(); i++) { + fields.push_back(message->field(i)); + } + std::sort(fields.begin(), fields.end(), + [](const google::protobuf::FieldDescriptor* a, + const google::protobuf::FieldDescriptor* b) { + return a->number() < b->number(); + }); + return fields; +} + } // namespace upbc #endif // UPBC_MESSAGE_LAYOUT_H From bd9f8f580d32f871874d2bdb2e86732526666a66 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 25 Oct 2020 12:42:42 -0700 Subject: [PATCH 73/88] Fixed a few bugs with the fast decoder. 1. For long tags we were putting table entries in the wrong slot. 2. For repeated strings, when the buffer flipped to no longer alias we were failing to notice and kept aliasing anyway. --- cmake/google/protobuf/descriptor.upb.c | 46 +++++++++++++------------- upb/decode_fast.c | 10 ++++-- upbc/generator.cc | 17 ++++++---- 3 files changed, 41 insertions(+), 32 deletions(-) diff --git a/cmake/google/protobuf/descriptor.upb.c b/cmake/google/protobuf/descriptor.upb.c index 1e43d3aa3b..12feddb688 100644 --- a/cmake/google/protobuf/descriptor.upb.c +++ b/cmake/google/protobuf/descriptor.upb.c @@ -299,7 +299,6 @@ const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x000000003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -316,6 +315,7 @@ const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, + {0x000000003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -724,16 +724,16 @@ const upb_msglayout google_protobuf_FileOptions_msginit = { {0x001800000100000a, &upb_pss_1bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x004800000d0002a2, &upb_pss_2bt}, - {0x005800000e0002aa, &upb_pss_2bt}, {0x0000000000000000, &fastdecode_generic}, - {0x006800000f0002ba, &upb_pss_2bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, {0x0028000002000042, &upb_pss_1bt}, {0x0004000003000048, &upb_psv4_1bt}, {0x0008000004000050, &upb_psb1_1bt}, {0x003800000500005a, &upb_pss_1bt}, - {0x00980000130002e2, &upb_pss_2bt}, - {0x00a80000140002ea, &upb_pss_2bt}, + {0x0000000000000000, &fastdecode_generic}, + {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0009000006000180, &upb_psb1_2bt}, @@ -741,15 +741,15 @@ const upb_msglayout google_protobuf_FileOptions_msginit = { {0x000b000008000190, &upb_psb1_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x000c0000090001a0, &upb_psb1_2bt}, - {0x0000000000000000, &fastdecode_generic}, + {0x005800000e0002aa, &upb_pss_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x000d00000a0001b8, &upb_psb1_2bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, + {0x00780000100002c2, &upb_pss_2bt}, + {0x00880000110002ca, &upb_pss_2bt}, + {0x00100000120002d0, &upb_psb1_2bt}, {0x000e00000b0001d8, &upb_psb1_2bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, + {0x00980000130002e2, &upb_pss_2bt}, + {0x00a80000140002ea, &upb_pss_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x000f00000c0001f8, &upb_psb1_2bt}, }, @@ -795,7 +795,7 @@ const upb_msglayout google_protobuf_MessageOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, + {0x000800003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -833,11 +833,10 @@ const upb_msglayout google_protobuf_FieldOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x000e000004000028, &upb_psb1_1bt}, {0x0008000005000030, &upb_psv4_1bt}, - {0x001000003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x000f000006000050, &upb_psb1_1bt}, {0x0000000000000000, &fastdecode_generic}, + {0x000f000006000050, &upb_psb1_1bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -850,6 +849,7 @@ const upb_msglayout google_protobuf_FieldOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, + {0x001000003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -881,7 +881,6 @@ const upb_msglayout google_protobuf_OneofOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x000000003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -898,6 +897,7 @@ const upb_msglayout google_protobuf_OneofOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, + {0x000000003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -931,7 +931,6 @@ const upb_msglayout google_protobuf_EnumOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x000800003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -948,6 +947,7 @@ const upb_msglayout google_protobuf_EnumOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, + {0x000800003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -980,7 +980,6 @@ const upb_msglayout google_protobuf_EnumValueOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x000800003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -997,6 +996,7 @@ const upb_msglayout google_protobuf_EnumValueOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, + {0x000800003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -1023,13 +1023,11 @@ static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2] = { const upb_msglayout google_protobuf_ServiceOptions_msginit = { { {0x0000000000000000, &fastdecode_generic}, - {0x0001000001000288, &upb_psb1_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x000800003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -1041,11 +1039,13 @@ const upb_msglayout google_protobuf_ServiceOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, + {0x0001000001000288, &upb_psb1_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, + {0x000800003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -1073,13 +1073,10 @@ static const upb_msglayout_field google_protobuf_MethodOptions__fields[3] = { const upb_msglayout google_protobuf_MethodOptions_msginit = { { {0x0000000000000000, &fastdecode_generic}, - {0x0008000001000288, &upb_psb1_2bt}, - {0x0004000002000290, &upb_psv4_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, - {0x001000003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, @@ -1092,10 +1089,13 @@ const upb_msglayout google_protobuf_MethodOptions_msginit = { {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, + {0x0008000001000288, &upb_psb1_2bt}, + {0x0004000002000290, &upb_psv4_2bt}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, + {0x001000003f003eba, &upb_prm_2bt_max128b}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, {0x0000000000000000, &fastdecode_generic}, diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 7590b816eb..766f50836b 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -560,8 +560,8 @@ again: ptr += valbytes; if (card == CARD_r) { - fastdecode_nextret ret = fastdecode_nextrepeated( - d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_msg *)); + fastdecode_nextret ret = + fastdecode_nextrepeated(d, dst, &ptr, &farr, data, tagbytes, valbytes); switch (ret.next) { case FD_NEXT_SAMEFIELD: dst = ret.dst; @@ -822,6 +822,12 @@ again: switch (ret.next) { case FD_NEXT_SAMEFIELD: dst = ret.dst; + if (UPB_UNLIKELY(!d->alias)) { + // Buffer flipped and we can't alias any more. Bounce to copyfunc(), + // but via dispatch since we need to reload table data also. + fastdecode_commitarr(dst, &farr, sizeof(upb_strview)); + return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, ret.tag); + } goto again; case FD_NEXT_OTHERFIELD: return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, ret.tag); diff --git a/upbc/generator.cc b/upbc/generator.cc index 0cb66a29f3..7e2569c472 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -741,7 +741,7 @@ typedef std::pair TableEntry; void TryFillTableEntry(const protobuf::Descriptor* message, const MessageLayout& layout, const protobuf::FieldDescriptor* field, - TableEntry& ent) { + std::vector& table) { std::string type = ""; std::string cardinality = ""; protobuf::internal::WireFormatLite::WireType wire_type = @@ -824,6 +824,14 @@ void TryFillTableEntry(const protobuf::Descriptor* message, // Tag is >2 bytes. return; } + int slot = (expected_tag & 0xf8) >> 3; + auto& ent = table[slot]; + + if (ent.first != "fastdecode_generic") { + // This slot is already populated by another field. + return; + } + MessageLayout::Size offset = layout.GetFieldOffset(field); // Data is: @@ -895,12 +903,7 @@ std::vector FastDecodeTable(const protobuf::Descriptor* message, table.emplace_back(TableEntry{"fastdecode_generic", 0}); } for (const auto field : FieldHotnessOrder(message)) { - int slot = field->number() & 31; - if (table[slot].first != "fastdecode_generic") { - // This slot is already populated by another field. - continue; - } - TryFillTableEntry(message, layout, field, table[slot]); + TryFillTableEntry(message, layout, field, table); } return table; } From 46eb82467a6bbacaf0ddaf44cd888660947dca8c Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 25 Oct 2020 20:30:16 -0700 Subject: [PATCH 74/88] Added comment to decode_fast.h. --- upb/decode_fast.c | 4 +++- upb/decode_fast.h | 27 +++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 766f50836b..d136feda9f 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -491,6 +491,7 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, * {s,o,r,p} x {b1,v4,z4,v8,z8} x {1bt,2bt} */ #define F(card, type, valbytes, tagbytes) \ + UPB_NOINLINE \ const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ return fastdecode_varint(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card, \ type##_ZZ, \ @@ -621,7 +622,7 @@ static const char *fastdecode_packedfixed(UPB_PARSE_PARAMS, int tagbytes, return fastdecode_dispatch(d, ptr + size, msg, table, hasbits); } - +UPB_FORCEINLINE static const char *fastdecode_fixed(UPB_PARSE_PARAMS, int tagbytes, int valbytes, upb_card card, _upb_field_parser *unpacked, @@ -638,6 +639,7 @@ static const char *fastdecode_fixed(UPB_PARSE_PARAMS, int tagbytes, * {s,o,r,p} x {f4,f8} x {1bt,2bt} */ #define F(card, valbytes, tagbytes) \ + UPB_NOINLINE \ const char *upb_p##card##f##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ return fastdecode_fixed(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card, \ &upb_ppf##valbytes##_##tagbytes##bt, \ diff --git a/upb/decode_fast.h b/upb/decode_fast.h index 301010c6bb..dc20430425 100644 --- a/upb/decode_fast.h +++ b/upb/decode_fast.h @@ -1,8 +1,31 @@ // These are the specialized field parser functions for the fast parser. // Generated tables will refer to these by name. // -// Here we follow the same pattern of macros used in decode_fast.c to declare -// all of the variants. +// The function names are encoded with names like: +// +// // 123 +// upb_pss_1bt(); // Parse singular string, 1 byte tag. +// +// In position 1: +// - 'p' for parse, most function use this +// - 'c' for copy, for when we are copying strings instead of aliasing +// +// In position 2 (cardinality): +// - 's' for singular, with or without hasbit +// - 'o' for oneof +// - 'r' for non-packed repeated +// - 'p' for packed repeated +// +// In position 3 (type): +// - 'b1' for bool +// - 'v4' for 4-byte varint +// - 'v8' for 8-byte varint +// - 'z4' for zig-zag-encoded 4-byte varint +// - 'z8' for zig-zag-encoded 8-byte varint +// - 'f4' for 4-byte fixed +// - 'f8' for 8-byte fixed +// - 'm' for sub-message +// - 's' for string #ifndef UPB_DECODE_FAST_H_ #define UPB_DECODE_FAST_H_ From 55f3569cd25423371def5843c360879b1ee80595 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 26 Oct 2020 20:52:47 -0700 Subject: [PATCH 75/88] A few minor fixes and more assertions. --- upb/decode.c | 22 +++++++++++++--------- upb/decode.int.h | 4 +++- upb/decode_fast.c | 2 +- upb/msg.h | 6 ++++++ 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/upb/decode.c b/upb/decode.c index fa6237e3da..d259783677 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -319,15 +319,15 @@ static const char *decode_readstr(upb_decstate *d, const char *ptr, int size, static const char *decode_tosubmsg(upb_decstate *d, const char *ptr, upb_msg *submsg, const upb_msglayout *layout, const upb_msglayout_field *field, int size) { - if (size > 0) { - const upb_msglayout *subl = layout->submsgs[field->submsg_index]; - int saved_delta = decode_pushlimit(d, ptr, size); - if (--d->depth < 0) decode_err(d); + const upb_msglayout *subl = layout->submsgs[field->submsg_index]; + int saved_delta = decode_pushlimit(d, ptr, size); + if (--d->depth < 0) decode_err(d); + if (!decode_isdone(d, &ptr)) { ptr = decode_msg(d, ptr, submsg, subl); - decode_poplimit(d, saved_delta); - if (d->end_group != 0) decode_err(d); - d->depth++; } + decode_poplimit(d, ptr, saved_delta); + if (d->end_group != 0) decode_err(d); + d->depth++; return ptr; } @@ -335,6 +335,9 @@ static const char *decode_group(upb_decstate *d, const char *ptr, upb_msg *submsg, const upb_msglayout *subl, uint32_t number) { if (--d->depth < 0) decode_err(d); + if (decode_isdone(d, &ptr)) { + decode_err(d); + } ptr = decode_msg(d, ptr, submsg, subl); if (d->end_group != number) decode_err(d); d->end_group = 0; @@ -430,7 +433,7 @@ static const char *decode_toarray(upb_decstate *d, const char *ptr, memcpy(out, &elem, scale); out += scale; } - decode_poplimit(d, saved_limit); + decode_poplimit(d, ptr, saved_limit); return ptr; } default: @@ -554,6 +557,7 @@ static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, wireval val; int op; + UPB_ASSERT(ptr < d->limit_ptr); ptr = decode_varint32(d, ptr, &tag); field_number = tag >> 3; wire_type = tag & 7; @@ -658,7 +662,7 @@ bool upb_decode(const char *buf, size_t size, void *msg, const upb_msglayout *l, if (size == 0) { return true; - } else if (size < 16) { + } else if (size <= 16) { memset(&state.patch, 0, 32); memcpy(&state.patch, buf, size); buf = state.patch; diff --git a/upb/decode.int.h b/upb/decode.int.h index c1d1860d32..41303531d7 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -119,7 +119,9 @@ UPB_INLINE int decode_pushlimit(upb_decstate *d, const char *ptr, int size) { return delta; } -UPB_INLINE void decode_poplimit(upb_decstate *d, int saved_delta) { +UPB_INLINE void decode_poplimit(upb_decstate *d, const char *ptr, + int saved_delta) { + UPB_ASSERT(ptr - d->end == d->limit); d->limit += saved_delta; d->limit_ptr = d->end + UPB_MIN(0, d->limit); UPB_ASSERT(d->limit_ptr == d->end + UPB_MIN(0, d->limit)); diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 780a264d3f..8170b4929f 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -142,7 +142,7 @@ static const char *fastdecode_delimited(upb_decstate *d, const char *ptr, } int delta = decode_pushlimit(d, ptr, len); ptr = func(d, ptr, ctx); - decode_poplimit(d, delta); + decode_poplimit(d, ptr, delta); } else { // Fast case: Sub-message is <128 bytes and fits in the current buffer. // This means we can preserve limit/limit_ptr verbatim. diff --git a/upb/msg.h b/upb/msg.h index b261ea3359..f0f55ffd7b 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -67,7 +67,13 @@ typedef struct upb_msglayout { uint16_t field_count; bool extendable; uint8_t table_mask; +#if __STDC_VERSION__ >= 199901L + // To constant-initialize the tables of variable length, we need a flexible + // array member, and we need to compile in C99 mode. _upb_fasttable_entry fasttable[]; +#else + _upb_fasttable_entry fasttable[1]; +#endif } upb_msglayout; /** upb_msg *******************************************************************/ From b928696942dd14f9770069d5f44a0ff6fcf59122 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 26 Oct 2020 21:23:16 -0700 Subject: [PATCH 76/88] A few more fixes, and test fastdecode under Kokoro. --- BUILD | 2 +- cmake/google/protobuf/descriptor.upb.c | 488 ++----------------------- kokoro/ubuntu/build.sh | 16 +- upb/decode.int.h | 2 +- upb/decode_fast.c | 9 +- upb/msg.h | 4 +- 6 files changed, 49 insertions(+), 472 deletions(-) diff --git a/BUILD b/BUILD index 3789b98f42..1276714b9c 100644 --- a/BUILD +++ b/BUILD @@ -38,7 +38,7 @@ config_setting( upb_fasttable_enabled( name = "fasttable_enabled", - build_setting_default = True, + build_setting_default = False, visibility = ["//visibility:public"], ) diff --git a/cmake/google/protobuf/descriptor.upb.c b/cmake/google/protobuf/descriptor.upb.c index c54304aa50..7225c146ff 100644 --- a/cmake/google/protobuf/descriptor.upb.c +++ b/cmake/google/protobuf/descriptor.upb.c @@ -23,10 +23,8 @@ static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1] = const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { &google_protobuf_FileDescriptorSet_submsgs[0], &google_protobuf_FileDescriptorSet__fields[0], - UPB_SIZE(8, 8), 1, false, 8, + UPB_SIZE(8, 8), 1, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x000000003f00000a, &upb_prm_1bt_max192b}, }, }; @@ -57,24 +55,8 @@ static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12] const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { &google_protobuf_FileDescriptorProto_submsgs[0], &google_protobuf_FileDescriptorProto__fields[0], - UPB_SIZE(64, 128), 12, false, 120, + UPB_SIZE(64, 128), 12, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x000800000100000a, &upb_pss_1bt}, - {0x0018000002000012, &upb_pss_1bt}, - {0x004800003f00001a, &upb_prs_1bt}, - {0x005000003f000022, &upb_prm_1bt_max128b}, - {0x005800003f01002a, &upb_prm_1bt_max128b}, - {0x006000003f040032, &upb_prm_1bt_max64b}, - {0x006800003f02003a, &upb_prm_1bt_max128b}, - {0x0038000003030042, &upb_psm_1bt_max256b}, - {0x004000000405004a, &upb_psm_1bt_max64b}, - {0x007000003f000050, &upb_prv4_1bt}, - {0x007800003f000058, &upb_prv4_1bt}, - {0x0028000005000062, &upb_pss_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -104,24 +86,8 @@ static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10] = { const upb_msglayout google_protobuf_DescriptorProto_msginit = { &google_protobuf_DescriptorProto_submsgs[0], &google_protobuf_DescriptorProto__fields[0], - UPB_SIZE(48, 96), 10, false, 120, + UPB_SIZE(48, 96), 10, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x000800000100000a, &upb_pss_1bt}, - {0x002000003f040012, &upb_prm_1bt_max128b}, - {0x002800003f00001a, &upb_prm_1bt_max128b}, - {0x003000003f030022, &upb_prm_1bt_max128b}, - {0x003800003f01002a, &upb_prm_1bt_max64b}, - {0x004000003f040032, &upb_prm_1bt_max128b}, - {0x001800000205003a, &upb_psm_1bt_max64b}, - {0x004800003f060042, &upb_prm_1bt_max64b}, - {0x005000003f02004a, &upb_prm_1bt_max64b}, - {0x005800003f000052, &upb_prs_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -138,12 +104,8 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange_ const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0], &google_protobuf_DescriptorProto_ExtensionRange__fields[0], - UPB_SIZE(16, 24), 3, false, 24, + UPB_SIZE(16, 24), 3, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x0004000001000008, &upb_psv4_1bt}, - {0x0008000002000010, &upb_psv4_1bt}, - {0x001000000300001a, &upb_psm_1bt_max64b}, }, }; @@ -155,12 +117,8 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__ const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { NULL, &google_protobuf_DescriptorProto_ReservedRange__fields[0], - UPB_SIZE(16, 16), 2, false, 24, + UPB_SIZE(16, 16), 2, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x0004000001000008, &upb_psv4_1bt}, - {0x0008000002000010, &upb_psv4_1bt}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -175,40 +133,8 @@ static const upb_msglayout_field google_protobuf_ExtensionRangeOptions__fields[1 const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { &google_protobuf_ExtensionRangeOptions_submsgs[0], &google_protobuf_ExtensionRangeOptions__fields[0], - UPB_SIZE(8, 8), 1, false, 248, + UPB_SIZE(8, 8), 1, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x000000003f003eba, &upb_prm_2bt_max128b}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -233,40 +159,8 @@ static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[11 const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { &google_protobuf_FieldDescriptorProto_submsgs[0], &google_protobuf_FieldDescriptorProto__fields[0], - UPB_SIZE(72, 112), 11, false, 248, + UPB_SIZE(72, 112), 11, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x001800000100000a, &upb_pss_1bt}, - {0x0028000002000012, &upb_pss_1bt}, - {0x000c000003000018, &upb_psv4_1bt}, - {0x0004000004000020, &upb_psv4_1bt}, - {0x0008000005000028, &upb_psv4_1bt}, - {0x0038000006000032, &upb_pss_1bt}, - {0x004800000700003a, &upb_pss_1bt}, - {0x0068000008000042, &upb_psm_1bt_max64b}, - {0x0010000009000048, &upb_psv4_1bt}, - {0x005800000a000052, &upb_pss_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x001400000b000188, &upb_psb1_2bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -282,12 +176,8 @@ static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2] const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { &google_protobuf_OneofDescriptorProto_submsgs[0], &google_protobuf_OneofDescriptorProto__fields[0], - UPB_SIZE(16, 32), 2, false, 24, + UPB_SIZE(16, 32), 2, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x000800000100000a, &upb_pss_1bt}, - {0x0018000002000012, &upb_psm_1bt_max64b}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -308,16 +198,8 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5] const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { &google_protobuf_EnumDescriptorProto_submsgs[0], &google_protobuf_EnumDescriptorProto__fields[0], - UPB_SIZE(32, 64), 5, false, 56, + UPB_SIZE(32, 64), 5, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x000800000100000a, &upb_pss_1bt}, - {0x002000003f020012, &upb_prm_1bt_max64b}, - {0x001800000201001a, &upb_psm_1bt_max64b}, - {0x002800003f000022, &upb_prm_1bt_max64b}, - {0x003000003f00002a, &upb_prs_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -329,12 +211,8 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReserve const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { NULL, &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0], - UPB_SIZE(16, 16), 2, false, 24, + UPB_SIZE(16, 16), 2, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x0004000001000008, &upb_psv4_1bt}, - {0x0008000002000010, &upb_psv4_1bt}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -351,12 +229,8 @@ static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__field const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { &google_protobuf_EnumValueDescriptorProto_submsgs[0], &google_protobuf_EnumValueDescriptorProto__fields[0], - UPB_SIZE(24, 32), 3, false, 24, + UPB_SIZE(24, 32), 3, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x000800000100000a, &upb_pss_1bt}, - {0x0004000002000010, &upb_psv4_1bt}, - {0x001800000300001a, &upb_psm_1bt_max64b}, }, }; @@ -374,12 +248,8 @@ static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[ const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { &google_protobuf_ServiceDescriptorProto_submsgs[0], &google_protobuf_ServiceDescriptorProto__fields[0], - UPB_SIZE(24, 48), 3, false, 24, + UPB_SIZE(24, 48), 3, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x000800000100000a, &upb_pss_1bt}, - {0x002000003f000012, &upb_prm_1bt_max128b}, - {0x001800000201001a, &upb_psm_1bt_max64b}, }, }; @@ -399,16 +269,8 @@ static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6 const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { &google_protobuf_MethodDescriptorProto_submsgs[0], &google_protobuf_MethodDescriptorProto__fields[0], - UPB_SIZE(32, 64), 6, false, 56, + UPB_SIZE(32, 64), 6, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x000800000100000a, &upb_pss_1bt}, - {0x0018000002000012, &upb_pss_1bt}, - {0x002800000300001a, &upb_pss_1bt}, - {0x0038000004000022, &upb_psm_1bt_max64b}, - {0x0001000005000028, &upb_psb1_1bt}, - {0x0002000006000030, &upb_psb1_1bt}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -443,40 +305,8 @@ static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { const upb_msglayout google_protobuf_FileOptions_msginit = { &google_protobuf_FileOptions_submsgs[0], &google_protobuf_FileOptions__fields[0], - UPB_SIZE(104, 192), 21, false, 248, + UPB_SIZE(104, 192), 21, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x001800000100000a, &upb_pss_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0028000002000042, &upb_pss_1bt}, - {0x0004000003000048, &upb_psv4_1bt}, - {0x0008000004000050, &upb_psb1_1bt}, - {0x003800000500005a, &upb_pss_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0009000006000180, &upb_psb1_2bt}, - {0x000a000007000188, &upb_psb1_2bt}, - {0x000b000008000190, &upb_psb1_2bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x000c0000090001a0, &upb_psb1_2bt}, - {0x005800000e0002aa, &upb_pss_2bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x000d00000a0001b8, &upb_psb1_2bt}, - {0x00780000100002c2, &upb_pss_2bt}, - {0x00880000110002ca, &upb_pss_2bt}, - {0x00100000120002d0, &upb_psb1_2bt}, - {0x000e00000b0001d8, &upb_psb1_2bt}, - {0x00980000130002e2, &upb_pss_2bt}, - {0x00a80000140002ea, &upb_pss_2bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x000f00000c0001f8, &upb_psb1_2bt}, }, }; @@ -495,40 +325,8 @@ static const upb_msglayout_field google_protobuf_MessageOptions__fields[5] = { const upb_msglayout google_protobuf_MessageOptions_msginit = { &google_protobuf_MessageOptions_submsgs[0], &google_protobuf_MessageOptions__fields[0], - UPB_SIZE(16, 16), 5, false, 248, + UPB_SIZE(16, 16), 5, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x0001000001000008, &upb_psb1_1bt}, - {0x0002000002000010, &upb_psb1_1bt}, - {0x0003000003000018, &upb_psb1_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0004000004000038, &upb_psb1_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x000800003f003eba, &upb_prm_2bt_max128b}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -549,40 +347,8 @@ static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = { const upb_msglayout google_protobuf_FieldOptions_msginit = { &google_protobuf_FieldOptions_submsgs[0], &google_protobuf_FieldOptions__fields[0], - UPB_SIZE(24, 24), 7, false, 248, + UPB_SIZE(24, 24), 7, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x0004000001000008, &upb_psv4_1bt}, - {0x000c000002000010, &upb_psb1_1bt}, - {0x000d000003000018, &upb_psb1_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x000e000004000028, &upb_psb1_1bt}, - {0x0008000005000030, &upb_psv4_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x000f000006000050, &upb_psb1_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x001000003f003eba, &upb_prm_2bt_max128b}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -597,40 +363,8 @@ static const upb_msglayout_field google_protobuf_OneofOptions__fields[1] = { const upb_msglayout google_protobuf_OneofOptions_msginit = { &google_protobuf_OneofOptions_submsgs[0], &google_protobuf_OneofOptions__fields[0], - UPB_SIZE(8, 8), 1, false, 248, + UPB_SIZE(8, 8), 1, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x000000003f003eba, &upb_prm_2bt_max128b}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -647,40 +381,8 @@ static const upb_msglayout_field google_protobuf_EnumOptions__fields[3] = { const upb_msglayout google_protobuf_EnumOptions_msginit = { &google_protobuf_EnumOptions_submsgs[0], &google_protobuf_EnumOptions__fields[0], - UPB_SIZE(8, 16), 3, false, 248, + UPB_SIZE(8, 16), 3, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0001000001000010, &upb_psb1_1bt}, - {0x0002000002000018, &upb_psb1_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x000800003f003eba, &upb_prm_2bt_max128b}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -696,40 +398,8 @@ static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2] = { const upb_msglayout google_protobuf_EnumValueOptions_msginit = { &google_protobuf_EnumValueOptions_submsgs[0], &google_protobuf_EnumValueOptions__fields[0], - UPB_SIZE(8, 16), 2, false, 248, + UPB_SIZE(8, 16), 2, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x0001000001000008, &upb_psb1_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x000800003f003eba, &upb_prm_2bt_max128b}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -745,40 +415,8 @@ static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2] = { const upb_msglayout google_protobuf_ServiceOptions_msginit = { &google_protobuf_ServiceOptions_submsgs[0], &google_protobuf_ServiceOptions__fields[0], - UPB_SIZE(8, 16), 2, false, 248, + UPB_SIZE(8, 16), 2, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0001000001000288, &upb_psb1_2bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x000800003f003eba, &upb_prm_2bt_max128b}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -795,40 +433,8 @@ static const upb_msglayout_field google_protobuf_MethodOptions__fields[3] = { const upb_msglayout google_protobuf_MethodOptions_msginit = { &google_protobuf_MethodOptions_submsgs[0], &google_protobuf_MethodOptions__fields[0], - UPB_SIZE(16, 24), 3, false, 248, + UPB_SIZE(16, 24), 3, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0008000001000288, &upb_psb1_2bt}, - {0x0004000002000290, &upb_psv4_2bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x001000003f003eba, &upb_prm_2bt_max128b}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -849,24 +455,8 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption__fields[7] const upb_msglayout google_protobuf_UninterpretedOption_msginit = { &google_protobuf_UninterpretedOption_submsgs[0], &google_protobuf_UninterpretedOption__fields[0], - UPB_SIZE(64, 96), 7, false, 120, + UPB_SIZE(64, 96), 7, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x005000003f000012, &upb_prm_1bt_max64b}, - {0x002000000100001a, &upb_pss_1bt}, - {0x0008000002000020, &upb_psv8_1bt}, - {0x0010000003000028, &upb_psv8_1bt}, - {0x0018000004000031, &upb_psf8_1bt}, - {0x003000000500003a, &upb_pss_1bt}, - {0x0040000006000042, &upb_pss_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -878,12 +468,8 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__f const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { NULL, &google_protobuf_UninterpretedOption_NamePart__fields[0], - UPB_SIZE(16, 32), 2, false, 24, + UPB_SIZE(16, 32), 2, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x000800000100000a, &upb_pss_1bt}, - {0x0001000002000010, &upb_psb1_1bt}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -898,10 +484,8 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1] = { const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { &google_protobuf_SourceCodeInfo_submsgs[0], &google_protobuf_SourceCodeInfo__fields[0], - UPB_SIZE(8, 8), 1, false, 8, + UPB_SIZE(8, 8), 1, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x000000003f00000a, &upb_prm_1bt_max128b}, }, }; @@ -916,16 +500,8 @@ static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { NULL, &google_protobuf_SourceCodeInfo_Location__fields[0], - UPB_SIZE(32, 64), 5, false, 56, + UPB_SIZE(32, 64), 5, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x002800003f00000a, &upb_ppv4_1bt}, - {0x003000003f000012, &upb_ppv4_1bt}, - {0x000800000100001a, &upb_pss_1bt}, - {0x0018000002000022, &upb_pss_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x003800003f000032, &upb_prs_1bt}, - {0x0000000000000000, &fastdecode_generic}, }, }; @@ -940,10 +516,8 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1] = const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { &google_protobuf_GeneratedCodeInfo_submsgs[0], &google_protobuf_GeneratedCodeInfo__fields[0], - UPB_SIZE(8, 8), 1, false, 8, + UPB_SIZE(8, 8), 1, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x000000003f00000a, &upb_prm_1bt_max64b}, }, }; @@ -957,16 +531,8 @@ static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__f const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { NULL, &google_protobuf_GeneratedCodeInfo_Annotation__fields[0], - UPB_SIZE(24, 48), 4, false, 56, + UPB_SIZE(24, 48), 4, false, 255, { - {0x0000000000000000, &fastdecode_generic}, - {0x002000003f00000a, &upb_ppv4_1bt}, - {0x0010000001000012, &upb_pss_1bt}, - {0x0004000002000018, &upb_psv4_1bt}, - {0x0008000003000020, &upb_psv4_1bt}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, - {0x0000000000000000, &fastdecode_generic}, }, }; diff --git a/kokoro/ubuntu/build.sh b/kokoro/ubuntu/build.sh index 1b1089097e..2dacffec6d 100644 --- a/kokoro/ubuntu/build.sh +++ b/kokoro/ubuntu/build.sh @@ -11,15 +11,25 @@ fi echo PATH=$PATH ls -l `which cmake` cmake --version -echo CC=${CC:-cc} -${CC:-cc} --version # Log the bazel path and version. which bazel bazel version cd $(dirname $0)/../.. -bazel test --test_output=errors ... + +if which gcc; then + gcc --version + bazel test --test_output=errors ... + # The checked-in code is with fasttable not enabled. + bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files +fi + +if which clang; then + CC=clang bazel test --test_output=errors ... + # The checked-in code is with fasttable not enabled. + CC=clang bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files +fi if [[ $(uname) = "Linux" ]]; then # Verify the ASAN build. Have to exclude test_conformance_upb as protobuf diff --git a/upb/decode.int.h b/upb/decode.int.h index 41303531d7..8cd09bbf46 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -99,7 +99,7 @@ const char *fastdecode_tagdispatch(upb_decstate *d, const char *ptr, uint8_t mask = table; uint64_t data; size_t idx = tag & mask; - __builtin_assume((idx & 7) == 0); + UPB_ASSUME((idx & 7) == 0); idx >>= 3; data = table_p->fasttable[idx].field_data ^ tag; return table_p->fasttable[idx].field_parser(d, ptr, msg, table, hasbits, data); diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 8170b4929f..cb30317dbb 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -47,8 +47,9 @@ static const char *fastdecode_isdonefallback(upb_decstate *d, const char *ptr, } UPB_FORCEINLINE -const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, - intptr_t table, uint64_t hasbits) { +static const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, + upb_msg *msg, intptr_t table, + uint64_t hasbits) { if (UPB_UNLIKELY(ptr >= d->limit_ptr)) { int overrun = ptr - d->end; if (UPB_LIKELY(overrun == d->limit)) { @@ -331,7 +332,7 @@ static const char *fastdecode_varint64(const char *ptr, uint64_t *val) { *val += (byte - 1) << 63; } done: - __builtin_assume(ptr != NULL); + UPB_ASSUME(ptr != NULL); return ptr; } @@ -872,7 +873,7 @@ static const char *fastdecode_tosubmsg(upb_decstate *d, const char *ptr, void *ctx) { fastdecode_submsgdata *submsg = ctx; ptr = fastdecode_dispatch(d, ptr, submsg->msg, submsg->table, 0); - __builtin_assume(ptr != NULL); + UPB_ASSUME(ptr != NULL); return ptr; } diff --git a/upb/msg.h b/upb/msg.h index f0f55ffd7b..4f4185ffde 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -68,8 +68,8 @@ typedef struct upb_msglayout { bool extendable; uint8_t table_mask; #if __STDC_VERSION__ >= 199901L - // To constant-initialize the tables of variable length, we need a flexible - // array member, and we need to compile in C99 mode. + /* To constant-initialize the tables of variable length, we need a flexible + * array member, and we need to compile in C99 mode. */ _upb_fasttable_entry fasttable[]; #else _upb_fasttable_entry fasttable[1]; From efd576b698c77d75b88a3bdb1c095903a009858d Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 26 Oct 2020 21:37:17 -0700 Subject: [PATCH 77/88] Added -std=gnu99 for fastdecode and ran Buildifier. --- BUILD | 17 ++++++++++++----- cmake/CMakeLists.txt | 6 +++--- upb/decode_fast.c | 3 ++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/BUILD b/BUILD index 1276714b9c..60588bf507 100644 --- a/BUILD +++ b/BUILD @@ -77,19 +77,26 @@ cc_library( ], copts = UPB_DEFAULT_COPTS, visibility = ["//visibility:public"], - deps = [":port", ":fastdecode"], + deps = [ + ":fastdecode", + ":port", + ], ) cc_library( name = "fastdecode", srcs = [ + "upb/decode.int.h", "upb/decode_fast.c", "upb/decode_fast.h", - "upb/decode.int.h", "upb/msg.h", "upb/upb.int.h", ], - deps = [":port", ":table"], + copts = ["-std=gnu99"], + deps = [ + ":port", + ":table", + ], ) # Common support routines used by generated code. This library has no @@ -188,8 +195,8 @@ cc_library( cc_library( name = "table", hdrs = [ - "upb/table.int.h", - "upb/upb.h", + "upb/table.int.h", + "upb/upb.h", ], visibility = ["//tests:__pkg__"], deps = [ diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 01c9f8fe17..8199fe39c1 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -77,12 +77,12 @@ add_library(upb ../upb/upb.h ../upb/upb.hpp) target_link_libraries(upb - port - fastdecode) + fastdecode + port) add_library(fastdecode + ../upb/decode.int.h ../upb/decode_fast.c ../upb/decode_fast.h - ../upb/decode.int.h ../upb/msg.h ../upb/upb.int.h) target_link_libraries(fastdecode diff --git a/upb/decode_fast.c b/upb/decode_fast.c index cb30317dbb..467787008e 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -77,9 +77,10 @@ static bool fastdecode_checktag(uint64_t data, int tagbytes) { UPB_FORCEINLINE static const char *fastdecode_longsize(const char *ptr, int *size) { + int i; UPB_ASSERT(*size & 0x80); *size &= 0xff; - for (int i = 0; i < 3; i++) { + for (i = 0; i < 3; i++) { ptr++; size_t byte = (uint8_t)ptr[-1]; *size += (byte - 1) << (7 + 7 * i); From 2c8bb6dd9d4795d408f80a3a79766fd174b264b5 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 27 Oct 2020 10:36:56 -0700 Subject: [PATCH 78/88] Specify C99 explicitly until/unless we stop using bool. --- BUILD | 6 ------ bazel/build_defs.bzl | 3 +-- upb/decode_fast.h | 8 ++++++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/BUILD b/BUILD index 60588bf507..dccd53185c 100644 --- a/BUILD +++ b/BUILD @@ -25,12 +25,6 @@ exports_files([ "build_defs", ]) -config_setting( - name = "darwin", - values = {"cpu": "darwin"}, - visibility = ["//visibility:public"], -) - config_setting( name = "windows", constraint_values = ["@bazel_tools//platforms:windows"], diff --git a/bazel/build_defs.bzl b/bazel/build_defs.bzl index 3555a03e8e..d721d0060c 100644 --- a/bazel/build_defs.bzl +++ b/bazel/build_defs.bzl @@ -18,8 +18,7 @@ UPB_DEFAULT_COPTS = select({ "//:windows": [], "//conditions:default": [ # copybara:strip_for_google3_begin - "-pedantic", - "-Werror=pedantic", + "-std=c99", "-Wstrict-prototypes", # copybara:strip_end ], diff --git a/upb/decode_fast.h b/upb/decode_fast.h index e3c6f575e3..e5cfc13e7f 100644 --- a/upb/decode_fast.h +++ b/upb/decode_fast.h @@ -3,7 +3,7 @@ // // The function names are encoded with names like: // -// // 123 +// // 123 4 // upb_pss_1bt(); // Parse singular string, 1 byte tag. // // In position 1: @@ -25,7 +25,11 @@ // - 'f4' for 4-byte fixed // - 'f8' for 8-byte fixed // - 'm' for sub-message -// - 's' for string +// - 's' for string/bytes +// +// In position 4 (tag length): +// - '1' for one-byte tags (field numbers 1-15) +// - '2' for two-byte tags (field numbers 16-2048) #ifndef UPB_DECODE_FAST_H_ #define UPB_DECODE_FAST_H_ From a274ad786a6d21d191baea321813f356d4b50104 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 28 Oct 2020 13:06:30 -0700 Subject: [PATCH 79/88] Plumbed copts (including the crucial -std=c99) to upb_proto_library() aspect. --- BUILD | 7 +++++++ bazel/upb_proto_library.bzl | 26 +++++++++++++++++++++++++- cmake/make_cmakelists.py | 3 +++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/BUILD b/BUILD index dccd53185c..6c9e9a1615 100644 --- a/BUILD +++ b/BUILD @@ -8,6 +8,7 @@ load( "upb_fasttable_enabled", "upb_proto_library", "upb_proto_reflection_library", + "upb_proto_library_copts", ) # copybara:strip_for_google3_begin @@ -36,6 +37,12 @@ upb_fasttable_enabled( visibility = ["//visibility:public"], ) +upb_proto_library_copts( + name = "upb_proto_library_copts__for_generated_code_only_do_not_use", + copts = UPB_DEFAULT_COPTS, + visibility = ["//visibility:public"], +) + # Public C/C++ libraries ####################################################### cc_library( diff --git a/bazel/upb_proto_library.bzl b/bazel/upb_proto_library.bzl index 6c56293b52..6e6ec3a8ed 100644 --- a/bazel/upb_proto_library.bzl +++ b/bazel/upb_proto_library.bzl @@ -52,7 +52,7 @@ def _filter_none(elems): out.append(elem) return out -def _cc_library_func(ctx, name, hdrs, srcs, dep_ccinfos): +def _cc_library_func(ctx, name, hdrs, srcs, copts, dep_ccinfos): """Like cc_library(), but callable from rules. Args: @@ -88,6 +88,7 @@ def _cc_library_func(ctx, name, hdrs, srcs, dep_ccinfos): name = name, srcs = srcs, public_hdrs = hdrs, + user_compile_flags = copts, compilation_contexts = compilation_contexts, **blaze_only_args ) @@ -128,6 +129,22 @@ upb_fasttable_enabled = rule( build_setting = config.bool(flag = True) ) +# Dummy rule to expose select() copts to aspects ############################## + +_UpbProtoLibraryCopts = provider( + fields = { + "copts": "copts for upb_proto_library()", + }, +) + +def upb_proto_library_copts_impl(ctx): + return _UpbProtoLibraryCopts(copts = ctx.attr.copts) + +upb_proto_library_copts = rule( + implementation = upb_proto_library_copts_impl, + attrs = {"copts": attr.string_list(default = [])}, +) + # upb_proto_library / upb_proto_reflection_library shared code ################# GeneratedSrcsInfo = provider( @@ -223,6 +240,7 @@ def _upb_proto_aspect_impl(target, ctx, cc_provider, file_provider): name = ctx.rule.attr.name + ctx.attr._ext, hdrs = files.hdrs, srcs = files.srcs, + copts = ctx.attr._copts[_UpbProtoLibraryCopts].copts, dep_ccinfos = dep_ccinfos, ) return [cc_provider(cc_info = cc_info), file_provider(srcs = files)] @@ -246,6 +264,9 @@ def _maybe_add(d): _upb_proto_library_aspect = aspect( attrs = _maybe_add({ + "_copts": attr.label( + default = "//:upb_proto_library_copts__for_generated_code_only_do_not_use", + ), "_upbc": attr.label( executable = True, cfg = "host", @@ -292,6 +313,9 @@ upb_proto_library = rule( _upb_proto_reflection_library_aspect = aspect( attrs = _maybe_add({ + "_copts": attr.label( + default = "//:upb_proto_library_copts__for_generated_code_only_do_not_use", + ), "_upbc": attr.label( executable = True, cfg = "host", diff --git a/cmake/make_cmakelists.py b/cmake/make_cmakelists.py index a750717326..1dafbbda5b 100755 --- a/cmake/make_cmakelists.py +++ b/cmake/make_cmakelists.py @@ -129,6 +129,9 @@ class BuildFileFunctions(object): def upb_proto_library(self, **kwargs): pass + def upb_proto_library_copts(self, **kwargs): + pass + def upb_proto_reflection_library(self, **kwargs): pass From e86541ac1d2345bac24ab38071ce24b13abb00c5 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 28 Oct 2020 17:53:09 -0700 Subject: [PATCH 80/88] Fixed the build after the merge. --- BUILD | 20 +++++++++++++++----- cmake/CMakeLists.txt | 6 +++--- examples/bazel/BUILD | 2 +- tests/bindings/lua/BUILD | 2 +- upb/decode_fast.c | 4 ++-- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/BUILD b/BUILD index efb4e36950..a18cff49d4 100644 --- a/BUILD +++ b/BUILD @@ -78,19 +78,26 @@ cc_library( ], copts = UPB_DEFAULT_COPTS, visibility = ["//visibility:public"], - deps = [":port", ":fastdecode"], + deps = [ + ":fastdecode", + ":port", + ], ) cc_library( name = "fastdecode", srcs = [ + "upb/decode.int.h", "upb/decode_fast.c", "upb/decode_fast.h", - "upb/decode.int.h", "upb/msg.h", "upb/upb.int.h", ], - deps = [":port", ":table"], + copts = UPB_DEFAULT_COPTS, + deps = [ + ":port", + ":table", + ], ) # Common support routines used by generated code. This library has no @@ -189,8 +196,8 @@ cc_library( cc_library( name = "table", hdrs = [ - "upb/table.int.h", - "upb/upb.h", + "upb/table.int.h", + "upb/upb.h", ], visibility = ["//tests:__pkg__"], deps = [ @@ -307,6 +314,7 @@ cc_library( name = "amalgamation", srcs = ["upb.c"], hdrs = ["upb.h"], + copts = UPB_DEFAULT_COPTS, ) upb_amalgamation( @@ -332,6 +340,7 @@ cc_library( name = "php_amalgamation", srcs = ["php-upb.c"], hdrs = ["php-upb.h"], + copts = UPB_DEFAULT_COPTS, ) upb_amalgamation( @@ -356,6 +365,7 @@ cc_library( name = "ruby_amalgamation", srcs = ["ruby-upb.c"], hdrs = ["ruby-upb.h"], + copts = UPB_DEFAULT_COPTS, ) exports_files( diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 48ee75d2dd..fcdce9936a 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -78,12 +78,12 @@ add_library(upb ../upb/upb.h ../upb/upb.hpp) target_link_libraries(upb - port - fastdecode) + fastdecode + port) add_library(fastdecode + ../upb/decode.int.h ../upb/decode_fast.c ../upb/decode_fast.h - ../upb/decode.int.h ../upb/msg.h ../upb/upb.int.h) target_link_libraries(fastdecode diff --git a/examples/bazel/BUILD b/examples/bazel/BUILD index af2c6f8cde..97119252e2 100644 --- a/examples/bazel/BUILD +++ b/examples/bazel/BUILD @@ -16,6 +16,6 @@ upb_proto_library( cc_binary( name = "test_binary", srcs = ["test_binary.c"], - deps = [":foo_upbproto"], copts = ["-std=c99"], + deps = [":foo_upbproto"], ) diff --git a/tests/bindings/lua/BUILD b/tests/bindings/lua/BUILD index 00eb3ba274..8834feb8ff 100644 --- a/tests/bindings/lua/BUILD +++ b/tests/bindings/lua/BUILD @@ -12,6 +12,7 @@ licenses(["notice"]) cc_test( name = "test_lua", srcs = ["main.c"], + copts = UPB_DEFAULT_COPTS, data = [ "test_upb.lua", ":descriptor_proto_lua", @@ -24,7 +25,6 @@ cc_test( "@com_google_protobuf//:conformance_proto", "@com_google_protobuf//:descriptor_proto", ], - copts = UPB_DEFAULT_COPTS, linkstatic = 1, deps = [ "//upb/bindings/lua:lupb", diff --git a/upb/decode_fast.c b/upb/decode_fast.c index d136feda9f..e38f8be1f1 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -356,7 +356,7 @@ static const char *fastdecode_varint64(const char *ptr, uint64_t *val) { *val += (byte - 1) << 63; } done: - __builtin_assume(ptr != NULL); + UPB_ASSUME(ptr != NULL); return ptr; } @@ -897,7 +897,7 @@ static const char *fastdecode_tosubmsg(upb_decstate *d, const char *ptr, void *ctx) { fastdecode_submsgdata *submsg = ctx; ptr = fastdecode_dispatch(d, ptr, submsg->msg, submsg->layout, 0); - __builtin_assume(ptr != NULL); + UPB_ASSUME(ptr != NULL); return ptr; } From e8f9eac68c3077f5896609898bbe2f57c4a9d367 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 28 Oct 2020 22:50:03 -0700 Subject: [PATCH 81/88] Added #defines UPB_ENABLE_FASTTABLE and UPB_TRY_ENABLE_FASTTABLE. These control whether fasttable decoding is on. --- BUILD | 7 ++++- bazel/build_defs.bzl | 1 + bazel/upb_proto_library.bzl | 10 +++---- cmake/build_defs.bzl | 1 - upb/bindings/lua/lua_proto_library.bzl | 9 ++++--- upb/decode.c | 5 ++-- upb/decode_fast.c | 4 +++ upb/port_def.inc | 37 ++++++++++++++++++++++++++ upbc/generator.cc | 4 +-- 9 files changed, 63 insertions(+), 15 deletions(-) diff --git a/BUILD b/BUILD index 8d5761b80d..9f2698724d 100644 --- a/BUILD +++ b/BUILD @@ -7,8 +7,8 @@ load( "//bazel:upb_proto_library.bzl", "upb_fasttable_enabled", "upb_proto_library", - "upb_proto_reflection_library", "upb_proto_library_copts", + "upb_proto_reflection_library", ) # copybara:strip_for_google3_begin @@ -37,6 +37,11 @@ upb_fasttable_enabled( visibility = ["//visibility:public"], ) +config_setting( + name = "fasttable_enabled_setting", + flag_values = {"//:fasttable_enabled": "true"}, +) + upb_proto_library_copts( name = "upb_proto_library_copts__for_generated_code_only_do_not_use", copts = UPB_DEFAULT_COPTS, diff --git a/bazel/build_defs.bzl b/bazel/build_defs.bzl index a199243947..0d31cecfea 100644 --- a/bazel/build_defs.bzl +++ b/bazel/build_defs.bzl @@ -16,6 +16,7 @@ UPB_DEFAULT_CPPOPTS = select({ UPB_DEFAULT_COPTS = select({ "//:windows": [], + "//:fasttable_enabled_setting": ["-std=gnu99", "-DUPB_ENABLE_FASTTABLE"], "//conditions:default": [ # copybara:strip_for_google3_begin "-std=c99", diff --git a/bazel/upb_proto_library.bzl b/bazel/upb_proto_library.bzl index 6e6ec3a8ed..392404fa2b 100644 --- a/bazel/upb_proto_library.bzl +++ b/bazel/upb_proto_library.bzl @@ -119,14 +119,14 @@ def fasttable_enabled_impl(ctx): raw_setting = ctx.build_setting_value if raw_setting: - # TODO(haberman): check that the target CPU supports fasttable. - pass + # TODO(haberman): check that the target CPU supports fasttable. + pass return _FastTableEnabled(enabled = raw_setting) upb_fasttable_enabled = rule( implementation = fasttable_enabled_impl, - build_setting = config.bool(flag = True) + build_setting = config.bool(flag = True), ) # Dummy rule to expose select() copts to aspects ############################## @@ -285,7 +285,7 @@ _upb_proto_library_aspect = aspect( "//:upb", ]), "_ext": attr.string(default = ".upb"), - "_fasttable_enabled": attr.label(default = "//:fasttable_enabled") + "_fasttable_enabled": attr.label(default = "//:fasttable_enabled"), }), implementation = _upb_proto_library_aspect_impl, provides = [ @@ -344,7 +344,7 @@ _upb_proto_reflection_library_aspect = aspect( ], ), "_ext": attr.string(default = ".upbdefs"), - "_fasttable_enabled": attr.label(default = "//:fasttable_enabled") + "_fasttable_enabled": attr.label(default = "//:fasttable_enabled"), }), implementation = _upb_proto_reflection_library_aspect_impl, provides = [ diff --git a/cmake/build_defs.bzl b/cmake/build_defs.bzl index 83f2f7aa75..34b4537558 100644 --- a/cmake/build_defs.bzl +++ b/cmake/build_defs.bzl @@ -1,4 +1,3 @@ - def generated_file_staleness_test(name, outs, generated_pattern): """Tests that checked-in file(s) match the contents of generated file(s). diff --git a/upb/bindings/lua/lua_proto_library.bzl b/upb/bindings/lua/lua_proto_library.bzl index 29b1caa07a..d6ac301ad8 100644 --- a/upb/bindings/lua/lua_proto_library.bzl +++ b/upb/bindings/lua/lua_proto_library.bzl @@ -1,4 +1,3 @@ - load("@bazel_skylib//lib:paths.bzl", "paths") # Generic support code ######################################################### @@ -12,6 +11,7 @@ def _get_real_short_path(file): if short_path.startswith("../"): second_slash = short_path.index("/", 3) short_path = short_path[second_slash + 1:] + # Sometimes it has another few prefixes like: # _virtual_imports/any_proto/google/protobuf/any.proto # We want just google/protobuf/any.proto. @@ -64,9 +64,10 @@ def _lua_proto_rule_impl(ctx): files = dep[_LuaFiles].files return [ DefaultInfo( - files = files, - data_runfiles = ctx.runfiles(files = files.to_list())), - ] + files = files, + data_runfiles = ctx.runfiles(files = files.to_list()), + ), + ] def _lua_proto_library_aspect_impl(target, ctx): proto_info = target[ProtoInfo] diff --git a/upb/decode.c b/upb/decode.c index d259783677..fb7d3e7c4e 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -535,14 +535,15 @@ static const char *decode_tomsg(upb_decstate *d, const char *ptr, upb_msg *msg, UPB_FORCEINLINE static bool decode_tryfastdispatch(upb_decstate *d, const char **ptr, upb_msg *msg, const upb_msglayout *layout) { +#if UPB_FASTTABLE if (layout && layout->table_mask != (unsigned char)-1) { uint16_t tag = fastdecode_loadtag(*ptr); intptr_t table = decode_totable(layout); *ptr = fastdecode_tagdispatch(d, *ptr, msg, table, 0, tag); return true; - } else { - return false; } +#endif + return false; } UPB_NOINLINE diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 467787008e..ac3c247aea 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -15,6 +15,8 @@ /* Must be last. */ #include "upb/port_def.inc" +#if UPB_FASTTABLE + // The standard set of arguments passed to each parsing function. // Thanks to x86-64 calling conventions, these will stay in registers. #define UPB_PARSE_PARAMS \ @@ -969,3 +971,5 @@ TAGBYTES(r) #undef TAGBYTES #undef SIZES #undef F + +#endif /* UPB_FASTTABLE */ diff --git a/upb/port_def.inc b/upb/port_def.inc index 0d25c90038..f1ed4645e9 100644 --- a/upb/port_def.inc +++ b/upb/port_def.inc @@ -125,6 +125,43 @@ #define UPB_UNREACHABLE() do { assert(0); } while(0) #endif +/* Configure whether fasttable is switched on or not. *************************/ + +#if defined(__x86_64__) && defined(__GNUC__) +#define UPB_FASTTABLE_SUPPORTED 1 +#else +#define UPB_FASTTABLE_SUPPORTED 0 +#endif + +/* define UPB_ENABLE_FASTTABLE to force fast table support. + * This is useful when we want to ensure we are really getting fasttable, + * for example for testing or benchmarking. */ +#if defined(UPB_ENABLE_FASTTABLE) +#if !UPB_FASTTABLE_SUPPORTED +#error fasttable is x86-64 + Clang/GCC only +#endif +#define UPB_FASTTABLE 1 +/* Define UPB_TRY_ENABLE_FASTTABLE to use fasttable if possible. + * This is useful for releasing code that might be used on multiple platforms, + * for example the PHP or Ruby C extensions. */ +#elif defined(UPB_TRY_ENABLE_FASTTABLE) +#define UPB_FASTTABLE UPB_FASTTABLE_SUPPORTED +#else +#define UPB_FASTTABLE 0 +#endif + +/* UPB_FASTTABLE_INIT() allows protos compiled for fasttable to gracefully + * degrade to non-fasttable if we are using UPB_TRY_ENABLE_FASTTABLE. */ +#if !UPB_FASTTABLE && defined(UPB_TRY_ENABLE_FASTTABLE) +#define UPB_FASTTABLE_INIT(...) +#else +#define UPB_FASTTABLE_INIT(...) __VA_ARGS__ +#endif + +#undef UPB_FASTTABLE_SUPPORTED + +/* ASAN poisoning (for arena) *************************************************/ + #if defined(__SANITIZE_ADDRESS__) #define UPB_ASAN 1 #ifdef __cplusplus diff --git a/upbc/generator.cc b/upbc/generator.cc index 642498adfd..f0573bd3d4 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -1037,12 +1037,12 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output, table_mask ); if (!table.empty()) { - output(" {\n"); + output(" UPB_FASTTABLE_INIT({\n"); for (const auto& ent : table) { output(" {0x$1, &$0},\n", ent.first, absl::StrCat(absl::Hex(ent.second, absl::kZeroPad16))); } - output(" },\n"); + output(" }),\n"); } output("};\n\n"); } From 154f2c25f42a94a40e8c5b9952f9d25611fd6fd7 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 29 Oct 2020 09:55:18 -0700 Subject: [PATCH 82/88] Added UTF-8 validation for proto3 string fields. --- benchmarks/compare.py | 2 +- tests/bindings/lua/test_upb.lua | 16 +++++ tests/test_generated_code.c | 23 +++++++ upb/decode.c | 52 ++++++---------- upb/decode.int.h | 23 +++++++ upb/decode_fast.c | 103 ++++++++++++++++++++++++++------ upb/decode_fast.h | 17 ++++-- upbc/generator.cc | 8 ++- 8 files changed, 184 insertions(+), 60 deletions(-) diff --git a/benchmarks/compare.py b/benchmarks/compare.py index 0bfa3db7c3..ad8a1901e8 100755 --- a/benchmarks/compare.py +++ b/benchmarks/compare.py @@ -53,7 +53,7 @@ def Benchmark(outbase, bench_cpu=True, runs=12): baseline = "master" -bench_cpu = False +bench_cpu = True if len(sys.argv) > 1: baseline = sys.argv[1] diff --git a/tests/bindings/lua/test_upb.lua b/tests/bindings/lua/test_upb.lua index b649f6043f..815f907551 100644 --- a/tests/bindings/lua/test_upb.lua +++ b/tests/bindings/lua/test_upb.lua @@ -356,6 +356,22 @@ local numeric_types = { }, } +function test_utf8() + local invalid_utf8 = "\xff" + local proto2_msg = test_messages_proto2.TestAllTypesProto2{ + optional_string = invalid_utf8, + } + + -- As proto2, invalid UTF-8 parses and serializes fine. + local serialized = upb.encode(proto2_msg) + local proto2_msg2 = upb.decode(test_messages_proto2.TestAllTypesProto2, serialized) + + -- Decoding as proto3 fails. + assert_error(function() + upb.decode(test_messages_proto3.TestAllTypesProto3, serialized) + end) +end + function test_msg_primitives() local msg = test_messages_proto3.TestAllTypesProto3{ optional_int32 = 10, diff --git a/tests/test_generated_code.c b/tests/test_generated_code.c index ff7266f9d7..66027245dd 100644 --- a/tests/test_generated_code.c +++ b/tests/test_generated_code.c @@ -68,6 +68,28 @@ static void test_scalars(void) { upb_arena_free(arena); } +static void test_utf8(void) { + const char invalid_utf8[] = "\xff"; + const upb_strview invalid_utf8_view = upb_strview_make(invalid_utf8, 1); + upb_arena *arena = upb_arena_new(); + upb_strview serialized; + protobuf_test_messages_proto3_TestAllTypesProto3 *msg = + protobuf_test_messages_proto3_TestAllTypesProto3_new(arena); + protobuf_test_messages_proto3_TestAllTypesProto3 *msg2; + + protobuf_test_messages_proto3_TestAllTypesProto3_set_optional_string( + msg, invalid_utf8_view); + + serialized.data = protobuf_test_messages_proto3_TestAllTypesProto3_serialize( + msg, arena, &serialized.size); + + msg2 = protobuf_test_messages_proto3_TestAllTypesProto3_parse( + serialized.data, serialized.size, arena); + ASSERT(msg2 == NULL); + + upb_arena_free(arena); +} + static void check_string_map_empty( protobuf_test_messages_proto3_TestAllTypesProto3 *msg) { size_t iter = UPB_MAP_BEGIN; @@ -390,6 +412,7 @@ void test_status_truncation(void) { int run_tests(int argc, char *argv[]) { test_scalars(); + test_utf8(); test_string_map(); test_string_double_map(); test_int32_map(); diff --git a/upb/decode.c b/upb/decode.c index fb7d3e7c4e..6ce55c5c1c 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -147,7 +147,6 @@ typedef union { static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *layout); -#include UPB_NORETURN static void decode_err(upb_decstate *d) { longjmp(d->err, 1); } @@ -156,38 +155,22 @@ const char *fastdecode_err(upb_decstate *d) { return NULL; } -void decode_verifyutf8(upb_decstate *d, const char *buf, int len) { - static const uint8_t utf8_offset[] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, - }; - - int i, j; - uint8_t offset; - - i = 0; - while (i < len) { - offset = utf8_offset[(uint8_t)buf[i]]; - if (offset == 0 || i + offset > len) { - decode_err(d); - } - for (j = i + 1; j < i + offset; j++) { - if ((buf[j] & 0xc0) != 0x80) { - decode_err(d); - } - } - i += offset; - } - if (i != len) decode_err(d); +const uint8_t upb_utf8_offsets[] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static void decode_verifyutf8(upb_decstate *d, const char *buf, int len) { + if (!decode_verifyutf8_inl(buf, len)) decode_err(d); } static bool decode_reserve(upb_decstate *d, upb_array *arr, size_t elem) { @@ -316,6 +299,7 @@ static const char *decode_readstr(upb_decstate *d, const char *ptr, int size, return ptr + size; } +UPB_FORCEINLINE static const char *decode_tosubmsg(upb_decstate *d, const char *ptr, upb_msg *submsg, const upb_msglayout *layout, const upb_msglayout_field *field, int size) { @@ -331,6 +315,7 @@ static const char *decode_tosubmsg(upb_decstate *d, const char *ptr, return ptr; } +UPB_FORCEINLINE static const char *decode_group(upb_decstate *d, const char *ptr, upb_msg *submsg, const upb_msglayout *subl, uint32_t number) { @@ -345,6 +330,7 @@ static const char *decode_group(upb_decstate *d, const char *ptr, return ptr; } +UPB_FORCEINLINE static const char *decode_togroup(upb_decstate *d, const char *ptr, upb_msg *submsg, const upb_msglayout *layout, const upb_msglayout_field *field) { diff --git a/upb/decode.int.h b/upb/decode.int.h index 8cd09bbf46..631be1742b 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -38,6 +38,29 @@ typedef struct upb_decstate { * noreturn. */ const char *fastdecode_err(upb_decstate *d); +extern const uint8_t upb_utf8_offsets[]; + +UPB_INLINE +bool decode_verifyutf8_inl(const char *buf, int len) { + int i, j; + uint8_t offset; + + i = 0; + while (i < len) { + offset = upb_utf8_offsets[(uint8_t)buf[i]]; + if (offset == 0 || i + offset > len) { + return false; + } + for (j = i + 1; j < i + offset; j++) { + if ((buf[j] & 0xc0) != 0x80) { + return false; + } + } + i += offset; + } + return i == len; +} + /* x86-64 pointers always have the high 16 bits matching. So we can shift * left 8 and right 8 without loss of information. */ UPB_INLINE intptr_t decode_totable(const upb_msglayout *tablep) { diff --git a/upb/decode_fast.c b/upb/decode_fast.c index ac3c247aea..526bde8e75 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -650,10 +650,21 @@ typedef const char *fastdecode_copystr_func(struct upb_decstate *d, uint64_t hasbits, upb_strview *dst); UPB_NOINLINE +static const char *fastdecode_verifyutf8(upb_decstate *d, const char *ptr, + upb_msg *msg, intptr_t table, + uint64_t hasbits, upb_strview *dst) { + if (!decode_verifyutf8_inl(dst->data, dst->size)) { + return fastdecode_err(d); + } + return fastdecode_dispatch(d, ptr, msg, table, hasbits); +} + +UPB_FORCEINLINE static const char *fastdecode_longstring(struct upb_decstate *d, const char *ptr, upb_msg *msg, intptr_t table, uint64_t hasbits, - upb_strview *dst) { + upb_strview *dst, + bool validate_utf8) { int size = (uint8_t)ptr[0]; // Could plumb through hasbits. ptr++; if (size & 0x80) { @@ -678,7 +689,28 @@ static const char *fastdecode_longstring(struct upb_decstate *d, dst->size = size; } - return fastdecode_dispatch(d, ptr + size, msg, table, hasbits); + if (validate_utf8) { + return fastdecode_verifyutf8(d, ptr + size, msg, table, hasbits, dst); + } else { + return fastdecode_dispatch(d, ptr + size, msg, table, hasbits); + } +} + +UPB_NOINLINE +static const char *fastdecode_longstring_utf8(struct upb_decstate *d, + const char *ptr, upb_msg *msg, + intptr_t table, uint64_t hasbits, + upb_strview *dst) { + return fastdecode_longstring(d, ptr, msg, table, hasbits, dst, true); +} + +UPB_NOINLINE +static const char *fastdecode_longstring_noutf8(struct upb_decstate *d, + const char *ptr, upb_msg *msg, + intptr_t table, + uint64_t hasbits, + upb_strview *dst) { + return fastdecode_longstring(d, ptr, msg, table, hasbits, dst, false); } UPB_FORCEINLINE @@ -693,7 +725,7 @@ static void fastdecode_docopy(upb_decstate *d, const char *ptr, uint32_t size, UPB_FORCEINLINE static const char *fastdecode_copystring(UPB_PARSE_PARAMS, int tagbytes, - upb_card card) { + upb_card card, bool validate_utf8) { upb_strview *dst; fastdecode_arr farr; int64_t size; @@ -741,6 +773,9 @@ again: ptr += size; if (card == CARD_r) { + if (validate_utf8 && !decode_verifyutf8_inl(dst->data, dst->size)) { + return fastdecode_err(d); + } fastdecode_nextret ret = fastdecode_nextrepeated( d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_strview)); switch (ret.next) { @@ -754,17 +789,25 @@ again: } } + if (card != CARD_r && validate_utf8) { + return fastdecode_verifyutf8(d, ptr, msg, table, hasbits, dst); + } + return fastdecode_dispatch(d, ptr, msg, table, hasbits); longstr: ptr--; - return fastdecode_longstring(d, ptr, msg, table, hasbits, dst); + if (validate_utf8) { + return fastdecode_longstring_utf8(d, ptr, msg, table, hasbits, dst); + } else { + return fastdecode_longstring_noutf8(d, ptr, msg, table, hasbits, dst); + } } UPB_FORCEINLINE static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, - upb_card card, - _upb_field_parser *copyfunc) { + upb_card card, _upb_field_parser *copyfunc, + bool validate_utf8) { upb_strview *dst; fastdecode_arr farr; int64_t size; @@ -792,12 +835,19 @@ again: if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, size, d->end))) { ptr--; - return fastdecode_longstring(d, ptr, msg, table, hasbits, dst); + if (validate_utf8) { + return fastdecode_longstring_utf8(d, ptr, msg, table, hasbits, dst); + } else { + return fastdecode_longstring_noutf8(d, ptr, msg, table, hasbits, dst); + } } ptr += size; if (card == CARD_r) { + if (validate_utf8 && !decode_verifyutf8_inl(dst->data, dst->size)) { + return fastdecode_err(d); + } fastdecode_nextret ret = fastdecode_nextrepeated( d, dst, &ptr, &farr, data, tagbytes, sizeof(upb_strview)); switch (ret.next) { @@ -817,30 +867,45 @@ again: } } + if (card != CARD_r && validate_utf8) { + return fastdecode_verifyutf8(d, ptr, msg, table, hasbits, dst); + } + return fastdecode_dispatch(d, ptr, msg, table, hasbits); } /* Generate all combinations: - * {p,c} x {s,o,r} x {1bt,2bt} */ - -#define F(card, tagbytes) \ - UPB_NOINLINE \ - const char *upb_c##card##s_##tagbytes##bt(UPB_PARSE_PARAMS) { \ - return fastdecode_copystring(UPB_PARSE_ARGS, tagbytes, CARD_##card); \ - } \ - const char *upb_p##card##s_##tagbytes##bt(UPB_PARSE_PARAMS) { \ - return fastdecode_string(UPB_PARSE_ARGS, tagbytes, CARD_##card, \ - &upb_c##card##s_##tagbytes##bt); \ + * {p,c} x {s,o,r} x {s, b} x {1bt,2bt} */ + +#define s_VALIDATE true +#define b_VALIDATE false + +#define F(card, tagbytes, type) \ + UPB_NOINLINE \ + const char *upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ + return fastdecode_copystring(UPB_PARSE_ARGS, tagbytes, CARD_##card, \ + type##_VALIDATE); \ + } \ + const char *upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ + return fastdecode_string(UPB_PARSE_ARGS, tagbytes, CARD_##card, \ + &upb_c##card##type##_##tagbytes##bt, \ + type##_VALIDATE); \ } +#define UTF8(card, tagbytes) \ + F(card, tagbytes, s) \ + F(card, tagbytes, b) + #define TAGBYTES(card) \ - F(card, 1) \ - F(card, 2) + UTF8(card, 1) \ + UTF8(card, 2) TAGBYTES(s) TAGBYTES(o) TAGBYTES(r) +#undef s_VALIDATE +#undef b_VALIDATE #undef F #undef TAGBYTES diff --git a/upb/decode_fast.h b/upb/decode_fast.h index e5cfc13e7f..6d56d12477 100644 --- a/upb/decode_fast.h +++ b/upb/decode_fast.h @@ -25,7 +25,8 @@ // - 'f4' for 4-byte fixed // - 'f8' for 8-byte fixed // - 'm' for sub-message -// - 's' for string/bytes +// - 's' for string (validate UTF-8) +// - 'b' for bytes // // In position 4 (tag length): // - '1' for one-byte tags (field numbers 1-15) @@ -77,13 +78,17 @@ TAGBYTES(p) /* string fields **************************************************************/ -#define F(card, tagbytes) \ - const char *upb_p##card##s_##tagbytes##bt(UPB_PARSE_PARAMS); \ - const char *upb_c##card##s_##tagbytes##bt(UPB_PARSE_PARAMS); +#define F(card, tagbytes, type) \ + const char *upb_p##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); \ + const char *upb_c##card##type##_##tagbytes##bt(UPB_PARSE_PARAMS); + +#define UTF8(card, tagbytes) \ + F(card, tagbytes, s) \ + F(card, tagbytes, b) #define TAGBYTES(card) \ - F(card, 1) \ - F(card, 2) + UTF8(card, 1) \ + UTF8(card, 2) TAGBYTES(s) TAGBYTES(o) diff --git a/upbc/generator.cc b/upbc/generator.cc index f0573bd3d4..e0bfa8c2b5 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -798,8 +798,14 @@ bool TryFillTableEntry(const protobuf::Descriptor* message, type = "z8"; break; case protobuf::FieldDescriptor::TYPE_STRING: + if (field->file()->syntax() == protobuf::FileDescriptor::SYNTAX_PROTO3) { + // Only proto3 validates UTF-8. + type = "s"; + break; + } + /* Fallthrough. */ case protobuf::FieldDescriptor::TYPE_BYTES: - type = "s"; + type = "b"; break; case protobuf::FieldDescriptor::TYPE_MESSAGE: if (field->is_map()) { From 9d87055ce4ccd4500c7bb6ba7c4884a17dcd6211 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 5 Nov 2020 10:23:03 -0800 Subject: [PATCH 83/88] Updated Kokoro build script. --- kokoro/ubuntu/build.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kokoro/ubuntu/build.sh b/kokoro/ubuntu/build.sh index eeb17903f4..1c6324f762 100644 --- a/kokoro/ubuntu/build.sh +++ b/kokoro/ubuntu/build.sh @@ -17,7 +17,6 @@ which bazel bazel version cd $(dirname $0)/../.. -<<<<<<< HEAD if which gcc; then gcc --version @@ -31,13 +30,12 @@ if which clang; then # The checked-in code is with fasttable not enabled. CC=clang bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files fi -======= ->>>>>>> master if which gcc; then gcc --version CC=gcc bazel test --test_output=errors ... CC=gcc bazel test -c opt --test_output=errors ... + CC=gcc bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files # TODO: work through these errors and enable this. # if gcc -fanalyzer -x c /dev/null -c -o /dev/null; then # CC=gcc bazel test --copt=-fanalyzer --test_output=errors ... @@ -47,6 +45,7 @@ fi if which clang; then CC=clang bazel test --test_output=errors ... CC=clang bazel test --test_output=errors -c opt ... + CC=clang bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files if [[ $(uname) = "Linux" ]]; then CC=clang bazel test --test_output=errors --config=m32 ... From 1eb7bd39e7084059814b8fbffe834addc2dea905 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 5 Nov 2020 10:39:38 -0800 Subject: [PATCH 84/88] Some formatting fixes. --- benchmarks/BUILD | 4 ++-- benchmarks/BUILD.googleapis | 20 ++++++++++---------- third_party/wyhash/BUILD | 1 - upb/decode_fast.c | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/benchmarks/BUILD b/benchmarks/BUILD index 4ed4042a6c..3e06fff8a2 100644 --- a/benchmarks/BUILD +++ b/benchmarks/BUILD @@ -46,15 +46,15 @@ cc_binary( testonly = 1, srcs = ["benchmark.cc"], deps = [ + ":ads_upb_proto_reflection", ":benchmark_descriptor_cc_proto", ":benchmark_descriptor_sv_cc_proto", ":benchmark_descriptor_upb_proto", ":benchmark_descriptor_upb_proto_reflection", - ":ads_upb_proto_reflection", "//:descriptor_upb_proto", "//:reflection", - "@com_google_absl//absl/container:flat_hash_set", "@com_github_google_benchmark//:benchmark_main", + "@com_google_absl//absl/container:flat_hash_set", "@com_google_protobuf//:protobuf", ], ) diff --git a/benchmarks/BUILD.googleapis b/benchmarks/BUILD.googleapis index c90815b09a..904bdeca6f 100644 --- a/benchmarks/BUILD.googleapis +++ b/benchmarks/BUILD.googleapis @@ -15,15 +15,15 @@ proto_library( #srcs = ["google/ads/googleads/v5/services/google_ads_service.proto"], visibility = ["//visibility:public"], deps = [ - "@com_google_protobuf//:any_proto", - "@com_google_protobuf//:empty_proto", - "@com_google_protobuf//:descriptor_proto", - "@com_google_protobuf//:field_mask_proto", - "@com_google_protobuf//:duration_proto", - "@com_google_protobuf//:timestamp_proto", - "@com_google_protobuf//:struct_proto", - "@com_google_protobuf//:api_proto", - "@com_google_protobuf//:type_proto", - "@com_google_protobuf//:wrappers_proto", + "@com_google_protobuf//:any_proto", + "@com_google_protobuf//:api_proto", + "@com_google_protobuf//:descriptor_proto", + "@com_google_protobuf//:duration_proto", + "@com_google_protobuf//:empty_proto", + "@com_google_protobuf//:field_mask_proto", + "@com_google_protobuf//:struct_proto", + "@com_google_protobuf//:timestamp_proto", + "@com_google_protobuf//:type_proto", + "@com_google_protobuf//:wrappers_proto", ], ) diff --git a/third_party/wyhash/BUILD b/third_party/wyhash/BUILD index 28fa3be6a5..f3f3a6fb6d 100644 --- a/third_party/wyhash/BUILD +++ b/third_party/wyhash/BUILD @@ -1,4 +1,3 @@ - licenses(["unencumbered"]) exports_files(["LICENSE"]) diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 526bde8e75..5908b50ca4 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -381,7 +381,7 @@ again: case FD_NEXT_SAMEFIELD: dst = ret.dst; goto again; - case FD_NEXT_OTHERFIELD: + case FD_NEXT_OTHERFIELD: return fastdecode_tagdispatch(d, ptr, msg, table, hasbits, ret.tag); case FD_NEXT_ATLIMIT: return ptr; From baab25b7aa8a1a8fe8016a123d75daef3cbbc7d0 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 5 Nov 2020 11:39:26 -0800 Subject: [PATCH 85/88] Removed excess/redundant tests from Kokoro script. --- kokoro/ubuntu/build.sh | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/kokoro/ubuntu/build.sh b/kokoro/ubuntu/build.sh index 1c6324f762..5223910016 100644 --- a/kokoro/ubuntu/build.sh +++ b/kokoro/ubuntu/build.sh @@ -18,23 +18,10 @@ bazel version cd $(dirname $0)/../.. -if which gcc; then - gcc --version - bazel test --test_output=errors ... - # The checked-in code is with fasttable not enabled. - bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files -fi - -if which clang; then - CC=clang bazel test --test_output=errors ... - # The checked-in code is with fasttable not enabled. - CC=clang bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files -fi - if which gcc; then gcc --version CC=gcc bazel test --test_output=errors ... - CC=gcc bazel test -c opt --test_output=errors ... + CC=gcc bazel test -c opt --test_output=errors ... -- -benchmarks:benchmark CC=gcc bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files # TODO: work through these errors and enable this. # if gcc -fanalyzer -x c /dev/null -c -o /dev/null; then @@ -44,12 +31,12 @@ fi if which clang; then CC=clang bazel test --test_output=errors ... - CC=clang bazel test --test_output=errors -c opt ... + CC=clang bazel test --test_output=errors -c opt ... -- -benchmarks:benchmark CC=clang bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files if [[ $(uname) = "Linux" ]]; then - CC=clang bazel test --test_output=errors --config=m32 ... - CC=clang bazel test --test_output=errors --config=asan ... + CC=clang bazel test --test_output=errors --config=m32 ... -- -benchmarks:benchmark + CC=clang bazel test --test_output=errors --config=asan ... -- -benchmarks:benchmark # TODO: update to a newer Lua that hopefully does not trigger UBSAN. CC=clang bazel test --test_output=errors --config=ubsan ... -- -tests/bindings/lua:test_lua From 73fcfe9ed0646d4bd4d2b81b1718907c86793263 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 5 Nov 2020 12:36:18 -0800 Subject: [PATCH 86/88] Tried to slim down the tests a bit more. --- kokoro/ubuntu/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kokoro/ubuntu/build.sh b/kokoro/ubuntu/build.sh index 5223910016..216b71bf8f 100644 --- a/kokoro/ubuntu/build.sh +++ b/kokoro/ubuntu/build.sh @@ -22,7 +22,7 @@ if which gcc; then gcc --version CC=gcc bazel test --test_output=errors ... CC=gcc bazel test -c opt --test_output=errors ... -- -benchmarks:benchmark - CC=gcc bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files + CC=gcc bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files -benchmarks:benchmark # TODO: work through these errors and enable this. # if gcc -fanalyzer -x c /dev/null -c -o /dev/null; then # CC=gcc bazel test --copt=-fanalyzer --test_output=errors ... From a83d55ee4b2b2b40346792573b9d7a44fd4c7a97 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 5 Nov 2020 13:16:37 -0800 Subject: [PATCH 87/88] Exclude Clang tests from MacOS to avoid Kokoro timeouts. The real solution is to have each Kokoro build as part of a separate job that runs in parallel. --- kokoro/ubuntu/build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kokoro/ubuntu/build.sh b/kokoro/ubuntu/build.sh index 216b71bf8f..64c6ce64c0 100644 --- a/kokoro/ubuntu/build.sh +++ b/kokoro/ubuntu/build.sh @@ -30,11 +30,11 @@ if which gcc; then fi if which clang; then - CC=clang bazel test --test_output=errors ... - CC=clang bazel test --test_output=errors -c opt ... -- -benchmarks:benchmark - CC=clang bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files - if [[ $(uname) = "Linux" ]]; then + CC=clang bazel test --test_output=errors ... + CC=clang bazel test --test_output=errors -c opt ... -- -benchmarks:benchmark + CC=clang bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files + CC=clang bazel test --test_output=errors --config=m32 ... -- -benchmarks:benchmark CC=clang bazel test --test_output=errors --config=asan ... -- -benchmarks:benchmark From a01f3e23a4d9222dfe584ebcf80e876035717e8b Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Thu, 5 Nov 2020 13:48:52 -0800 Subject: [PATCH 88/88] Fixes for google3 build, and exclude even more tests from macOS to avoid timeout. --- kokoro/ubuntu/build.sh | 6 ++++-- upb/decode.int.h | 3 +-- upbc/generator.cc | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/kokoro/ubuntu/build.sh b/kokoro/ubuntu/build.sh index 64c6ce64c0..c95ee88d46 100644 --- a/kokoro/ubuntu/build.sh +++ b/kokoro/ubuntu/build.sh @@ -20,9 +20,11 @@ cd $(dirname $0)/../.. if which gcc; then gcc --version - CC=gcc bazel test --test_output=errors ... CC=gcc bazel test -c opt --test_output=errors ... -- -benchmarks:benchmark - CC=gcc bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files -benchmarks:benchmark + if [[ $(uname) = "Linux" ]]; then + CC=gcc bazel test --test_output=errors ... + CC=gcc bazel test --test_output=errors ... --//:fasttable_enabled=true -- -cmake:test_generated_files -benchmarks:benchmark + fi # TODO: work through these errors and enable this. # if gcc -fanalyzer -x c /dev/null -c -o /dev/null; then # CC=gcc bazel test --copt=-fanalyzer --test_output=errors ... diff --git a/upb/decode.int.h b/upb/decode.int.h index 631be1742b..dbec3da8e5 100644 --- a/upb/decode.int.h +++ b/upb/decode.int.h @@ -10,7 +10,6 @@ #include "upb/msg.h" #include "upb/upb.int.h" -#include "upb/decode_fast.h" /* Must be last. */ #include "upb/port_def.inc" @@ -68,7 +67,7 @@ UPB_INLINE intptr_t decode_totable(const upb_msglayout *tablep) { } UPB_INLINE const upb_msglayout *decode_totablep(intptr_t table) { - return (void*)(table >> 8); + return (const upb_msglayout*)(table >> 8); } UPB_INLINE diff --git a/upbc/generator.cc b/upbc/generator.cc index e0bfa8c2b5..f4d1bb9b8d 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -3,6 +3,7 @@ #include +#include "absl/base/attributes.h" #include "absl/container/flat_hash_map.h" #include "absl/strings/ascii.h" #include "absl/strings/str_replace.h" @@ -803,7 +804,7 @@ bool TryFillTableEntry(const protobuf::Descriptor* message, type = "s"; break; } - /* Fallthrough. */ + ABSL_FALLTHROUGH_INTENDED; case protobuf::FieldDescriptor::TYPE_BYTES: type = "b"; break;