NameDateSize

..21-Aug-2014

acinclude.m419-Oct-20136 KiB

bench.php18-Dec-20127.3 KiB

build.mk18-Dec-2012860

buildconf18-Dec-2012676

configure.in18-Dec-20123.1 KiB

header18-Dec-20121.1 KiB

LICENSE18-Dec-20122.7 KiB

Makefile.am22-Dec-20132.2 KiB

Makefile.frag18-Dec-201278

micro_bench.php18-Dec-20126.4 KiB

OBJECTS2_HOWTO18-Dec-20127.1 KiB

README.ZEND_MM18-Dec-20121.3 KiB

README.ZEND_VM15-Jul-20134 KiB

RFCs/18-Dec-2012

tests/19-Jul-2014

zend.c03-Jan-201441.3 KiB

Zend.dsp22-Dec-201313 KiB

zend.h03-Jan-201426 KiB

zend.ico18-Dec-20121.3 KiB

Zend.m418-Dec-20129.6 KiB

zend_alloc.c03-Jan-201478.1 KiB

zend_alloc.h03-Jan-201411.8 KiB

zend_API.c03-Jan-2014118.7 KiB

zend_API.h03-Jan-201440 KiB

zend_build.h03-Jan-20141.6 KiB

zend_builtin_functions.c08-Jun-201469.1 KiB

zend_builtin_functions.h03-Jan-20141.6 KiB

ZEND_CHANGES15-Jul-201336.3 KiB

zend_closures.c09-Jun-201416.9 KiB

zend_closures.h03-Jan-20141.8 KiB

zend_compile.c16-Jun-2014245.7 KiB

zend_compile.h19-Jul-201433.6 KiB

zend_config.nw.h03-Jan-20142.4 KiB

zend_config.w32.h04-Jan-20143.2 KiB

zend_constants.c03-Jan-201417.4 KiB

zend_constants.h03-Jan-20145 KiB

zend_default_classes.c03-Jan-20141.7 KiB

zend_dtrace.c23-Aug-20133.8 KiB

zend_dtrace.d18-Dec-20122.1 KiB

zend_dtrace.h18-Dec-20122 KiB

zend_dynamic_array.c03-Jan-20142.3 KiB

zend_dynamic_array.h03-Jan-20141.9 KiB

zend_errors.h03-Jan-20142.1 KiB

zend_exceptions.c11-May-201429.1 KiB

zend_exceptions.h03-Jan-20143 KiB

zend_execute.c03-Jan-201455.7 KiB

zend_execute.h03-Jan-201413.8 KiB

zend_execute_API.c10-Jun-201452.4 KiB

zend_extensions.c03-Jan-20147.2 KiB

zend_extensions.h03-Jan-20144.5 KiB

zend_float.c03-Jan-20141.8 KiB

zend_float.h03-Jan-201415.5 KiB

zend_gc.c03-Jan-201422.2 KiB

zend_gc.h03-Jan-20147.2 KiB

zend_generators.c02-Jul-201422.6 KiB

zend_generators.h03-Jan-20142.6 KiB

zend_globals.h03-Jan-20147.1 KiB

zend_globals_macros.h03-Jan-20143.2 KiB

zend_hash.c03-Jan-201437.7 KiB

zend_hash.h03-Jan-201417.4 KiB

zend_highlight.c23-Feb-20145.7 KiB

zend_highlight.h03-Jan-20142.4 KiB

zend_indent.c03-Jan-20144.1 KiB

zend_indent.h03-Jan-20141.4 KiB

zend_ini.c03-Jan-201417.6 KiB

zend_ini.h03-Jan-20149.8 KiB

zend_ini_parser.y03-Jan-201410.9 KiB

zend_ini_scanner.c03-Jan-2014103 KiB

zend_ini_scanner.h03-Jan-20141.9 KiB

zend_ini_scanner.l03-Jan-201415.8 KiB

zend_ini_scanner_defs.h18-Dec-2012226

zend_interfaces.c03-Jan-201417.7 KiB

zend_interfaces.h03-Jan-20143.9 KiB

zend_istdiostream.h03-Jan-20141.6 KiB

zend_iterators.c03-Jan-20143.2 KiB

zend_iterators.h03-Jan-20143.7 KiB

zend_language_parser.y03-Jan-201456.7 KiB

zend_language_scanner.c03-Jan-2014183.4 KiB

zend_language_scanner.h03-Jan-20142.6 KiB

zend_language_scanner.l03-Jan-201457.3 KiB

zend_language_scanner_defs.h22-Dec-2013326

zend_list.c03-Jan-20149.8 KiB

zend_list.h03-Jan-20145.1 KiB

zend_llist.c03-Jan-20146.8 KiB

zend_llist.h03-Jan-20143.9 KiB

zend_modules.h03-Jan-20145 KiB

zend_multibyte.c03-Jan-20147.3 KiB

zend_multibyte.h03-Jan-20145 KiB

zend_multiply.h03-Jan-20143.7 KiB

zend_object_handlers.c04-Jan-201453.5 KiB

zend_object_handlers.h03-Jan-20149.2 KiB

zend_objects.c03-Jan-20148.2 KiB

zend_objects.h03-Jan-20142.2 KiB

zend_objects_API.c03-Jan-201413.1 KiB

zend_objects_API.h03-Jan-20144.3 KiB

zend_opcode.c19-Jul-201425.2 KiB

zend_operators.c03-Jan-201455 KiB

zend_operators.h03-Jan-201430.2 KiB

zend_ptr_stack.c03-Jan-20142.9 KiB

zend_ptr_stack.h03-Jan-20144.2 KiB

zend_qsort.c03-Jan-20143.5 KiB

zend_qsort.h03-Jan-20141.6 KiB

zend_signal.c18-Dec-201211.6 KiB

zend_signal.h18-Dec-20124 KiB

zend_sprintf.c03-Jan-20141.6 KiB

zend_stack.c03-Jan-20143.9 KiB

zend_stack.h03-Jan-20142.3 KiB

zend_static_allocator.c03-Jan-20142.6 KiB

zend_static_allocator.h03-Jan-20141.8 KiB

zend_stream.c03-Jan-201410.9 KiB

zend_stream.h03-Jan-20142.9 KiB

zend_string.c03-Jan-20146.8 KiB

zend_string.h03-Jan-20142.2 KiB

zend_strtod.c09-Dec-201353 KiB

zend_strtod.h03-Jan-20141.8 KiB

zend_ts_hash.c03-Jan-20149.5 KiB

zend_ts_hash.h03-Jan-20146.9 KiB

zend_types.h03-Jan-20142.3 KiB

zend_variables.c03-Jan-20145.8 KiB

zend_variables.h03-Jan-20143.8 KiB

zend_vm.h03-Jan-20141.4 KiB

zend_vm_def.h19-Jul-2014155.5 KiB

zend_vm_execute.h19-Jul-20141.3 MiB

zend_vm_execute.skl18-Dec-2012950

zend_vm_gen.php07-Jul-201451 KiB

zend_vm_opcodes.c03-Jan-20144.5 KiB

zend_vm_opcodes.h07-Jul-20148.4 KiB

ZendCore.dep18-Dec-20125.2 KiB

ZendTS.dsp22-Dec-201316.9 KiB

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
109