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.

49 lines
1.7 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. void xc_install_function(char *filename, zend_function *func, zend_uchar type, char *key, uint len TSRMLS_DC);
  25. ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, zend_uchar type, void *key, uint len TSRMLS_DC);
  26. /* sandbox */
  27. typedef struct {
  28. int alloc;
  29. int orig_user_error_handler_error_reporting;
  30. char *filename;
  31. HashTable orig_included_files;
  32. zend_llist orig_open_files;
  33. HashTable *tmp_included_files;
  34. zend_llist *tmp_open_files;
  35. HashTable *orig_function_table;
  36. HashTable *orig_class_table;
  37. HashTable tmp_function_table;
  38. HashTable tmp_class_table;
  39. } xc_sandbox_t;
  40. xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC);
  41. void xc_sandbox_free(xc_sandbox_t *sandbox, int install TSRMLS_DC);