Auto-generate files after cl/643036818
diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index 022fab0..8a24966 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c
@@ -487,7 +487,7 @@ // Must be last. -extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_Empty); +extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_StaticallyTreeShaken); static const upb_MiniTableSubInternal google_protobuf_FileDescriptorSet_submsgs[1] = { {.UPB_PRIVATE(submsg) = &google__protobuf__FileDescriptorProto_msg_init_ptr}, }; @@ -12615,7 +12615,12 @@ // Must be last. -// A MiniTable for an empty message, used for unlinked sub-messages. +// A MiniTable for an empty message, used for unlinked sub-messages that are +// built via MiniDescriptors. Messages that use this MiniTable may possibly +// be linked later, in which case this MiniTable will be replaced with a real +// one. This pattern is known as "dynamic tree shaking", and it introduces +// complication because sub-messages may either be the "empty" type or the +// "real" type. A tagged bit indicates the difference. const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_Empty) = { .UPB_PRIVATE(subs) = NULL, .UPB_PRIVATE(fields) = NULL, @@ -12627,6 +12632,21 @@ .UPB_PRIVATE(required_count) = 0, }; +// A MiniTable for a statically tree shaken message. Messages that use this +// MiniTable are guaranteed to remain unlinked; unlike the empty message, this +// MiniTable is never replaced, which greatly simplifies everything, because the +// type of a sub-message is always known, without consulting a tagged bit. +const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_StaticallyTreeShaken) = { + .UPB_PRIVATE(subs) = NULL, + .UPB_PRIVATE(fields) = NULL, + .UPB_PRIVATE(size) = sizeof(struct upb_Message), + .UPB_PRIVATE(field_count) = 0, + .UPB_PRIVATE(ext) = kUpb_ExtMode_NonExtendable, + .UPB_PRIVATE(dense_below) = 0, + .UPB_PRIVATE(table_mask) = -1, + .UPB_PRIVATE(required_count) = 0, +}; + // Must be last.
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index 2ffd880..9c007d7 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c
@@ -487,7 +487,7 @@ // Must be last. -extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_Empty); +extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_StaticallyTreeShaken); static const upb_MiniTableSubInternal google_protobuf_FileDescriptorSet_submsgs[1] = { {.UPB_PRIVATE(submsg) = &google__protobuf__FileDescriptorProto_msg_init_ptr}, }; @@ -12103,7 +12103,12 @@ // Must be last. -// A MiniTable for an empty message, used for unlinked sub-messages. +// A MiniTable for an empty message, used for unlinked sub-messages that are +// built via MiniDescriptors. Messages that use this MiniTable may possibly +// be linked later, in which case this MiniTable will be replaced with a real +// one. This pattern is known as "dynamic tree shaking", and it introduces +// complication because sub-messages may either be the "empty" type or the +// "real" type. A tagged bit indicates the difference. const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_Empty) = { .UPB_PRIVATE(subs) = NULL, .UPB_PRIVATE(fields) = NULL, @@ -12115,6 +12120,21 @@ .UPB_PRIVATE(required_count) = 0, }; +// A MiniTable for a statically tree shaken message. Messages that use this +// MiniTable are guaranteed to remain unlinked; unlike the empty message, this +// MiniTable is never replaced, which greatly simplifies everything, because the +// type of a sub-message is always known, without consulting a tagged bit. +const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_StaticallyTreeShaken) = { + .UPB_PRIVATE(subs) = NULL, + .UPB_PRIVATE(fields) = NULL, + .UPB_PRIVATE(size) = sizeof(struct upb_Message), + .UPB_PRIVATE(field_count) = 0, + .UPB_PRIVATE(ext) = kUpb_ExtMode_NonExtendable, + .UPB_PRIVATE(dense_below) = 0, + .UPB_PRIVATE(table_mask) = -1, + .UPB_PRIVATE(required_count) = 0, +}; + // Must be last.
diff --git a/upb/cmake/google/protobuf/descriptor.upb_minitable.c b/upb/cmake/google/protobuf/descriptor.upb_minitable.c index 05bece8..08fa451 100644 --- a/upb/cmake/google/protobuf/descriptor.upb_minitable.c +++ b/upb/cmake/google/protobuf/descriptor.upb_minitable.c
@@ -13,7 +13,7 @@ // Must be last. #include "upb/port/def.inc" -extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_Empty); +extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_StaticallyTreeShaken); static const upb_MiniTableSubInternal google_protobuf_FileDescriptorSet_submsgs[1] = { {.UPB_PRIVATE(submsg) = &google__protobuf__FileDescriptorProto_msg_init_ptr}, };
diff --git a/upb/reflection/cmake/google/protobuf/descriptor.upb_minitable.c b/upb/reflection/cmake/google/protobuf/descriptor.upb_minitable.c index 05bece8..08fa451 100644 --- a/upb/reflection/cmake/google/protobuf/descriptor.upb_minitable.c +++ b/upb/reflection/cmake/google/protobuf/descriptor.upb_minitable.c
@@ -13,7 +13,7 @@ // Must be last. #include "upb/port/def.inc" -extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_Empty); +extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_StaticallyTreeShaken); static const upb_MiniTableSubInternal google_protobuf_FileDescriptorSet_submsgs[1] = { {.UPB_PRIVATE(submsg) = &google__protobuf__FileDescriptorProto_msg_init_ptr}, };
diff --git a/upb_generator/cmake/google/protobuf/compiler/plugin.upb_minitable.c b/upb_generator/cmake/google/protobuf/compiler/plugin.upb_minitable.c index fab151b..0aaf0cd 100644 --- a/upb_generator/cmake/google/protobuf/compiler/plugin.upb_minitable.c +++ b/upb_generator/cmake/google/protobuf/compiler/plugin.upb_minitable.c
@@ -14,7 +14,7 @@ // Must be last. #include "upb/port/def.inc" -extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_Empty); +extern const struct upb_MiniTable UPB_PRIVATE(_kUpb_MiniTable_StaticallyTreeShaken); static const upb_MiniTableField google_protobuf_compiler_Version__fields[4] = { {1, 12, 64, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)}, {2, 16, 65, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},