1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 10:12:18 +01:00

Fixed ability to call user functions from user opcodes without recursion

This commit is contained in:
Dmitry Stogov
2009-08-18 10:12:32 +00:00
parent a515259047
commit f1ab855cfe
3 changed files with 10 additions and 8 deletions

View File

@@ -351,6 +351,8 @@ ZEND_API zval** zend_get_compiled_variable_value(const zend_execute_data *execut
#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 */

View File

@@ -2328,16 +2328,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);
@@ -4358,6 +4354,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:

View File

@@ -330,16 +330,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);
@@ -699,6 +695,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: