Skip to content

Commit 7690887

Browse files
author
Andi Gutmans
committed
- Use inline instead of macro for PZVAL_LOCK()/PZVAL_UNLOCK() so that it
can be debugged.
1 parent 8cd7092 commit 7690887

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

Zend/zend_execute_locks.h

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
11
#ifndef ZEND_EXECUTE_LOCKS_H
22
#define ZEND_EXECUTE_LOCKS_H
33

4-
#define PZVAL_LOCK(z) ((z)->refcount++)
5-
#define PZVAL_UNLOCK(z) { ((z)->refcount--); \
6-
if (!(z)->refcount) { \
7-
(z)->refcount = 1; \
8-
(z)->is_ref = 0; \
9-
if (EG(garbage_ptr) == 4) { \
10-
zval_ptr_dtor(&EG(garbage)[0]); \
11-
zval_ptr_dtor(&EG(garbage)[1]); \
12-
EG(garbage)[0] = EG(garbage)[2]; \
13-
EG(garbage)[1] = EG(garbage)[3]; \
14-
EG(garbage_ptr) -= 2; \
15-
} \
16-
EG(garbage)[EG(garbage_ptr)++] = (z); \
17-
} \
18-
}
4+
#define PZVAL_LOCK(z) zend_pzval_lock_func(z)
5+
6+
static inline zend_pzval_lock_func(zval *z)
7+
{
8+
((z)->refcount++);
9+
}
10+
11+
#define PZVAL_UNLOCK(z) zend_pzval_unlock_func(z ELS_CC)
12+
13+
static inline zend_pzval_unlock_func(zval *z ELS_DC)
14+
{
15+
((z)->refcount--);
16+
if (!(z)->refcount) {
17+
(z)->refcount = 1;
18+
(z)->is_ref = 0;
19+
if (EG(garbage_ptr) == 4) {
20+
zval_ptr_dtor(&EG(garbage)[0]);
21+
zval_ptr_dtor(&EG(garbage)[1]);
22+
EG(garbage)[0] = EG(garbage)[2];
23+
EG(garbage)[1] = EG(garbage)[3];
24+
EG(garbage_ptr) -= 2;
25+
}
26+
EG(garbage)[EG(garbage_ptr)++] = (z);
27+
}
28+
}
1929

2030
#define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
2131

0 commit comments

Comments
 (0)