mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Make gc_collect_cycles hookable.
This commit is contained in:
parent
e427188755
commit
eb6dc9db29
4 changed files with 18 additions and 2 deletions
|
@ -15,6 +15,7 @@ PHP 7.0 INTERNALS UPGRADE NOTES
|
|||
n. ZEND_ENGINE_2 removal
|
||||
o. Updated final class modifier
|
||||
p. TSRM changes
|
||||
q. gc_collect_cycles() is now hookable
|
||||
|
||||
2. Build system changes
|
||||
a. Unix build system changes
|
||||
|
@ -169,6 +170,12 @@ PHP 7.0 INTERNALS UPGRADE NOTES
|
|||
Additionally, if an extension triggers its own threads, TSRMLS_CACHE shouldn't
|
||||
be passed to that threads directly.
|
||||
|
||||
q. gc_collect_cycles() is now a function pointer, and can be replaced in the
|
||||
same manner as zend_execute_ex() if needed (for example, to include the
|
||||
time spent in the garbage collector in a profiler). The default
|
||||
implementation has been renamed to zend_gc_collect_cycles(), and is
|
||||
exported with ZEND_API.
|
||||
|
||||
|
||||
========================
|
||||
2. Build system changes
|
||||
|
|
|
@ -616,6 +616,9 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) /
|
|||
zend_compile_string = compile_string;
|
||||
zend_throw_exception_hook = NULL;
|
||||
|
||||
/* Set up the default garbage collection implementation. */
|
||||
gc_collect_cycles = zend_gc_collect_cycles;
|
||||
|
||||
zend_init_opcodes_handlers();
|
||||
|
||||
/* set up version */
|
||||
|
|
|
@ -31,6 +31,8 @@ ZEND_API int gc_globals_id;
|
|||
ZEND_API zend_gc_globals gc_globals;
|
||||
#endif
|
||||
|
||||
ZEND_API int (*gc_collect_cycles)(TSRMLS_D);
|
||||
|
||||
#define GC_REMOVE_FROM_ROOTS(current) \
|
||||
gc_remove_from_roots((current))
|
||||
|
||||
|
@ -701,7 +703,7 @@ tail_call:
|
|||
}
|
||||
}
|
||||
|
||||
ZEND_API int gc_collect_cycles(void)
|
||||
ZEND_API int zend_gc_collect_cycles(void)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
|
|
|
@ -119,13 +119,17 @@ extern ZEND_API zend_gc_globals gc_globals;
|
|||
#endif
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API int gc_collect_cycles(void);
|
||||
ZEND_API extern int (*gc_collect_cycles)(void);
|
||||
|
||||
ZEND_API void gc_possible_root(zend_refcounted *ref);
|
||||
ZEND_API void gc_remove_from_buffer(zend_refcounted *ref);
|
||||
ZEND_API void gc_globals_ctor(void);
|
||||
ZEND_API void gc_globals_dtor(void);
|
||||
ZEND_API void gc_init(void);
|
||||
ZEND_API void gc_reset(void);
|
||||
|
||||
/* The default implementation of the gc_collect_cycles callback. */
|
||||
ZEND_API int zend_gc_collect_cycles(void);
|
||||
END_EXTERN_C()
|
||||
|
||||
#define GC_ZVAL_CHECK_POSSIBLE_ROOT(z) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue