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