Everything passes except 4 conformance tests.

pull/13171/head
Joshua Haberman 4 years ago
parent 6e10b5789d
commit a4b35aa388
  1. 969
      upb/decode_fast.c
  2. 7
      upb/decode_internal.h
  3. 6
      upb/port_def.inc
  4. 1
      upb/port_undef.inc

File diff suppressed because it is too large Load Diff

@ -142,10 +142,11 @@ bool decode_isdone(upb_decstate *d, const char **ptr) {
} }
} }
#include <stdio.h>
UPB_INLINE UPB_INLINE
const char *fastdecode_tagdispatch(upb_decstate *d, const char *ptr, const char *fastdecode_tagdispatch(upb_decstate *d, const char *ptr,
upb_msg *msg, intptr_t table, upb_msg *msg, intptr_t table,
uint64_t hasbits, uint32_t tag) { uint64_t hasbits, uint64_t tag) {
const upb_msglayout *table_p = decode_totablep(table); const upb_msglayout *table_p = decode_totablep(table);
uint8_t mask = table; uint8_t mask = table;
uint64_t data; uint64_t data;
@ -153,7 +154,9 @@ const char *fastdecode_tagdispatch(upb_decstate *d, const char *ptr,
UPB_ASSUME((idx & 7) == 0); UPB_ASSUME((idx & 7) == 0);
idx >>= 3; idx >>= 3;
data = table_p->fasttable[idx].field_data ^ tag; data = table_p->fasttable[idx].field_data ^ tag;
return table_p->fasttable[idx].field_parser(d, ptr, msg, table, hasbits, data); //fprintf(stderr, "Dispatch at: %p\n", ptr);
UPB_MUSTTAIL return table_p->fasttable[idx].field_parser(d, ptr, msg, table,
hasbits, data);
} }
UPB_INLINE uint32_t fastdecode_loadtag(const char* ptr) { UPB_INLINE uint32_t fastdecode_loadtag(const char* ptr) {

@ -167,8 +167,10 @@
/* Configure whether fasttable is switched on or not. *************************/ /* Configure whether fasttable is switched on or not. *************************/
#if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__) #if (defined(__x86_64__) || defined(__aarch64__)) && defined(__clang__) && \
__has_attribute(musttail)
#define UPB_FASTTABLE_SUPPORTED 1 #define UPB_FASTTABLE_SUPPORTED 1
#define UPB_MUSTTAIL __attribute__((musttail))
#else #else
#define UPB_FASTTABLE_SUPPORTED 0 #define UPB_FASTTABLE_SUPPORTED 0
#endif #endif
@ -178,7 +180,7 @@
* for example for testing or benchmarking. */ * for example for testing or benchmarking. */
#if defined(UPB_ENABLE_FASTTABLE) #if defined(UPB_ENABLE_FASTTABLE)
#if !UPB_FASTTABLE_SUPPORTED #if !UPB_FASTTABLE_SUPPORTED
#error fasttable is x86-64 + Clang/GCC only #error fasttable is x86-64/ARM64 only and requires a recent Clang that supports __attribute__((musttail))
#endif #endif
#define UPB_FASTTABLE 1 #define UPB_FASTTABLE 1
/* Define UPB_TRY_ENABLE_FASTTABLE to use fasttable if possible. /* Define UPB_TRY_ENABLE_FASTTABLE to use fasttable if possible.

@ -52,6 +52,7 @@
#undef UPB_SETJMP #undef UPB_SETJMP
#undef UPB_LONGJMP #undef UPB_LONGJMP
#undef UPB_PTRADD #undef UPB_PTRADD
#undef UPB_MUSTTAIL
#undef UPB_FASTTABLE_SUPPORTED #undef UPB_FASTTABLE_SUPPORTED
#undef UPB_FASTTABLE #undef UPB_FASTTABLE
#undef UPB_FASTTABLE_INIT #undef UPB_FASTTABLE_INIT

Loading…
Cancel
Save