com php-src: Sync convert_to_null with VM cast beha vior: Zend/zend_operators.c Zend/zend_vm_def.h Zend/zend_vm_execute.h
| From: | Nikita Popov | Date: | Sun, 04 Sep 2016 10:36:16 +0000 |
| Subject: | com php-src: Sync convert_to_null with VM cast beha vior: Zend/zend_operators.c Zend/zend_vm_def.h Zend/zend_vm_execute.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94288@lists.php.net to get a copy of this message | ||
Commit: bbdff7ea24d97cdc198b413165a5218213b6c22d
Author: Nikita Popov <nikic@php.net> Sun, 4 Sep 2016 12:36:16 +0200
Parents: bbe0cca221d43499063f332c9377c435747fb807
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bbdff7ea24d97cdc198b413165a5218213b6c22d
Log:
Sync convert_to_null with VM cast behavior
Do not call cast_object, this is useless and we haven't been doing
it in the VM as of 7.0.
Changed paths:
M Zend/zend_operators.c
M Zend/zend_vm_def.h
M Zend/zend_vm_execute.h
Diff:
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 4159e43..9a90250 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -411,19 +411,6 @@ try_again:
ZEND_API void ZEND_FASTCALL convert_to_null(zval *op) /* {{{ */
{
- if (Z_TYPE_P(op) == IS_OBJECT) {
- if (Z_OBJ_HT_P(op)->cast_object) {
- zval org;
-
- ZVAL_COPY_VALUE(&org, op);
- if (Z_OBJ_HT_P(op)->cast_object(&org, op, IS_NULL) == SUCCESS) {
- zval_dtor(&org);
- return;
- }
- ZVAL_COPY_VALUE(op, &org);
- }
- }
-
zval_ptr_dtor(op);
ZVAL_NULL(op);
}
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 068235b..2c90e0f 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -5278,20 +5278,6 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY, TYPE)
switch (opline->extended_value) {
case IS_NULL:
- /* This code is taken from convert_to_null. However, it does not seems very useful,
- * because a conversion to null always results in the same value. This could only
- * be relevant if a cast_object handler for IS_NULL has some kind of side-effect. */
-#if 0
- if (OP1_TYPE == IS_VAR || OP1_TYPE == IS_CV) {
- ZVAL_DEREF(expr);
- }
- if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->cast_object) {
- if (Z_OBJ_HT_P(expr)->cast_object(expr, result, IS_NULL) == SUCCESS) {
- break;
- }
- }
-#endif
-
ZVAL_NULL(result);
break;
case _IS_BOOL:
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index e5e364c..fe2e319 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -3291,20 +3291,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL
ZEND_CAST_SPEC_CONST_HANDLER(ZEND_O
switch (opline->extended_value) {
case IS_NULL:
- /* This code is taken from convert_to_null. However, it does not seems very useful,
- * because a conversion to null always results in the same value. This could only
- * be relevant if a cast_object handler for IS_NULL has some kind of side-effect. */
-#if 0
- if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
- ZVAL_DEREF(expr);
- }
- if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->cast_object) {
- if (Z_OBJ_HT_P(expr)->cast_object(expr, result, IS_NULL) == SUCCESS) {
- break;
- }
- }
-#endif
-
ZVAL_NULL(result);
break;
case _IS_BOOL:
@@ -12416,20 +12402,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL
ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPC
switch (opline->extended_value) {
case IS_NULL:
- /* This code is taken from convert_to_null. However, it does not seems very useful,
- * because a conversion to null always results in the same value. This could only
- * be relevant if a cast_object handler for IS_NULL has some kind of side-effect. */
-#if 0
- if (IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) {
- ZVAL_DEREF(expr);
- }
- if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->cast_object) {
- if (Z_OBJ_HT_P(expr)->cast_object(expr, result, IS_NULL) == SUCCESS) {
- break;
- }
- }
-#endif
-
ZVAL_NULL(result);
break;
case _IS_BOOL:
@@ -15982,20 +15954,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL
ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPC
switch (opline->extended_value) {
case IS_NULL:
- /* This code is taken from convert_to_null. However, it does not seems very useful,
- * because a conversion to null always results in the same value. This could only
- * be relevant if a cast_object handler for IS_NULL has some kind of side-effect. */
-#if 0
- if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- ZVAL_DEREF(expr);
- }
- if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->cast_object) {
- if (Z_OBJ_HT_P(expr)->cast_object(expr, result, IS_NULL) == SUCCESS) {
- break;
- }
- }
-#endif
-
ZVAL_NULL(result);
break;
case _IS_BOOL:
@@ -35015,20 +34973,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL
ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCO
switch (opline->extended_value) {
case IS_NULL:
- /* This code is taken from convert_to_null.. However, it does not seems very useful,
- * because a conversion to null always results in the same value. This could only
- * be relevant if a cast_object handler for IS_NULL has some kind of side-effect. */
-#if 0
- if (IS_CV == IS_VAR || IS_CV == IS_CV) {
- ZVAL_DEREF(expr);
- }
- if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->cast_object) {
- if (Z_OBJ_HT_P(expr)->cast_object(expr, result, IS_NULL) == SUCCESS) {
- break;
- }
- }
-#endif
-
ZVAL_NULL(result);
break;
case _IS_BOOL: