Add first-class callables

Support acquiring a Closure to a callable using the syntax
func(...), $obj->method(...), etc. This is essentially a
shortcut for Closure::fromCallable().

RFC: https://wiki.php.net/rfc/first_class_callable_syntax

Closes GH-7019.

Co-Authored-By: Nikita Popov <nikita.ppv@gmail.com>
This commit is contained in:
Joe Watkins 2021-05-20 08:14:56 +02:00 committed by Nikita Popov
parent 42cb5b5fa8
commit d0b09a7be4
40 changed files with 1078 additions and 515 deletions

View file

@ -740,7 +740,9 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
}
TRACE_RECORD(ZEND_JIT_TRACE_DO_ICALL, 0, EX(call)->func);
}
} else if (opline->opcode == ZEND_INCLUDE_OR_EVAL) {
} else if (opline->opcode == ZEND_INCLUDE_OR_EVAL
|| opline->opcode == ZEND_CALLABLE_CONVERT) {
/* TODO: Support tracing JIT for ZEND_CALLABLE_CONVERT. */
stop = ZEND_JIT_TRACE_STOP_INTERPRETER;
break;
}