Faster comparison

reviewable/pr8842/r1
Craig Tiller 8 years ago
parent 3b05e1da91
commit dcbe70c137
  1. 11
      src/core/lib/transport/metadata.c
  2. 924
      src/core/lib/transport/static_metadata.c
  3. 37
      tools/codegen/core/gen_static_metadata.py

@ -260,10 +260,13 @@ grpc_mdelem grpc_mdelem_create(
return GRPC_MAKE_MDELEM(allocated, GRPC_MDELEM_STORAGE_ALLOCATED);
}
grpc_mdelem static_elem = grpc_static_mdelem_for_static_strings(
grpc_static_metadata_index(key), grpc_static_metadata_index(value));
if (!GRPC_MDISNULL(static_elem)) {
return static_elem;
if (grpc_is_static_metadata_string(key) &&
grpc_is_static_metadata_string(value)) {
grpc_mdelem static_elem = grpc_static_mdelem_for_static_strings(
grpc_static_metadata_index(key), grpc_static_metadata_index(value));
if (!GRPC_MDISNULL(static_elem)) {
return static_elem;
}
}
uint32_t hash =

@ -43,7 +43,7 @@
#include "src/core/lib/slice/slice_internal.h"
static uint8_t g_raw_bytes[] = {
static uint8_t g_bytes[] = {
48, 49, 50, 50, 48, 48, 50, 48, 52, 50, 48, 54, 51, 48, 52,
52, 48, 48, 52, 48, 52, 53, 48, 48, 97, 99, 99, 101, 112, 116,
97, 99, 99, 101, 112, 116, 45, 99, 104, 97, 114, 115, 101, 116, 97,
@ -118,292 +118,174 @@ static void static_ref(void *unused) {}
static void static_unref(grpc_exec_ctx *exec_ctx, void *unused) {}
static const grpc_slice_refcount_vtable static_vtable = {
static_ref, static_unref, grpc_static_slice_eq, grpc_static_slice_hash};
static grpc_slice_refcount g_refcnt = {&static_vtable};
typedef struct {
grpc_slice_refcount base;
const uint16_t offset;
const uint16_t length;
} static_slice_refcount;
static static_slice_refcount g_refcnts[GRPC_STATIC_MDSTR_COUNT] = {
{{&static_vtable}, 0, 1}, {{&static_vtable}, 1, 1},
{{&static_vtable}, 2, 1}, {{&static_vtable}, 3, 3},
{{&static_vtable}, 6, 3}, {{&static_vtable}, 9, 3},
{{&static_vtable}, 12, 3}, {{&static_vtable}, 15, 3},
{{&static_vtable}, 18, 3}, {{&static_vtable}, 21, 3},
{{&static_vtable}, 24, 6}, {{&static_vtable}, 30, 14},
{{&static_vtable}, 44, 15}, {{&static_vtable}, 59, 15},
{{&static_vtable}, 74, 13}, {{&static_vtable}, 87, 27},
{{&static_vtable}, 114, 3}, {{&static_vtable}, 117, 5},
{{&static_vtable}, 122, 16}, {{&static_vtable}, 138, 10},
{{&static_vtable}, 148, 13}, {{&static_vtable}, 161, 13},
{{&static_vtable}, 174, 19}, {{&static_vtable}, 193, 16},
{{&static_vtable}, 209, 16}, {{&static_vtable}, 225, 14},
{{&static_vtable}, 239, 16}, {{&static_vtable}, 255, 13},
{{&static_vtable}, 268, 12}, {{&static_vtable}, 280, 6},
{{&static_vtable}, 286, 4}, {{&static_vtable}, 290, 7},
{{&static_vtable}, 297, 12}, {{&static_vtable}, 309, 0},
{{&static_vtable}, 309, 4}, {{&static_vtable}, 313, 6},
{{&static_vtable}, 319, 7}, {{&static_vtable}, 326, 4},
{{&static_vtable}, 330, 3}, {{&static_vtable}, 333, 4},
{{&static_vtable}, 337, 20}, {{&static_vtable}, 357, 30},
{{&static_vtable}, 387, 31}, {{&static_vtable}, 418, 12},
{{&static_vtable}, 430, 19}, {{&static_vtable}, 449, 13},
{{&static_vtable}, 462, 30}, {{&static_vtable}, 492, 12},
{{&static_vtable}, 504, 16}, {{&static_vtable}, 520, 14},
{{&static_vtable}, 534, 11}, {{&static_vtable}, 545, 12},
{{&static_vtable}, 557, 16}, {{&static_vtable}, 573, 4},
{{&static_vtable}, 577, 13}, {{&static_vtable}, 590, 4},
{{&static_vtable}, 594, 4}, {{&static_vtable}, 598, 5},
{{&static_vtable}, 603, 8}, {{&static_vtable}, 611, 16},
{{&static_vtable}, 627, 21}, {{&static_vtable}, 648, 13},
{{&static_vtable}, 661, 8}, {{&static_vtable}, 669, 17},
{{&static_vtable}, 686, 13}, {{&static_vtable}, 699, 8},
{{&static_vtable}, 707, 19}, {{&static_vtable}, 726, 13},
{{&static_vtable}, 739, 11}, {{&static_vtable}, 750, 8},
{{&static_vtable}, 758, 4}, {{&static_vtable}, 762, 8},
{{&static_vtable}, 770, 12}, {{&static_vtable}, 782, 7},
{{&static_vtable}, 789, 5}, {{&static_vtable}, 794, 4},
{{&static_vtable}, 798, 18}, {{&static_vtable}, 816, 19},
{{&static_vtable}, 835, 3}, {{&static_vtable}, 838, 5},
{{&static_vtable}, 843, 7}, {{&static_vtable}, 850, 7},
{{&static_vtable}, 857, 11}, {{&static_vtable}, 868, 7},
{{&static_vtable}, 875, 6}, {{&static_vtable}, 881, 10},
{{&static_vtable}, 891, 1}, {{&static_vtable}, 892, 36},
{{&static_vtable}, 928, 11}, {{&static_vtable}, 939, 7},
{{&static_vtable}, 946, 25}, {{&static_vtable}, 971, 2},
{{&static_vtable}, 973, 8}, {{&static_vtable}, 981, 17},
{{&static_vtable}, 998, 10}, {{&static_vtable}, 1008, 4},
{{&static_vtable}, 1012, 3}, {{&static_vtable}, 1015, 16},
};
bool grpc_is_static_metadata_string(grpc_slice slice) {
return slice.refcount != NULL && slice.refcount->vtable == &static_vtable;
}
const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = {
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 0, .length = 1}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 1, .length = 1}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 2, .length = 1}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 3, .length = 3}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 6, .length = 3}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 9, .length = 3}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 12, .length = 3}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 15, .length = 3}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 18, .length = 3}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 21, .length = 3}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 24, .length = 6}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 30, .length = 14}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 44, .length = 15}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 59, .length = 15}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 74, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 87, .length = 27}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 114, .length = 3}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 117, .length = 5}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 122, .length = 16}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 138, .length = 10}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 148, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 161, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 174, .length = 19}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 193, .length = 16}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 209, .length = 16}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 225, .length = 14}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 239, .length = 16}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 255, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 268, .length = 12}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 280, .length = 6}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 286, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 290, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 297, .length = 12}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 313, .length = 6}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 319, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 326, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 330, .length = 3}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 333, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 357, .length = 30}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 387, .length = 31}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 418, .length = 12}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 430, .length = 19}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 449, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 462, .length = 30}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 492, .length = 12}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 504, .length = 16}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 520, .length = 14}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 534, .length = 11}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 545, .length = 12}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 557, .length = 16}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 573, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 577, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 590, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 594, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 598, .length = 5}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 603, .length = 8}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 611, .length = 16}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 627, .length = 21}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 648, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 661, .length = 8}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 669, .length = 17}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 686, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 699, .length = 8}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 707, .length = 19}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 726, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 739, .length = 11}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 750, .length = 8}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 758, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 762, .length = 8}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 770, .length = 12}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 782, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 789, .length = 5}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 794, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 798, .length = 18}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 816, .length = 19}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 835, .length = 3}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 838, .length = 5}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 843, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 850, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 857, .length = 11}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 868, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 875, .length = 6}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 881, .length = 10}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 891, .length = 1}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 892, .length = 36}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 928, .length = 11}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 946, .length = 25}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 971, .length = 2}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 973, .length = 8}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 981, .length = 17}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 998, .length = 10}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 1008, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 1012, .length = 3}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 1015, .length = 16}},
{.refcount = &g_refcnts[0].base, .data.refcounted = {g_bytes + 0, 1}},
{.refcount = &g_refcnts[1].base, .data.refcounted = {g_bytes + 1, 1}},
{.refcount = &g_refcnts[2].base, .data.refcounted = {g_bytes + 2, 1}},
{.refcount = &g_refcnts[3].base, .data.refcounted = {g_bytes + 3, 3}},
{.refcount = &g_refcnts[4].base, .data.refcounted = {g_bytes + 6, 3}},
{.refcount = &g_refcnts[5].base, .data.refcounted = {g_bytes + 9, 3}},
{.refcount = &g_refcnts[6].base, .data.refcounted = {g_bytes + 12, 3}},
{.refcount = &g_refcnts[7].base, .data.refcounted = {g_bytes + 15, 3}},
{.refcount = &g_refcnts[8].base, .data.refcounted = {g_bytes + 18, 3}},
{.refcount = &g_refcnts[9].base, .data.refcounted = {g_bytes + 21, 3}},
{.refcount = &g_refcnts[10].base, .data.refcounted = {g_bytes + 24, 6}},
{.refcount = &g_refcnts[11].base, .data.refcounted = {g_bytes + 30, 14}},
{.refcount = &g_refcnts[12].base, .data.refcounted = {g_bytes + 44, 15}},
{.refcount = &g_refcnts[13].base, .data.refcounted = {g_bytes + 59, 15}},
{.refcount = &g_refcnts[14].base, .data.refcounted = {g_bytes + 74, 13}},
{.refcount = &g_refcnts[15].base, .data.refcounted = {g_bytes + 87, 27}},
{.refcount = &g_refcnts[16].base, .data.refcounted = {g_bytes + 114, 3}},
{.refcount = &g_refcnts[17].base, .data.refcounted = {g_bytes + 117, 5}},
{.refcount = &g_refcnts[18].base, .data.refcounted = {g_bytes + 122, 16}},
{.refcount = &g_refcnts[19].base, .data.refcounted = {g_bytes + 138, 10}},
{.refcount = &g_refcnts[20].base, .data.refcounted = {g_bytes + 148, 13}},
{.refcount = &g_refcnts[21].base, .data.refcounted = {g_bytes + 161, 13}},
{.refcount = &g_refcnts[22].base, .data.refcounted = {g_bytes + 174, 19}},
{.refcount = &g_refcnts[23].base, .data.refcounted = {g_bytes + 193, 16}},
{.refcount = &g_refcnts[24].base, .data.refcounted = {g_bytes + 209, 16}},
{.refcount = &g_refcnts[25].base, .data.refcounted = {g_bytes + 225, 14}},
{.refcount = &g_refcnts[26].base, .data.refcounted = {g_bytes + 239, 16}},
{.refcount = &g_refcnts[27].base, .data.refcounted = {g_bytes + 255, 13}},
{.refcount = &g_refcnts[28].base, .data.refcounted = {g_bytes + 268, 12}},
{.refcount = &g_refcnts[29].base, .data.refcounted = {g_bytes + 280, 6}},
{.refcount = &g_refcnts[30].base, .data.refcounted = {g_bytes + 286, 4}},
{.refcount = &g_refcnts[31].base, .data.refcounted = {g_bytes + 290, 7}},
{.refcount = &g_refcnts[32].base, .data.refcounted = {g_bytes + 297, 12}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}},
{.refcount = &g_refcnts[34].base, .data.refcounted = {g_bytes + 309, 4}},
{.refcount = &g_refcnts[35].base, .data.refcounted = {g_bytes + 313, 6}},
{.refcount = &g_refcnts[36].base, .data.refcounted = {g_bytes + 319, 7}},
{.refcount = &g_refcnts[37].base, .data.refcounted = {g_bytes + 326, 4}},
{.refcount = &g_refcnts[38].base, .data.refcounted = {g_bytes + 330, 3}},
{.refcount = &g_refcnts[39].base, .data.refcounted = {g_bytes + 333, 4}},
{.refcount = &g_refcnts[40].base, .data.refcounted = {g_bytes + 337, 20}},
{.refcount = &g_refcnts[41].base, .data.refcounted = {g_bytes + 357, 30}},
{.refcount = &g_refcnts[42].base, .data.refcounted = {g_bytes + 387, 31}},
{.refcount = &g_refcnts[43].base, .data.refcounted = {g_bytes + 418, 12}},
{.refcount = &g_refcnts[44].base, .data.refcounted = {g_bytes + 430, 19}},
{.refcount = &g_refcnts[45].base, .data.refcounted = {g_bytes + 449, 13}},
{.refcount = &g_refcnts[46].base, .data.refcounted = {g_bytes + 462, 30}},
{.refcount = &g_refcnts[47].base, .data.refcounted = {g_bytes + 492, 12}},
{.refcount = &g_refcnts[48].base, .data.refcounted = {g_bytes + 504, 16}},
{.refcount = &g_refcnts[49].base, .data.refcounted = {g_bytes + 520, 14}},
{.refcount = &g_refcnts[50].base, .data.refcounted = {g_bytes + 534, 11}},
{.refcount = &g_refcnts[51].base, .data.refcounted = {g_bytes + 545, 12}},
{.refcount = &g_refcnts[52].base, .data.refcounted = {g_bytes + 557, 16}},
{.refcount = &g_refcnts[53].base, .data.refcounted = {g_bytes + 573, 4}},
{.refcount = &g_refcnts[54].base, .data.refcounted = {g_bytes + 577, 13}},
{.refcount = &g_refcnts[55].base, .data.refcounted = {g_bytes + 590, 4}},
{.refcount = &g_refcnts[56].base, .data.refcounted = {g_bytes + 594, 4}},
{.refcount = &g_refcnts[57].base, .data.refcounted = {g_bytes + 598, 5}},
{.refcount = &g_refcnts[58].base, .data.refcounted = {g_bytes + 603, 8}},
{.refcount = &g_refcnts[59].base, .data.refcounted = {g_bytes + 611, 16}},
{.refcount = &g_refcnts[60].base, .data.refcounted = {g_bytes + 627, 21}},
{.refcount = &g_refcnts[61].base, .data.refcounted = {g_bytes + 648, 13}},
{.refcount = &g_refcnts[62].base, .data.refcounted = {g_bytes + 661, 8}},
{.refcount = &g_refcnts[63].base, .data.refcounted = {g_bytes + 669, 17}},
{.refcount = &g_refcnts[64].base, .data.refcounted = {g_bytes + 686, 13}},
{.refcount = &g_refcnts[65].base, .data.refcounted = {g_bytes + 699, 8}},
{.refcount = &g_refcnts[66].base, .data.refcounted = {g_bytes + 707, 19}},
{.refcount = &g_refcnts[67].base, .data.refcounted = {g_bytes + 726, 13}},
{.refcount = &g_refcnts[68].base, .data.refcounted = {g_bytes + 739, 11}},
{.refcount = &g_refcnts[69].base, .data.refcounted = {g_bytes + 750, 8}},
{.refcount = &g_refcnts[70].base, .data.refcounted = {g_bytes + 758, 4}},
{.refcount = &g_refcnts[71].base, .data.refcounted = {g_bytes + 762, 8}},
{.refcount = &g_refcnts[72].base, .data.refcounted = {g_bytes + 770, 12}},
{.refcount = &g_refcnts[73].base, .data.refcounted = {g_bytes + 782, 7}},
{.refcount = &g_refcnts[74].base, .data.refcounted = {g_bytes + 789, 5}},
{.refcount = &g_refcnts[75].base, .data.refcounted = {g_bytes + 794, 4}},
{.refcount = &g_refcnts[76].base, .data.refcounted = {g_bytes + 798, 18}},
{.refcount = &g_refcnts[77].base, .data.refcounted = {g_bytes + 816, 19}},
{.refcount = &g_refcnts[78].base, .data.refcounted = {g_bytes + 835, 3}},
{.refcount = &g_refcnts[79].base, .data.refcounted = {g_bytes + 838, 5}},
{.refcount = &g_refcnts[80].base, .data.refcounted = {g_bytes + 843, 7}},
{.refcount = &g_refcnts[81].base, .data.refcounted = {g_bytes + 850, 7}},
{.refcount = &g_refcnts[82].base, .data.refcounted = {g_bytes + 857, 11}},
{.refcount = &g_refcnts[83].base, .data.refcounted = {g_bytes + 868, 7}},
{.refcount = &g_refcnts[84].base, .data.refcounted = {g_bytes + 875, 6}},
{.refcount = &g_refcnts[85].base, .data.refcounted = {g_bytes + 881, 10}},
{.refcount = &g_refcnts[86].base, .data.refcounted = {g_bytes + 891, 1}},
{.refcount = &g_refcnts[87].base, .data.refcounted = {g_bytes + 892, 36}},
{.refcount = &g_refcnts[88].base, .data.refcounted = {g_bytes + 928, 11}},
{.refcount = &g_refcnts[89].base, .data.refcounted = {g_bytes + 939, 7}},
{.refcount = &g_refcnts[90].base, .data.refcounted = {g_bytes + 946, 25}},
{.refcount = &g_refcnts[91].base, .data.refcounted = {g_bytes + 971, 2}},
{.refcount = &g_refcnts[92].base, .data.refcounted = {g_bytes + 973, 8}},
{.refcount = &g_refcnts[93].base, .data.refcounted = {g_bytes + 981, 17}},
{.refcount = &g_refcnts[94].base, .data.refcounted = {g_bytes + 998, 10}},
{.refcount = &g_refcnts[95].base, .data.refcounted = {g_bytes + 1008, 4}},
{.refcount = &g_refcnts[96].base, .data.refcounted = {g_bytes + 1012, 3}},
{.refcount = &g_refcnts[97].base, .data.refcounted = {g_bytes + 1015, 16}},
};
static const uint8_t g_revmap[] = {
0, 1, 2, 3, 255, 255, 4, 255, 255, 5, 255, 255, 6, 255, 255,
7, 255, 255, 8, 255, 255, 9, 255, 255, 10, 255, 255, 255, 255, 255,
11, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 12,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 13,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 14,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 16, 255, 255, 17, 255, 255,
255, 255, 18, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 19, 255, 255, 255, 255, 255, 255, 255, 255, 255, 20, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 21, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 22, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 23, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 24,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
25, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 26,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
27, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 28, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 29, 255, 255, 255, 255,
255, 30, 255, 255, 255, 31, 255, 255, 255, 255, 255, 255, 32, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 34, 255, 255, 255, 35, 255,
255, 255, 255, 255, 36, 255, 255, 255, 255, 255, 255, 37, 255, 255, 255,
38, 255, 255, 39, 255, 255, 255, 40, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 41, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 42, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 43, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 44, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 45,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 46, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 47, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 48, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 49, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 50, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 51, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 52, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 53, 255, 255, 255, 54, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 55, 255, 255, 255, 56, 255, 255, 255, 57, 255,
255, 255, 255, 58, 255, 255, 255, 255, 255, 255, 255, 59, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 60, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 61, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 62, 255, 255, 255, 255, 255, 255, 255, 63, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 64, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 65, 255, 255, 255, 255, 255,
255, 255, 66, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 67, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 68, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
69, 255, 255, 255, 255, 255, 255, 255, 70, 255, 255, 255, 71, 255, 255,
255, 255, 255, 255, 255, 72, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 73, 255, 255, 255, 255, 255, 255, 74, 255, 255, 255, 255, 75,
255, 255, 255, 76, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 77, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 78, 255, 255, 79, 255,
255, 255, 255, 80, 255, 255, 255, 255, 255, 255, 81, 255, 255, 255, 255,
255, 255, 82, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 83, 255,
255, 255, 255, 255, 255, 84, 255, 255, 255, 255, 255, 85, 255, 255, 255,
255, 255, 255, 255, 255, 255, 86, 87, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 88, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 89, 255, 255, 255, 255, 255,
255, 90, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 91, 255, 92, 255,
255, 255, 255, 255, 255, 255, 93, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 94, 255, 255, 255, 255, 255, 255,
255, 255, 255, 95, 255, 255, 255, 96, 255, 255, 97, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255};
int grpc_static_metadata_index(grpc_slice slice) {
if (GRPC_SLICE_LENGTH(slice) == 0) return 33;
if (slice.refcount != &g_refcnt) return -1;
size_t ofs = (size_t)(slice.data.refcounted.bytes - g_raw_bytes);
if (ofs > sizeof(g_revmap)) return -1;
uint8_t id = g_revmap[ofs];
return id == 255 ? -1 : (grpc_static_slice_table[id].data.refcounted.length ==
slice.data.refcounted.length
? id
: -1);
static_slice_refcount *r = (static_slice_refcount *)slice.refcount;
if (slice.data.refcounted.bytes == g_bytes + r->offset &&
slice.data.refcounted.length == r->length)
return (int)(r - g_refcnts);
return -1;
}
uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {
@ -465,330 +347,168 @@ grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) {
}
grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = {
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 30, .length = 14}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 24, .length = 6}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 44, .length = 15}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 44, .length = 15}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 577, .length = 13}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 59, .length = 15}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 74, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 87, .length = 27}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 114, .length = 3}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 117, .length = 5}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 138, .length = 10}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 148, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 161, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 174, .length = 19}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 193, .length = 16}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 209, .length = 16}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 225, .length = 14}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 239, .length = 16}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 255, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 268, .length = 12}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 122, .length = 16}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 268, .length = 12}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 280, .length = 6}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 286, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 313, .length = 6}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 319, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 326, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 290, .length = 7}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 297, .length = 12}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 573, .length = 4}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 603, .length = 8}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 611, .length = 16}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 627, .length = 21}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 648, .length = 13}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 449, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 290, .length = 7}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 449, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 573, .length = 4}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 449, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 603, .length = 8}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 534, .length = 11}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 0, .length = 1}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 534, .length = 11}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 1, .length = 1}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 534, .length = 11}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 2, .length = 1}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 590, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 661, .length = 8}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 669, .length = 17}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 686, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 699, .length = 8}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 707, .length = 19}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 726, .length = 13}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 739, .length = 11}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 750, .length = 8}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 758, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 762, .length = 8}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 770, .length = 12}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 782, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 330, .length = 3}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 782, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 794, .length = 4}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 782, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 835, .length = 3}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 789, .length = 5}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 891, .length = 1}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 789, .length = 5}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 928, .length = 11}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 798, .length = 18}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 816, .length = 19}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 838, .length = 5}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 843, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 850, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 857, .length = 11}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 868, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 333, .length = 4}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 868, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 594, .length = 4}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 868, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 598, .length = 5}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 875, .length = 6}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 881, .length = 10}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 3, .length = 3}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 6, .length = 3}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 9, .length = 3}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 12, .length = 3}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 15, .length = 3}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 18, .length = 3}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 21, .length = 3}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 946, .length = 25}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 971, .length = 2}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 973, .length = 8}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 981, .length = 17}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 998, .length = 10}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 1008, .length = 4}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 1012, .length = 3}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 1015, .length = 16}},
{.refcount = &g_refcnt,
.data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}},
{{.refcount = &g_refcnts[11].base, .data.refcounted = {g_bytes + 30, 14}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[10].base, .data.refcounted = {g_bytes + 24, 6}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[12].base, .data.refcounted = {g_bytes + 44, 15}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[12].base, .data.refcounted = {g_bytes + 44, 15}},
{.refcount = &g_refcnts[54].base, .data.refcounted = {g_bytes + 577, 13}}},
{{.refcount = &g_refcnts[13].base, .data.refcounted = {g_bytes + 59, 15}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[14].base, .data.refcounted = {g_bytes + 74, 13}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[15].base, .data.refcounted = {g_bytes + 87, 27}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[16].base, .data.refcounted = {g_bytes + 114, 3}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[17].base, .data.refcounted = {g_bytes + 117, 5}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[19].base, .data.refcounted = {g_bytes + 138, 10}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[20].base, .data.refcounted = {g_bytes + 148, 13}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[21].base, .data.refcounted = {g_bytes + 161, 13}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[22].base, .data.refcounted = {g_bytes + 174, 19}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[23].base, .data.refcounted = {g_bytes + 193, 16}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[24].base, .data.refcounted = {g_bytes + 209, 16}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[25].base, .data.refcounted = {g_bytes + 225, 14}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[26].base, .data.refcounted = {g_bytes + 239, 16}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[27].base, .data.refcounted = {g_bytes + 255, 13}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[28].base, .data.refcounted = {g_bytes + 268, 12}},
{.refcount = &g_refcnts[18].base, .data.refcounted = {g_bytes + 122, 16}}},
{{.refcount = &g_refcnts[28].base, .data.refcounted = {g_bytes + 268, 12}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[29].base, .data.refcounted = {g_bytes + 280, 6}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[30].base, .data.refcounted = {g_bytes + 286, 4}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[34].base, .data.refcounted = {g_bytes + 309, 4}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[35].base, .data.refcounted = {g_bytes + 313, 6}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[36].base, .data.refcounted = {g_bytes + 319, 7}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[37].base, .data.refcounted = {g_bytes + 326, 4}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[40].base, .data.refcounted = {g_bytes + 337, 20}},
{.refcount = &g_refcnts[31].base, .data.refcounted = {g_bytes + 290, 7}}},
{{.refcount = &g_refcnts[40].base, .data.refcounted = {g_bytes + 337, 20}},
{.refcount = &g_refcnts[32].base, .data.refcounted = {g_bytes + 297, 12}}},
{{.refcount = &g_refcnts[40].base, .data.refcounted = {g_bytes + 337, 20}},
{.refcount = &g_refcnts[53].base, .data.refcounted = {g_bytes + 573, 4}}},
{{.refcount = &g_refcnts[40].base, .data.refcounted = {g_bytes + 337, 20}},
{.refcount = &g_refcnts[58].base, .data.refcounted = {g_bytes + 603, 8}}},
{{.refcount = &g_refcnts[40].base, .data.refcounted = {g_bytes + 337, 20}},
{.refcount = &g_refcnts[59].base, .data.refcounted = {g_bytes + 611, 16}}},
{{.refcount = &g_refcnts[40].base, .data.refcounted = {g_bytes + 337, 20}},
{.refcount = &g_refcnts[60].base, .data.refcounted = {g_bytes + 627, 21}}},
{{.refcount = &g_refcnts[40].base, .data.refcounted = {g_bytes + 337, 20}},
{.refcount = &g_refcnts[61].base, .data.refcounted = {g_bytes + 648, 13}}},
{{.refcount = &g_refcnts[45].base, .data.refcounted = {g_bytes + 449, 13}},
{.refcount = &g_refcnts[31].base, .data.refcounted = {g_bytes + 290, 7}}},
{{.refcount = &g_refcnts[45].base, .data.refcounted = {g_bytes + 449, 13}},
{.refcount = &g_refcnts[53].base, .data.refcounted = {g_bytes + 573, 4}}},
{{.refcount = &g_refcnts[45].base, .data.refcounted = {g_bytes + 449, 13}},
{.refcount = &g_refcnts[58].base, .data.refcounted = {g_bytes + 603, 8}}},
{{.refcount = &g_refcnts[50].base, .data.refcounted = {g_bytes + 534, 11}},
{.refcount = &g_refcnts[0].base, .data.refcounted = {g_bytes + 0, 1}}},
{{.refcount = &g_refcnts[50].base, .data.refcounted = {g_bytes + 534, 11}},
{.refcount = &g_refcnts[1].base, .data.refcounted = {g_bytes + 1, 1}}},
{{.refcount = &g_refcnts[50].base, .data.refcounted = {g_bytes + 534, 11}},
{.refcount = &g_refcnts[2].base, .data.refcounted = {g_bytes + 2, 1}}},
{{.refcount = &g_refcnts[55].base, .data.refcounted = {g_bytes + 590, 4}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[62].base, .data.refcounted = {g_bytes + 661, 8}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[63].base, .data.refcounted = {g_bytes + 669, 17}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[64].base, .data.refcounted = {g_bytes + 686, 13}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[65].base, .data.refcounted = {g_bytes + 699, 8}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[66].base, .data.refcounted = {g_bytes + 707, 19}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[67].base, .data.refcounted = {g_bytes + 726, 13}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[68].base, .data.refcounted = {g_bytes + 739, 11}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[69].base, .data.refcounted = {g_bytes + 750, 8}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[70].base, .data.refcounted = {g_bytes + 758, 4}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[71].base, .data.refcounted = {g_bytes + 762, 8}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[72].base, .data.refcounted = {g_bytes + 770, 12}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[73].base, .data.refcounted = {g_bytes + 782, 7}},
{.refcount = &g_refcnts[38].base, .data.refcounted = {g_bytes + 330, 3}}},
{{.refcount = &g_refcnts[73].base, .data.refcounted = {g_bytes + 782, 7}},
{.refcount = &g_refcnts[75].base, .data.refcounted = {g_bytes + 794, 4}}},
{{.refcount = &g_refcnts[73].base, .data.refcounted = {g_bytes + 782, 7}},
{.refcount = &g_refcnts[78].base, .data.refcounted = {g_bytes + 835, 3}}},
{{.refcount = &g_refcnts[74].base, .data.refcounted = {g_bytes + 789, 5}},
{.refcount = &g_refcnts[86].base, .data.refcounted = {g_bytes + 891, 1}}},
{{.refcount = &g_refcnts[74].base, .data.refcounted = {g_bytes + 789, 5}},
{.refcount = &g_refcnts[88].base, .data.refcounted = {g_bytes + 928, 11}}},
{{.refcount = &g_refcnts[76].base, .data.refcounted = {g_bytes + 798, 18}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[77].base, .data.refcounted = {g_bytes + 816, 19}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[79].base, .data.refcounted = {g_bytes + 838, 5}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[80].base, .data.refcounted = {g_bytes + 843, 7}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[81].base, .data.refcounted = {g_bytes + 850, 7}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[82].base, .data.refcounted = {g_bytes + 857, 11}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[83].base, .data.refcounted = {g_bytes + 868, 7}},
{.refcount = &g_refcnts[39].base, .data.refcounted = {g_bytes + 333, 4}}},
{{.refcount = &g_refcnts[83].base, .data.refcounted = {g_bytes + 868, 7}},
{.refcount = &g_refcnts[56].base, .data.refcounted = {g_bytes + 594, 4}}},
{{.refcount = &g_refcnts[83].base, .data.refcounted = {g_bytes + 868, 7}},
{.refcount = &g_refcnts[57].base, .data.refcounted = {g_bytes + 598, 5}}},
{{.refcount = &g_refcnts[84].base, .data.refcounted = {g_bytes + 875, 6}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[85].base, .data.refcounted = {g_bytes + 881, 10}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[89].base, .data.refcounted = {g_bytes + 939, 7}},
{.refcount = &g_refcnts[3].base, .data.refcounted = {g_bytes + 3, 3}}},
{{.refcount = &g_refcnts[89].base, .data.refcounted = {g_bytes + 939, 7}},
{.refcount = &g_refcnts[4].base, .data.refcounted = {g_bytes + 6, 3}}},
{{.refcount = &g_refcnts[89].base, .data.refcounted = {g_bytes + 939, 7}},
{.refcount = &g_refcnts[5].base, .data.refcounted = {g_bytes + 9, 3}}},
{{.refcount = &g_refcnts[89].base, .data.refcounted = {g_bytes + 939, 7}},
{.refcount = &g_refcnts[6].base, .data.refcounted = {g_bytes + 12, 3}}},
{{.refcount = &g_refcnts[89].base, .data.refcounted = {g_bytes + 939, 7}},
{.refcount = &g_refcnts[7].base, .data.refcounted = {g_bytes + 15, 3}}},
{{.refcount = &g_refcnts[89].base, .data.refcounted = {g_bytes + 939, 7}},
{.refcount = &g_refcnts[8].base, .data.refcounted = {g_bytes + 18, 3}}},
{{.refcount = &g_refcnts[89].base, .data.refcounted = {g_bytes + 939, 7}},
{.refcount = &g_refcnts[9].base, .data.refcounted = {g_bytes + 21, 3}}},
{{.refcount = &g_refcnts[90].base, .data.refcounted = {g_bytes + 946, 25}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[91].base, .data.refcounted = {g_bytes + 971, 2}},
{.refcount = &g_refcnts[92].base, .data.refcounted = {g_bytes + 973, 8}}},
{{.refcount = &g_refcnts[93].base, .data.refcounted = {g_bytes + 981, 17}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[94].base, .data.refcounted = {g_bytes + 998, 10}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[95].base, .data.refcounted = {g_bytes + 1008, 4}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[96].base, .data.refcounted = {g_bytes + 1012, 3}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
{{.refcount = &g_refcnts[97].base, .data.refcounted = {g_bytes + 1015, 16}},
{.refcount = &g_refcnts[33].base, .data.refcounted = {g_bytes + 309, 0}}},
};
const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 29, 26, 30,
28, 32, 27, 31};

@ -300,6 +300,14 @@ print >>C
print >>C, '#include "src/core/lib/slice/slice_internal.h"'
print >>C
str_ofs = 0
id2strofs = {}
for i, elem in enumerate(all_strs):
id2strofs[i] = str_ofs
str_ofs += len(elem);
def slice_def(i):
return '{.refcount = &g_refcnts[%d].base, .data.refcounted = {g_bytes+%d, %d}}' % (i, id2strofs[i], len(all_strs[i]))
print >>H, '#define GRPC_STATIC_MDSTR_COUNT %d' % len(all_strs)
print >>H, 'extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];'
for i, elem in enumerate(all_strs):
@ -308,42 +316,31 @@ for i, elem in enumerate(all_strs):
print >>H
print >>H, 'bool grpc_is_static_metadata_string(grpc_slice slice);'
print >>H
print >>C, 'static uint8_t g_raw_bytes[] = {%s};' % (','.join('%d' % ord(c) for c in ''.join(all_strs)))
print >>C, 'static uint8_t g_bytes[] = {%s};' % (','.join('%d' % ord(c) for c in ''.join(all_strs)))
print >>C
print >>C, 'static void static_ref(void *unused) {}'
print >>C, 'static void static_unref(grpc_exec_ctx *exec_ctx, void *unused) {}'
print >>C, 'static const grpc_slice_refcount_vtable static_vtable = {static_ref, static_unref, grpc_static_slice_eq, grpc_static_slice_hash};';
print >>C, 'static grpc_slice_refcount g_refcnt = {&static_vtable};'
print >>C, 'typedef struct { grpc_slice_refcount base; const uint16_t offset; const uint16_t length; } static_slice_refcount;'
print >>C, 'static static_slice_refcount g_refcnts[GRPC_STATIC_MDSTR_COUNT] = {'
for i, elem in enumerate(all_strs):
print >>C, ' {{&static_vtable}, %d, %d},' % (id2strofs[i], len(elem))
print >>C, '};'
print >>C
print >>C, 'bool grpc_is_static_metadata_string(grpc_slice slice) {'
print >>C, ' return slice.refcount != NULL && slice.refcount->vtable == &static_vtable;'
print >>C, '}'
print >>C
print >>C, 'const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = {'
str_ofs = 0
revmap = {}
zero_length_idx = None
id2strofs = {}
def slice_def(i):
return '{.refcount = &g_refcnt, .data.refcounted = {.bytes = g_raw_bytes+%d, .length=%d}}' % (id2strofs[i], len(all_strs[i]))
for i, elem in enumerate(all_strs):
id2strofs[i] = str_ofs
print >>C, slice_def(i) + ','
revmap[str_ofs] = i
if len(elem) == 0: zero_length_idx = i
str_ofs += len(elem);
print >>C, '};'
print >>C
print >>C, 'static const uint8_t g_revmap[] = {%s};' % ','.join('%d' % (revmap[i] if i in revmap else 255) for i in range(0, str_ofs))
print >>C
print >>H, 'int grpc_static_metadata_index(grpc_slice slice);'
print >>C, 'int grpc_static_metadata_index(grpc_slice slice) {'
print >>C, ' if (GRPC_SLICE_LENGTH(slice) == 0) return %d;' % zero_length_idx
print >>C, ' if (slice.refcount != &g_refcnt) return -1;'
print >>C, ' size_t ofs = (size_t)(slice.data.refcounted.bytes - g_raw_bytes);'
print >>C, ' if (ofs > sizeof(g_revmap)) return -1;'
print >>C, ' uint8_t id = g_revmap[ofs];'
print >>C, ' return id == 255 ? -1 : (grpc_static_slice_table[id].data.refcounted.length == slice.data.refcounted.length? id : -1);'
print >>C, ' static_slice_refcount *r = (static_slice_refcount *)slice.refcount;'
print >>C, ' if (slice.data.refcounted.bytes == g_bytes + r->offset && slice.data.refcounted.length == r->length) return (int)(r - g_refcnts);'
print >>C, ' return -1;'
print >>C, '}'
print >>C

Loading…
Cancel
Save