Skip to content

Remove useless UNEXPECTED around RETURN_VALUE_USED in specialized RETVAL handler #9329

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

Merged

Conversation

iluuu1994
Copy link
Member

This can lead to funny code like UNEXPECTED(1) which is non-sensical.

SPEC(QUICK_ARG) can cause the same issue with UNEXPECTED(arg_num <= MAX_ARG_FLAG_NUM) but it's not as straight-forward to fix as it doesn't get replaced in all handlers.

…VAL handler

This can lead to funny code like UNEXPECTED(1) which is non-sensical.
@cmb69
Copy link
Member

cmb69 commented Aug 15, 2022

This can lead to funny code like UNEXPECTED(1) which is non-sensical.

It would only be bad, if RETURN_VALUE_USED(opline) evaluated to 0 most of the time. I think we either should measure, or rely on PGO (although I'm not sure whether "good" PGO builds are very common).

@iluuu1994
Copy link
Member Author

iluuu1994 commented Aug 15, 2022

@cmb69 Note that RETURN_VALUE_USED(opline) is not the code that is actually compiled, as it's replaced with 0/1 in zend_vm_execute.h by zend_vm_gen.php for these specialized handlers.

Copy link
Member

@cmb69 cmb69 left a comment

Choose a reason for hiding this comment

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

Ah, thanks, of course!

@iluuu1994 iluuu1994 merged commit 0f29436 into php:master Aug 15, 2022
@iluuu1994
Copy link
Member Author

@cmb69 Thanks for the review 🙂

@iluuu1994
Copy link
Member Author

I reverted this change (81f3fcd). I was unaware of the --without-specializer flag in which case the UNEXPECTED might still be helpful.

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