com php-src: Mark error and exception functions as "cold" (Matt's idea): Zend/zend.c Zend/zend.h Zend/zend_API.c Zend/zend_API .h Zend/zend_alloc.c
Zend/zend_closures.c Zend/ zend_exceptions.c Zend/zend_exceptions.h Zend/zend _execute.c Zend/zend_generators.c Zend/zend_inher itance.c
Zend/zend_object_handlers.c Zend/zend_ob ject_handlers.h Zend/zend_portability.h
| From: | Dmitry Stogov | Date: | Wed, 19 Aug 2015 11:40:56 +0000 |
| Subject: | com php-src: Mark error and exception functions as "cold" (Matt's idea): Zend/zend.c Zend/zend.h Zend/zend_API.c Zend/zend_API .h Zend/zend_alloc.c Zend/zend_closures.c Zend/ zend_exceptions.c Zend/zend_exceptions.h Zend/zend _execute.c Zend/zend_generators.c Zend/zend_inher itance.c Zend/zend_object_handlers.c Zend/zend_ob ject_handlers.h Zend/zend_portability.h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88680@lists.php.net to get a copy of this message | ||
Commit: 71af54e5f6656af070e4dccd1470bb1376c89568
Author: Dmitry Stogov <dmitry@zend.com> Wed, 19 Aug 2015 14:40:56 +0300
Parents: 066f6f6ad8bf9ff3b548d768c811931bab320cd5
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=71af54e5f6656af070e4dccd1470bb1376c89568
Log:
Mark error and exception functions as "cold" (Matt's idea)
Changed paths:
M Zend/zend.c
M Zend/zend..h
M Zend/zend_API.c
M Zend/zend_API.h
M Zend/zend_alloc.c
M Zend/zend_closures.c
M Zend/zend_exceptions.c
M Zend/zend_exceptions.h
M Zend/zend_execute.c
M Zend/zend_generators.c
M Zend/zend_inheritance.c
M Zend/zend_object_handlers.c
M Zend/zend_object_handlers.h
M Zend/zend_portability.h
diff --git a/Zend/zend.c b/Zend/zend.c index 4a39c7f..d9f29ab 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -880,7 +880,7 @@ void zend_set_utility_values(zend_utility_values *utility_values) /* {{{ */ /* }}} */ /* this should be compatible with the standard zenderror */ -void zenderror(const char *error) /* {{{ */ +ZEND_COLD void zenderror(const char *error) /* {{{ */ { if (EG(exception)) { /* An exception was thrown in the lexer, don't throw another in the parser. */ @@ -892,7 +892,7 @@ void zenderror(const char *error) /* {{{ */ /* }}} */ BEGIN_EXTERN_C() -ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */ +ZEND_API ZEND_COLD void _zend_bailout(char *filename, uint lineno) /* {{{ */ { if (!EG(bailout)) { @@ -1032,9 +1032,9 @@ ZEND_API zval *zend_get_configuration_directive(zend_string *name) /* {{{ */ } while (0) #if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS) -ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ +ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) /* {{{ */ #else -static void zend_error_va_list(int type, const char *format, va_list args) +static ZEND_COLD void zend_error_va_list(int type, const char *format, va_list args) #endif { char *str; @@ -1274,9 +1274,9 @@ static void zend_error_va_list(int type, const char *format, va_list args) #ifdef HAVE_NORETURN # ifdef HAVE_NORETURN_ALIAS -void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((alias("zend_error"),noreturn)); +ZEND_COLD void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((alias("zend_error"),noreturn)); # else -ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ +ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) /* {{{ */ { va_list va; @@ -1285,7 +1285,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ va_end(va); } -ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) +ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) { va_list va; @@ -1297,7 +1297,7 @@ ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, .. # endif #endif -ZEND_API void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...) /* {{{ */ +ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...) /* {{{ */ { va_list va; char *message = NULL; @@ -1326,7 +1326,7 @@ ZEND_API void zend_throw_error(zend_class_entry *exception_ce, const char *forma } /* }}} */ -ZEND_API void zend_type_error(const char *format, ...) /* {{{ */ +ZEND_API ZEND_COLD void zend_type_error(const char *format, ...) /* {{{ */ { va_list va; char *message = NULL; @@ -1338,7 +1338,7 @@ ZEND_API void zend_type_error(const char *format, ...) /* {{{ */ va_end(va); } /* }}} */ -ZEND_API void zend_internal_type_error(zend_bool throw_exception, const char *format, ...) /* {{{ */ +ZEND_API ZEND_COLD void zend_internal_type_error(zend_bool throw_exception, const char *format, ...) /* {{{ */ { va_list va; char *message = NULL; @@ -1355,7 +1355,7 @@ ZEND_API void zend_internal_type_error(zend_bool throw_exception, const char *fo va_end(va); } /* }}} */ -ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) /* {{{ */ +ZEND_API ZEND_COLD void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) /* {{{ */ { #if ZEND_DEBUG va_list args; diff --git a/Zend/zend.h b/Zend/zend.h index 2d90424..c4f1a23 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -78,9 +78,9 @@ ZEND_TSRMLS_CACHE_EXTERN(); #ifdef HAVE_NORETURN # ifdef ZEND_NORETRUN_ALIAS -void zend_error_noreturn(int type, const char *format, ...) ZEND_NORETURN; +ZEND_COLD void zend_error_noreturn(int type, const char *format, ...) ZEND_NORETURN; # else -ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...); +ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...); # endif #else # define zend_error_noreturn zend_error @@ -240,7 +240,7 @@ void zend_register_standard_ini_entries(void); void zend_post_startup(void); void zend_set_utility_values(zend_utility_values *utility_values); -ZEND_API void _zend_bailout(char *filename, uint lineno); +ZEND_API ZEND_COLD void _zend_bailout(char *filename, uint lineno); ZEND_API char *get_zend_version(void); ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy); @@ -249,7 +249,7 @@ ZEND_API size_t zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int ZEND_API void zend_print_zval_r(zval *expr, int indent); ZEND_API void zend_print_flat_zval_r(zval *expr); ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent); -ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); +ZEND_API ZEND_COLD void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); ZEND_API void zend_activate(void); ZEND_API void zend_deactivate(void); @@ -284,10 +284,10 @@ extern zend_string *(*zend_vstrpprintf)(size_t max_len, const char *format, va_l extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len); extern ZEND_API zend_string *(*zend_resolve_path)(const char *filename, int filename_len); -ZEND_API void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); -ZEND_API void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...); -ZEND_API void zend_type_error(const char *format, ...); -ZEND_API void zend_internal_type_error(zend_bool throw_exception, const char *format, ...); +ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); +ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...); +ZEND_API ZEND_COLD void zend_type_error(const char *format, ...); +ZEND_API ZEND_COLD void zend_internal_type_error(zend_bool throw_exception, const char *format, ...); void zenderror(const char *error); diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 559a1d2..133109f 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -149,7 +149,7 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array) / } /* }}} */ -ZEND_API void zend_wrong_param_count(void) /* {{{ */ +ZEND_API ZEND_COLD void zend_wrong_param_count(void) /* {{{ */ { const char *space; const char *class_name = get_active_class_name(&space); @@ -196,7 +196,7 @@ ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */ /* }}} */ #ifdef FAST_ZPP -ZEND_API void ZEND_FASTCALL zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args) /* {{{ */ +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args) /* {{{ */ { zend_function *active_function = EG(current_execute_data)->func; const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : ""; @@ -212,7 +212,7 @@ ZEND_API void ZEND_FASTCALL zend_wrong_paramers_count_error(int num_args, int mi } /* }}} */ -ZEND_API void ZEND_FASTCALL zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg) /* {{{ */ +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg) /* {{{ */ { const char *space; const char *class_name = get_active_class_name(&space); @@ -226,7 +226,7 @@ ZEND_API void ZEND_FASTCALL zend_wrong_paramer_type_error(int num, zend_expected } /* }}} */ -ZEND_API void ZEND_FASTCALL zend_wrong_paramer_class_error(int num, char *name, zval *arg) /* {{{ */ +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_paramer_class_error(int num, char *name, zval *arg) /* {{{ */ { const char *space; const char *class_name = get_active_class_name(&space); @@ -236,7 +236,7 @@ ZEND_API void ZEND_FASTCALL zend_wrong_paramer_class_error(int num, char *name, } /* }}} */ -ZEND_API void ZEND_FASTCALL zend_wrong_callback_error(int severity, int num, char *error) /* {{{ */ +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int severity, int num, char *error) /* {{{ */ { const char *space; const char *class_name = get_active_class_name(&space); @@ -790,7 +790,7 @@ ZEND_API int zend_parse_parameter(int flags, int arg_num, zval *arg, const char return ret; } -static void zend_parse_parameters_debug_error(const char *msg) { +static ZEND_COLD void zend_parse_parameters_debug_error(const char *msg) { zend_function *active_function = EG(current_execute_data)->func; const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : ""; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 0fc0584..66a5cb6 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -300,7 +300,7 @@ ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zen ZEND_API int zend_disable_function(char *function_name, size_t function_name_length); ZEND_API int zend_disable_class(char *class_name, size_t class_name_length); -ZEND_API void zend_wrong_param_count(void); +ZEND_API ZEND_COLD void zend_wrong_param_count(void); #define IS_CALLABLE_CHECK_SYNTAX_ONLY (1<<0) #define IS_CALLABLE_CHECK_NO_ACCESS (1<<1) @@ -691,10 +691,10 @@ typedef enum _zend_expected_type { Z_EXPECTED_LAST } zend_expected_type; -ZEND_API void ZEND_FASTCALL zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args); -ZEND_API void ZEND_FASTCALL zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg); -ZEND_API void ZEND_FASTCALL zend_wrong_paramer_class_error(int num, char *name, zval *arg); -ZEND_API void ZEND_FASTCALL zend_wrong_callback_error(int severity, int num, char *error); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_paramer_class_error(int num, char *name, zval *arg); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int severity, int num, char *error); #define ZPP_ERROR_OK 0 #define ZPP_ERROR_FAILURE 1 diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 52b1ac5..493cf1f 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -338,7 +338,7 @@ static const int bin_pages[] = { }; #if ZEND_DEBUG -void zend_debug_alloc_output(char *format, ...) +ZEND_COLD void zend_debug_alloc_output(char *format, ...) { char output_buf[256]; va_list args; @@ -355,7 +355,7 @@ void zend_debug_alloc_output(char *format, ...) } #endif -static ZEND_NORETURN void zend_mm_panic(const char *message) +static ZEND_COLD ZEND_NORETURN void zend_mm_panic(const char *message) { fprintf(stderr, "%s\n", message); /* See http://support.microsoft.com/kb/190351 */ @@ -368,7 +368,7 @@ static ZEND_NORETURN void zend_mm_panic(const char *message) exit(1); } -static ZEND_NORETURN void zend_mm_safe_error(zend_mm_heap *heap, +static ZEND_COLD ZEND_NORETURN void zend_mm_safe_error(zend_mm_heap *heap, const char *format, size_t limit, #if ZEND_DEBUG diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 6f16935..637e2dd 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -205,7 +205,7 @@ ZEND_METHOD(Closure, bind) } /* }}} */ -static zend_function *zend_closure_get_constructor(zend_object *object) /* {{{ */ +static ZEND_COLD zend_function *zend_closure_get_constructor(zend_object *object) /* {{{ */ { zend_throw_error(NULL, "Instantiation of 'Closure' is not allowed"); return NULL; @@ -448,7 +448,7 @@ static HashTable *zend_closure_get_gc(zval *obj, zval **table, int *n) /* {{{ */ /* {{{ proto Closure::__construct() Private constructor preventing instantiation */ -ZEND_METHOD(Closure, __construct) +ZEND_COLD ZEND_METHOD(Closure, __construct) { zend_throw_error(NULL, "Instantiation of 'Closure' is not allowed"); } diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index e38c414..002f519 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -120,7 +120,7 @@ void zend_exception_restore(void) /* {{{ */ } /* }}} */ -ZEND_API void zend_throw_exception_internal(zval *exception) /* {{{ */ +ZEND_API ZEND_COLD void zend_throw_exception_internal(zval *exception) /* {{{ */ { #ifdef HAVE_DTRACE if (DTRACE_EXCEPTION_THROWN_ENABLED()) { @@ -233,7 +233,7 @@ static zend_object *zend_error_exception_new(zend_class_entry *class_type) /* {{ /* {{{ proto Exception|Error Exception|Error::__clone() Clone the exception object */ -ZEND_METHOD(exception, __clone) +ZEND_COLD ZEND_METHOD(exception, __clone) { /* Should never be executable */ zend_throw_exception(NULL, "Cannot clone object using __clone()", 0); @@ -908,7 +908,7 @@ ZEND_API zend_class_entry *zend_get_error_exception(void) } /* }}} */ -ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code) /* {{{ */ +ZEND_API ZEND_COLD zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code) /* {{{ */ { zval ex; @@ -935,7 +935,7 @@ ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const } /* }}} */ -ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format, ...) /* {{{ */ +ZEND_API ZEND_COLD zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format, ...) /* {{{ */ { va_list arg; char *message; @@ -950,7 +950,7 @@ ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, ze } /* }}} */ -ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_long code, int severity) /* {{{ */ +ZEND_API ZEND_COLD zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_long code, int severity) /* {{{ */ { zval ex; zend_object *obj = zend_throw_exception(exception_ce, message, code); @@ -980,7 +980,7 @@ static void zend_error_helper(int type, const char *filename, const uint lineno, } /* This function doesn't return if it uses E_ERROR */ -ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */ +ZEND_API ZEND_COLD void zend_exception_error(zend_object *ex, int severity) /* {{{ */ { zval exception, rv; zend_class_entry *ce_exception; @@ -1048,7 +1048,7 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */ } /* }}} */ -ZEND_API void zend_throw_exception_object(zval *exception) /* {{{ */ +ZEND_API ZEND_COLD void zend_throw_exception_object(zval *exception) /* {{{ */ { zend_class_entry *exception_ce; diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index f9bf24b..9b8d0d9 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -39,7 +39,7 @@ ZEND_API void zend_exception_set_previous(zend_object *exception, zend_object *a ZEND_API void zend_exception_save(void); ZEND_API void zend_exception_restore(void); -ZEND_API void zend_throw_exception_internal(zval *exception); +ZEND_API ZEND_COLD void zend_throw_exception_internal(zval *exception); void zend_register_default_exception(void); @@ -55,9 +55,9 @@ ZEND_API void zend_register_default_classes(void); /* exception_ce NULL, zend_ce_exception, zend_ce_error, or a derived class * message NULL or the message of the exception */ -ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code); -ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format, ...); -ZEND_API void zend_throw_exception_object(zval *exception); +ZEND_API ZEND_COLD zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code); +ZEND_API ZEND_COLD zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format, ...); +ZEND_API ZEND_COLD void zend_throw_exception_object(zval *exception); ZEND_API void zend_clear_exception(void); ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_long code, int severity); @@ -65,7 +65,7 @@ ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, extern ZEND_API void (*zend_throw_exception_hook)(zval *ex); /* show an exception using zend_error(severity,...), severity should be E_ERROR */ -ZEND_API void zend_exception_error(zend_object *exception, int severity); +ZEND_API ZEND_COLD void zend_exception_error(zend_object *exception, int severity); /* do not export, in php it's available thru spprintf directly */ size_t zend_spprintf(char **message, size_t max_len, const char *format, ...); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index c443fe4..59f936d 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -585,7 +585,7 @@ static zend_always_inline zend_class_entry* zend_verify_arg_class_kind(const zen return zend_fetch_class(cur_arg_info->class_name, (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD)); } -static void zend_verify_arg_error(const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg) +static ZEND_COLD void zend_verify_arg_error(const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg) { zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data; const char *fname = ZSTR_VAL(zf->common.function_name); @@ -846,10 +846,10 @@ static zend_always_inline int zend_verify_missing_arg_type(zend_function *zf, ui return 1; } -static zend_always_inline int zend_verify_missing_arg(zend_execute_data *execute_data, uint32_t arg_num, void **cache_slot) +static ZEND_COLD int zend_verify_missing_arg(zend_execute_data *execute_data, uint32_t arg_num, void **cache_slot) { if (EXPECTED(!(EX(func)->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) || - zend_verify_missing_arg_type(EX(func), arg_num, cache_slot)) { + UNEXPECTED(zend_verify_missing_arg_type(EX(func), arg_num, cache_slot))) { const char *class_name = EX(func)->common.scope ? ZSTR_VAL(EX(func)->common.scope->name) : ""; const char *space = EX(func)->common.scope ? "::" : ""; const char *func_name = EX(func)->common.function_name ? ZSTR_VAL(EX(func)->common.function_name) : "main"; @@ -865,7 +865,7 @@ static zend_always_inline int zend_verify_missing_arg(zend_execute_data *execute return 0; } -static void zend_verify_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind) +static ZEND_COLD void zend_verify_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind) { const char *fname = ZSTR_VAL(zf->common.function_name); const char *fsep; @@ -889,7 +889,7 @@ static void zend_verify_return_error(const zend_function *zf, const char *need_m } } -static void zend_verify_internal_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind) +static ZEND_COLD void zend_verify_internal_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind) { const char *fname = ZSTR_VAL(zf->common.function_name); const char *fsep; @@ -1003,7 +1003,7 @@ static zend_always_inline void zend_verify_return_type(zend_function *zf, zval * } } -static zend_always_inline int zend_verify_missing_return_type(zend_function *zf, void **cache_slot) +static ZEND_COLD int zend_verify_missing_return_type(zend_function *zf, void **cache_slot) { zend_arg_info *ret_info = zf->common.arg_info - 1; char *need_msg; diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 9ca264b..0b54292 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -263,7 +263,7 @@ ZEND_API void zend_generator_create_zval(zend_execute_data *call, zend_op_array } /* }}} */ -static zend_function *zend_generator_get_constructor(zend_object *object) /* {{{ */ +static ZEND_COLD zend_function *zend_generator_get_constructor(zend_object *object) /* {{{ */ { zend_throw_error(NULL, "The \"Generator\" class is reserved for internal use and cannot be manually instantiated"); diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 3ccade9..0d02bf7 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -345,7 +345,7 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c } /* }}} */ -static void zend_append_type_hint(smart_str *str, const zend_function *fptr, zend_arg_info *arg_info, int return_hint) /* {{{ */ +static ZEND_COLD void zend_append_type_hint(smart_str *str, const zend_function *fptr, zend_arg_info *arg_info, int return_hint) /* {{{ */ { if (arg_info->class_name) { const char *class_name; @@ -387,7 +387,7 @@ static void zend_append_type_hint(smart_str *str, const zend_function *fptr, zen } /* }}} */ -static zend_string *zend_get_function_declaration(const zend_function *fptr) /* {{{ */ +static ZEND_COLD zend_string *zend_get_function_declaration(const zend_function *fptr) /* {{{ */ { smart_str str = {0}; diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 43a010c..1c06f1e 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -1300,7 +1300,7 @@ undeclared_property: } /* }}} */ -ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name) /* {{{ */ +ZEND_API ZEND_COLD zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name) /* {{{ */ { zend_throw_error(NULL, "Attempt to unset static property %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(property_name)); return 0; diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index 77ac850..0bd8c7e 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -163,7 +163,7 @@ extern ZEND_API zend_object_handlers std_object_handlers; BEGIN_EXTERN_C() ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_string *function_name_strval, const zval *key); ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent); -ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name); +ZEND_API ZEND_COLD zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name); ZEND_API union _zend_function *zend_std_get_constructor(zend_object *object); ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent); ZEND_API HashTable *zend_std_get_properties(zval *object); diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index 5552350..77cd3ee 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -216,9 +216,13 @@ char *alloca(); #if defined(__GNUC__) && ZEND_GCC_VERSION >= 4003 # define ZEND_ATTRIBUTE_UNUSED __attribute__((unused)) # define ZEND_ATTRIBUTE_UNUSED_LABEL __attribute__((cold, unused)); +# define ZEND_COLD __attribute__((cold)) +# define ZEND_HOT __attribute__((cold)) #else # define ZEND_ATTRIBUTE_UNUSED # define ZEND_ATTRIBUTE_UNUSED_LABEL +# define ZEND_COLD __attribute__((cold)) +# define ZEND_HOT __attribute__((cold)); #endif #if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004 && defined(__i386__)
diff --git a/Zend/zend.c b/Zend/zend.c index 4a39c7f..d9f29ab 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -880,7 +880,7 @@ void zend_set_utility_values(zend_utility_values *utility_values) /* {{{ */ /* }}} */ /* this should be compatible with the standard zenderror */ -void zenderror(const char *error) /* {{{ */ +ZEND_COLD void zenderror(const char *error) /* {{{ */ { if (EG(exception)) { /* An exception was thrown in the lexer, don't throw another in the parser. */ @@ -892,7 +892,7 @@ void zenderror(const char *error) /* {{{ */ /* }}} */ BEGIN_EXTERN_C() -ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */ +ZEND_API ZEND_COLD void _zend_bailout(char *filename, uint lineno) /* {{{ */ { if (!EG(bailout)) { @@ -1032,9 +1032,9 @@ ZEND_API zval *zend_get_configuration_directive(zend_string *name) /* {{{ */ } while (0) #if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS) -ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ +ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) /* {{{ */ #else -static void zend_error_va_list(int type, const char *format, va_list args) +static ZEND_COLD void zend_error_va_list(int type, const char *format, va_list args) #endif { char *str; @@ -1274,9 +1274,9 @@ static void zend_error_va_list(int type, const char *format, va_list args) #ifdef HAVE_NORETURN # ifdef HAVE_NORETURN_ALIAS -void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((alias("zend_error"),noreturn)); +ZEND_COLD void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((alias("zend_error"),noreturn)); # else -ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ +ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) /* {{{ */ { va_list va; @@ -1285,7 +1285,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ va_end(va); } -ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) +ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) { va_list va; @@ -1297,7 +1297,7 @@ ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, .. # endif #endif -ZEND_API void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...) /* {{{ */ +ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...) /* {{{ */ { va_list va; char *message = NULL; @@ -1326,7 +1326,7 @@ ZEND_API void zend_throw_error(zend_class_entry *exception_ce, const char *forma } /* }}} */ -ZEND_API void zend_type_error(const char *format, ...) /* {{{ */ +ZEND_API ZEND_COLD void zend_type_error(const char *format, ...) /* {{{ */ { va_list va; char *message = NULL; @@ -1338,7 +1338,7 @@ ZEND_API void zend_type_error(const char *format, ...) /* {{{ */ va_end(va); } /* }}} */ -ZEND_API void zend_internal_type_error(zend_bool throw_exception, const char *format, ...) /* {{{ */ +ZEND_API ZEND_COLD void zend_internal_type_error(zend_bool throw_exception, const char *format, ...) /* {{{ */ { va_list va; char *message = NULL; @@ -1355,7 +1355,7 @@ ZEND_API void zend_internal_type_error(zend_bool throw_exception, const char *fo va_end(va); } /* }}} */ -ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) /* {{{ */ +ZEND_API ZEND_COLD void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) /* {{{ */ { #if ZEND_DEBUG va_list args; diff --git a/Zend/zend.h b/Zend/zend.h index 2d90424..c4f1a23 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -78,9 +78,9 @@ ZEND_TSRMLS_CACHE_EXTERN(); #ifdef HAVE_NORETURN # ifdef ZEND_NORETRUN_ALIAS -void zend_error_noreturn(int type, const char *format, ...) ZEND_NORETURN; +ZEND_COLD void zend_error_noreturn(int type, const char *format, ...) ZEND_NORETURN; # else -ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...); +ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...); # endif #else # define zend_error_noreturn zend_error @@ -240,7 +240,7 @@ void zend_register_standard_ini_entries(void); void zend_post_startup(void); void zend_set_utility_values(zend_utility_values *utility_values); -ZEND_API void _zend_bailout(char *filename, uint lineno); +ZEND_API ZEND_COLD void _zend_bailout(char *filename, uint lineno); ZEND_API char *get_zend_version(void); ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy); @@ -249,7 +249,7 @@ ZEND_API size_t zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int ZEND_API void zend_print_zval_r(zval *expr, int indent); ZEND_API void zend_print_flat_zval_r(zval *expr); ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent); -ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); +ZEND_API ZEND_COLD void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); ZEND_API void zend_activate(void); ZEND_API void zend_deactivate(void); @@ -284,10 +284,10 @@ extern zend_string *(*zend_vstrpprintf)(size_t max_len, const char *format, va_l extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len); extern ZEND_API zend_string *(*zend_resolve_path)(const char *filename, int filename_len); -ZEND_API void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); -ZEND_API void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...); -ZEND_API void zend_type_error(const char *format, ...); -ZEND_API void zend_internal_type_error(zend_bool throw_exception, const char *format, ...); +ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); +ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...); +ZEND_API ZEND_COLD void zend_type_error(const char *format, ...); +ZEND_API ZEND_COLD void zend_internal_type_error(zend_bool throw_exception, const char *format, ...); void zenderror(const char *error); diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 559a1d2..133109f 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -149,7 +149,7 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array) / } /* }}} */ -ZEND_API void zend_wrong_param_count(void) /* {{{ */ +ZEND_API ZEND_COLD void zend_wrong_param_count(void) /* {{{ */ { const char *space; const char *class_name = get_active_class_name(&space); @@ -196,7 +196,7 @@ ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */ /* }}} */ #ifdef FAST_ZPP -ZEND_API void ZEND_FASTCALL zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args) /* {{{ */ +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args) /* {{{ */ { zend_function *active_function = EG(current_execute_data)->func; const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : ""; @@ -212,7 +212,7 @@ ZEND_API void ZEND_FASTCALL zend_wrong_paramers_count_error(int num_args, int mi } /* }}} */ -ZEND_API void ZEND_FASTCALL zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg) /* {{{ */ +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg) /* {{{ */ { const char *space; const char *class_name = get_active_class_name(&space); @@ -226,7 +226,7 @@ ZEND_API void ZEND_FASTCALL zend_wrong_paramer_type_error(int num, zend_expected } /* }}} */ -ZEND_API void ZEND_FASTCALL zend_wrong_paramer_class_error(int num, char *name, zval *arg) /* {{{ */ +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_paramer_class_error(int num, char *name, zval *arg) /* {{{ */ { const char *space; const char *class_name = get_active_class_name(&space); @@ -236,7 +236,7 @@ ZEND_API void ZEND_FASTCALL zend_wrong_paramer_class_error(int num, char *name, } /* }}} */ -ZEND_API void ZEND_FASTCALL zend_wrong_callback_error(int severity, int num, char *error) /* {{{ */ +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int severity, int num, char *error) /* {{{ */ { const char *space; const char *class_name = get_active_class_name(&space); @@ -790,7 +790,7 @@ ZEND_API int zend_parse_parameter(int flags, int arg_num, zval *arg, const char return ret; } -static void zend_parse_parameters_debug_error(const char *msg) { +static ZEND_COLD void zend_parse_parameters_debug_error(const char *msg) { zend_function *active_function = EG(current_execute_data)->func; const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : ""; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 0fc0584..66a5cb6 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -300,7 +300,7 @@ ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zen ZEND_API int zend_disable_function(char *function_name, size_t function_name_length); ZEND_API int zend_disable_class(char *class_name, size_t class_name_length); -ZEND_API void zend_wrong_param_count(void); +ZEND_API ZEND_COLD void zend_wrong_param_count(void); #define IS_CALLABLE_CHECK_SYNTAX_ONLY (1<<0) #define IS_CALLABLE_CHECK_NO_ACCESS (1<<1) @@ -691,10 +691,10 @@ typedef enum _zend_expected_type { Z_EXPECTED_LAST } zend_expected_type; -ZEND_API void ZEND_FASTCALL zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args); -ZEND_API void ZEND_FASTCALL zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg); -ZEND_API void ZEND_FASTCALL zend_wrong_paramer_class_error(int num, char *name, zval *arg); -ZEND_API void ZEND_FASTCALL zend_wrong_callback_error(int severity, int num, char *error); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_paramer_class_error(int num, char *name, zval *arg); +ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int severity, int num, char *error); #define ZPP_ERROR_OK 0 #define ZPP_ERROR_FAILURE 1 diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 52b1ac5..493cf1f 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -338,7 +338,7 @@ static const int bin_pages[] = { }; #if ZEND_DEBUG -void zend_debug_alloc_output(char *format, ...) +ZEND_COLD void zend_debug_alloc_output(char *format, ...) { char output_buf[256]; va_list args; @@ -355,7 +355,7 @@ void zend_debug_alloc_output(char *format, ...) } #endif -static ZEND_NORETURN void zend_mm_panic(const char *message) +static ZEND_COLD ZEND_NORETURN void zend_mm_panic(const char *message) { fprintf(stderr, "%s\n", message); /* See http://support.microsoft.com/kb/190351 */ @@ -368,7 +368,7 @@ static ZEND_NORETURN void zend_mm_panic(const char *message) exit(1); } -static ZEND_NORETURN void zend_mm_safe_error(zend_mm_heap *heap, +static ZEND_COLD ZEND_NORETURN void zend_mm_safe_error(zend_mm_heap *heap, const char *format, size_t limit, #if ZEND_DEBUG diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 6f16935..637e2dd 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -205,7 +205,7 @@ ZEND_METHOD(Closure, bind) } /* }}} */ -static zend_function *zend_closure_get_constructor(zend_object *object) /* {{{ */ +static ZEND_COLD zend_function *zend_closure_get_constructor(zend_object *object) /* {{{ */ { zend_throw_error(NULL, "Instantiation of 'Closure' is not allowed"); return NULL; @@ -448,7 +448,7 @@ static HashTable *zend_closure_get_gc(zval *obj, zval **table, int *n) /* {{{ */ /* {{{ proto Closure::__construct() Private constructor preventing instantiation */ -ZEND_METHOD(Closure, __construct) +ZEND_COLD ZEND_METHOD(Closure, __construct) { zend_throw_error(NULL, "Instantiation of 'Closure' is not allowed"); } diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index e38c414..002f519 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -120,7 +120,7 @@ void zend_exception_restore(void) /* {{{ */ } /* }}} */ -ZEND_API void zend_throw_exception_internal(zval *exception) /* {{{ */ +ZEND_API ZEND_COLD void zend_throw_exception_internal(zval *exception) /* {{{ */ { #ifdef HAVE_DTRACE if (DTRACE_EXCEPTION_THROWN_ENABLED()) { @@ -233,7 +233,7 @@ static zend_object *zend_error_exception_new(zend_class_entry *class_type) /* {{ /* {{{ proto Exception|Error Exception|Error::__clone() Clone the exception object */ -ZEND_METHOD(exception, __clone) +ZEND_COLD ZEND_METHOD(exception, __clone) { /* Should never be executable */ zend_throw_exception(NULL, "Cannot clone object using __clone()", 0); @@ -908,7 +908,7 @@ ZEND_API zend_class_entry *zend_get_error_exception(void) } /* }}} */ -ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code) /* {{{ */ +ZEND_API ZEND_COLD zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code) /* {{{ */ { zval ex; @@ -935,7 +935,7 @@ ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const } /* }}} */ -ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format, ...) /* {{{ */ +ZEND_API ZEND_COLD zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format, ...) /* {{{ */ { va_list arg; char *message; @@ -950,7 +950,7 @@ ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, ze } /* }}} */ -ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_long code, int severity) /* {{{ */ +ZEND_API ZEND_COLD zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_long code, int severity) /* {{{ */ { zval ex; zend_object *obj = zend_throw_exception(exception_ce, message, code); @@ -980,7 +980,7 @@ static void zend_error_helper(int type, const char *filename, const uint lineno, } /* This function doesn't return if it uses E_ERROR */ -ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */ +ZEND_API ZEND_COLD void zend_exception_error(zend_object *ex, int severity) /* {{{ */ { zval exception, rv; zend_class_entry *ce_exception; @@ -1048,7 +1048,7 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */ } /* }}} */ -ZEND_API void zend_throw_exception_object(zval *exception) /* {{{ */ +ZEND_API ZEND_COLD void zend_throw_exception_object(zval *exception) /* {{{ */ { zend_class_entry *exception_ce; diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h index f9bf24b..9b8d0d9 100644 --- a/Zend/zend_exceptions.h +++ b/Zend/zend_exceptions.h @@ -39,7 +39,7 @@ ZEND_API void zend_exception_set_previous(zend_object *exception, zend_object *a ZEND_API void zend_exception_save(void); ZEND_API void zend_exception_restore(void); -ZEND_API void zend_throw_exception_internal(zval *exception); +ZEND_API ZEND_COLD void zend_throw_exception_internal(zval *exception); void zend_register_default_exception(void); @@ -55,9 +55,9 @@ ZEND_API void zend_register_default_classes(void); /* exception_ce NULL, zend_ce_exception, zend_ce_error, or a derived class * message NULL or the message of the exception */ -ZEND_API zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code); -ZEND_API zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format, ...); -ZEND_API void zend_throw_exception_object(zval *exception); +ZEND_API ZEND_COLD zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code); +ZEND_API ZEND_COLD zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format, ...); +ZEND_API ZEND_COLD void zend_throw_exception_object(zval *exception); ZEND_API void zend_clear_exception(void); ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, const char *message, zend_long code, int severity); @@ -65,7 +65,7 @@ ZEND_API zend_object *zend_throw_error_exception(zend_class_entry *exception_ce, extern ZEND_API void (*zend_throw_exception_hook)(zval *ex); /* show an exception using zend_error(severity,...), severity should be E_ERROR */ -ZEND_API void zend_exception_error(zend_object *exception, int severity); +ZEND_API ZEND_COLD void zend_exception_error(zend_object *exception, int severity); /* do not export, in php it's available thru spprintf directly */ size_t zend_spprintf(char **message, size_t max_len, const char *format, ...); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index c443fe4..59f936d 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -585,7 +585,7 @@ static zend_always_inline zend_class_entry* zend_verify_arg_class_kind(const zen return zend_fetch_class(cur_arg_info->class_name, (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD)); } -static void zend_verify_arg_error(const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg) +static ZEND_COLD void zend_verify_arg_error(const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg) { zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data; const char *fname = ZSTR_VAL(zf->common.function_name); @@ -846,10 +846,10 @@ static zend_always_inline int zend_verify_missing_arg_type(zend_function *zf, ui return 1; } -static zend_always_inline int zend_verify_missing_arg(zend_execute_data *execute_data, uint32_t arg_num, void **cache_slot) +static ZEND_COLD int zend_verify_missing_arg(zend_execute_data *execute_data, uint32_t arg_num, void **cache_slot) { if (EXPECTED(!(EX(func)->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) || - zend_verify_missing_arg_type(EX(func), arg_num, cache_slot)) { + UNEXPECTED(zend_verify_missing_arg_type(EX(func), arg_num, cache_slot))) { const char *class_name = EX(func)->common.scope ? ZSTR_VAL(EX(func)->common.scope->name) : ""; const char *space = EX(func)->common.scope ? "::" : ""; const char *func_name = EX(func)->common.function_name ? ZSTR_VAL(EX(func)->common.function_name) : "main"; @@ -865,7 +865,7 @@ static zend_always_inline int zend_verify_missing_arg(zend_execute_data *execute return 0; } -static void zend_verify_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind) +static ZEND_COLD void zend_verify_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind) { const char *fname = ZSTR_VAL(zf->common.function_name); const char *fsep; @@ -889,7 +889,7 @@ static void zend_verify_return_error(const zend_function *zf, const char *need_m } } -static void zend_verify_internal_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind) +static ZEND_COLD void zend_verify_internal_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind) { const char *fname = ZSTR_VAL(zf->common.function_name); const char *fsep; @@ -1003,7 +1003,7 @@ static zend_always_inline void zend_verify_return_type(zend_function *zf, zval * } } -static zend_always_inline int zend_verify_missing_return_type(zend_function *zf, void **cache_slot) +static ZEND_COLD int zend_verify_missing_return_type(zend_function *zf, void **cache_slot) { zend_arg_info *ret_info = zf->common.arg_info - 1; char *need_msg; diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 9ca264b..0b54292 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -263,7 +263,7 @@ ZEND_API void zend_generator_create_zval(zend_execute_data *call, zend_op_array } /* }}} */ -static zend_function *zend_generator_get_constructor(zend_object *object) /* {{{ */ +static ZEND_COLD zend_function *zend_generator_get_constructor(zend_object *object) /* {{{ */ { zend_throw_error(NULL, "The \"Generator\" class is reserved for internal use and cannot be manually instantiated"); diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 3ccade9..0d02bf7 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -345,7 +345,7 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c } /* }}} */ -static void zend_append_type_hint(smart_str *str, const zend_function *fptr, zend_arg_info *arg_info, int return_hint) /* {{{ */ +static ZEND_COLD void zend_append_type_hint(smart_str *str, const zend_function *fptr, zend_arg_info *arg_info, int return_hint) /* {{{ */ { if (arg_info->class_name) { const char *class_name; @@ -387,7 +387,7 @@ static void zend_append_type_hint(smart_str *str, const zend_function *fptr, zen } /* }}} */ -static zend_string *zend_get_function_declaration(const zend_function *fptr) /* {{{ */ +static ZEND_COLD zend_string *zend_get_function_declaration(const zend_function *fptr) /* {{{ */ { smart_str str = {0}; diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 43a010c..1c06f1e 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -1300,7 +1300,7 @@ undeclared_property: } /* }}} */ -ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name) /* {{{ */ +ZEND_API ZEND_COLD zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name) /* {{{ */ { zend_throw_error(NULL, "Attempt to unset static property %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(property_name)); return 0; diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index 77ac850..0bd8c7e 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -163,7 +163,7 @@ extern ZEND_API zend_object_handlers std_object_handlers; BEGIN_EXTERN_C() ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_string *function_name_strval, const zval *key); ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *property_name, zend_bool silent); -ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name); +ZEND_API ZEND_COLD zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name); ZEND_API union _zend_function *zend_std_get_constructor(zend_object *object); ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent); ZEND_API HashTable *zend_std_get_properties(zval *object); diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h index 5552350..77cd3ee 100644 --- a/Zend/zend_portability.h +++ b/Zend/zend_portability.h @@ -216,9 +216,13 @@ char *alloca(); #if defined(__GNUC__) && ZEND_GCC_VERSION >= 4003 # define ZEND_ATTRIBUTE_UNUSED __attribute__((unused)) # define ZEND_ATTRIBUTE_UNUSED_LABEL __attribute__((cold, unused)); +# define ZEND_COLD __attribute__((cold)) +# define ZEND_HOT __attribute__((cold)) #else # define ZEND_ATTRIBUTE_UNUSED # define ZEND_ATTRIBUTE_UNUSED_LABEL +# define ZEND_COLD __attribute__((cold)) +# define ZEND_HOT __attribute__((cold)); #endif #if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004 && defined(__i386__)