Commit 7134e69ab2a for php.net

commit 7134e69ab2a73da2a5f0e540a135a559210278bb
Author: Tim Düsterhus <tim@tideways-gmbh.com>
Date:   Wed Feb 11 22:53:31 2026 +0100

    zend_globals: Embed `in_autoload` into `zend_executor_globals` (#21202)

    * zend_globals: Embed `in_autoload` into `zend_executor_globals`

    Nowadays virtually any PHP application is making use of autoloading, making the
    lazy allocation of the `HashTable` struct a needless pointer indirection.

    * zend_globals: Rename `in_autoload` to `autoload_current_classnames`

    The old name `in_autoload` was somewhat misleading by implying a `bool`ean
    value rather than a `HashTable`. Since the previous change to embed the
    `HashTable` is breaking anyway, we can also rename it.

    * UPGRADING.INTERNALS

diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS
index 83ef90e5558..06c1d528262 100644
--- a/UPGRADING.INTERNALS
+++ b/UPGRADING.INTERNALS
@@ -70,6 +70,8 @@ PHP 8.6 INTERNALS UPGRADE NOTES
     performed on the result.
   . The zend_dval_to_lval_cap() function no longer takes a second
     zend_string* parameter.
+  . EG(in_autoload) was renamed to EG(autoload_current_classnames) and no
+    longer is a pointer, but a directly embedded HashTable struct.

 ========================
 2. Build system changes
diff --git a/Zend/zend.c b/Zend/zend.c
index 49e18f1a777..bce1faede8f 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -811,7 +811,6 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals) /* {{
 	executor_globals->user_error_handler_error_reporting = 0;
 	ZVAL_UNDEF(&executor_globals->user_error_handler);
 	ZVAL_UNDEF(&executor_globals->user_exception_handler);
-	executor_globals->in_autoload = NULL;
 	executor_globals->current_execute_data = NULL;
 	executor_globals->current_module = NULL;
 	executor_globals->exit_status = 0;
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index f9309be99f0..dbd2a9039cf 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -145,7 +145,6 @@ void init_executor(void) /* {{{ */
 	EG(function_table) = CG(function_table);
 	EG(class_table) = CG(class_table);

-	EG(in_autoload) = NULL;
 	EG(error_handling) = EH_NORMAL;
 	EG(flags) = EG_FLAGS_INITIAL;

@@ -156,6 +155,7 @@ void init_executor(void) /* {{{ */
 	zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator);

 	zend_hash_init(&EG(included_files), 8, NULL, NULL, 0);
+	zend_hash_init(&EG(autoload_current_classnames), 8, NULL, NULL, 0);

 	EG(ticks_count) = 0;

@@ -503,16 +503,13 @@ void shutdown_executor(void) /* {{{ */
 		}

 		zend_hash_destroy(&EG(included_files));
+		zend_hash_destroy(&EG(autoload_current_classnames));

 		zend_stack_destroy(&EG(user_error_handlers_error_reporting));
 		zend_stack_destroy(&EG(user_error_handlers));
 		zend_stack_destroy(&EG(user_exception_handlers));
 		zend_lazy_objects_destroy(&EG(lazy_objects_store));
 		zend_objects_store_destroy(&EG(objects_store));
-		if (EG(in_autoload)) {
-			zend_hash_destroy(EG(in_autoload));
-			FREE_HASHTABLE(EG(in_autoload));
-		}

 		if (EG(ht_iterators) != EG(ht_iterators_slots)) {
 			efree(EG(ht_iterators));
@@ -1245,12 +1242,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
 		return NULL;
 	}

-	if (EG(in_autoload) == NULL) {
-		ALLOC_HASHTABLE(EG(in_autoload));
-		zend_hash_init(EG(in_autoload), 8, NULL, NULL, 0);
-	}
-
-	if (zend_hash_add_empty_element(EG(in_autoload), lc_name) == NULL) {
+	if (zend_hash_add_empty_element(&EG(autoload_current_classnames), lc_name) == NULL) {
 		if (!key) {
 			zend_string_release_ex(lc_name, 0);
 		}
@@ -1272,7 +1264,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
 	EG(lineno_override) = previous_lineno;

 	zend_string_release_ex(autoload_name, 0);
-	zend_hash_del(EG(in_autoload), lc_name);
+	zend_hash_del(&EG(autoload_current_classnames), lc_name);

 	if (!key) {
 		zend_string_release_ex(lc_name, 0);
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index f09b81acb31..31f54cd8284 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -220,7 +220,7 @@ struct _zend_executor_globals {
 	zend_atomic_bool vm_interrupt;
 	zend_atomic_bool timed_out;

-	HashTable *in_autoload;
+	HashTable autoload_current_classnames;

 	zend_long hard_timeout;
 	void *stack_base;