mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Zend/zend_types.h: move zend_rc_debug
to zend_rc_debug.h
`zend_rc_debug` is not a type and does not really belong in `zend_types.h`; this allows using `ZEND_RC_MOD_CHECK()` without including the huge `zend_types.h` header and allows decoupling circular header dependencies.
This commit is contained in:
parent
9108a32bfe
commit
d6e95041e2
@ -94,10 +94,6 @@ 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) {
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "zend_ini.h"
|
||||
#include "zend_enum.h"
|
||||
#include "zend_observer.h"
|
||||
#include "zend_rc_debug.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
|
21
Zend/zend_rc_debug.c
Normal file
21
Zend/zend_rc_debug.c
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| 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
|
53
Zend/zend_rc_debug.h
Normal file
53
Zend/zend_rc_debug.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| 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 <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
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 */
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_globals.h"
|
||||
#include "zend_rc_debug.h"
|
||||
|
||||
#ifdef HAVE_VALGRIND
|
||||
# include "valgrind/callgrind.h"
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "zend_portability.h"
|
||||
#include "zend_long.h"
|
||||
#include "zend_rc_debug.h"
|
||||
#include "zend_result.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
@ -1161,29 +1162,11 @@ 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
|
||||
|
@ -1722,6 +1722,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 \
|
||||
Optimizer/zend_optimizer.c \
|
||||
Optimizer/pass1.c \
|
||||
Optimizer/pass3.c \
|
||||
|
@ -71,6 +71,7 @@
|
||||
#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"
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include "php_version.h"
|
||||
#include "zend.h"
|
||||
#include "zend_rc_debug.h"
|
||||
#include "zend_sort.h"
|
||||
#include "php_compat.h"
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#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"
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "php.h"
|
||||
#include "zend_ini_scanner.h"
|
||||
#include "zend_globals.h"
|
||||
#include "zend_rc_debug.h"
|
||||
#include "zend_stream.h"
|
||||
|
||||
#include "SAPI.h"
|
||||
|
Loading…
Reference in New Issue
Block a user