diff options
author | Dmitry Stogov <dmitry@zend.com> | 2019-05-31 12:09:06 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2019-05-31 12:20:21 +0300 |
commit | 1df9f238fed314255b858e3996c35be8cdff917f (patch) | |
tree | ab3dbad2f11e44688926b6a98fb50b7c0c68d1b2 /Zend/zend.c | |
parent | 84333cad674890174c47f3c21b1b1cf85a4276ac (diff) | |
download | php-git-1df9f238fed314255b858e3996c35be8cdff917f.tar.gz |
Better hot/cold code splitting
Diffstat (limited to 'Zend/zend.c')
-rw-r--r-- | Zend/zend.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/Zend/zend.c b/Zend/zend.c index 5670dae703..080a75a3c4 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -1401,7 +1401,7 @@ static ZEND_COLD void zend_error_va_list( } /* }}} */ -static void get_filename_lineno(int type, const char **filename, uint32_t *lineno) { +static ZEND_COLD void get_filename_lineno(int type, const char **filename, uint32_t *lineno) { /* Obtain relevant filename and lineno */ switch (type) { case E_CORE_ERROR: @@ -1612,29 +1612,25 @@ ZEND_API ZEND_COLD void zend_output_debug_string(zend_bool trigger_break, const } /* }}} */ -ZEND_API void zend_try_exception_handler() /* {{{ */ +ZEND_API ZEND_COLD void zend_user_exception_handler(void) /* {{{ */ { - if (EG(exception)) { - if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) { - zval orig_user_exception_handler; - zval params[1], retval2; - zend_object *old_exception; - old_exception = EG(exception); - EG(exception) = NULL; - ZVAL_OBJ(¶ms[0], old_exception); - ZVAL_COPY_VALUE(&orig_user_exception_handler, &EG(user_exception_handler)); + zval orig_user_exception_handler; + zval params[1], retval2; + zend_object *old_exception; + old_exception = EG(exception); + EG(exception) = NULL; + ZVAL_OBJ(¶ms[0], old_exception); + ZVAL_COPY_VALUE(&orig_user_exception_handler, &EG(user_exception_handler)); - if (call_user_function(CG(function_table), NULL, &orig_user_exception_handler, &retval2, 1, params) == SUCCESS) { - zval_ptr_dtor(&retval2); - if (EG(exception)) { - OBJ_RELEASE(EG(exception)); - EG(exception) = NULL; - } - OBJ_RELEASE(old_exception); - } else { - EG(exception) = old_exception; - } + if (call_user_function(CG(function_table), NULL, &orig_user_exception_handler, &retval2, 1, params) == SUCCESS) { + zval_ptr_dtor(&retval2); + if (EG(exception)) { + OBJ_RELEASE(EG(exception)); + EG(exception) = NULL; } + OBJ_RELEASE(old_exception); + } else { + EG(exception) = old_exception; } } /* }}} */ @@ -1660,9 +1656,13 @@ ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...) / if (op_array) { zend_execute(op_array, retval); zend_exception_restore(); - zend_try_exception_handler(); - if (EG(exception)) { - zend_exception_error(EG(exception), E_ERROR); + if (UNEXPECTED(EG(exception))) { + if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) { + zend_user_exception_handler(); + } + if (EG(exception)) { + zend_exception_error(EG(exception), E_ERROR); + } } destroy_op_array(op_array); efree_size(op_array, sizeof(zend_op_array)); |