Skip to content
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

Implement compile-time-eval for functions called with named arguments #10831

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

Conversation

nielsdos
Copy link
Member

@nielsdos nielsdos commented Mar 11, 2023

In #10811 I disabled compile-time-eval for function calls with named
arguments because it was completely unsupported and thus would therefore
crash or give semantically wrong results. This patch undoes the
disabling and implements the necessary components to support CTE for
named arguments.

Since named arguments are a bit of a special case for the VM, I also had
to add some special handling for the SCCP pass. I also had to tweak how
the call removal code worked such that the named arguments, which are
not in num_args, are also removed, as well as the CHECK_UNDEF_ARGS
opline.

Unfortunately this is a bit convoluted because the named params need special handling.
There's probably some room for cleanup by using inline functions or macros though, although maybe that's too invasive anyway? Not sure...

EDIT: OK I need to debug this further, sad that I can't repro the crash locally, but I have some clues. I'm almost out of time for today so that'll have to happen tomorrow... I'll let yo know when it's actually ready for review
Ready for review now

In phpGH-10811 I disabled compile-time-eval for function calls with named
arguments because it was completely unsupported and thus would therefore
crash or give semantically wrong results. This patch undoes the
disabling and implements the necessary components to support CTE for
named arguments.

Since named arguments are a bit of a special case for the VM, I also had
to add some special handling for the SCCP pass. I also had to tweak how
the call removal code worked such that the named arguments, which are
not in num_args, are also removed, as well as the CHECK_UNDEF_ARGS
opline.
Previously, the CTE did indeed not execute on function calls with named
parameters. Now we can do this, so the comments need to be adjusted to
not confuse the end user. The goal of the test remains the same though:
we use different argument orders to check if there is a semantic
difference.
@nielsdos nielsdos marked this pull request as draft March 11, 2023 14:53
@nielsdos nielsdos marked this pull request as ready for review March 12, 2023 18:25
@nielsdos nielsdos requested a review from dstogov as a code owner October 7, 2023 13:51
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.

1 participant