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.

54 lines
1.9 KiB

  1. #include "php.h"
  2. typedef struct {
  3. int alloc;
  4. zend_op_array *op_array;
  5. HashTable *function_table;
  6. HashTable *class_table;
  7. } xc_compile_result_t;
  8. xc_compile_result_t *xc_compile_result_init(xc_compile_result_t *cr,
  9. zend_op_array *op_array,
  10. HashTable *function_table,
  11. HashTable *class_table);
  12. void xc_compile_result_free(xc_compile_result_t *cr);
  13. xc_compile_result_t *xc_compile_result_init_cur(xc_compile_result_t *cr, zend_op_array *op_array TSRMLS_DC);
  14. /* apply func */
  15. int xc_apply_function(zend_function *zf, apply_func_t applyer TSRMLS_DC);
  16. int xc_apply_class(zend_class_entry *ce, apply_func_t applyer TSRMLS_DC);
  17. int xc_apply_op_array(xc_compile_result_t *cr, apply_func_t applyer TSRMLS_DC);
  18. int xc_undo_pass_two(zend_op_array *op_array TSRMLS_DC);
  19. int xc_redo_pass_two(zend_op_array *op_array TSRMLS_DC);
  20. int xc_fix_opcode(zend_op_array *op_array TSRMLS_DC);
  21. int xc_undo_fix_opcode(zend_op_array *op_array TSRMLS_DC);
  22. zend_uchar xc_get_fixed_opcode(zend_uchar opcode, int line);
  23. /* installer */
  24. #ifdef HAVE_XCACHE_CONSTANT
  25. void xc_install_constant(char *filename, zend_constant *constant, zend_uchar type, zstr key, uint len TSRMLS_DC);
  26. #endif
  27. void xc_install_function(char *filename, zend_function *func, zend_uchar type, zstr key, uint len TSRMLS_DC);
  28. ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, zend_uchar type, zstr key, uint len TSRMLS_DC);
  29. /* sandbox */
  30. typedef struct {
  31. int alloc;
  32. int orig_user_error_handler_error_reporting;
  33. char *filename;
  34. HashTable orig_included_files;
  35. HashTable *tmp_included_files;
  36. #ifdef HAVE_XCACHE_CONSTANT
  37. HashTable *orig_zend_constants;
  38. HashTable tmp_zend_constants;
  39. #endif
  40. HashTable *orig_function_table;
  41. HashTable *orig_class_table;
  42. HashTable tmp_function_table;
  43. HashTable tmp_class_table;
  44. } xc_sandbox_t;
  45. xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC);
  46. void xc_sandbox_free(xc_sandbox_t *sandbox, int install TSRMLS_DC);