zend_globals.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Zend Engine |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1998-2018 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. +----------------------------------------------------------------------+
  18. */
  19. #ifndef ZEND_GLOBALS_H
  20. #define ZEND_GLOBALS_H
  21. #include <setjmp.h>
  22. #include "zend_globals_macros.h"
  23. #include "zend_stack.h"
  24. #include "zend_ptr_stack.h"
  25. #include "zend_hash.h"
  26. #include "zend_llist.h"
  27. #include "zend_objects.h"
  28. #include "zend_objects_API.h"
  29. #include "zend_modules.h"
  30. #include "zend_float.h"
  31. #include "zend_multibyte.h"
  32. #include "zend_multiply.h"
  33. #include "zend_arena.h"
  34. /* Define ZTS if you want a thread-safe Zend */
  35. /*#undef ZTS*/
  36. #ifdef ZTS
  37. BEGIN_EXTERN_C()
  38. ZEND_API extern int compiler_globals_id;
  39. ZEND_API extern int executor_globals_id;
  40. END_EXTERN_C()
  41. #endif
  42. #define SYMTABLE_CACHE_SIZE 32
  43. #include "zend_compile.h"
  44. /* excpt.h on Digital Unix 4.0 defines function_table */
  45. #undef function_table
  46. #define ZEND_EARLY_BINDING_COMPILE_TIME 0
  47. #define ZEND_EARLY_BINDING_DELAYED 1
  48. #define ZEND_EARLY_BINDING_DELAYED_ALL 2
  49. typedef struct _zend_vm_stack *zend_vm_stack;
  50. typedef struct _zend_ini_entry zend_ini_entry;
  51. struct _zend_compiler_globals {
  52. zend_stack loop_var_stack;
  53. zend_class_entry *active_class_entry;
  54. zend_string *compiled_filename;
  55. int zend_lineno;
  56. zend_op_array *active_op_array;
  57. HashTable *function_table; /* function symbol table */
  58. HashTable *class_table; /* class table */
  59. HashTable filenames_table;
  60. HashTable *auto_globals;
  61. zend_bool parse_error;
  62. zend_bool in_compilation;
  63. zend_bool short_tags;
  64. zend_bool unclean_shutdown;
  65. zend_bool ini_parser_unbuffered_errors;
  66. zend_llist open_files;
  67. struct _zend_ini_parser_param *ini_parser_param;
  68. uint32_t start_lineno;
  69. zend_bool increment_lineno;
  70. zend_string *doc_comment;
  71. uint32_t extra_fn_flags;
  72. uint32_t compiler_options; /* set of ZEND_COMPILE_* constants */
  73. zend_oparray_context context;
  74. zend_file_context file_context;
  75. zend_arena *arena;
  76. HashTable interned_strings;
  77. const zend_encoding **script_encoding_list;
  78. size_t script_encoding_list_size;
  79. zend_bool multibyte;
  80. zend_bool detect_unicode;
  81. zend_bool encoding_declared;
  82. zend_ast *ast;
  83. zend_arena *ast_arena;
  84. zend_stack delayed_oplines_stack;
  85. #ifdef ZTS
  86. zval **static_members_table;
  87. int last_static_member;
  88. #endif
  89. };
  90. struct _zend_executor_globals {
  91. zval uninitialized_zval;
  92. zval error_zval;
  93. /* symbol table cache */
  94. zend_array *symtable_cache[SYMTABLE_CACHE_SIZE];
  95. zend_array **symtable_cache_limit;
  96. zend_array **symtable_cache_ptr;
  97. zend_array symbol_table; /* main symbol table */
  98. HashTable included_files; /* files already included */
  99. JMP_BUF *bailout;
  100. int error_reporting;
  101. int exit_status;
  102. HashTable *function_table; /* function symbol table */
  103. HashTable *class_table; /* class table */
  104. HashTable *zend_constants; /* constants table */
  105. zval *vm_stack_top;
  106. zval *vm_stack_end;
  107. zend_vm_stack vm_stack;
  108. size_t vm_stack_page_size;
  109. struct _zend_execute_data *current_execute_data;
  110. zend_class_entry *fake_scope; /* used to avoid checks accessing properties */
  111. zend_long precision;
  112. int ticks_count;
  113. uint32_t persistent_constants_count;
  114. uint32_t persistent_functions_count;
  115. uint32_t persistent_classes_count;
  116. HashTable *in_autoload;
  117. zend_function *autoload_func;
  118. zend_bool full_tables_cleanup;
  119. /* for extended information support */
  120. zend_bool no_extensions;
  121. zend_bool vm_interrupt;
  122. zend_bool timed_out;
  123. zend_long hard_timeout;
  124. #ifdef ZEND_WIN32
  125. OSVERSIONINFOEX windows_version_info;
  126. #endif
  127. HashTable regular_list;
  128. HashTable persistent_list;
  129. int user_error_handler_error_reporting;
  130. zval user_error_handler;
  131. zval user_exception_handler;
  132. zend_stack user_error_handlers_error_reporting;
  133. zend_stack user_error_handlers;
  134. zend_stack user_exception_handlers;
  135. zend_error_handling_t error_handling;
  136. zend_class_entry *exception_class;
  137. /* timeout support */
  138. zend_long timeout_seconds;
  139. int lambda_count;
  140. HashTable *ini_directives;
  141. HashTable *modified_ini_directives;
  142. zend_ini_entry *error_reporting_ini_entry;
  143. zend_objects_store objects_store;
  144. zend_object *exception, *prev_exception;
  145. const zend_op *opline_before_exception;
  146. zend_op exception_op[3];
  147. struct _zend_module_entry *current_module;
  148. zend_bool active;
  149. zend_uchar flags;
  150. zend_long assertions;
  151. uint32_t ht_iterators_count; /* number of allocatd slots */
  152. uint32_t ht_iterators_used; /* number of used slots */
  153. HashTableIterator *ht_iterators;
  154. HashTableIterator ht_iterators_slots[16];
  155. void *saved_fpu_cw_ptr;
  156. #if XPFPA_HAVE_CW
  157. XPFPA_CW_DATATYPE saved_fpu_cw;
  158. #endif
  159. zend_function trampoline;
  160. zend_op call_trampoline_op;
  161. zend_bool each_deprecation_thrown;
  162. void *reserved[ZEND_MAX_RESERVED_RESOURCES];
  163. };
  164. #define EG_FLAGS_INITIAL (0)
  165. #define EG_FLAGS_IN_SHUTDOWN (1<<0)
  166. #define EG_FLAGS_OBJECT_STORE_NO_REUSE (1<<1)
  167. struct _zend_ini_scanner_globals {
  168. zend_file_handle *yy_in;
  169. zend_file_handle *yy_out;
  170. unsigned int yy_leng;
  171. unsigned char *yy_start;
  172. unsigned char *yy_text;
  173. unsigned char *yy_cursor;
  174. unsigned char *yy_marker;
  175. unsigned char *yy_limit;
  176. int yy_state;
  177. zend_stack state_stack;
  178. char *filename;
  179. int lineno;
  180. /* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW, ZEND_INI_SCANNER_TYPED */
  181. int scanner_mode;
  182. };
  183. typedef enum {
  184. ON_TOKEN,
  185. ON_FEEDBACK,
  186. ON_STOP
  187. } zend_php_scanner_event;
  188. struct _zend_php_scanner_globals {
  189. zend_file_handle *yy_in;
  190. zend_file_handle *yy_out;
  191. unsigned int yy_leng;
  192. unsigned char *yy_start;
  193. unsigned char *yy_text;
  194. unsigned char *yy_cursor;
  195. unsigned char *yy_marker;
  196. unsigned char *yy_limit;
  197. int yy_state;
  198. zend_stack state_stack;
  199. zend_ptr_stack heredoc_label_stack;
  200. zend_bool heredoc_scan_ahead;
  201. int heredoc_indentation;
  202. zend_bool heredoc_indentation_uses_spaces;
  203. /* original (unfiltered) script */
  204. unsigned char *script_org;
  205. size_t script_org_size;
  206. /* filtered script */
  207. unsigned char *script_filtered;
  208. size_t script_filtered_size;
  209. /* input/output filters */
  210. zend_encoding_filter input_filter;
  211. zend_encoding_filter output_filter;
  212. const zend_encoding *script_encoding;
  213. /* initial string length after scanning to first variable */
  214. int scanned_string_len;
  215. /* hooks */
  216. void (*on_event)(zend_php_scanner_event event, int token, int line, void *context);
  217. void *on_event_context;
  218. };
  219. #endif /* ZEND_GLOBALS_H */
  220. /*
  221. * Local variables:
  222. * tab-width: 4
  223. * c-basic-offset: 4
  224. * indent-tabs-mode: t
  225. * End:
  226. * vim600: sw=4 ts=4 fdm=marker
  227. * vim<600: sw=4 ts=4
  228. */