]> granicus.if.org Git - php/commitdiff
Make IS_UNUSED to be zero.
authorDmitry Stogov <dmitry@zend.com>
Wed, 31 Jan 2018 08:18:41 +0000 (11:18 +0300)
committerDmitry Stogov <dmitry@zend.com>
Wed, 31 Jan 2018 08:18:41 +0000 (11:18 +0300)
UPGRADING.INTERNALS
Zend/zend.c
Zend/zend_compile.h
Zend/zend_opcode.c
Zend/zend_vm_execute.h
Zend/zend_vm_gen.php

index 69e073a4d3bdf555c00b49210cf6adc8ddfc8ec6..631ddf693c837ef52f30b73be394a2aaf16b7f16 100644 (file)
@@ -15,6 +15,7 @@ PHP 7.3 INTERNALS UPGRADE NOTES
   l. php_hrtime_current()
   m. zend_cpu_supports()
   n. IS_TYPE_COPYABLE
+  o. IS_UNUSED
 
 2. Build system changes
   a. Unix build system changes
@@ -110,6 +111,9 @@ PHP 7.3 INTERNALS UPGRADE NOTES
      IS_ARRAY type (it may be IS_TYPE_REFCOUNTED or not). All the related
      macros: Z_COPYABLE..., Z_IMMUTABLE... are kept for compatibility.
 
+  o. IS_UNUSED became zero and can't be used as a bitmask (there were no such
+     usages in PHP sources).
+
 ========================
 2. Build system changes
 ========================
index a915de1b3e1eef43ca424103ef0b9feca65ed6d5..aae1d13b1190d01a7898f819ab9857422324a247 100644 (file)
@@ -534,19 +534,10 @@ static void zend_init_exception_op(void) /* {{{ */
 {
        memset(EG(exception_op), 0, sizeof(EG(exception_op)));
        EG(exception_op)[0].opcode = ZEND_HANDLE_EXCEPTION;
-       EG(exception_op)[0].op1_type = IS_UNUSED;
-       EG(exception_op)[0].op2_type = IS_UNUSED;
-       EG(exception_op)[0].result_type = IS_UNUSED;
        ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op));
        EG(exception_op)[1].opcode = ZEND_HANDLE_EXCEPTION;
-       EG(exception_op)[1].op1_type = IS_UNUSED;
-       EG(exception_op)[1].op2_type = IS_UNUSED;
-       EG(exception_op)[1].result_type = IS_UNUSED;
        ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+1);
        EG(exception_op)[2].opcode = ZEND_HANDLE_EXCEPTION;
-       EG(exception_op)[2].op1_type = IS_UNUSED;
-       EG(exception_op)[2].op2_type = IS_UNUSED;
-       EG(exception_op)[2].result_type = IS_UNUSED;
        ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+2);
 }
 /* }}} */
@@ -555,9 +546,6 @@ static void zend_init_call_trampoline_op(void) /* {{{ */
 {
        memset(&EG(call_trampoline_op), 0, sizeof(EG(call_trampoline_op)));
        EG(call_trampoline_op).opcode = ZEND_CALL_TRAMPOLINE;
-       EG(call_trampoline_op).op1_type = IS_UNUSED;
-       EG(call_trampoline_op).op2_type = IS_UNUSED;
-       EG(call_trampoline_op).result_type = IS_UNUSED;
        ZEND_VM_SET_OPCODE_HANDLER(&EG(call_trampoline_op));
 }
 /* }}} */
index 44fe1f30740005c2a395f23526ea9b6a1f336943..228111e29ebfaf58bdaae5eb91d32c19c3f83ea3 100644 (file)
@@ -660,11 +660,11 @@ struct _zend_execute_data {
 
 #endif
 
+#define IS_UNUSED      0               /* Unused operand */
 #define IS_CONST       (1<<0)
 #define IS_TMP_VAR     (1<<1)
 #define IS_VAR         (1<<2)
-#define IS_UNUSED      (1<<3)  /* Unused variable */
-#define IS_CV          (1<<4)  /* Compiled variable */
+#define IS_CV          (1<<3)  /* Compiled variable */
 
 #include "zend_globals.h"
 
index e814052ab41301fbb5e1fdfb75b94707e5fcb82b..a0301a9add25fa633334cd6cbeb885f6d4b0567c 100644 (file)
@@ -458,7 +458,6 @@ void init_op(zend_op *op)
 {
        memset(op, 0, sizeof(zend_op));
        op->lineno = CG(zend_lineno);
-       SET_UNUSED(op->result);
 }
 
 zend_op *get_next_op(zend_op_array *op_array)
index 40341937fdffc5cf9282e79f14ab09635ba20111..71b496d643b40b75e63316753bbd80164837dd57 100644 (file)
@@ -66995,7 +66995,7 @@ ZEND_API int zend_vm_kind(void)
 static const void *zend_vm_get_opcode_handler_ex(uint32_t spec, const zend_op* op)
 {
        static const int zend_vm_decode[] = {
-               _UNUSED_CODE, /* 0              */
+               _UNUSED_CODE, /* 0 = IS_UNUSED  */
                _CONST_CODE,  /* 1 = IS_CONST   */
                _TMP_CODE,    /* 2 = IS_TMP_VAR */
                _UNUSED_CODE, /* 3              */
@@ -67003,15 +67003,7 @@ static const void *zend_vm_get_opcode_handler_ex(uint32_t spec, const zend_op* o
                _UNUSED_CODE, /* 5              */
                _UNUSED_CODE, /* 6              */
                _UNUSED_CODE, /* 7              */
-               _UNUSED_CODE, /* 8 = IS_UNUSED  */
-               _UNUSED_CODE, /* 9              */
-               _UNUSED_CODE, /* 10             */
-               _UNUSED_CODE, /* 11             */
-               _UNUSED_CODE, /* 12             */
-               _UNUSED_CODE, /* 13             */
-               _UNUSED_CODE, /* 14             */
-               _UNUSED_CODE, /* 15             */
-               _CV_CODE      /* 16 = IS_CV     */
+               _CV_CODE      /* 8 = IS_CV      */
        };
        uint32_t offset = 0;
        if (spec & SPEC_RULE_OP1) offset = offset * 5 + zend_vm_decode[op->op1_type];
@@ -67050,7 +67042,7 @@ static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend
 {
        uint32_t spec = zend_spec_handlers[opcode];
        static const int zend_vm_decode[] = {
-               _UNUSED_CODE, /* 0              */
+               _UNUSED_CODE, /* 0 = IS_UNUSED  */
                _CONST_CODE,  /* 1 = IS_CONST   */
                _TMP_CODE,    /* 2 = IS_TMP_VAR */
                _UNUSED_CODE, /* 3              */
@@ -67058,15 +67050,7 @@ static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend
                _UNUSED_CODE, /* 5              */
                _UNUSED_CODE, /* 6              */
                _UNUSED_CODE, /* 7              */
-               _UNUSED_CODE, /* 8 = IS_UNUSED  */
-               _UNUSED_CODE, /* 9              */
-               _UNUSED_CODE, /* 10             */
-               _UNUSED_CODE, /* 11             */
-               _UNUSED_CODE, /* 12             */
-               _UNUSED_CODE, /* 13             */
-               _UNUSED_CODE, /* 14             */
-               _UNUSED_CODE, /* 15             */
-               _CV_CODE      /* 16 = IS_CV     */
+               _CV_CODE      /* 8 = IS_CV      */
        };
        uint32_t offset = 0;
        if (spec & SPEC_RULE_OP1) offset = offset * 5 + zend_vm_decode[op->op1_type];
index 5d5f734a23ad964f575b3f3eff2890572ce61e48..413d4de2e2a6a0c494abeb338fee1f3c00b3fc2a 100644 (file)
@@ -2451,7 +2451,7 @@ function gen_vm($def, $skel) {
                out($f, "\treturn zend_opcode_handlers[spec];\n");
        } else {
                out($f, "\tstatic const int zend_vm_decode[] = {\n");
-               out($f, "\t\t_UNUSED_CODE, /* 0              */\n");
+               out($f, "\t\t_UNUSED_CODE, /* 0 = IS_UNUSED  */\n");
                out($f, "\t\t_CONST_CODE,  /* 1 = IS_CONST   */\n");
                out($f, "\t\t_TMP_CODE,    /* 2 = IS_TMP_VAR */\n");
                out($f, "\t\t_UNUSED_CODE, /* 3              */\n");
@@ -2459,15 +2459,7 @@ function gen_vm($def, $skel) {
                out($f, "\t\t_UNUSED_CODE, /* 5              */\n");
                out($f, "\t\t_UNUSED_CODE, /* 6              */\n");
                out($f, "\t\t_UNUSED_CODE, /* 7              */\n");
-               out($f, "\t\t_UNUSED_CODE, /* 8 = IS_UNUSED  */\n");
-               out($f, "\t\t_UNUSED_CODE, /* 9              */\n");
-               out($f, "\t\t_UNUSED_CODE, /* 10             */\n");
-               out($f, "\t\t_UNUSED_CODE, /* 11             */\n");
-               out($f, "\t\t_UNUSED_CODE, /* 12             */\n");
-               out($f, "\t\t_UNUSED_CODE, /* 13             */\n");
-               out($f, "\t\t_UNUSED_CODE, /* 14             */\n");
-               out($f, "\t\t_UNUSED_CODE, /* 15             */\n");
-               out($f, "\t\t_CV_CODE      /* 16 = IS_CV     */\n");
+               out($f, "\t\t_CV_CODE      /* 8 = IS_CV      */\n");
                out($f, "\t};\n");
                out($f, "\tuint32_t offset = 0;\n");
                out($f, "\tif (spec & SPEC_RULE_OP1) offset = offset * 5 + zend_vm_decode[op->op1_type];\n");
@@ -2525,7 +2517,7 @@ function gen_vm($def, $skel) {
                        out($f, "\treturn zend_opcode_handler_funcs[spec];\n");
                } else {
                        out($f, "\tstatic const int zend_vm_decode[] = {\n");
-                       out($f, "\t\t_UNUSED_CODE, /* 0              */\n");
+                       out($f, "\t\t_UNUSED_CODE, /* 0 = IS_UNUSED  */\n");
                        out($f, "\t\t_CONST_CODE,  /* 1 = IS_CONST   */\n");
                        out($f, "\t\t_TMP_CODE,    /* 2 = IS_TMP_VAR */\n");
                        out($f, "\t\t_UNUSED_CODE, /* 3              */\n");
@@ -2533,15 +2525,7 @@ function gen_vm($def, $skel) {
                        out($f, "\t\t_UNUSED_CODE, /* 5              */\n");
                        out($f, "\t\t_UNUSED_CODE, /* 6              */\n");
                        out($f, "\t\t_UNUSED_CODE, /* 7              */\n");
-                       out($f, "\t\t_UNUSED_CODE, /* 8 = IS_UNUSED  */\n");
-                       out($f, "\t\t_UNUSED_CODE, /* 9              */\n");
-                       out($f, "\t\t_UNUSED_CODE, /* 10             */\n");
-                       out($f, "\t\t_UNUSED_CODE, /* 11             */\n");
-                       out($f, "\t\t_UNUSED_CODE, /* 12             */\n");
-                       out($f, "\t\t_UNUSED_CODE, /* 13             */\n");
-                       out($f, "\t\t_UNUSED_CODE, /* 14             */\n");
-                       out($f, "\t\t_UNUSED_CODE, /* 15             */\n");
-                       out($f, "\t\t_CV_CODE      /* 16 = IS_CV     */\n");
+                       out($f, "\t\t_CV_CODE      /* 8 = IS_CV      */\n");
                        out($f, "\t};\n");
                        out($f, "\tuint32_t offset = 0;\n");
                        out($f, "\tif (spec & SPEC_RULE_OP1) offset = offset * 5 + zend_vm_decode[op->op1_type];\n");