]> granicus.if.org Git - php/commitdiff
Added zend_get_opcode_flags() function to get information about opcode operands and...
authorDmitry Stogov <dmitry@zend.com>
Wed, 28 Oct 2015 20:25:05 +0000 (23:25 +0300)
committerDmitry Stogov <dmitry@zend.com>
Fri, 30 Oct 2015 04:18:44 +0000 (07:18 +0300)
Zend/zend_vm_def.h
Zend/zend_vm_gen.php
Zend/zend_vm_opcodes.c
Zend/zend_vm_opcodes.h

index 3296eaaedffc453ecfe694c1326609035dbe388a..6089ab05248ec5343d9b97f6266f07e804461fb3 100644 (file)
@@ -872,7 +872,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_helper, VAR|CV, CONST|TMPVAR|CV, binary_
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(23, ZEND_ASSIGN_ADD, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(23, ZEND_ASSIGN_ADD, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV, DIM_OBJ)
 {
 #if !defined(ZEND_VM_SPEC) || (OP2_TYPE != IS_UNUSED)
        USE_OPLINE
@@ -892,7 +892,7 @@ ZEND_VM_HANDLER(23, ZEND_ASSIGN_ADD, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
 #endif
 }
 
-ZEND_VM_HANDLER(24, ZEND_ASSIGN_SUB, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(24, ZEND_ASSIGN_SUB, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV, DIM_OBJ)
 {
 #if !defined(ZEND_VM_SPEC) || (OP2_TYPE != IS_UNUSED)
        USE_OPLINE
@@ -912,7 +912,7 @@ ZEND_VM_HANDLER(24, ZEND_ASSIGN_SUB, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
 #endif
 }
 
-ZEND_VM_HANDLER(25, ZEND_ASSIGN_MUL, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(25, ZEND_ASSIGN_MUL, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV, DIM_OBJ)
 {
 #if !defined(ZEND_VM_SPEC) || (OP2_TYPE != IS_UNUSED)
        USE_OPLINE
@@ -932,7 +932,7 @@ ZEND_VM_HANDLER(25, ZEND_ASSIGN_MUL, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
 #endif
 }
 
-ZEND_VM_HANDLER(26, ZEND_ASSIGN_DIV, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(26, ZEND_ASSIGN_DIV, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV, DIM_OBJ)
 {
 #if !defined(ZEND_VM_SPEC) || (OP2_TYPE != IS_UNUSED)
        USE_OPLINE
@@ -952,7 +952,7 @@ ZEND_VM_HANDLER(26, ZEND_ASSIGN_DIV, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
 #endif
 }
 
-ZEND_VM_HANDLER(27, ZEND_ASSIGN_MOD, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(27, ZEND_ASSIGN_MOD, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV, DIM_OBJ)
 {
 #if !defined(ZEND_VM_SPEC) || (OP2_TYPE != IS_UNUSED)
        USE_OPLINE
@@ -972,7 +972,7 @@ ZEND_VM_HANDLER(27, ZEND_ASSIGN_MOD, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
 #endif
 }
 
-ZEND_VM_HANDLER(28, ZEND_ASSIGN_SL, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(28, ZEND_ASSIGN_SL, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV, DIM_OBJ)
 {
 #if !defined(ZEND_VM_SPEC) || (OP2_TYPE != IS_UNUSED)
        USE_OPLINE
@@ -992,7 +992,7 @@ ZEND_VM_HANDLER(28, ZEND_ASSIGN_SL, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
 #endif
 }
 
-ZEND_VM_HANDLER(29, ZEND_ASSIGN_SR, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(29, ZEND_ASSIGN_SR, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV, DIM_OBJ)
 {
 #if !defined(ZEND_VM_SPEC) || (OP2_TYPE != IS_UNUSED)
        USE_OPLINE
@@ -1012,7 +1012,7 @@ ZEND_VM_HANDLER(29, ZEND_ASSIGN_SR, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
 #endif
 }
 
-ZEND_VM_HANDLER(30, ZEND_ASSIGN_CONCAT, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(30, ZEND_ASSIGN_CONCAT, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV, DIM_OBJ)
 {
 #if !defined(ZEND_VM_SPEC) || (OP2_TYPE != IS_UNUSED)
        USE_OPLINE
@@ -1032,7 +1032,7 @@ ZEND_VM_HANDLER(30, ZEND_ASSIGN_CONCAT, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
 #endif
 }
 
-ZEND_VM_HANDLER(31, ZEND_ASSIGN_BW_OR, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(31, ZEND_ASSIGN_BW_OR, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV, DIM_OBJ)
 {
 #if !defined(ZEND_VM_SPEC) || (OP2_TYPE != IS_UNUSED)
        USE_OPLINE
@@ -1052,7 +1052,7 @@ ZEND_VM_HANDLER(31, ZEND_ASSIGN_BW_OR, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
 #endif
 }
 
-ZEND_VM_HANDLER(32, ZEND_ASSIGN_BW_AND, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(32, ZEND_ASSIGN_BW_AND, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV, DIM_OBJ)
 {
 #if !defined(ZEND_VM_SPEC) || (OP2_TYPE != IS_UNUSED)
        USE_OPLINE
@@ -1072,7 +1072,7 @@ ZEND_VM_HANDLER(32, ZEND_ASSIGN_BW_AND, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
 #endif
 }
 
-ZEND_VM_HANDLER(33, ZEND_ASSIGN_BW_XOR, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(33, ZEND_ASSIGN_BW_XOR, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV, DIM_OBJ)
 {
 #if !defined(ZEND_VM_SPEC) || (OP2_TYPE != IS_UNUSED)
        USE_OPLINE
@@ -1092,7 +1092,7 @@ ZEND_VM_HANDLER(33, ZEND_ASSIGN_BW_XOR, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
 #endif
 }
 
-ZEND_VM_HANDLER(167, ZEND_ASSIGN_POW, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(167, ZEND_ASSIGN_POW, VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV, DIM_OBJ)
 {
 #if !defined(ZEND_VM_SPEC) || (OP2_TYPE != IS_UNUSED)
        USE_OPLINE
@@ -1564,22 +1564,22 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMPVAR|CV, UNUSED, int ty
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(80, ZEND_FETCH_R, CONST|TMPVAR|CV, UNUSED)
+ZEND_VM_HANDLER(80, ZEND_FETCH_R, CONST|TMPVAR|CV, UNUSED, VAR_FETCH)
 {
        ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_R);
 }
 
-ZEND_VM_HANDLER(83, ZEND_FETCH_W, CONST|TMPVAR|CV, UNUSED)
+ZEND_VM_HANDLER(83, ZEND_FETCH_W, CONST|TMPVAR|CV, UNUSED, VAR_FETCH)
 {
        ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_W);
 }
 
-ZEND_VM_HANDLER(86, ZEND_FETCH_RW, CONST|TMPVAR|CV, UNUSED)
+ZEND_VM_HANDLER(86, ZEND_FETCH_RW, CONST|TMPVAR|CV, UNUSED, VAR_FETCH)
 {
        ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_RW);
 }
 
-ZEND_VM_HANDLER(92, ZEND_FETCH_FUNC_ARG, CONST|TMPVAR|CV, UNUSED)
+ZEND_VM_HANDLER(92, ZEND_FETCH_FUNC_ARG, CONST|TMPVAR|CV, UNUSED, VAR_FETCH)
 {
        USE_OPLINE
 
@@ -1590,12 +1590,12 @@ ZEND_VM_HANDLER(92, ZEND_FETCH_FUNC_ARG, CONST|TMPVAR|CV, UNUSED)
        }
 }
 
-ZEND_VM_HANDLER(95, ZEND_FETCH_UNSET, CONST|TMPVAR|CV, UNUSED)
+ZEND_VM_HANDLER(95, ZEND_FETCH_UNSET, CONST|TMPVAR|CV, UNUSED, VAR_FETCH)
 {
        ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_UNSET);
 }
 
-ZEND_VM_HANDLER(89, ZEND_FETCH_IS, CONST|TMPVAR|CV, UNUSED)
+ZEND_VM_HANDLER(89, ZEND_FETCH_IS, CONST|TMPVAR|CV, UNUSED, VAR_FETCH)
 {
        ZEND_VM_DISPATCH_TO_HELPER_EX(zend_fetch_var_address_helper, type, BP_VAR_IS);
 }
@@ -2514,7 +2514,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
        }
 }
 
-ZEND_VM_HANDLER(42, ZEND_JMP, ANY, ANY)
+ZEND_VM_HANDLER(42, ZEND_JMP, ADDR, ANY)
 {
        USE_OPLINE
 
@@ -2522,7 +2522,7 @@ ZEND_VM_HANDLER(42, ZEND_JMP, ANY, ANY)
        ZEND_VM_CONTINUE();
 }
 
-ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMPVAR|CV, ANY)
+ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMPVAR|CV, ADDR)
 {
        USE_OPLINE
        zend_free_op free_op1;
@@ -2557,7 +2557,7 @@ ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMPVAR|CV, ANY)
        ZEND_VM_JMP(opline);
 }
 
-ZEND_VM_HANDLER(44, ZEND_JMPNZ, CONST|TMPVAR|CV, ANY)
+ZEND_VM_HANDLER(44, ZEND_JMPNZ, CONST|TMPVAR|CV, ADDR)
 {
        USE_OPLINE
        zend_free_op free_op1;
@@ -2591,7 +2591,7 @@ ZEND_VM_HANDLER(44, ZEND_JMPNZ, CONST|TMPVAR|CV, ANY)
        ZEND_VM_JMP(opline);
 }
 
-ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMPVAR|CV, ANY)
+ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMPVAR|CV, ADDR, REL_LINE)
 {
        USE_OPLINE
        zend_free_op free_op1;
@@ -2628,7 +2628,7 @@ ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMPVAR|CV, ANY)
        ZEND_VM_JMP(opline);
 }
 
-ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMPVAR|CV, ANY)
+ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMPVAR|CV, ADDR)
 {
        USE_OPLINE
        zend_free_op free_op1;
@@ -2671,7 +2671,7 @@ ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMPVAR|CV, ANY)
        ZEND_VM_JMP(opline);
 }
 
-ZEND_VM_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMPVAR|CV, ANY)
+ZEND_VM_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMPVAR|CV, ADDR)
 {
        USE_OPLINE
        zend_free_op free_op1;
@@ -2801,7 +2801,7 @@ ZEND_VM_HANDLER(53, ZEND_FAST_CONCAT, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(54, ZEND_ROPE_INIT, UNUSED, CONST|TMPVAR|CV)
+ZEND_VM_HANDLER(54, ZEND_ROPE_INIT, UNUSED, CONST|TMPVAR|CV, NUM)
 {
        USE_OPLINE
        zend_free_op free_op2;
@@ -2834,7 +2834,7 @@ ZEND_VM_HANDLER(54, ZEND_ROPE_INIT, UNUSED, CONST|TMPVAR|CV)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(55, ZEND_ROPE_ADD, TMP, CONST|TMPVAR|CV)
+ZEND_VM_HANDLER(55, ZEND_ROPE_ADD, TMP, CONST|TMPVAR|CV, NUM)
 {
        USE_OPLINE
        zend_free_op free_op2;
@@ -2867,7 +2867,7 @@ ZEND_VM_HANDLER(55, ZEND_ROPE_ADD, TMP, CONST|TMPVAR|CV)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(56, ZEND_ROPE_END, TMP, CONST|TMPVAR|CV)
+ZEND_VM_HANDLER(56, ZEND_ROPE_END, TMP, CONST|TMPVAR|CV, NUM)
 {
        USE_OPLINE
        zend_free_op free_op2;
@@ -2920,7 +2920,7 @@ ZEND_VM_HANDLER(56, ZEND_ROPE_END, TMP, CONST|TMPVAR|CV)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMPVAR|UNUSED|CV, CLASS_FETCH)
 {
        USE_OPLINE
 
@@ -2963,7 +2963,7 @@ ZEND_VM_C_LABEL(try_class_name):
        }
 }
 
-ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR|CV)
+ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR|CV, NUM)
 {
        USE_OPLINE
        zval *function_name;
@@ -3084,7 +3084,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CONST|VAR, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CONST|VAR, CONST|TMPVAR|UNUSED|CV, NUM)
 {
        USE_OPLINE
        zval *function_name;
@@ -3220,7 +3220,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CONST|VAR, CONST|TMPVA
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST)
+ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST, NUM)
 {
        USE_OPLINE
        zend_function *fbc;
@@ -3247,7 +3247,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(128, ZEND_INIT_DYNAMIC_CALL, ANY, CONST|TMPVAR|CV)
+ZEND_VM_HANDLER(128, ZEND_INIT_DYNAMIC_CALL, ANY, CONST|TMPVAR|CV, NUM)
 {
        USE_OPLINE
        zend_function *fbc;
@@ -3460,7 +3460,7 @@ ZEND_VM_C_LABEL(try_function_name):
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV)
+ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM)
 {
        USE_OPLINE
        zend_free_op free_op2;
@@ -3519,7 +3519,7 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV)
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST)
+ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST, NUM)
 {
        USE_OPLINE
        zval *func_name;
@@ -3552,7 +3552,7 @@ ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(61, ZEND_INIT_FCALL, ANY, CONST)
+ZEND_VM_HANDLER(61, ZEND_INIT_FCALL, ANY, CONST, NUM)
 {
        USE_OPLINE
        zend_free_op free_op2;
@@ -4205,7 +4205,7 @@ ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY)
        HANDLE_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
+ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV, LINE)
 {
        USE_OPLINE
        zend_class_entry *ce, *catch_ce;
@@ -4255,7 +4255,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
        }
 }
 
-ZEND_VM_HANDLER(65, ZEND_SEND_VAL, CONST|TMP, ANY)
+ZEND_VM_HANDLER(65, ZEND_SEND_VAL, CONST|TMP, NUM)
 {
        USE_OPLINE
        zval *value, *arg;
@@ -4272,7 +4272,7 @@ ZEND_VM_HANDLER(65, ZEND_SEND_VAL, CONST|TMP, ANY)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(116, ZEND_SEND_VAL_EX, CONST|TMP, ANY)
+ZEND_VM_HANDLER(116, ZEND_SEND_VAL_EX, CONST|TMP, NUM)
 {
        USE_OPLINE
        zval *value, *arg;
@@ -4303,7 +4303,7 @@ ZEND_VM_C_LABEL(send_val_by_ref):
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(117, ZEND_SEND_VAR, VAR|CV, ANY)
+ZEND_VM_HANDLER(117, ZEND_SEND_VAR, VAR|CV, NUM)
 {
        USE_OPLINE
        zval *varptr, *arg;
@@ -4342,7 +4342,7 @@ ZEND_VM_HANDLER(117, ZEND_SEND_VAR, VAR|CV, ANY)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR, ANY)
+ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR, NUM)
 {
        USE_OPLINE
        zend_free_op free_op1;
@@ -4379,7 +4379,7 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR, ANY)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY)
+ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, NUM)
 {
        USE_OPLINE
        zend_free_op free_op1;
@@ -4414,7 +4414,7 @@ ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(66, ZEND_SEND_VAR_EX, VAR|CV, ANY)
+ZEND_VM_HANDLER(66, ZEND_SEND_VAR_EX, VAR|CV, NUM)
 {
        USE_OPLINE
        zval *varptr, *arg;
@@ -4725,7 +4725,7 @@ ZEND_VM_C_LABEL(send_array):
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(120, ZEND_SEND_USER, VAR|CV, ANY)
+ZEND_VM_HANDLER(120, ZEND_SEND_USER, VAR|CV, NUM)
 {
        USE_OPLINE
        zval *arg, *param;
@@ -4780,7 +4780,7 @@ ZEND_VM_HANDLER(120, ZEND_SEND_USER, VAR|CV, ANY)
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
+ZEND_VM_HANDLER(63, ZEND_RECV, NUM, ANY)
 {
        USE_OPLINE
        uint32_t arg_num = opline->op1.num;
@@ -4801,7 +4801,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
+ZEND_VM_HANDLER(64, ZEND_RECV_INIT, NUM, CONST)
 {
        USE_OPLINE
        uint32_t arg_num;
@@ -4840,7 +4840,7 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, ANY, ANY)
+ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, ANY)
 {
        USE_OPLINE
        uint32_t arg_num = opline->op1.num;
@@ -4971,7 +4971,7 @@ ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(68, ZEND_NEW, UNUSED|CONST|VAR, ANY)
+ZEND_VM_HANDLER(68, ZEND_NEW, UNUSED|CONST|VAR, ADDR, NUM)
 {
        USE_OPLINE
        zval object_zval;
@@ -5106,7 +5106,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|CV, ANY)
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, UNUSED, CONST)
+ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, UNUSED, CONST, CONST_FETCH)
 {
        USE_OPLINE
        zend_constant *c;
@@ -5225,7 +5225,7 @@ ZEND_VM_HANDLER(181, ZEND_FETCH_CLASS_CONSTANT, VAR|CONST|UNUSED, CONST)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMPVAR|UNUSED|CV, NUM)
 {
        USE_OPLINE
        zend_free_op free_op1;
@@ -5324,7 +5324,7 @@ ZEND_VM_C_LABEL(num_index):
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(71, ZEND_INIT_ARRAY, CONST|TMP|VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV)
+ZEND_VM_HANDLER(71, ZEND_INIT_ARRAY, CONST|TMP|VAR|UNUSED|CV, CONST|TMPVAR|UNUSED|CV, ARRAY_INIT)
 {
        zval *array;
        uint32_t size;
@@ -5355,7 +5355,7 @@ ZEND_VM_HANDLER(71, ZEND_INIT_ARRAY, CONST|TMP|VAR|UNUSED|CV, CONST|TMPVAR|UNUSE
        }
 }
 
-ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
+ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY, TYPE)
 {
        USE_OPLINE
        zend_free_op free_op1;
@@ -5457,7 +5457,7 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMPVAR|CV, ANY)
+ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMPVAR|CV, ANY, EVAL)
 {
        USE_OPLINE
        zend_op_array *new_op_array=NULL;
@@ -5586,7 +5586,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMPVAR|CV, ANY)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMPVAR|CV, UNUSED)
+ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMPVAR|CV, UNUSED, VAR_FETCH)
 {
        USE_OPLINE
        zval tmp, *varname;
@@ -5828,7 +5828,7 @@ ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|CV, CONST|TMPVAR|CV)
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, ANY)
+ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, ADDR)
 {
        USE_OPLINE
        zend_free_op free_op1;
@@ -5933,7 +5933,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, ANY)
        }
 }
 
-ZEND_VM_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, ANY)
+ZEND_VM_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, ADDR)
 {
        USE_OPLINE
        zend_free_op free_op1;
@@ -6097,7 +6097,7 @@ ZEND_VM_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, ANY)
        }
 }
 
-ZEND_VM_HANDLER(78, ZEND_FE_FETCH_R, VAR, ANY)
+ZEND_VM_HANDLER(78, ZEND_FE_FETCH_R, VAR, ANY, REL_LINE)
 {
        USE_OPLINE
        zval *array;
@@ -6274,7 +6274,7 @@ ZEND_VM_C_LABEL(fe_fetch_r_exit):
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(126, ZEND_FE_FETCH_RW, VAR, ANY)
+ZEND_VM_HANDLER(126, ZEND_FE_FETCH_RW, VAR, ANY, REL_LINE)
 {
        USE_OPLINE
        zval *array;
@@ -6475,7 +6475,7 @@ ZEND_VM_C_LABEL(fe_fetch_w_exit):
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMPVAR|CV, UNUSED)
+ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMPVAR|CV, UNUSED, VAR_FETCH)
 {
        USE_OPLINE
        zval *value;
@@ -6533,7 +6533,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMPVAR|CV, UNUSED)
        }
 }
 
-ZEND_VM_HANDLER(180, ZEND_ISSET_ISEMPTY_STATIC_PROP, CONST|TMPVAR|CV, UNUSED|CONST|VAR)
+ZEND_VM_HANDLER(180, ZEND_ISSET_ISEMPTY_STATIC_PROP, CONST|TMPVAR|CV, UNUSED|CONST|VAR, ISSET)
 {
        USE_OPLINE
        zval *value;
@@ -6609,7 +6609,7 @@ ZEND_VM_C_LABEL(is_static_prop_return):
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR|CV)
+ZEND_VM_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR|CV, ISSET)
 {
        USE_OPLINE
        zend_free_op free_op1, free_op2;
@@ -6746,7 +6746,7 @@ ZEND_VM_C_LABEL(isset_dim_obj_exit):
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR|CV)
+ZEND_VM_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR|CV, ISSET)
 {
        USE_OPLINE
        zend_free_op free_op1, free_op2;
@@ -6865,7 +6865,7 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, ANY)
+ZEND_VM_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, ADDR)
 {
        USE_OPLINE
        zend_free_op free_op1;
@@ -6904,7 +6904,7 @@ ZEND_VM_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, ANY)
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(169, ZEND_COALESCE, CONST|TMP|VAR|CV, ANY)
+ZEND_VM_HANDLER(169, ZEND_COALESCE, CONST|TMP|VAR|CV, ADDR)
 {
        USE_OPLINE
        zend_free_op free_op1;
@@ -7023,7 +7023,7 @@ ZEND_VM_HANDLER(139, ZEND_DECLARE_CLASS, ANY, ANY)
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(140, ZEND_DECLARE_INHERITED_CLASS, ANY, ANY)
+ZEND_VM_HANDLER(140, ZEND_DECLARE_INHERITED_CLASS, ANY, ANY, VAR)
 {
        USE_OPLINE
 
@@ -7032,7 +7032,7 @@ ZEND_VM_HANDLER(140, ZEND_DECLARE_INHERITED_CLASS, ANY, ANY)
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, ANY, ANY)
+ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, ANY, ANY, VAR)
 {
        USE_OPLINE
        zval *zce, *orig_zce;
@@ -7046,7 +7046,7 @@ ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, ANY, ANY)
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(171, ZEND_DECLARE_ANON_CLASS, ANY, ANY)
+ZEND_VM_HANDLER(171, ZEND_DECLARE_ANON_CLASS, ADDR, ANY)
 {
        zend_class_entry *ce;
        USE_OPLINE
@@ -7067,7 +7067,7 @@ ZEND_VM_HANDLER(171, ZEND_DECLARE_ANON_CLASS, ANY, ANY)
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(172, ZEND_DECLARE_ANON_INHERITED_CLASS, ANY, ANY)
+ZEND_VM_HANDLER(172, ZEND_DECLARE_ANON_INHERITED_CLASS, ADDR, ANY, VAR)
 {
        zend_class_entry *ce;
        USE_OPLINE
@@ -7095,7 +7095,7 @@ ZEND_VM_HANDLER(141, ZEND_DECLARE_FUNCTION, ANY, ANY)
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(105, ZEND_TICKS, ANY, ANY)
+ZEND_VM_HANDLER(105, ZEND_TICKS, ANY, ANY, NUM)
 {
        USE_OPLINE
 
@@ -7671,7 +7671,7 @@ ZEND_VM_HANDLER(159, ZEND_DISCARD_EXCEPTION, ANY, ANY)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(162, ZEND_FAST_CALL, ANY, ANY)
+ZEND_VM_HANDLER(162, ZEND_FAST_CALL, ADDR, LINE, FCALL)
 {
        USE_OPLINE
        zval *fast_call = EX_VAR(opline->result.var);
@@ -7687,7 +7687,7 @@ ZEND_VM_HANDLER(162, ZEND_FAST_CALL, ANY, ANY)
        ZEND_VM_CONTINUE();
 }
 
-ZEND_VM_HANDLER(163, ZEND_FAST_RET, ANY, ANY)
+ZEND_VM_HANDLER(163, ZEND_FAST_RET, ANY, LINE, FRET)
 {
        USE_OPLINE
        zval *fast_call = EX_VAR(opline->op1.var);
@@ -7857,7 +7857,7 @@ ZEND_VM_C_LABEL(try_strlen):
        ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
 }
 
-ZEND_VM_HANDLER(123, ZEND_TYPE_CHECK, CONST|TMP|VAR|CV, ANY)
+ZEND_VM_HANDLER(123, ZEND_TYPE_CHECK, CONST|TMP|VAR|CV, ANY, TYPE)
 {
        USE_OPLINE
        zval *value;
@@ -7913,7 +7913,7 @@ ZEND_VM_HANDLER(122, ZEND_DEFINED, CONST, ANY)
        ZEND_VM_NEXT_OPCODE();
 }
 
-ZEND_VM_HANDLER(151, ZEND_ASSERT_CHECK, ANY, ANY)
+ZEND_VM_HANDLER(151, ZEND_ASSERT_CHECK, ANY, ADDR)
 {
        USE_OPLINE
 
@@ -7930,7 +7930,7 @@ ZEND_VM_HANDLER(151, ZEND_ASSERT_CHECK, ANY, ANY)
        }
 }
 
-ZEND_VM_HANDLER(157, ZEND_FETCH_CLASS_NAME, ANY, ANY)
+ZEND_VM_HANDLER(157, ZEND_FETCH_CLASS_NAME, ANY, ANY, CLASS_FETCH)
 {
        uint32_t fetch_type;
        USE_OPLINE
index 613b4c9338dc27a11bf8588b5acb32d41c4984d2..35b865731cfd5a69d0c2a2781e3d8bc96de62067 100644 (file)
@@ -54,6 +54,71 @@ define("ZEND_VM_KIND_CALL",   1);
 define("ZEND_VM_KIND_SWITCH", 2);
 define("ZEND_VM_KIND_GOTO",   3);
 
+$vm_op_flags = array(
+       "ZEND_VM_OP1_SPEC"        => 1<<0,
+       "ZEND_VM_OP1_CONST"       => 1<<1,
+       "ZEND_VM_OP1_TMPVAR"      => 1<<2,
+       "ZEND_VM_OP1_NUM"         => 1<<3,
+       "ZEND_VM_OP1_ADDR"        => 1<<4,
+       "ZEND_VM_OP1_LINE"        => 1<<5,
+
+       "ZEND_VM_OP2_SPEC"        => 1<<8,
+       "ZEND_VM_OP2_CONST"       => 1<<9,
+       "ZEND_VM_OP2_TMPVAR"      => 1<<10,
+       "ZEND_VM_OP2_NUM"         => 1<<11,
+       "ZEND_VM_OP2_ADDR"        => 1<<12,
+       "ZEND_VM_OP2_LINE"        => 1<<13,
+
+       "ZEND_VM_EXT_NUM"         => 1<<16,
+       "ZEND_VM_EXT_VAR"         => 1<<17,
+       "ZEND_VM_EXT_LINE"        => 1<<18,
+       "ZEND_VM_EXT_REL_LINE"    => 1<<19,
+       "ZEND_VM_EXT_DIM_OBJ"     => 1<<20,
+       "ZEND_VM_EXT_CLASS_FETCH" => 1<<21,
+       "ZEND_VM_EXT_CONST_FETCH" => 1<<22,
+       "ZEND_VM_EXT_VAR_FETCH"   => 1<<23,
+       "ZEND_VM_EXT_ARRAY_INIT"  => 1<<24,
+       "ZEND_VM_EXT_TYPE"        => 1<<25,
+       "ZEND_VM_EXT_EVAL"        => 1<<26,
+       "ZEND_VM_EXT_FCALL"       => 1<<27,
+       "ZEND_VM_EXT_FRET"        => 1<<28,
+       "ZEND_VM_EXT_ISSET"       => 1<<29,
+);
+
+foreach ($vm_op_flags as $name => $val) {
+       define($name, $val);
+}
+
+$vm_op_decode = array(
+       "ANY"                  => 0,
+       "CONST"                => ZEND_VM_OP1_SPEC | ZEND_VM_OP1_CONST,
+       "TMP"                  => ZEND_VM_OP1_SPEC,
+       "VAR"                  => ZEND_VM_OP1_SPEC,
+       "UNUSED"               => ZEND_VM_OP1_SPEC,
+       "CV"                   => ZEND_VM_OP1_SPEC,
+       "TMPVAR"               => ZEND_VM_OP1_SPEC | ZEND_VM_OP1_TMPVAR,
+       "NUM"                  => ZEND_VM_OP1_NUM,
+       "ADDR"                 => ZEND_VM_OP1_ADDR,
+       "LINE"                 => ZEND_VM_OP1_LINE,
+);
+
+$vm_ext_decode = array(
+       "NUM"                  => ZEND_VM_EXT_NUM,
+       "VAR"                  => ZEND_VM_EXT_VAR,
+       "LINE"                 => ZEND_VM_EXT_LINE,
+       "REL_LINE"             => ZEND_VM_EXT_REL_LINE,
+       "DIM_OBJ"              => ZEND_VM_EXT_DIM_OBJ,
+       "CLASS_FETCH"          => ZEND_VM_EXT_CLASS_FETCH,
+       "CONST_FETCH"          => ZEND_VM_EXT_CONST_FETCH,
+       "VAR_FETCH"            => ZEND_VM_EXT_VAR_FETCH,
+       "ARRAY_INIT"           => ZEND_VM_EXT_ARRAY_INIT,
+       "TYPE"                 => ZEND_VM_EXT_TYPE,
+       "EVAL"                 => ZEND_VM_EXT_EVAL,
+       "FCALL"                => ZEND_VM_EXT_FCALL,
+       "FRET"                 => ZEND_VM_EXT_FRET,
+       "ISSET"                => ZEND_VM_EXT_ISSET,
+);
+
 $vm_kind_name = array(
        ZEND_VM_KIND_CALL => "ZEND_VM_KIND_CALL",
        ZEND_VM_KIND_SWITCH => "ZEND_VM_KIND_SWITCH",
@@ -1310,9 +1375,41 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
        }
 }
 
+function parse_operand_spec($def, $lineno, $str, &$flags) {
+       global $vm_op_decode;
+
+       $flags = 0;
+       $a = explode("|",$str);
+       foreach($a as $val) {
+               if (isset($vm_op_decode[$val])) {
+                       $flags |= $vm_op_decode[$val];
+               } else {
+                       die("ERROR ($def:$lineno): Wrong operand type '$str'\n");
+               }
+       }
+       if (!($flags & ZEND_VM_OP1_SPEC)) {
+               if (count($a) != 1) {
+                       die("ERROR ($def:$lineno): Wrong operand type '$str'\n");
+               }
+               $a = array("ANY");
+       }
+       return array_flip($a);
+}
+
+function parse_ext_spec($def, $lineno, $str) {
+       global $vm_ext_decode;
+
+       if (isset($vm_ext_decode[$str])) {
+               return $vm_ext_decode[$str];
+       } else {
+               die("ERROR ($def:$lineno): Wrong extended_value type '$str'\n");
+       }
+}
+
 function gen_vm($def, $skel) {
        global $definition_file, $skeleton_file, $executor_file,
-               $op_types, $list, $opcodes, $helpers, $params, $opnames;
+               $op_types, $list, $opcodes, $helpers, $params, $opnames,
+               $vm_op_flags;
 
        // Load definition file
        $in = @file($def);
@@ -1342,7 +1439,7 @@ function gen_vm($def, $skel) {
                if (strpos($line,"ZEND_VM_HANDLER(") === 0) {
                  // Parsing opcode handler's definition
                        if (preg_match(
-                                       "/^ZEND_VM_HANDLER\(\s*([0-9]+)\s*,\s*([A-Z_]+)\s*,\s*([A-Z|]+)\s*,\s*([A-Z|]+)\s*\)/",
+                                       "/^ZEND_VM_HANDLER\(\s*([0-9]+)\s*,\s*([A-Z_]+)\s*,\s*([A-Z|]+)\s*,\s*([A-Z|]+)\s*(,\s*([A-Z_|]+)\s*)?\)/",
                                        $line,
                                        $m) == 0) {
                                die("ERROR ($def:$lineno): Invalid ZEND_VM_HANDLER definition.\n");
@@ -1350,8 +1447,12 @@ function gen_vm($def, $skel) {
                        $code = (int)$m[1];
                        $op   = $m[2];
                        $len  = strlen($op);
-                       $op1  = array_flip(explode("|",$m[3]));
-                       $op2  = array_flip(explode("|",$m[4]));
+                       $op1  = parse_operand_spec($def, $lineno, $m[3], $flags1);
+                       $op2  = parse_operand_spec($def, $lineno, $m[4], $flags2);
+                       $flags = $flags1 | ($flags2 << 8);
+                       if (isset($m[6])) {
+                               $flags |= parse_ext_spec($def, $lineno, $m[6]);
+                       }
 
                        if ($len > $max_opcode_len) {
                                $max_opcode_len = $len;
@@ -1365,7 +1466,7 @@ function gen_vm($def, $skel) {
                        if (isset($opnames[$op])) {
                                die("ERROR ($def:$lineno): Opcode with name '$op' is already defined.\n");
                        }
-                       $opcodes[$code] = array("op"=>$op,"op1"=>$op1,"op2"=>$op2,"code"=>"");
+                       $opcodes[$code] = array("op"=>$op,"op1"=>$op1,"op2"=>$op2,"code"=>"","flags"=>$flags);
                        $opnames[$op] = $code;
                        $handler = $code;
                        $helper = null;
@@ -1379,8 +1480,8 @@ function gen_vm($def, $skel) {
                                die("ERROR ($def:$lineno): Invalid ZEND_VM_HELPER definition.\n");
                        }
                        $helper = $m[1];
-                       $op1    = array_flip(explode("|",$m[2]));
-                       $op2    = array_flip(explode("|",$m[3]));
+                       $op1    = parse_operand_spec($def, $lineno, $m[2], $flags1);
+                       $op2    = parse_operand_spec($def, $lineno, $m[3], $flags2);
                        if (isset($helpers[$helper])) {
                                die("ERROR ($def:$lineno): Helper with name '$helper' is already defined.\n");
                        }
@@ -1396,8 +1497,8 @@ function gen_vm($def, $skel) {
                                die("ERROR ($def:$lineno): Invalid ZEND_VM_HELPER definition.\n");
                        }
                        $helper = $m[1];
-                       $op1    = array_flip(explode("|",$m[2]));
-                       $op2    = array_flip(explode("|",$m[3]));
+                       $op1    = parse_operand_spec($def, $lineno, $m[2], $flags1);
+                       $op2    = parse_operand_spec($def, $lineno, $m[3], $flags2);
                        $param  = $m[4];
                        if (isset($helpers[$helper])) {
                                die("ERROR ($def:$lineno): Helper with name '$helper' is already defined.\n");
@@ -1493,8 +1594,13 @@ function gen_vm($def, $skel) {
        fputs($f, "#define ZEND_VM_KIND_GOTO\t" . ZEND_VM_KIND_GOTO . "\n");
        fputs($f, "#define ZEND_VM_KIND\t\t" . $GLOBALS["vm_kind_name"][ZEND_VM_KIND] . "\n");
        fputs($f, "\n");
+       foreach($vm_op_flags as $name => $val) {
+               fprintf($f, "#define %-24s 0x%08x\n", $name, $val);
+       }
+       fputs($f, "\n");
        fputs($f, "BEGIN_EXTERN_C()\n\n");
-       fputs($f, "ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);\n\n");
+       fputs($f, "ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);\n");
+       fputs($f, "ZEND_API uint32_t zend_get_opcode_flags(zend_uchar opcode);\n\n");
        fputs($f, "END_EXTERN_C()\n\n");
        
        foreach ($opcodes as $code => $dsc) {
@@ -1515,14 +1621,24 @@ function gen_vm($def, $skel) {
        fputs($f,"#include <stdio.h>\n");
        fputs($f,"#include <zend.h>\n\n");
        
-       fputs($f,"const char *zend_vm_opcodes_map[".($max_opcode + 1)."] = {\n");
+       fputs($f,"static const char *zend_vm_opcodes_names[".($max_opcode + 1)."] = {\n");
        for ($i = 0; $i <= $max_opcode; $i++) {
                fputs($f,"\t".(isset($opcodes[$i]["op"])?'"'.$opcodes[$i]["op"].'"':"NULL").",\n");
        }
        fputs($f, "};\n\n");
        
+       fputs($f,"static uint32_t zend_vm_opcodes_flags[".($max_opcode + 1)."] = {\n");
+       for ($i = 0; $i <= $max_opcode; $i++) {
+               fprintf($f, "\t0x%08x,\n", isset($opcodes[$i]["flags"]) ? $opcodes[$i]["flags"] : 0);
+       }
+       fputs($f, "};\n\n");
+
        fputs($f, "ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {\n");
-       fputs($f, "\treturn zend_vm_opcodes_map[opcode];\n");
+       fputs($f, "\treturn zend_vm_opcodes_names[opcode];\n");
+       fputs($f, "}\n");
+
+       fputs($f, "ZEND_API uint32_t zend_get_opcode_flags(zend_uchar opcode) {\n");
+       fputs($f, "\treturn zend_vm_opcodes_flags[opcode];\n");
        fputs($f, "}\n");
     
        fclose($f);
index 000d39044b99767ee23fbd38d87c345d4d428f4d..4b2913b5e14937fe690076daf5e8b07465bb8dbc 100644 (file)
@@ -21,7 +21,7 @@
 #include <stdio.h>
 #include <zend.h>
 
-const char *zend_vm_opcodes_map[182] = {
+static const char *zend_vm_opcodes_names[182] = {
        "ZEND_NOP",
        "ZEND_ADD",
        "ZEND_SUB",
@@ -206,6 +206,194 @@ const char *zend_vm_opcodes_map[182] = {
        "ZEND_FETCH_CLASS_CONSTANT",
 };
 
+static uint32_t zend_vm_opcodes_flags[182] = {
+       0x00000000,
+       0x00000707,
+       0x00000707,
+       0x00000707,
+       0x00000707,
+       0x00000707,
+       0x00000707,
+       0x00000707,
+       0x00000707,
+       0x00000707,
+       0x00000707,
+       0x00000707,
+       0x00000007,
+       0x00000007,
+       0x00000707,
+       0x00000303,
+       0x00000303,
+       0x00000707,
+       0x00000707,
+       0x00000707,
+       0x00000707,
+       0x02000003,
+       0x00000003,
+       0x00100701,
+       0x00100701,
+       0x00100701,
+       0x00100701,
+       0x00100701,
+       0x00100701,
+       0x00100701,
+       0x00100701,
+       0x00100701,
+       0x00100701,
+       0x00100701,
+       0x00000001,
+       0x00000001,
+       0x00000001,
+       0x00000001,
+       0x00000301,
+       0x00000101,
+       0x00000007,
+       0x00000000,
+       0x00000010,
+       0x00001007,
+       0x00001007,
+       0x00081007,
+       0x00001007,
+       0x00001007,
+       0x00000707,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00000007,
+       0x00000707,
+       0x00010701,
+       0x00010701,
+       0x00010701,
+       0x00000000,
+       0x00000001,
+       0x00010300,
+       0x00000000,
+       0x00010300,
+       0x00000003,
+       0x00000008,
+       0x00000308,
+       0x00000803,
+       0x00000801,
+       0x00000801,
+       0x00011003,
+       0x00010300,
+       0x00000005,
+       0x01000703,
+       0x00010703,
+       0x04000007,
+       0x00800107,
+       0x00000701,
+       0x00000701,
+       0x00001003,
+       0x00080001,
+       0x00000007,
+       0x00800107,
+       0x00000707,
+       0x00000703,
+       0x00800107,
+       0x00000701,
+       0x00000701,
+       0x00800107,
+       0x00000701,
+       0x00000701,
+       0x00800107,
+       0x00000707,
+       0x00000707,
+       0x00800107,
+       0x00000703,
+       0x00000703,
+       0x00800107,
+       0x00000701,
+       0x00000701,
+       0x00000307,
+       0x00400301,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00010000,
+       0x00000801,
+       0x00040103,
+       0x00000003,
+       0x00200700,
+       0x00000007,
+       0x00000003,
+       0x00010707,
+       0x00010703,
+       0x00800107,
+       0x20000707,
+       0x00000803,
+       0x00000801,
+       0x00010703,
+       0x00000000,
+       0x00000801,
+       0x00000007,
+       0x00000003,
+       0x02000003,
+       0x00000103,
+       0x00001003,
+       0x00080001,
+       0x00000005,
+       0x00010700,
+       0x00000000,
+       0x00000000,
+       0x00000000,
+       0x00000701,
+       0x00000701,
+       0x00000701,
+       0x00000701,
+       0x00000701,
+       0x00000000,
+       0x00000305,
+       0x00000000,
+       0x00020000,
+       0x00000000,
+       0x00000003,
+       0x00000303,
+       0x00000300,
+       0x00020000,
+       0x00000000,
+       0x00000701,
+       0x20000707,
+       0x00000000,
+       0x00000000,
+       0x00001000,
+       0x00001003,
+       0x00000103,
+       0x00000000,
+       0x00000000,
+       0x00000101,
+       0x00200000,
+       0x00000000,
+       0x00000000,
+       0x00000303,
+       0x00000003,
+       0x08002010,
+       0x10002000,
+       0x00000008,
+       0x00000000,
+       0x00000707,
+       0x00100701,
+       0x00000301,
+       0x00001003,
+       0x00000707,
+       0x00000010,
+       0x00020010,
+       0x00000307,
+       0x00000307,
+       0x00000307,
+       0x00000307,
+       0x00000307,
+       0x00000307,
+       0x00000307,
+       0x20000307,
+       0x00000303,
+};
+
 ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {
-       return zend_vm_opcodes_map[opcode];
+       return zend_vm_opcodes_names[opcode];
+}
+ZEND_API uint32_t zend_get_opcode_flags(zend_uchar opcode) {
+       return zend_vm_opcodes_flags[opcode];
 }
index c6fa3a1dc5711912da4c1843abbe6a0bf778f316..72a04699e0f37a482576b2ecaeb2c85d3726ab24 100644 (file)
 #define ZEND_VM_KIND_GOTO      3
 #define ZEND_VM_KIND           ZEND_VM_KIND_CALL
 
+#define ZEND_VM_OP1_SPEC         0x00000001
+#define ZEND_VM_OP1_CONST        0x00000002
+#define ZEND_VM_OP1_TMPVAR       0x00000004
+#define ZEND_VM_OP1_NUM          0x00000008
+#define ZEND_VM_OP1_ADDR         0x00000010
+#define ZEND_VM_OP1_LINE         0x00000020
+#define ZEND_VM_OP2_SPEC         0x00000100
+#define ZEND_VM_OP2_CONST        0x00000200
+#define ZEND_VM_OP2_TMPVAR       0x00000400
+#define ZEND_VM_OP2_NUM          0x00000800
+#define ZEND_VM_OP2_ADDR         0x00001000
+#define ZEND_VM_OP2_LINE         0x00002000
+#define ZEND_VM_EXT_NUM          0x00010000
+#define ZEND_VM_EXT_VAR          0x00020000
+#define ZEND_VM_EXT_LINE         0x00040000
+#define ZEND_VM_EXT_REL_LINE     0x00080000
+#define ZEND_VM_EXT_DIM_OBJ      0x00100000
+#define ZEND_VM_EXT_CLASS_FETCH  0x00200000
+#define ZEND_VM_EXT_CONST_FETCH  0x00400000
+#define ZEND_VM_EXT_VAR_FETCH    0x00800000
+#define ZEND_VM_EXT_ARRAY_INIT   0x01000000
+#define ZEND_VM_EXT_TYPE         0x02000000
+#define ZEND_VM_EXT_EVAL         0x04000000
+#define ZEND_VM_EXT_FCALL        0x08000000
+#define ZEND_VM_EXT_FRET         0x10000000
+#define ZEND_VM_EXT_ISSET        0x20000000
+
 BEGIN_EXTERN_C()
 
 ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);
+ZEND_API uint32_t zend_get_opcode_flags(zend_uchar opcode);
 
 END_EXTERN_C()