1
0
Fork 0

PHP_5_3 support: uses ZEND_COMPILE_IGNORE_INTERNAL_CLASSES and ZEND_COMPILE_DELAYED_BINDING stuffs for PHP_5_3 support finally

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@548 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 15 years ago
parent 3a8c3df32f
commit bedd56400a

@ -245,7 +245,11 @@ void xc_coverager_request_init(TSRMLS_D) /* {{{ */
{
if (XG(coverager)) {
xc_coverager_enable(TSRMLS_C);
#ifdef ZEND_COMPILE_EXTENDED_INFO
CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO;
#else
CG(extended_info) = 1;
#endif
}
else {
XG(coverage_enabled) = 0;

@ -505,7 +505,12 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
dnl readonly_protection=on
dnl main op_array && have early binding
zend_uint ii;
if (!processor->readonly_protection && !(src == processor->php_src->op_array && processor->php_src->have_early_binding)) {
#ifdef ZEND_COMPILE_DELAYED_BINDING
zend_bool need_early_binding = 0;
#else
zend_bool need_early_binding = processor->php_src->have_early_binding;
#endif
if (!processor->readonly_protection && !(src == processor->php_src->op_array && need_early_binding)) {
/* really fast shallow copy */
memcpy(dst, src, sizeof(src[0]));
dst->refcount[0] = 1000;
@ -632,6 +637,9 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
DISPATCH(int, doc_comment_len)
PROC_ZSTRING_L(, doc_comment, doc_comment_len)
#endif
#ifdef ZEND_COMPILE_DELAYED_BINDING
DISPATCH(zend_uint, early_binding);
#endif
/* reserved */
DONE(reserved)
@ -729,7 +737,9 @@ DEF_STRUCT_P_FUNC(`xc_classinfo_t', , `dnl {{{
#else
STRUCT(zend_class_entry, cest)
#endif
#ifndef ZEND_COMPILE_DELAYED_BINDING
DISPATCH(int, oplineno)
#endif
')
dnl }}}
#ifdef ZEND_ENGINE_2_1
@ -806,7 +816,9 @@ DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , `dnl {{{
STRUCT_ARRAY(compilererror_cnt, xc_compilererror_t, compilererrors)
')
#endif
#ifndef ZEND_COMPILE_DELAYED_BINDING
DISPATCH(zend_bool, have_early_binding)
#endif
DISPATCH(zend_bool, have_references)
')
dnl }}}

@ -499,9 +499,11 @@ ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, int op
cest, sizeof(xc_cest_t),
ZESW(&stored_ce_ptr, NULL)
);
#ifndef ZEND_COMPILE_DELAYED_BINDING
if (oplineno != -1) {
xc_do_early_binding(CG(active_op_array), CG(class_table), oplineno TSRMLS_CC);
}
#endif
}
else if (zend_u_hash_quick_add(CG(class_table), type, key, len, h,
cest, sizeof(xc_cest_t),
@ -672,6 +674,13 @@ xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC) /
zend_error_cb = xc_sandbox_error_cb;
#endif
#ifdef ZEND_COMPILE_IGNORE_INTERNAL_CLASSES
sandbox->orig_compiler_options = CG(compiler_options);
/* Using ZEND_COMPILE_IGNORE_INTERNAL_CLASSES for ZEND_FETCH_CLASS_RT_NS_CHECK
*/
CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES | ZEND_COMPILE_DELAYED_BINDING;
#endif
XG(sandbox) = (void *) sandbox;
return sandbox;
}
@ -727,9 +736,13 @@ static void xc_sandbox_install(xc_sandbox_t *sandbox, xc_install_action_t instal
#endif
if (install != XC_InstallNoBinding) {
#ifdef ZEND_COMPILE_DELAYED_BINDING
zend_do_delayed_early_binding(CG(active_op_array) TSRMLS_CC);
#else
xc_undo_pass_two(CG(active_op_array) TSRMLS_CC);
xc_foreach_early_binding_class(CG(active_op_array), xc_early_binding_cb, (void *) sandbox TSRMLS_CC);
xc_redo_pass_two(CG(active_op_array) TSRMLS_CC);
#endif
}
#ifdef E_STRICT
@ -804,6 +817,11 @@ void xc_sandbox_free(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_D
efree(sandbox->compilererrors);
}
#endif
#ifdef ZEND_COMPILE_IGNORE_INTERNAL_CLASSES
CG(compiler_options) = sandbox->orig_compiler_options;
#endif
if (sandbox->alloc) {
efree(sandbox);
}

@ -104,6 +104,10 @@ typedef struct {
zend_uint compilererror_size;
xc_compilererror_t *compilererrors;
#endif
#ifdef ZEND_COMPILE_IGNORE_INTERNAL_CLASSES
zend_uint orig_compiler_options;
#endif
} xc_sandbox_t;
typedef enum _xc_install_action_t {

@ -719,8 +719,13 @@ static zend_op_array *xc_entry_install(xc_entry_t *xce, zend_file_handle *h TSRM
}
new_cest_ptrs[i] =
#endif
#ifdef ZEND_COMPILE_DELAYED_BINDING
xc_install_class(xce->name.str.val, &ci->cest, -1,
UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC);
#else
xc_install_class(xce->name.str.val, &ci->cest, ci->oplineno,
UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC);
#endif
}
#ifdef ZEND_ENGINE_2_1
@ -1042,6 +1047,7 @@ static int xc_entry_init_key_php_md5(xc_entry_data_php_t *php, xc_entry_t *xce T
return SUCCESS;
}
/* }}} */
#ifndef ZEND_COMPILE_DELAYED_BINDING
static void xc_cache_early_binding_class_cb(zend_op *opline, int oplineno, void *data TSRMLS_DC) /* {{{ */
{
char *class_name;
@ -1069,6 +1075,7 @@ static void xc_cache_early_binding_class_cb(zend_op *opline, int oplineno, void
}
}
/* }}} */
#endif
static void xc_free_php(xc_entry_data_php_t *php TSRMLS_DC) /* {{{ */
{
#define X_FREE(var) do {\
@ -1237,6 +1244,7 @@ static zend_op_array *xc_compile_php(xc_entry_data_php_t *php, zend_file_handle
php->compilererrors = ((xc_sandbox_t *) XG(sandbox))->compilererrors;
php->compilererror_cnt = ((xc_sandbox_t *) XG(sandbox))->compilererror_cnt;
#endif
#ifndef ZEND_COMPILE_DELAYED_BINDING
/* {{{ find inherited classes that should be early-binding */
php->have_early_binding = 0;
for (i = 0; i < php->classinfo_cnt; i ++) {
@ -1247,6 +1255,7 @@ static zend_op_array *xc_compile_php(xc_entry_data_php_t *php, zend_file_handle
xc_foreach_early_binding_class(php->op_array, xc_cache_early_binding_class_cb, (void *) php TSRMLS_CC);
xc_redo_pass_two(php->op_array TSRMLS_CC);
/* }}} */
#endif
return op_array;

@ -242,7 +242,9 @@ typedef struct {
zend_uint key_size;
ulong h;
xc_cest_t cest;
#ifndef ZEND_COMPILE_DELAYED_BINDING
int oplineno;
#endif
} xc_classinfo_t;
/* }}} */
#ifdef HAVE_XCACHE_CONSTANT
@ -315,7 +317,9 @@ struct _xc_entry_data_php_t {
zend_uint classinfo_cnt;
xc_classinfo_t *classinfos;
#ifndef ZEND_COMPILE_DELAYED_BINDING
zend_bool have_early_binding;
#endif
#ifdef ZEND_ENGINE_2_1
zend_uint autoglobal_cnt;

Loading…
Cancel
Save