Skip to content

ext/standard/stream: Use FCC instead of zval for notification callback #19024

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Jul 3, 2025

Also check that the callable exists while setting the option

Also check that the callable exists while setting the option
@Girgias Girgias marked this pull request as ready for review July 4, 2025 10:12
@Girgias Girgias requested a review from bukka as a code owner July 4, 2025 10:12
@Girgias Girgias requested a review from nielsdos July 4, 2025 10:12
}
for (i = 0; i < 6; i++) {
zend_call_known_fcc(context->notifier->fcc, NULL, 6, zvs, NULL);
for (uint8_t i = 0; i < 6; i++) {
Copy link
Member

Choose a reason for hiding this comment

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

Fun fact: If not unrolled, using an (unsigned) int would be better in the sense that the generated assembly for both x86-64 and arm64 is shorter. For x86 it saves an instruction prefix byte to switch to 8 bit mode, and for arm64 it saves an instruction.
However, the loop is likely unrolled in which case it doesn't matter, but just something to take into account that using a shorter type is not always better.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, why do we even have a loop? Just call the zval_ptr_dtor(_str) on &zvs[2] ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking about that, but can't this be an issue if the notifier callback takes the arguments by-ref and changes them to strings?

Copy link
Member

Choose a reason for hiding this comment

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

No, because the conversion happens on the call frame, not on the original zvals.

Copy link
Member Author

Choose a reason for hiding this comment

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

ACK, will change then

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