Browse Source

decode optimized if/return

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@820 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 11 years ago
parent
commit
34db445076
  1. 14
      Decompiler.class.php
  2. 7
      phpdop.phpr

14
Decompiler.class.php

@ -905,6 +905,20 @@ class Decompiler
$this->endComplexBlock($EX);
return;
}
if ($firstOp['opcode'] == XC_JMPZ && !empty($firstOp['jmpouts'])
&& $firstOp['jmpouts'][0] - 1 == $range[1] && $opcodes[$firstOp['jmpouts'][0] - 1]['opcode'] == XC_RETURN) {
$this->beginComplexBlock($EX);
$this->removeJmpInfo($EX, $range[0]);
$condition = $this->getOpVal($opcodes[$range[0]]['op1'], $EX);
echo $indent, 'if (', str($condition, $EX), ') ', '{', PHP_EOL;
$this->beginScope($EX);
$this->recognizeAndDecompileClosedBlocks($EX, $range);
$this->endScope($EX);
echo $indent, '}', PHP_EOL;
$this->endComplexBlock($EX);
return;
}
// }}}
// {{{ try/catch
if (!empty($firstOp['jmpins']) && !empty($opcodes[$firstOp['jmpins'][0]]['isCatchBegin'])) {

7
phpdop.phpr

@ -94,7 +94,12 @@ if (!isset($argv[1])) {
die("Usage: $argv[0] <file>\n");
}
$decompiler = new Decompiler();
$pk = xcache_dasm_file($argv[1]);
if (isset($argv[2])) {
eval('$pk = ' . file_get_contents($argv[2]) . ';');
}
else {
$pk = xcache_dasm_file($argv[1]);
}
$op_array = $funcs = $classes = null;
if (isset($pk['op_array'])) {
$op_array = $pk['op_array'];

Loading…
Cancel
Save