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.
 
 
 
 
 
 

78 lines
1.3 KiB

  1. #! /usr/bin/awk -f
  2. # vim:ts=4:sw=4
  3. # process zend_vm_def.h or zend_compile.h
  4. BEGIN {
  5. FS=" "
  6. max = 0;
  7. }
  8. /^ZEND_VM_HANDLER\(/ {
  9. # regex from php5.1+/Zend/zend_vm_gen.php
  10. gsub(/ +/, "");
  11. if (!match($0, /^ZEND_VM_HANDLER\(([0-9]+),([A-Z_]+),([A-Z|]+),([A-Z|]+)\)/)) {
  12. print "error unmatch $0";
  13. exit;
  14. }
  15. # life is hard without 3rd argument of match()
  16. sub(/^ZEND_VM_HANDLER\(/, "");
  17. id = $0;
  18. sub(/,.*/, "", id); # chop
  19. id = 0 + id;
  20. sub(/^([0-9]+),/, "");
  21. sub(/,.*/, ""); # chop
  22. name = $0;
  23. if (max < id) {
  24. max = id;
  25. }
  26. opcodes[id] = name;
  27. next;
  28. }
  29. /^#define +ZEND_[A-Z_]+[\t ]+[[:digit:]]+$/ {
  30. id = 0 + $3;
  31. name = $2;
  32. if (max < id) {
  33. max = id;
  34. }
  35. opcodes[id] = name;
  36. next;
  37. }
  38. /end of block/ {
  39. exit;
  40. }
  41. END {
  42. mymax = 112;
  43. if (max < mymax) {
  44. for (i = max + 1; i <= mymax; i ++) {
  45. opcodes[i] = "UNDEF";
  46. }
  47. max = mymax;
  48. opcodes[110] = "ZEND_DO_FCALL_BY_FUNC";
  49. opcodes[111] = "ZEND_INIT_FCALL_BY_FUNC";
  50. opcodes[112] = "UNDEF";
  51. }
  52. printf "/* size = %d */\n", max + 1;
  53. print "static const char *const xc_opcode_names[] = {";
  54. for (i = 0; i <= max; i ++) {
  55. if (i != 0) {
  56. print ",";
  57. }
  58. printf "/* %d */\t", i
  59. if (i in opcodes) {
  60. name = opcodes[i];
  61. sub(/^ZEND_/, "", name);
  62. printf "\"%s\"", name;
  63. }
  64. else if (i == 137) {
  65. printf "\"%s\"", "OP_DATA";
  66. }
  67. else {
  68. printf "\"UNDEF\"";
  69. }
  70. }
  71. print "";
  72. print "};";
  73. }