From: Dmitry Stogov Date: Tue, 18 Aug 2009 10:12:32 +0000 (+0000) Subject: Fixed ability to call user functions from user opcodes without recursion X-Git-Tag: php-5.4.0alpha1~191^2~2785 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9efc8616d1272eca867103cb35bb93bdc7420db8;p=php Fixed ability to call user functions from user opcodes without recursion --- diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 7120c80172..09f0590c79 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -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 */ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 161cf2b7c7..76d499b42a 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -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: diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 2ff5d5a20b..405b7debdf 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -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: