Last change
on this file since 982 was
982,
checked in by Xuefer, 6 years ago
|
move files to subdirs
|
-
Property svn:eol-style set to
native
|
File size:
1.2 KB
|
Rev | Line | |
---|
[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 }, |
---|
| 7 | #ifdef ZEND_ENGINE_2 |
---|
| 8 | # define OPSPEC_VAR_2 OPSPEC_STD |
---|
| 9 | #else |
---|
| 10 | # define OPSPEC_VAR_2 OPSPEC_VAR |
---|
| 11 | #endif |
---|
[982] | 12 | #include "xc_opcode_spec_def.h" |
---|
[1] | 13 | |
---|
[20] | 14 | zend_uchar xc_get_opcode_spec_count() |
---|
[1] | 15 | { |
---|
| 16 | return sizeof(xc_opcode_spec) / sizeof(xc_opcode_spec[0]); |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | const 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, |
---|
| 34 | static const char *xc_op_spec[] = { OPSPECS(OPSPECS_DEF_NAME) }; |
---|
| 35 | |
---|
[20] | 36 | zend_uchar xc_get_op_spec_count() |
---|
[1] | 37 | { |
---|
| 38 | return sizeof(xc_op_spec) / sizeof(xc_op_spec[0]); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | const 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.