-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinternals.html
156 lines (141 loc) · 7.32 KB
/
internals.html
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Changes to PHP Internals in PHP 5.5</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Lito && Óscar Otero">
<meta name="title" content="Changes to PHP Internals in PHP 5.5">
<meta property="og:type" content="website">
<meta property="og:url" content="https://eusonlito.github.io/php-changes-cheatsheet">
<meta property="og:title" content="Changes to PHP Internals in PHP 5.5">
<meta property="og:image" content="./images/social.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:url" content="https://eusonlito.github.io/php-changes-cheatsheet">
<meta name="twitter:site" content="@lito_ordes">
<meta name="twitter:creator" content="@lito_ordes">
<meta name="twitter:title" content="Changes to PHP Internals in PHP 5.5">
<meta name="twitter:image" content="./images/social.png">
<link href="//fonts.googleapis.com/css?family=Fira+Sans|Droid+Sans|Source+Sans+Pro" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="./phpnet.css?1744308666" type="text/css" media="screen">
<link rel="stylesheet" href="./styles.css?1744308666" type="text/css" media="screen">
<link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="./favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="./favicon-16x16.png">
<link rel="icon" href="./favicon.ico" type="image/x-icon">
<meta name="theme-color" content="#ffffff">
</head>
<body class="docs">
<section class="info-wrapper">
<nav id="head-nav" class="navbar">
<h1><a href="index.html"> Changes to PHP Internals in PHP 5.5</a></h1>
</nav>
<main class="info-main">
<article id="layout-content" class="info-version">
<header class="info-version-header">
<h1><a href="https://www.php.net/manual/en/migration55.internals.php" target="_blank">PHP 5.5</a></h1>
</header>
<div id="migration55.internals" class="sect1">
<h2 class="title">Changes to PHP Internals</h2>
<ul class="itemizedlist"><li class="listitem">
<span class="simpara">
Extensions cannot override <strong class="command">zend_execute()</strong> any more and
should override <strong class="command">zend_execute_ex()</strong> instead.
<code class="literal">EG(current_execute_data)</code> is already initialized in
<strong class="command">zend_execute_ex()</strong>, so for compatibility extensions may
need to use
<code class="literal">EG(current_execute_data)->prev_execute_data</code> instead.
</span>
</li>
<li class="listitem">
<span class="simpara">
Removed <code class="literal">EG(arg_types_stack)</code>,
<code class="literal">EX(fbc)</code>, <code class="literal">EX(called_scope)</code> and
<code class="literal">EX(current_object)</code>.
</span>
</li>
<li class="listitem">
<span class="simpara">
Added <code class="literal">op_array->nested_calls</code>, which is calculated
at compile time.
</span>
</li>
<li class="listitem">
<span class="simpara">
Added <code class="literal">EX(call_slots)</code>, which is an array to store
information about syntaticaly nested calls (e.g.
<code class="literal">foo(bar())</code>) and is preallocated together with
<code class="literal">execute_data</code>.
</span>
</li>
<li class="listitem">
<span class="simpara">
Added <code class="literal">EX(call)</code>, which is a pointer to a current
calling function, and is an element of <code class="literal">EX(call_slots)</code>.
</span>
</li>
<li class="listitem">
<span class="simpara">
Opcodes
<a target="_blank" href="https://www.php.net/manual/en/internals2.opcodes.init-method-call.html" class="link">INIT_METHOD_CALL</a>,
<a target="_blank" href="https://www.php.net/manual/en/internals2.opcodes.init-static-method-call.html" class="link">ZEND_INIT_STATIC_METHOD_CALL</a>,
<a target="_blank" href="https://www.php.net/manual/en/internals2.opcodes.init-fcall-by-name.html" class="link">ZEND_INIT_FCALL_BY_NAME</a>
and
<a target="_blank" href="https://www.php.net/manual/en/internals2.opcodes.init-ns-fcall-by-name.html" class="link">ZEND_INIT_NS_FCALL_BY_NAME</a>
use <code class="literal">result.num</code> as an index in
<code class="literal">EX(call_slots)</code>.
</span>
</li>
<li class="listitem">
<span class="simpara">
Opcode <a target="_blank" href="https://www.php.net/manual/en/internals2.opcodes.new.html" class="link">ZEND_NEW</a> uses
<code class="literal">extended_value</code> as an index in
<code class="literal">EX(call_slots)</code>.
</span>
</li>
<li class="listitem">
<span class="simpara">
Opcodes <a target="_blank" href="https://www.php.net/manual/en/internals2.opcodes.do-fcall.html" class="link">ZEND_DO_FCALL</a>
and
<a target="_blank" href="https://www.php.net/manual/en/internals2.opcodes.do-fcall-by-name.html" class="link">ZEND_DO_FCALL_BY_NAME</a>
use <code class="literal">op2.num</code> as an index in
<code class="literal">EX(call_slots)</code>.
</span>
</li>
<li class="listitem">
<span class="simpara">
Added <code class="literal">op_array->used_stack</code>, which is calculated at
compile time; the corresponding stack space is preallocated together with
<code class="literal">execute_data</code>. As a result, the ZEND_SEND* and
ZEND_DO_FCALL* opcodes no longer need to check for stack overflow.
</span>
</li>
<li class="listitem">
<span class="simpara">
Removed <code class="literal">execute_data->Ts</code> field. The VM temporary
variables are always allocated immediately before the
<code class="literal">execute_data</code> structure, and are now accessed by their
offset from the <code class="literal">execute_data</code> base pointer instead of
via <code class="literal">execute_data->Ts</code>. The compiler stores new
offsets in <code class="literal">op_array->opcodes[*].op?.num</code>. The
<strong class="command">EX_TMP_VAR()</strong> and <strong class="command">EX_TMP_VAR_NUM()</strong>
macros can be used to access temporary variables by offset or number. You
can convert the number to an offset using <strong class="command">EX_TMP_VAR_NUM(0,
num)</strong> or offset to number using
<strong class="command">(EX_TMP_VAR_NUM(0,0)-EX_TMP_VAR(0,offset))</strong>.
</span>
</li>
<li class="listitem">
<span class="simpara">
Removed the <code class="literal">execute_data->CVs</code> field. The VM
compiled variables are always allocated immediately after the
<code class="literal">execute_data</code> structure, and are now accessed by the
offset from the <code class="literal">execute_data</code> base pointer instead of
via <code class="literal">execute_data->CVs</code>. You can use the
<strong class="command">EX_CV_NUM()</strong> macro to access compiled variables by
number.
</span>
</li>
</ul></div></article> </main>
</section> </body>
</html>