Skip to content

[Observer] Pass zend_execute_data instead of zend_function to fcall init #6209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

SammyK
Copy link
Contributor

@SammyK SammyK commented Sep 24, 2020

This changes the observer API signature for zend_observer_fcall_init:

- typedef zend_observer_fcall_handlers (*zend_observer_fcall_init)(zend_function *func);
+ typedef zend_observer_fcall_handlers (*zend_observer_fcall_init)(zend_execute_data *execute_data);

The motivation for this change is to prevent extensions from having to check executor globals for the current execute_data during function call init. (See this example from @trowski's work on amphp/ext-fiber.)

A previous implementation of the observer API initialized the function call from runtime cache initialization before execute_data was allocated which is why zend_function was passed in instead. But now that the observer API is implemented via opcode specialization, it makes sense to pass in the execute_data.

This also keeps the API a bit more consistent for existing extensions that already hook zend_execute_ex.

/cc @morrisonlevi and @beberlei

The motivation for this change is to prevent extensions from having to check executor globals for the current execute_data during function call init. A previous implementation of the observer API initialized the function call from runtime cache initialization before execute_data was allocated which is why zend_function was passed in.

But now that the observer API is implemented via opcode specialization, it makes sense to pass in the execute_data. This also keeps the API a bit more consistent for existing extensions that already hook zend_execute_ex.
@SammyK SammyK force-pushed the observer/api-change branch from 1a5f17f to 9f50152 Compare September 24, 2020 20:19
Copy link
Contributor

@morrisonlevi morrisonlevi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me as well!

@php-pulls php-pulls closed this in e42abea Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants