Skip to content

Commit 8cd7092

Browse files
author
Andi Gutmans
committed
- Nuke dependency of all of PHP on zend_execute_locks.h.
1 parent 87902db commit 8cd7092

File tree

3 files changed

+53
-53
lines changed

3 files changed

+53
-53
lines changed

Zend/zend_execute.c

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,58 @@ static inline void zend_switch_free(zend_op *opline, temp_variable *Ts ELS_DC)
246246
}
247247
}
248248

249+
void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts ELS_DC)
250+
{
251+
zval *variable_ptr;
252+
zval *value_ptr;
253+
254+
if (!value_ptr_ptr || !variable_ptr_ptr) {
255+
zend_error(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
256+
return;
257+
}
258+
259+
variable_ptr = *variable_ptr_ptr;
260+
value_ptr = *value_ptr_ptr;
261+
262+
if (variable_ptr == EG(error_zval_ptr) || value_ptr==EG(error_zval_ptr)) {
263+
variable_ptr_ptr = &EG(uninitialized_zval_ptr);
264+
/* } else if (variable_ptr==&EG(uninitialized_zval) || variable_ptr!=value_ptr) { */
265+
} else if (variable_ptr_ptr != value_ptr_ptr) {
266+
variable_ptr->refcount--;
267+
if (variable_ptr->refcount==0) {
268+
zendi_zval_dtor(*variable_ptr);
269+
FREE_ZVAL(variable_ptr);
270+
}
271+
272+
if (!PZVAL_IS_REF(value_ptr)) {
273+
/* break it away */
274+
value_ptr->refcount--;
275+
if (value_ptr->refcount>0) {
276+
ALLOC_ZVAL(*value_ptr_ptr);
277+
**value_ptr_ptr = *value_ptr;
278+
value_ptr = *value_ptr_ptr;
279+
zendi_zval_copy_ctor(*value_ptr);
280+
}
281+
value_ptr->refcount = 1;
282+
value_ptr->is_ref = 1;
283+
}
284+
285+
*variable_ptr_ptr = value_ptr;
286+
value_ptr->refcount++;
287+
} else {
288+
if (variable_ptr->refcount>1) { /* we need to break away */
289+
SEPARATE_ZVAL(variable_ptr_ptr);
290+
}
291+
(*variable_ptr_ptr)->is_ref = 1;
292+
}
293+
294+
if (result && !(result->u.EA.type & EXT_TYPE_UNUSED)) {
295+
Ts[result->u.var].var.ptr_ptr = variable_ptr_ptr;
296+
SELECTIVE_PZVAL_LOCK(*variable_ptr_ptr, result);
297+
AI_USE_PTR(Ts[result->u.var].var);
298+
}
299+
}
300+
249301

250302
static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2, zval *value, int type, temp_variable *Ts ELS_DC)
251303
{

Zend/zend_execute.h

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "zend_compile.h"
2525
#include "zend_hash.h"
2626
#include "zend_variables.h"
27-
#include "zend_execute_locks.h"
2827

2928
typedef union _temp_variable {
3029
zval tmp_var;
@@ -155,57 +154,7 @@ void zend_shutdown_timeout_thread();
155154

156155
#define active_opline (*EG(opline_ptr))
157156

158-
static inline void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts ELS_DC)
159-
{
160-
zval *variable_ptr;
161-
zval *value_ptr;
162-
163-
if (!value_ptr_ptr || !variable_ptr_ptr) {
164-
zend_error(E_ERROR, "Cannot create references to/from string offsets nor overloaded objects");
165-
return;
166-
}
167-
168-
variable_ptr = *variable_ptr_ptr;
169-
value_ptr = *value_ptr_ptr;
170-
171-
if (variable_ptr == EG(error_zval_ptr) || value_ptr==EG(error_zval_ptr)) {
172-
variable_ptr_ptr = &EG(uninitialized_zval_ptr);
173-
/* } else if (variable_ptr==&EG(uninitialized_zval) || variable_ptr!=value_ptr) { */
174-
} else if (variable_ptr_ptr != value_ptr_ptr) {
175-
variable_ptr->refcount--;
176-
if (variable_ptr->refcount==0) {
177-
zendi_zval_dtor(*variable_ptr);
178-
FREE_ZVAL(variable_ptr);
179-
}
180-
181-
if (!PZVAL_IS_REF(value_ptr)) {
182-
/* break it away */
183-
value_ptr->refcount--;
184-
if (value_ptr->refcount>0) {
185-
ALLOC_ZVAL(*value_ptr_ptr);
186-
**value_ptr_ptr = *value_ptr;
187-
value_ptr = *value_ptr_ptr;
188-
zendi_zval_copy_ctor(*value_ptr);
189-
}
190-
value_ptr->refcount = 1;
191-
value_ptr->is_ref = 1;
192-
}
193-
194-
*variable_ptr_ptr = value_ptr;
195-
value_ptr->refcount++;
196-
} else {
197-
if (variable_ptr->refcount>1) { /* we need to break away */
198-
SEPARATE_ZVAL(variable_ptr_ptr);
199-
}
200-
(*variable_ptr_ptr)->is_ref = 1;
201-
}
202-
203-
if (result && !(result->u.EA.type & EXT_TYPE_UNUSED)) {
204-
Ts[result->u.var].var.ptr_ptr = variable_ptr_ptr;
205-
SELECTIVE_PZVAL_LOCK(*variable_ptr_ptr, result);
206-
AI_USE_PTR(Ts[result->u.var].var);
207-
}
208-
}
157+
void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts ELS_DC);
209158

210159
#define IS_OVERLOADED_OBJECT 1
211160
#define IS_STRING_OFFSET 2

Zend/zend_execute_API.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "zend_ptr_stack.h"
2929
#include "zend_constants.h"
3030
#include "zend_extensions.h"
31-
#include "zend_execute_locks.h"
3231
#ifdef HAVE_SYS_TIME_H
3332
#include <sys/time.h>
3433
#endif

0 commit comments

Comments
 (0)