Skip to content

Commit

Permalink
Remove unused zend_class_arrayaccess_funcs struct now
Browse files Browse the repository at this point in the history
  • Loading branch information
Girgias committed Jul 9, 2024
1 parent 0e4598a commit 7b20c51
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 58 deletions.
2 changes: 0 additions & 2 deletions Zend/zend.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ struct _zend_class_entry {

/* allocated only if class implements Iterator or IteratorAggregate interface */
zend_class_iterator_funcs *iterator_funcs_ptr;
/* allocated only if class implements ArrayAccess interface */
zend_class_arrayaccess_funcs *arrayaccess_funcs_ptr;

/* handlers */
union {
Expand Down
1 change: 0 additions & 1 deletion Zend/zend_API.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ typedef struct _zend_fcall_info_cache {
class_container.interfaces = NULL; \
class_container.get_iterator = NULL; \
class_container.iterator_funcs_ptr = NULL; \
class_container.arrayaccess_funcs_ptr = NULL; \
class_container.dimension_handlers = NULL; \
class_container.info.internal.module = NULL; \
class_container.info.internal.builtin_functions = functions; \
Expand Down
1 change: 0 additions & 1 deletion Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2040,7 +2040,6 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, bool nullify_hand
ce->create_object = NULL;
ce->get_iterator = NULL;
ce->iterator_funcs_ptr = NULL;
ce->arrayaccess_funcs_ptr = NULL;
ce->get_static_method = NULL;
ce->parent = NULL;
ce->parent_name = NULL;
Expand Down
7 changes: 0 additions & 7 deletions Zend/zend_dimension_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,4 @@ typedef struct _zend_class_dimensions_functions {
void (*/* const */ unset_dimension)(zend_object *object, zval *offset);
} zend_class_dimensions_functions;

typedef struct _zend_class_arrayaccess_funcs {
zend_function *zf_offsetget;
zend_function *zf_offsetexists;
zend_function *zf_offsetset;
zend_function *zf_offsetunset;
} zend_class_arrayaccess_funcs;

#endif /* ZEND_DIMENSION_HANDLERS_H */
15 changes: 0 additions & 15 deletions Zend/zend_interfaces_dimension.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,21 +261,6 @@ static int zend_implement_arrayaccess(zend_class_entry *interface, zend_class_en
return SUCCESS;
}

ZEND_ASSERT(!class_type->arrayaccess_funcs_ptr && "ArrayAccess funcs already set?");
zend_class_arrayaccess_funcs *funcs_ptr = class_type->type == ZEND_INTERNAL_CLASS
? pemalloc(sizeof(zend_class_arrayaccess_funcs), 1)
: zend_arena_alloc(&CG(arena), sizeof(zend_class_arrayaccess_funcs));
class_type->arrayaccess_funcs_ptr = funcs_ptr;

funcs_ptr->zf_offsetget = zend_hash_str_find_ptr(
&class_type->function_table, "offsetget", sizeof("offsetget") - 1);
funcs_ptr->zf_offsetexists = zend_hash_str_find_ptr(
&class_type->function_table, "offsetexists", sizeof("offsetexists") - 1);
funcs_ptr->zf_offsetset = zend_hash_str_find_ptr(
&class_type->function_table, "offsetset", sizeof("offsetset") - 1);
funcs_ptr->zf_offsetunset = zend_hash_str_find_ptr(
&class_type->function_table, "offsetunset", sizeof("offsetunset") - 1);

zend_class_dimensions_functions *funcs = NULL;
ALLOC_HANDLERS_IF_MISSING(funcs, class_type);

Expand Down
3 changes: 0 additions & 3 deletions Zend/zend_opcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,6 @@ ZEND_API void destroy_zend_class(zval *zv)
if (ce->iterator_funcs_ptr) {
free(ce->iterator_funcs_ptr);
}
if (ce->arrayaccess_funcs_ptr) {
free(ce->arrayaccess_funcs_ptr);
}
if (ce->num_interfaces > 0) {
free(ce->interfaces);
}
Expand Down
15 changes: 0 additions & 15 deletions ext/opcache/zend_file_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,14 +874,6 @@ static void zend_file_cache_serialize_class(zval *zv,
SERIALIZE_PTR(ce->iterator_funcs_ptr->zf_next);
SERIALIZE_PTR(ce->iterator_funcs_ptr);
}

if (ce->arrayaccess_funcs_ptr) {
SERIALIZE_PTR(ce->arrayaccess_funcs_ptr->zf_offsetget);
SERIALIZE_PTR(ce->arrayaccess_funcs_ptr->zf_offsetexists);
SERIALIZE_PTR(ce->arrayaccess_funcs_ptr->zf_offsetset);
SERIALIZE_PTR(ce->arrayaccess_funcs_ptr->zf_offsetunset);
SERIALIZE_PTR(ce->arrayaccess_funcs_ptr);
}
if (ce->dimension_handlers) {
SERIALIZE_PTR(ce->dimension_handlers->read_dimension);
SERIALIZE_PTR(ce->dimension_handlers->has_dimension);
Expand Down Expand Up @@ -1711,13 +1703,6 @@ static void zend_file_cache_unserialize_class(zval *zv,
UNSERIALIZE_PTR(ce->iterator_funcs_ptr->zf_current);
UNSERIALIZE_PTR(ce->iterator_funcs_ptr->zf_next);
}
if (ce->arrayaccess_funcs_ptr) {
UNSERIALIZE_PTR(ce->arrayaccess_funcs_ptr);
UNSERIALIZE_PTR(ce->arrayaccess_funcs_ptr->zf_offsetget);
UNSERIALIZE_PTR(ce->arrayaccess_funcs_ptr->zf_offsetexists);
UNSERIALIZE_PTR(ce->arrayaccess_funcs_ptr->zf_offsetset);
UNSERIALIZE_PTR(ce->arrayaccess_funcs_ptr->zf_offsetunset);
}
if (ce->dimension_handlers) {
UNSERIALIZE_PTR(ce->dimension_handlers);
UNSERIALIZE_PTR(ce->dimension_handlers->read_dimension);
Expand Down
11 changes: 0 additions & 11 deletions ext/opcache/zend_persist.c
Original file line number Diff line number Diff line change
Expand Up @@ -975,9 +975,6 @@ zend_class_entry *zend_persist_class_entry(zend_class_entry *orig_ce)
if (ce->iterator_funcs_ptr) {
ce->iterator_funcs_ptr = zend_shared_memdup(ce->iterator_funcs_ptr, sizeof(zend_class_iterator_funcs));
}
if (ce->arrayaccess_funcs_ptr) {
ce->arrayaccess_funcs_ptr = zend_shared_memdup(ce->arrayaccess_funcs_ptr, sizeof(zend_class_arrayaccess_funcs));
}
if (ce->dimension_handlers) {
ce->dimension_handlers = zend_shared_memdup(ce->dimension_handlers, sizeof(zend_class_dimensions_functions));
}
Expand Down Expand Up @@ -1137,14 +1134,6 @@ void zend_update_parent_ce(zend_class_entry *ce)
ce->iterator_funcs_ptr->zf_next = zend_hash_str_find_ptr(&ce->function_table, "next", sizeof("next") - 1);
}
}

if (ce->arrayaccess_funcs_ptr) {
ZEND_ASSERT(zend_class_implements_interface(ce, zend_ce_arrayaccess));
ce->arrayaccess_funcs_ptr->zf_offsetget = zend_hash_str_find_ptr(&ce->function_table, "offsetget", sizeof("offsetget") - 1);
ce->arrayaccess_funcs_ptr->zf_offsetexists = zend_hash_str_find_ptr(&ce->function_table, "offsetexists", sizeof("offsetexists") - 1);
ce->arrayaccess_funcs_ptr->zf_offsetset = zend_hash_str_find_ptr(&ce->function_table, "offsetset", sizeof("offsetset") - 1);
ce->arrayaccess_funcs_ptr->zf_offsetunset = zend_hash_str_find_ptr(&ce->function_table, "offsetunset", sizeof("offsetunset") - 1);
}
}

/* update methods */
Expand Down
3 changes: 0 additions & 3 deletions ext/opcache/zend_persist_calc.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,6 @@ void zend_persist_class_entry_calc(zend_class_entry *ce)
if (ce->iterator_funcs_ptr) {
ADD_SIZE(sizeof(zend_class_iterator_funcs));
}
if (ce->arrayaccess_funcs_ptr) {
ADD_SIZE(sizeof(zend_class_arrayaccess_funcs));
}
if (ce->dimension_handlers) {
ADD_SIZE(sizeof(zend_class_dimensions_functions));
}
Expand Down

0 comments on commit 7b20c51

Please sign in to comment.