-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
ext/standard: Refactor tick and shutdown functions #17295
Conversation
198a8f4
to
5eb00ca
Compare
e772b06
to
75aaccc
Compare
ext/standard/basic_functions.c
Outdated
|
||
ZEND_PARSE_PARAMETERS_START(1, 1) | ||
Z_PARAM_FUNC(tick_fe.fci, tick_fe.fci_cache) | ||
Z_PARAM_FUNC_NO_TRAMPOLINE_FREE(fci, tick_fe.fci_cache) | ||
ZEND_PARSE_PARAMETERS_END(); | ||
|
||
if (!BG(user_tick_functions)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you free the trampoline in this early return?
You can consolidate the freeing by inverting the if condition and placing the zend_llist_del_element
call inside the if.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test and did your fix
|
||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "f*", &tick_fe.fci, &tick_fe.fci_cache, ¶ms, ¶m_count) == FAILURE) { | ||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "F*", &fci, &tick_fe.fci_cache, ¶ms, &tick_fe.param_count) == FAILURE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change from f
to F
means that the function never worked for trampolines, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It did because the callable was stored in the FCI, and it was fetched at each call from the function_name
zval of the FCI.
I did think this as well at the beginning and so wrote the tests first.
Remove usage of FCI and store the parameters and count of it directly on the relevant structures This reduces the size of the structs by ~50
75aaccc
to
190c4c3
Compare
Remove usage of FCI and store the parameters and count of it directly on the relevant structures
This reduces the size of the structs by ~50%