com php-src: Remove unnecessary type checks in verify_missing _return_type: Zend/zend_execute.c
| From: | Nikita Popov | Date: | Thu, 24 Oct 2019 13:52:06 +0000 |
| Subject: | com php-src: Remove unnecessary type checks in verify_missing _return_type: Zend/zend_execute.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109046@lists.php.net to get a copy of this message | ||
Commit: d71a6ee54fb43acc08a3ed471cc2469946e135de
Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 24 Oct 2019 15:52:06 +0200
Parents: 9666d7a753e1276b3ead88946af26695aac0d4df
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d71a6ee54fb43acc08a3ed471cc2469946e135de
Log:
Remove unnecessary type checks in verify_missing_return_type
We don't emit VERIFY_RETURN_TYPE for void functions, so there's
no need to check it here. It's always an error.
Changed paths:
M Zend/zend_execute.c
Diff:
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 5ace501cce1..7544742cd76 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1211,24 +1211,20 @@ static zend_always_inline void zend_verify_return_type(zend_function *zf,
zval *
static ZEND_COLD int zend_verify_missing_return_type(const zend_function *zf, void **cache_slot)
{
+ /* VERIFY_RETURN_TYPE is not emitted for "void" functions, so this is always an error.
*/
zend_arg_info *ret_info = zf->common.arg_info - 1;
- if (ZEND_TYPE_IS_SET(ret_info->type)
- && (!ZEND_TYPE_IS_MASK(ret_info->type)
- || !(ZEND_TYPE_MASK(ret_info->type) & MAY_BE_VOID))) {
- // TODO: Eliminate this!
- if (ZEND_TYPE_IS_CLASS(ret_info->type)) {
- if (UNEXPECTED(!*cache_slot)) {
- zend_class_entry *ce = zend_fetch_class(ZEND_TYPE_NAME(ret_info->type),
(ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
- if (ce) {
- *cache_slot = (void *) ce;
- }
+ // TODO: Eliminate this!
+ if (ZEND_TYPE_IS_CLASS(ret_info->type)) {
+ if (UNEXPECTED(!*cache_slot)) {
+ zend_class_entry *ce = zend_fetch_class(ZEND_TYPE_NAME(ret_info->type),
(ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
+ if (ce) {
+ *cache_slot = (void *) ce;
}
}
- zend_verify_return_error(zf, cache_slot, NULL);
- return 0;
}
- return 1;
+ zend_verify_return_error(zf, cache_slot, NULL);
+ return 0;
}
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_object_as_array(void)