Skip to content

Commit c9d728c

Browse files
committed
Revert "Zend/zend_types.h: move zend_rc_debug to zend_rc_debug.h"
This reverts commit d6e9504.
1 parent 59905d8 commit c9d728c

File tree

11 files changed

+23
-82
lines changed

11 files changed

+23
-82
lines changed

Zend/zend.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ void (*zend_on_timeout)(int seconds);
9595
static void (*zend_message_dispatcher_p)(zend_long message, const void *data);
9696
static zval *(*zend_get_configuration_directive_p)(zend_string *name);
9797

98+
#if ZEND_RC_DEBUG
99+
ZEND_API bool zend_rc_debug = 0;
100+
#endif
101+
98102
static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
99103
{
100104
if (!new_value) {

Zend/zend_API.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "zend_ini.h"
3333
#include "zend_enum.h"
3434
#include "zend_observer.h"
35-
#include "zend_rc_debug.h"
3635

3736
#include <stdarg.h>
3837

Zend/zend_rc_debug.c

Lines changed: 0 additions & 21 deletions
This file was deleted.

Zend/zend_rc_debug.h

Lines changed: 0 additions & 53 deletions
This file was deleted.

Zend/zend_string.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include "zend.h"
2020
#include "zend_globals.h"
21-
#include "zend_rc_debug.h"
2221

2322
#ifdef HAVE_VALGRIND
2423
# include "valgrind/callgrind.h"

Zend/zend_types.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
#include "zend_portability.h"
2626
#include "zend_long.h"
27-
#include "zend_rc_debug.h"
2827
#include "zend_result.h"
2928

3029
#include <stdbool.h>
@@ -1162,11 +1161,29 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
11621161
#define Z_TRY_ADDREF(z) Z_TRY_ADDREF_P(&(z))
11631162
#define Z_TRY_DELREF(z) Z_TRY_DELREF_P(&(z))
11641163

1164+
#ifndef ZEND_RC_DEBUG
1165+
# define ZEND_RC_DEBUG 0
1166+
#endif
1167+
11651168
#if ZEND_RC_DEBUG
1169+
extern ZEND_API bool zend_rc_debug;
1170+
/* The GC_PERSISTENT flag is reused for IS_OBJ_WEAKLY_REFERENCED on objects.
1171+
* Skip checks for OBJECT/NULL type to avoid interpreting the flag incorrectly. */
1172+
# define ZEND_RC_MOD_CHECK(p) do { \
1173+
if (zend_rc_debug) { \
1174+
uint8_t type = zval_gc_type((p)->u.type_info); \
1175+
if (type != IS_OBJECT && type != IS_NULL) { \
1176+
ZEND_ASSERT(!(zval_gc_flags((p)->u.type_info) & GC_IMMUTABLE)); \
1177+
ZEND_ASSERT((zval_gc_flags((p)->u.type_info) & (GC_PERSISTENT|GC_PERSISTENT_LOCAL)) != GC_PERSISTENT); \
1178+
} \
1179+
} \
1180+
} while (0)
11661181
# define GC_MAKE_PERSISTENT_LOCAL(p) do { \
11671182
GC_ADD_FLAGS(p, GC_PERSISTENT_LOCAL); \
11681183
} while (0)
11691184
#else
1185+
# define ZEND_RC_MOD_CHECK(p) \
1186+
do { } while (0)
11701187
# define GC_MAKE_PERSISTENT_LOCAL(p) \
11711188
do { } while (0)
11721189
#endif

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,7 @@ PHP_ADD_SOURCES(Zend, \
17231723
zend_virtual_cwd.c zend_ast.c zend_objects.c zend_object_handlers.c zend_objects_API.c \
17241724
zend_default_classes.c zend_inheritance.c zend_smart_str.c zend_cpuinfo.c zend_gdb.c \
17251725
zend_observer.c zend_system_id.c zend_enum.c zend_fibers.c zend_atomic.c \
1726-
zend_rc_debug.c zend_max_execution_timer.c \
1726+
zend_max_execution_timer.c \
17271727
Optimizer/zend_optimizer.c \
17281728
Optimizer/pass1.c \
17291729
Optimizer/pass3.c \

main/main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
#include "zend_ini.h"
7272
#include "zend_dtrace.h"
7373
#include "zend_observer.h"
74-
#include "zend_rc_debug.h"
7574
#include "zend_system_id.h"
7675

7776
#include "php_content_types.h"

main/php.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
#include "php_version.h"
3131
#include "zend.h"
32-
#include "zend_rc_debug.h"
3332
#include "zend_sort.h"
3433
#include "php_compat.h"
3534

main/php_ini.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "ext/standard/dl.h"
2323
#include "zend_extensions.h"
2424
#include "zend_highlight.h"
25-
#include "zend_rc_debug.h"
2625
#include "SAPI.h"
2726
#include "php_main.h"
2827
#include "php_scandir.h"

sapi/fpm/fpm/fpm_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "php.h"
2828
#include "zend_ini_scanner.h"
2929
#include "zend_globals.h"
30-
#include "zend_rc_debug.h"
3130
#include "zend_stream.h"
3231

3332
#include "SAPI.h"

0 commit comments

Comments
 (0)