@@ -6297,9 +6297,9 @@ static zend_type zend_compile_typename(
6297
6297
zend_error_noreturn (E_COMPILE_ERROR , "Nullable type cannot be part of an intersection type" );
6298
6298
}
6299
6299
6300
- ALLOCA_FLAG ( use_heap )
6301
-
6302
- type_list = do_alloca ( ZEND_TYPE_LIST_SIZE (list -> children ), use_heap );
6300
+ /* Allocate the type list directly on the arena as it must be a type
6301
+ * list of the same number of elements as the AST list has children */
6302
+ type_list = zend_arena_alloc ( & CG ( arena ), ZEND_TYPE_LIST_SIZE (list -> children ));
6303
6303
type_list -> num_types = 0 ;
6304
6304
6305
6305
ZEND_ASSERT (list -> children > 1 );
@@ -6336,18 +6336,12 @@ static zend_type zend_compile_typename(
6336
6336
}
6337
6337
}
6338
6338
6339
- ZEND_ASSERT (type_list -> num_types > 1 );
6339
+ ZEND_ASSERT (list -> children == type_list -> num_types );
6340
6340
6341
- /* TODO Can be arena allocated directly? */
6342
- zend_type_list * reduced_list = zend_arena_alloc (
6343
- & CG (arena ), ZEND_TYPE_LIST_SIZE (type_list -> num_types ));
6344
- memcpy (reduced_list , type_list , ZEND_TYPE_LIST_SIZE (type_list -> num_types ));
6345
- ZEND_TYPE_SET_LIST (type , reduced_list );
6341
+ ZEND_TYPE_SET_LIST (type , type_list );
6346
6342
ZEND_TYPE_FULL_MASK (type ) |= _ZEND_TYPE_ARENA_BIT ;
6347
6343
/* Inform that the type list is an intersection type */
6348
6344
ZEND_TYPE_FULL_MASK (type ) |= _ZEND_TYPE_INTERSECTION_BIT ;
6349
-
6350
- free_alloca (type_list , use_heap );
6351
6345
} else {
6352
6346
type = zend_compile_single_typename (ast );
6353
6347
}
0 commit comments