Browse Source

opcodes data is copied but not the op_array. use op_array_handler instead

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@477 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 14 years ago
parent
commit
04ce5c5466
  1. 33
      optimizer.c
  2. 2
      optimizer.h
  3. 14
      xcache.c

33
optimizer.c

@ -6,6 +6,7 @@
#include "optimizer.h"
/* the "vector" stack */
#include "stack.h"
#include "xcache_globals.h"
#ifdef DEBUG
# include "processor.h"
@ -18,7 +19,6 @@
#else
# define XCACHE_IS_CV 16
#endif
#define optimized_flag done_pass_two
typedef int bbid_t;
enum {
@ -515,12 +515,6 @@ static int xc_optimize_op_array(zend_op_array *op_array TSRMLS_DC) /* {{{ */
return 0;
}
/* don't optimize twice */
if (op_array->optimized_flag) {
return 0;
}
op_array->optimized_flag = 1;
#ifdef DEBUG
# if 0
TRACE("optimize file: %s", op_array->filename);
@ -556,28 +550,11 @@ static int xc_optimize_op_array(zend_op_array *op_array TSRMLS_DC) /* {{{ */
return 0;
}
/* }}} */
static int xc_clear_flag_optimized(zend_op_array *op_array TSRMLS_DC) /* {{{ */
void xc_optimizer_op_array_handler(zend_op_array *op_array) /* {{{ */
{
op_array->done_pass_two = 0;
return 0;
}
/* }}} */
void xc_optimize(zend_op_array *op_array TSRMLS_DC) /* {{{ */
{
xc_compile_result_t cr;
if (!op_array) {
return;
TSRMLS_FETCH();
if (XG(optimizer)) {
xc_optimize_op_array(op_array TSRMLS_CC);
}
xc_compile_result_init_cur(&cr, op_array TSRMLS_CC);
xc_apply_op_array(&cr, (apply_func_t) xc_undo_pass_two TSRMLS_CC);
/* op_array->done_pass_two is now used as if it's op_array->flag_optimized */
xc_apply_op_array(&cr, (apply_func_t) xc_optimize_op_array TSRMLS_CC);
xc_apply_op_array(&cr, (apply_func_t) xc_clear_flag_optimized TSRMLS_CC);
xc_apply_op_array(&cr, (apply_func_t) xc_redo_pass_two TSRMLS_CC);
xc_compile_result_free(&cr);
}
/* }}} */

2
optimizer.h

@ -1,4 +1,4 @@
#include "php.h"
#include "xcache.h"
void xc_optimize(zend_op_array *op_array TSRMLS_DC);
void xc_optimizer_op_array_handler(zend_op_array *op_array);

14
xcache.c

@ -999,11 +999,6 @@ static zend_op_array *xc_compile_php(xc_entry_data_php_t *php, zend_file_handle
return op_array;
}
#ifdef HAVE_XCACHE_OPTIMIZER
if (XG(optimizer)) {
xc_optimize(op_array TSRMLS_CC);
}
#endif
/* }}} */
/* {{{ prepare */
php->op_array = op_array;
@ -1199,11 +1194,6 @@ static zend_op_array *xc_compile_file(zend_file_handle *h, int type TSRMLS_DC) /
TRACE("type = %d\n", h->type);
if (!XG(cacher)) {
op_array = old_compile_file(h, type TSRMLS_CC);
#ifdef HAVE_XCACHE_OPTIMIZER
if (XG(optimizer)) {
xc_optimize(op_array TSRMLS_CC);
}
#endif
return op_array;
}
@ -3050,7 +3040,11 @@ ZEND_DLEXPORT zend_extension zend_extension_entry = {
NULL, /* activate_func_t */
NULL, /* deactivate_func_t */
NULL, /* message_handler_func_t */
#ifdef HAVE_XCACHE_OPTIMIZER
xc_optimizer_op_array_handler,
#else
NULL, /* op_array_handler_func_t */
#endif
xcache_statement_handler,
xcache_fcall_begin_handler,
xcache_fcall_end_handler,

Loading…
Cancel
Save