diff --git a/Zend/zend.c b/Zend/zend.c index 7f5257c570c..141d9bb4ad4 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -95,6 +95,10 @@ void (*zend_on_timeout)(int seconds); static void (*zend_message_dispatcher_p)(zend_long message, const void *data); static zval *(*zend_get_configuration_directive_p)(zend_string *name); +#if ZEND_RC_DEBUG +ZEND_API bool zend_rc_debug = 0; +#endif + static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */ { if (!new_value) { diff --git a/Zend/zend_API.c b/Zend/zend_API.c index c199190888f..1beb76dff4d 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -32,7 +32,6 @@ #include "zend_ini.h" #include "zend_enum.h" #include "zend_observer.h" -#include "zend_rc_debug.h" #include diff --git a/Zend/zend_rc_debug.c b/Zend/zend_rc_debug.c deleted file mode 100644 index 190fcde74c2..00000000000 --- a/Zend/zend_rc_debug.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.00 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ -*/ - -#include "zend_rc_debug.h" - -#if ZEND_RC_DEBUG -ZEND_API bool zend_rc_debug = false; -#endif diff --git a/Zend/zend_rc_debug.h b/Zend/zend_rc_debug.h deleted file mode 100644 index df033d36fa8..00000000000 --- a/Zend/zend_rc_debug.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.00 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.zend.com/license/2_00.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ -*/ - -#ifndef ZEND_RC_DEBUG_H -#define ZEND_RC_DEBUG_H - -#ifndef ZEND_RC_DEBUG -# define ZEND_RC_DEBUG 0 -#endif - -#if ZEND_RC_DEBUG - -#ifdef PHP_WIN32 -# include "zend_config.w32.h" -#else -# include "zend_config.h" -#endif - -#include -#include - -extern ZEND_API bool zend_rc_debug; - -/* The GC_PERSISTENT flag is reused for IS_OBJ_WEAKLY_REFERENCED on objects. - * Skip checks for OBJECT/NULL type to avoid interpreting the flag incorrectly. */ -# define ZEND_RC_MOD_CHECK(p) do { \ - if (zend_rc_debug) { \ - uint8_t type = zval_gc_type((p)->u.type_info); \ - if (type != IS_OBJECT && type != IS_NULL) { \ - ZEND_ASSERT(!(zval_gc_flags((p)->u.type_info) & GC_IMMUTABLE)); \ - ZEND_ASSERT((zval_gc_flags((p)->u.type_info) & (GC_PERSISTENT|GC_PERSISTENT_LOCAL)) != GC_PERSISTENT); \ - } \ - } \ - } while (0) -#else -# define ZEND_RC_MOD_CHECK(p) \ - do { } while (0) -#endif - -#endif /* ZEND_RC_DEBUG_H */ diff --git a/Zend/zend_string.c b/Zend/zend_string.c index ddb8ff1bb84..d65101e778c 100644 --- a/Zend/zend_string.c +++ b/Zend/zend_string.c @@ -18,7 +18,6 @@ #include "zend.h" #include "zend_globals.h" -#include "zend_rc_debug.h" #ifdef HAVE_VALGRIND # include "valgrind/callgrind.h" diff --git a/Zend/zend_types.h b/Zend/zend_types.h index b9ac3b04cf1..c7437122de2 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -24,7 +24,6 @@ #include "zend_portability.h" #include "zend_long.h" -#include "zend_rc_debug.h" #include "zend_result.h" #include @@ -1162,11 +1161,29 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) { #define Z_TRY_ADDREF(z) Z_TRY_ADDREF_P(&(z)) #define Z_TRY_DELREF(z) Z_TRY_DELREF_P(&(z)) +#ifndef ZEND_RC_DEBUG +# define ZEND_RC_DEBUG 0 +#endif + #if ZEND_RC_DEBUG +extern ZEND_API bool zend_rc_debug; +/* The GC_PERSISTENT flag is reused for IS_OBJ_WEAKLY_REFERENCED on objects. + * Skip checks for OBJECT/NULL type to avoid interpreting the flag incorrectly. */ +# define ZEND_RC_MOD_CHECK(p) do { \ + if (zend_rc_debug) { \ + uint8_t type = zval_gc_type((p)->u.type_info); \ + if (type != IS_OBJECT && type != IS_NULL) { \ + ZEND_ASSERT(!(zval_gc_flags((p)->u.type_info) & GC_IMMUTABLE)); \ + ZEND_ASSERT((zval_gc_flags((p)->u.type_info) & (GC_PERSISTENT|GC_PERSISTENT_LOCAL)) != GC_PERSISTENT); \ + } \ + } \ + } while (0) # define GC_MAKE_PERSISTENT_LOCAL(p) do { \ GC_ADD_FLAGS(p, GC_PERSISTENT_LOCAL); \ } while (0) #else +# define ZEND_RC_MOD_CHECK(p) \ + do { } while (0) # define GC_MAKE_PERSISTENT_LOCAL(p) \ do { } while (0) #endif diff --git a/configure.ac b/configure.ac index 4793ffdf520..fcb62972381 100644 --- a/configure.ac +++ b/configure.ac @@ -1723,7 +1723,7 @@ PHP_ADD_SOURCES(Zend, \ zend_virtual_cwd.c zend_ast.c zend_objects.c zend_object_handlers.c zend_objects_API.c \ zend_default_classes.c zend_inheritance.c zend_smart_str.c zend_cpuinfo.c zend_gdb.c \ zend_observer.c zend_system_id.c zend_enum.c zend_fibers.c zend_atomic.c \ - zend_rc_debug.c zend_max_execution_timer.c \ + zend_max_execution_timer.c \ Optimizer/zend_optimizer.c \ Optimizer/pass1.c \ Optimizer/pass3.c \ diff --git a/main/main.c b/main/main.c index 022f26bd5f4..95d1ad6050b 100644 --- a/main/main.c +++ b/main/main.c @@ -71,7 +71,6 @@ #include "zend_ini.h" #include "zend_dtrace.h" #include "zend_observer.h" -#include "zend_rc_debug.h" #include "zend_system_id.h" #include "php_content_types.h" diff --git a/main/php.h b/main/php.h index c3d139059c4..3385fb79992 100644 --- a/main/php.h +++ b/main/php.h @@ -29,7 +29,6 @@ #include "php_version.h" #include "zend.h" -#include "zend_rc_debug.h" #include "zend_sort.h" #include "php_compat.h" diff --git a/main/php_ini.c b/main/php_ini.c index 68304f42c5d..82420fd0bc6 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -22,7 +22,6 @@ #include "ext/standard/dl.h" #include "zend_extensions.h" #include "zend_highlight.h" -#include "zend_rc_debug.h" #include "SAPI.h" #include "php_main.h" #include "php_scandir.h" diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index 783cb200c1e..7ef0372c08e 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -27,7 +27,6 @@ #include "php.h" #include "zend_ini_scanner.h" #include "zend_globals.h" -#include "zend_rc_debug.h" #include "zend_stream.h" #include "SAPI.h"