]> granicus.if.org Git - php/commitdiff
Fixed ability to call user functions from user opcodes without recursion
authorDmitry Stogov <dmitry@php.net>
Tue, 18 Aug 2009 10:12:32 +0000 (10:12 +0000)
committerDmitry Stogov <dmitry@php.net>
Tue, 18 Aug 2009 10:12:32 +0000 (10:12 +0000)
Zend/zend_execute.h
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index 7120c8017209a8bd735011c8efd4626a39c54e3d..09f0590c79dc02617de93c6da9e6e60c09c712d5 100644 (file)
@@ -372,6 +372,8 @@ void init_unicode_strings(void);
 #define ZEND_USER_OPCODE_CONTINUE   0 /* execute next opcode */
 #define ZEND_USER_OPCODE_RETURN     1 /* exit from executor (return from function) */
 #define ZEND_USER_OPCODE_DISPATCH   2 /* call original opcode handler */
+#define ZEND_USER_OPCODE_ENTER      3 /* enter into new op_array without recursion */
+#define ZEND_USER_OPCODE_LEAVE      4 /* return to calling op_array within the same executor */
 
 #define ZEND_USER_OPCODE_DISPATCH_TO 0x100 /* call original handler of returned opcode */
 
index 161cf2b7c7df055deba5f38592a9fbad70c4f4b9..76d499b42af232cbfcbfc835dc14182e7b7d41f6 100644 (file)
@@ -2405,16 +2405,12 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
                        EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference;
                }
 
-#ifndef ZEND_VM_EXPORT
                if (zend_execute == execute && !EG(exception)) {
                        EX(call_opline) = opline;
                        ZEND_VM_ENTER();
                } else {
                        zend_execute(EG(active_op_array) TSRMLS_CC);
                }
-#else
-               zend_execute(EG(active_op_array) TSRMLS_CC);
-#endif
 
                EG(opline_ptr) = &EX(opline);
                EG(active_op_array) = EX(op_array);
@@ -4566,6 +4562,10 @@ ZEND_VM_HANDLER(150, ZEND_USER_OPCODE, ANY, ANY)
                        ZEND_VM_CONTINUE();
                case ZEND_USER_OPCODE_RETURN:
                        ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
+               case ZEND_USER_OPCODE_ENTER:
+                       ZEND_VM_ENTER();
+               case ZEND_USER_OPCODE_LEAVE:
+                       ZEND_VM_LEAVE();
                case ZEND_USER_OPCODE_DISPATCH:
                        ZEND_VM_DISPATCH(EX(opline)->opcode, EX(opline));
                default:
index 2ff5d5a20b5f7e668aa73ef1581770a9df154988..405b7debdf110da23825edbd17c0e60f27779422 100644 (file)
@@ -338,16 +338,12 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
                        EX_T(opline->result.u.var).var.fcall_returned_reference = EX(function_state).function->common.return_reference;
                }
 
-#if 1
                if (zend_execute == execute && !EG(exception)) {
                        EX(call_opline) = opline;
                        ZEND_VM_ENTER();
                } else {
                        zend_execute(EG(active_op_array) TSRMLS_CC);
                }
-#else
-               zend_execute(EG(active_op_array) TSRMLS_CC);
-#endif
 
                EG(opline_ptr) = &EX(opline);
                EG(active_op_array) = EX(op_array);
@@ -707,6 +703,10 @@ static int ZEND_FASTCALL  ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS
                        ZEND_VM_CONTINUE();
                case ZEND_USER_OPCODE_RETURN:
                        return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+               case ZEND_USER_OPCODE_ENTER:
+                       ZEND_VM_ENTER();
+               case ZEND_USER_OPCODE_LEAVE:
+                       ZEND_VM_LEAVE();
                case ZEND_USER_OPCODE_DISPATCH:
                        ZEND_VM_DISPATCH(EX(opline)->opcode, EX(opline));
                default: