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

Fix GH-17428: Assertion failure ext/opcache/jit/zend_jit_ir.c:8940 #17438

Closed
wants to merge 2 commits into from

Conversation

nielsdos
Copy link
Member

@nielsdos nielsdos commented Jan 10, 2025

The code to update the call_level in that case skips the opline itself, as that opline is handled by the tail handler, and then wants to set the opline to the last opline of the block because the code below the switch will update the call_level for that opline.
However, the test has a block with a single opline (THROW). The block after that has ZEND_INIT_FCALL. Because i points to ZEND_DO_FCALL now, it erroneously updates the call_level after the switch. Although it suffices to change i to end (none of the opcodes here occur in zend_jit_dec_call_level), I added a goto label and changed the loop to handle all call_level updates. This seems more robust for the future in case the list of opcodes changes.

The code to update the call_level in that case skips the opline itself,
as that's handled by the tail handler, and then wants to set the opline
to the last opline of the block because the code below the switch will
update the call_level for that opline.
However, the test has a block with a single opline (THROW). The block
after that has ZEND_INIT_FCALL, because `i` points to ZEND_INIT_FCALL
now, it erroneously causes the call_level after the switch.
Although it suffices to change `i` to `end` (none of the opcodes here
occur in `zend_jit_dec_call_level`), I added a goto label as well to be
safer for the future in case the list of opcodes changes.
@nielsdos nielsdos marked this pull request as ready for review January 10, 2025 20:32
@nielsdos nielsdos requested a review from dstogov as a code owner January 10, 2025 20:32
opline = op_array->opcodes + i;
if (zend_jit_inc_call_level(opline->opcode)) {
call_level++;
} else if (zend_jit_dec_call_level(opline->opcode)) {
call_level--;
}
}
opline = op_array->opcodes + i;
break;
opline = op_array->opcodes + end;
Copy link
Member

Choose a reason for hiding this comment

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

May be you should fix only this single line?

- opline = op_array->opcodes + i;
+ opline = op_array->opcodes + end;

Copy link
Member Author

Choose a reason for hiding this comment

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

alright

@nielsdos nielsdos closed this in 3524702 Jan 14, 2025
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.

Assertion failure ext/opcache/jit/zend_jit_ir.c:8940
2 participants