Skip to content

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Dec 29, 2024

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%

@Girgias Girgias force-pushed the tick-shutdown-fcc-equals-fix branch from 198a8f4 to 5eb00ca Compare December 29, 2024 12:47
@Girgias Girgias force-pushed the tick-shutdown-fcc-equals-fix branch 2 times, most recently from e772b06 to 75aaccc Compare December 29, 2024 16:31
@Girgias Girgias marked this pull request as ready for review December 29, 2024 18:34
@Girgias Girgias requested a review from bukka as a code owner December 29, 2024 18:34
Z_PARAM_FUNC_NO_TRAMPOLINE_FREE(fci, tick_fe.fci_cache)
ZEND_PARSE_PARAMETERS_END();

if (!BG(user_tick_functions)) {
Copy link
Member

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.

Copy link
Member Author

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

uint32_t param_count = 0;

if (zend_parse_parameters(ZEND_NUM_ARGS(), "f*", &tick_fe.fci, &tick_fe.fci_cache, &params, &param_count) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "F*", &fci, &tick_fe.fci_cache, &params, &tick_fe.param_count) == FAILURE) {
Copy link
Member

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?

Copy link
Member Author

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
@Girgias Girgias force-pushed the tick-shutdown-fcc-equals-fix branch from 75aaccc to 190c4c3 Compare December 29, 2024 19:40
@Girgias Girgias merged commit 6ab38b5 into php:master Dec 29, 2024
10 checks passed
@Girgias Girgias deleted the tick-shutdown-fcc-equals-fix branch December 29, 2024 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants