diff --git a/cmake/google/protobuf/descriptor.upb.c b/cmake/google/protobuf/descriptor.upb.c index 932fbb3559..a6b9af9132 100644 --- a/cmake/google/protobuf/descriptor.upb.c +++ b/cmake/google/protobuf/descriptor.upb.c @@ -17,7 +17,7 @@ static const upb_msglayout *const google_protobuf_FileDescriptorSet_submsgs[1] = }; static const upb_msglayout_field google_protobuf_FileDescriptorSet__fields[1] = { - {1, UPB_SIZE(0, 0), 0, 0, 11, 3}, + {1, UPB_SIZE(0, 0), 0, 0, 11, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_FileDescriptorSet_msginit = { @@ -36,18 +36,18 @@ static const upb_msglayout *const google_protobuf_FileDescriptorProto_submsgs[6] }; static const upb_msglayout_field google_protobuf_FileDescriptorProto__fields[12] = { - {1, UPB_SIZE(4, 8), 1, 0, 12, 1}, - {2, UPB_SIZE(12, 24), 2, 0, 12, 1}, - {3, UPB_SIZE(36, 72), 0, 0, 12, 3}, - {4, UPB_SIZE(40, 80), 0, 0, 11, 3}, - {5, UPB_SIZE(44, 88), 0, 1, 11, 3}, - {6, UPB_SIZE(48, 96), 0, 4, 11, 3}, - {7, UPB_SIZE(52, 104), 0, 2, 11, 3}, - {8, UPB_SIZE(28, 56), 3, 3, 11, 1}, - {9, UPB_SIZE(32, 64), 4, 5, 11, 1}, - {10, UPB_SIZE(56, 112), 0, 0, 5, 3}, - {11, UPB_SIZE(60, 120), 0, 0, 5, 3}, - {12, UPB_SIZE(20, 40), 5, 0, 12, 1}, + {1, UPB_SIZE(4, 8), 1, 0, 12, _UPB_MODE_SCALAR}, + {2, UPB_SIZE(12, 24), 2, 0, 12, _UPB_MODE_SCALAR}, + {3, UPB_SIZE(36, 72), 0, 0, 12, _UPB_MODE_ARRAY}, + {4, UPB_SIZE(40, 80), 0, 0, 11, _UPB_MODE_ARRAY}, + {5, UPB_SIZE(44, 88), 0, 1, 11, _UPB_MODE_ARRAY}, + {6, UPB_SIZE(48, 96), 0, 4, 11, _UPB_MODE_ARRAY}, + {7, UPB_SIZE(52, 104), 0, 2, 11, _UPB_MODE_ARRAY}, + {8, UPB_SIZE(28, 56), 3, 3, 11, _UPB_MODE_SCALAR}, + {9, UPB_SIZE(32, 64), 4, 5, 11, _UPB_MODE_SCALAR}, + {10, UPB_SIZE(56, 112), 0, 0, 5, _UPB_MODE_ARRAY}, + {11, UPB_SIZE(60, 120), 0, 0, 5, _UPB_MODE_ARRAY}, + {12, UPB_SIZE(20, 40), 5, 0, 12, _UPB_MODE_SCALAR}, }; const upb_msglayout google_protobuf_FileDescriptorProto_msginit = { @@ -67,16 +67,16 @@ static const upb_msglayout *const google_protobuf_DescriptorProto_submsgs[7] = { }; static const upb_msglayout_field google_protobuf_DescriptorProto__fields[10] = { - {1, UPB_SIZE(4, 8), 1, 0, 12, 1}, - {2, UPB_SIZE(16, 32), 0, 4, 11, 3}, - {3, UPB_SIZE(20, 40), 0, 0, 11, 3}, - {4, UPB_SIZE(24, 48), 0, 3, 11, 3}, - {5, UPB_SIZE(28, 56), 0, 1, 11, 3}, - {6, UPB_SIZE(32, 64), 0, 4, 11, 3}, - {7, UPB_SIZE(12, 24), 2, 5, 11, 1}, - {8, UPB_SIZE(36, 72), 0, 6, 11, 3}, - {9, UPB_SIZE(40, 80), 0, 2, 11, 3}, - {10, UPB_SIZE(44, 88), 0, 0, 12, 3}, + {1, UPB_SIZE(4, 8), 1, 0, 12, _UPB_MODE_SCALAR}, + {2, UPB_SIZE(16, 32), 0, 4, 11, _UPB_MODE_ARRAY}, + {3, UPB_SIZE(20, 40), 0, 0, 11, _UPB_MODE_ARRAY}, + {4, UPB_SIZE(24, 48), 0, 3, 11, _UPB_MODE_ARRAY}, + {5, UPB_SIZE(28, 56), 0, 1, 11, _UPB_MODE_ARRAY}, + {6, UPB_SIZE(32, 64), 0, 4, 11, _UPB_MODE_ARRAY}, + {7, UPB_SIZE(12, 24), 2, 5, 11, _UPB_MODE_SCALAR}, + {8, UPB_SIZE(36, 72), 0, 6, 11, _UPB_MODE_ARRAY}, + {9, UPB_SIZE(40, 80), 0, 2, 11, _UPB_MODE_ARRAY}, + {10, UPB_SIZE(44, 88), 0, 0, 12, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_DescriptorProto_msginit = { @@ -90,9 +90,9 @@ static const upb_msglayout *const google_protobuf_DescriptorProto_ExtensionRange }; static const upb_msglayout_field google_protobuf_DescriptorProto_ExtensionRange__fields[3] = { - {1, UPB_SIZE(4, 4), 1, 0, 5, 1}, - {2, UPB_SIZE(8, 8), 2, 0, 5, 1}, - {3, UPB_SIZE(12, 16), 3, 0, 11, 1}, + {1, UPB_SIZE(4, 4), 1, 0, 5, _UPB_MODE_SCALAR}, + {2, UPB_SIZE(8, 8), 2, 0, 5, _UPB_MODE_SCALAR}, + {3, UPB_SIZE(12, 16), 3, 0, 11, _UPB_MODE_SCALAR}, }; const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { @@ -102,8 +102,8 @@ const upb_msglayout google_protobuf_DescriptorProto_ExtensionRange_msginit = { }; static const upb_msglayout_field google_protobuf_DescriptorProto_ReservedRange__fields[2] = { - {1, UPB_SIZE(4, 4), 1, 0, 5, 1}, - {2, UPB_SIZE(8, 8), 2, 0, 5, 1}, + {1, UPB_SIZE(4, 4), 1, 0, 5, _UPB_MODE_SCALAR}, + {2, UPB_SIZE(8, 8), 2, 0, 5, _UPB_MODE_SCALAR}, }; const upb_msglayout google_protobuf_DescriptorProto_ReservedRange_msginit = { @@ -117,7 +117,7 @@ static const upb_msglayout *const google_protobuf_ExtensionRangeOptions_submsgs[ }; static const upb_msglayout_field google_protobuf_ExtensionRangeOptions__fields[1] = { - {999, UPB_SIZE(0, 0), 0, 0, 11, 3}, + {999, UPB_SIZE(0, 0), 0, 0, 11, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_ExtensionRangeOptions_msginit = { @@ -131,17 +131,17 @@ static const upb_msglayout *const google_protobuf_FieldDescriptorProto_submsgs[1 }; static const upb_msglayout_field google_protobuf_FieldDescriptorProto__fields[11] = { - {1, UPB_SIZE(24, 24), 1, 0, 12, 1}, - {2, UPB_SIZE(32, 40), 2, 0, 12, 1}, - {3, UPB_SIZE(12, 12), 3, 0, 5, 1}, - {4, UPB_SIZE(4, 4), 4, 0, 14, 1}, - {5, UPB_SIZE(8, 8), 5, 0, 14, 1}, - {6, UPB_SIZE(40, 56), 6, 0, 12, 1}, - {7, UPB_SIZE(48, 72), 7, 0, 12, 1}, - {8, UPB_SIZE(64, 104), 8, 0, 11, 1}, - {9, UPB_SIZE(16, 16), 9, 0, 5, 1}, - {10, UPB_SIZE(56, 88), 10, 0, 12, 1}, - {17, UPB_SIZE(20, 20), 11, 0, 8, 1}, + {1, UPB_SIZE(24, 24), 1, 0, 12, _UPB_MODE_SCALAR}, + {2, UPB_SIZE(32, 40), 2, 0, 12, _UPB_MODE_SCALAR}, + {3, UPB_SIZE(12, 12), 3, 0, 5, _UPB_MODE_SCALAR}, + {4, UPB_SIZE(4, 4), 4, 0, 14, _UPB_MODE_SCALAR}, + {5, UPB_SIZE(8, 8), 5, 0, 14, _UPB_MODE_SCALAR}, + {6, UPB_SIZE(40, 56), 6, 0, 12, _UPB_MODE_SCALAR}, + {7, UPB_SIZE(48, 72), 7, 0, 12, _UPB_MODE_SCALAR}, + {8, UPB_SIZE(64, 104), 8, 0, 11, _UPB_MODE_SCALAR}, + {9, UPB_SIZE(16, 16), 9, 0, 5, _UPB_MODE_SCALAR}, + {10, UPB_SIZE(56, 88), 10, 0, 12, _UPB_MODE_SCALAR}, + {17, UPB_SIZE(20, 20), 11, 0, 8, _UPB_MODE_SCALAR}, }; const upb_msglayout google_protobuf_FieldDescriptorProto_msginit = { @@ -155,8 +155,8 @@ static const upb_msglayout *const google_protobuf_OneofDescriptorProto_submsgs[1 }; static const upb_msglayout_field google_protobuf_OneofDescriptorProto__fields[2] = { - {1, UPB_SIZE(4, 8), 1, 0, 12, 1}, - {2, UPB_SIZE(12, 24), 2, 0, 11, 1}, + {1, UPB_SIZE(4, 8), 1, 0, 12, _UPB_MODE_SCALAR}, + {2, UPB_SIZE(12, 24), 2, 0, 11, _UPB_MODE_SCALAR}, }; const upb_msglayout google_protobuf_OneofDescriptorProto_msginit = { @@ -172,11 +172,11 @@ static const upb_msglayout *const google_protobuf_EnumDescriptorProto_submsgs[3] }; static const upb_msglayout_field google_protobuf_EnumDescriptorProto__fields[5] = { - {1, UPB_SIZE(4, 8), 1, 0, 12, 1}, - {2, UPB_SIZE(16, 32), 0, 2, 11, 3}, - {3, UPB_SIZE(12, 24), 2, 1, 11, 1}, - {4, UPB_SIZE(20, 40), 0, 0, 11, 3}, - {5, UPB_SIZE(24, 48), 0, 0, 12, 3}, + {1, UPB_SIZE(4, 8), 1, 0, 12, _UPB_MODE_SCALAR}, + {2, UPB_SIZE(16, 32), 0, 2, 11, _UPB_MODE_ARRAY}, + {3, UPB_SIZE(12, 24), 2, 1, 11, _UPB_MODE_SCALAR}, + {4, UPB_SIZE(20, 40), 0, 0, 11, _UPB_MODE_ARRAY}, + {5, UPB_SIZE(24, 48), 0, 0, 12, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { @@ -186,8 +186,8 @@ const upb_msglayout google_protobuf_EnumDescriptorProto_msginit = { }; static const upb_msglayout_field google_protobuf_EnumDescriptorProto_EnumReservedRange__fields[2] = { - {1, UPB_SIZE(4, 4), 1, 0, 5, 1}, - {2, UPB_SIZE(8, 8), 2, 0, 5, 1}, + {1, UPB_SIZE(4, 4), 1, 0, 5, _UPB_MODE_SCALAR}, + {2, UPB_SIZE(8, 8), 2, 0, 5, _UPB_MODE_SCALAR}, }; const upb_msglayout google_protobuf_EnumDescriptorProto_EnumReservedRange_msginit = { @@ -201,9 +201,9 @@ static const upb_msglayout *const google_protobuf_EnumValueDescriptorProto_subms }; static const upb_msglayout_field google_protobuf_EnumValueDescriptorProto__fields[3] = { - {1, UPB_SIZE(8, 8), 1, 0, 12, 1}, - {2, UPB_SIZE(4, 4), 2, 0, 5, 1}, - {3, UPB_SIZE(16, 24), 3, 0, 11, 1}, + {1, UPB_SIZE(8, 8), 1, 0, 12, _UPB_MODE_SCALAR}, + {2, UPB_SIZE(4, 4), 2, 0, 5, _UPB_MODE_SCALAR}, + {3, UPB_SIZE(16, 24), 3, 0, 11, _UPB_MODE_SCALAR}, }; const upb_msglayout google_protobuf_EnumValueDescriptorProto_msginit = { @@ -218,9 +218,9 @@ static const upb_msglayout *const google_protobuf_ServiceDescriptorProto_submsgs }; static const upb_msglayout_field google_protobuf_ServiceDescriptorProto__fields[3] = { - {1, UPB_SIZE(4, 8), 1, 0, 12, 1}, - {2, UPB_SIZE(16, 32), 0, 0, 11, 3}, - {3, UPB_SIZE(12, 24), 2, 1, 11, 1}, + {1, UPB_SIZE(4, 8), 1, 0, 12, _UPB_MODE_SCALAR}, + {2, UPB_SIZE(16, 32), 0, 0, 11, _UPB_MODE_ARRAY}, + {3, UPB_SIZE(12, 24), 2, 1, 11, _UPB_MODE_SCALAR}, }; const upb_msglayout google_protobuf_ServiceDescriptorProto_msginit = { @@ -234,12 +234,12 @@ static const upb_msglayout *const google_protobuf_MethodDescriptorProto_submsgs[ }; static const upb_msglayout_field google_protobuf_MethodDescriptorProto__fields[6] = { - {1, UPB_SIZE(4, 8), 1, 0, 12, 1}, - {2, UPB_SIZE(12, 24), 2, 0, 12, 1}, - {3, UPB_SIZE(20, 40), 3, 0, 12, 1}, - {4, UPB_SIZE(28, 56), 4, 0, 11, 1}, - {5, UPB_SIZE(1, 1), 5, 0, 8, 1}, - {6, UPB_SIZE(2, 2), 6, 0, 8, 1}, + {1, UPB_SIZE(4, 8), 1, 0, 12, _UPB_MODE_SCALAR}, + {2, UPB_SIZE(12, 24), 2, 0, 12, _UPB_MODE_SCALAR}, + {3, UPB_SIZE(20, 40), 3, 0, 12, _UPB_MODE_SCALAR}, + {4, UPB_SIZE(28, 56), 4, 0, 11, _UPB_MODE_SCALAR}, + {5, UPB_SIZE(1, 1), 5, 0, 8, _UPB_MODE_SCALAR}, + {6, UPB_SIZE(2, 2), 6, 0, 8, _UPB_MODE_SCALAR}, }; const upb_msglayout google_protobuf_MethodDescriptorProto_msginit = { @@ -253,27 +253,27 @@ static const upb_msglayout *const google_protobuf_FileOptions_submsgs[1] = { }; static const upb_msglayout_field google_protobuf_FileOptions__fields[21] = { - {1, UPB_SIZE(20, 24), 1, 0, 12, 1}, - {8, UPB_SIZE(28, 40), 2, 0, 12, 1}, - {9, UPB_SIZE(4, 4), 3, 0, 14, 1}, - {10, UPB_SIZE(8, 8), 4, 0, 8, 1}, - {11, UPB_SIZE(36, 56), 5, 0, 12, 1}, - {16, UPB_SIZE(9, 9), 6, 0, 8, 1}, - {17, UPB_SIZE(10, 10), 7, 0, 8, 1}, - {18, UPB_SIZE(11, 11), 8, 0, 8, 1}, - {20, UPB_SIZE(12, 12), 9, 0, 8, 1}, - {23, UPB_SIZE(13, 13), 10, 0, 8, 1}, - {27, UPB_SIZE(14, 14), 11, 0, 8, 1}, - {31, UPB_SIZE(15, 15), 12, 0, 8, 1}, - {36, UPB_SIZE(44, 72), 13, 0, 12, 1}, - {37, UPB_SIZE(52, 88), 14, 0, 12, 1}, - {39, UPB_SIZE(60, 104), 15, 0, 12, 1}, - {40, UPB_SIZE(68, 120), 16, 0, 12, 1}, - {41, UPB_SIZE(76, 136), 17, 0, 12, 1}, - {42, UPB_SIZE(16, 16), 18, 0, 8, 1}, - {44, UPB_SIZE(84, 152), 19, 0, 12, 1}, - {45, UPB_SIZE(92, 168), 20, 0, 12, 1}, - {999, UPB_SIZE(100, 184), 0, 0, 11, 3}, + {1, UPB_SIZE(20, 24), 1, 0, 12, _UPB_MODE_SCALAR}, + {8, UPB_SIZE(28, 40), 2, 0, 12, _UPB_MODE_SCALAR}, + {9, UPB_SIZE(4, 4), 3, 0, 14, _UPB_MODE_SCALAR}, + {10, UPB_SIZE(8, 8), 4, 0, 8, _UPB_MODE_SCALAR}, + {11, UPB_SIZE(36, 56), 5, 0, 12, _UPB_MODE_SCALAR}, + {16, UPB_SIZE(9, 9), 6, 0, 8, _UPB_MODE_SCALAR}, + {17, UPB_SIZE(10, 10), 7, 0, 8, _UPB_MODE_SCALAR}, + {18, UPB_SIZE(11, 11), 8, 0, 8, _UPB_MODE_SCALAR}, + {20, UPB_SIZE(12, 12), 9, 0, 8, _UPB_MODE_SCALAR}, + {23, UPB_SIZE(13, 13), 10, 0, 8, _UPB_MODE_SCALAR}, + {27, UPB_SIZE(14, 14), 11, 0, 8, _UPB_MODE_SCALAR}, + {31, UPB_SIZE(15, 15), 12, 0, 8, _UPB_MODE_SCALAR}, + {36, UPB_SIZE(44, 72), 13, 0, 12, _UPB_MODE_SCALAR}, + {37, UPB_SIZE(52, 88), 14, 0, 12, _UPB_MODE_SCALAR}, + {39, UPB_SIZE(60, 104), 15, 0, 12, _UPB_MODE_SCALAR}, + {40, UPB_SIZE(68, 120), 16, 0, 12, _UPB_MODE_SCALAR}, + {41, UPB_SIZE(76, 136), 17, 0, 12, _UPB_MODE_SCALAR}, + {42, UPB_SIZE(16, 16), 18, 0, 8, _UPB_MODE_SCALAR}, + {44, UPB_SIZE(84, 152), 19, 0, 12, _UPB_MODE_SCALAR}, + {45, UPB_SIZE(92, 168), 20, 0, 12, _UPB_MODE_SCALAR}, + {999, UPB_SIZE(100, 184), 0, 0, 11, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_FileOptions_msginit = { @@ -287,11 +287,11 @@ static const upb_msglayout *const google_protobuf_MessageOptions_submsgs[1] = { }; static const upb_msglayout_field google_protobuf_MessageOptions__fields[5] = { - {1, UPB_SIZE(1, 1), 1, 0, 8, 1}, - {2, UPB_SIZE(2, 2), 2, 0, 8, 1}, - {3, UPB_SIZE(3, 3), 3, 0, 8, 1}, - {7, UPB_SIZE(4, 4), 4, 0, 8, 1}, - {999, UPB_SIZE(8, 8), 0, 0, 11, 3}, + {1, UPB_SIZE(1, 1), 1, 0, 8, _UPB_MODE_SCALAR}, + {2, UPB_SIZE(2, 2), 2, 0, 8, _UPB_MODE_SCALAR}, + {3, UPB_SIZE(3, 3), 3, 0, 8, _UPB_MODE_SCALAR}, + {7, UPB_SIZE(4, 4), 4, 0, 8, _UPB_MODE_SCALAR}, + {999, UPB_SIZE(8, 8), 0, 0, 11, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_MessageOptions_msginit = { @@ -305,13 +305,13 @@ static const upb_msglayout *const google_protobuf_FieldOptions_submsgs[1] = { }; static const upb_msglayout_field google_protobuf_FieldOptions__fields[7] = { - {1, UPB_SIZE(4, 4), 1, 0, 14, 1}, - {2, UPB_SIZE(12, 12), 2, 0, 8, 1}, - {3, UPB_SIZE(13, 13), 3, 0, 8, 1}, - {5, UPB_SIZE(14, 14), 4, 0, 8, 1}, - {6, UPB_SIZE(8, 8), 5, 0, 14, 1}, - {10, UPB_SIZE(15, 15), 6, 0, 8, 1}, - {999, UPB_SIZE(16, 16), 0, 0, 11, 3}, + {1, UPB_SIZE(4, 4), 1, 0, 14, _UPB_MODE_SCALAR}, + {2, UPB_SIZE(12, 12), 2, 0, 8, _UPB_MODE_SCALAR}, + {3, UPB_SIZE(13, 13), 3, 0, 8, _UPB_MODE_SCALAR}, + {5, UPB_SIZE(14, 14), 4, 0, 8, _UPB_MODE_SCALAR}, + {6, UPB_SIZE(8, 8), 5, 0, 14, _UPB_MODE_SCALAR}, + {10, UPB_SIZE(15, 15), 6, 0, 8, _UPB_MODE_SCALAR}, + {999, UPB_SIZE(16, 16), 0, 0, 11, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_FieldOptions_msginit = { @@ -325,7 +325,7 @@ static const upb_msglayout *const google_protobuf_OneofOptions_submsgs[1] = { }; static const upb_msglayout_field google_protobuf_OneofOptions__fields[1] = { - {999, UPB_SIZE(0, 0), 0, 0, 11, 3}, + {999, UPB_SIZE(0, 0), 0, 0, 11, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_OneofOptions_msginit = { @@ -339,9 +339,9 @@ static const upb_msglayout *const google_protobuf_EnumOptions_submsgs[1] = { }; static const upb_msglayout_field google_protobuf_EnumOptions__fields[3] = { - {2, UPB_SIZE(1, 1), 1, 0, 8, 1}, - {3, UPB_SIZE(2, 2), 2, 0, 8, 1}, - {999, UPB_SIZE(4, 8), 0, 0, 11, 3}, + {2, UPB_SIZE(1, 1), 1, 0, 8, _UPB_MODE_SCALAR}, + {3, UPB_SIZE(2, 2), 2, 0, 8, _UPB_MODE_SCALAR}, + {999, UPB_SIZE(4, 8), 0, 0, 11, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_EnumOptions_msginit = { @@ -355,8 +355,8 @@ static const upb_msglayout *const google_protobuf_EnumValueOptions_submsgs[1] = }; static const upb_msglayout_field google_protobuf_EnumValueOptions__fields[2] = { - {1, UPB_SIZE(1, 1), 1, 0, 8, 1}, - {999, UPB_SIZE(4, 8), 0, 0, 11, 3}, + {1, UPB_SIZE(1, 1), 1, 0, 8, _UPB_MODE_SCALAR}, + {999, UPB_SIZE(4, 8), 0, 0, 11, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_EnumValueOptions_msginit = { @@ -370,8 +370,8 @@ static const upb_msglayout *const google_protobuf_ServiceOptions_submsgs[1] = { }; static const upb_msglayout_field google_protobuf_ServiceOptions__fields[2] = { - {33, UPB_SIZE(1, 1), 1, 0, 8, 1}, - {999, UPB_SIZE(4, 8), 0, 0, 11, 3}, + {33, UPB_SIZE(1, 1), 1, 0, 8, _UPB_MODE_SCALAR}, + {999, UPB_SIZE(4, 8), 0, 0, 11, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_ServiceOptions_msginit = { @@ -385,9 +385,9 @@ static const upb_msglayout *const google_protobuf_MethodOptions_submsgs[1] = { }; static const upb_msglayout_field google_protobuf_MethodOptions__fields[3] = { - {33, UPB_SIZE(8, 8), 1, 0, 8, 1}, - {34, UPB_SIZE(4, 4), 2, 0, 14, 1}, - {999, UPB_SIZE(12, 16), 0, 0, 11, 3}, + {33, UPB_SIZE(8, 8), 1, 0, 8, _UPB_MODE_SCALAR}, + {34, UPB_SIZE(4, 4), 2, 0, 14, _UPB_MODE_SCALAR}, + {999, UPB_SIZE(12, 16), 0, 0, 11, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_MethodOptions_msginit = { @@ -401,13 +401,13 @@ static const upb_msglayout *const google_protobuf_UninterpretedOption_submsgs[1] }; static const upb_msglayout_field google_protobuf_UninterpretedOption__fields[7] = { - {2, UPB_SIZE(56, 80), 0, 0, 11, 3}, - {3, UPB_SIZE(32, 32), 1, 0, 12, 1}, - {4, UPB_SIZE(8, 8), 2, 0, 4, 1}, - {5, UPB_SIZE(16, 16), 3, 0, 3, 1}, - {6, UPB_SIZE(24, 24), 4, 0, 1, 1}, - {7, UPB_SIZE(40, 48), 5, 0, 12, 1}, - {8, UPB_SIZE(48, 64), 6, 0, 12, 1}, + {2, UPB_SIZE(56, 80), 0, 0, 11, _UPB_MODE_ARRAY}, + {3, UPB_SIZE(32, 32), 1, 0, 12, _UPB_MODE_SCALAR}, + {4, UPB_SIZE(8, 8), 2, 0, 4, _UPB_MODE_SCALAR}, + {5, UPB_SIZE(16, 16), 3, 0, 3, _UPB_MODE_SCALAR}, + {6, UPB_SIZE(24, 24), 4, 0, 1, _UPB_MODE_SCALAR}, + {7, UPB_SIZE(40, 48), 5, 0, 12, _UPB_MODE_SCALAR}, + {8, UPB_SIZE(48, 64), 6, 0, 12, _UPB_MODE_SCALAR}, }; const upb_msglayout google_protobuf_UninterpretedOption_msginit = { @@ -417,8 +417,8 @@ const upb_msglayout google_protobuf_UninterpretedOption_msginit = { }; static const upb_msglayout_field google_protobuf_UninterpretedOption_NamePart__fields[2] = { - {1, UPB_SIZE(4, 8), 1, 0, 12, 2}, - {2, UPB_SIZE(1, 1), 2, 0, 8, 2}, + {1, UPB_SIZE(4, 8), 1, 0, 12, _UPB_MODE_SCALAR}, + {2, UPB_SIZE(1, 1), 2, 0, 8, _UPB_MODE_SCALAR}, }; const upb_msglayout google_protobuf_UninterpretedOption_NamePart_msginit = { @@ -432,7 +432,7 @@ static const upb_msglayout *const google_protobuf_SourceCodeInfo_submsgs[1] = { }; static const upb_msglayout_field google_protobuf_SourceCodeInfo__fields[1] = { - {1, UPB_SIZE(0, 0), 0, 0, 11, 3}, + {1, UPB_SIZE(0, 0), 0, 0, 11, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { @@ -442,11 +442,11 @@ const upb_msglayout google_protobuf_SourceCodeInfo_msginit = { }; static const upb_msglayout_field google_protobuf_SourceCodeInfo_Location__fields[5] = { - {1, UPB_SIZE(20, 40), 0, 0, 5, _UPB_LABEL_PACKED}, - {2, UPB_SIZE(24, 48), 0, 0, 5, _UPB_LABEL_PACKED}, - {3, UPB_SIZE(4, 8), 1, 0, 12, 1}, - {4, UPB_SIZE(12, 24), 2, 0, 12, 1}, - {6, UPB_SIZE(28, 56), 0, 0, 12, 3}, + {1, UPB_SIZE(20, 40), 0, 0, 5, _UPB_MODE_ARRAY | _UPB_MODE_IS_PACKED}, + {2, UPB_SIZE(24, 48), 0, 0, 5, _UPB_MODE_ARRAY | _UPB_MODE_IS_PACKED}, + {3, UPB_SIZE(4, 8), 1, 0, 12, _UPB_MODE_SCALAR}, + {4, UPB_SIZE(12, 24), 2, 0, 12, _UPB_MODE_SCALAR}, + {6, UPB_SIZE(28, 56), 0, 0, 12, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_SourceCodeInfo_Location_msginit = { @@ -460,7 +460,7 @@ static const upb_msglayout *const google_protobuf_GeneratedCodeInfo_submsgs[1] = }; static const upb_msglayout_field google_protobuf_GeneratedCodeInfo__fields[1] = { - {1, UPB_SIZE(0, 0), 0, 0, 11, 3}, + {1, UPB_SIZE(0, 0), 0, 0, 11, _UPB_MODE_ARRAY}, }; const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { @@ -470,10 +470,10 @@ const upb_msglayout google_protobuf_GeneratedCodeInfo_msginit = { }; static const upb_msglayout_field google_protobuf_GeneratedCodeInfo_Annotation__fields[4] = { - {1, UPB_SIZE(20, 32), 0, 0, 5, _UPB_LABEL_PACKED}, - {2, UPB_SIZE(12, 16), 1, 0, 12, 1}, - {3, UPB_SIZE(4, 4), 2, 0, 5, 1}, - {4, UPB_SIZE(8, 8), 3, 0, 5, 1}, + {1, UPB_SIZE(20, 32), 0, 0, 5, _UPB_MODE_ARRAY | _UPB_MODE_IS_PACKED}, + {2, UPB_SIZE(12, 16), 1, 0, 12, _UPB_MODE_SCALAR}, + {3, UPB_SIZE(4, 4), 2, 0, 5, _UPB_MODE_SCALAR}, + {4, UPB_SIZE(8, 8), 3, 0, 5, _UPB_MODE_SCALAR}, }; const upb_msglayout google_protobuf_GeneratedCodeInfo_Annotation_msginit = { diff --git a/upb/decode.c b/upb/decode.c index 56aef0afda..1bd091ec9f 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -641,7 +641,7 @@ static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, case UPB_WIRE_TYPE_DELIMITED: { int ndx = field->descriptortype; uint64_t size; - if (_upb_isrepeated(field)) ndx += 18; + if (_upb_getmode(field) == _UPB_MODE_ARRAY) ndx += 18; ptr = decode_varint64(d, ptr, &size); if (size >= INT32_MAX || ptr - d->end + (int32_t)size > d->limit) { @@ -665,17 +665,18 @@ static const char *decode_msg(upb_decstate *d, const char *ptr, upb_msg *msg, if (op >= 0) { /* Parse, using op for dispatch. */ - switch (field->label) { - case UPB_LABEL_REPEATED: - case _UPB_LABEL_PACKED: + switch (_upb_getmode(field)) { + case _UPB_MODE_ARRAY: ptr = decode_toarray(d, ptr, msg, layout->submsgs, field, &val, op); break; - case _UPB_LABEL_MAP: + case _UPB_MODE_MAP: ptr = decode_tomap(d, ptr, msg, layout->submsgs, field, &val); break; - default: + case _UPB_MODE_SCALAR: ptr = decode_tomsg(d, ptr, msg, layout->submsgs, field, &val, op); break; + default: + UPB_UNREACHABLE(); } } else { unknown: diff --git a/upb/def.c b/upb/def.c index 5394955b12..599f42e5be 100644 --- a/upb/def.c +++ b/upb/def.c @@ -1035,6 +1035,30 @@ static void assign_layout_indices(const upb_msgdef *m, upb_msglayout *l, l->dense_below = dense_below; } +static void fill_fieldlayout(upb_msglayout_field *field, const upb_fielddef *f) { + field->number = upb_fielddef_number(f); + field->descriptortype = upb_fielddef_descriptortype(f); + + if (field->descriptortype == UPB_DTYPE_STRING && + f->file->syntax == UPB_SYNTAX_PROTO2) { + /* See TableDescriptorType() in upbc/generator.cc for details and + * rationale. */ + field->descriptortype = UPB_DTYPE_BYTES; + } + + if (upb_fielddef_ismap(f)) { + field->mode = _UPB_MODE_MAP; + } else if (upb_fielddef_isseq(f)) { + field->mode = _UPB_MODE_ARRAY; + } else { + field->mode = _UPB_MODE_SCALAR; + } + + if (upb_fielddef_packed(f)) { + field->mode |= _UPB_MODE_IS_PACKED; + } +} + /* This function is the dynamic equivalent of message_layout.{cc,h} in upbc. * It computes a dynamic layout for all of the fields in |m|. */ static void make_layout(symtab_addctx *ctx, const upb_msgdef *m) { @@ -1076,8 +1100,8 @@ static void make_layout(symtab_addctx *ctx, const upb_msgdef *m) { const upb_fielddef *val = upb_msgdef_itof(m, 2); fields[0].number = 1; fields[1].number = 2; - fields[0].label = UPB_LABEL_OPTIONAL; - fields[1].label = UPB_LABEL_OPTIONAL; + fields[0].mode = _UPB_MODE_SCALAR; + fields[1].mode = _UPB_MODE_SCALAR; fields[0].presence = 0; fields[1].presence = 0; fields[0].descriptortype = upb_fielddef_descriptortype(key); @@ -1113,22 +1137,7 @@ static void make_layout(symtab_addctx *ctx, const upb_msgdef *m) { upb_fielddef* f = upb_msg_iter_field(&it); upb_msglayout_field *field = &fields[upb_fielddef_index(f)]; - field->number = upb_fielddef_number(f); - field->descriptortype = upb_fielddef_descriptortype(f); - field->label = upb_fielddef_label(f); - - if (field->descriptortype == UPB_DTYPE_STRING && - f->file->syntax == UPB_SYNTAX_PROTO2) { - /* See TableDescriptorType() in upbc/generator.cc for details and - * rationale. */ - field->descriptortype = UPB_DTYPE_BYTES; - } - - if (upb_fielddef_ismap(f)) { - field->label = _UPB_LABEL_MAP; - } else if (upb_fielddef_packed(f)) { - field->label = _UPB_LABEL_PACKED; - } + fill_fieldlayout(field, f); if (upb_fielddef_issubmsg(f)) { const upb_msgdef *subm = upb_fielddef_msgsubdef(f); diff --git a/upb/encode.c b/upb/encode.c index f3149f2b31..6c5bfaf6ff 100644 --- a/upb/encode.c +++ b/upb/encode.c @@ -183,7 +183,7 @@ static void encode_fixedarray(upb_encstate *e, const upb_array *arr, } } -static void encode_message(upb_encstate *e, const char *msg, +static void encode_message(upb_encstate *e, const upb_msg *msg, const upb_msglayout *m, size_t *size); static void encode_scalar(upb_encstate *e, const void *_field_mem, @@ -275,10 +275,10 @@ static void encode_scalar(upb_encstate *e, const void *_field_mem, encode_tag(e, f->number, wire_type); } -static void encode_array(upb_encstate *e, const char *field_mem, +static void encode_array(upb_encstate *e, const upb_msg *msg, const upb_msglayout *m, const upb_msglayout_field *f) { - const upb_array *arr = *(const upb_array**)field_mem; - bool packed = f->label == _UPB_LABEL_PACKED; + const upb_array *arr = *UPB_PTR_AT(msg, f->offset, upb_array*); + bool packed = f->mode & _UPB_MODE_IS_PACKED; size_t pre_len = e->limit - e->ptr; if (arr == NULL || arr->len == 0) { @@ -394,9 +394,9 @@ static void encode_mapentry(upb_encstate *e, uint32_t number, encode_tag(e, number, UPB_WIRE_TYPE_DELIMITED); } -static void encode_map(upb_encstate *e, const char *field_mem, +static void encode_map(upb_encstate *e, const upb_msg *msg, const upb_msglayout *m, const upb_msglayout_field *f) { - const upb_map *map = *(const upb_map**)field_mem; + const upb_map *map = *UPB_PTR_AT(msg, f->offset, const upb_map*); const upb_msglayout *layout = m->submsgs[f->submsg_index]; UPB_ASSERT(layout->field_count == 2); @@ -442,7 +442,7 @@ static void encode_scalarfield(upb_encstate *e, const char *msg, encode_scalar(e, msg + f->offset, m, f, skip_empty); } -static void encode_message(upb_encstate *e, const char *msg, +static void encode_message(upb_encstate *e, const upb_msg *msg, const upb_msglayout *m, size_t *size) { size_t pre_len = e->limit - e->ptr; const upb_msglayout_field *f = &m->fields[m->field_count]; @@ -459,12 +459,18 @@ static void encode_message(upb_encstate *e, const char *msg, while (f != first) { f--; - if (_upb_isrepeated(f)) { - encode_array(e, msg + f->offset, m, f); - } else if (f->label == _UPB_LABEL_MAP) { - encode_map(e, msg + f->offset, m, f); - } else { - encode_scalarfield(e, msg, m, f); + switch (_upb_getmode(f)) { + case _UPB_MODE_ARRAY: + encode_array(e, msg, m, f); + break; + case _UPB_MODE_MAP: + encode_map(e, msg, m, f); + break; + case _UPB_MODE_SCALAR: + encode_scalarfield(e, msg, m, f); + break; + default: + UPB_UNREACHABLE(); } } diff --git a/upb/msg_internal.h b/upb/msg_internal.h index 9fefd53fb4..08af923734 100644 --- a/upb/msg_internal.h +++ b/upb/msg_internal.h @@ -42,9 +42,34 @@ typedef struct { int16_t presence; /* If >0, hasbit_index. If <0, ~oneof_index. */ uint16_t submsg_index; /* undefined if descriptortype != MESSAGE or GROUP. */ uint8_t descriptortype; - uint8_t label; /* google.protobuf.Label or _UPB_LABEL_* above. */ + int8_t mode; /* upb_fieldmode, with flags from upb_labelflags */ } upb_msglayout_field; +typedef enum { + _UPB_MODE_MAP = 0, + _UPB_MODE_ARRAY = 1, + _UPB_MODE_SCALAR = 2, +} upb_fieldmode; + +/* Extra flags on the mode field. */ +enum upb_labelflags { + _UPB_MODE_IS_PACKED = 4, +}; + +UPB_INLINE upb_fieldmode _upb_getmode(const upb_msglayout_field *field) { + return (upb_fieldmode)(field->mode & 3); +} + +UPB_INLINE bool _upb_repeated_or_map(const upb_msglayout_field *field) { + /* This works because upb_fieldmode has no value 3. */ + return !(field->mode & _UPB_MODE_SCALAR); +} + +UPB_INLINE bool _upb_issubmsg(const upb_msglayout_field *field) { + return field->descriptortype == UPB_DTYPE_MESSAGE || + field->descriptortype == UPB_DTYPE_GROUP; +} + struct upb_decstate; struct upb_msglayout; @@ -188,14 +213,6 @@ UPB_INLINE bool _upb_has_submsg_nohasbit(const upb_msg *msg, size_t ofs) { return *UPB_PTR_AT(msg, ofs, const upb_msg*) != NULL; } -UPB_INLINE bool _upb_isrepeated(const upb_msglayout_field *field) { - return (field->label & 3) == UPB_LABEL_REPEATED; -} - -UPB_INLINE bool _upb_repeated_or_map(const upb_msglayout_field *field) { - return field->label >= UPB_LABEL_REPEATED; -} - /** upb_array *****************************************************************/ /* Our internal representation for repeated fields. */ diff --git a/upbc/protoc-gen-upb.cc b/upbc/protoc-gen-upb.cc index e809fa66c2..79db357dd3 100644 --- a/upbc/protoc-gen-upb.cc +++ b/upbc/protoc-gen-upb.cc @@ -846,18 +846,21 @@ std::vector FastDecodeTable(const protobuf::Descriptor* message, void WriteField(const protobuf::FieldDescriptor* field, absl::string_view offset, absl::string_view presence, int submsg_index, Output& output) { - - std::string label; + std::string mode; if (field->is_map()) { - label = "_UPB_LABEL_MAP"; - } else if (field->is_packed()) { - label = "_UPB_LABEL_PACKED"; + mode = "_UPB_MODE_MAP"; + } else if (field->is_repeated()) { + mode = "_UPB_MODE_ARRAY"; } else { - label = absl::StrCat(field->label()); + mode = "_UPB_MODE_SCALAR"; + } + + if (field->is_packed()) { + absl::StrAppend(&mode, " | _UPB_MODE_IS_PACKED"); } output("{$0, $1, $2, $3, $4, $5}", field->number(), offset, presence, - submsg_index, TableDescriptorType(field), label); + submsg_index, TableDescriptorType(field), mode); } // Writes a single field into a .upb.c source file.