Skip to content

Commit

Permalink
#16477 - Regenerate ext/ directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeckerson committed Dec 23, 2023
1 parent 5853914 commit e34ccf8
Show file tree
Hide file tree
Showing 632 changed files with 10,660 additions and 29,253 deletions.
4 changes: 0 additions & 4 deletions ext/kernel/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
* following url: https://docs.zephir-lang.com/en/latest/license
*/

#ifndef ZEPHIR_KERNEL_ARRAY_H
#define ZEPHIR_KERNEL_ARRAY_H
#define ZEPHIR_MAX_ARRAY_LEVELS 16

#include <php.h>
Expand Down Expand Up @@ -73,5 +71,3 @@ int zephir_fast_in_array(zval *needle, zval *haystack);
Z_TRY_ADDREF_P(value); \
zend_hash_next_index_insert(Z_ARRVAL_P(arr), value); \
} while (0)

#endif /* ZEPHIR_KERNEL_ARRAY_H */
14 changes: 2 additions & 12 deletions ext/kernel/exception.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ void zephir_throw_exception_debug(zval *object, const char *file, uint32_t line)

ZVAL_UNDEF(&curline);

ZEPHIR_MM_GROW();
ZEPHIR_METHOD_GLOBALS_PTR = pecalloc(1, sizeof(zephir_method_globals), 0);
zephir_memory_grow_stack(ZEPHIR_METHOD_GLOBALS_PTR, __func__);

if (Z_TYPE_P(object) != IS_OBJECT) {
ZVAL_COPY_VALUE(&object_copy, object);
Expand All @@ -54,14 +55,8 @@ void zephir_throw_exception_debug(zval *object, const char *file, uint32_t line)
zephir_check_call_status();
if (ZEPHIR_IS_LONG(&curline, 0)) {
default_exception_ce = zend_exception_get_default();

#if PHP_VERSION_ID >= 80000
zend_update_property_string(default_exception_ce, Z_OBJ_P(object), SL("file"), file);
zend_update_property_long(default_exception_ce, Z_OBJ_P(object), SL("line"), line);
#else
zend_update_property_string(default_exception_ce, object, SL("file"), file);
zend_update_property_long(default_exception_ce, object, SL("line"), line);
#endif
}
}

Expand All @@ -88,13 +83,8 @@ void zephir_throw_exception_string_debug(zend_class_entry *ce, const char *messa

if (line > 0) {
default_exception_ce = zend_exception_get_default();
#if PHP_VERSION_ID >= 80000
zend_update_property_string(default_exception_ce, Z_OBJ(object), "file", sizeof("file")-1, file);
zend_update_property_long(default_exception_ce, Z_OBJ(object), "line", sizeof("line")-1, line);
#else
zend_update_property_string(default_exception_ce, &object, "file", sizeof("file")-1, file);
zend_update_property_long(default_exception_ce, &object, "line", sizeof("line")-1, line);
#endif
}

if (ZEPHIR_LAST_CALL_STATUS != FAILURE) {
Expand Down
84 changes: 8 additions & 76 deletions ext/kernel/fcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,21 +211,12 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
}

fcic->called_scope = called_scope;

#if PHP_VERSION_ID >= 80000
calling_scope = zend_get_called_scope(EG(current_execute_data));
#else
calling_scope = zend_get_executed_scope();
#endif

fcic->object = this_ptr ? Z_OBJ_P(this_ptr) : NULL;
switch (type) {
case zephir_fcall_parent:

#if PHP_VERSION_ID >= 80000
if (ce && Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&ce->parent->function_table, Z_STR_P(func));

fcic->calling_scope = ce->parent;
} else if (EXPECTED(calling_scope && calling_scope->parent)) {
if (Z_TYPE_P(func) == IS_STRING) {
Expand All @@ -235,7 +226,7 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
} else {
return;
}
#endif

if (UNEXPECTED(!calling_scope || !calling_scope->parent)) {
return;
}
Expand All @@ -244,25 +235,17 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
break;

case zephir_fcall_static:
#if PHP_VERSION_ID >= 80000
if (ce && Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func));
fcic->calling_scope = ce;
} else if (calling_scope && Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&calling_scope->function_table, Z_STR_P(func));
fcic->calling_scope = called_scope;
}
#else
fcic->calling_scope = called_scope;
if (UNEXPECTED(!calling_scope)) {
return;
}
#endif

break;

case zephir_fcall_self:
#if PHP_VERSION_ID >= 80000
if (ce && Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func));
fcic->calling_scope = ce;
Expand All @@ -273,13 +256,9 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
//fcic->called_scope = zend_get_called_scope(EG(current_execute_data));
fcic->calling_scope = calling_scope;
}
#else
fcic->calling_scope = calling_scope;
#endif
break;

case zephir_fcall_ce:
#if PHP_VERSION_ID >= 80000
if (ce && Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func));

Expand All @@ -288,7 +267,6 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
fcic->function_handler = zend_hash_find_ptr(&calling_scope->function_table, Z_STR_P(func));
fcic->calling_scope = calling_scope;
}
#endif
// TODO: Check for PHP 7.4 and PHP 8.0, as it rewrite from above
fcic->calling_scope = ce;
fcic->called_scope = ce;
Expand All @@ -297,23 +275,17 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
case zephir_fcall_function:
case zephir_fcall_method:
if (Z_TYPE_P(func) == IS_OBJECT) {
#if PHP_VERSION_ID >= 80000
if (Z_OBJ_HANDLER_P(func, get_closure) && Z_OBJ_HANDLER_P(func, get_closure)(Z_OBJ_P(func), &fcic->calling_scope, &fcic->function_handler, &fcic->object, 0) == SUCCESS) {
#else
if (Z_OBJ_HANDLER_P(func, get_closure) && Z_OBJ_HANDLER_P(func, get_closure)(func, &fcic->calling_scope, &fcic->function_handler, &fcic->object) == SUCCESS) {
#endif
fcic->called_scope = fcic->calling_scope;
break;
}

return;
}

#if PHP_VERSION_ID >= 80000
if (ce && Z_TYPE_P(func) == IS_STRING) {
fcic->function_handler = zend_hash_find_ptr(&ce->function_table, Z_STR_P(func));
}
#endif
fcic->calling_scope = this_ptr ? Z_OBJCE_P(this_ptr) : NULL;
fcic->called_scope = fcic->calling_scope;
break;
Expand Down Expand Up @@ -383,12 +355,7 @@ int zephir_call_user_function(
ZVAL_COPY_VALUE(&fci.function_name, function_name);
fci.retval = retval_ptr ? retval_ptr : &local_retval_ptr;
fci.param_count = param_count;

#if PHP_VERSION_ID < 80000
fci.no_separation = 1;
#else
fci.named_params = NULL;
#endif

if (cache_entry && *cache_entry) {
/* We have a cache record, initialize scope */
Expand All @@ -402,22 +369,18 @@ int zephir_call_user_function(
/* The caller is interested in caching OR we have the call cache enabled */
resolve_callable(&callable, type, (object_pp && type != zephir_fcall_ce ? Z_OBJCE_P(object_pp) : obj_ce), object_pp, function_name);

#if PHP_VERSION_ID >= 80000
char *is_callable_error = NULL;
zend_execute_data *frame = EG(current_execute_data);
char *is_callable_error = NULL;
zend_execute_data *frame = EG(current_execute_data);
if (obj_ce || !zend_is_callable_at_frame(&callable, fci.object, frame, 0, &fcic, &is_callable_error)) {
if (is_callable_error) {
zend_error(E_WARNING, "%s", is_callable_error);
efree(is_callable_error);
if (is_callable_error) {
zend_error(E_WARNING, "%s", is_callable_error);
efree(is_callable_error);

return FAILURE;
}
return FAILURE;
}

populate_fcic(&fcic, type, obj_ce, object_pp, function_name, called_scope);
}
#else
zend_is_callable_ex(&callable, fci.object, IS_CALLABLE_CHECK_SILENT, NULL, &fcic, NULL);
#endif
}

#ifdef _MSC_VER
Expand All @@ -432,12 +395,9 @@ int zephir_call_user_function(
}

fci.params = p;

#if PHP_VERSION_ID >= 80000
if (!fcic.function_handler) {
ZVAL_COPY_VALUE(&fci.function_name, &callable);
}
#endif

status = zend_call_function(&fci, &fcic);

Expand Down Expand Up @@ -630,29 +590,6 @@ int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *pa
return FAILURE;
}

#if PHP_VERSION_ID < 80000
zend_fcall_info_init(handler, 0, &fci, &fci_cache, NULL, &is_callable_error);

if (is_callable_error) {
zend_error(E_WARNING, "%s", is_callable_error);
efree(is_callable_error);
} else {
status = SUCCESS;
}

if (status == SUCCESS) {
zend_fcall_info_args(&fci, params);

fci.retval = return_value;
zend_call_function(&fci, &fci_cache);

zend_fcall_info_args_clear(&fci, 1);
}

if (EG(exception)) {
status = SUCCESS;
}
#else
zend_execute_data *frame = EG(current_execute_data);
if (!zend_is_callable_at_frame(handler, NULL, frame, 0, &fci_cache, &is_callable_error)) {
if (is_callable_error) {
Expand All @@ -674,7 +611,6 @@ int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *pa
zend_fcall_info_args(&fci, params);
status = zend_call_function(&fci, &fci_cache);
zend_fcall_info_args_clear(&fci, 1);
#endif

return status;
}
Expand All @@ -696,11 +632,7 @@ void zephir_eval_php(zval *str, zval *retval_ptr, char *context)
#if PHP_VERSION_ID >= 80200
new_op_array = zend_compile_string(Z_STR_P(str), context, ZEND_COMPILE_POSITION_AFTER_OPEN_TAG);
#else
#if PHP_VERSION_ID >= 80000
new_op_array = zend_compile_string(Z_STR_P(str), context);
#else
new_op_array = zend_compile_string(str, context);
#endif
#endif

CG(compiler_options) = original_compiler_options;
Expand Down
34 changes: 0 additions & 34 deletions ext/kernel/fcall.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,71 +167,37 @@ typedef enum _zephir_call_type {
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, Z_TYPE_P(object) == IS_OBJECT ? Z_OBJCE_P(object) : NULL, zephir_fcall_method, object, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)

#if PHP_VERSION_ID >= 80000
#define ZEPHIR_RETURN_CALL_STATIC(method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_static, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)
#else
#define ZEPHIR_RETURN_CALL_STATIC(method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_static, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)
#endif

#define ZEPHIR_RETURN_CALL_PARENT(class_entry, this_ptr, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, class_entry, zephir_fcall_parent, this_ptr, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)

#if PHP_VERSION_ID >= 80000
#define ZEPHIR_CALL_SELF(return_value_ptr, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_self, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)
#else
#define ZEPHIR_CALL_SELF(return_value_ptr, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_self, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)
#endif

#if PHP_VERSION_ID >= 80000
#define ZEPHIR_RETURN_CALL_SELF(method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_self, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)
#else
#define ZEPHIR_RETURN_CALL_SELF(method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_LAST_CALL_STATUS = zephir_return_call_class_method(return_value, NULL, zephir_fcall_self, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)
#endif

#if PHP_VERSION_ID >= 80000
#define ZEPHIR_CALL_STATIC(return_value_ptr, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, (getThis() ? Z_OBJCE_P(getThis()) : NULL), zephir_fcall_static, getThis(), method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)
#else
#define ZEPHIR_CALL_STATIC(return_value_ptr, method, cache, cache_slot, ...) \
do { \
zval *params_[] = {ZEPHIR_FETCH_VA_ARGS __VA_ARGS__}; \
ZEPHIR_OBSERVE_OR_NULLIFY_PPZV(return_value_ptr); \
ZEPHIR_LAST_CALL_STATUS = zephir_call_class_method_aparams(return_value_ptr, NULL, zephir_fcall_static, NULL, method, strlen(method), cache, cache_slot, ZEPHIR_CALL_NUM_PARAMS(params_), ZEPHIR_PASS_CALL_PARAMS(params_)); \
} while (0)
#endif

#define ZEPHIR_CALL_CE_STATIC(return_value_ptr, class_entry, method, cache, cache_slot, ...) \
do { \
Expand Down
Loading

0 comments on commit e34ccf8

Please sign in to comment.