|
|
@ -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); |
|
|
|
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 |
|
|
|
UPB_FORCEINLINE |
|
|
|
static bool fastdecode_checktag(uint64_t data, int tagbytes) { |
|
|
|
static bool fastdecode_checktag(uint64_t data, int tagbytes) { |
|
|
|
if (tagbytes == 1) { |
|
|
|
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 **************************************************************/ |
|
|
|
/* varint fields **************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
UPB_FORCEINLINE |
|
|
@ -179,8 +127,33 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, |
|
|
|
if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { |
|
|
|
if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { |
|
|
|
RETURN_GENERIC("varint field tag mismatch\n"); |
|
|
|
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; |
|
|
|
ptr += tagbytes + 1; |
|
|
|
val = (uint8_t)ptr[-1]; |
|
|
|
val = (uint8_t)ptr[-1]; |
|
|
|
if (UPB_UNLIKELY(val & 0x80)) { |
|
|
|
if (UPB_UNLIKELY(val & 0x80)) { |
|
|
@ -193,12 +166,32 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, |
|
|
|
} |
|
|
|
} |
|
|
|
ptr++; |
|
|
|
ptr++; |
|
|
|
uint64_t byte = (uint8_t)ptr[-1]; |
|
|
|
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; |
|
|
|
val += (byte - 1) << 63; |
|
|
|
} |
|
|
|
} |
|
|
|
done: |
|
|
|
done: |
|
|
|
val = fastdecode_munge(val, valbytes, zigzag); |
|
|
|
val = fastdecode_munge(val, valbytes, zigzag); |
|
|
|
memcpy(dst, &val, valbytes); |
|
|
|
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); |
|
|
|
return fastdecode_dispatch(d, ptr, msg, table, hasbits); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -228,14 +221,94 @@ done: |
|
|
|
|
|
|
|
|
|
|
|
TAGBYTES(s) |
|
|
|
TAGBYTES(s) |
|
|
|
TAGBYTES(o) |
|
|
|
TAGBYTES(o) |
|
|
|
/* TAGBYTES(r) */ |
|
|
|
TAGBYTES(r) |
|
|
|
|
|
|
|
|
|
|
|
#undef z_ZZ |
|
|
|
#undef z_ZZ |
|
|
|
#undef b_ZZ |
|
|
|
#undef b_ZZ |
|
|
|
#undef v_ZZ |
|
|
|
#undef v_ZZ |
|
|
|
#undef o_ONEOF |
|
|
|
#undef F |
|
|
|
#undef s_ONEOF |
|
|
|
#undef TYPES |
|
|
|
#undef r_ONEOF |
|
|
|
#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 F |
|
|
|
#undef TYPES |
|
|
|
#undef TYPES |
|
|
|
#undef TAGBYTES |
|
|
|
#undef TAGBYTES |
|
|
@ -261,35 +334,92 @@ static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, |
|
|
|
RETURN_GENERIC("string field tag mismatch\n"); |
|
|
|
RETURN_GENERIC("string field tag mismatch\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, |
|
|
|
upb_array* arr; |
|
|
|
sizeof(upb_strview), card); |
|
|
|
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]; |
|
|
|
len = (int8_t)ptr[tagbytes]; |
|
|
|
str = ptr + tagbytes + 1; |
|
|
|
str = ptr + tagbytes + 1; |
|
|
|
dst->data = str; |
|
|
|
dst->data = str; |
|
|
|
dst->size = len; |
|
|
|
dst->size = len; |
|
|
|
|
|
|
|
ptr = str + len; |
|
|
|
if (UPB_UNLIKELY(fastdecode_boundscheck(str, len, d->limit))) { |
|
|
|
if (UPB_UNLIKELY(fastdecode_boundscheck(str, len, d->limit))) { |
|
|
|
dst->size = 0; |
|
|
|
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) { |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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) { |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) { |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 *************************************************************/ |
|
|
|
/* message fields *************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
UPB_NOINLINE |
|
|
|
UPB_NOINLINE |
|
|
@ -350,6 +480,12 @@ static const char *fastdecode_submsg(UPB_PARSE_PARAMS, int tagbytes, |
|
|
|
hasbits = 0; |
|
|
|
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_limit = d->limit; |
|
|
|
const char *saved_fastlimit = d->fastlimit; |
|
|
|
const char *saved_fastlimit = d->fastlimit; |
|
|
|
|
|
|
|
|
|
|
@ -368,7 +504,7 @@ again: |
|
|
|
end = (void*)(new_ptr + (new_size * sizeof(upb_msg*))); |
|
|
|
end = (void*)(new_ptr + (new_size * sizeof(upb_msg*))); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
upb_msg* child = *submsg; |
|
|
|
upb_msg* child = *submsg; |
|
|
|
|
|
|
|
|
|
|
|
if (card == CARD_r || UPB_LIKELY(!child)) { |
|
|
|
if (card == CARD_r || UPB_LIKELY(!child)) { |
|
|
@ -413,7 +549,6 @@ again: |
|
|
|
d->depth++; |
|
|
|
d->depth++; |
|
|
|
|
|
|
|
|
|
|
|
return fastdecode_dispatch(d, ptr, msg, table, hasbits); |
|
|
|
return fastdecode_dispatch(d, ptr, msg, table, hasbits); |
|
|
|
|
|
|
|
|
|
|
|
repeated_generic: |
|
|
|
repeated_generic: |
|
|
|
arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); |
|
|
|
arr->len = submsg - (upb_msg**)_upb_array_ptr(arr); |
|
|
|
d->limit = saved_limit; |
|
|
|
d->limit = saved_limit; |
|
|
|