Coverage Report

Created: 2022-02-19 20:30

/src/php-src/Zend/zend_globals.h
Line
Count
Source
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
   +----------------------------------------------------------------------+
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
ZEND_API extern size_t compiler_globals_offset;
49
ZEND_API extern size_t executor_globals_offset;
50
END_EXTERN_C()
51
52
#endif
53
54
645k
#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
typedef struct _zend_vm_stack *zend_vm_stack;
63
typedef struct _zend_ini_entry zend_ini_entry;
64
65
66
struct _zend_compiler_globals {
67
  zend_stack loop_var_stack;
68
69
  zend_class_entry *active_class_entry;
70
71
  zend_string *compiled_filename;
72
73
  int zend_lineno;
74
75
  zend_op_array *active_op_array;
76
77
  HashTable *function_table;  /* function symbol table */
78
  HashTable *class_table;   /* class table */
79
80
  HashTable filenames_table;
81
82
  HashTable *auto_globals;
83
84
  /* Refer to zend_yytnamerr() in zend_language_parser.y for meaning of values */
85
  zend_uchar parse_error;
86
  zend_bool in_compilation;
87
  zend_bool short_tags;
88
89
  zend_bool unclean_shutdown;
90
91
  zend_bool ini_parser_unbuffered_errors;
92
93
  zend_llist open_files;
94
95
  struct _zend_ini_parser_param *ini_parser_param;
96
97
  zend_bool skip_shebang;
98
  zend_bool increment_lineno;
99
100
  zend_string *doc_comment;
101
  uint32_t extra_fn_flags;
102
103
  uint32_t compiler_options; /* set of ZEND_COMPILE_* constants */
104
105
  zend_oparray_context context;
106
  zend_file_context file_context;
107
108
  zend_arena *arena;
109
110
  HashTable interned_strings;
111
112
  const zend_encoding **script_encoding_list;
113
  size_t script_encoding_list_size;
114
  zend_bool multibyte;
115
  zend_bool detect_unicode;
116
  zend_bool encoding_declared;
117
118
  zend_ast *ast;
119
  zend_arena *ast_arena;
120
121
  zend_stack delayed_oplines_stack;
122
  HashTable *memoized_exprs;
123
  int memoize_mode;
124
125
  void   *map_ptr_base;
126
  size_t  map_ptr_size;
127
  size_t  map_ptr_last;
128
129
  HashTable *delayed_variance_obligations;
130
  HashTable *delayed_autoloads;
131
132
  uint32_t rtd_key_counter;
133
134
  zend_stack short_circuiting_opnums;
135
};
136
137
138
struct _zend_executor_globals {
139
  zval uninitialized_zval;
140
  zval error_zval;
141
142
  /* symbol table cache */
143
  zend_array *symtable_cache[SYMTABLE_CACHE_SIZE];
144
  /* Pointer to one past the end of the symtable_cache */
145
  zend_array **symtable_cache_limit;
146
  /* Pointer to first unused symtable_cache slot */
147
  zend_array **symtable_cache_ptr;
148
149
  zend_array symbol_table;    /* main symbol table */
150
151
  HashTable included_files; /* files already included */
152
153
  JMP_BUF *bailout;
154
155
  int error_reporting;
156
  int exit_status;
157
158
  HashTable *function_table;  /* function symbol table */
159
  HashTable *class_table;   /* class table */
160
  HashTable *zend_constants;  /* constants table */
161
162
  zval          *vm_stack_top;
163
  zval          *vm_stack_end;
164
  zend_vm_stack  vm_stack;
165
  size_t         vm_stack_page_size;
166
167
  struct _zend_execute_data *current_execute_data;
168
  zend_class_entry *fake_scope; /* used to avoid checks accessing properties */
169
170
  uint32_t jit_trace_num; /* Used by tracing JIT to reference the currently running trace */
171
172
  zend_long precision;
173
174
  int ticks_count;
175
176
  uint32_t persistent_constants_count;
177
  uint32_t persistent_functions_count;
178
  uint32_t persistent_classes_count;
179
180
  HashTable *in_autoload;
181
  zend_bool full_tables_cleanup;
182
183
  /* for extended information support */
184
  zend_bool no_extensions;
185
186
  zend_bool vm_interrupt;
187
  zend_bool timed_out;
188
  zend_long hard_timeout;
189
190
#ifdef ZEND_WIN32
191
  OSVERSIONINFOEX windows_version_info;
192
#endif
193
194
  HashTable regular_list;
195
  HashTable persistent_list;
196
197
  int user_error_handler_error_reporting;
198
  zval user_error_handler;
199
  zval user_exception_handler;
200
  zend_stack user_error_handlers_error_reporting;
201
  zend_stack user_error_handlers;
202
  zend_stack user_exception_handlers;
203
204
  zend_error_handling_t  error_handling;
205
  zend_class_entry      *exception_class;
206
207
  /* timeout support */
208
  zend_long timeout_seconds;
209
210
  int lambda_count;
211
212
  HashTable *ini_directives;
213
  HashTable *modified_ini_directives;
214
  zend_ini_entry *error_reporting_ini_entry;
215
216
  zend_objects_store objects_store;
217
  zend_object *exception, *prev_exception;
218
  const zend_op *opline_before_exception;
219
  zend_op exception_op[3];
220
221
  struct _zend_module_entry *current_module;
222
223
  zend_bool active;
224
  zend_uchar flags;
225
226
  zend_long assertions;
227
228
  uint32_t           ht_iterators_count;     /* number of allocatd slots */
229
  uint32_t           ht_iterators_used;      /* number of used slots */
230
  HashTableIterator *ht_iterators;
231
  HashTableIterator  ht_iterators_slots[16];
232
233
  void *saved_fpu_cw_ptr;
234
#if XPFPA_HAVE_CW
235
  XPFPA_CW_DATATYPE saved_fpu_cw;
236
#endif
237
238
  zend_function trampoline;
239
  zend_op       call_trampoline_op;
240
241
  HashTable weakrefs;
242
243
  zend_bool exception_ignore_args;
244
  zend_long exception_string_param_max_len;
245
246
  zend_get_gc_buffer get_gc_buffer;
247
248
  void *reserved[ZEND_MAX_RESERVED_RESOURCES];
249
};
250
251
645k
#define EG_FLAGS_INITIAL        (0)
252
641k
#define EG_FLAGS_IN_SHUTDOWN      (1<<0)
253
640k
#define EG_FLAGS_OBJECT_STORE_NO_REUSE  (1<<1)
254
642k
#define EG_FLAGS_IN_RESOURCE_SHUTDOWN (1<<2)
255
256
struct _zend_ini_scanner_globals {
257
  zend_file_handle *yy_in;
258
  zend_file_handle *yy_out;
259
260
  unsigned int yy_leng;
261
  unsigned char *yy_start;
262
  unsigned char *yy_text;
263
  unsigned char *yy_cursor;
264
  unsigned char *yy_marker;
265
  unsigned char *yy_limit;
266
  int yy_state;
267
  zend_stack state_stack;
268
269
  char *filename;
270
  int lineno;
271
272
  /* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW, ZEND_INI_SCANNER_TYPED */
273
  int scanner_mode;
274
};
275
276
typedef enum {
277
  ON_TOKEN,
278
  ON_FEEDBACK,
279
  ON_STOP
280
} zend_php_scanner_event;
281
282
struct _zend_php_scanner_globals {
283
  zend_file_handle *yy_in;
284
  zend_file_handle *yy_out;
285
286
  unsigned int yy_leng;
287
  unsigned char *yy_start;
288
  unsigned char *yy_text;
289
  unsigned char *yy_cursor;
290
  unsigned char *yy_marker;
291
  unsigned char *yy_limit;
292
  int yy_state;
293
  zend_stack state_stack;
294
  zend_ptr_stack heredoc_label_stack;
295
  zend_stack nest_location_stack; /* for syntax error reporting */
296
  zend_bool heredoc_scan_ahead;
297
  int heredoc_indentation;
298
  zend_bool heredoc_indentation_uses_spaces;
299
300
  /* original (unfiltered) script */
301
  unsigned char *script_org;
302
  size_t script_org_size;
303
304
  /* filtered script */
305
  unsigned char *script_filtered;
306
  size_t script_filtered_size;
307
308
  /* input/output filters */
309
  zend_encoding_filter input_filter;
310
  zend_encoding_filter output_filter;
311
  const zend_encoding *script_encoding;
312
313
  /* initial string length after scanning to first variable */
314
  int scanned_string_len;
315
316
  /* hooks */
317
  void (*on_event)(
318
    zend_php_scanner_event event, int token, int line,
319
    const char *text, size_t length, void *context);
320
  void *on_event_context;
321
};
322
323
#endif /* ZEND_GLOBALS_H */