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