Browse Source

PHP_6: prepared in literal way for __FILE__ __DIR__ fix up

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@721 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 10 years ago
parent
commit
e2a871ec76
  1. 1
      processor/hashtable.m4
  2. 38
      processor/processor.m4
  3. 33
      xcache.c
  4. 5
      xcache.h

1
processor/hashtable.m4

@ -64,7 +64,6 @@ define(`DEF_HASH_TABLE_FUNC', `
')
efree(buf);
return; /* no check size */
', `
dnl }}}
Bucket *b, *pnew = NULL, *prev = NULL;

38
processor/processor.m4

@ -84,7 +84,6 @@ DEF_STRUCT_P_FUNC(`zval', , `dnl {{{
DONE(refcount)
#endif
} while(0);
return;
', `
dnl IFDASM else
/* Variable information */
@ -322,6 +321,10 @@ DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{
DISPATCH(zend_uint, ce_flags)
#endif
#ifdef ZEND_ENGINE_2
STRUCT(HashTable, properties_info, HashTable_zend_property_info)
#endif
#ifdef ZEND_ENGINE_2_4
DISPATCH(int, default_properties_count)
STRUCT_ARRAY(default_properties_count, zval, default_properties_table)
@ -333,15 +336,12 @@ DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{
IFCOPY(`dst->builtin_functions = src->builtin_functions;')
DONE(builtin_functions)
STRUCT(HashTable, default_properties, HashTable_zval_ptr)
# ifdef ZEND_ENGINE_2
STRUCT(HashTable, properties_info, HashTable_zend_property_info)
# ifdef ZEND_ENGINE_2_1
# ifdef ZEND_ENGINE_2_1
STRUCT(HashTable, default_static_members, HashTable_zval_ptr)
IFCOPY(`dst->static_members = &dst->default_static_members;')
DONE(static_members)
# else
# elif defined(ZEND_ENGINE_2)
STRUCT_P(HashTable, static_members, HashTable_zval_ptr)
# endif
# endif
#endif /* ZEND_ENGINE_2_4 */
@ -485,14 +485,21 @@ dnl }}}
#ifdef ZEND_ENGINE_2_4
undefine(`UNION_znode_op')
define(`UNION_znode_op', `dnl {{{
assert(src->$1_type == IS_CONST ||
src->$1_type == IS_VAR ||
src->$1_type == IS_CV ||
src->$1_type == IS_TMP_VAR ||
src->$1_type == IS_UNUSED);
switch ((src->$1_type & ~EXT_TYPE_UNUSED)) {
case IS_CONST:
case IS_VAR:
case IS_CV:
case IS_TMP_VAR:
case IS_UNUSED:
break;
default:
assert(0);
}
dnl dirty dispatch
DISABLECHECK(`
switch (src->$1_type) {
switch ((src->$1_type & ~EXT_TYPE_UNUSED)) {
case IS_CONST:
dnl TODO: fix me, use literals
IFDASM(`{
@ -658,10 +665,12 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
gc_arg_info = 1;
#endif
IFRESTORE(`dst->filename = processor->entry_src->filepath;')
#ifndef ZEND_ENGINE_2_4
if (op_array_info->oplineinfo_cnt) {
gc_opcodes = 1;
COPY_N_EX(last, zend_op, opcodes)
}
#endif
if (gc_arg_info || gc_opcodes) {
xc_gc_op_array_t gc_op_array;
#ifdef ZEND_ENGINE_2
@ -888,8 +897,13 @@ DEF_STRUCT_P_FUNC(`xc_constinfo_t', , `dnl {{{
dnl }}}
#endif
DEF_STRUCT_P_FUNC(`xc_op_array_info_t', , `dnl {{{
#ifdef ZEND_ENGINE_2_4
DISPATCH(zend_uint, literalinfo_cnt)
DISPATCH_ARRAY(literalinfo_cnt, int, literalinfos)
#else
DISPATCH(zend_uint, oplineinfo_cnt)
DISPATCH_ARRAY(oplineinfo_cnt, int, oplineinfos)
#endif
')
dnl }}}
DEF_STRUCT_P_FUNC(`xc_funcinfo_t', , `dnl {{{

33
xcache.c

@ -1176,10 +1176,13 @@ static void xc_cache_early_binding_class_cb(zend_op *opline, int oplineno, void
#endif
/* {{{ Constant Usage */
#define xcache_op1_is_file 1
#define xcache_op1_is_dir 2
#define xcache_op2_is_file 4
#define xcache_op2_is_dir 8
#ifdef ZEND_ENGINE_2_4
#else
# define xcache_op1_is_file 1
# define xcache_op1_is_dir 2
# define xcache_op2_is_file 4
# define xcache_op2_is_dir 8
#endif
typedef struct {
zend_bool filepath_used;
zend_bool dirpath_used;
@ -1189,11 +1192,17 @@ typedef struct {
/* }}} */
static void xc_collect_op_array_info(xc_entry_t *xce, xc_entry_data_php_t *php, xc_const_usage_t *usage, xc_op_array_info_t *op_array_info, zend_op_array *op_array TSRMLS_DC) /* {{{ */
{
#ifdef ZEND_ENGINE_2_4
int oplineno;
#else
int oplineno;
#endif
xc_vector_t vector_int;
xc_vector_init(int, &vector_int);
#ifdef ZEND_ENGINE_2_4
#else
#define XCACHE_CHECK_OP(type, op) \
if (zend_binary_strcmp(Z_STRVAL(Z_OP_CONSTANT(opline->op)), Z_STRLEN(Z_OP_CONSTANT(opline->op)), xce->type##path, xce->type##path_len) == 0) { \
usage->type##path_used = 1; \
@ -1243,16 +1252,19 @@ static void xc_collect_op_array_info(xc_entry_t *xce, xc_entry_data_php_t *php,
op_array_info->oplineinfo_cnt = vector_int.cnt;
op_array_info->oplineinfos = xc_vector_detach(int, &vector_int);
#endif
xc_vector_free(int, &vector_int);
}
/* }}} */
void xc_fix_op_array_info(const xc_entry_t *xce, const xc_entry_data_php_t *php, zend_op_array *op_array, int copy, const xc_op_array_info_t *op_array_info TSRMLS_DC) /* {{{ */
{
#ifdef ZEND_ENGINE_2_4
#else
int i;
if (!op_array_info->oplineinfo_cnt) {
return;
}
#endif
#ifdef ZEND_ENGINE_2_4
#else
for (i = 0; i < op_array_info->oplineinfo_cnt; i += 2) {
int oplineno = op_array_info->oplineinfos[i];
int oplineinfo = op_array_info->oplineinfos[i + 1];
@ -1339,13 +1351,20 @@ void xc_fix_op_array_info(const xc_entry_t *xce, const xc_entry_data_php_t *php,
}
}
}
#endif
}
/* }}} */
static void xc_free_op_array_info(xc_op_array_info_t *op_array_info TSRMLS_DC) /* {{{ */
{
#ifdef ZEND_ENGINE_2_4
if (op_array_info->literalinfos) {
efree(op_array_info->literalinfos);
}
#else
if (op_array_info->oplineinfos) {
efree(op_array_info->oplineinfos);
}
#endif
}
/* }}} */
static void xc_free_php(xc_entry_data_php_t *php TSRMLS_DC) /* {{{ */

5
xcache.h

@ -258,8 +258,13 @@ typedef struct {
/* }}} */
/* {{{ xc_op_array_info_t */
typedef struct {
#ifdef ZEND_ENGINE_2_4
zend_uint literalinfo_cnt;
int *literalinfos;
#else
zend_uint oplineinfo_cnt;
int *oplineinfos;
#endif
} xc_op_array_info_t;
/* }}} */
/* {{{ xc_classinfo_t */

Loading…
Cancel
Save