summaryrefslogtreecommitdiff
path: root/Zend/zend_vm_execute.h
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2018-01-11 17:27:26 +0300
committerDmitry Stogov <dmitry@zend.com>2018-01-11 17:27:26 +0300
commit6ba10a03e7b14089e2f53305dec9a6ec06a7eb64 (patch)
tree9a8da85cf1145c0e52691d6ece4553ac8cc8234b /Zend/zend_vm_execute.h
parentda8204ba1c5e688164b14bd914900df7b84047cb (diff)
downloadphp-git-6ba10a03e7b14089e2f53305dec9a6ec06a7eb64.tar.gz
Revert "Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse." (this patch is incomplete or wrong)
This reverts commit 781e1573afdc7c336b3577ceabc9c65cafea17e8.
Diffstat (limited to 'Zend/zend_vm_execute.h')
-rw-r--r--Zend/zend_vm_execute.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 3845f454da..8747a299e8 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -457,7 +457,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_
}
OBJ_RELEASE(object);
} else if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
- OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
+ OBJ_RELEASE((zend_object*)execute_data->func->op_array.prototype);
}
EG(vm_stack_top) = (zval*)execute_data;
execute_data = EX(prev_execute_data);
@@ -488,7 +488,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_
}
OBJ_RELEASE(object);
} else if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
- OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
+ OBJ_RELEASE((zend_object*)execute_data->func->op_array.prototype);
}
zend_vm_stack_free_extra_args_ex(call_info, execute_data);
@@ -530,7 +530,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_
}
EG(current_execute_data) = EX(prev_execute_data);
if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
- OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
+ OBJ_RELEASE((zend_object*)EX(func)->op_array.prototype);
}
ZEND_VM_RETURN();
} else /* if (call_kind == ZEND_CALL_TOP_CODE) */ {
@@ -1361,7 +1361,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_O
}
zend_internal_type_error(EX_USES_STRICT_TYPES(), "call_user_func_array() expects parameter 2 to be array, %s given", zend_get_type_by_const(Z_TYPE_P(args)));
if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) {
- OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(call)->func));
+ OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
}
if (Z_TYPE(EX(call)->This) == IS_OBJECT) {
OBJ_RELEASE(Z_OBJ(EX(call)->This));
@@ -5585,7 +5585,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS
}
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
- GC_ADDREF(ZEND_CLOSURE_OBJECT(func));
+ ZEND_ASSERT(GC_TYPE((zend_object*)func->common.prototype) == IS_OBJECT);
+ GC_ADDREF((zend_object*)func->common.prototype);
call_info |= ZEND_CALL_CLOSURE;
if (func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE) {
call_info |= ZEND_CALL_FAKE_CLOSURE;
@@ -5597,7 +5598,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS
if ((IS_CONST & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) {
if (call_info & ZEND_CALL_CLOSURE) {
- zend_object_release(ZEND_CLOSURE_OBJECT(func));
+ zend_object_release((zend_object*)func->common.prototype);
}
if (call_info & ZEND_CALL_RELEASE_THIS) {
zend_object_release(object);
@@ -7795,7 +7796,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV
}
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
- GC_ADDREF(ZEND_CLOSURE_OBJECT(func));
+ ZEND_ASSERT(GC_TYPE((zend_object*)func->common.prototype) == IS_OBJECT);
+ GC_ADDREF((zend_object*)func->common.prototype);
call_info |= ZEND_CALL_CLOSURE;
if (func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE) {
call_info |= ZEND_CALL_FAKE_CLOSURE;
@@ -7808,7 +7810,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV
zval_ptr_dtor_nogc(free_op2);
if (((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) {
if (call_info & ZEND_CALL_CLOSURE) {
- zend_object_release(ZEND_CLOSURE_OBJECT(func));
+ zend_object_release((zend_object*)func->common.prototype);
}
if (call_info & ZEND_CALL_RELEASE_THIS) {
zend_object_release(object);
@@ -10931,7 +10933,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H
}
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
- GC_ADDREF(ZEND_CLOSURE_OBJECT(func));
+ ZEND_ASSERT(GC_TYPE((zend_object*)func->common.prototype) == IS_OBJECT);
+ GC_ADDREF((zend_object*)func->common.prototype);
call_info |= ZEND_CALL_CLOSURE;
if (func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE) {
call_info |= ZEND_CALL_FAKE_CLOSURE;
@@ -10943,7 +10946,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H
if ((IS_CV & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) {
if (call_info & ZEND_CALL_CLOSURE) {
- zend_object_release(ZEND_CLOSURE_OBJECT(func));
+ zend_object_release((zend_object*)func->common.prototype);
}
if (call_info & ZEND_CALL_RELEASE_THIS) {
zend_object_release(object);