Zend: inline some Closure handling - #23643
Conversation
This only affects direct calls to Closure->__invoke().
To provide fast paths for Closures and __invoke() and abstract away the need to deal with the object handler
|
I would expect that the dispatch via a virtual call is invisible in real life applications, and it should be an easily predictable call target for CPUs. |
|
I don't see benefit in this honestly, especially the code duplication isn't great. |
Trying to determine if it is possible to have the The other motivation was to determine if, when we get rid of the deprecated callables, we can remove one of the scopes from the FCC. But I can see the lack of benefit if we can't actually remove the |
The initial motivation was to actually remove the
get_closureobject handler as I couldn't find any usage via SourceGraph (which is quite difficult asget_closureis incredibly common) and the one usage I could was the old Pimple extension and thus effectively revert f90255cBut it turns out that ext/ffi uses it for
ZEND_FFI_TYPE_FUNCCData classes (which once again reminds me we should try and actually provide different distinct classes for all those CData types rather than changing object handlers...)Anyway I've readded the
zend_get_closure()API which inlines theClosureand__invoke()behaviour and abstracts over theget_closureobject handler logic, and reordered some logic with the new API usage.