|
|
|
@ -1848,20 +1848,40 @@ err: |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
/* }}} */ |
|
|
|
|
static void xc_copy_zend_constant(zend_constant *c) /* {{{ */ |
|
|
|
|
{ |
|
|
|
|
c->name = zend_strndup(c->name, c->name_len - 1); |
|
|
|
|
if (!(c->flags & CONST_PERSISTENT)) { |
|
|
|
|
zval_copy_ctor(&c->value); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/* }}} */ |
|
|
|
|
static void xc_request_init(TSRMLS_D) /* {{{ */ |
|
|
|
|
{ |
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
if (!XG(internal_table_copied)) { |
|
|
|
|
#ifdef HAVE_XCACHE_CONSTANT |
|
|
|
|
zend_constant tmp_const; |
|
|
|
|
#endif |
|
|
|
|
zend_function tmp_func; |
|
|
|
|
xc_cest_t tmp_cest; |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_XCACHE_CONSTANT |
|
|
|
|
zend_hash_destroy(&XG(internal_constant_table)); |
|
|
|
|
#endif |
|
|
|
|
zend_hash_destroy(&XG(internal_function_table)); |
|
|
|
|
zend_hash_destroy(&XG(internal_class_table)); |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_XCACHE_CONSTANT |
|
|
|
|
zend_hash_init_ex(&XG(internal_constant_table), 20, NULL, NULL, 1, 0); |
|
|
|
|
#endif |
|
|
|
|
zend_hash_init_ex(&XG(internal_function_table), 100, NULL, NULL, 1, 0); |
|
|
|
|
zend_hash_init_ex(&XG(internal_class_table), 10, NULL, NULL, 1, 0); |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_XCACHE_CONSTANT |
|
|
|
|
zend_hash_copy(&XG(internal_constant_table), EG(zend_constants), (copy_ctor_func_t) xc_copy_zend_constant, &tmp_const, sizeof(tmp_const)); |
|
|
|
|
#endif |
|
|
|
|
zend_hash_copy(&XG(internal_function_table), CG(function_table), NULL, &tmp_func, sizeof(tmp_func)); |
|
|
|
|
zend_hash_copy(&XG(internal_class_table), CG(class_table), NULL, &tmp_cest, sizeof(tmp_cest)); |
|
|
|
|
|
|
|
|
@ -1920,6 +1940,9 @@ void xc_init_globals(zend_xcache_globals* xcache_globals TSRMLS_DC) |
|
|
|
|
{ |
|
|
|
|
memset(xcache_globals, 0, sizeof(zend_xcache_globals)); |
|
|
|
|
|
|
|
|
|
#ifdef HAVE_XCACHE_CONSTANT |
|
|
|
|
zend_hash_init_ex(&xcache_globals->internal_constant_table, 1, NULL, NULL, 1, 0); |
|
|
|
|
#endif |
|
|
|
|
zend_hash_init_ex(&xcache_globals->internal_function_table, 1, NULL, NULL, 1, 0); |
|
|
|
|
zend_hash_init_ex(&xcache_globals->internal_class_table, 1, NULL, NULL, 1, 0); |
|
|
|
|
} |
|
|
|
@ -1951,6 +1974,9 @@ void xc_shutdown_globals(zend_xcache_globals* xcache_globals TSRMLS_DC) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (xcache_globals->internal_table_copied) { |
|
|
|
|
#ifdef HAVE_XCACHE_CONSTANT |
|
|
|
|
zend_hash_destroy(&xcache_globals->internal_constant_table); |
|
|
|
|
#endif |
|
|
|
|
zend_hash_destroy(&xcache_globals->internal_function_table); |
|
|
|
|
zend_hash_destroy(&xcache_globals->internal_class_table); |
|
|
|
|
} |
|
|
|
|