|
|
|
@ -658,12 +658,14 @@ static const char* fastdecode_longstring_noutf8( |
|
|
|
|
|
|
|
|
|
UPB_FORCEINLINE |
|
|
|
|
static void fastdecode_docopy(upb_Decoder* d, const char* ptr, uint32_t size, |
|
|
|
|
int copy, char* data, upb_StringView* dst) { |
|
|
|
|
int copy, char* data, size_t data_offset, |
|
|
|
|
upb_StringView* dst) { |
|
|
|
|
d->arena.head.ptr += copy; |
|
|
|
|
dst->data = data; |
|
|
|
|
dst->data = data + data_offset; |
|
|
|
|
UPB_UNPOISON_MEMORY_REGION(data, copy); |
|
|
|
|
memcpy(data, ptr, copy); |
|
|
|
|
UPB_POISON_MEMORY_REGION(data + size, copy - size); |
|
|
|
|
UPB_POISON_MEMORY_REGION(data + data_offset + size, |
|
|
|
|
copy - data_offset - size); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#define FASTDECODE_COPYSTRING(d, ptr, msg, table, hasbits, data, tagbytes, \ |
|
|
|
@ -697,18 +699,17 @@ static void fastdecode_docopy(upb_Decoder* d, const char* ptr, uint32_t size, |
|
|
|
|
\
|
|
|
|
|
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; \
|
|
|
|
|
fastdecode_docopy(d, ptr - tagbytes - 1, size, 16, buf, tagbytes + 1, \
|
|
|
|
|
dst); \
|
|
|
|
|
} else if (UPB_LIKELY(size <= 32)) { \
|
|
|
|
|
if (UPB_UNLIKELY(common_has < 32)) goto longstr; \
|
|
|
|
|
fastdecode_docopy(d, ptr, size, 32, buf, dst); \
|
|
|
|
|
fastdecode_docopy(d, ptr, size, 32, buf, 0, dst); \
|
|
|
|
|
} else if (UPB_LIKELY(size <= 64)) { \
|
|
|
|
|
if (UPB_UNLIKELY(common_has < 64)) goto longstr; \
|
|
|
|
|
fastdecode_docopy(d, ptr, size, 64, buf, dst); \
|
|
|
|
|
fastdecode_docopy(d, ptr, size, 64, buf, 0, dst); \
|
|
|
|
|
} else if (UPB_LIKELY(size < 128)) { \
|
|
|
|
|
if (UPB_UNLIKELY(common_has < 128)) goto longstr; \
|
|
|
|
|
fastdecode_docopy(d, ptr, size, 128, buf, dst); \
|
|
|
|
|
fastdecode_docopy(d, ptr, size, 128, buf, 0, dst); \
|
|
|
|
|
} else { \
|
|
|
|
|
goto longstr; \
|
|
|
|
|
} \
|
|
|
|
@ -917,6 +918,7 @@ static const char* fastdecode_tosubmsg(upb_EpsCopyInputStream* e, |
|
|
|
|
fastdecode_arr farr; \
|
|
|
|
|
\
|
|
|
|
|
if (subtablep->table_mask == (uint8_t)-1) { \
|
|
|
|
|
d->depth++; \
|
|
|
|
|
RETURN_GENERIC("submessage doesn't have fast tables."); \
|
|
|
|
|
} \
|
|
|
|
|
\
|
|
|
|
|