zend_vm_opcodes.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Zend Engine |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 2.00 of the Zend license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.zend.com/license/2_00.txt. |
  11. | If you did not receive a copy of the Zend license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@zend.com so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Andi Gutmans <andi@php.net> |
  16. | Zeev Suraski <zeev@php.net> |
  17. | Dmitry Stogov <dmitry@php.net> |
  18. +----------------------------------------------------------------------+
  19. */
  20. #ifndef ZEND_VM_OPCODES_H
  21. #define ZEND_VM_OPCODES_H
  22. #define ZEND_VM_SPEC 1
  23. #define ZEND_VM_LINES 0
  24. #define ZEND_VM_KIND_CALL 1
  25. #define ZEND_VM_KIND_SWITCH 2
  26. #define ZEND_VM_KIND_GOTO 3
  27. #define ZEND_VM_KIND_HYBRID 4
  28. /* HYBRID requires support for computed GOTO and global register variables*/
  29. #if (defined(__GNUC__) && defined(HAVE_GCC_GLOBAL_REGS))
  30. # define ZEND_VM_KIND ZEND_VM_KIND_HYBRID
  31. #else
  32. # define ZEND_VM_KIND ZEND_VM_KIND_CALL
  33. #endif
  34. #if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) && !defined(__SANITIZE_ADDRESS__)
  35. # if ((defined(i386) && !defined(__PIC__)) || defined(__x86_64__) || defined(_M_X64))
  36. # define ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE 16
  37. # endif
  38. #endif
  39. #define ZEND_VM_OP_SPEC 0x00000001
  40. #define ZEND_VM_OP_CONST 0x00000002
  41. #define ZEND_VM_OP_TMPVAR 0x00000004
  42. #define ZEND_VM_OP_TMPVARCV 0x00000008
  43. #define ZEND_VM_OP_MASK 0x000000f0
  44. #define ZEND_VM_OP_NUM 0x00000010
  45. #define ZEND_VM_OP_JMP_ADDR 0x00000020
  46. #define ZEND_VM_OP_TRY_CATCH 0x00000030
  47. #define ZEND_VM_OP_THIS 0x00000050
  48. #define ZEND_VM_OP_NEXT 0x00000060
  49. #define ZEND_VM_OP_CLASS_FETCH 0x00000070
  50. #define ZEND_VM_OP_CONSTRUCTOR 0x00000080
  51. #define ZEND_VM_OP_CONST_FETCH 0x00000090
  52. #define ZEND_VM_OP_CACHE_SLOT 0x000000a0
  53. #define ZEND_VM_EXT_VAR_FETCH 0x00010000
  54. #define ZEND_VM_EXT_ISSET 0x00020000
  55. #define ZEND_VM_EXT_CACHE_SLOT 0x00040000
  56. #define ZEND_VM_EXT_ARRAY_INIT 0x00080000
  57. #define ZEND_VM_EXT_REF 0x00100000
  58. #define ZEND_VM_EXT_FETCH_REF 0x00200000
  59. #define ZEND_VM_EXT_DIM_WRITE 0x00400000
  60. #define ZEND_VM_EXT_MASK 0x0f000000
  61. #define ZEND_VM_EXT_NUM 0x01000000
  62. #define ZEND_VM_EXT_LAST_CATCH 0x02000000
  63. #define ZEND_VM_EXT_JMP_ADDR 0x03000000
  64. #define ZEND_VM_EXT_OP 0x04000000
  65. #define ZEND_VM_EXT_TYPE 0x07000000
  66. #define ZEND_VM_EXT_EVAL 0x08000000
  67. #define ZEND_VM_EXT_TYPE_MASK 0x09000000
  68. #define ZEND_VM_EXT_SRC 0x0b000000
  69. #define ZEND_VM_NO_CONST_CONST 0x40000000
  70. #define ZEND_VM_COMMUTATIVE 0x80000000
  71. #define ZEND_VM_OP1_FLAGS(flags) (flags & 0xff)
  72. #define ZEND_VM_OP2_FLAGS(flags) ((flags >> 8) & 0xff)
  73. BEGIN_EXTERN_C()
  74. ZEND_API const char* ZEND_FASTCALL zend_get_opcode_name(zend_uchar opcode);
  75. ZEND_API uint32_t ZEND_FASTCALL zend_get_opcode_flags(zend_uchar opcode);
  76. ZEND_API zend_uchar zend_get_opcode_id(const char *name, size_t length);
  77. END_EXTERN_C()
  78. #define ZEND_NOP 0
  79. #define ZEND_ADD 1
  80. #define ZEND_SUB 2
  81. #define ZEND_MUL 3
  82. #define ZEND_DIV 4
  83. #define ZEND_MOD 5
  84. #define ZEND_SL 6
  85. #define ZEND_SR 7
  86. #define ZEND_CONCAT 8
  87. #define ZEND_BW_OR 9
  88. #define ZEND_BW_AND 10
  89. #define ZEND_BW_XOR 11
  90. #define ZEND_POW 12
  91. #define ZEND_BW_NOT 13
  92. #define ZEND_BOOL_NOT 14
  93. #define ZEND_BOOL_XOR 15
  94. #define ZEND_IS_IDENTICAL 16
  95. #define ZEND_IS_NOT_IDENTICAL 17
  96. #define ZEND_IS_EQUAL 18
  97. #define ZEND_IS_NOT_EQUAL 19
  98. #define ZEND_IS_SMALLER 20
  99. #define ZEND_IS_SMALLER_OR_EQUAL 21
  100. #define ZEND_ASSIGN 22
  101. #define ZEND_ASSIGN_DIM 23
  102. #define ZEND_ASSIGN_OBJ 24
  103. #define ZEND_ASSIGN_STATIC_PROP 25
  104. #define ZEND_ASSIGN_OP 26
  105. #define ZEND_ASSIGN_DIM_OP 27
  106. #define ZEND_ASSIGN_OBJ_OP 28
  107. #define ZEND_ASSIGN_STATIC_PROP_OP 29
  108. #define ZEND_ASSIGN_REF 30
  109. #define ZEND_QM_ASSIGN 31
  110. #define ZEND_ASSIGN_OBJ_REF 32
  111. #define ZEND_ASSIGN_STATIC_PROP_REF 33
  112. #define ZEND_PRE_INC 34
  113. #define ZEND_PRE_DEC 35
  114. #define ZEND_POST_INC 36
  115. #define ZEND_POST_DEC 37
  116. #define ZEND_PRE_INC_STATIC_PROP 38
  117. #define ZEND_PRE_DEC_STATIC_PROP 39
  118. #define ZEND_POST_INC_STATIC_PROP 40
  119. #define ZEND_POST_DEC_STATIC_PROP 41
  120. #define ZEND_JMP 42
  121. #define ZEND_JMPZ 43
  122. #define ZEND_JMPNZ 44
  123. #define ZEND_JMPZNZ 45
  124. #define ZEND_JMPZ_EX 46
  125. #define ZEND_JMPNZ_EX 47
  126. #define ZEND_CASE 48
  127. #define ZEND_CHECK_VAR 49
  128. #define ZEND_SEND_VAR_NO_REF_EX 50
  129. #define ZEND_CAST 51
  130. #define ZEND_BOOL 52
  131. #define ZEND_FAST_CONCAT 53
  132. #define ZEND_ROPE_INIT 54
  133. #define ZEND_ROPE_ADD 55
  134. #define ZEND_ROPE_END 56
  135. #define ZEND_BEGIN_SILENCE 57
  136. #define ZEND_END_SILENCE 58
  137. #define ZEND_INIT_FCALL_BY_NAME 59
  138. #define ZEND_DO_FCALL 60
  139. #define ZEND_INIT_FCALL 61
  140. #define ZEND_RETURN 62
  141. #define ZEND_RECV 63
  142. #define ZEND_RECV_INIT 64
  143. #define ZEND_SEND_VAL 65
  144. #define ZEND_SEND_VAR_EX 66
  145. #define ZEND_SEND_REF 67
  146. #define ZEND_NEW 68
  147. #define ZEND_INIT_NS_FCALL_BY_NAME 69
  148. #define ZEND_FREE 70
  149. #define ZEND_INIT_ARRAY 71
  150. #define ZEND_ADD_ARRAY_ELEMENT 72
  151. #define ZEND_INCLUDE_OR_EVAL 73
  152. #define ZEND_UNSET_VAR 74
  153. #define ZEND_UNSET_DIM 75
  154. #define ZEND_UNSET_OBJ 76
  155. #define ZEND_FE_RESET_R 77
  156. #define ZEND_FE_FETCH_R 78
  157. #define ZEND_EXIT 79
  158. #define ZEND_FETCH_R 80
  159. #define ZEND_FETCH_DIM_R 81
  160. #define ZEND_FETCH_OBJ_R 82
  161. #define ZEND_FETCH_W 83
  162. #define ZEND_FETCH_DIM_W 84
  163. #define ZEND_FETCH_OBJ_W 85
  164. #define ZEND_FETCH_RW 86
  165. #define ZEND_FETCH_DIM_RW 87
  166. #define ZEND_FETCH_OBJ_RW 88
  167. #define ZEND_FETCH_IS 89
  168. #define ZEND_FETCH_DIM_IS 90
  169. #define ZEND_FETCH_OBJ_IS 91
  170. #define ZEND_FETCH_FUNC_ARG 92
  171. #define ZEND_FETCH_DIM_FUNC_ARG 93
  172. #define ZEND_FETCH_OBJ_FUNC_ARG 94
  173. #define ZEND_FETCH_UNSET 95
  174. #define ZEND_FETCH_DIM_UNSET 96
  175. #define ZEND_FETCH_OBJ_UNSET 97
  176. #define ZEND_FETCH_LIST_R 98
  177. #define ZEND_FETCH_CONSTANT 99
  178. #define ZEND_CHECK_FUNC_ARG 100
  179. #define ZEND_EXT_STMT 101
  180. #define ZEND_EXT_FCALL_BEGIN 102
  181. #define ZEND_EXT_FCALL_END 103
  182. #define ZEND_EXT_NOP 104
  183. #define ZEND_TICKS 105
  184. #define ZEND_SEND_VAR_NO_REF 106
  185. #define ZEND_CATCH 107
  186. #define ZEND_THROW 108
  187. #define ZEND_FETCH_CLASS 109
  188. #define ZEND_CLONE 110
  189. #define ZEND_RETURN_BY_REF 111
  190. #define ZEND_INIT_METHOD_CALL 112
  191. #define ZEND_INIT_STATIC_METHOD_CALL 113
  192. #define ZEND_ISSET_ISEMPTY_VAR 114
  193. #define ZEND_ISSET_ISEMPTY_DIM_OBJ 115
  194. #define ZEND_SEND_VAL_EX 116
  195. #define ZEND_SEND_VAR 117
  196. #define ZEND_INIT_USER_CALL 118
  197. #define ZEND_SEND_ARRAY 119
  198. #define ZEND_SEND_USER 120
  199. #define ZEND_STRLEN 121
  200. #define ZEND_DEFINED 122
  201. #define ZEND_TYPE_CHECK 123
  202. #define ZEND_VERIFY_RETURN_TYPE 124
  203. #define ZEND_FE_RESET_RW 125
  204. #define ZEND_FE_FETCH_RW 126
  205. #define ZEND_FE_FREE 127
  206. #define ZEND_INIT_DYNAMIC_CALL 128
  207. #define ZEND_DO_ICALL 129
  208. #define ZEND_DO_UCALL 130
  209. #define ZEND_DO_FCALL_BY_NAME 131
  210. #define ZEND_PRE_INC_OBJ 132
  211. #define ZEND_PRE_DEC_OBJ 133
  212. #define ZEND_POST_INC_OBJ 134
  213. #define ZEND_POST_DEC_OBJ 135
  214. #define ZEND_ECHO 136
  215. #define ZEND_OP_DATA 137
  216. #define ZEND_INSTANCEOF 138
  217. #define ZEND_GENERATOR_CREATE 139
  218. #define ZEND_MAKE_REF 140
  219. #define ZEND_DECLARE_FUNCTION 141
  220. #define ZEND_DECLARE_LAMBDA_FUNCTION 142
  221. #define ZEND_DECLARE_CONST 143
  222. #define ZEND_DECLARE_CLASS 144
  223. #define ZEND_DECLARE_CLASS_DELAYED 145
  224. #define ZEND_DECLARE_ANON_CLASS 146
  225. #define ZEND_ADD_ARRAY_UNPACK 147
  226. #define ZEND_ISSET_ISEMPTY_PROP_OBJ 148
  227. #define ZEND_HANDLE_EXCEPTION 149
  228. #define ZEND_USER_OPCODE 150
  229. #define ZEND_ASSERT_CHECK 151
  230. #define ZEND_JMP_SET 152
  231. #define ZEND_UNSET_CV 153
  232. #define ZEND_ISSET_ISEMPTY_CV 154
  233. #define ZEND_FETCH_LIST_W 155
  234. #define ZEND_SEPARATE 156
  235. #define ZEND_FETCH_CLASS_NAME 157
  236. #define ZEND_CALL_TRAMPOLINE 158
  237. #define ZEND_DISCARD_EXCEPTION 159
  238. #define ZEND_YIELD 160
  239. #define ZEND_GENERATOR_RETURN 161
  240. #define ZEND_FAST_CALL 162
  241. #define ZEND_FAST_RET 163
  242. #define ZEND_RECV_VARIADIC 164
  243. #define ZEND_SEND_UNPACK 165
  244. #define ZEND_YIELD_FROM 166
  245. #define ZEND_COPY_TMP 167
  246. #define ZEND_BIND_GLOBAL 168
  247. #define ZEND_COALESCE 169
  248. #define ZEND_SPACESHIP 170
  249. #define ZEND_FUNC_NUM_ARGS 171
  250. #define ZEND_FUNC_GET_ARGS 172
  251. #define ZEND_FETCH_STATIC_PROP_R 173
  252. #define ZEND_FETCH_STATIC_PROP_W 174
  253. #define ZEND_FETCH_STATIC_PROP_RW 175
  254. #define ZEND_FETCH_STATIC_PROP_IS 176
  255. #define ZEND_FETCH_STATIC_PROP_FUNC_ARG 177
  256. #define ZEND_FETCH_STATIC_PROP_UNSET 178
  257. #define ZEND_UNSET_STATIC_PROP 179
  258. #define ZEND_ISSET_ISEMPTY_STATIC_PROP 180
  259. #define ZEND_FETCH_CLASS_CONSTANT 181
  260. #define ZEND_BIND_LEXICAL 182
  261. #define ZEND_BIND_STATIC 183
  262. #define ZEND_FETCH_THIS 184
  263. #define ZEND_SEND_FUNC_ARG 185
  264. #define ZEND_ISSET_ISEMPTY_THIS 186
  265. #define ZEND_SWITCH_LONG 187
  266. #define ZEND_SWITCH_STRING 188
  267. #define ZEND_IN_ARRAY 189
  268. #define ZEND_COUNT 190
  269. #define ZEND_GET_CLASS 191
  270. #define ZEND_GET_CALLED_CLASS 192
  271. #define ZEND_GET_TYPE 193
  272. #define ZEND_ARRAY_KEY_EXISTS 194
  273. #define ZEND_MATCH 195
  274. #define ZEND_CASE_STRICT 196
  275. #define ZEND_MATCH_ERROR 197
  276. #define ZEND_JMP_NULL 198
  277. #define ZEND_CHECK_UNDEF_ARGS 199
  278. #define ZEND_FETCH_GLOBALS 200
  279. #define ZEND_VERIFY_NEVER_TYPE 201
  280. #define ZEND_CALLABLE_CONVERT 202
  281. #define ZEND_VM_LAST_OPCODE 202
  282. #endif