]> granicus.if.org Git - php/commitdiff
ZEND_DECLARE_ANON_CLASS doesn't need to skip anything now. It's immediatelly followed...
authorDmitry Stogov <dmitry@zend.com>
Fri, 19 Jul 2019 07:09:26 +0000 (10:09 +0300)
committerDmitry Stogov <dmitry@zend.com>
Fri, 19 Jul 2019 07:09:26 +0000 (10:09 +0300)
12 files changed:
Zend/zend_compile.c
Zend/zend_opcode.c
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
Zend/zend_vm_opcodes.c
ext/opcache/Optimizer/block_pass.c
ext/opcache/Optimizer/dfa_pass.c
ext/opcache/Optimizer/sccp.c
ext/opcache/Optimizer/zend_cfg.c
ext/opcache/Optimizer/zend_optimizer.c
ext/opcache/zend_file_cache.c
ext/opcache/zend_persist.c

index 1e57c7bf095dafebf2a1b4bb8c60f43419cdbed8..d8180c9bee5c92570c98127615dc8ec82b1fe49e 100644 (file)
@@ -3960,11 +3960,10 @@ void zend_compile_new(znode *result, zend_ast *ast) /* {{{ */
        zend_op *opline;
 
        if (class_ast->kind == ZEND_AST_CLASS) {
-               /* jump over anon class declaration */
+               /* anon class declaration */
                opline = zend_compile_class_decl(class_ast, 0);
                class_node.op_type = opline->result_type;
                class_node.u.op.var = opline->result.var;
-               opline->extended_value = get_next_op_number();
        } else {
                zend_compile_class_ref(&class_node, class_ast, ZEND_FETCH_CLASS_EXCEPTION);
        }
index 0d2608816720500fcfa86a803f8cb9fd3aba1df8..a62d3db4770f51824790caa3c9081445ed2d2938 100644 (file)
@@ -959,7 +959,6 @@ ZEND_API int pass_two(zend_op_array *op_array)
                                ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op2);
                                break;
                        }
-                       case ZEND_DECLARE_ANON_CLASS:
                        case ZEND_FE_FETCH_R:
                        case ZEND_FE_FETCH_RW:
                                /* absolute index to relative offset */
index 8594cda17950fe1601c79738077e0d96292468a8..0224e674e77e6add9fa80208a4dc0322b292a59b 100644 (file)
@@ -7264,24 +7264,24 @@ ZEND_VM_HANDLER(145, ZEND_DECLARE_CLASS_DELAYED, CONST, CONST)
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(146, ZEND_DECLARE_ANON_CLASS, ANY, ANY, JMP_ADDR)
+ZEND_VM_HANDLER(146, ZEND_DECLARE_ANON_CLASS, ANY, ANY)
 {
        zval *zv;
        zend_class_entry *ce;
        USE_OPLINE
 
-       SAVE_OPLINE();
        zv = zend_hash_find_ex(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1);
        ZEND_ASSERT(zv != NULL);
        ce = Z_CE_P(zv);
        Z_CE_P(EX_VAR(opline->result.var)) = ce;
 
        if (ce->ce_flags & ZEND_ACC_LINKED) {
-               ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
-               ZEND_VM_CONTINUE();
+               ZEND_VM_NEXT_OPCODE();
+       } else {
+               SAVE_OPLINE();
+               zend_do_link_class(ce, (OP2_TYPE == IS_CONST) ? Z_STR_P(RT_CONSTANT(opline, opline->op2)) : NULL);
+               ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
        }
-       zend_do_link_class(ce, (OP2_TYPE == IS_CONST) ? Z_STR_P(RT_CONSTANT(opline, opline->op2)) : NULL);
-       ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
 ZEND_VM_HANDLER(141, ZEND_DECLARE_FUNCTION, ANY, ANY)
index 763cc1b1acd04e4cc114c13e1dd2a24e14023203..2c21ea0a04b6971b9066d27b9ecdcd5a11bf122d 100644 (file)
@@ -2430,18 +2430,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_ANON_CLASS_SPEC_HANDLE
        zend_class_entry *ce;
        USE_OPLINE
 
-       SAVE_OPLINE();
        zv = zend_hash_find_ex(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1);
        ZEND_ASSERT(zv != NULL);
        ce = Z_CE_P(zv);
        Z_CE_P(EX_VAR(opline->result.var)) = ce;
 
        if (ce->ce_flags & ZEND_ACC_LINKED) {
-               ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
-               ZEND_VM_CONTINUE();
+               ZEND_VM_NEXT_OPCODE();
+       } else {
+               SAVE_OPLINE();
+               zend_do_link_class(ce, (opline->op2_type == IS_CONST) ? Z_STR_P(RT_CONSTANT(opline, opline->op2)) : NULL);
+               ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
        }
-       zend_do_link_class(ce, (opline->op2_type == IS_CONST) ? Z_STR_P(RT_CONSTANT(opline, opline->op2)) : NULL);
-       ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
 static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_FUNCTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
index 31262e089c12161a5fafeee6e22e9dbd0efd1b5b..6ef58e4d906ce8b0e563854fa0ccd884a682a076 100644 (file)
@@ -367,7 +367,7 @@ static uint32_t zend_vm_opcodes_flags[195] = {
        0x00000303,
        0x00000003,
        0x00000303,
-       0x03000000,
+       0x00000000,
        0x00000000,
        0x00060757,
        0x00000000,
index e5f12dfa329fd85170a7beb062fa6d4c4388dde3..e699d03d6201cea80142d8dc43340cba4a9438d4 100644 (file)
@@ -1000,7 +1000,6 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array, zend_op
                                        ZEND_SET_OP_JMP_ADDR(opline, opline->op2, new_opcodes + blocks[b->successors[0]].start);
                                }
                                break;
-                       case ZEND_DECLARE_ANON_CLASS:
                        case ZEND_FE_FETCH_R:
                        case ZEND_FE_FETCH_RW:
                                opline->extended_value = ZEND_OPLINE_TO_OFFSET(opline, new_opcodes + blocks[b->successors[0]].start);
index 2da656e0c16d7975f253c077a174aaefd0f8ddb5..704cca1835105922eeda30c1bc9f1a5e2f226be6 100644 (file)
@@ -628,7 +628,6 @@ static void zend_ssa_replace_control_link(zend_op_array *op_array, zend_ssa *ssa
                                        }
                                }
                                break;
-                       case ZEND_DECLARE_ANON_CLASS:
                        case ZEND_FE_FETCH_R:
                        case ZEND_FE_FETCH_RW:
                                if (ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, opline->extended_value) == old->start) {
index bb3eebe18301f7d71489f7fdae177e667d78a704..6f8de3d43f455912a0afa6bc4e392afb221f3eaf 100644 (file)
@@ -1927,7 +1927,6 @@ static void sccp_mark_feasible_successors(
        switch (opline->opcode) {
                case ZEND_ASSERT_CHECK:
                case ZEND_CATCH:
-               case ZEND_DECLARE_ANON_CLASS:
                case ZEND_FE_FETCH_R:
                case ZEND_FE_FETCH_RW:
                        scdf_mark_edge_feasible(scdf, block_num, block->successors[0]);
index d956f6dfbd4159eb0290d7f3cd66e93f46cead95..5e0f1370246df184804bb673189ce6b899a48afe 100644 (file)
@@ -375,7 +375,6 @@ int zend_build_cfg(zend_arena **arena, const zend_op_array *op_array, uint32_t b
                                }
                                BB_START(i + 1);
                                break;
-                       case ZEND_DECLARE_ANON_CLASS:
                        case ZEND_FE_FETCH_R:
                        case ZEND_FE_FETCH_RW:
                                BB_START(ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, opline->extended_value));
@@ -535,7 +534,6 @@ int zend_build_cfg(zend_arena **arena, const zend_op_array *op_array, uint32_t b
                                        block->successors[0] = j + 1;
                                }
                                break;
-                       case ZEND_DECLARE_ANON_CLASS:
                        case ZEND_FE_FETCH_R:
                        case ZEND_FE_FETCH_RW:
                                block->successors_count = 2;
index 683ea2548d219339999bc440cacf856f00832208..a922d0f5974c8f1f89b3ea73d455fb6d53223229 100644 (file)
@@ -709,7 +709,6 @@ void zend_optimizer_migrate_jump(zend_op_array *op_array, zend_op *new_opline, z
                case ZEND_ASSERT_CHECK:
                        ZEND_SET_OP_JMP_ADDR(new_opline, new_opline->op2, ZEND_OP2_JMP_ADDR(opline));
                        break;
-               case ZEND_DECLARE_ANON_CLASS:
                case ZEND_FE_FETCH_R:
                case ZEND_FE_FETCH_RW:
                        new_opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, new_opline, ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, opline->extended_value));
@@ -759,7 +758,6 @@ void zend_optimizer_shift_jump(zend_op_array *op_array, zend_op *opline, uint32_
                                ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP2_JMP_ADDR(opline) - shiftlist[ZEND_OP2_JMP_ADDR(opline) - op_array->opcodes]);
                        }
                        break;
-               case ZEND_DECLARE_ANON_CLASS:
                case ZEND_FE_FETCH_R:
                case ZEND_FE_FETCH_RW:
                        opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, opline->extended_value) - shiftlist[ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, opline->extended_value)]);
@@ -1146,7 +1144,6 @@ static void zend_redo_pass_two(zend_op_array *op_array)
                                                opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
                                        }
                                        break;
-                               case ZEND_DECLARE_ANON_CLASS:
                                case ZEND_FE_FETCH_R:
                                case ZEND_FE_FETCH_RW:
                                case ZEND_SWITCH_LONG:
@@ -1234,7 +1231,6 @@ static void zend_redo_pass_two_ex(zend_op_array *op_array, zend_ssa *ssa)
                                                opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
                                        }
                                        break;
-                               case ZEND_DECLARE_ANON_CLASS:
                                case ZEND_FE_FETCH_R:
                                case ZEND_FE_FETCH_RW:
                                case ZEND_SWITCH_LONG:
index b5bab36e4b8db5217af45bbdb84c5d075ddb83ea..83e8a9d57538da8a491299108c570e157bd239c2 100644 (file)
@@ -470,7 +470,6 @@ static void zend_file_cache_serialize_op_array(zend_op_array            *op_arra
                                                SERIALIZE_PTR(opline->op2.jmp_addr);
                                        }
                                        break;
-                               case ZEND_DECLARE_ANON_CLASS:
                                case ZEND_FE_FETCH_R:
                                case ZEND_FE_FETCH_RW:
                                case ZEND_SWITCH_LONG:
@@ -1169,7 +1168,6 @@ static void zend_file_cache_unserialize_op_array(zend_op_array           *op_arr
                                                UNSERIALIZE_PTR(opline->op2.jmp_addr);
                                        }
                                        break;
-                               case ZEND_DECLARE_ANON_CLASS:
                                case ZEND_FE_FETCH_R:
                                case ZEND_FE_FETCH_RW:
                                case ZEND_SWITCH_LONG:
index 247acc90f343c8b7f5e04f187e1ce0596335b5f8..733b331e654814e319a509c27c4d8ff3547b4d12 100644 (file)
@@ -453,7 +453,6 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
                                                        opline->op2.jmp_addr = &new_opcodes[opline->op2.jmp_addr - op_array->opcodes];
                                                }
                                                break;
-                                       case ZEND_DECLARE_ANON_CLASS:
                                        case ZEND_FE_FETCH_R:
                                        case ZEND_FE_FETCH_RW:
                                        case ZEND_SWITCH_LONG: