Fix JIT QM_ASSIGN may be optimized out when op1 is null#13610
Merged
arnaud-lb merged 1 commit intophp:PHP-8.2from Mar 11, 2024
Merged
Fix JIT QM_ASSIGN may be optimized out when op1 is null#13610arnaud-lb merged 1 commit intophp:PHP-8.2from
arnaud-lb merged 1 commit intophp:PHP-8.2from
Conversation
Member
|
This seems already fixed in master in a better way. diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c
index f6da28375b7..c1ed5d80a66 100644
--- a/ext/opcache/jit/zend_jit_trace.c
+++ b/ext/opcache/jit/zend_jit_trace.c
@@ -5070,8 +5070,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
CHECK_OP1_TRACE_TYPE();
res_info = RES_INFO();
res_use_info = zend_jit_trace_type_to_info(
- STACK_MEM_TYPE(stack, EX_VAR_TO_NUM(opline->result.var)))
- & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE);
+ STACK_MEM_TYPE(stack, EX_VAR_TO_NUM(opline->result.var)));
res_addr = RES_REG_ADDR();
if (Z_MODE(res_addr) != IS_REG &&
STACK_TYPE(stack, EX_VAR_TO_NUM(opline->result.var)) !=Can you place take care about committing this. |
Co-authored-by: Dmitry Stogov <[email protected]>
dstogov
approved these changes
Mar 11, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ZVAL_COPY_CONSTand its variations avoid updatingZ_TYPE_P(dst_addr)when it's known to have the right value already, based ondst_info. However, when emitting code forZEND_QM_ASSIGN, we addMAY_BE_NULLtodst_infowhen the SSA type and stack types disagree. I'm assuming this is done to force a type store here:php-src/ext/opcache/jit/zend_jit_x86.dasc
Lines 959 to 963 in 88e90c6
Both of these conditions will be true unless
Z_TYPE_P(zv)is NULL, in which case the type store is erroneously eliminated.In this change I set
res_use_info(dst_info) to0to force a type store.MAY_BE_ANYwould also work.This fixes #13508, but I'm not 100% confident this is correct.
ZEND_ASSIGNmay have the same issue and I will look at it later.