Browse Source

adds reflection info for APIs

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1477 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
master
Xuefer 8 years ago
parent
commit
501bbf2e0f
  1. 2
      ChangeLog
  2. 8
      devel/exportfunctions.php
  3. 150
      mod_cacher/xc_cacher.c
  4. 39
      mod_coverager/xc_coverager.c
  5. 20
      mod_disassembler/xc_disassembler.c
  6. 234
      xcache.c

2
ChangeLog

@ -9,6 +9,8 @@ ChangeLog
* cacher:
* (WIP) defragment
* (WIP) cache to disk
* misc:
* Reflection info added for APIs
3.1.1 2013-??-??
ChangeLog

8
devel/exportfunctions.php

@ -0,0 +1,8 @@
<?php
$all_functions = get_defined_functions();
$xcache_functions = preg_grep("/^xcache_/", $all_functions['internal']);
foreach ($xcache_functions as $function) {
ReflectionFunction::export($function);
}

150
mod_cacher/xc_cacher.c

@ -3132,6 +3132,14 @@ static void xcache_admin_operate(xcache_op_type optype, INTERNAL_FUNCTION_PARAME
/* }}} */
/* {{{ proto int xcache_count(int type)
Return count of cache on specified cache type */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_count, 0, 0, 1)
ZEND_ARG_INFO(0, type)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_count[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_count)
{
xcache_admin_operate(XC_OP_COUNT, INTERNAL_FUNCTION_PARAM_PASSTHRU);
@ -3139,6 +3147,15 @@ PHP_FUNCTION(xcache_count)
/* }}} */
/* {{{ proto array xcache_info(int type, int id)
Get cache info by id on specified cache type */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_info, 0, 0, 2)
ZEND_ARG_INFO(0, type)
ZEND_ARG_INFO(0, id)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_info[] = { 2, BYREF_NONE, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_info)
{
xcache_admin_operate(XC_OP_INFO, INTERNAL_FUNCTION_PARAM_PASSTHRU);
@ -3146,6 +3163,15 @@ PHP_FUNCTION(xcache_info)
/* }}} */
/* {{{ proto array xcache_list(int type, int id)
Get cache entries list by id on specified cache type */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_list, 0, 0, 2)
ZEND_ARG_INFO(0, type)
ZEND_ARG_INFO(0, id)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_list[] = { 2, BYREF_NONE, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_list)
{
xcache_admin_operate(XC_OP_LIST, INTERNAL_FUNCTION_PARAM_PASSTHRU);
@ -3153,6 +3179,15 @@ PHP_FUNCTION(xcache_list)
/* }}} */
/* {{{ proto array xcache_clear_cache(int type, [ int id = -1 ])
Clear cache by id on specified cache type */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_clear_cache, 0, 0, 1)
ZEND_ARG_INFO(0, type)
ZEND_ARG_INFO(0, id)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_clear_cache[] = { 2, BYREF_NONE, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_clear_cache)
{
xcache_admin_operate(XC_OP_CLEAR, INTERNAL_FUNCTION_PARAM_PASSTHRU);
@ -3160,6 +3195,16 @@ PHP_FUNCTION(xcache_clear_cache)
/* }}} */
/* {{{ proto array xcache_enable_cache(int type, [ int id = -1, [ bool enable = true ] ])
Enable or disable cache by id on specified cache type */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_enable_cache, 0, 0, 1)
ZEND_ARG_INFO(0, type)
ZEND_ARG_INFO(0, id)
ZEND_ARG_INFO(0, enable)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_enable_cache[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_enable_cache)
{
xcache_admin_operate(XC_OP_ENABLE, INTERNAL_FUNCTION_PARAM_PASSTHRU);
@ -3167,6 +3212,13 @@ PHP_FUNCTION(xcache_enable_cache)
/* }}} */
/* {{{ proto mixed xcache_admin_namespace()
Break out of namespace limitation */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_admin_namespace, 0, 0, 0)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_admin_namespace[] = { 0 };
#endif
PHP_FUNCTION(xcache_admin_namespace)
{
xcache_admin_auth_check(TSRMLS_C);
@ -3198,6 +3250,14 @@ static int xc_entry_var_init_key(xc_entry_var_t *entry_var, xc_entry_hash_t *ent
/* }}} */
/* {{{ proto mixed xcache_set_namespace(string namespace)
Switch to user defined namespace */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_set_namespace, 0, 0, 1)
ZEND_ARG_INFO(0, namespace)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_set_namespace[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_set_namespace)
{
zval *namespace;
@ -3223,6 +3283,14 @@ PHP_FUNCTION(xcache_set_namespace)
/* }}} */
/* {{{ proto mixed xcache_get(string name)
Get cached data by specified name */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_get[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_get)
{
xc_entry_hash_t entry_hash;
@ -3264,6 +3332,16 @@ PHP_FUNCTION(xcache_get)
/* }}} */
/* {{{ proto bool xcache_set(string name, mixed value [, int ttl])
Store data to cache by specified name */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_set, 0, 0, 2)
ZEND_ARG_INFO(0, name)
ZEND_ARG_INFO(0, value)
ZEND_ARG_INFO(0, ttl)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_set[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_set)
{
xc_entry_hash_t entry_hash;
@ -3315,6 +3393,14 @@ PHP_FUNCTION(xcache_set)
/* }}} */
/* {{{ proto bool xcache_isset(string name)
Check if an entry exists in cache by specified name */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_isset, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_isset[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_isset)
{
xc_entry_hash_t entry_hash;
@ -3357,6 +3443,14 @@ PHP_FUNCTION(xcache_isset)
/* }}} */
/* {{{ proto bool xcache_unset(string name)
Unset existing data in cache by specified name */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_unset, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_unset[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_unset)
{
xc_entry_hash_t entry_hash;
@ -3397,6 +3491,14 @@ PHP_FUNCTION(xcache_unset)
/* }}} */
/* {{{ proto bool xcache_unset_by_prefix(string prefix)
Unset existing data in cache by specified prefix */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_unset_by_prefix, 0, 0, 1)
ZEND_ARG_INFO(0, prefix)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_unset_by_prefix[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_unset_by_prefix)
{
zval *prefix;
@ -3517,6 +3619,16 @@ static inline void xc_var_inc_dec(int inc, INTERNAL_FUNCTION_PARAMETERS) /* {{{
/* }}} */
/* {{{ proto int xcache_inc(string name [, int value [, int ttl]])
Increase an int counter in cache by specified name, create it if not exists */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_inc, 0, 0, 1)
ZEND_ARG_INFO(0, prefix)
ZEND_ARG_INFO(0, value)
ZEND_ARG_INFO(0, ttl)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_inc[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_inc)
{
xc_var_inc_dec(1, INTERNAL_FUNCTION_PARAM_PASSTHRU);
@ -3524,6 +3636,16 @@ PHP_FUNCTION(xcache_inc)
/* }}} */
/* {{{ proto int xcache_dec(string name [, int value [, int ttl]])
Decrease an int counter in cache by specified name, create it if not exists */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_dec, 0, 0, 1)
ZEND_ARG_INFO(0, prefix)
ZEND_ARG_INFO(0, value)
ZEND_ARG_INFO(0, ttl)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_dec[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_dec)
{
xc_var_inc_dec(-1, INTERNAL_FUNCTION_PARAM_PASSTHRU);
@ -3531,20 +3653,20 @@ PHP_FUNCTION(xcache_dec)
/* }}} */
static zend_function_entry xcache_cacher_functions[] = /* {{{ */
{
PHP_FE(xcache_count, NULL)
PHP_FE(xcache_info, NULL)
PHP_FE(xcache_list, NULL)
PHP_FE(xcache_clear_cache, NULL)
PHP_FE(xcache_enable_cache, NULL)
PHP_FE(xcache_admin_namespace, NULL)
PHP_FE(xcache_set_namespace, NULL)
PHP_FE(xcache_get, NULL)
PHP_FE(xcache_set, NULL)
PHP_FE(xcache_isset, NULL)
PHP_FE(xcache_unset, NULL)
PHP_FE(xcache_unset_by_prefix, NULL)
PHP_FE(xcache_inc, NULL)
PHP_FE(xcache_dec, NULL)
PHP_FE(xcache_count, arginfo_xcache_count)
PHP_FE(xcache_info, arginfo_xcache_info)
PHP_FE(xcache_list, arginfo_xcache_list)
PHP_FE(xcache_clear_cache, arginfo_xcache_clear_cache)
PHP_FE(xcache_enable_cache, arginfo_xcache_enable_cache)
PHP_FE(xcache_admin_namespace, arginfo_xcache_admin_namespace)
PHP_FE(xcache_set_namespace, arginfo_xcache_set_namespace)
PHP_FE(xcache_get, arginfo_xcache_get)
PHP_FE(xcache_set, arginfo_xcache_set)
PHP_FE(xcache_isset, arginfo_xcache_isset)
PHP_FE(xcache_unset, arginfo_xcache_unset)
PHP_FE(xcache_unset_by_prefix, arginfo_xcache_unset_by_prefix)
PHP_FE(xcache_inc, arginfo_xcache_inc)
PHP_FE(xcache_dec, arginfo_xcache_dec)
PHP_FE_END
};
/* }}} */

39
mod_coverager/xc_coverager.c

@ -484,6 +484,14 @@ static void xc_coverager_handle_ext_stmt(zend_op_array *op_array, zend_uchar op)
/* {{{ proto array xcache_coverager_decode(string data)
* decode specified data which is saved by auto dumper to array
*/
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_coverager_decode, 0, 0, 1)
ZEND_ARG_INFO(0, data)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_coverager_decode[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_coverager_decode)
{
char *str;
@ -514,6 +522,14 @@ PHP_FUNCTION(xcache_coverager_decode)
/* {{{ proto void xcache_coverager_start([bool clean = true])
* starts coverager data collecting
*/
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_coverager_start, 0, 0, 0)
ZEND_ARG_INFO(0, clean)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_coverager_start[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_coverager_start)
{
zend_bool clean = 1;
@ -537,6 +553,14 @@ PHP_FUNCTION(xcache_coverager_start)
/* {{{ proto void xcache_coverager_stop([bool clean = false])
* stop coverager data collecting
*/
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_coverager_stop, 0, 0, 0)
ZEND_ARG_INFO(0, clean)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_coverager_stop[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_coverager_stop)
{
zend_bool clean = 0;
@ -554,6 +578,13 @@ PHP_FUNCTION(xcache_coverager_stop)
/* {{{ proto array xcache_coverager_get([bool clean = false])
* get coverager data collected
*/
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_coverager_get, 0, 0, 0)
ZEND_ARG_INFO(0, clean)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_coverager_get[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_coverager_get)
{
zend_bool clean = 0;
@ -569,10 +600,10 @@ PHP_FUNCTION(xcache_coverager_get)
/* }}} */
static zend_function_entry xcache_coverager_functions[] = /* {{{ */
{
PHP_FE(xcache_coverager_decode, NULL)
PHP_FE(xcache_coverager_start, NULL)
PHP_FE(xcache_coverager_stop, NULL)
PHP_FE(xcache_coverager_get, NULL)
PHP_FE(xcache_coverager_decode, arginfo_xcache_coverager_decode)
PHP_FE(xcache_coverager_start, arginfo_xcache_coverager_start)
PHP_FE(xcache_coverager_stop, arginfo_xcache_coverager_stop)
PHP_FE(xcache_coverager_get, arginfo_xcache_coverager_get)
PHP_FE_END
};
/* }}} */

20
mod_disassembler/xc_disassembler.c

@ -194,6 +194,14 @@ void xc_dasm_file(zval *output, const char *filename TSRMLS_DC) /* {{{ */
/* {{{ proto array xcache_dasm_file(string filename)
Disassemble file into opcode array by filename */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_dasm_file, 0, 0, 1)
ZEND_ARG_INFO(0, filename)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_dasm_file[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_dasm_file)
{
char *filename;
@ -209,6 +217,14 @@ PHP_FUNCTION(xcache_dasm_file)
/* }}} */
/* {{{ proto array xcache_dasm_string(string code)
Disassemble php code into opcode array */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_dasm_string, 0, 0, 1)
ZEND_ARG_INFO(0, code)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_dasm_string[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_dasm_string)
{
zval *code;
@ -232,8 +248,8 @@ static PHP_MINFO_FUNCTION(xcache_disassembler)
/* }}} */
static zend_function_entry xcache_disassembler_functions[] = /* {{{ */
{
PHP_FE(xcache_dasm_file, NULL)
PHP_FE(xcache_dasm_string, NULL)
PHP_FE(xcache_dasm_file, arginfo_xcache_dasm_file)
PHP_FE(xcache_dasm_string, arginfo_xcache_dasm_string)
PHP_FE_END
};
/* }}} */

234
xcache.c

@ -176,70 +176,19 @@ void xc_shutdown_globals(zend_xcache_globals* xcache_globals TSRMLS_DC)
}
/* }}} */
/* {{{ proto int xcache_get_refcount(mixed &variable)
XCache internal uses only: Get reference count of referenced variable */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_refcount, 0, 0, 1)
ZEND_ARG_INFO(1, variable)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_get_refcount[] = { 1, BYREF_FORCE };
#endif
PHP_FUNCTION(xcache_get_refcount)
{
zval *variable;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &variable) == FAILURE) {
RETURN_NULL();
}
RETURN_LONG(Z_REFCOUNT(*variable) - 1);
}
/* }}} */
/* {{{ proto int xcache_get_cowcount(mixed value)
XCache internal uses only: Get reference count of copy-on-write variable or data */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_cowcount, 0, 0, 1)
ZEND_ARG_INFO(0, variable)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_get_cowcount[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_get_cowcount)
{
zval *variable;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &variable) == FAILURE) {
RETURN_NULL();
}
#ifdef HAVE_XCACHE_DPRINT
/* {{{ proto bool xcache_dprint(mixed value)
Prints internal struct of an zval (debug only) */
#include "xc_processor.h"
RETURN_LONG(Z_REFCOUNT(*variable) - 1);
}
/* }}} */
/* {{{ 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_BEGIN_ARG_INFO_EX(arginfo_xcache_dprint, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_get_isref[] = { 1, BYREF_FORCE };
static unsigned char arginfo_xcache_dprint[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_get_isref)
{
zval *variable;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &variable) == FAILURE) {
RETURN_NULL();
}
RETURN_BOOL(Z_ISREF(*variable) && Z_REFCOUNT(*variable) >= 3);
}
/* }}} */
#ifdef HAVE_XCACHE_DPRINT
/* {{{ proto bool xcache_dprint(mixed value)
Prints variable (or value) internal struct (debug only) */
#include "xc_processor.h"
PHP_FUNCTION(xcache_dprint)
{
zval *value;
@ -251,38 +200,36 @@ PHP_FUNCTION(xcache_dprint)
}
/* }}} */
#endif
#ifdef HAVE_XCACHE_ASSEMBLER
/* {{{ proto string xcache_asm(string filename)
*/
#ifdef HAVE_XCACHE_ASSEMBLER
PHP_FUNCTION(xcache_asm)
{
}
#endif
/* }}} */
#endif
#ifdef HAVE_XCACHE_ENCODER
/* {{{ proto string xcache_encode(string filename)
Encode php file into XCache opcode encoded format */
#ifdef HAVE_XCACHE_ENCODER
PHP_FUNCTION(xcache_encode)
{
}
#endif
/* }}} */
#endif
#ifdef HAVE_XCACHE_DECODER
/* {{{ proto bool xcache_decode_file(string filename)
Decode(load) opcode from XCache encoded format file */
#ifdef HAVE_XCACHE_DECODER
PHP_FUNCTION(xcache_decode_file)
{
}
#endif
/* }}} */
/* {{{ proto bool xcache_decode_string(string data)
Decode(load) opcode from XCache encoded format data */
#ifdef HAVE_XCACHE_DECODER
PHP_FUNCTION(xcache_decode_string)
{
}
#endif
/* }}} */
#endif
/* {{{ xc_call_getter */
typedef const char *(xc_name_getter_t)(zend_uchar type);
static void xc_call_getter(xc_name_getter_t getter, int count, INTERNAL_FUNCTION_PARAMETERS)
@ -308,30 +255,70 @@ static void xc_call_getter(xc_name_getter_t getter, int count, INTERNAL_FUNCTION
}
/* }}} */
/* {{{ proto string xcache_get_op_type(int op_type) */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_op_type, 0, 0, 1)
ZEND_ARG_INFO(0, op_type)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_get_op_type[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_get_op_type)
{
xc_call_getter(xc_get_op_type, xc_get_op_type_count(), INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
/* {{{ proto string xcache_get_data_type(int type) */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_data_type, 0, 0, 1)
ZEND_ARG_INFO(0, type)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_get_data_type[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_get_data_type)
{
xc_call_getter(xc_get_data_type, xc_get_data_type_count(), INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
/* {{{ proto string xcache_get_opcode(int opcode) */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_opcode, 0, 0, 1)
ZEND_ARG_INFO(0, opcode)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_get_opcode[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_get_opcode)
{
xc_call_getter(xc_get_opcode, xc_get_opcode_count(), INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
/* {{{ proto string xcache_get_op_spec(int op_type) */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_op_spec, 0, 0, 1)
ZEND_ARG_INFO(0, op_type)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_get_op_spec[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_get_op_spec)
{
xc_call_getter(xc_get_op_spec, xc_get_op_spec_count(), INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
/* {{{ proto string xcache_get_opcode_spec(int opcode) */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_opcode_spec, 0, 0, 1)
ZEND_ARG_INFO(0, opcode)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_get_opcode_spec[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_get_opcode_spec)
{
long spec;
@ -356,6 +343,14 @@ PHP_FUNCTION(xcache_get_opcode_spec)
/* }}} */
/* {{{ proto mixed xcache_get_special_value(zval value)
XCache internal use only: For decompiler to get static value with type fixed */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_special_value, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_get_special_value[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_get_special_value)
{
zval *value;
@ -391,6 +386,14 @@ PHP_FUNCTION(xcache_get_special_value)
/* }}} */
/* {{{ proto int xcache_get_type(zval value)
XCache internal use only for disassembler to get variable type in engine level */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_type, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_get_type[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_get_type)
{
zval *value;
@ -402,7 +405,14 @@ PHP_FUNCTION(xcache_get_type)
RETURN_LONG(Z_TYPE_P(value));
}
/* }}} */
/* {{{ proto string xcache_coredump(int op_type) */
/* {{{ proto string xcache_coredump() */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_coredump, 0, 0, 0)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_coredump[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_coredump)
{
if (xc_test) {
@ -416,6 +426,14 @@ PHP_FUNCTION(xcache_coredump)
}
/* }}} */
/* {{{ proto string xcache_is_autoglobal(string name) */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_is_autoglobal, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_is_autoglobal[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_is_autoglobal)
{
zval *name;
@ -433,9 +451,71 @@ PHP_FUNCTION(xcache_is_autoglobal)
RETURN_BOOL(zend_u_hash_exists(CG(auto_globals), UG(unicode), Z_STRVAL_P(name), Z_STRLEN_P(name) + 1));
}
/* }}} */
/* {{{ proto int xcache_get_refcount(mixed &variable)
XCache internal uses only: Get reference count of referenced variable */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_refcount, 0, 0, 1)
ZEND_ARG_INFO(1, variable)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_get_refcount[] = { 1, BYREF_FORCE };
#endif
PHP_FUNCTION(xcache_get_refcount)
{
zval *variable;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &variable) == FAILURE) {
RETURN_NULL();
}
RETURN_LONG(Z_REFCOUNT(*variable) - 1);
}
/* }}} */
/* {{{ proto int xcache_get_cowcount(mixed value)
XCache internal uses only: Get reference count of copy-on-write variable or data */
#ifdef ZEND_BEGIN_ARG_INFO_EX
ZEND_BEGIN_ARG_INFO_EX(arginfo_xcache_get_cowcount, 0, 0, 1)
ZEND_ARG_INFO(0, variable)
ZEND_END_ARG_INFO()
#else
static unsigned char arginfo_xcache_get_cowcount[] = { 1, BYREF_NONE };
#endif
PHP_FUNCTION(xcache_get_cowcount)
{
zval *variable;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &variable) == FAILURE) {
RETURN_NULL();
}
RETURN_LONG(Z_REFCOUNT(*variable) - 1);
}
/* }}} */
/* {{{ 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)
{
zval *variable;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &variable) == FAILURE) {
RETURN_NULL();
}
RETURN_BOOL(Z_ISREF(*variable) && Z_REFCOUNT(*variable) >= 3);
}
/* }}} */
static zend_function_entry xcache_functions[] = /* {{{ */
{
PHP_FE(xcache_coredump, NULL)
#ifdef HAVE_XCACHE_DPRINT
PHP_FE(xcache_dprint, arginfo_xcache_dprint)
#endif
#ifdef HAVE_XCACHE_ASSEMBLER
PHP_FE(xcache_asm, NULL)
#endif
@ -446,19 +526,17 @@ static zend_function_entry xcache_functions[] = /* {{{ */
PHP_FE(xcache_decode_file, NULL)
PHP_FE(xcache_decode_string, NULL)
#endif
PHP_FE(xcache_get_special_value, NULL)
PHP_FE(xcache_get_type, NULL)
PHP_FE(xcache_get_op_type, NULL)
PHP_FE(xcache_get_data_type, NULL)
PHP_FE(xcache_get_opcode, NULL)
PHP_FE(xcache_get_opcode_spec, NULL)
PHP_FE(xcache_is_autoglobal, NULL)
PHP_FE(xcache_get_special_value, arginfo_xcache_get_special_value)
PHP_FE(xcache_get_type, arginfo_xcache_get_type)
PHP_FE(xcache_get_op_type, arginfo_xcache_get_op_type)
PHP_FE(xcache_get_data_type, arginfo_xcache_get_data_type)
PHP_FE(xcache_get_opcode, arginfo_xcache_get_opcode)
PHP_FE(xcache_get_opcode_spec, arginfo_xcache_get_opcode_spec)
PHP_FE(xcache_coredump, arginfo_xcache_coredump)
PHP_FE(xcache_is_autoglobal, arginfo_xcache_is_autoglobal)
PHP_FE(xcache_get_refcount, arginfo_xcache_get_refcount)
PHP_FE(xcache_get_cowcount, arginfo_xcache_get_cowcount)
PHP_FE(xcache_get_isref, arginfo_xcache_get_isref)
#ifdef HAVE_XCACHE_DPRINT
PHP_FE(xcache_dprint, NULL)
#endif
PHP_FE_END
};
/* }}} */

Loading…
Cancel
Save