|
Revision 726, 1.2 KB
(checked in by moo, 2 years ago)
|
|
merge from trunk
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | #include "xcache.h" |
|---|
| 2 | #include "opcode_spec.h" |
|---|
| 3 | #include "const_string.h" |
|---|
| 4 | |
|---|
| 5 | #ifdef HAVE_XCACHE_OPCODE_SPEC_DEF |
|---|
| 6 | /* {{{ opcode_spec */ |
|---|
| 7 | #define OPSPEC(ext, op1, op2, res) { OPSPEC_##ext, OPSPEC_##op1, OPSPEC_##op2, OPSPEC_##res }, |
|---|
| 8 | #ifdef ZEND_ENGINE_2 |
|---|
| 9 | # define OPSPEC_VAR_2 OPSPEC_STD |
|---|
| 10 | #else |
|---|
| 11 | # define OPSPEC_VAR_2 OPSPEC_VAR |
|---|
| 12 | #endif |
|---|
| 13 | #include "opcode_spec_def.h" |
|---|
| 14 | |
|---|
| 15 | zend_uchar xc_get_opcode_spec_count() |
|---|
| 16 | { |
|---|
| 17 | return sizeof(xc_opcode_spec) / sizeof(xc_opcode_spec[0]); |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | const xc_opcode_spec_t *xc_get_opcode_spec(zend_uchar opcode) |
|---|
| 21 | { |
|---|
| 22 | #ifndef NDEBUG |
|---|
| 23 | if (xc_get_opcode_count() != xc_get_opcode_spec_count()) { |
|---|
| 24 | 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()); |
|---|
| 25 | } |
|---|
| 26 | #endif |
|---|
| 27 | assert(xc_get_opcode_count() == xc_get_opcode_spec_count()); |
|---|
| 28 | assert(opcode < xc_get_opcode_spec_count()); |
|---|
| 29 | return &xc_opcode_spec[opcode]; |
|---|
| 30 | } |
|---|
| 31 | /* }}} */ |
|---|
| 32 | #endif |
|---|
| 33 | /* {{{ op_spec */ |
|---|
| 34 | |
|---|
| 35 | #define OPSPECS_DEF_NAME(name) #name, |
|---|
| 36 | static const char *xc_op_spec[] = { OPSPECS(OPSPECS_DEF_NAME) }; |
|---|
| 37 | |
|---|
| 38 | zend_uchar xc_get_op_spec_count() |
|---|
| 39 | { |
|---|
| 40 | return sizeof(xc_op_spec) / sizeof(xc_op_spec[0]); |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | const char *xc_get_op_spec(zend_uchar spec) |
|---|
| 44 | { |
|---|
| 45 | assert(spec < xc_get_op_spec_count()); |
|---|
| 46 | return xc_op_spec[spec]; |
|---|
| 47 | } |
|---|
| 48 | /* }}} */ |
|---|