|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 30-Sep-2020 | - |
| tests/ | H | 05-Dec-2019 | - | | |
| LICENSE | H A D | 05-Dec-2019 | 2.7 KiB | 57 | 47 |
| Makefile.am | H A D | 05-Dec-2019 | 2.3 KiB | 56 | 34 |
| Makefile.frag | H A D | 05-Dec-2019 | 78 | 2 | 1 |
| OBJECTS2_HOWTO | H A D | 05-Dec-2019 | 7.1 KiB | 196 | 142 |
| README.ZEND_MM | H A D | 05-Dec-2019 | 1.3 KiB | 44 | 29 |
| README.ZEND_VM | H A D | 05-Dec-2019 | 4 KiB | 108 | 93 |
| Zend.m4 | H A D | 05-Dec-2019 | 13.7 KiB | 606 | 526 |
| ZendCore.dep | H A D | 05-Dec-2019 | 5.2 KiB | 259 | 213 |
| acinclude.m4 | H A D | 05-Dec-2019 | 6.5 KiB | 231 | 210 |
| bench.php | H A D | 05-Dec-2019 | 7.3 KiB | 423 | 347 |
| build.mk | H A D | 05-Dec-2019 | 858 | 44 | 21 |
| buildconf | H A D | 05-Dec-2019 | 675 | 33 | 25 |
| configure.ac | H A D | 05-Dec-2019 | 2.8 KiB | 134 | 107 |
| header | H A D | 05-Dec-2019 | 1.1 KiB | 20 | 18 |
| micro_bench.php | H A D | 05-Dec-2019 | 6.4 KiB | 359 | 307 |
| zend.c | H A D | 05-Dec-2019 | 43.3 KiB | 1,556 | 1,233 |
| zend.h | H A D | 05-Dec-2019 | 12.6 KiB | 341 | 245 |
| zend.ico | H A D | 05-Dec-2019 | 1.3 KiB | | |
| zend_API.c | H A D | 05-Dec-2019 | 127.2 KiB | 4,357 | 3,518 |
| zend_API.h | H A D | 05-Dec-2019 | 59.1 KiB | 1,329 | 1,019 |
| zend_alloc.c | H A D | 05-Dec-2019 | 84.6 KiB | 2,867 | 2,379 |
| zend_alloc.h | H A D | 05-Dec-2019 | 18.8 KiB | 415 | 232 |
| zend_alloc_sizes.h | H A D | 05-Dec-2019 | 2.7 KiB | 75 | 41 |
| zend_arena.h | H A D | 05-Dec-2019 | 3.7 KiB | 126 | 77 |
| zend_ast.c | H A D | 05-Dec-2019 | 48.9 KiB | 1,747 | 1,561 |
| zend_ast.h | H A D | 05-Dec-2019 | 8.3 KiB | 288 | 213 |
| zend_bitset.h | H A D | 05-Dec-2019 | 6.9 KiB | 267 | 193 |
| zend_build.h | H A D | 05-Dec-2019 | 1.7 KiB | 57 | 21 |
| zend_builtin_functions.c | H A D | 05-Dec-2019 | 74.9 KiB | 2,711 | 2,088 |
| zend_builtin_functions.h | H A D | 05-Dec-2019 | 1.6 KiB | 42 | 7 |
| zend_closures.c | H A D | 05-Dec-2019 | 24.6 KiB | 753 | 548 |
| zend_closures.h | H A D | 05-Dec-2019 | 2.1 KiB | 51 | 13 |
| zend_compile.c | H A D | 05-Dec-2019 | 252.4 KiB | 8,717 | 6,924 |
| zend_compile.h | H A D | 05-Dec-2019 | 32.7 KiB | 1,065 | 693 |
| zend_config.nw.h | H A D | 05-Dec-2019 | 2.5 KiB | 92 | 24 |
| zend_config.w32.h | H A D | 05-Dec-2019 | 2.8 KiB | 96 | 46 |
| zend_constants.c | H A D | 05-Dec-2019 | 16.4 KiB | 524 | 412 |
| zend_constants.h | H A D | 05-Dec-2019 | 5.9 KiB | 95 | 53 |
| zend_default_classes.c | H A D | 05-Dec-2019 | 1.7 KiB | 49 | 15 |
| zend_dtrace.c | H A D | 05-Dec-2019 | 4.1 KiB | 127 | 72 |
| zend_dtrace.d | H A D | 05-Dec-2019 | 2.1 KiB | 38 | 13 |
| zend_dtrace.h | H A D | 05-Dec-2019 | 2.1 KiB | 59 | 21 |
| zend_errors.h | H A D | 05-Dec-2019 | 2.2 KiB | 55 | 20 |
| zend_exceptions.c | H A D | 05-Dec-2019 | 33.5 KiB | 1,067 | 797 |
| zend_exceptions.h | H A D | 05-Dec-2019 | 3.9 KiB | 94 | 38 |
| zend_execute.c | H A D | 05-Dec-2019 | 90.1 KiB | 3,075 | 2,609 |
| zend_execute.h | H A D | 05-Dec-2019 | 14.2 KiB | 385 | 283 |
| zend_execute_API.c | H A D | 05-Dec-2019 | 47.3 KiB | 1,723 | 1,366 |
| zend_extensions.c | H A D | 05-Dec-2019 | 10.2 KiB | 346 | 259 |
| zend_extensions.h | H A D | 05-Dec-2019 | 6 KiB | 166 | 83 |
| zend_float.c | H A D | 05-Dec-2019 | 1.9 KiB | 69 | 30 |
| zend_float.h | H A D | 05-Dec-2019 | 15.3 KiB | 431 | 259 |
| zend_gc.c | H A D | 05-Dec-2019 | 29.9 KiB | 1,243 | 1,019 |
| zend_gc.h | H A D | 05-Dec-2019 | 5 KiB | 173 | 115 |
| zend_generators.c | H A D | 05-Dec-2019 | 38.6 KiB | 1,308 | 931 |
| zend_generators.h | H A D | 05-Dec-2019 | 7.4 KiB | 149 | 67 |
| zend_globals.h | H A D | 05-Dec-2019 | 7.2 KiB | 309 | 182 |
| zend_globals_macros.h | H A D | 05-Dec-2019 | 2.8 KiB | 82 | 36 |
| zend_hash.c | H A D | 05-Dec-2019 | 65.9 KiB | 2,609 | 2,210 |
| zend_hash.h | H A D | 05-Dec-2019 | 33.8 KiB | 1,093 | 850 |
| zend_highlight.c | H A D | 05-Dec-2019 | 6 KiB | 245 | 187 |
| zend_highlight.h | H A D | 05-Dec-2019 | 2.4 KiB | 63 | 24 |
| zend_inheritance.c | H A D | 05-Dec-2019 | 61.6 KiB | 1,738 | 1,364 |
| zend_inheritance.h | H A D | 05-Dec-2019 | 2 KiB | 51 | 13 |
| zend_ini.c | H A D | 05-Dec-2019 | 19.1 KiB | 756 | 560 |
| zend_ini.h | H A D | 05-Dec-2019 | 9.5 KiB | 204 | 135 |
| zend_ini_parser.y | H A D | 05-Dec-2019 | 11.6 KiB | 427 | 313 |
| zend_ini_scanner.c | H A D | 05-Dec-2019 | 88.7 KiB | 3,935 | 3,750 |
| zend_ini_scanner.h | H A D | 05-Dec-2019 | 2 KiB | 50 | 14 |
| zend_ini_scanner.l | H A D | 05-Dec-2019 | 16.7 KiB | 664 | 434 |
| zend_ini_scanner_defs.h | H A D | 05-Dec-2019 | 224 | 14 | 11 |
| zend_interfaces.c | H A D | 05-Dec-2019 | 17.1 KiB | 566 | 405 |
| zend_interfaces.h | H A D | 05-Dec-2019 | 4.3 KiB | 95 | 47 |
| zend_istdiostream.h | H A D | 05-Dec-2019 | 1.7 KiB | 47 | 13 |
| zend_iterators.c | H A D | 05-Dec-2019 | 3 KiB | 109 | 67 |
| zend_iterators.h | H A D | 05-Dec-2019 | 3.6 KiB | 94 | 31 |
| zend_language_parser.y | H A D | 05-Dec-2019 | 47.2 KiB | 1,381 | 1,163 |
| zend_language_scanner.c | H A D | 05-Dec-2019 | 176.6 KiB | 7,788 | 7,434 |
| zend_language_scanner.h | H A D | 05-Dec-2019 | 2.8 KiB | 87 | 40 |
| zend_language_scanner.l | H A D | 05-Dec-2019 | 55.7 KiB | 2,401 | 1,862 |
| zend_language_scanner_defs.h | H A D | 05-Dec-2019 | 297 | 16 | 13 |
| zend_list.c | H A D | 05-Dec-2019 | 8.6 KiB | 349 | 255 |
| zend_list.h | H A D | 05-Dec-2019 | 3.2 KiB | 86 | 38 |
| zend_llist.c | H A D | 05-Dec-2019 | 6.8 KiB | 322 | 227 |
| zend_llist.h | H A D | 05-Dec-2019 | 3.9 KiB | 89 | 47 |
| zend_long.h | H A D | 05-Dec-2019 | 4.4 KiB | 143 | 98 |
| zend_modules.h | H A D | 05-Dec-2019 | 4.8 KiB | 144 | 91 |
| zend_multibyte.c | H A D | 05-Dec-2019 | 7.3 KiB | 224 | 159 |
| zend_multibyte.h | H A D | 05-Dec-2019 | 4.9 KiB | 91 | 45 |
| zend_multiply.h | H A D | 05-Dec-2019 | 9.4 KiB | 342 | 257 |
| zend_object_handlers.c | H A D | 05-Dec-2019 | 52.5 KiB | 1,778 | 1,401 |
| zend_object_handlers.h | H A D | 05-Dec-2019 | 9.2 KiB | 206 | 92 |
| zend_objects.c | H A D | 05-Dec-2019 | 8.4 KiB | 270 | 199 |
| zend_objects.h | H A D | 05-Dec-2019 | 1.9 KiB | 47 | 12 |
| zend_objects_API.c | H A D | 05-Dec-2019 | 6.8 KiB | 220 | 155 |
| zend_objects_API.h | H A D | 05-Dec-2019 | 3.5 KiB | 100 | 48 |
| zend_opcode.c | H A D | 05-Dec-2019 | 22.4 KiB | 787 | 663 |
| zend_operators.c | H A D | 05-Dec-2019 | 77 KiB | 3,150 | 2,633 |
| zend_operators.h | H A D | 05-Dec-2019 | 30.8 KiB | 912 | 756 |
| zend_portability.h | H A D | 05-Dec-2019 | 15 KiB | 524 | 402 |
| zend_ptr_stack.c | H A D | 05-Dec-2019 | 3 KiB | 122 | 71 |
| zend_ptr_stack.h | H A D | 05-Dec-2019 | 4.3 KiB | 130 | 76 |
| zend_range_check.h | H A D | 05-Dec-2019 | 3.1 KiB | 78 | 32 |
| zend_signal.c | H A D | 05-Dec-2019 | 12.9 KiB | 460 | 315 |
| zend_signal.h | H A D | 05-Dec-2019 | 4.1 KiB | 125 | 72 |
| zend_smart_str.c | H A D | 05-Dec-2019 | 4 KiB | 137 | 95 |
| zend_smart_str.h | H A D | 05-Dec-2019 | 5.1 KiB | 152 | 105 |
| zend_smart_str_public.h | H A D | 05-Dec-2019 | 1.4 KiB | 38 | 7 |
| zend_smart_string.h | H A D | 05-Dec-2019 | 4.9 KiB | 150 | 98 |
| zend_smart_string_public.h | H A D | 05-Dec-2019 | 1.5 KiB | 44 | 9 |
| zend_sort.c | H A D | 05-Dec-2019 | 10.7 KiB | 386 | 244 |
| zend_sort.h | H A D | 05-Dec-2019 | 1.8 KiB | 42 | 8 |
| zend_sprintf.c | H A D | 05-Dec-2019 | 1.6 KiB | 53 | 16 |
| zend_stack.c | H A D | 05-Dec-2019 | 4 KiB | 177 | 118 |
| zend_stack.h | H A D | 05-Dec-2019 | 2.5 KiB | 62 | 24 |
| zend_stream.c | H A D | 05-Dec-2019 | 10.4 KiB | 358 | 277 |
| zend_stream.h | H A D | 05-Dec-2019 | 3.4 KiB | 111 | 64 |
| zend_string.c | H A D | 05-Dec-2019 | 6.7 KiB | 235 | 150 |
| zend_string.h | H A D | 05-Dec-2019 | 14.6 KiB | 446 | 317 |
| zend_strtod.c | H A D | 05-Dec-2019 | 90.4 KiB | 4,554 | 3,916 |
| zend_strtod.h | H A D | 05-Dec-2019 | 2 KiB | 49 | 14 |
| zend_strtod_int.h | H A D | 05-Dec-2019 | 3.6 KiB | 158 | 95 |
| zend_ts_hash.c | H A D | 05-Dec-2019 | 8.6 KiB | 376 | 274 |
| zend_ts_hash.h | H A D | 05-Dec-2019 | 6.6 KiB | 159 | 89 |
| zend_type_info.h | H A D | 05-Dec-2019 | 3.2 KiB | 71 | 33 |
| zend_types.h | H A D | 05-Dec-2019 | 33 KiB | 1,082 | 824 |
| zend_variables.c | H A D | 05-Dec-2019 | 5.5 KiB | 222 | 163 |
| zend_variables.h | H A D | 05-Dec-2019 | 4.7 KiB | 127 | 80 |
| zend_virtual_cwd.c | H A D | 05-Dec-2019 | 47.9 KiB | 1,956 | 1,573 |
| zend_virtual_cwd.h | H A D | 05-Dec-2019 | 12.4 KiB | 391 | 288 |
| zend_vm.h | H A D | 05-Dec-2019 | 2 KiB | 51 | 15 |
| zend_vm_def.h | H A D | 05-Dec-2019 | 253.2 KiB | 8,897 | 7,670 |
| zend_vm_execute.h | H A D | 05-Dec-2019 | 2.2 MiB | 69,373 | 60,575 |
| zend_vm_execute.skl | H A D | 05-Dec-2019 | 2.7 KiB | 117 | 95 |
| zend_vm_gen.php | H A D | 05-Dec-2019 | 99.3 KiB | 2,774 | 2,446 |
| zend_vm_opcodes.c | H A D | 05-Dec-2019 | 8.2 KiB | 432 | 408 |
| zend_vm_opcodes.h | H A D | 05-Dec-2019 | 12.6 KiB | 276 | 246 |
README.ZEND_MM
1Zend Memory Manager
2===================
3
4General:
5--------
6
7The goal of the new memory manager (available since PHP 5.2) is to reduce memory
8allocation overhead and speedup memory management.
9
10The new manager's "configure" has no "--disable-zend-memory-manager" option,
11but it has "--enable-malloc-mm" instead. It is enabled by default in DEBUG
12build and disabled by default in RELEASE build. When enabled it allows selecting
13between malloc and emalloc at runtime so you can use internal and external memory
14debuggers without recompilation.
15
16Debugging:
17----------
18
19Normal:
20
21 $ sapi/cli/php -r 'leak();'
22
23Zend MM disabled:
24
25 $ USE_ZEND_ALLOC=0 valgrind --leak-check=full sapi/cli/php -r 'leak();'
26
27Shared extensions:
28------------------
29
30Since PHP 5.3.11 it is possible to prevent shared extensions from unloading so
31that valgrind can correctly track the memory leaks in shared extensions. For
32this there is the ZEND_DONT_UNLOAD_MODULES environment variable. If set, then
33DL_UNLOAD() is skipped during the shutdown of shared extensions.
34
35
36Tweaking:
37---------
38
39The Zend MM can be tweaked using ZEND_MM_MEM_TYPE and ZEND_MM_SEG_SIZE environment
40variables. Default values are "malloc" and "256K". Dependent on target system you
41can also use "mmap_anon", "mmap_zero" and "win32" storage managers.
42
43 $ ZEND_MM_MEM_TYPE=mmap_anon ZEND_MM_SEG_SIZE=1M sapi/cli/php ..etc.
44
README.ZEND_VM
1ZEND_VM
2=======
3
4ZEND_VM architecture allows specializing opcode handlers according to op_type
5fields and using different execution methods (call threading, switch threading
6and direct threading). As a result ZE2 got more than 20% speedup on raw PHP
7code execution (with specialized executor and direct threading execution
8method). As in most PHP applications raw execution speed isn't the limiting
9factor but system calls and database calls are, your mileage with this patch
10will vary.
11
12Most parts of the old zend_execute.c go into zend_vm_def.h. Here you can
13find opcode handlers and helpers. The typical opcode handler template looks
14like this:
15
16ZEND_VM_HANDLER(<OPCODE-NUMBER>, <OPCODE>, <OP1_TYPES>, <OP2_TYPES>)
17{
18 <HANDLER'S CODE>
19}
20
21<OPCODE-NUMBER> is a opcode number (0, 1, ...)
22<OPCODE> is an opcode name (ZEN_NOP, ZEND_ADD, :)
23<OP1_TYPES> & <OP2_TYPES> are masks for allowed operand op_types. Specializer
24will generate code only for defined combination of types. You can use any
25combination of the following op_types UNUSED, CONST, VAR, TMP and CV also
26you can use ANY mask to disable specialization according operand's op_type.
27<HANDLER'S CODE> is a handler's code itself. For most handlers it stills the
28same as in old zend_execute.c, but now it uses macros to access opcode operands
29and some internal executor data.
30
31You can see the conformity of new macros to old code in the following list:
32
33EXECUTE_DATA
34 execute_data
35ZEND_VM_DISPATCH_TO_HANDLER(<OP>)
36 return <OP>_helper(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU)
37ZEND_VM_DISPATCH_TO_HELPER(<NAME>)
38 return <NAME>(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU)
39ZEND_VM_DISPATCH_TO_HELPER_EX(<NAME>,<PARAM>,<VAL>)
40 return <NAME>(<VAL>, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU)
41ZEND_VM_CONTINUE()
42 return 0
43ZEND_VM_NEXT_OPCODE()
44 NEXT_OPCODE()
45ZEND_VM_SET_OPCODE(<TARGET>
46 SET_OPCODE(<TARGET>
47ZEND_VM_INC_OPCODE()
48 INC_OPCOD()
49ZEND_VM_RETURN_FROM_EXECUTE_LOOP()
50 RETURN_FROM_EXECUTE_LOOP()
51ZEND_VM_C_LABEL(<LABEL>):
52 <LABEL>:
53ZEND_VM_C_GOTO(<LABEL>)
54 goto <LABEL>
55OP<X>_TYPE
56 opline->op<X>.op_type
57GET_OP<X>_ZVAL_PTR(<TYPE>)
58 get_zval_ptr(&opline->op<X>, EX(Ts), &free_op<X>, <TYPE>)
59GET_OP<X>_ZVAL_PTR_PTR(<TYPE>)
60 get_zval_ptr_ptr(&opline->op<X>, EX(Ts), &free_op<X>, <TYPE>)
61GET_OP<X>_OBJ_ZVAL_PTR(<TYPE>)
62 get_obj_zval_ptr(&opline->op<X>, EX(Ts), &free_op<X>, <TYPE>)
63GET_OP<X>_OBJ_ZVAL_PTR_PTR(<TYPE>)
64 get_obj_zval_ptr_ptr(&opline->op<X>, EX(Ts), &free_op<X>, <TYPE>)
65IS_OP<X>_TMP_FREE()
66 IS_TMP_FREE(free_op<X>)
67FREE_OP<X>()
68 FREE_OP(free_op<X>)
69FREE_OP<X>_IF_VAR()
70 FREE_VAR(free_op<X>)
71FREE_OP<X>_VAR_PTR()
72 FREE_VAR_PTR(free_op<X>)
73
74
75Executor's helpers can be defined without parameters or with one parameter.
76This is done with the following constructs:
77
78ZEND_VM_HELPER(<HELPER-NAME>, <OP1_TYPES>, <OP2_TYPES>)
79{
80 <HELPER'S CODE>
81}
82
83ZEND_VM_HELPER_EX(<HELPER-NAME>, <OP1_TYPES>, <OP2_TYPES>, <PARAM_SPEC>)
84{
85 <HELPER'S CODE>
86}
87
88Executor's code is generated by PHP script zend_vm_gen.php it uses zend_vm_def.h
89and zend_vm_execute.skl as input and produces zend_vm_opcodes.h and
90zend_vm_execute.h. The first file is a list of opcode definitions. It is
91included from zend_compile.h. The second one is an executor code itself. It is
92included from zend_execute.c.
93
94zend_vm_gen.php can produce different kind of executors. You can select
95different opcode threading model using --with-vm-kind=CALL|SWITCH|GOTO. You can
96disable opcode specialization using --without-specializer. You can include or
97exclude old executor together with specialized one using --without-old-executor.
98At last you can debug executor using original zend_vm_def.h or generated file
99zend_vm_execute.h. Debugging with original file requires --with-lines
100option. By default ZE2 uses the following command to generate executor:
101
102$ php zend_vm_gen.php --with-vm-kind=CALL
103
104Zend Engine II currently includes two executors during the build process, one
105is the specialized version and the other is the old one non-specialized with
106function handlers. By default Zend Engine II uses the specialized one but you
107can switch to the old executor at runtime by calling zend_vm_use_old_executor().
108