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.
 
 
 
 
 
 

87 lines
1.8 KiB

  1. #include "xcache.h"
  2. #include "xc_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. };
  49. zend_uchar xc_get_data_type_count()
  50. {
  51. return sizeof(data_type_names) / sizeof(data_type_names[0]);
  52. }
  53. const char *xc_get_data_type(zend_uchar data_type)
  54. {
  55. return data_type_names[(data_type & IS_CONSTANT_TYPE_MASK)];
  56. }
  57. /* }}} */
  58. /* {{{ xc_get_opcode */
  59. #if PHP_MAJOR_VERSION >= 6
  60. # include "xc_const_string_opcodes_php6.x.h"
  61. #elif defined(ZEND_ENGINE_2_4)
  62. # include "xc_const_string_opcodes_php5.4.h"
  63. #elif defined(ZEND_ENGINE_2_1)
  64. # include "xc_const_string_opcodes_php5.1.h"
  65. #elif defined(ZEND_ENGINE_2)
  66. # include "xc_const_string_opcodes_php5.0.h"
  67. #else
  68. # include "xc_const_string_opcodes_php4.x.h"
  69. #endif
  70. zend_uchar xc_get_opcode_count()
  71. {
  72. return sizeof(xc_opcode_names) / sizeof(xc_opcode_names[0]);
  73. }
  74. const char *xc_get_opcode(zend_uchar opcode)
  75. {
  76. assert(opcode < xc_get_opcode_count());
  77. return xc_opcode_names[opcode];
  78. }
  79. /* }}} */