Continue cleaning up after the GLOBALS experiment.

Clean up ExtensionInfo to contain a ClassData* instead.

PiperOrigin-RevId: 967283147
diff --git a/src/google/protobuf/extension_set.cc b/src/google/protobuf/extension_set.cc
index b4518b9..fed6725 100644
--- a/src/google/protobuf/extension_set.cc
+++ b/src/google/protobuf/extension_set.cc
@@ -157,6 +157,8 @@
   Register(info);
 }
 
+// TODO: Change the registration function to take ClassData*
+// instead.
 void ExtensionSet::RegisterMessageExtension(const MessageLite* extendee,
                                             int number, FieldType type,
                                             bool is_repeated, bool is_packed,
@@ -168,11 +170,7 @@
   ExtensionInfo info(extendee, number, type, is_repeated, is_packed,
                      verify_func, is_lazy);
   info.message_info = {
-#ifdef PROTOBUF_MESSAGE_GLOBALS
-      internal::MessageGlobalsBase::FromDefaultInstance(prototype),
-#else   // PROTOBUF_MESSAGE_GLOBALS
-      prototype,
-#endif  // PROTOBUF_MESSAGE_GLOBALS
+      &internal::MessageGlobalsBase::FromDefaultInstance(prototype)->class_data,
 #if defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES)
       prototype->GetTcParseTable()
 #else
@@ -1856,7 +1854,7 @@
           &extension_info, &was_packed_on_wire)) {
     return nullptr;
   }
-  return extension_info.message_info.GetClassData();
+  return extension_info.message_info.class_data;
 }
 
 uint8_t*
diff --git a/src/google/protobuf/extension_set.h b/src/google/protobuf/extension_set.h
index fd688db..b3e20f1 100644
--- a/src/google/protobuf/extension_set.h
+++ b/src/google/protobuf/extension_set.h
@@ -168,35 +168,15 @@
   };
 
   struct MessageInfo {
-#ifdef PROTOBUF_MESSAGE_GLOBALS
-    const internal::MessageGlobalsBase* globals = nullptr;
-#else
-    const MessageLite* prototype = nullptr;
-#endif
+    // Never null.
+    const internal::ClassData* class_data;
+    // TODO: Remove `tc_table` now that we can easily get it from
+    // `class_data`.
     // The TcParse table used for this object. Never null. (except in platforms
     // that don't constant initialize default instances)
     const internal::TcParseTableBase* tc_table = nullptr;
 
-    // Create from prototype
-    const MessageLite* GetPrototype() const {
-#ifdef PROTOBUF_MESSAGE_GLOBALS
-      return internal::MessageGlobalsBase::ToDefaultInstance(globals);
-#else
-      return prototype;
-#endif
-    }
-
     const internal::TcParseTableBase* GetTcTable() const { return tc_table; }
-
-    const ClassData* GetClassData() const {
-#if defined(PROTOBUF_MESSAGE_GLOBALS)
-      return internal::MessageGlobalsBase::GetClassData(globals);
-#elif defined(PROTOBUF_CONSTINIT_DEFAULT_INSTANCES)
-      return tc_table->class_data;
-#else
-      return internal::GetClassData(*prototype);
-#endif
-    }
   };
 
   union {
diff --git a/src/google/protobuf/extension_set_heavy.cc b/src/google/protobuf/extension_set_heavy.cc
index 0a970df..553cab7 100644
--- a/src/google/protobuf/extension_set_heavy.cc
+++ b/src/google/protobuf/extension_set_heavy.cc
@@ -265,12 +265,8 @@
       ABSL_CHECK_NE(prototype, nullptr)
           << "Extension factory's GetPrototype() returned nullptr; extension: "
           << extension->full_name();
-#ifdef PROTOBUF_MESSAGE_GLOBALS
-      output->message_info.globals =
-          MessageGlobalsBase::FromDefaultInstance(prototype);
-#else
-      output->message_info.prototype = prototype;
-#endif  // PROTOBUF_MESSAGE_GLOBALS
+      output->message_info.class_data =
+          &MessageGlobalsBase::FromDefaultInstance(prototype)->class_data;
       output->message_info.tc_table = prototype->GetTcParseTable();
 
     } else if (extension->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) {
diff --git a/src/google/protobuf/extension_set_inl.h b/src/google/protobuf/extension_set_inl.h
index 2f990f0..75a2283 100644
--- a/src/google/protobuf/extension_set_inl.h
+++ b/src/google/protobuf/extension_set_inl.h
@@ -167,10 +167,10 @@
         MessageLite* value =
             info.is_repeated
                 ? AddMessage(arena, number, WireFormatLite::TYPE_GROUP,
-                             info.message_info.GetClassData(), info.descriptor)
+                             info.message_info.class_data, info.descriptor)
                 : MutableMessageByClassData(
                       arena, number, WireFormatLite::TYPE_GROUP,
-                      info.message_info.GetClassData(), info.descriptor);
+                      info.message_info.class_data, info.descriptor);
         uint32_t tag = (number << 3) + WireFormatLite::WIRETYPE_START_GROUP;
         return ctx->ParseGroup(value, ptr, tag);
       }
@@ -179,10 +179,10 @@
         MessageLite* value =
             info.is_repeated
                 ? AddMessage(arena, number, WireFormatLite::TYPE_MESSAGE,
-                             info.message_info.GetClassData(), info.descriptor)
+                             info.message_info.class_data, info.descriptor)
                 : MutableMessageByClassData(
                       arena, number, WireFormatLite::TYPE_MESSAGE,
-                      info.message_info.GetClassData(), info.descriptor);
+                      info.message_info.class_data, info.descriptor);
         return ctx->ParseMessage(value, ptr);
       }
     }
@@ -223,12 +223,12 @@
           MessageLite* value =
               extension.is_repeated
                   ? AddMessage(arena, type_id, WireFormatLite::TYPE_MESSAGE,
-                               extension.message_info.GetClassData(),
+                               extension.message_info.class_data,
                                extension.descriptor)
-                  : MutableMessageByClassData(
-                        arena, type_id, WireFormatLite::TYPE_MESSAGE,
-                        extension.message_info.GetClassData(),
-                        extension.descriptor);
+                  : MutableMessageByClassData(arena, type_id,
+                                              WireFormatLite::TYPE_MESSAGE,
+                                              extension.message_info.class_data,
+                                              extension.descriptor);
 
           const char* p;
           // Use Spawn to transfer all attributes for recursion.