Auto-generate files after cl/651113583
diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c
index f047146..180b2a9 100644
--- a/php/ext/google/protobuf/php-upb.c
+++ b/php/ext/google/protobuf/php-upb.c
@@ -5871,74 +5871,18 @@
 
 // Must be last.
 
-#define kUpb_BaseField_Begin ((size_t)-1)
-#define kUpb_Extension_Begin ((size_t)-1)
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-static bool _upb_Message_NextBaseField(const upb_Message* msg,
-                                       const upb_MiniTable* m,
-                                       const upb_MiniTableField** out_f,
-                                       upb_MessageValue* out_v, size_t* iter) {
-  const size_t count = upb_MiniTable_FieldCount(m);
-  size_t i = *iter;
-
-  while (++i < count) {
-    const upb_MiniTableField* f = upb_MiniTable_GetFieldByIndex(m, i);
-    const void* src = UPB_PRIVATE(_upb_Message_DataPtr)(msg, f);
-
-    upb_MessageValue val;
-    UPB_PRIVATE(_upb_MiniTableField_DataCopy)(f, &val, src);
-
-    // Skip field if unset or empty.
-    if (upb_MiniTableField_HasPresence(f)) {
-      if (!upb_Message_HasBaseField(msg, f)) continue;
-    } else {
-      if (UPB_PRIVATE(_upb_MiniTableField_DataIsZero)(f, src)) continue;
-
-      if (upb_MiniTableField_IsArray(f)) {
-        if (upb_Array_Size(val.array_val) == 0) continue;
-      } else if (upb_MiniTableField_IsMap(f)) {
-        if (upb_Map_Size(val.map_val) == 0) continue;
-      }
-    }
-
-    *out_f = f;
-    *out_v = val;
-    *iter = i;
-    return true;
-  }
-
-  return false;
-}
-
-static bool _upb_Message_NextExtension(const upb_Message* msg,
-                                       const upb_MiniTable* m,
-                                       const upb_MiniTableExtension** out_e,
-                                       upb_MessageValue* out_v, size_t* iter) {
-  size_t count;
-  const upb_Extension* exts = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count);
-  size_t i = *iter;
-
-  if (++i < count) {
-    *out_e = exts[i].ext;
-    *out_v = exts[i].data;
-    *iter = i;
-    return true;
-  }
-
-  return false;
-}
-
 bool upb_Message_IsEmpty(const upb_Message* msg, const upb_MiniTable* m) {
   if (upb_Message_ExtensionCount(msg)) return false;
 
   const upb_MiniTableField* f;
   upb_MessageValue v;
   size_t iter = kUpb_BaseField_Begin;
-  return !_upb_Message_NextBaseField(msg, m, &f, &v, &iter);
+  return !UPB_PRIVATE(_upb_Message_NextBaseField)(msg, m, &f, &v, &iter);
 }
 
 static bool _upb_Array_IsEqual(const upb_Array* arr1, const upb_Array* arr2,
@@ -6000,8 +5944,10 @@
     const upb_MiniTableField *f1, *f2;
     upb_MessageValue val1, val2;
 
-    const bool got1 = _upb_Message_NextBaseField(msg1, m, &f1, &val1, &iter1);
-    const bool got2 = _upb_Message_NextBaseField(msg2, m, &f2, &val2, &iter2);
+    const bool got1 =
+        UPB_PRIVATE(_upb_Message_NextBaseField)(msg1, m, &f1, &val1, &iter1);
+    const bool got2 =
+        UPB_PRIVATE(_upb_Message_NextBaseField)(msg2, m, &f2, &val2, &iter2);
 
     if (got1 != got2) return false;  // Must have identical field counts.
     if (!got1) return true;          // Loop termination condition.
@@ -6041,7 +5987,7 @@
 
   // Iterate over all extensions for msg1, and search msg2 for each extension.
   size_t iter1 = kUpb_Extension_Begin;
-  while (_upb_Message_NextExtension(msg1, m, &e, &val1, &iter1)) {
+  while (UPB_PRIVATE(_upb_Message_NextExtension)(msg1, m, &e, &val1, &iter1)) {
     const upb_Extension* ext2 = UPB_PRIVATE(_upb_Message_Getext)(msg2, e);
     if (!ext2) return false;
 
@@ -12316,6 +12262,66 @@
 #endif  // UPB_TRACING_ENABLED
 
 
+#include <stddef.h>
+
+
+// Must be last.
+
+bool UPB_PRIVATE(_upb_Message_NextBaseField)(const upb_Message* msg,
+                                             const upb_MiniTable* m,
+                                             const upb_MiniTableField** out_f,
+                                             upb_MessageValue* out_v,
+                                             size_t* iter) {
+  const size_t count = upb_MiniTable_FieldCount(m);
+  size_t i = *iter;
+
+  while (++i < count) {
+    const upb_MiniTableField* f = upb_MiniTable_GetFieldByIndex(m, i);
+    const void* src = UPB_PRIVATE(_upb_Message_DataPtr)(msg, f);
+
+    upb_MessageValue val;
+    UPB_PRIVATE(_upb_MiniTableField_DataCopy)(f, &val, src);
+
+    // Skip field if unset or empty.
+    if (upb_MiniTableField_HasPresence(f)) {
+      if (!upb_Message_HasBaseField(msg, f)) continue;
+    } else {
+      if (UPB_PRIVATE(_upb_MiniTableField_DataIsZero)(f, src)) continue;
+
+      if (upb_MiniTableField_IsArray(f)) {
+        if (upb_Array_Size(val.array_val) == 0) continue;
+      } else if (upb_MiniTableField_IsMap(f)) {
+        if (upb_Map_Size(val.map_val) == 0) continue;
+      }
+    }
+
+    *out_f = f;
+    *out_v = val;
+    *iter = i;
+    return true;
+  }
+
+  return false;
+}
+
+bool UPB_PRIVATE(_upb_Message_NextExtension)(
+    const upb_Message* msg, const upb_MiniTable* m,
+    const upb_MiniTableExtension** out_e, upb_MessageValue* out_v,
+    size_t* iter) {
+  size_t count;
+  const upb_Extension* exts = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count);
+  size_t i = *iter;
+
+  if (++i < count) {
+    *out_e = exts[i].ext;
+    *out_v = exts[i].data;
+    *iter = i;
+    return true;
+  }
+
+  return false;
+}
+
 const char _kUpb_ToBase92[] = {
     ' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/',
     '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
diff --git a/php/ext/google/protobuf/php-upb.h b/php/ext/google/protobuf/php-upb.h
index e1eacfb..4ad9bbf 100644
--- a/php/ext/google/protobuf/php-upb.h
+++ b/php/ext/google/protobuf/php-upb.h
@@ -13797,6 +13797,29 @@
 
 #endif /* UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_ */
 
+#ifndef THIRD_PARTY_UPB_UPB_MESSAGE_INTERNAL_ITERATOR_H_
+#define THIRD_PARTY_UPB_UPB_MESSAGE_INTERNAL_ITERATOR_H_
+
+#include <stddef.h>
+
+
+// Must be last.
+
+#define kUpb_BaseField_Begin ((size_t)-1)
+#define kUpb_Extension_Begin ((size_t)-1)
+
+bool UPB_PRIVATE(_upb_Message_NextBaseField)(const upb_Message* msg,
+                                             const upb_MiniTable* m,
+                                             const upb_MiniTableField** out_f,
+                                             upb_MessageValue* out_v,
+                                             size_t* iter);
+
+bool UPB_PRIVATE(_upb_Message_NextExtension)(
+    const upb_Message* msg, const upb_MiniTable* m,
+    const upb_MiniTableExtension** out_e, upb_MessageValue* out_v,
+    size_t* iter);
+#endif  // THIRD_PARTY_UPB_UPB_MESSAGE_INTERNAL_ITERATOR_H_
+
 #ifndef UPB_MESSAGE_COPY_H_
 #define UPB_MESSAGE_COPY_H_
 
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c
index 582487e..4eaaefe 100644
--- a/ruby/ext/google/protobuf_c/ruby-upb.c
+++ b/ruby/ext/google/protobuf_c/ruby-upb.c
@@ -5359,74 +5359,18 @@
 
 // Must be last.
 
-#define kUpb_BaseField_Begin ((size_t)-1)
-#define kUpb_Extension_Begin ((size_t)-1)
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-static bool _upb_Message_NextBaseField(const upb_Message* msg,
-                                       const upb_MiniTable* m,
-                                       const upb_MiniTableField** out_f,
-                                       upb_MessageValue* out_v, size_t* iter) {
-  const size_t count = upb_MiniTable_FieldCount(m);
-  size_t i = *iter;
-
-  while (++i < count) {
-    const upb_MiniTableField* f = upb_MiniTable_GetFieldByIndex(m, i);
-    const void* src = UPB_PRIVATE(_upb_Message_DataPtr)(msg, f);
-
-    upb_MessageValue val;
-    UPB_PRIVATE(_upb_MiniTableField_DataCopy)(f, &val, src);
-
-    // Skip field if unset or empty.
-    if (upb_MiniTableField_HasPresence(f)) {
-      if (!upb_Message_HasBaseField(msg, f)) continue;
-    } else {
-      if (UPB_PRIVATE(_upb_MiniTableField_DataIsZero)(f, src)) continue;
-
-      if (upb_MiniTableField_IsArray(f)) {
-        if (upb_Array_Size(val.array_val) == 0) continue;
-      } else if (upb_MiniTableField_IsMap(f)) {
-        if (upb_Map_Size(val.map_val) == 0) continue;
-      }
-    }
-
-    *out_f = f;
-    *out_v = val;
-    *iter = i;
-    return true;
-  }
-
-  return false;
-}
-
-static bool _upb_Message_NextExtension(const upb_Message* msg,
-                                       const upb_MiniTable* m,
-                                       const upb_MiniTableExtension** out_e,
-                                       upb_MessageValue* out_v, size_t* iter) {
-  size_t count;
-  const upb_Extension* exts = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count);
-  size_t i = *iter;
-
-  if (++i < count) {
-    *out_e = exts[i].ext;
-    *out_v = exts[i].data;
-    *iter = i;
-    return true;
-  }
-
-  return false;
-}
-
 bool upb_Message_IsEmpty(const upb_Message* msg, const upb_MiniTable* m) {
   if (upb_Message_ExtensionCount(msg)) return false;
 
   const upb_MiniTableField* f;
   upb_MessageValue v;
   size_t iter = kUpb_BaseField_Begin;
-  return !_upb_Message_NextBaseField(msg, m, &f, &v, &iter);
+  return !UPB_PRIVATE(_upb_Message_NextBaseField)(msg, m, &f, &v, &iter);
 }
 
 static bool _upb_Array_IsEqual(const upb_Array* arr1, const upb_Array* arr2,
@@ -5488,8 +5432,10 @@
     const upb_MiniTableField *f1, *f2;
     upb_MessageValue val1, val2;
 
-    const bool got1 = _upb_Message_NextBaseField(msg1, m, &f1, &val1, &iter1);
-    const bool got2 = _upb_Message_NextBaseField(msg2, m, &f2, &val2, &iter2);
+    const bool got1 =
+        UPB_PRIVATE(_upb_Message_NextBaseField)(msg1, m, &f1, &val1, &iter1);
+    const bool got2 =
+        UPB_PRIVATE(_upb_Message_NextBaseField)(msg2, m, &f2, &val2, &iter2);
 
     if (got1 != got2) return false;  // Must have identical field counts.
     if (!got1) return true;          // Loop termination condition.
@@ -5529,7 +5475,7 @@
 
   // Iterate over all extensions for msg1, and search msg2 for each extension.
   size_t iter1 = kUpb_Extension_Begin;
-  while (_upb_Message_NextExtension(msg1, m, &e, &val1, &iter1)) {
+  while (UPB_PRIVATE(_upb_Message_NextExtension)(msg1, m, &e, &val1, &iter1)) {
     const upb_Extension* ext2 = UPB_PRIVATE(_upb_Message_Getext)(msg2, e);
     if (!ext2) return false;
 
@@ -11804,6 +11750,66 @@
 #endif  // UPB_TRACING_ENABLED
 
 
+#include <stddef.h>
+
+
+// Must be last.
+
+bool UPB_PRIVATE(_upb_Message_NextBaseField)(const upb_Message* msg,
+                                             const upb_MiniTable* m,
+                                             const upb_MiniTableField** out_f,
+                                             upb_MessageValue* out_v,
+                                             size_t* iter) {
+  const size_t count = upb_MiniTable_FieldCount(m);
+  size_t i = *iter;
+
+  while (++i < count) {
+    const upb_MiniTableField* f = upb_MiniTable_GetFieldByIndex(m, i);
+    const void* src = UPB_PRIVATE(_upb_Message_DataPtr)(msg, f);
+
+    upb_MessageValue val;
+    UPB_PRIVATE(_upb_MiniTableField_DataCopy)(f, &val, src);
+
+    // Skip field if unset or empty.
+    if (upb_MiniTableField_HasPresence(f)) {
+      if (!upb_Message_HasBaseField(msg, f)) continue;
+    } else {
+      if (UPB_PRIVATE(_upb_MiniTableField_DataIsZero)(f, src)) continue;
+
+      if (upb_MiniTableField_IsArray(f)) {
+        if (upb_Array_Size(val.array_val) == 0) continue;
+      } else if (upb_MiniTableField_IsMap(f)) {
+        if (upb_Map_Size(val.map_val) == 0) continue;
+      }
+    }
+
+    *out_f = f;
+    *out_v = val;
+    *iter = i;
+    return true;
+  }
+
+  return false;
+}
+
+bool UPB_PRIVATE(_upb_Message_NextExtension)(
+    const upb_Message* msg, const upb_MiniTable* m,
+    const upb_MiniTableExtension** out_e, upb_MessageValue* out_v,
+    size_t* iter) {
+  size_t count;
+  const upb_Extension* exts = UPB_PRIVATE(_upb_Message_Getexts)(msg, &count);
+  size_t i = *iter;
+
+  if (++i < count) {
+    *out_e = exts[i].ext;
+    *out_v = exts[i].data;
+    *iter = i;
+    return true;
+  }
+
+  return false;
+}
+
 const char _kUpb_ToBase92[] = {
     ' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/',
     '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h
index e55fb77..ab2f09e 100755
--- a/ruby/ext/google/protobuf_c/ruby-upb.h
+++ b/ruby/ext/google/protobuf_c/ruby-upb.h
@@ -13563,6 +13563,29 @@
 
 #endif /* UPB_MESSAGE_INTERNAL_COMPARE_UNKNOWN_H_ */
 
+#ifndef THIRD_PARTY_UPB_UPB_MESSAGE_INTERNAL_ITERATOR_H_
+#define THIRD_PARTY_UPB_UPB_MESSAGE_INTERNAL_ITERATOR_H_
+
+#include <stddef.h>
+
+
+// Must be last.
+
+#define kUpb_BaseField_Begin ((size_t)-1)
+#define kUpb_Extension_Begin ((size_t)-1)
+
+bool UPB_PRIVATE(_upb_Message_NextBaseField)(const upb_Message* msg,
+                                             const upb_MiniTable* m,
+                                             const upb_MiniTableField** out_f,
+                                             upb_MessageValue* out_v,
+                                             size_t* iter);
+
+bool UPB_PRIVATE(_upb_Message_NextExtension)(
+    const upb_Message* msg, const upb_MiniTable* m,
+    const upb_MiniTableExtension** out_e, upb_MessageValue* out_v,
+    size_t* iter);
+#endif  // THIRD_PARTY_UPB_UPB_MESSAGE_INTERNAL_ITERATOR_H_
+
 #ifndef UPB_MESSAGE_COPY_H_
 #define UPB_MESSAGE_COPY_H_
 
diff --git a/src/file_lists.cmake b/src/file_lists.cmake
index 29e328a..07152d9 100644
--- a/src/file_lists.cmake
+++ b/src/file_lists.cmake
@@ -563,6 +563,7 @@
   ${protobuf_SOURCE_DIR}/upb/message/copy.c
   ${protobuf_SOURCE_DIR}/upb/message/internal/compare_unknown.c
   ${protobuf_SOURCE_DIR}/upb/message/internal/extension.c
+  ${protobuf_SOURCE_DIR}/upb/message/internal/iterator.c
   ${protobuf_SOURCE_DIR}/upb/message/internal/message.c
   ${protobuf_SOURCE_DIR}/upb/message/map.c
   ${protobuf_SOURCE_DIR}/upb/message/map_sorter.c
@@ -594,6 +595,7 @@
   ${protobuf_SOURCE_DIR}/upb/reflection/oneof_def.c
   ${protobuf_SOURCE_DIR}/upb/reflection/service_def.c
   ${protobuf_SOURCE_DIR}/upb/text/encode.c
+  ${protobuf_SOURCE_DIR}/upb/text/internal/encode.c
   ${protobuf_SOURCE_DIR}/upb/util/def_to_proto.c
   ${protobuf_SOURCE_DIR}/upb/util/required_fields.c
   ${protobuf_SOURCE_DIR}/upb/wire/decode.c
@@ -635,6 +637,7 @@
   ${protobuf_SOURCE_DIR}/upb/message/internal/array.h
   ${protobuf_SOURCE_DIR}/upb/message/internal/compare_unknown.h
   ${protobuf_SOURCE_DIR}/upb/message/internal/extension.h
+  ${protobuf_SOURCE_DIR}/upb/message/internal/iterator.h
   ${protobuf_SOURCE_DIR}/upb/message/internal/map.h
   ${protobuf_SOURCE_DIR}/upb/message/internal/map_entry.h
   ${protobuf_SOURCE_DIR}/upb/message/internal/map_sorter.h
@@ -707,6 +710,8 @@
   ${protobuf_SOURCE_DIR}/upb/reflection/oneof_def.h
   ${protobuf_SOURCE_DIR}/upb/reflection/service_def.h
   ${protobuf_SOURCE_DIR}/upb/text/encode.h
+  ${protobuf_SOURCE_DIR}/upb/text/internal/encode.h
+  ${protobuf_SOURCE_DIR}/upb/text/options.h
   ${protobuf_SOURCE_DIR}/upb/util/def_to_proto.h
   ${protobuf_SOURCE_DIR}/upb/util/required_fields.h
   ${protobuf_SOURCE_DIR}/upb/wire/decode.h