Skip to content

Instantly share code, notes, and snippets.

@laruence
Last active June 14, 2018 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laruence/4068c564e38e8e0f84148cc1b3f977cf to your computer and use it in GitHub Desktop.
Save laruence/4068c564e38e8e0f84148cc1b3f977cf to your computer and use it in GitHub Desktop.
diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c
index 5511313..0fc538b 100644
--- a/ext/opcache/Optimizer/sccp.c
+++ b/ext/opcache/Optimizer/sccp.c
@@ -1226,13 +1226,6 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
SKIP_IF_TOP(op2);
}
- /* We want to avoid keeping around intermediate arrays for each SSA variable in the
- * ADD_ARRAY_ELEMENT chain. We do this by only keeping the array on the last opcode
- * and use a NULL value everywhere else. */
- if (Z_TYPE(ctx->values[ssa_op->result_def]) == IS_NULL) {
- return;
- }
-
if (op2 && IS_BOT(op2)) {
/* Update of unknown index */
SET_RESULT_BOT(op1);
@@ -1256,9 +1249,8 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
if (!result) {
empty_partial_array(&zv);
} else {
- MAKE_PARTIAL_ARRAY(result);
- ZVAL_COPY_VALUE(&zv, result);
- ZVAL_NULL(result);
+ ZVAL_ARR(&zv, zend_array_dup(Z_ARR_P(result)));
+ MAKE_PARTIAL_ARRAY(&zv);
}
if (!op2) {
/* We can't add NEXT element into partial array (skip it) */
@@ -1277,8 +1269,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
} else {
if (result) {
- ZVAL_COPY_VALUE(&zv, result);
- ZVAL_NULL(result);
+ ZVAL_ARR(&zv, zend_array_dup(Z_ARR_P(result)));
} else {
array_init(&zv);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment