summaryrefslogtreecommitdiff
path: root/UPGRADING.INTERNALS
blob: 45143ead7c5de263c0f4503df819cd8c7231083f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
PHP 7.3 INTERNALS UPGRADE NOTES

1. Internal API changes
  a. array_init() and array_init_size()
  b. Run-time constant operand addressing
  c. Array/Object recursion protection
  d. HASH_FLAG_PERSISTENT
  e. AST and IS_CONSTANT
  f. GC_REFCOUNT()
  g. zend_get_parameters()
  h. zend_register_persistent_resource()
  i. RAND_RANGE()
  j. cast_object() with _IS_NUMBER
  k. zend_fcall_info_cache.initialized
  l. php_hrtime_current()
  m. zend_cpu_supports()

2. Build system changes
  a. Unix build system changes
  b. Windows build system changes


3. Module changes

========================
1. Internal API changes
========================

  a. array_init() and array_init_size() are not functions anymore.
     They don't return any values.

  b. In 64-bit builds PHP-7.2 and below used relative run-time constant operand
     addressing. E.g. opline->op1.constant kept an offset from start of literals
     table - op_array->literals. To speedup access op_array->literals was cached
     in execute_data->literals. So the resulting address calculated as
     EX(literals) + opline->op1.constant.

     Now at run-time literals allocated close to opcodes, and addressed
     relatively from current opline. This eliminates load of EX(literals) on
     each constant access as well as EX(literals) initialization on each call.

     As result some related macros were removed (ZEND_EX_USE_LITERALS,
     EX_LOAD_LITERALS, EX_LITERALS, RT_CONSTANT_EX, EX_CONSTANT) or changed
     (RT_CONSTANT, ZEND_PASS_TWO_UPDATE_CONSTANT, ZEND_PASS_TWO_UNDO_CONSTANT).
     This change way affect only some "system" extensions. EX_LITERALS,
     RT_CONSTANT_EX, EX_CONSTANT should be substituted by RT_CONSTANT than now
     use "opline" (instead of "op_array") as first argument.

  c. Protection from recursion during processing circular data structures was
     refactored. HashTable.nApplyCount and IS_OBJ_APPLY_COUNT are replaced by
     single flag GC_PROTECTED. Corresponding macros Z_OBJ_APPLY_COUNT,
     Z_OBJ_INC_APPLY_COUNT, Z_OBJ_DEC_APPLY_COUNT, ZEND_HASH_GET_APPLY_COUNT,
     ZEND_HASH_INC_APPLY_COUNT, ZEND_HASH_DEC_APPLY_COUNT are replaced with
     GC_IS_RECURSIVE, GC_PROTECT_RECURSION, GC_UNPROTECT_RECURSION,
     Z_IS_RECURSIVE, Z_PROTECT_RECURSION, Z_UNPROTECT_RECURSION.

     HASH_FLAG_APPLY_PROTECTION flag and ZEND_HASH_APPLY_PROTECTION() macro
     are removed. All mutable arrays should use recursion protection.
     Corresponding checks should be replaced by Z_REFCOUNTED() or
     !(GC_GLAGS(p) & GC_IMMUTABLE).

  d. HASH_FLAG_PERSISTENT renamed into IS_ARRAY_PERSISTENT and moved into
     GC_FLAGS (to be consistent with IS_STR_PERSISTENT).

  e. zend_ast_ref structure is changed to use only one allocation.
     zend_ast_copy() now returns zend_ast_ref (instead of zend_asr).
     zend_ast_destroy_and_free() is removed. ZVAL_NEW_AST() is replaced
     by ZVAL_AST().

     IS_CONSTANT type and Z_CONST_FLAGS() are removed. Now constants are always
     represented using IS_CONSTANT_AST (ZEND_AST_CONSTANT kind). AST node
     attributes are used instead of constant flags. IS_TYPE_CONSTANT flag is
     removed, but Z_CONSTANT() macro is kept for compatibility.

  f. GC_REFCOUNT() is turned into inline function and can't be modified direcly.
     All reference-counting operations should be done through corresponding
     macros GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF().

     GC_REFCOUNT(p)++ should be changed into GC_ADDREF(p),
     GC_REFCOUNT(p)-- into GC_DELREF(p),
     GC_REFCOUNT(p) = 1 into GC_SET_REFCOUNT(p, 1).

  g. The zend_get_parameters() and zend_get_parameters_ex() functions were
     removed. Instead zend_parse_parameters() should be used.

  h. New functions zend_register_persistent_resource() or
     zend_register_persistent_resource_ex() should beused to register
     persistent resources, instead of manual insertion into EG(persistent_list).

  i. The RANGE_RANGE() macro has been removed. php_mt_rand_range() should be
     used instead.

  j. The cast_object() object handler now also accepts the _IS_NUMBER type. The
     handler should return either an integer or float value in this case,
     whichever is more appropriate.

  k. zend_fcall_info_cache.initialized is removed. zend_fcall_info_cache is
     initialized if zend_fcall_info_cache.function_handler is set.

  l. php_hrtime_current() delivers the number of nanoseconds since an uncertain
     point in the past.

  m. zend_cpu_supports() determines if a feature is supported by current cpu.

========================
2. Build system changes
========================

  a. Unix build system changes

  b. Windows build system changes
    - ZEND_WIN32_FORCE_INLINE doesn't affect C++ anymore. zend_always_inline is
      still usable in C++, but anything else inlining related is up to
      compiler.
    - ZEND_WIN32_KEEP_INLINE was removed, it was only needed for C++
      convenience and is now default behavior with C++.

========================
3. Module changes
========================