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.

43 lines
1019 B

  1. #include "xcache.h"
  2. #include "opcode_spec.h"
  3. #include "const_string.h"
  4. #ifdef HAVE_XCACHE_OPCODE_SPEC_DEF
  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
  12. #include "opcode_spec_def.h"
  13. zend_uchar xc_get_opcode_spec_count()
  14. {
  15. return sizeof(xc_opcode_spec) / sizeof(xc_opcode_spec[0]);
  16. }
  17. const xc_opcode_spec_t *xc_get_opcode_spec(zend_uchar opcode)
  18. {
  19. assert(xc_get_opcode_count() == xc_get_opcode_spec_count());
  20. assert(opcode < xc_get_opcode_spec_count());
  21. return &xc_opcode_spec[opcode];
  22. }
  23. /* }}} */
  24. #endif
  25. /* {{{ op_spec */
  26. #define OPSPECS_DEF_NAME(name) #name,
  27. static const char *xc_op_spec[] = { OPSPECS(OPSPECS_DEF_NAME) };
  28. zend_uchar xc_get_op_spec_count()
  29. {
  30. return sizeof(xc_op_spec) / sizeof(xc_op_spec[0]);
  31. }
  32. const char *xc_get_op_spec(zend_uchar spec)
  33. {
  34. assert(spec < xc_get_op_spec_count());
  35. return xc_op_spec[spec];
  36. }
  37. /* }}} */