diff --git a/mod_coverager/xc_coverager.c b/mod_coverager/xc_coverager.c index fdad339..edd912d 100644 --- a/mod_coverager/xc_coverager.c +++ b/mod_coverager/xc_coverager.c @@ -22,6 +22,7 @@ #include "xcache_globals.h" #include "ext/standard/info.h" +#include "zend_compile.h" typedef HashTable *coverager_t; #define PCOV_HEADER_MAGIC 0x564f4350 diff --git a/mod_disassembler/xc_disassembler.c b/mod_disassembler/xc_disassembler.c index a618c8f..5fc0f92 100644 --- a/mod_disassembler/xc_disassembler.c +++ b/mod_disassembler/xc_disassembler.c @@ -1,5 +1,6 @@ #include "xc_disassembler.h" #include "xcache.h" +#include "xcache/xc_ini.h" #include "xcache/xc_utils.h" #include "xcache/xc_sandbox.h" #include "xcache/xc_compatibility.h" diff --git a/processor/processor.m4 b/processor/processor.m4 index ffe2ab4..45ab2b3 100644 --- a/processor/processor.m4 +++ b/processor/processor.m4 @@ -653,9 +653,11 @@ DEF_STRUCT_P_FUNC(`zend_op', , `dnl {{{ case ZEND_GOTO: #endif case ZEND_JMP: +#ifdef ZEND_ENGINE_2 assert(Z_OP(src->op1).jmp_addr >= processor->active_op_array_src->opcodes && Z_OP(src->op1).jmp_addr - processor->active_op_array_src->opcodes < processor->active_op_array_src->last); Z_OP(dst->op1).jmp_addr = processor->active_op_array_dst->opcodes + (Z_OP(src->op1).jmp_addr - processor->active_op_array_src->opcodes); assert(Z_OP(dst->op1).jmp_addr >= processor->active_op_array_dst->opcodes && Z_OP(dst->op1).jmp_addr - processor->active_op_array_dst->opcodes < processor->active_op_array_dst->last); +#endif break; case ZEND_JMPZ: @@ -668,9 +670,11 @@ DEF_STRUCT_P_FUNC(`zend_op', , `dnl {{{ #ifdef ZEND_JMP_SET_VAR case ZEND_JMP_SET_VAR: #endif +#ifdef ZEND_ENGINE_2 assert(Z_OP(src->op2).jmp_addr >= processor->active_op_array_src->opcodes && Z_OP(src->op2).jmp_addr - processor->active_op_array_src->opcodes < processor->active_op_array_src->last); Z_OP(dst->op2).jmp_addr = processor->active_op_array_dst->opcodes + (Z_OP(src->op2).jmp_addr - processor->active_op_array_src->opcodes); assert(Z_OP(dst->op2).jmp_addr >= processor->active_op_array_dst->opcodes && Z_OP(dst->op2).jmp_addr - processor->active_op_array_dst->opcodes < processor->active_op_array_dst->last); +#endif break; default: @@ -752,7 +756,9 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{ case ZEND_GOTO: #endif case ZEND_JMP: +#ifdef ZEND_ENGINE_2 Z_OP(opline->op1).jmp_addr = &dst->opcodes[Z_OP(opline->op1).jmp_addr - src->opcodes]; +#endif break; case ZEND_JMPZ: @@ -765,7 +771,9 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{ #ifdef ZEND_JMP_SET_VAR case ZEND_JMP_SET_VAR: #endif +#ifdef ZEND_ENGINE_2 Z_OP(opline->op2).jmp_addr = &dst->opcodes[Z_OP(opline->op2).jmp_addr - src->opcodes]; +#endif break; default: diff --git a/xcache.c b/xcache.c index c34172f..2f6a97f 100644 --- a/xcache.c +++ b/xcache.c @@ -3131,9 +3131,13 @@ PHP_FUNCTION(xcache_get_refcount) /* }}} */ /* {{{ proto bool xcache_get_isref(mixed variable) XCache internal uses only: Check if variable data is marked referenced */ +#ifdef ZEND_BEGIN_ARG_INFO_EX ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_isref, 0, 0, 1) ZEND_ARG_INFO(1, variable) ZEND_END_ARG_INFO() +#else +static unsigned char arginfo_xcache_get_isref[] = { 1, BYREF_FORCE }; +#endif PHP_FUNCTION(xcache_get_isref) { @@ -3656,7 +3660,7 @@ static PHP_MINFO_FUNCTION(xcache) /* {{{ */ if (xc_php_size) { ptr = _php_math_number_format(xc_php_size, 0, '.', ','); - snprintf(buf, sizeof(buf), "enabled, %s bytes, %d split(s), with %d slots each", ptr, xc_php_hcache.size, xc_php_hentry.size); + snprintf(buf, sizeof(buf), "enabled, %s bytes, %lu split(s), with %lu slots each", ptr, xc_php_hcache.size, xc_php_hentry.size); php_info_print_table_row(2, "Opcode Cache", buf); efree(ptr); } @@ -3665,7 +3669,7 @@ static PHP_MINFO_FUNCTION(xcache) /* {{{ */ } if (xc_var_size) { ptr = _php_math_number_format(xc_var_size, 0, '.', ','); - snprintf(buf, sizeof(buf), "enabled, %s bytes, %d split(s), with %d slots each", ptr, xc_var_hcache.size, xc_var_hentry.size); + snprintf(buf, sizeof(buf), "enabled, %s bytes, %lu split(s), with %lu slots each", ptr, xc_var_hcache.size, xc_var_hentry.size); php_info_print_table_row(2, "Variable Cache", buf); efree(ptr); } diff --git a/xcache.h b/xcache.h index c1711cf..30edb57 100644 --- a/xcache.h +++ b/xcache.h @@ -10,11 +10,6 @@ #define XCACHE_WIKI_URL XCACHE_URL "/wiki" #include -#include -#include -#include -#include "php_ini.h" -#include "zend_hash.h" #ifdef HAVE_CONFIG_H #include diff --git a/xcache/xc_compatibility.h b/xcache/xc_compatibility.h index 513530a..5b617d6 100644 --- a/xcache/xc_compatibility.h +++ b/xcache/xc_compatibility.h @@ -232,7 +232,11 @@ long xc_atol(const char *str, int len); #endif #ifndef PHP_FE_END -# define PHP_FE_END {NULL, NULL, NULL} +# ifdef ZEND_ENGINE_2 +# define PHP_FE_END {NULL, NULL, NULL, 0, 0} +# else +# define PHP_FE_END {NULL, NULL, NULL} +# endif #endif #endif /* XC_COMPATIBILITY_H_54F26ED90198353558718191D5EE244C */ diff --git a/xcache/xc_lock.c b/xcache/xc_lock.c index 7c19f5b..93b739f 100644 --- a/xcache/xc_lock.c +++ b/xcache/xc_lock.c @@ -1,8 +1,9 @@ +#include "xc_lock.h" +#include "xcache.h" #include #include #include -#include #ifndef ZEND_WIN32 typedef int HANDLE; # ifndef INVALID_HANDLE_VALUE diff --git a/xcache/xc_lock.h b/xcache/xc_lock.h index f656de8..d858c37 100644 --- a/xcache/xc_lock.h +++ b/xcache/xc_lock.h @@ -1,3 +1,10 @@ +#ifndef XC_LOCK_H_1913F3DED68715D7CDA5A055E79FE0FF +#define XC_LOCK_H_1913F3DED68715D7CDA5A055E79FE0FF + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + typedef struct _xc_lock_t xc_lock_t; xc_lock_t *xc_fcntl_init(const char *pathname); @@ -9,3 +16,5 @@ void xc_fcntl_unlock(xc_lock_t *lck); #define xc_lock_destroy(fd) xc_fcntl_destroy(fd) #define xc_lock(fd) xc_fcntl_lock(fd) #define xc_unlock(fd) xc_fcntl_unlock(fd) + +#endif /* XC_LOCK_H_1913F3DED68715D7CDA5A055E79FE0FF */