Skip to content

Commit 8f93709

Browse files
committed
micro-optimization
1 parent 3228d68 commit 8f93709

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

Zend/zend_execute.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4016,27 +4016,29 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_object(zend_o
40164016
void *object_or_called_scope;
40174017
zend_class_entry *called_scope;
40184018
zend_object *object;
4019-
uint32_t call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_DYNAMIC;
4019+
uint32_t call_info;
40204020

40214021
if (EXPECTED(function->handlers->get_closure) &&
40224022
EXPECTED(function->handlers->get_closure(function, &called_scope, &fbc, &object, 0) == SUCCESS)) {
40234023

4024-
object_or_called_scope = called_scope;
4025-
if (fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
4024+
object_or_called_scope = called_scope;
4025+
if (EXPECTED(fbc->common.fn_flags & ZEND_ACC_CLOSURE)) {
40264026
/* Delay closure destruction until its invocation */
40274027
GC_ADDREF(ZEND_CLOSURE_OBJECT(fbc));
4028-
call_info |= ZEND_CALL_CLOSURE;
4029-
if (fbc->common.fn_flags & ZEND_ACC_FAKE_CLOSURE) {
4030-
call_info |= ZEND_CALL_FAKE_CLOSURE;
4031-
}
4028+
ZEND_ASSERT(ZEND_ACC_FAKE_CLOSURE == ZEND_CALL_FAKE_CLOSURE);
4029+
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_DYNAMIC | ZEND_CALL_CLOSURE |
4030+
(fbc->common.fn_flags & ZEND_ACC_FAKE_CLOSURE);
40324031
if (object) {
40334032
call_info |= ZEND_CALL_HAS_THIS;
40344033
object_or_called_scope = object;
40354034
}
4036-
} else if (object) {
4037-
call_info |= ZEND_CALL_RELEASE_THIS | ZEND_CALL_HAS_THIS;
4038-
GC_ADDREF(object); /* For $this pointer */
4039-
object_or_called_scope = object;
4035+
} else {
4036+
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_DYNAMIC;
4037+
if (object) {
4038+
call_info |= ZEND_CALL_RELEASE_THIS | ZEND_CALL_HAS_THIS;
4039+
GC_ADDREF(object); /* For $this pointer */
4040+
object_or_called_scope = object;
4041+
}
40404042
}
40414043
} else {
40424044
zend_throw_error(NULL, "Object of type %s is not callable", ZSTR_VAL(function->ce->name));

0 commit comments

Comments
 (0)