source: trunk/xcache/xc_opcode_spec.c @ 1306

Last change on this file since 1306 was 1306, checked in by moo, 13 months ago

Decompiler, disassembler: fix catch for different PHP version; fetch hack is not necessary for PHP5.4+; update for ?: operator

  • Property svn:eol-style set to native
File size: 1.2 KB
RevLine 
[1]1#include "xcache.h"
[982]2#include "xc_opcode_spec.h"
3#include "xc_const_string.h"
[1]4
5/* {{{ opcode_spec */
6#define OPSPEC(ext, op1, op2, res) { OPSPEC_##ext, OPSPEC_##op1, OPSPEC_##op2, OPSPEC_##res },
[1281]7#define OPSPEC_VAR_2 OPSPEC_STD
[1306]8#ifdef ZEND_ENGINE_2_4
9#undef OPSPEC_FETCH
10#define OPSPEC_FETCH OPSPEC_STD
11#endif
[982]12#include "xc_opcode_spec_def.h"
[1]13
[20]14zend_uchar xc_get_opcode_spec_count()
[1]15{
16    return sizeof(xc_opcode_spec) / sizeof(xc_opcode_spec[0]);
17}
18
19const xc_opcode_spec_t *xc_get_opcode_spec(zend_uchar opcode)
20{
[718]21#ifndef NDEBUG
22    if (xc_get_opcode_count() != xc_get_opcode_spec_count()) {
23        fprintf(stderr, "count mismatch: xc_get_opcode_count=%d, xc_get_opcode_spec_count=%d\n", xc_get_opcode_count(), xc_get_opcode_spec_count());
24    }
25#endif
[1]26    assert(xc_get_opcode_count() == xc_get_opcode_spec_count());
27    assert(opcode < xc_get_opcode_spec_count());
28    return &xc_opcode_spec[opcode];
29}
30/* }}} */
31/* {{{ op_spec */
32
33#define OPSPECS_DEF_NAME(name) #name,
34static const char *xc_op_spec[] = { OPSPECS(OPSPECS_DEF_NAME) };
35
[20]36zend_uchar xc_get_op_spec_count()
[1]37{
38    return sizeof(xc_op_spec) / sizeof(xc_op_spec[0]);
39}
40
41const char *xc_get_op_spec(zend_uchar spec)
42{
43    assert(spec < xc_get_op_spec_count());
44    return xc_op_spec[spec];
45}
46/* }}} */
Note: See TracBrowser for help on using the repository browser.