1.0 branch
git-svn-id: svn://svn.lighttpd.net/xcache/branches/1.0@71 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
commit
e9266f60f5
|
@ -0,0 +1,33 @@
|
|||
acinclude.m4
|
||||
aclocal.m4
|
||||
build
|
||||
config.cache
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.nice
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
configure.in
|
||||
conftest
|
||||
conftest.c
|
||||
.deps
|
||||
include
|
||||
includes.i
|
||||
install-sh
|
||||
libtool
|
||||
ltmain.sh
|
||||
Makefile
|
||||
Makefile.fragments
|
||||
Makefile.global
|
||||
Makefile.objects
|
||||
missing
|
||||
mkinstalldirs
|
||||
modules
|
||||
processor.h
|
||||
processor.out
|
||||
processor_real.c
|
||||
run-tests.php
|
||||
structinfo.m4
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
|
||||
Copyright (c) 2005-2006, mOo, phpxcache@gmail.com, XCache
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the 'XCache' nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,26 @@
|
|||
# vim:ts=4:sw=4
|
||||
Installtion:
|
||||
|
||||
$ phpize --clean && phpize
|
||||
$ ./configure --help
|
||||
$ CFLAGS='your cflags' ./configure --enable-xcache --enable...
|
||||
$ make
|
||||
$ su
|
||||
# make install
|
||||
(update php.ini, restart php)
|
||||
|
||||
Reinstall:
|
||||
|
||||
$ mv config.nice conf
|
||||
$ make distclean && phpize --clean && phpize
|
||||
$ mv conf config.nice
|
||||
$ ./config.nice
|
||||
$ make
|
||||
$ su
|
||||
# make install
|
||||
(update php.ini, restart php)
|
||||
|
||||
Update php.ini:
|
||||
$ su
|
||||
# cat xcache.ini >> /etc/php.ini
|
||||
# $EDITOR /etc/php.ini
|
|
@ -0,0 +1,35 @@
|
|||
XCACHE_PROC_SRC=$(srcdir)/processor/main.m4
|
||||
XCACHE_PROC_OUT=$(builddir)/processor.out
|
||||
XCACHE_PROC_C=$(builddir)/processor_real.c
|
||||
XCACHE_PROC_H=$(builddir)/processor.h
|
||||
XCACHE_INCLUDES_SRC=$(srcdir)/includes.c
|
||||
XCACHE_INCLUDES_I=$(builddir)/includes.i
|
||||
XCACHE_STRUCTINFO_OUT=$(builddir)/structinfo.m4
|
||||
|
||||
$(XCACHE_INCLUDES_I): $(XCACHE_INCLUDES_SRC) $(srcdir)/xcache.h
|
||||
$(CC) -I. -I$(srcdir) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) -E $(XCACHE_INCLUDES_SRC) -o $(XCACHE_INCLUDES_I)
|
||||
|
||||
$(XCACHE_STRUCTINFO_OUT): $(XCACHE_INCLUDES_I) $(srcdir)/mkstructinfo.awk
|
||||
@echo $(XCACHE_STRUCTINFO_OUT) is optional if XCache test is not enabled, feel free if it awk failed to produce it
|
||||
-$(AWK) -f $(srcdir)/mkstructinfo.awk < $(XCACHE_INCLUDES_I) > $(XCACHE_STRUCTINFO_OUT).tmp && mv -f $(XCACHE_STRUCTINFO_OUT).tmp $(XCACHE_STRUCTINFO_OUT)
|
||||
|
||||
$(XCACHE_PROC_OUT): $(XCACHE_PROC_SRC) $(XCACHE_STRUCTINFO_OUT) $(XCACHE_PROC_SOURCES)
|
||||
$(M4) -D srcdir="$(srcdir)" -D builddir="$(builddir)" $(XCACHE_ENABLE_TEST) $(XCACHE_PROC_SRC) > $(XCACHE_PROC_OUT).tmp
|
||||
mv -f $(XCACHE_PROC_OUT).tmp $(XCACHE_PROC_OUT)
|
||||
|
||||
$(XCACHE_PROC_H): $(XCACHE_PROC_OUT)
|
||||
$(GREP) 'export: ' $(XCACHE_PROC_OUT) | $(SED) 's/.*export:\(.*\):export.*/\1/g' | $(XCACHE_INDENT) > $(XCACHE_PROC_H).tmp
|
||||
mv -f $(XCACHE_PROC_H).tmp $(XCACHE_PROC_H)
|
||||
|
||||
$(XCACHE_PROC_C): $(XCACHE_PROC_OUT) $(XCACHE_PROC_H)
|
||||
$(XCACHE_INDENT) < $(XCACHE_PROC_OUT) > $(XCACHE_PROC_C).tmp
|
||||
mv -f $(XCACHE_PROC_C).tmp $(XCACHE_PROC_C)
|
||||
|
||||
$(builddir)/processor.lo: $(XCACHE_PROC_C) $(XCACHE_PROC_H) $(srcdir)/processor.c
|
||||
processor.lo: $(XCACHE_PROC_C) $(XCACHE_PROC_H) $(srcdir)/processor.c
|
||||
|
||||
$(builddir)/disassembler.lo: $(XCACHE_PROC_H) $(srcdir)/processor.c
|
||||
disassembler.lo: $(XCACHE_PROC_H) $(srcdir)/processor.c
|
||||
|
||||
$(builddir)/xcache.lo: $(XCACHE_PROC_H) $(srcdir)/myshm.h $(srcdir)/stack.h $(srcdir)/xcache_globals.h $(srcdir)/xcache.c
|
||||
xcache.lo: $(XCACHE_PROC_H) $(srcdir)/myshm.h $(srcdir)/stack.h $(srcdir)/xcache_globals.h $(srcdir)/xcache.c
|
|
@ -0,0 +1 @@
|
|||
Please check http://trac.lighttpd.net/xcache/ and http://forum.lighttpd.net/forum/4 for help
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
Jan <jan@kneschke.de>, host XCache website
|
||||
Alex <ale@freebsd.org>, redist to FreeBSD
|
||||
darix <darix@irssi.org>, redist to opensuse
|
||||
|
||||
There is also many ppl on IRC or forum helped me a lot testing XCache.
|
||||
Without them, XCache may not even be released.
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
// this is an example only
|
||||
// write your own config and name it as config.php
|
||||
|
||||
$charset = "UTF-8";
|
||||
|
||||
// this function is detected by xcache.tpl.php, and enabled if function_exists
|
||||
// this ob filter is applied for the cache list, not the whole page
|
||||
function ob_filter_path_nicer($o)
|
||||
{
|
||||
$o = str_replace("/home/", "{H}/", $o);
|
||||
return $o;
|
||||
}
|
||||
|
||||
// you can simply let xcache to do the http auth
|
||||
// but if you have your home made login/permission system, you can implement the following
|
||||
// {{{ home made login example
|
||||
// this is an example only, it's won't work for you without your implemention.
|
||||
function check_admin_and_by_pass_xcache_http_auth()
|
||||
{
|
||||
require("/path/to/user-login-and-permission-lib.php");
|
||||
session_start();
|
||||
|
||||
if (!user_logined()) {
|
||||
if (!ask_the_user_to_login()) {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
user_load_permissions();
|
||||
if (!user_is_admin()) {
|
||||
die("Permission denied");
|
||||
}
|
||||
|
||||
// user is trusted after permission checks above.
|
||||
// tell XCache about it (the only way to by pass XCache http auth)
|
||||
$_SERVER["PHP_AUTH_USER"] = "moo";
|
||||
$_SERVER["PHP_AUTH_PW"] = "your-xcache-password";
|
||||
return true;
|
||||
}
|
||||
|
||||
// uncomment:
|
||||
// check_admin_and_by_pass_xcache_http_auth();
|
||||
// }}}
|
||||
|
||||
?>
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
$charset = "UTF-8";
|
||||
if (file_exists("./config.php")) {
|
||||
include("./config.php");
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Language" content="en-us" />
|
||||
<?php
|
||||
echo <<<HEAD
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=$charset" />
|
||||
<script type="text/javascript" src="tablesort.js" charset="$charset"></script>
|
||||
HEAD;
|
||||
?>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="xcache.css" />
|
||||
<title>XCache Administration Help</title>
|
||||
<script>
|
||||
function toggle(o)
|
||||
{
|
||||
o.style.display = o.style.display != 'block' ? 'block' : 'none';
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>XCache Administration Help</h1>
|
||||
<a href="javascript:" onclick="toggle(document.getElementById('help'));return false" style="display:block; float: right">Help</a>
|
||||
<div id1="help">
|
||||
<h2>Cache Legends</h2>
|
||||
<pre>
|
||||
<b>Slots: </b>Number of hash slots. the setting from your php.ini
|
||||
<b>Size: </b>Cache Size, Size of the cache (or cache chunk), in bytes
|
||||
<b>Avail: </b>Available Memory, free memory in bytes of this cache
|
||||
<b>Used: </b>Used Percent, A bar shows how much memory used in percent
|
||||
<b>Clear: </b>Clear Button, Press the button to clean this cache
|
||||
<b>Compiling: </b>Compiling flag, "yes" if the cache is busy compiling php script
|
||||
<b>Hits: </b>Cache Hits, hit=a var/php is loaded from this cache
|
||||
<b>Misses: </b>Cache Misses, miss=a var/php is requested but not in the cache
|
||||
<b>CLogs: </b>Compiling Clogs, clog=compiling is needed but avoided to wait(be blocked)
|
||||
for the cache busy compiling
|
||||
<b>OOMs: </b>Out Of Memory, how many times a new item should be stored but there isn't
|
||||
enough memory in the cache, think of increasing the xcache.size or xcache.var_size
|
||||
<b>Protected: </b>Whether readonly_protection is available and enable on this cache
|
||||
<b>Cached: </b>Number of entries stored in this cache
|
||||
<b>Deleted: </b>Number of entries is pending in delete list (expired but referenced)
|
||||
<b>Free Blocks:</b>Free blocks list in the specified cache
|
||||
</pre>
|
||||
|
||||
<h2>List Legends</h2>
|
||||
<pre>
|
||||
<b>entry: </b>The entry name or filename
|
||||
<b>Hits: </b>Times this entry is hit (loaded from this cache)
|
||||
<b>Refcount: </b>Reference count this entry is holded by a php request
|
||||
<b>Size: </b>Size in bytes of this entry in the cache
|
||||
<b>SrcSize: </b>Size of the source file
|
||||
<b>Modify: </b>Last modified time of the source file
|
||||
<b>device: </b>device number of the source file
|
||||
<b>inode: </b>inode number of the source file
|
||||
<b>Access: </b>Last access time of the cached entry
|
||||
<b>Create: </b>The time when this entry is stored
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
See also: <a href="http://trac.lighttpd.net/xcache/wiki/PhpIni">setting php.ini for XCache</a> in the <a href="http://trac.lighttpd.net/xcache/">XCache wiki</a>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
include("xcache.php");
|
|
@ -0,0 +1,58 @@
|
|||
var sort_column;
|
||||
var prev_span = null;
|
||||
function get_inner_text(el) {
|
||||
if((typeof el == 'string')||(typeof el == 'undefined'))
|
||||
return el;
|
||||
if(el.innerText)
|
||||
return el.innerText;
|
||||
else {
|
||||
var str = "";
|
||||
var cs = el.childNodes;
|
||||
var l = cs.length;
|
||||
for (i=0;i<l;i++) {
|
||||
if (cs[i].nodeType==1) str += get_inner_text(cs[i]);
|
||||
else if (cs[i].nodeType==3) str += cs[i].nodeValue;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
function sortfn(a,b) {
|
||||
var i = a.cells[sort_column].getAttribute('int');
|
||||
if (i != null) {
|
||||
return parseInt(i)-parseInt(b.cells[sort_column].getAttribute('int'));
|
||||
} else {
|
||||
var at = get_inner_text(a.cells[sort_column]);
|
||||
var bt = get_inner_text(b.cells[sort_column]);
|
||||
aa = at.toLowerCase();
|
||||
bb = bt.toLowerCase();
|
||||
if (aa==bb) return 0;
|
||||
else if (aa<bb) return -1;
|
||||
else return 1;
|
||||
}
|
||||
}
|
||||
function resort(lnk) {
|
||||
var span = lnk.childNodes[1];
|
||||
if (!span) {
|
||||
var span = document.createElement("span")
|
||||
span.className = "sortarrow";
|
||||
lnk.appendChild(span);
|
||||
}
|
||||
var table = lnk.parentNode.parentNode.parentNode.parentNode;
|
||||
var rows = new Array();
|
||||
for (j=1;j<table.rows.length;j++)
|
||||
rows[j-1] = table.rows[j];
|
||||
sort_column = lnk.parentNode.cellIndex;
|
||||
rows.sort(sortfn);
|
||||
if (prev_span != null) prev_span.innerHTML = '';
|
||||
if (span.getAttribute('sortdir')=='down') {
|
||||
span.innerHTML = '↑';
|
||||
span.setAttribute('sortdir','up');
|
||||
rows.reverse();
|
||||
} else {
|
||||
span.innerHTML = '↓';
|
||||
span.setAttribute('sortdir','down');
|
||||
}
|
||||
for (i=0;i<rows.length;i++)
|
||||
table.tBodies[0].appendChild(rows[i]);
|
||||
prev_span = span;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
input, table { font-family: monospace; font-size: 11px; }
|
||||
table.cycles { border: 1px solid black; background: white; margin-top: 5px; margin-bottom: 5px; }
|
||||
table.cycles .col1 { background-color: #f5f5f5; }
|
||||
table.cycles .col2 { background-color: #e0e0e0; }
|
||||
table.cycles th, table.cycles td { border-top: 1px solid white; border-left: 1px solid white; }
|
||||
table.cycles th { background-color: #707090; color: white; font-weight: bold; height: 20px; line-height: 16px; font-family: serif; }
|
||||
th a { color: white; font-weight: bold; display: block; width: 100%; height: 100%; }
|
||||
.button { }
|
||||
span.sortarrow { color: white; text-decoration: none; }
|
||||
.freeblocks { float: left; margin-right: 4px;}
|
||||
form {margin: 0; padding: 0}
|
||||
.percent { border: 1px solid gray; width: 90%; }
|
||||
.percent .v { background: black; font-size: 1px; line-height: 11px;}
|
||||
.switcher, h1 { text-align: center; display: block; }
|
||||
.switcher * { color: blue; }
|
||||
.switcher a.active { font-weight: bold; font-size: 130%; color: black; }
|
||||
#help { display: block; float: right; }
|
|
@ -0,0 +1,189 @@
|
|||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
define('REQUEST_TIME', time());
|
||||
|
||||
class Cycle
|
||||
{
|
||||
var $values;
|
||||
var $i;
|
||||
var $count;
|
||||
|
||||
function Cycle($v)
|
||||
{
|
||||
$this->values = func_get_args();
|
||||
$this->i = -1;
|
||||
$this->count = count($this->values);
|
||||
}
|
||||
|
||||
function next()
|
||||
{
|
||||
$this->i = ($this->i + 1) % $this->count;
|
||||
return $this->values[$this->i];
|
||||
}
|
||||
|
||||
function cur()
|
||||
{
|
||||
return $this->values[$this->i];
|
||||
}
|
||||
|
||||
function reset()
|
||||
{
|
||||
$this->i = -1;
|
||||
}
|
||||
}
|
||||
|
||||
function number_formats($a, $keys)
|
||||
{
|
||||
foreach ($keys as $k) {
|
||||
$a[$k] = number_format($a[$k]);
|
||||
}
|
||||
return $a;
|
||||
}
|
||||
|
||||
function size($size, $suffix = '', $precision = 2)
|
||||
{
|
||||
$size = (int) $size;
|
||||
if ($size < 1024)
|
||||
return number_format($size, $precision) . ' ' . $suffix;
|
||||
|
||||
if ($size < 1048576)
|
||||
return number_format($size / 1024, $precision) . ' K' . $suffix;
|
||||
|
||||
return number_format($size / 1048576, $precision) . ' M' . $suffix;
|
||||
}
|
||||
|
||||
function age($time)
|
||||
{
|
||||
if (!$time) return '';
|
||||
$delta = REQUEST_TIME - $time;
|
||||
|
||||
if ($delta < 0) {
|
||||
$delta = -$delta;
|
||||
}
|
||||
|
||||
static $seconds = array(1, 60, 3600, 86400, 604800, 2678400, 31536000);
|
||||
static $name = array('s', 'm', 'h', 'd', 'w', 'M', 'Y');
|
||||
|
||||
for ($i = 6; $i >= 0; $i --) {
|
||||
if ($delta >= $seconds[$i]) {
|
||||
$ret = (int) ($delta / $seconds[$i]);
|
||||
return $ret . ' ' . $name[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function switcher($name, $options)
|
||||
{
|
||||
$n = isset($_GET[$name]) ? $_GET[$name] : null;
|
||||
$html = array();
|
||||
foreach ($options as $k => $v) {
|
||||
$html[] = sprintf('<a href="?%s=%s"%s>%s</a>', $name, $k, $k == $n ? 'class="active"' : '', $v);
|
||||
}
|
||||
return implode(' ', $html);
|
||||
}
|
||||
|
||||
$charset = "UTF-8";
|
||||
|
||||
if (file_exists("config.php")) {
|
||||
include("config.php");
|
||||
}
|
||||
|
||||
$pcnt = xcache_count(XC_TYPE_PHP);
|
||||
$vcnt = xcache_count(XC_TYPE_VAR);
|
||||
|
||||
$type_none = -1;
|
||||
if (!isset($_GET['type'])) {
|
||||
$_GET['type'] = $type_none;
|
||||
}
|
||||
$_GET['type'] = $type = (int) $_GET['type'];
|
||||
|
||||
// {{{ process clear
|
||||
function processClear()
|
||||
{
|
||||
$type = isset($_POST['type']) ? $_POST['type'] : null;
|
||||
if ($type != XC_TYPE_PHP && $type != XC_TYPE_VAR) {
|
||||
$type = null;
|
||||
}
|
||||
if (isset($type)) {
|
||||
$cacheid = (int) (isset($_POST['cacheid']) ? $_POST['cacheid'] : 0);
|
||||
if (isset($_POST['clearcache'])) {
|
||||
xcache_clear_cache($type, $cacheid);
|
||||
}
|
||||
}
|
||||
}
|
||||
processClear();
|
||||
// }}}
|
||||
// {{{ load info/list
|
||||
$cacheinfos = array();
|
||||
for ($i = 0; $i < $pcnt; $i ++) {
|
||||
$data = xcache_info(XC_TYPE_PHP, $i);
|
||||
if ($type === XC_TYPE_PHP) {
|
||||
$data += xcache_list(XC_TYPE_PHP, $i);
|
||||
}
|
||||
$data['type'] = XC_TYPE_PHP;
|
||||
$data['cache_name'] = "php#$i";
|
||||
$data['cacheid'] = $i;
|
||||
$cacheinfos[] = $data;
|
||||
}
|
||||
for ($i = 0; $i < $vcnt; $i ++) {
|
||||
$data = xcache_info(XC_TYPE_VAR, $i);
|
||||
if ($type === XC_TYPE_VAR) {
|
||||
$data += xcache_list(XC_TYPE_VAR, $i);
|
||||
}
|
||||
$data['type'] = XC_TYPE_VAR;
|
||||
$data['cache_name'] = "var#$i";
|
||||
$data['cacheid'] = $i;
|
||||
$cacheinfos[] = $data;
|
||||
}
|
||||
// }}}
|
||||
// {{{ merge the list
|
||||
switch ($type) {
|
||||
case XC_TYPE_PHP:
|
||||
case XC_TYPE_VAR:
|
||||
$cachelist = array('type' => $type, 'cache_list' => array(), 'deleted_list' => array());
|
||||
if ($type == XC_TYPE_VAR) {
|
||||
$cachelist['type_name'] = 'var';
|
||||
}
|
||||
else {
|
||||
$cachelist['type_name'] = 'php';
|
||||
}
|
||||
foreach ($cacheinfos as $i => $c) {
|
||||
if ($c['type'] == $type && isset($c['cache_list'])) {
|
||||
foreach ($c['cache_list'] as $e) {
|
||||
$e['cache_name'] = $c['cache_name'];
|
||||
$cachelist['cache_list'][] = $e;
|
||||
}
|
||||
foreach ($c['deleted_list'] as $e) {
|
||||
$e['cache_name'] = $c['cache_name'];
|
||||
$cachelist['deleted_list'][] = $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($type == XC_TYPE_PHP) {
|
||||
$inodes = array();
|
||||
foreach ($cachelist['cache_list'] as $e) {
|
||||
$i = &$inodes[$e['inode']];
|
||||
if (isset($i) && $i == 1) {
|
||||
set_error("duplicate inode $e[inode]");
|
||||
}
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
unset($data);
|
||||
break;
|
||||
|
||||
default:
|
||||
$_GET['type'] = $type_none;
|
||||
$cachelist = array();
|
||||
break;
|
||||
}
|
||||
// }}}
|
||||
|
||||
$type_php = XC_TYPE_PHP;
|
||||
$type_var = XC_TYPE_VAR;
|
||||
$types = array($type_none => 'Statistics', $type_php =>'List PHP', $type_var =>'List Var Data');
|
||||
|
||||
include("xcache.tpl.php");
|
||||
|
||||
?>
|
|
@ -0,0 +1,234 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Language" content="en-us" />
|
||||
<?php
|
||||
echo <<<HEAD
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=$charset" />
|
||||
<script type="text/javascript" src="tablesort.js" charset="$charset"></script>
|
||||
HEAD;
|
||||
?>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="xcache.css" />
|
||||
<title>XCache Administration</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>XCache Administration</h1>
|
||||
<a href="help.php" target="_blank" id="help">Help »</a>
|
||||
<span class="switcher"><?php echo switcher("type", $types); ?></span>
|
||||
<?php
|
||||
$a = new Cycle('class="col1"', 'class="col2"');
|
||||
$b = new Cycle('class="col1"', 'class="col2"');
|
||||
?>
|
||||
Caches:
|
||||
<table cellspacing="0" cellpadding="4" class="cycles">
|
||||
<col />
|
||||
<col align="right" />
|
||||
<col align="right" />
|
||||
<col align="right" />
|
||||
<col />
|
||||
<col />
|
||||
<col align="right" />
|
||||
<col align="right" />
|
||||
<col align="right" />
|
||||
<col align="right" />
|
||||
<col align="right" />
|
||||
<col align="right" />
|
||||
<col align="right" />
|
||||
<col align="right" />
|
||||
<col />
|
||||
<tr <?php echo $a->next(); ?>>
|
||||
<th>-</th>
|
||||
<th>Slots</th>
|
||||
<th>Size</th>
|
||||
<th>Avail</th>
|
||||
<th>Used</th>
|
||||
<th>Clear</th>
|
||||
<th>Compiling</th>
|
||||
<th>Hits</th>
|
||||
<th>Misses</th>
|
||||
<th>Clogs</th>
|
||||
<th>OOMs</th>
|
||||
<th>Protected</th>
|
||||
<th>Cached</th>
|
||||
<th>Deleted</th>
|
||||
</tr>
|
||||
<?php
|
||||
$numkeys = explode(',', 'slots,size,avail,hits,misses,clogs,ooms,cached,deleted');
|
||||
foreach ($cacheinfos as $i => $ci) {
|
||||
echo "
|
||||
<tr ", $a->next(), ">";
|
||||
$ci = number_formats($ci, $numkeys);
|
||||
$ci['compiling'] = $ci['type'] == $type_php ? ($ci['compiling'] ? 'yes' : 'no') : '-';
|
||||
$ci['can_readonly'] = $ci['can_readonly'] ? 'yes' : 'no';
|
||||
|
||||
$percent = (int) (($ci['size'] - $ci['avail']) / $ci['size'] * 100);
|
||||
echo <<<EOS
|
||||
<th>{$ci['cache_name']}</th>
|
||||
<td>{$ci['slots']}</td>
|
||||
<td>{$ci['size']}</td>
|
||||
<td>{$ci['avail']}</td>
|
||||
<td><div class="percent"><div style="width: $percent%" class="v"> </div></div></td>
|
||||
<td>
|
||||
<form method="post">
|
||||
<div>
|
||||
<input type="hidden" name="type" value="{$ci['type']}">
|
||||
<input type="hidden" name="cacheid" value="{$ci['cacheid']}">
|
||||
<input type="submit" name="clearcache" value="Clear" class="submit" onclick="return confirm('Sure to clear?');" />
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
<td>{$ci['compiling']}</td>
|
||||
<td>{$ci['hits']}</td>
|
||||
<td>{$ci['misses']}</td>
|
||||
<td>{$ci['clogs']}</td>
|
||||
<td>{$ci['ooms']}</td>
|
||||
<td>{$ci['can_readonly']}</td>
|
||||
<td>{$ci['cached']}</td>
|
||||
<td>{$ci['deleted']}</td>
|
||||
EOS;
|
||||
|
||||
$b->reset();
|
||||
?>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
Free Blocks:
|
||||
<?php
|
||||
foreach ($cacheinfos as $i => $ci) {
|
||||
$b->reset();
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="4" class="cycles freeblocks">
|
||||
<tr>
|
||||
<th><?php echo $ci['cache_name']; ?> size<br>offset</th>
|
||||
<?php
|
||||
foreach ($ci['free_blocks'] as $block) {
|
||||
$size = number_format($block['size']);
|
||||
$offset = number_format($block['offset']);
|
||||
|
||||
$c = $b->next();
|
||||
echo "
|
||||
<td $c><nobr>$size<br>$offset</nobr></td>";
|
||||
}
|
||||
?>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div style="clear: both"> </div>
|
||||
<?php
|
||||
|
||||
if ($cachelist) {
|
||||
$isphp = $cachelist['type'] == $type_php;
|
||||
if (function_exists("ob_filter_path_nicer")) {
|
||||
ob_start("ob_filter_path_nicer");
|
||||
}
|
||||
foreach (array('Cached' => $cachelist['cache_list'], 'Deleted' => $cachelist['deleted_list']) as $listname => $entries) {
|
||||
$a->reset();
|
||||
echo "
|
||||
<caption>{$cachelist['type_name']} $listname</caption>";
|
||||
?>
|
||||
|
||||
<table cellspacing="0" cellpadding="4" class="cycles entrys" width="100%">
|
||||
<col />
|
||||
<col />
|
||||
<col align="right" />
|
||||
<col align="right" />
|
||||
<col align="right" />
|
||||
<col align="right" />
|
||||
<col align="right" />
|
||||
<col align="right" />
|
||||
<?php
|
||||
if ($listname == 'Deleted') {
|
||||
echo '<col align="right" />';
|
||||
}
|
||||
if ($isphp) {
|
||||
echo '<col align="right" />';
|
||||
echo '<col align="right" />';
|
||||
echo '<col align="right" />';
|
||||
}
|
||||
|
||||
echo "
|
||||
<tr ", $a->next(), ">";
|
||||
?>
|
||||
|
||||
<th><a href="javascript:" onclick="resort(this); return false">Cache</a></th>
|
||||
<th><a href="javascript:" onclick="resort(this); return false">entry</a></th>
|
||||
<th><a href="javascript:" onclick="resort(this); return false">Hits</a></th>
|
||||
<th><a href="javascript:" onclick="resort(this); return false">Ref count</a></th>
|
||||
<th><a href="javascript:" onclick="resort(this); return false">Size</a></th>
|
||||
<?php if ($isphp) { ?>
|
||||
<th><a href="javascript:" onclick="resort(this); return false">SrcSize</a></th>
|
||||
<th><a href="javascript:" onclick="resort(this); return false">Modify</a></th>
|
||||
<th><a href="javascript:" onclick="resort(this); return false">device</a></th>
|
||||
<th><a href="javascript:" onclick="resort(this); return false">inode</a></th>
|
||||
<?php } ?>
|
||||
<th><a href="javascript:" onclick="resort(this); return false">Access</a></th>
|
||||
<th><a href="javascript:" onclick="resort(this); return false">Create</a></th>
|
||||
<?php if ($listname == 'Deleted') { ?>
|
||||
<th><a href="javascript:" onclick="resort(this); return false">Delete</a></th>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($entries as $i => $entry) {
|
||||
echo "
|
||||
<tr ", $a->next(), ">";
|
||||
$name = htmlspecialchars($entry['name']);
|
||||
$hits = number_format($entry['hits']);
|
||||
$refcount = number_format($entry['refcount']);
|
||||
$size = size($entry['size']);
|
||||
if ($isphp) {
|
||||
$sourcesize = size($entry['sourcesize']);
|
||||
}
|
||||
|
||||
if ($isphp) {
|
||||
$mtime = age($entry['mtime']);
|
||||
}
|
||||
$ctime = age($entry['ctime']);
|
||||
$atime = age($entry['atime']);
|
||||
$dtime = age($entry['dtime']);
|
||||
|
||||
echo <<<ENTRY
|
||||
<td>{$entry['cache_name']} {$i}</td>
|
||||
<td>{$name}</td>
|
||||
<td int="{$entry['hits']}">{$entry['hits']}</td>
|
||||
<td int="{$entry['refcount']}">{$entry['refcount']}</td>
|
||||
<td int="{$entry['size']}">{$size}</td>
|
||||
ENTRY;
|
||||
if ($isphp) {
|
||||
echo <<<ENTRY
|
||||
<td int="{$entry['sourcesize']}">{$sourcesize}</td>
|
||||
<td int="{$entry['mtime']}">{$mtime}</td>
|
||||
<td int="{$entry['device']}">{$entry['device']}</td>
|
||||
<td int="{$entry['inode']}">{$entry['inode']}</td>
|
||||
ENTRY;
|
||||
}
|
||||
echo <<<ENTRY
|
||||
<td int="{$entry['atime']}">{$atime}</td>
|
||||
<td int="{$entry['ctime']}">{$ctime}</td>
|
||||
ENTRY;
|
||||
if ($listname == 'Deleted') {
|
||||
echo <<<ENTRY
|
||||
<td int="{$entry['dtime']}">{$dtime}</td>
|
||||
ENTRY;
|
||||
}
|
||||
|
||||
echo "
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
if (function_exists("ob_filter_path_nicer")) {
|
||||
ob_end_flush();
|
||||
}
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __ALIGN_H
|
||||
#define __ALIGN_H
|
||||
#ifndef ALIGN
|
||||
typedef union align_union {
|
||||
double d;
|
||||
void *v;
|
||||
int (*func)(int);
|
||||
long l;
|
||||
} align_union;
|
||||
|
||||
#if (defined (__GNUC__) && __GNUC__ >= 2)
|
||||
#define XCACHE_PLATFORM_ALIGNMENT (__alignof__ (align_union))
|
||||
#else
|
||||
#define XCACHE_PLATFORM_ALIGNMENT (sizeof(align_union))
|
||||
#endif
|
||||
|
||||
#define ALIGN(n) ((((size_t)(n)-1) & ~(XCACHE_PLATFORM_ALIGNMENT-1)) + XCACHE_PLATFORM_ALIGNMENT)
|
||||
#endif
|
||||
#endif /* __ALIGN_H */
|
|
@ -0,0 +1,103 @@
|
|||
dnl vim:ts=2:sw=2:expandtab
|
||||
|
||||
AC_DEFUN([XCACHE_OPTION], [
|
||||
PHP_ARG_ENABLE(xcache-$1, for XCache $1,
|
||||
[ --enable-xcache-$2 XCache: $4], no, no)
|
||||
if test "$PHP_$3" != "no"; then
|
||||
xcache_sources="$xcache_sources $1.c"
|
||||
XCACHE_MODULES="$XCACHE_MODULES $1"
|
||||
HAVE_$3=1
|
||||
AC_DEFINE([HAVE_$3], 1, [Define for XCache: $4])
|
||||
else
|
||||
HAVE_$3=
|
||||
fi
|
||||
])dnl
|
||||
|
||||
PHP_ARG_ENABLE(xcache, for XCache support,
|
||||
[ --enable-xcache Include XCache support.])
|
||||
|
||||
if test "$PHP_XCACHE" != "no"; then
|
||||
xcache_sources="processor.c \
|
||||
xcache.c \
|
||||
mmap.c \
|
||||
mem.c \
|
||||
const_string.c \
|
||||
opcode_spec.c \
|
||||
stack.c \
|
||||
utils.c \
|
||||
lock.c \
|
||||
"
|
||||
XCACHE_MODULES="cacher"
|
||||
XCACHE_OPTION([optimizer], [optimizer ], [XCACHE_OPTIMIZER], [(N/A)])
|
||||
XCACHE_OPTION([coverager], [coverager ], [XCACHE_COVERAGER], [Enable code coverage dumper, useful for testing php scripts])
|
||||
XCACHE_OPTION([assembler], [assembler ], [XCACHE_ASSEMBLER], [(N/A)])
|
||||
XCACHE_OPTION([disassembler], [disassembler], [XCACHE_DISASSEMBLER], [Enable opcode to php variable dumper, NOT for production server])
|
||||
XCACHE_OPTION([encoder], [encoder ], [XCACHE_ENCODER], [(N/A)])
|
||||
XCACHE_OPTION([decoder], [decoder ], [XCACHE_DECODER], [(N/A)])
|
||||
AC_DEFINE_UNQUOTED([XCACHE_MODULES], "$XCACHE_MODULES", [Define what modules is built with XCache])
|
||||
|
||||
PHP_NEW_EXTENSION(xcache, $xcache_sources, $ext_shared)
|
||||
PHP_ADD_MAKEFILE_FRAGMENT()
|
||||
|
||||
PHP_ARG_ENABLE(xcache-test, for XCache self test,
|
||||
[ --enable-xcache-test XCache: Enable self test - FOR DEVELOPERS ONLY!!], no, no)
|
||||
if test "$PHP_XCACHE_TEST" != "no"; then
|
||||
XCACHE_ENABLE_TEST=-DXCACHE_ENABLE_TEST
|
||||
AC_DEFINE([HAVE_XCACHE_TEST], 1, [Define to enable XCache self test])
|
||||
else
|
||||
XCACHE_ENABLE_TEST=
|
||||
fi
|
||||
PHP_SUBST([XCACHE_ENABLE_TEST])
|
||||
|
||||
AC_PATH_PROGS([AWK], [gawk awk])
|
||||
PHP_SUBST([AWK])
|
||||
AC_PATH_PROGS([M4], [m4])
|
||||
PHP_SUBST([M4])
|
||||
AC_PATH_PROGS([GREP], [grep])
|
||||
PHP_SUBST([GREP])
|
||||
AC_PATH_PROGS([SED], [sed])
|
||||
PHP_SUBST([SED])
|
||||
|
||||
AC_PATH_PROGS([INDENT], [indent cat])
|
||||
case $INDENT in
|
||||
*/indent[)]
|
||||
opts="-kr --use-tabs --tab-size 4 -sob -nce"
|
||||
if echo | $INDENT $opts > /dev/null 2>&1 ; then
|
||||
XCACHE_INDENT="$INDENT $opts"
|
||||
else
|
||||
opts="-sob -nce"
|
||||
if echo | $INDENT $opts > /dev/null 2>&1 ; then
|
||||
XCACHE_INDENT="$INDENT $opts"
|
||||
else
|
||||
if echo | $INDENT > /dev/null 2>&1 ; then
|
||||
XCACHE_INDENT="$INDENT"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*[)]
|
||||
XCACHE_INDENT=cat
|
||||
;;
|
||||
esac
|
||||
PHP_SUBST([XCACHE_INDENT])
|
||||
|
||||
dnl $ac_srcdir etc require PHP_NEW_EXTENSION
|
||||
XCACHE_PROC_SOURCES=`ls $ac_srcdir/processor/*.m4`
|
||||
PHP_SUBST([XCACHE_PROC_SOURCES])
|
||||
|
||||
AC_MSG_CHECKING(if you have opcode_spec_def.h for XCache)
|
||||
if test -e "$ac_srcdir/opcode_spec_def.h" ; then
|
||||
AC_DEFINE([HAVE_XCACHE_OPCODE_SPEC_DEF], 1, [Define if you have opcode_spec_def.h for XCache])
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
dnl check for features depend on opcode_spec_def.h
|
||||
AC_MSG_RESULT(no)
|
||||
define([ERROR], [
|
||||
AC_MSG_ERROR([cannot build with $1, $ac_srcdir/opcode_spec_def.h required])
|
||||
])
|
||||
if test "$PHP_XCACHE_DISASSEMBLER" != "no" ; then
|
||||
ERROR(disassembler)
|
||||
fi
|
||||
undefine([ERROR])
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,135 @@
|
|||
// vim:ft=javascript
|
||||
|
||||
|
||||
ARG_ENABLE("xcache", "Include XCache support", "yes,shared");
|
||||
|
||||
if (PHP_XCACHE != "no") {
|
||||
var xcache_sources = "processor.c \
|
||||
xcache.c \
|
||||
mmap.c \
|
||||
mem.c \
|
||||
const_string.c \
|
||||
opcode_spec.c \
|
||||
stack.c \
|
||||
utils.c \
|
||||
lock.c \
|
||||
";
|
||||
// {{{ add sources on enabled
|
||||
ARG_ENABLE("xcache-optimizer", "(N/A)", "no");
|
||||
ARG_ENABLE("xcache-coverager", "Enable code coverage dumper, useful for testing php scripts", "no");
|
||||
ARG_ENABLE("xcache-assembler", "(N/A)", "no");
|
||||
ARG_ENABLE("xcache-disassembler", "Enable opcode to php variable dumper, NOT for production server", "no");
|
||||
ARG_ENABLE("xcache-encoder", "(N/A)", "no");
|
||||
ARG_ENABLE("xcache-decoder", "(N/A)", "no");
|
||||
|
||||
var XCACHE_MODULES = "cacher";
|
||||
var options = ["optimizer",
|
||||
"coverager",
|
||||
"assembler", "disassembler",
|
||||
"encoder", "decoder"];
|
||||
for (var i in options) {
|
||||
var name = options[i];
|
||||
var uname = name.toUpperCase();
|
||||
var withval = eval("PHP_XCACHE_" + uname);
|
||||
if (withval != "no") {
|
||||
xcache_sources += " " + name + ".c";
|
||||
XCACHE_MODULES += " " + name;
|
||||
STDOUT.WriteLine("Enabling XCache Module: " + name);
|
||||
AC_DEFINE("HAVE_XCACHE_" + uname, 1, "Define for XCache: " + name)
|
||||
}
|
||||
}
|
||||
AC_DEFINE("XCACHE_MODULES", XCACHE_MODULES);
|
||||
// }}}
|
||||
// {{{ check for programs needed
|
||||
var apps = ["m4", "grep", "sed"];
|
||||
for (var i in apps) {
|
||||
if (!PATH_PROG(apps[i])) {
|
||||
ERROR(apps[i] + " is currently required to build XCache");
|
||||
}
|
||||
}
|
||||
PATH_PROG("gawk", null, "AWK") || PATH_PROG("awk", null, "AWK");
|
||||
|
||||
// the cygwin indent is known broken on our output
|
||||
var indent = false; // PATH_PROG("indent");
|
||||
if (indent) {
|
||||
indent += " -kr --use-tabs --tab-size 4 -sob -nce";
|
||||
}
|
||||
else {
|
||||
indent = PATH_PROG("cat");
|
||||
if (!indent) {
|
||||
indent = '';
|
||||
}
|
||||
}
|
||||
DEFINE("XCACHE_INDENT", indent);
|
||||
// }}}
|
||||
// {{{ create extension
|
||||
EXTENSION("xcache", xcache_sources);
|
||||
var srcdir = configure_module_dirname;
|
||||
// it's a bit harder to get builddir
|
||||
var mfofile = "Makefile.objects";
|
||||
MFO.Close();
|
||||
|
||||
var mfo = file_get_contents(mfofile);
|
||||
mfo.match(/(.*\\xcache)\\xcache.obj/);
|
||||
var builddir = RegExp.$1;
|
||||
mfo.match(/(.*\$\(CC\).* )\/c.*\\xcache\\xcache.c.*/i);
|
||||
var ccrule = RegExp.$1;
|
||||
|
||||
MFO = FSO.OpenTextFile(mfofile, 8);
|
||||
mfo = null;
|
||||
// }}}
|
||||
// {{{ add make fragments
|
||||
var file = srcdir + "\\Makefile.frag";
|
||||
STDOUT.WriteLine("Adding Makefile.frag: " + file);
|
||||
var frag = file_get_contents(file);
|
||||
frag = frag.replace(/\$\(srcdir\)\//g, srcdir + '\\');
|
||||
frag = frag.replace(/\$\(srcdir\)/g, srcdir);
|
||||
frag = frag.replace(/\$\(builddir\)\//g, builddir + '\\');
|
||||
frag = frag.replace(/\$\(builddir\)/g, builddir);
|
||||
frag = frag.replace(/processor\//g, "processor\\");
|
||||
frag = frag.replace(/\.lo:/g, ".obj:");
|
||||
frag = frag.replace(/.*\$\(CC\).* -E (.*) -o (.*)/, ccrule + " /E $1 > $2");
|
||||
frag = frag.replace(/ -o /g, " /Fo");
|
||||
frag = frag.replace(/mv -f /g, "move ");
|
||||
frag = frag.replace(/ \|\| /g, "\r\n\tif errorlevel 1 ");
|
||||
frag = frag.replace(/ && /g, "\r\n\tif not errorlevel 1 ");
|
||||
if (indent == '') {
|
||||
frag = frag.replace(/\| +\$\(XCACHE_INDENT\)/, '');
|
||||
frag = frag.replace(/\$\(XCACHE_INDENT\) < /, 'type ');
|
||||
}
|
||||
MFO.WriteLine(frag);
|
||||
ADD_FLAG("CFLAGS_XCACHE", "/I " + builddir);
|
||||
/// }}}
|
||||
// {{{ check for xcache-test
|
||||
ARG_ENABLE("xcache-test", "XCache: Enable self test - FOR DEVELOPERS ONLY!!", "no");
|
||||
if (PHP_XCACHE_TEST != "no") {
|
||||
ADD_FLAG("XCACHE_ENABLE_TEST", "-DXCACHE_ENABLE_TEST");
|
||||
AC_DEFINE("HAVE_XCACHE_TEST", 1, "Define to enable XCache self test");
|
||||
}
|
||||
else {
|
||||
ADD_FLAG("XCACHE_ENABLE_TEST", "");
|
||||
}
|
||||
|
||||
XCACHE_PROC_SOURCES=glob(srcdir + "\\processor\\*.m4").join(' ');
|
||||
ADD_FLAG("XCACHE_PROC_SOURCES", XCACHE_PROC_SOURCES);
|
||||
// }}}
|
||||
// {{{ check for opcode_spec_def.h
|
||||
STDOUT.Write("Checking if you have opcode_spec_def.h for XCache ... ");
|
||||
var file = srcdir + "\\opcode_spec_def.h";
|
||||
if (FSO.FileExists(file)) {
|
||||
STDOUT.WriteLine("yes");
|
||||
AC_DEFINE("HAVE_XCACHE_OPCODE_SPEC_DEF", 1, "Define if you have opcode_spec_def.h for XCache");
|
||||
}
|
||||
else {
|
||||
STDOUT.WriteLine("no");
|
||||
|
||||
// check for features depend on opcode_spec_def.h
|
||||
var xcache_require_opcode_spec_def = function(withval, name) {
|
||||
if (withval != "no") {
|
||||
ERROR(file + " is required to enable XCache " + name);
|
||||
}
|
||||
}
|
||||
xcache_require_opcode_spec_def(PHP_XCACHE_DISASSEMBLER, "disassembler");
|
||||
}
|
||||
// }}}
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
#include "xcache.h"
|
||||
#include "const_string.h"
|
||||
|
||||
/* {{{ xc_get_op_type */
|
||||
static const char *const op_type_names[] = {
|
||||
/* 0 */ "NULL?",
|
||||
/* 1 */ "IS_CONST",
|
||||
/* 2 */ "IS_TMP_VAR",
|
||||
/* 3 */ NULL,
|
||||
/* 4 */ "IS_VAR",
|
||||
/* 5 */ NULL,
|
||||
/* 6 */ NULL,
|
||||
/* 7 */ NULL,
|
||||
/* 8 */ "IS_UNUSED",
|
||||
#ifdef IS_CV
|
||||
/* 9 */ NULL,
|
||||
/* 10 */ NULL,
|
||||
/* 11 */ NULL,
|
||||
/* 12 */ NULL,
|
||||
/* 13 */ NULL,
|
||||
/* 14 */ NULL,
|
||||
/* 15 */ NULL,
|
||||
/* 16 */ "IS_CV"
|
||||
#endif
|
||||
};
|
||||
|
||||
zend_uchar xc_get_op_type_count()
|
||||
{
|
||||
return sizeof(op_type_names) / sizeof(op_type_names[0]);
|
||||
}
|
||||
|
||||
const char *xc_get_op_type(zend_uchar op_type)
|
||||
{
|
||||
assert(op_type < xc_get_op_type_count());
|
||||
return op_type_names[op_type];
|
||||
}
|
||||
/* }}} */
|
||||
/* {{{ xc_get_data_type */
|
||||
static const char *const data_type_names[] = {
|
||||
/* 0 */ "IS_NULL",
|
||||
/* 1 */ "IS_LONG",
|
||||
/* 2 */ "IS_DOUBLE",
|
||||
/* 3 */ "IS_BOOL",
|
||||
/* 4 */ "IS_ARRAY",
|
||||
/* 5 */ "IS_OBJECT",
|
||||
/* 6 */ "IS_STRING",
|
||||
/* 7 */ "IS_RESOURCE",
|
||||
/* 8 */ "IS_CONSTANT",
|
||||
/* 9 */ "IS_CONSTANT_ARRAY",
|
||||
/* 10 */ "IS_UNICODE",
|
||||
#if 0
|
||||
/* 11 */ "",
|
||||
/* 12 */ "",
|
||||
/* 13 */ "",
|
||||
/* 14 */ "",
|
||||
/* 15 */ "", "", "", "", "",
|
||||
|
||||
/* IS_CONSTANT_INDEX */
|
||||
/* 20 */ "CIDX IS_NULL",
|
||||
/* 21 */ "CIDX IS_LONG",
|
||||
/* 22 */ "CIDX IS_DOUBLE",
|
||||
/* 23 */ "CIDX IS_BOOL",
|
||||
/* 24 */ "CIDX IS_ARRAY",
|
||||
/* 25 */ "CIDX IS_OBJECT",
|
||||
/* 26 */ "CIDX IS_STRING",
|
||||
/* 27 */ "CIDX IS_RESOURCE",
|
||||
/* 28 */ "CIDX IS_CONSTANT",
|
||||
/* 29 */ "CIDX IS_CONSTANT_ARRAY"
|
||||
/* 20 */ "CIDX IS_UNICODE",
|
||||
#endif
|
||||
};
|
||||
|
||||
zend_uchar xc_get_data_type_count()
|
||||
{
|
||||
return sizeof(data_type_names) / sizeof(data_type_names[0]);
|
||||
}
|
||||
|
||||
const char *xc_get_data_type(zend_uchar data_type)
|
||||
{
|
||||
#if 0
|
||||
if (data_type & IS_CONSTANT_INDEX) {
|
||||
data_type = (data_type & ~IS_CONSTANT_INDEX) + 20;
|
||||
}
|
||||
#endif
|
||||
data_type &= ~IS_CONSTANT_INDEX;
|
||||
return data_type_names[data_type];
|
||||
}
|
||||
/* }}} */
|
||||
/* {{{ xc_get_opcode */
|
||||
#if PHP_MAJOR_VERSION >= 6
|
||||
# include "const_string_opcodes_php6.x.h"
|
||||
#else
|
||||
# ifdef ZEND_ENGINE_2_1
|
||||
# include "const_string_opcodes_php5.1.h"
|
||||
# else
|
||||
# ifdef ZEND_ENGINE_2
|
||||
# include "const_string_opcodes_php5.0.h"
|
||||
# else
|
||||
# include "const_string_opcodes_php4.x.h"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
zend_uchar xc_get_opcode_count()
|
||||
{
|
||||
return sizeof(xc_opcode_names) / sizeof(xc_opcode_names[0]);
|
||||
}
|
||||
|
||||
const char *xc_get_opcode(zend_uchar opcode)
|
||||
{
|
||||
assert(opcode < xc_get_opcode_count());
|
||||
return xc_opcode_names[opcode];
|
||||
}
|
||||
/* }}} */
|
|
@ -0,0 +1,8 @@
|
|||
#include "php.h"
|
||||
|
||||
zend_uchar xc_get_op_type_count();
|
||||
const char *xc_get_op_type(zend_uchar op_type);
|
||||
zend_uchar xc_get_data_type_count();
|
||||
const char *xc_get_data_type(zend_uchar data_type);
|
||||
zend_uchar xc_get_opcode_count();
|
||||
const char *xc_get_opcode(zend_uchar opcode);
|
|
@ -0,0 +1,116 @@
|
|||
/* size = 112 */
|
||||
static const char *const xc_opcode_names[] = {
|
||||
/* 0 */ "NOP",
|
||||
/* 1 */ "ADD",
|
||||
/* 2 */ "SUB",
|
||||
/* 3 */ "MUL",
|
||||
/* 4 */ "DIV",
|
||||
/* 5 */ "MOD",
|
||||
/* 6 */ "SL",
|
||||
/* 7 */ "SR",
|
||||
/* 8 */ "CONCAT",
|
||||
/* 9 */ "BW_OR",
|
||||
/* 10 */ "BW_AND",
|
||||
/* 11 */ "BW_XOR",
|
||||
/* 12 */ "BW_NOT",
|
||||
/* 13 */ "BOOL_NOT",
|
||||
/* 14 */ "BOOL_XOR",
|
||||
/* 15 */ "IS_IDENTICAL",
|
||||
/* 16 */ "IS_NOT_IDENTICAL",
|
||||
/* 17 */ "IS_EQUAL",
|
||||
/* 18 */ "IS_NOT_EQUAL",
|
||||
/* 19 */ "IS_SMALLER",
|
||||
/* 20 */ "IS_SMALLER_OR_EQUAL",
|
||||
/* 21 */ "CAST",
|
||||
/* 22 */ "QM_ASSIGN",
|
||||
/* 23 */ "ASSIGN_ADD",
|
||||
/* 24 */ "ASSIGN_SUB",
|
||||
/* 25 */ "ASSIGN_MUL",
|
||||
/* 26 */ "ASSIGN_DIV",
|
||||
/* 27 */ "ASSIGN_MOD",
|
||||
/* 28 */ "ASSIGN_SL",
|
||||
/* 29 */ "ASSIGN_SR",
|
||||
/* 30 */ "ASSIGN_CONCAT",
|
||||
/* 31 */ "ASSIGN_BW_OR",
|
||||
/* 32 */ "ASSIGN_BW_AND",
|
||||
/* 33 */ "ASSIGN_BW_XOR",
|
||||
/* 34 */ "PRE_INC",
|
||||
/* 35 */ "PRE_DEC",
|
||||
/* 36 */ "POST_INC",
|
||||
/* 37 */ "POST_DEC",
|
||||
/* 38 */ "ASSIGN",
|
||||
/* 39 */ "ASSIGN_REF",
|
||||
/* 40 */ "ECHO",
|
||||
/* 41 */ "PRINT",
|
||||
/* 42 */ "JMP",
|
||||
/* 43 */ "JMPZ",
|
||||
/* 44 */ "JMPNZ",
|
||||
/* 45 */ "JMPZNZ",
|
||||
/* 46 */ "JMPZ_EX",
|
||||
/* 47 */ "JMPNZ_EX",
|
||||
/* 48 */ "CASE",
|
||||
/* 49 */ "SWITCH_FREE",
|
||||
/* 50 */ "BRK",
|
||||
/* 51 */ "CONT",
|
||||
/* 52 */ "BOOL",
|
||||
/* 53 */ "INIT_STRING",
|
||||
/* 54 */ "ADD_CHAR",
|
||||
/* 55 */ "ADD_STRING",
|
||||
/* 56 */ "ADD_VAR",
|
||||
/* 57 */ "BEGIN_SILENCE",
|
||||
/* 58 */ "END_SILENCE",
|
||||
/* 59 */ "INIT_FCALL_BY_NAME",
|
||||
/* 60 */ "DO_FCALL",
|
||||
/* 61 */ "DO_FCALL_BY_NAME",
|
||||
/* 62 */ "RETURN",
|
||||
/* 63 */ "RECV",
|
||||
/* 64 */ "RECV_INIT",
|
||||
/* 65 */ "SEND_VAL",
|
||||
/* 66 */ "SEND_VAR",
|
||||
/* 67 */ "SEND_REF",
|
||||
/* 68 */ "NEW",
|
||||
/* 69 */ "JMP_NO_CTOR",
|
||||
/* 70 */ "FREE",
|
||||
/* 71 */ "INIT_ARRAY",
|
||||
/* 72 */ "ADD_ARRAY_ELEMENT",
|
||||
/* 73 */ "INCLUDE_OR_EVAL",
|
||||
/* 74 */ "UNSET_VAR",
|
||||
/* 75 */ "UNSET_DIM_OBJ",
|
||||
/* 76 */ "ISSET_ISEMPTY",
|
||||
/* 77 */ "FE_RESET",
|
||||
/* 78 */ "FE_FETCH",
|
||||
/* 79 */ "EXIT",
|
||||
/* 80 */ "FETCH_R",
|
||||
/* 81 */ "FETCH_DIM_R",
|
||||
/* 82 */ "FETCH_OBJ_R",
|
||||
/* 83 */ "FETCH_W",
|
||||
/* 84 */ "FETCH_DIM_W",
|
||||
/* 85 */ "FETCH_OBJ_W",
|
||||
/* 86 */ "FETCH_RW",
|
||||
/* 87 */ "FETCH_DIM_RW",
|
||||
/* 88 */ "FETCH_OBJ_RW",
|
||||
/* 89 */ "FETCH_IS",
|
||||
/* 90 */ "FETCH_DIM_IS",
|
||||
/* 91 */ "FETCH_OBJ_IS",
|
||||
/* 92 */ "FETCH_FUNC_ARG",
|
||||
/* 93 */ "FETCH_DIM_FUNC_ARG",
|
||||
/* 94 */ "FETCH_OBJ_FUNC_ARG",
|
||||
/* 95 */ "FETCH_UNSET",
|
||||
/* 96 */ "FETCH_DIM_UNSET",
|
||||
/* 97 */ "FETCH_OBJ_UNSET",
|
||||
/* 98 */ "FETCH_DIM_TMP_VAR",
|
||||
/* 99 */ "FETCH_CONSTANT",
|
||||
/* 100 */ "DECLARE_FUNCTION_OR_CLASS",
|
||||
/* 101 */ "EXT_STMT",
|
||||
/* 102 */ "EXT_FCALL_BEGIN",
|
||||
/* 103 */ "EXT_FCALL_END",
|
||||
/* 104 */ "EXT_NOP",
|
||||
/* 105 */ "TICKS",
|
||||
/* 106 */ "SEND_VAR_NO_REF",
|
||||
/* 107 */ "UNDEF",
|
||||
/* 108 */ "UNDEF",
|
||||
/* 109 */ "UNDEF",
|
||||
/* 110 */ "DO_FCALL_BY_FUNC",
|
||||
/* 111 */ "INIT_FCALL_BY_FUNC",
|
||||
/* 112 */ "UNDEF"
|
||||
};
|
|
@ -0,0 +1,153 @@
|
|||
/* size = 149 */
|
||||
static const char *const xc_opcode_names[] = {
|
||||
/* 0 */ "NOP",
|
||||
/* 1 */ "ADD",
|
||||
/* 2 */ "SUB",
|
||||
/* 3 */ "MUL",
|
||||
/* 4 */ "DIV",
|
||||
/* 5 */ "MOD",
|
||||
/* 6 */ "SL",
|
||||
/* 7 */ "SR",
|
||||
/* 8 */ "CONCAT",
|
||||
/* 9 */ "BW_OR",
|
||||
/* 10 */ "BW_AND",
|
||||
/* 11 */ "BW_XOR",
|
||||
/* 12 */ "BW_NOT",
|
||||
/* 13 */ "BOOL_NOT",
|
||||
/* 14 */ "BOOL_XOR",
|
||||
/* 15 */ "IS_IDENTICAL",
|
||||
/* 16 */ "IS_NOT_IDENTICAL",
|
||||
/* 17 */ "IS_EQUAL",
|
||||
/* 18 */ "IS_NOT_EQUAL",
|
||||
/* 19 */ "IS_SMALLER",
|
||||
/* 20 */ "IS_SMALLER_OR_EQUAL",
|
||||
/* 21 */ "CAST",
|
||||
/* 22 */ "QM_ASSIGN",
|
||||
/* 23 */ "ASSIGN_ADD",
|
||||
/* 24 */ "ASSIGN_SUB",
|
||||
/* 25 */ "ASSIGN_MUL",
|
||||
/* 26 */ "ASSIGN_DIV",
|
||||
/* 27 */ "ASSIGN_MOD",
|
||||
/* 28 */ "ASSIGN_SL",
|
||||
/* 29 */ "ASSIGN_SR",
|
||||
/* 30 */ "ASSIGN_CONCAT",
|
||||
/* 31 */ "ASSIGN_BW_OR",
|
||||
/* 32 */ "ASSIGN_BW_AND",
|
||||
/* 33 */ "ASSIGN_BW_XOR",
|
||||
/* 34 */ "PRE_INC",
|
||||
/* 35 */ "PRE_DEC",
|
||||
/* 36 */ "POST_INC",
|
||||
/* 37 */ "POST_DEC",
|
||||
/* 38 */ "ASSIGN",
|
||||
/* 39 */ "ASSIGN_REF",
|
||||
/* 40 */ "ECHO",
|
||||
/* 41 */ "PRINT",
|
||||
/* 42 */ "JMP",
|
||||
/* 43 */ "JMPZ",
|
||||
/* 44 */ "JMPNZ",
|
||||
/* 45 */ "JMPZNZ",
|
||||
/* 46 */ "JMPZ_EX",
|
||||
/* 47 */ "JMPNZ_EX",
|
||||
/* 48 */ "CASE",
|
||||
/* 49 */ "SWITCH_FREE",
|
||||
/* 50 */ "BRK",
|
||||
/* 51 */ "CONT",
|
||||
/* 52 */ "BOOL",
|
||||
/* 53 */ "INIT_STRING",
|
||||
/* 54 */ "ADD_CHAR",
|
||||
/* 55 */ "ADD_STRING",
|
||||
/* 56 */ "ADD_VAR",
|
||||
/* 57 */ "BEGIN_SILENCE",
|
||||
/* 58 */ "END_SILENCE",
|
||||
/* 59 */ "INIT_FCALL_BY_NAME",
|
||||
/* 60 */ "DO_FCALL",
|
||||
/* 61 */ "DO_FCALL_BY_NAME",
|
||||
/* 62 */ "RETURN",
|
||||
/* 63 */ "RECV",
|
||||
/* 64 */ "RECV_INIT",
|
||||
/* 65 */ "SEND_VAL",
|
||||
/* 66 */ "SEND_VAR",
|
||||
/* 67 */ "SEND_REF",
|
||||
/* 68 */ "NEW",
|
||||
/* 69 */ "JMP_NO_CTOR",
|
||||
/* 70 */ "FREE",
|
||||
/* 71 */ "INIT_ARRAY",
|
||||
/* 72 */ "ADD_ARRAY_ELEMENT",
|
||||
/* 73 */ "INCLUDE_OR_EVAL",
|
||||
/* 74 */ "UNSET_VAR",
|
||||
/* 75 */ "UNSET_DIM_OBJ",
|
||||
/* 76 */ "UNDEF",
|
||||
/* 77 */ "FE_RESET",
|
||||
/* 78 */ "FE_FETCH",
|
||||
/* 79 */ "EXIT",
|
||||
/* 80 */ "FETCH_R",
|
||||
/* 81 */ "FETCH_DIM_R",
|
||||
/* 82 */ "FETCH_OBJ_R",
|
||||
/* 83 */ "FETCH_W",
|
||||
/* 84 */ "FETCH_DIM_W",
|
||||
/* 85 */ "FETCH_OBJ_W",
|
||||
/* 86 */ "FETCH_RW",
|
||||
/* 87 */ "FETCH_DIM_RW",
|
||||
/* 88 */ "FETCH_OBJ_RW",
|
||||
/* 89 */ "FETCH_IS",
|
||||
/* 90 */ "FETCH_DIM_IS",
|
||||
/* 91 */ "FETCH_OBJ_IS",
|
||||
/* 92 */ "FETCH_FUNC_ARG",
|
||||
/* 93 */ "FETCH_DIM_FUNC_ARG",
|
||||
/* 94 */ "FETCH_OBJ_FUNC_ARG",
|
||||
/* 95 */ "FETCH_UNSET",
|
||||
/* 96 */ "FETCH_DIM_UNSET",
|
||||
/* 97 */ "FETCH_OBJ_UNSET",
|
||||
/* 98 */ "FETCH_DIM_TMP_VAR",
|
||||
/* 99 */ "FETCH_CONSTANT",
|
||||
/* 100 */ "UNDEF",
|
||||
/* 101 */ "EXT_STMT",
|
||||
/* 102 */ "EXT_FCALL_BEGIN",
|
||||
/* 103 */ "EXT_FCALL_END",
|
||||
/* 104 */ "EXT_NOP",
|
||||
/* 105 */ "TICKS",
|
||||
/* 106 */ "SEND_VAR_NO_REF",
|
||||
/* 107 */ "CATCH",
|
||||
/* 108 */ "THROW",
|
||||
/* 109 */ "FETCH_CLASS",
|
||||
/* 110 */ "CLONE",
|
||||
/* 111 */ "INIT_CTOR_CALL",
|
||||
/* 112 */ "INIT_METHOD_CALL",
|
||||
/* 113 */ "INIT_STATIC_METHOD_CALL",
|
||||
/* 114 */ "ISSET_ISEMPTY_VAR",
|
||||
/* 115 */ "ISSET_ISEMPTY_DIM_OBJ",
|
||||
/* 116 */ "UNDEF",
|
||||
/* 117 */ "UNDEF",
|
||||
/* 118 */ "UNDEF",
|
||||
/* 119 */ "UNDEF",
|
||||
/* 120 */ "UNDEF",
|
||||
/* 121 */ "UNDEF",
|
||||
/* 122 */ "UNDEF",
|
||||
/* 123 */ "UNDEF",
|
||||
/* 124 */ "UNDEF",
|
||||
/* 125 */ "UNDEF",
|
||||
/* 126 */ "UNDEF",
|
||||
/* 127 */ "UNDEF",
|
||||
/* 128 */ "UNDEF",
|
||||
/* 129 */ "UNDEF",
|
||||
/* 130 */ "UNDEF",
|
||||
/* 131 */ "UNDEF",
|
||||
/* 132 */ "PRE_INC_OBJ",
|
||||
/* 133 */ "PRE_DEC_OBJ",
|
||||
/* 134 */ "POST_INC_OBJ",
|
||||
/* 135 */ "POST_DEC_OBJ",
|
||||
/* 136 */ "ASSIGN_OBJ",
|
||||
/* 137 */ "OP_DATA",
|
||||
/* 138 */ "INSTANCEOF",
|
||||
/* 139 */ "DECLARE_CLASS",
|
||||
/* 140 */ "DECLARE_INHERITED_CLASS",
|
||||
/* 141 */ "DECLARE_FUNCTION",
|
||||
/* 142 */ "RAISE_ABSTRACT_ERROR",
|
||||
/* 143 */ "UNDEF",
|
||||
/* 144 */ "ADD_INTERFACE",
|
||||
/* 145 */ "UNDEF",
|
||||
/* 146 */ "VERIFY_ABSTRACT_CLASS",
|
||||
/* 147 */ "ASSIGN_DIM",
|
||||
/* 148 */ "ISSET_ISEMPTY_PROP_OBJ",
|
||||
/* 149 */ "HANDLE_EXCEPTION"
|
||||
};
|
|
@ -0,0 +1,154 @@
|
|||
/* size = 150 */
|
||||
static const char *const xc_opcode_names[] = {
|
||||
/* 0 */ "NOP",
|
||||
/* 1 */ "ADD",
|
||||
/* 2 */ "SUB",
|
||||
/* 3 */ "MUL",
|
||||
/* 4 */ "DIV",
|
||||
/* 5 */ "MOD",
|
||||
/* 6 */ "SL",
|
||||
/* 7 */ "SR",
|
||||
/* 8 */ "CONCAT",
|
||||
/* 9 */ "BW_OR",
|
||||
/* 10 */ "BW_AND",
|
||||
/* 11 */ "BW_XOR",
|
||||
/* 12 */ "BW_NOT",
|
||||
/* 13 */ "BOOL_NOT",
|
||||
/* 14 */ "BOOL_XOR",
|
||||
/* 15 */ "IS_IDENTICAL",
|
||||
/* 16 */ "IS_NOT_IDENTICAL",
|
||||
/* 17 */ "IS_EQUAL",
|
||||
/* 18 */ "IS_NOT_EQUAL",
|
||||
/* 19 */ "IS_SMALLER" |