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.
 
 
 
 
 
 

47 lines
1.2 KiB

  1. #include "xcache.h"
  2. #include "xc_opcode_spec.h"
  3. #include "xc_const_string.h"
  4. /* {{{ opcode_spec */
  5. #define OPSPEC(ext, op1, op2, res) { OPSPEC_##ext, OPSPEC_##op1, OPSPEC_##op2, OPSPEC_##res },
  6. #ifdef ZEND_ENGINE_2
  7. # define OPSPEC_VAR_2 OPSPEC_STD
  8. #else
  9. # define OPSPEC_VAR_2 OPSPEC_VAR
  10. #endif
  11. #include "xc_opcode_spec_def.h"
  12. zend_uchar xc_get_opcode_spec_count()
  13. {
  14. return sizeof(xc_opcode_spec) / sizeof(xc_opcode_spec[0]);
  15. }
  16. const xc_opcode_spec_t *xc_get_opcode_spec(zend_uchar opcode)
  17. {
  18. #ifndef NDEBUG
  19. if (xc_get_opcode_count() != xc_get_opcode_spec_count()) {
  20. 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());
  21. }
  22. #endif
  23. assert(xc_get_opcode_count() == xc_get_opcode_spec_count());
  24. assert(opcode < xc_get_opcode_spec_count());
  25. return &xc_opcode_spec[opcode];
  26. }
  27. /* }}} */
  28. /* {{{ op_spec */
  29. #define OPSPECS_DEF_NAME(name) #name,
  30. static const char *xc_op_spec[] = { OPSPECS(OPSPECS_DEF_NAME) };
  31. zend_uchar xc_get_op_spec_count()
  32. {
  33. return sizeof(xc_op_spec) / sizeof(xc_op_spec[0]);
  34. }
  35. const char *xc_get_op_spec(zend_uchar spec)
  36. {
  37. assert(spec < xc_get_op_spec_count());
  38. return xc_op_spec[spec];
  39. }
  40. /* }}} */