<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/php-git.git/Zend/Optimizer, branch master</title>
<subtitle>git.php.net: repository/php-src.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/php-git.git/'/>
<entry>
<title>Improved type inference for FE_FETCH_R</title>
<updated>2021-03-25T13:00:36+00:00</updated>
<author>
<name>Dmitry Stogov</name>
<email>dmitry@zend.com</email>
</author>
<published>2021-03-25T13:00:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/php-git.git/commit/?id=2f3538c2150eb2698fb024f97ff049bbb20642d7'/>
<id>2f3538c2150eb2698fb024f97ff049bbb20642d7</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Support VERIFY_RETURN_TYPE elision with unused operand</title>
<updated>2021-03-22T13:54:29+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>nikita.ppv@gmail.com</email>
</author>
<published>2021-03-22T13:50:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/php-git.git/commit/?id=6a5d60085d381255da94789f69892a9c979948a2'/>
<id>6a5d60085d381255da94789f69892a9c979948a2</id>
<content type='text'>
This handles the degenerate case where SCCP replaced the value in
the RETURN opcode with a constant, but the VERIFY_RETURN is still
there. We can still apply the same optimization, just don't need
to adjust the use list in this case.

The result is still sub-optimal in that a dead QM_ASSIGN is left
behind.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This handles the degenerate case where SCCP replaced the value in
the RETURN opcode with a constant, but the VERIFY_RETURN is still
there. We can still apply the same optimization, just don't need
to adjust the use list in this case.

The result is still sub-optimal in that a dead QM_ASSIGN is left
behind.
</pre>
</div>
</content>
</entry>
<entry>
<title>Support prototypes in call graph</title>
<updated>2021-03-19T09:49:15+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>nikita.ppv@gmail.com</email>
</author>
<published>2021-03-18T14:40:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/php-git.git/commit/?id=2d0e2733c8a0010df9f45693d536531a7a725bdf'/>
<id>2d0e2733c8a0010df9f45693d536531a7a725bdf</id>
<content type='text'>
Even if we don't know the exact method being called, include it
in the call graph with the is_prototype flag. In particular, we
can still make use of return types from prototype methods, as
PHP 8 makes LSP violations a hard error.

Most other places are adjusted to skip calls with !is_prototype.
Maybe some of them would be fine, but ignoring them is conservative.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Even if we don't know the exact method being called, include it
in the call graph with the is_prototype flag. In particular, we
can still make use of return types from prototype methods, as
PHP 8 makes LSP violations a hard error.

Most other places are adjusted to skip calls with !is_prototype.
Maybe some of them would be fine, but ignoring them is conservative.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add missing rc1/rcn to return type initialization</title>
<updated>2021-03-19T09:04:56+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>nikita.ppv@gmail.com</email>
</author>
<published>2021-03-19T09:04:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/php-git.git/commit/?id=e67156e967950b4ed7bbb7993ccff574d430b28d'/>
<id>e67156e967950b4ed7bbb7993ccff574d430b28d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Allow inferring narrowed return type</title>
<updated>2021-03-18T16:11:56+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>nikita.ppv@gmail.com</email>
</author>
<published>2021-03-18T16:11:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/php-git.git/commit/?id=dcac654fd56a2cecec0c187ba061ecc82bbc9031'/>
<id>dcac654fd56a2cecec0c187ba061ecc82bbc9031</id>
<content type='text'>
Even if an explicit return type is given, we might still infer
a more narrow one based on return statements. We shouldn't
pessimize this just because a type has been declared.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Even if an explicit return type is given, we might still infer
a more narrow one based on return statements. We shouldn't
pessimize this just because a type has been declared.
</pre>
</div>
</content>
</entry>
<entry>
<title>Update opt test</title>
<updated>2021-03-18T14:25:40+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>nikita.ppv@gmail.com</email>
</author>
<published>2021-03-18T14:25:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/php-git.git/commit/?id=8690efd1f8593edec3d1e9c4ed9e89b3018bfd58'/>
<id>8690efd1f8593edec3d1e9c4ed9e89b3018bfd58</id>
<content type='text'>
And fix a type in the fetch class flags dumping while here.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
And fix a type in the fetch class flags dumping while here.
</pre>
</div>
</content>
</entry>
<entry>
<title>Implement enums</title>
<updated>2021-03-17T18:08:03+00:00</updated>
<author>
<name>Ilija Tovilo</name>
<email>ilija.tovilo@me.com</email>
</author>
<published>2020-06-10T21:10:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/php-git.git/commit/?id=269c8dac1d56ee85d71ae94d9b28dd7d8e8de7b7'/>
<id>269c8dac1d56ee85d71ae94d9b28dd7d8e8de7b7</id>
<content type='text'>
RFC: https://wiki.php.net/rfc/enumerations

Co-authored-by: Nikita Popov &lt;nikita.ppv@gmail.com&gt;

Closes GH-6489.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
RFC: https://wiki.php.net/rfc/enumerations

Co-authored-by: Nikita Popov &lt;nikita.ppv@gmail.com&gt;

Closes GH-6489.
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'PHP-8.0'</title>
<updated>2021-03-16T10:18:12+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>nikita.ppv@gmail.com</email>
</author>
<published>2021-03-16T10:18:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/php-git.git/commit/?id=77ebf81492e8d9dcd441894cea9e6efdc8d1011a'/>
<id>77ebf81492e8d9dcd441894cea9e6efdc8d1011a</id>
<content type='text'>
* PHP-8.0:
  Fix refcount inference for typed properties
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* PHP-8.0:
  Fix refcount inference for typed properties
</pre>
</div>
</content>
</entry>
<entry>
<title>Reference dynamic functions through dynamic_defs</title>
<updated>2021-03-01T10:35:54+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>nikita.ppv@gmail.com</email>
</author>
<published>2020-05-18T13:46:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/php-git.git/commit/?id=47a2e5c785cdba71e003d9ad77cb799d4be88806'/>
<id>47a2e5c785cdba71e003d9ad77cb799d4be88806</id>
<content type='text'>
Currently, dynamically declared functions and closures are inserted
into the function table under a runtime definition key, and then later
possibly renamed. When opcache is not used and a file containing a
closure is repeatedly included, this leads to a very large memory leak,
as the no longer needed closure declarations will never be freed
(https://bugs.php.net/bug.php?id=76982).

With this patch, dynamic functions are instead stored in a
dynamic_func_defs member on the op_array, which opcodes reference
by index. When the parent op_array is destroyed, the dynamic_func_defs
it contains are also destroyed (unless they are stilled used elsewhere,
e.g. because they have been bound, or are used by a live closure). This
resolves the fundamental part of the leak, though doesn't completely
fix it yet due to some arena allocations.

The main non-obvious change here is to static variable handling:
We can't destroy static_variables_ptr in destroy_op_array, as e.g.
that would clear the static variables in a dynamic function when
the op_array containing it is destroyed. Static variable destruction
is separated out for this reason (we already do static variable
destruction separately for normal functions, so we only need to
handle main scripts).

Closes GH-5595.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, dynamically declared functions and closures are inserted
into the function table under a runtime definition key, and then later
possibly renamed. When opcache is not used and a file containing a
closure is repeatedly included, this leads to a very large memory leak,
as the no longer needed closure declarations will never be freed
(https://bugs.php.net/bug.php?id=76982).

With this patch, dynamic functions are instead stored in a
dynamic_func_defs member on the op_array, which opcodes reference
by index. When the parent op_array is destroyed, the dynamic_func_defs
it contains are also destroyed (unless they are stilled used elsewhere,
e.g. because they have been bound, or are used by a live closure). This
resolves the fundamental part of the leak, though doesn't completely
fix it yet due to some arena allocations.

The main non-obvious change here is to static variable handling:
We can't destroy static_variables_ptr in destroy_op_array, as e.g.
that would clear the static variables in a dynamic function when
the op_array containing it is destroyed. Static variable destruction
is separated out for this reason (we already do static variable
destruction separately for normal functions, so we only need to
handle main scripts).

Closes GH-5595.
</pre>
</div>
</content>
</entry>
<entry>
<title>Handle warnings during sccp function evaluation</title>
<updated>2021-02-11T11:36:35+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>nikita.ppv@gmail.com</email>
</author>
<published>2021-02-11T11:31:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/php-git.git/commit/?id=4c088c5da7fb96380a4cfc420d272075b40b6141'/>
<id>4c088c5da7fb96380a4cfc420d272075b40b6141</id>
<content type='text'>
Some upcoming changes like https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg
will make it somewhat inconvenient to determine whether a given
function invocation will generate a diagnostic. Rather than trying
to exclude this in advance, call the function with diagnostics
suppressed, and check whether anything was thrown.

This adds a new EG flag that is kept specific to the SCCP use-case.
This does not use the error_cb hook as it is a (non-TLS) global,
and doesn't fully suppress error handling besides.

Test this by removing the in advance checks for implode and array_flip.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some upcoming changes like https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg
will make it somewhat inconvenient to determine whether a given
function invocation will generate a diagnostic. Rather than trying
to exclude this in advance, call the function with diagnostics
suppressed, and check whether anything was thrown.

This adds a new EG flag that is kept specific to the SCCP use-case.
This does not use the error_cb hook as it is a (non-TLS) global,
and doesn't fully suppress error handling besides.

Test this by removing the in advance checks for implode and array_flip.
</pre>
</div>
</content>
</entry>
</feed>
