Browse Source

Decompiler, disassembler: update PHP 5.0 support

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1314 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.1
Xuefer 8 years ago
parent
commit
63c0a0aa24
  1. 20
      lib/Decompiler.class.php
  2. 4
      xcache/xc_utils.c

20
lib/Decompiler.class.php

@ -262,18 +262,18 @@ class Decompiler_Fetch extends Decompiler_Code // {{{
public $src;
public $fetchType;
function Decompiler_Fetch($src, $type, $globalsrc)
function Decompiler_Fetch($src, $type, $globalSrc)
{
$this->src = $src;
$this->fetchType = $type;
$this->globalsrc = $globalsrc;
$this->globalSrc = $globalSrc;
}
function toCode($indent)
{
switch ($this->fetchType) {
case ZEND_FETCH_LOCAL:
return '$' . substr($this->src, 1, -1);
return '$' . $this->src;
case ZEND_FETCH_STATIC:
if (ZEND_ENGINE_2_3) {
// closure local variable?
@ -282,7 +282,7 @@ class Decompiler_Fetch extends Decompiler_Code // {{{
die('static fetch cant to string');
case ZEND_FETCH_GLOBAL:
case ZEND_FETCH_GLOBAL_LOCK:
return $this->globalsrc;
return $this->globalSrc;
default:
var_dump($this->fetchType);
assert(0);
@ -1259,6 +1259,7 @@ class Decompiler
} while ($j <= $blockLast);
if (!assert('$blockLast <= $range[1]')) {
var_dump($blockLast, $range[1]);
printBacktrace();
}
if ($blockLast >= $blockFirst) {
@ -1558,9 +1559,9 @@ class Decompiler
$rvalue = $this->stripNamespace($class) . '::$' . $name;
}
else {
$rvalue = $this->getOpVal($op1, $EX);
$globalname = xcache_is_autoglobal($name) ? "\$$name" : "\$GLOBALS[" . str($rvalue) . "]";
$rvalue = new Decompiler_Fetch($rvalue, $fetchType, $globalname);
$rvalue = isset($op1['constant']) ? $op1['constant'] : $this->getOpVal($op1, $EX);
$globalName = xcache_is_autoglobal($name) ? "\$$name" : "\$GLOBALS[" . $this->getOpVal($op1, $EX) . "]";
$rvalue = new Decompiler_Fetch($rvalue, $fetchType, $globalName);
}
if ($res['op_type'] != XC_IS_UNUSED) {
@ -1591,7 +1592,6 @@ class Decompiler
case XC_FETCH_DIM_UNSET:
case XC_FETCH_DIM_IS:
case XC_ASSIGN_DIM:
case XC_UNSET_DIM_OBJ: // PHP 4 only
case XC_UNSET_DIM:
case XC_UNSET_OBJ:
$src = $this->getOpVal($op1, $EX);
@ -2881,7 +2881,9 @@ foreach (array (
'XC_JMP_SET' => -1,
'XC_JMP_SET_VAR' => -1,
'XC_QM_ASSIGN_VAR' => -1,
'XC_UNSET_DIM_OBJ' => -1,
'XC_UNSET_DIM' => -1,
'XC_UNSET_OBJ' => -1,
'XC_USER_OPCODE' => -1,
) as $k => $v) {
if (!defined($k)) {
define($k, $v);

4
xcache/xc_utils.c

@ -130,7 +130,6 @@ int xc_undo_pass_two(zend_op_array *op_array TSRMLS_DC) /* {{{ */
}
#endif
#ifdef ZEND_ENGINE_2_1
switch (opline->opcode) {
#ifdef ZEND_GOTO
case ZEND_GOTO:
@ -156,7 +155,6 @@ int xc_undo_pass_two(zend_op_array *op_array TSRMLS_DC) /* {{{ */
Z_OP(opline->op2).opline_num = Z_OP(opline->op2).jmp_addr - op_array->opcodes;
break;
}
#endif
opline++;
}
#ifdef ZEND_ENGINE_2_4
@ -220,7 +218,6 @@ int xc_redo_pass_two(zend_op_array *op_array TSRMLS_DC) /* {{{ */
Z_SET_REFCOUNT(Z_OP_CONSTANT(opline->op2), 2);
}
#endif
#ifdef ZEND_ENGINE_2_1
switch (opline->opcode) {
#ifdef ZEND_GOTO
case ZEND_GOTO:
@ -247,7 +244,6 @@ int xc_redo_pass_two(zend_op_array *op_array TSRMLS_DC) /* {{{ */
break;
}
/* ZEND_VM_SET_OPCODE_HANDLER(opline); this is not undone, don't redo. only do this for loader */
#endif
opline++;
}

Loading…
Cancel
Save