public
Created

  • Download Gist
no_foreach_lock.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 25a604c..4dba71b 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1737,7 +1737,6 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n
zend_op dummy_opline;
dummy_opline.result_type = IS_UNUSED;
- dummy_opline.op1_type = IS_UNUSED;
zend_stack_push(&CG(foreach_copy_stack), (void *) &dummy_opline, sizeof(zend_op));
}
@@ -2657,7 +2656,7 @@ static int generate_free_foreach_copy(const zend_op *foreach_copy TSRMLS_DC) /*
zend_op *opline;
/* If we reach the separator then stop applying the stack */
- if (foreach_copy->result_type == IS_UNUSED && foreach_copy->op1_type == IS_UNUSED) {
+ if (foreach_copy->result_type == IS_UNUSED) {
return 1;
}
@@ -2668,15 +2667,6 @@ static int generate_free_foreach_copy(const zend_op *foreach_copy TSRMLS_DC) /*
SET_UNUSED(opline->op2);
opline->extended_value = 1;
- if (foreach_copy->op1_type != IS_UNUSED) {
- opline = get_next_op(CG(active_op_array) TSRMLS_CC);
-
- opline->opcode = (foreach_copy->op1_type == IS_TMP_VAR) ? ZEND_FREE : ZEND_SWITCH_FREE;
- COPY_NODE(opline->op1, foreach_copy->op1);
- SET_UNUSED(opline->op2);
- opline->extended_value = 0;
- }
-
return 0;
}
/* }}} */
@@ -6225,7 +6215,6 @@ void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, zno
{
zend_op *opline;
zend_bool is_variable;
- zend_bool push_container = 0;
zend_op dummy_opline;
if (variable) {
@@ -6237,14 +6226,6 @@ void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, zno
/* save the location of FETCH_W instruction(s) */
open_brackets_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
zend_do_end_variable_parse(array, BP_VAR_W, 0 TSRMLS_CC);
- if (CG(active_op_array)->last > 0 &&
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode == ZEND_FETCH_OBJ_W) {
- /* Only lock the container if we are fetching from a real container and not $this */
- if (CG(active_op_array)->opcodes[CG(active_op_array)->last-1].op1_type == IS_VAR) {
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].extended_value |= ZEND_FETCH_ADD_LOCK;
- push_container = 1;
- }
- }
} else {
is_variable = 0;
open_brackets_token->u.op.opline_num = get_next_op_number(CG(active_op_array));
@@ -6264,11 +6245,6 @@ void zend_do_foreach_begin(znode *foreach_token, znode *open_brackets_token, zno
opline->extended_value = is_variable ? ZEND_FE_RESET_VARIABLE : 0;
COPY_NODE(dummy_opline.result, opline->result);
- if (push_container) {
- COPY_NODE(dummy_opline.op1, CG(active_op_array)->opcodes[CG(active_op_array)->last-2].op1);
- } else {
- dummy_opline.op1_type = IS_UNUSED;
- }
zend_stack_push(&CG(foreach_copy_stack), (void *) &dummy_opline, sizeof(zend_op));
/* save the location of FE_FETCH */
@@ -6325,7 +6301,6 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token
opline->extended_value |= ZEND_FE_FETCH_BYREF;
CG(active_op_array)->opcodes[foreach_token->u.op.opline_num].extended_value |= ZEND_FE_RESET_REFERENCE;
} else {
- zend_op *foreach_copy;
zend_op *fetch = &CG(active_op_array)->opcodes[foreach_token->u.op.opline_num];
zend_op *end = &CG(active_op_array)->opcodes[open_brackets_token->u.op.opline_num];
@@ -6342,9 +6317,6 @@ void zend_do_foreach_cont(znode *foreach_token, const znode *open_brackets_token
fetch->opcode -= 3; /* FETCH_W -> FETCH_R */
}
}
- /* prevent double SWITCH_FREE */
- zend_stack_top(&CG(foreach_copy_stack), (void **) &foreach_copy);
- foreach_copy->op1_type = IS_UNUSED;
}
GET_NODE(&value_node, opline->result);
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 3a51321..09f567c 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -1388,11 +1388,6 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
SAVE_OPLINE();
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
- if (OP1_TYPE == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
- EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
- }
-
if (IS_OP2_TMP_FREE()) {
MAKE_REAL_ZVAL_PTR(property);
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 7774e96..a5b4e72 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -14996,11 +14996,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
property = opline->op2.zv;
- if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
- EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
- }
-
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
@@ -17335,11 +17330,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
- EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
- }
-
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
@@ -19579,11 +19569,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
- EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
- }
-
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
@@ -23023,11 +23008,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (IS_VAR == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
- EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
- }
-
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
@@ -24794,11 +24774,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE
SAVE_OPLINE();
property = opline->op2.zv;
- if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
- EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
- }
-
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
@@ -26206,11 +26181,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
- EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
- }
-
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
@@ -27521,11 +27491,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_H
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
- EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
- }
-
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
@@ -29260,11 +29225,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HA
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (IS_UNUSED == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
- EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
- }
-
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
@@ -32415,11 +32375,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
SAVE_OPLINE();
property = opline->op2.zv;
- if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
- EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
- }
-
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
@@ -34520,11 +34475,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
property = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
- EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
- }
-
if (1) {
MAKE_REAL_ZVAL_PTR(property);
}
@@ -36627,11 +36577,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL
SAVE_OPLINE();
property = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
- if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
- EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
- }
-
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}
@@ -39786,11 +39731,6 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE
SAVE_OPLINE();
property = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
- if (IS_CV == IS_VAR && (opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
- PZVAL_LOCK(*EX_T(opline->op1.var).var.ptr_ptr);
- EX_T(opline->op1.var).var.ptr = *EX_T(opline->op1.var).var.ptr_ptr;
- }
-
if (0) {
MAKE_REAL_ZVAL_PTR(property);
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.