Changed to use table pairs, seems to ever-so-slightly regress.

pull/13171/head
Joshua Haberman 4 years ago
parent 91eb09b1bc
commit 75edd3e59c
  1. 2646
      generated_for_cmake/google/protobuf/descriptor.upb.c
  2. 6
      upb/decode_fast.c
  3. 2
      upb/def.c
  4. 8
      upb/msg.h
  5. 7
      upbc/generator.cc

File diff suppressed because it is too large Load Diff

@ -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)) {

@ -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)) {

@ -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

@ -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);

Loading…
Cancel
Save