XCache is a fast, stable PHP opcode cacher that has been proven and is now running on production servers under high load. https://xcache.lighttpd.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
2.3 KiB

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