| [1] | 1 | #include "xcache.h" |
|---|
| 2 | #include "const_string.h" |
|---|
| 3 | |
|---|
| 4 | /* {{{ xc_get_op_type */ |
|---|
| 5 | static const char *const op_type_names[] = { |
|---|
| 6 | /* 0 */ "NULL?", |
|---|
| 7 | /* 1 */ "IS_CONST", |
|---|
| 8 | /* 2 */ "IS_TMP_VAR", |
|---|
| 9 | /* 3 */ NULL, |
|---|
| 10 | /* 4 */ "IS_VAR", |
|---|
| 11 | /* 5 */ NULL, |
|---|
| 12 | /* 6 */ NULL, |
|---|
| 13 | /* 7 */ NULL, |
|---|
| 14 | /* 8 */ "IS_UNUSED", |
|---|
| 15 | #ifdef IS_CV |
|---|
| 16 | /* 9 */ NULL, |
|---|
| 17 | /* 10 */ NULL, |
|---|
| 18 | /* 11 */ NULL, |
|---|
| 19 | /* 12 */ NULL, |
|---|
| 20 | /* 13 */ NULL, |
|---|
| 21 | /* 14 */ NULL, |
|---|
| 22 | /* 15 */ NULL, |
|---|
| 23 | /* 16 */ "IS_CV" |
|---|
| 24 | #endif |
|---|
| 25 | }; |
|---|
| 26 | |
|---|
| [20] | 27 | zend_uchar xc_get_op_type_count() |
|---|
| [1] | 28 | { |
|---|
| 29 | return sizeof(op_type_names) / sizeof(op_type_names[0]); |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | const char *xc_get_op_type(zend_uchar op_type) |
|---|
| 33 | { |
|---|
| 34 | assert(op_type < xc_get_op_type_count()); |
|---|
| 35 | return op_type_names[op_type]; |
|---|
| 36 | } |
|---|
| 37 | /* }}} */ |
|---|
| 38 | /* {{{ xc_get_data_type */ |
|---|
| 39 | static const char *const data_type_names[] = { |
|---|
| 40 | /* 0 */ "IS_NULL", |
|---|
| 41 | /* 1 */ "IS_LONG", |
|---|
| 42 | /* 2 */ "IS_DOUBLE", |
|---|
| 43 | /* 3 */ "IS_BOOL", |
|---|
| 44 | /* 4 */ "IS_ARRAY", |
|---|
| 45 | /* 5 */ "IS_OBJECT", |
|---|
| 46 | /* 6 */ "IS_STRING", |
|---|
| 47 | /* 7 */ "IS_RESOURCE", |
|---|
| 48 | /* 8 */ "IS_CONSTANT", |
|---|
| 49 | /* 9 */ "IS_CONSTANT_ARRAY", |
|---|
| [491] | 50 | /* 10 */ "IS_UNICODE" |
|---|
| [1] | 51 | }; |
|---|
| 52 | |
|---|
| [20] | 53 | zend_uchar xc_get_data_type_count() |
|---|
| [1] | 54 | { |
|---|
| 55 | return sizeof(data_type_names) / sizeof(data_type_names[0]); |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | const char *xc_get_data_type(zend_uchar data_type) |
|---|
| 59 | { |
|---|
| [491] | 60 | return data_type_names[(data_type & IS_CONSTANT_TYPE_MASK)]; |
|---|
| [1] | 61 | } |
|---|
| 62 | /* }}} */ |
|---|
| 63 | /* {{{ xc_get_opcode */ |
|---|
| [51] | 64 | #if PHP_MAJOR_VERSION >= 6 |
|---|
| [485] | 65 | # include "const_string_opcodes_php6.x.h" |
|---|
| [821] | 66 | #elif defined(ZEND_ENGINE_2_4) |
|---|
| 67 | # include "const_string_opcodes_php5.4.h" |
|---|
| [485] | 68 | #elif defined(ZEND_ENGINE_2_1) |
|---|
| 69 | # include "const_string_opcodes_php5.1.h" |
|---|
| 70 | #elif defined(ZEND_ENGINE_2) |
|---|
| 71 | # include "const_string_opcodes_php5.0.h" |
|---|
| [508] | 72 | #else |
|---|
| 73 | # include "const_string_opcodes_php4.x.h" |
|---|
| [1] | 74 | #endif |
|---|
| 75 | |
|---|
| [20] | 76 | zend_uchar xc_get_opcode_count() |
|---|
| [1] | 77 | { |
|---|
| 78 | return sizeof(xc_opcode_names) / sizeof(xc_opcode_names[0]); |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | const char *xc_get_opcode(zend_uchar opcode) |
|---|
| 82 | { |
|---|
| 83 | assert(opcode < xc_get_opcode_count()); |
|---|
| 84 | return xc_opcode_names[opcode]; |
|---|
| 85 | } |
|---|
| 86 | /* }}} */ |
|---|