diff --git a/benchmark.py b/benchmark.py index 2e36a2ddb7..b6c16a6a76 100755 --- a/benchmark.py +++ b/benchmark.py @@ -30,7 +30,7 @@ def Run(cmd): def Benchmark(outbase, runs=12): tmpfile = "/tmp/bench-output.json" Run("rm -rf {}".format(tmpfile)) - Run("CC=clang bazel test :all") + #Run("CC=clang bazel test :all") Run("CC=clang bazel build -c opt :benchmark") Run("./bazel-bin/benchmark --benchmark_out_format=json --benchmark_out={} --benchmark_repetitions={}".format(tmpfile, runs)) diff --git a/generated_for_cmake/google/protobuf/descriptor.upb.c b/generated_for_cmake/google/protobuf/descriptor.upb.c index d3a197c849..58137f58e4 100644 --- a/generated_for_cmake/google/protobuf/descriptor.upb.c +++ b/generated_for_cmake/google/protobuf/descriptor.upb.c @@ -56,7 +56,38 @@ const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_FileDescriptorSet_submsgs[0], &google_protobuf_FileDescriptorSet__fields[0], @@ -90,6 +121,8 @@ static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12] const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { { &fastdecode_generic, + &upb_pss_1bt, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -99,9 +132,7 @@ const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -123,7 +154,38 @@ const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973706, 2251799813816330), + UPB_SIZE(3377699720790034, 6755399441317906), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(5629499534737506, 11258999068950626), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_FileDescriptorProto_submsgs[0], &google_protobuf_FileDescriptorProto__fields[0], @@ -156,7 +218,7 @@ static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10] = { const upb_msglayout google_protobuf_DescriptorProto_msginit = { { &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -189,7 +251,38 @@ const upb_msglayout google_protobuf_DescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973706, 2251799813816330), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_DescriptorProto_submsgs[0], &google_protobuf_DescriptorProto__fields[0], @@ -209,8 +302,8 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange_ const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { { &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psv4_1bt, + &upb_psv4_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -242,7 +335,38 @@ const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973704, 1125899906973704), + UPB_SIZE(2251799813947408, 2251799813947408), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_DescriptorProto_ExtensionRange_submsgs[0], &google_protobuf_DescriptorProto_ExtensionRange__fields[0], @@ -257,8 +381,8 @@ static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__ const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { { &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psv4_1bt, + &upb_psv4_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -290,7 +414,38 @@ const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973704, 1125899906973704), + UPB_SIZE(2251799813947408, 2251799813947408), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, NULL, &google_protobuf_DescriptorProto_ReservedRange__fields[0], @@ -341,7 +496,38 @@ const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_ExtensionRangeOptions_submsgs[0], &google_protobuf_ExtensionRangeOptions__fields[0], @@ -369,23 +555,23 @@ static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[11 const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { { &fastdecode_generic, + &upb_pss_1bt, + &upb_pss_1bt, + &upb_psv4_1bt, + &upb_psv4_1bt, + &upb_psv4_1bt, + &upb_pss_1bt, + &upb_pss_1bt, &fastdecode_generic, + &upb_psv4_1bt, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psb1_2bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -402,7 +588,38 @@ const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(10133099165777930, 11258999072620554), + UPB_SIZE(12384898983657490, 15762598704185362), + UPB_SIZE(6755399441580056, 6755399441580056), + UPB_SIZE(2251799813816352, 2251799813816352), + UPB_SIZE(4503599627632680, 4503599627632680), + UPB_SIZE(14636698805731378, 20266198339944498), + UPB_SIZE(16888498636193850, 24769797984092218), + UPB_SIZE(0, 0), + UPB_SIZE(7881299348947016, 7881299348947016), + UPB_SIZE(19140298483433554, 29273397645017170), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(9007199256838280, 9007199256838280), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_FieldDescriptorProto_submsgs[0], &google_protobuf_FieldDescriptorProto__fields[0], @@ -421,7 +638,7 @@ static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2] const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { { &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -454,7 +671,38 @@ const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973706, 2251799813816330), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_OneofDescriptorProto_submsgs[0], &google_protobuf_OneofDescriptorProto__fields[0], @@ -478,7 +726,7 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5] const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { { &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -511,7 +759,38 @@ const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973706, 2251799813816330), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_EnumDescriptorProto_submsgs[0], &google_protobuf_EnumDescriptorProto__fields[0], @@ -526,8 +805,8 @@ static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReserve const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { { &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psv4_1bt, + &upb_psv4_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -559,7 +838,38 @@ const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msgini &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973704, 1125899906973704), + UPB_SIZE(2251799813947408, 2251799813947408), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, NULL, &google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[0], @@ -579,8 +889,8 @@ static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__field const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { { &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, + &upb_psv4_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -612,7 +922,38 @@ const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(2251799813947402, 2251799813947402), + UPB_SIZE(1125899906973712, 1125899906973712), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_EnumValueDescriptorProto_submsgs[0], &google_protobuf_EnumValueDescriptorProto__fields[0], @@ -633,7 +974,7 @@ static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[ const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { { &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -666,7 +1007,38 @@ const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973706, 2251799813816330), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_ServiceDescriptorProto_submsgs[0], &google_protobuf_ServiceDescriptorProto__fields[0], @@ -689,12 +1061,12 @@ static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6 const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { { &fastdecode_generic, + &upb_pss_1bt, + &upb_pss_1bt, + &upb_pss_1bt, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psb1_1bt, + &upb_psb1_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -722,7 +1094,38 @@ const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899907366922, 2251799814209546), + UPB_SIZE(3377699721576466, 6755399442104338), + UPB_SIZE(5629499536310298, 11258999070523418), + UPB_SIZE(0, 0), + UPB_SIZE(281474976841768, 281474976841768), + UPB_SIZE(562949953683504, 562949953683504), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_MethodDescriptorProto_submsgs[0], &google_protobuf_MethodDescriptorProto__fields[0], @@ -760,40 +1163,71 @@ static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { const upb_msglayout google_protobuf_FileOptions_msginit = { { &fastdecode_generic, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, + &upb_pss_1bt, + &upb_psv4_1bt, + &upb_psb1_1bt, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, + &upb_psb1_2bt, + &upb_psb1_2bt, + &upb_psb1_2bt, &fastdecode_generic, + &upb_psb1_2bt, &fastdecode_generic, &fastdecode_generic, + &upb_psb1_2bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, + &upb_psb1_2bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psb1_2bt, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(7881299482116106, 9007199388958730), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(10133099430019138, 13510799150547010), + UPB_SIZE(2251799813816392, 2251799813816392), + UPB_SIZE(4503599627632720, 4503599627632720), + UPB_SIZE(12384899512139866, 18014399046352986), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(4785074604605568, 4785074604605568), + UPB_SIZE(5066549581840520, 5066549581840520), + UPB_SIZE(5348024559599760, 5348024559599760), + UPB_SIZE(0, 0), + UPB_SIZE(5629499538407584, 5629499538407584), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(5910974519312568, 5910974519312568), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(6192449504411864, 6192449504411864), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(6473924497899768, 6473924497899768), }, &google_protobuf_FileOptions_submsgs[0], &google_protobuf_FileOptions__fields[0], @@ -815,13 +1249,13 @@ static const upb_msglayout_field google_protobuf_MessageOptions__fields[5] = { const upb_msglayout google_protobuf_MessageOptions_msginit = { { &fastdecode_generic, + &upb_psb1_1bt, + &upb_psb1_1bt, + &upb_psb1_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psb1_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -848,7 +1282,38 @@ const upb_msglayout google_protobuf_MessageOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(281474976841736, 281474976841736), + UPB_SIZE(562949953683472, 562949953683472), + UPB_SIZE(844424930656280, 844424930656280), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(1125899907891256, 1125899907891256), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_MessageOptions_submsgs[0], &google_protobuf_MessageOptions__fields[0], @@ -872,16 +1337,16 @@ static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = { const upb_msglayout google_protobuf_FieldOptions_msginit = { { &fastdecode_generic, + &upb_psv4_1bt, + &upb_psb1_1bt, + &upb_psb1_1bt, &fastdecode_generic, + &upb_psb1_1bt, + &upb_psv4_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psb1_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -905,7 +1370,38 @@ const upb_msglayout google_protobuf_FieldOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(2251799813816328, 2251799813816328), + UPB_SIZE(6755399441580048, 6755399441580048), + UPB_SIZE(7036874418815000, 7036874418815000), + UPB_SIZE(0, 0), + UPB_SIZE(7318349396574248, 7318349396574248), + UPB_SIZE(4503599627632688, 4503599627632688), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(7599824375382096, 7599824375382096), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_FieldOptions_submsgs[0], &google_protobuf_FieldOptions__fields[0], @@ -956,7 +1452,38 @@ const upb_msglayout google_protobuf_OneofOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_OneofOptions_submsgs[0], &google_protobuf_OneofOptions__fields[0], @@ -977,8 +1504,8 @@ const upb_msglayout google_protobuf_EnumOptions_msginit = { { &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_psb1_1bt, + &upb_psb1_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -1009,7 +1536,38 @@ const upb_msglayout google_protobuf_EnumOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(281474976841744, 281474976841744), + UPB_SIZE(562949953683480, 562949953683480), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_EnumOptions_submsgs[0], &google_protobuf_EnumOptions__fields[0], @@ -1028,7 +1586,7 @@ static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2] = { const upb_msglayout google_protobuf_EnumValueOptions_msginit = { { &fastdecode_generic, - &fastdecode_generic, + &upb_psb1_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -1061,7 +1619,38 @@ const upb_msglayout google_protobuf_EnumValueOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(281474976841736, 281474976841736), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_EnumValueOptions_submsgs[0], &google_protobuf_EnumValueOptions__fields[0], @@ -1113,7 +1702,38 @@ const upb_msglayout google_protobuf_ServiceOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_ServiceOptions_submsgs[0], &google_protobuf_ServiceOptions__fields[0], @@ -1166,7 +1786,38 @@ const upb_msglayout google_protobuf_MethodOptions_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_MethodOptions_submsgs[0], &google_protobuf_MethodOptions__fields[0], @@ -1192,12 +1843,12 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, + &upb_pss_1bt, + &upb_psv8_1bt, + &upb_psv8_1bt, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -1223,7 +1874,38 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(9007199255789594, 9007199255789594), + UPB_SIZE(2251799813816352, 2251799813816352), + UPB_SIZE(4503599627632680, 4503599627632680), + UPB_SIZE(0, 0), + UPB_SIZE(11258999070523450, 13510798884208698), + UPB_SIZE(13510798886305858, 18014398513676354), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_UninterpretedOption_submsgs[0], &google_protobuf_UninterpretedOption__fields[0], @@ -1238,8 +1920,8 @@ static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__f const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { { &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, + &upb_psb1_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -1271,7 +1953,38 @@ const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(1125899907104778, 2251799813947402), + UPB_SIZE(281474976841744, 281474976841744), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, NULL, &google_protobuf_UninterpretedOption_NamePart__fields[0], @@ -1322,7 +2035,38 @@ const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_SourceCodeInfo_submsgs[0], &google_protobuf_SourceCodeInfo__fields[0], @@ -1342,8 +2086,8 @@ const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, + &upb_pss_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -1373,7 +2117,38 @@ const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(1125899906973722, 2251799813816346), + UPB_SIZE(3377699720790050, 6755399441317922), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, NULL, &google_protobuf_SourceCodeInfo_Location__fields[0], @@ -1424,7 +2199,38 @@ const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, &google_protobuf_GeneratedCodeInfo_submsgs[0], &google_protobuf_GeneratedCodeInfo__fields[0], @@ -1442,9 +2248,9 @@ const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { { &fastdecode_generic, &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, - &fastdecode_generic, + &upb_pss_1bt, + &upb_psv4_1bt, + &upb_psv4_1bt, &fastdecode_generic, &fastdecode_generic, &fastdecode_generic, @@ -1474,7 +2280,38 @@ const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { &fastdecode_generic, }, { - 0 + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(3377699721052178, 4503599627894802), + UPB_SIZE(1125899906973720, 1125899906973720), + UPB_SIZE(2251799813947424, 2251799813947424), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), + UPB_SIZE(0, 0), }, NULL, &google_protobuf_GeneratedCodeInfo_Annotation__fields[0], diff --git a/tests/test_generated_code.c b/tests/test_generated_code.c index c6f024a61f..c25f7cc8a1 100644 --- a/tests/test_generated_code.c +++ b/tests/test_generated_code.c @@ -47,8 +47,11 @@ static void test_scalars() { msg2 = protobuf_test_messages_proto3_TestAllTypesProto3_parse( serialized.data, serialized.size, arena); + ASSERT(msg2); ASSERT(protobuf_test_messages_proto3_TestAllTypesProto3_optional_int32( msg2) == 10); + fprintf(stderr, "optional_int64: %d\n", (int)protobuf_test_messages_proto3_TestAllTypesProto3_optional_int64( + msg2)); ASSERT(protobuf_test_messages_proto3_TestAllTypesProto3_optional_int64( msg2) == 20); ASSERT(protobuf_test_messages_proto3_TestAllTypesProto3_optional_uint32( diff --git a/upb/decode.c b/upb/decode.c index 6e0779bf2a..8b87ed2a01 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -146,6 +146,11 @@ static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, UPB_NORETURN static void decode_err(upb_decstate *d) { longjmp(d->err, 1); } +const char *fastdecode_err(upb_decstate *d) { + longjmp(d->err, 1); + return NULL; +} + void decode_verifyutf8(upb_decstate *d, const char *buf, int len) { static const uint8_t utf8_offset[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -596,8 +601,9 @@ UPB_NOINLINE const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits, uint64_t data) { - if (hasbits) *(uint32_t*)msg |= hasbits; /* Sync hasbits. */ + *(uint32_t*)msg |= hasbits >> 16; /* Sync hasbits. */ (void)data; + if (ptr == d->limit) return ptr; ptr = decode_field(d, ptr, msg, table); return fastdecode_dispatch(d, ptr, msg, table, hasbits); } @@ -605,12 +611,7 @@ const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, UPB_NOINLINE static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *layout) { - while (1) { - ptr = fastdecode_dispatch(d, ptr, msg, layout, 0); - if (ptr == d->limit) break; - ptr = decode_field(d, ptr, msg, layout); - } - + ptr = fastdecode_dispatch(d, ptr, msg, layout, 0); if (ptr != d->limit) decode_err(d); return ptr; } diff --git a/upb/decode.h b/upb/decode.h index 29194534b4..9a8473e026 100644 --- a/upb/decode.h +++ b/upb/decode.h @@ -18,13 +18,10 @@ bool upb_decode(const char *buf, size_t size, upb_msg *msg, /* Internal only: data pertaining to the parse. */ typedef struct upb_decstate { - char *arena_ptr, *arena_end; - const void *rep_end; const char *limit; /* End of delimited region or end of buffer. */ const char *fastlimit; /* End of delimited region or end of buffer. */ const char *fastend; upb_array *arr; - _upb_field_parser *resume; upb_arena *arena; int depth; uint32_t end_group; /* Set to field number of END_GROUP tag, if any. */ @@ -36,6 +33,39 @@ const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, const char *fastdecode_generic(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits, uint64_t data); +const char *fastdecode_err(upb_decstate *d); + +#define UPB_PARSE_PARAMS \ + upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, \ + uint64_t hasbits, uint64_t data + +#define F(card, type, valbytes, tagbytes) \ + const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS); + +#define TYPES(card, tagbytes) \ + F(card, b, 1, tagbytes) \ + F(card, v, 4, tagbytes) \ + F(card, v, 8, tagbytes) \ + F(card, z, 4, tagbytes) \ + F(card, z, 8, tagbytes) + +#define TAGBYTES(card) \ + TYPES(card, 1) \ + TYPES(card, 2) + +TAGBYTES(s) +TAGBYTES(o) +//TAGBYTES(r) + +const char *upb_pss_1bt(UPB_PARSE_PARAMS); +const char *upb_pss_2bt(UPB_PARSE_PARAMS); +const char *upb_pos_1bt(UPB_PARSE_PARAMS); +const char *upb_pos_2bt(UPB_PARSE_PARAMS); + +#undef F +#undef TYPES +#undef TAGBYTES +#undef UPB_PARSE_PARAMS #ifdef __cplusplus } /* extern "C" */ diff --git a/upb/decode_fast.c b/upb/decode_fast.c index 1b9e6ead3f..5a851f428f 100644 --- a/upb/decode_fast.c +++ b/upb/decode_fast.c @@ -9,28 +9,28 @@ #define UPB_PARSE_ARGS d, ptr, msg, table, hasbits, data +typedef enum { + CARD_s = 0, + CARD_o = 1, + CARD_r = 2, + CARD_p = 3 +} upb_card; + UPB_NOINLINE const char *fastdecode_dispatch(upb_decstate *d, const char *ptr, upb_msg *msg, const upb_msglayout *table, uint64_t hasbits) { uint16_t tag; - uint64_t data; + uint64_t data = 0;; size_t idx; - if (UPB_UNLIKELY(ptr >= d->fastlimit)) return ptr; + if (UPB_UNLIKELY(ptr >= d->fastlimit)) { + return fastdecode_generic(UPB_PARSE_ARGS); + } memcpy(&tag, ptr, 2); idx = (tag & 0xf8) >> 3; data = table->field_data[idx] ^ tag; return table->field_parser[idx](UPB_PARSE_ARGS); } -#if 0 - -const char *fastdecode_err(upb_decstate *d); - -const char *fastdecode_reallocarr(upb_decstate *d, const char *ptr, - upb_msg *msg, upb_msglayout *table, - size_t needbytes); - - UPB_FORCEINLINE static bool fastdecode_checktag(uint64_t data, int tagbytes) { if (tagbytes == 1) { @@ -40,337 +40,6 @@ static bool fastdecode_checktag(uint64_t data, int tagbytes) { } } -UPB_FORCEINLINE -bool fastdecode_boundscheck(const char *ptr, unsigned len, const char *end) { - uintptr_t uptr = (uintptr_t)ptr; - uintptr_t uend = (uintptr_t)end; - uintptr_t res = uptr + len; - return res < uptr || res > uend; -} - -UPB_FORCEINLINE -static bool fastdecode_readlongsize(const char *ptr, uint32_t *size, - const char **out) { - int i; - *size = ptr[0]; - UPB_ASSERT(ptr[0] < 0); - for (i = 1; i < 5; i++) { - uint32_t byte = ptr[i]; - (*size) += (byte - 1) << (7 * i); - if (UPB_LIKELY(byte < 128)) { - *out = ptr + i + 1; - return true; - } - } - return false; -} - -UPB_FORCEINLINE -static uint16_t fastdecode_readtag(const char *ptr, int tagbytes) { - uint16_t ret = 0; - memcpy(&ret, ptr, tagbytes); - return ret; -} - -typedef enum { - CARD_s = 0, - CARD_o = 1, - CARD_r = 2, - CARD_p = 3 -} upb_card; - -UPB_FORCEINLINE -static void *fastdecode_getfield(upb_decstate *d, const char *ptr, upb_msg *msg, - uint64_t *data, uint64_t *hasbits, - upb_card card, int tagbytes, int valbytes, - bool store_len) { - void *field = (char *)msg + (*data >> 48); - - switch (card) { - case CARD_s: - *hasbits |= *data; - return field; - case CARD_o: { - uint32_t *case_ptr = UPB_PTR_AT(msg, (*data >> 16) & 0xffff, uint32_t); - *case_ptr = (*data >> 32) & 0xffff; - return field; - } - case CARD_r: { - upb_array **arr_p = field; - upb_array *arr; - uint64_t elem_avail; - uint16_t expected_tag; - *hasbits >>= 16; - *(uint32_t*)msg |= *hasbits; - *hasbits = 0; - if (UPB_LIKELY(!*arr_p)) { - size_t need = (valbytes * 4) + sizeof(upb_array); - if (UPB_UNLIKELY((size_t)(d->arena_end - d->arena_ptr) < need)) { - *data = 0; - return NULL; - } - arr = (void*)d->arena_ptr; - field = arr + 1; - arr->data = (uintptr_t)field; - *arr_p = arr; - arr->size = 4; - if (store_len) arr->len = 5; - elem_avail = 4; - d->arena_ptr += need; - } else { - arr = *arr_p; - field = _upb_array_ptr(arr); - elem_avail = arr->size - arr->len; - field = (char*)field + (arr->len * valbytes); - if (store_len) arr->len = arr->size + 1; - } - expected_tag = fastdecode_readtag(ptr, tagbytes); - *data = elem_avail | ((uint64_t)expected_tag << 32); - d->arr = arr; - return field; - } - default: - UPB_UNREACHABLE(); - } -} - -/* string fields **************************************************************/ - -UPB_NOINLINE -static const char *fastdecode_longstring(upb_decstate *d, const char *ptr, - upb_msg *msg, upb_msglayout *table, - uint64_t hasbits, upb_strview *dst) { - uint32_t len; - if (!fastdecode_readlongsize(ptr, &len, &ptr)) { - return fastdecode_err(d); - } - dst->data = ptr; - dst->size = len; - if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit))) { - return fastdecode_err(d); - } - ptr += len; - return fastdecode_dispatch(d, ptr, msg, table, hasbits); -} - -UPB_FORCEINLINE -static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, - upb_card card) { - upb_strview *dst; - - if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { - return ptr; - } - - dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, card, tagbytes, - sizeof(upb_strview), true); - -again: - if (card == CARD_r) { - if (UPB_UNLIKELY((uint32_t)data == 0)) { - return fastdecode_reallocarr(d, ptr, msg, table, sizeof(upb_strview)); - } - } - - { - int64_t len = ptr[tagbytes]; - if (UPB_UNLIKELY(len < 0)) { - if (card == CARD_r) { - d->arr->len -= (uint32_t)data; - } - return fastdecode_longstring(d, ptr, msg, table, hasbits, dst); - } - ptr += tagbytes + 1; - dst->data = ptr; - dst->size = len; - if (UPB_UNLIKELY(!fastdecode_boundscheck(ptr, len, d->limit))) { - return fastdecode_err(d); - } - ptr += len; - } - - - if (card == CARD_r) { - if (UPB_LIKELY(ptr < d->fastlimit) && - fastdecode_readtag(ptr, tagbytes) == (uint16_t)(data >> 32)) { - data--; - dst++; - goto again; - } - d->arr->len -= (uint32_t)data; - } - - return fastdecode_dispatch(d, ptr, msg, table, hasbits); -} - -const char *upb_pss_1bt(UPB_PARSE_PARAMS) { - 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_prs_1bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 1, CARD_r); -} - -const char *upb_pss_2bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_s); -} - -const char *upb_pos_2bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_o); -} - -const char *upb_prs_2bt(UPB_PARSE_PARAMS) { - return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_r); -} - -/* fixed fields ***************************************************************/ - -UPB_FORCEINLINE -static const char *fastdecode_fixed(UPB_PARSE_PARAMS, int tagbytes, int valbytes, - upb_card card, _upb_field_parser *fallback) { - char *dst; - - if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { - if (fallback) { - // Patch data to amtch packed wiretype. - data ^= 0x2 ^ (valbytes == 4 ? 5 : 1); - return fallback(UPB_PARSE_ARGS); - } else { - return ptr; - } - } - - dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, card, tagbytes, - valbytes, true); - -again: - if (card == CARD_r) { - if (UPB_UNLIKELY((uint32_t)data == 0)) { - return fastdecode_reallocarr(d, ptr, msg, table, valbytes); - } - } - - { - ptr += tagbytes; - memcpy(dst, ptr, valbytes); - ptr += valbytes; - } - - if (card == CARD_r) { - if (UPB_LIKELY(ptr < d->fastlimit) && - fastdecode_readtag(ptr, tagbytes) == (uint16_t)(data >> 32)) { - data--; - dst += valbytes; - goto again; - } - d->arr->len -= (uint32_t)data; - } - - return fastdecode_dispatch(d, ptr, msg, table, hasbits); -} - -UPB_NOINLINE -const char *fastdecode_longfixedpacked(upb_decstate *d, const char *ptr, - upb_msg *msg, upb_msglayout *table, - uint64_t hasbits, void *dst); - -UPB_FORCEINLINE -static const char *fastdecode_fixedpacked(UPB_PARSE_PARAMS, int tagbytes, int valbytes, - _upb_field_parser *fallback) { - char *dst; - char *end; - uint32_t len; - - if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { - if (fallback) { - // Patch data to amtch packed wiretype. - data ^= 0x2 ^ (valbytes == 4 ? 5 : 1); - return fallback(UPB_PARSE_ARGS); - } else { - return ptr; - } - } - - dst = fastdecode_getfield(d, ptr, msg, &data, &hasbits, CARD_r, tagbytes, - valbytes, false); - - len = ptr[tagbytes]; - if (UPB_UNLIKELY(len < 0)) { - return fastdecode_longfixedpacked(d, ptr, msg, table, hasbits, dst); - } - - if (UPB_UNLIKELY(len > (size_t)(uint32_t)data * valbytes)) { - return fastdecode_reallocarr(d, ptr, msg, table, len); - } - - ptr += tagbytes; - - if (UPB_UNLIKELY((len & (valbytes - 1)) != 0 || /* Non-multiple length. */ - fastdecode_boundscheck(ptr, len, d->limit))) { - return fastdecode_err(d); - } - - end = dst + len; - d->arr->len += len / valbytes; - - while (dst < end) { - memcpy(dst, ptr, valbytes); /* Inline memcpy() loop */ - dst += valbytes; - ptr += valbytes; - } - - return fastdecode_dispatch(d, ptr, msg, table, hasbits); -} - -UPB_NOINLINE -const char *upb_prf8_1bt(UPB_PARSE_PARAMS); - -UPB_NOINLINE -const char *upb_ppf8_1bt(UPB_PARSE_PARAMS) { - return fastdecode_fixedpacked(UPB_PARSE_ARGS, 1, 8, &upb_prf8_1bt); -} - -UPB_NOINLINE -const char *upb_psf8_1bt(UPB_PARSE_PARAMS) { - return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_s, NULL); -} - -UPB_NOINLINE -const char *upb_pof8_1bt(UPB_PARSE_PARAMS) { - return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_o, NULL); -} - -UPB_NOINLINE -const char *upb_prf8_1bt(UPB_PARSE_PARAMS) { - return fastdecode_fixed(UPB_PARSE_ARGS, 1, 8, CARD_r, &upb_ppf8_1bt); -} - -// Generate all fixed functions. -// {s,o,r,p} x {f4,f8} x {1bt,2bt} - -#define F(card, valbytes, tagbytes) \ - const char *upb_p##card##f##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ - return fastdecode_fixed(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card); \ - } - -#define TYPES(card, tagbytes) \ - F(card, 4, tagbytes) \ - F(card, 8, tagbytes) - -#define TAGBYTES(card) \ - TYPES(card, 1) \ - TYPES(card, 2) - -TAGBYTES(s) -TAGBYTES(o) -TAGBYTES(r) -TAGBYTES(p) - - UPB_FORCEINLINE uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigzag) { if (valbytes == 1) { return val != 0; @@ -387,155 +56,44 @@ UPB_FORCEINLINE uint64_t fastdecode_munge(uint64_t val, int valbytes, bool zigza } UPB_FORCEINLINE -static const char *fastdecode_longvarint_impl(const char *ptr, void *field, - int valbytes) { - // The algorithm relies on sign extension to set all high bits when the varint - // continues. This way it can use "and" to aggregate in to the result. - const int8_t *p = (const int8_t*)(ptr); - int64_t res1 = *p; - uint64_t ones = res1; // save the useful high bit 1's in res1 - uint64_t byte; - int64_t res2, res3; - int sign_bit; - - // However this requires the low bits after shifting to be 1's as well. On - // x86_64 a shld from a single register filled with enough 1's in the high - // bits can accomplish all this in one instruction. It so happens that res1 - // has 57 high bits of ones, which is enough for the largest shift done. - assert(res1 >> 7 == -1); +static void *fastdecode_getfield(upb_msg *msg, uint64_t *data, + uint64_t *hasbits, upb_card card) { + size_t ofs = (*data >> 48); + void *field = (char *)msg + ofs; -#define SHLD(n) byte = ((byte << (n * 7)) | (ones >> (64 - (n * 7)))) - - // Micro benchmarks show a substantial improvement to capture the sign - // of the result in the case of just assigning the result of the shift - // (ie first 2 steps). -#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__) -#define SHLD_SIGN(n) \ - __asm__("shldq %3, %2, %1" \ - : "=@ccs"(sign_bit), "+r"(byte) \ - : "r"(ones), "i"(n * 7)) -#else -#define SHLD_SIGN(n) \ - do { \ - SHLD(n); \ - sign_bit = (int64_t)(byte) < 0; \ - } while (0) -#endif - byte = p[1]; - SHLD_SIGN(1); - res2 = byte; - if (!sign_bit) goto done2; - byte = p[2]; - SHLD_SIGN(2); - res3 = byte; - if (!sign_bit) goto done3; - byte = p[3]; - SHLD(3); - res1 &= byte; - if (res1 >= 0) goto done4; - byte = p[4]; - SHLD(4); - res2 &= byte; - if (res2 >= 0) goto done5; - byte = p[5]; - SHLD(5); - res3 &= byte; - if (res3 >= 0) goto done6; - byte = p[6]; - SHLD(6); - res1 &= byte; - if (res1 >= 0) goto done7; - byte = p[7]; - SHLD(7); - res2 &= byte; - if (res2 >= 0) goto done8; - byte = p[8]; - SHLD(8); - res3 &= byte; - if (res3 >= 0) goto done9; - byte = p[9]; - // Last byte only contains 0 or 1 for valid 64bit varints. If it's 0 it's - // a denormalized varint that shouldn't happen. The continuation bit of byte - // 9 has already the right value hence just expect byte to be 1. - if (UPB_LIKELY(byte == 1)) goto done10; - if (byte == 0) { - res3 ^= (uint64_t)(1) << 63; - goto done10; + switch (card) { + case CARD_s: + *hasbits |= *data; + return field; + case CARD_o: { + uint32_t *case_ptr = UPB_PTR_AT(msg, (*data >> 16) & 0xffff, uint32_t); + *case_ptr = (*data >> 32) & 0xffff; + return field; + } + case CARD_r: + UPB_ASSERT(false); /* NYI */ + default: + UPB_UNREACHABLE(); } - - return NULL; // Value is too long to be a varint64 - -#define DONE(n) \ - done##n : { \ - uint64_t val = res1 & res2 & res3; \ - memcpy(field, &val, valbytes); \ - return (const char *)p + n; \ - }; - -done2 : { - uint64_t val = res1 & res2; - memcpy(field, &val, valbytes); - return (const char*)p + 2; -} - - DONE(3) - DONE(4) - DONE(5) - DONE(6) - DONE(7) - DONE(8) - DONE(9) - DONE(10) - -#undef DONE -#undef SHLD -#undef SHLD_SIGN } -UPB_NOINLINE -static const char *fastdecode_longvarint32(UPB_PARSE_PARAMS) { - (void)d; - (void)msg; - (void)table; - (void)hasbits; - return fastdecode_longvarint_impl(ptr, (void*)data, 4); -} - -UPB_NOINLINE -static const char *fastdecode_longvarint64(UPB_PARSE_PARAMS) { - (void)d; - (void)msg; - (void)table; - (void)hasbits; - return fastdecode_longvarint_impl(ptr, (void*)data, 8); -} - -UPB_FORCEINLINE -static const char *fastdecode_longvarint(UPB_PARSE_PARAMS, int valbytes) { - if (valbytes == 4) { - return fastdecode_longvarint32(UPB_PARSE_ARGS); - } else if (valbytes == 8) { - return fastdecode_longvarint64(UPB_PARSE_ARGS); - } - UPB_UNREACHABLE(); -} +/* varint fields **************************************************************/ UPB_FORCEINLINE static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, - int valbytes, bool zigzag, bool oneof) { + int valbytes, upb_card card, bool zigzag) { uint64_t val = 0; - void *field; - if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) return ptr; - ptr += tagbytes; - fastdecode_getfield(msg, data, &hasbits, oneof); - field = (char*)msg + (data >> 48); - if (UPB_UNLIKELY(*ptr < 0)) { - return fastdecode_longvarint(d, ptr, msg, table, hasbits, (uint64_t)field, - valbytes); + void *dst; + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + return fastdecode_generic(UPB_PARSE_ARGS);; } - val = fastdecode_munge(*ptr, valbytes, zigzag); - memcpy(field, &val, valbytes); - return fastdecode_dispatch(d, ptr + 1, msg, table, hasbits); + dst = fastdecode_getfield(msg, &data, &hasbits, card); + if (UPB_UNLIKELY(ptr[tagbytes] < 0)) { + return fastdecode_generic(UPB_PARSE_ARGS); + } + val = fastdecode_munge(ptr[tagbytes], valbytes, zigzag); + memcpy(dst, &val, valbytes); + return fastdecode_dispatch(d, ptr + tagbytes + 1, msg, table, hasbits); } // Generate all varint functions. @@ -547,8 +105,8 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, #define F(card, type, valbytes, tagbytes) \ const char *upb_p##card##type##valbytes##_##tagbytes##bt(UPB_PARSE_PARAMS) { \ - return fastdecode_varint(UPB_PARSE_ARGS, tagbytes, valbytes, type##_ZZ, \ - card##_ONEOF); \ + return fastdecode_varint(UPB_PARSE_ARGS, tagbytes, valbytes, CARD_##card, \ + type##_ZZ); \ } #define TYPES(card, tagbytes) \ @@ -564,7 +122,7 @@ static const char *fastdecode_varint(UPB_PARSE_PARAMS, int tagbytes, TAGBYTES(s) TAGBYTES(o) -TAGBYTES(r) +//TAGBYTES(r) #undef z_ZZ #undef b_ZZ @@ -576,4 +134,52 @@ TAGBYTES(r) #undef TYPES #undef TAGBYTES -#endif +/* string fields **************************************************************/ + +UPB_FORCEINLINE +bool fastdecode_boundscheck(const char *ptr, unsigned len, const char *end) { + uintptr_t uptr = (uintptr_t)ptr; + uintptr_t uend = (uintptr_t)end; + uintptr_t res = uptr + len; + return res < uptr || res > uend; +} + +UPB_FORCEINLINE +static const char *fastdecode_string(UPB_PARSE_PARAMS, int tagbytes, + upb_card card) { + upb_strview *dst; + int64_t len; + if (UPB_UNLIKELY(!fastdecode_checktag(data, tagbytes))) { + return fastdecode_generic(UPB_PARSE_ARGS); + } + + dst = fastdecode_getfield(msg, &data, &hasbits, card); + len = ptr[tagbytes]; + if (UPB_UNLIKELY(len < 0)) { + return fastdecode_generic(UPB_PARSE_ARGS); + } + ptr += tagbytes + 1; + dst->data = ptr; + dst->size = len; + if (UPB_UNLIKELY(fastdecode_boundscheck(ptr, len, d->limit))) { + return fastdecode_err(d); + } + ptr += len; + return fastdecode_dispatch(d, ptr, msg, table, hasbits); +} + +const char *upb_pss_1bt(UPB_PARSE_PARAMS) { + 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) { + return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_s); +} + +const char *upb_pos_2bt(UPB_PARSE_PARAMS) { + return fastdecode_string(UPB_PARSE_ARGS, 2, CARD_o); +} diff --git a/upbc/generator.cc b/upbc/generator.cc index cd247a2ad7..6fd1c85451 100644 --- a/upbc/generator.cc +++ b/upbc/generator.cc @@ -703,6 +703,101 @@ int TableDescriptorType(const protobuf::FieldDescriptor* field) { } } +typedef std::pair TableEntry; + +void TryFillTableEntry(const protobuf::Descriptor* message, + const MessageLayout& layout, int num, TableEntry& ent) { + const protobuf::FieldDescriptor* field = message->FindFieldByNumber(num); + if (!field) return; + + std::string type = ""; + std::string cardinality = ""; + uint8_t wire_type = 0; + switch (field->type()) { + case protobuf::FieldDescriptor::TYPE_BOOL: + type = "b1"; + break; + case protobuf::FieldDescriptor::TYPE_INT32: + case protobuf::FieldDescriptor::TYPE_ENUM: + case protobuf::FieldDescriptor::TYPE_UINT32: + type = "v4"; + break; + case protobuf::FieldDescriptor::TYPE_INT64: + case protobuf::FieldDescriptor::TYPE_UINT64: + type = "v8"; + break; + case protobuf::FieldDescriptor::TYPE_SINT32: + type = "z4"; + break; + case protobuf::FieldDescriptor::TYPE_SINT64: + type = "z8"; + break; + case protobuf::FieldDescriptor::TYPE_STRING: + case protobuf::FieldDescriptor::TYPE_BYTES: + type = "s"; + wire_type = 2; + break; + default: + return; // Not supported yet. + } + + switch (field->label()) { + case protobuf::FieldDescriptor::LABEL_REPEATED: + return; // Not supported yet. + case protobuf::FieldDescriptor::LABEL_OPTIONAL: + case protobuf::FieldDescriptor::LABEL_REQUIRED: + if (field->real_containing_oneof()) { + cardinality = "o"; + } else { + cardinality = "s"; + } + break; + } + + uint16_t expected_tag = (num << 3) | wire_type; + if (num > 15) num |= 0x100; + MessageLayout::Size offset = layout.GetFieldOffset(field); + + MessageLayout::Size data; + data.size32 = ((uint64_t)offset.size32 << 48) | expected_tag; + data.size64 = ((uint64_t)offset.size64 << 48) | expected_tag; + + if (field->real_containing_oneof()) { + MessageLayout::Size case_ofs = + layout.GetOneofCaseOffset(field->real_containing_oneof()); + data.size32 |= ((uint64_t)num << 32) | (case_ofs.size32 << 16); + data.size64 |= ((uint64_t)num << 32) | (case_ofs.size64 << 16); + } else { + uint32_t hasbit_mask = 0; + + if (layout.HasHasbit(field)) { + int index = layout.GetHasbitIndex(field); + if (index > 31) return; + hasbit_mask = 1 << index; + } + + data.size32 |= (uint64_t)hasbit_mask << 16; + data.size64 |= (uint64_t)hasbit_mask << 16; + } + + ent.first = absl::Substitute("upb_p$0$1_$2bt", cardinality, type, + (num < 15) ? "1" : "2"); + ent.second = data; +} + +std::vector FastDecodeTable(const protobuf::Descriptor* message, + const MessageLayout& layout) { + std::vector table; + MessageLayout::Size empty_size; + empty_size.size32 = 0; + empty_size.size64 = 0; + for (int i = 0; i < 32; i++) { + table.emplace_back(TableEntry{"fastdecode_generic", empty_size}); + TryFillTableEntry(message, layout, i, table.back()); + } + return table; +} + void WriteSource(const protobuf::FileDescriptor* file, Output& output) { EmitFileWarning(file, output); @@ -803,14 +898,18 @@ void WriteSource(const protobuf::FileDescriptor* file, Output& output) { output("};\n\n"); } + std::vector table = FastDecodeTable(message, layout); + output("const upb_msglayout $0 = {\n", MessageInit(message)); output(" {\n"); - for (int i = 0; i < 32; i++) { - output(" &fastdecode_generic,\n"); + for (const auto& ent : table) { + output(" &$0,\n", ent.first); } output(" },\n"); output(" {\n"); - output(" 0\n"); + for (const auto& ent : table) { + output(" $0,\n", GetSizeInit(ent.second)); + } output(" },\n"); output(" $0,\n", submsgs_array_ref); output(" $0,\n", fields_array_ref);