Commit graph

37 commits

Author SHA1 Message Date
Nikita Popov
d92229d8c7 Implement named parameters
From an engine perspective, named parameters mainly add three
concepts:

 * The SEND_* opcodes now accept a CONST op2, which is the
   argument name. For now, it is looked up by linear scan and
   runtime cached.
 * This may leave UNDEF arguments on the stack. To avoid having
   to deal with them in other places, a CHECK_UNDEF_ARGS opcode
   is used to either replace them with defaults, or error.
 * For variadic functions, EX(extra_named_params) are collected
   and need to be freed based on ZEND_CALL_HAS_EXTRA_NAMED_PARAMS.

RFC: https://wiki.php.net/rfc/named_params

Closes GH-5357.
2020-07-31 15:53:36 +02:00
Nikita Popov
47e4001976 Remove more unused func_info fields 2020-07-30 18:50:12 +02:00
Dmitry Stogov
bd329a6019 Keep information about SEND_UNPACK/SEND_ARRAY in call_info 2020-05-27 22:15:14 +03:00
Nikita Popov
33b5c026aa Extract zend_foreach_op_array()
Move this functionality from zend_call_graph into zend_optimizer,
because we use this pattern in a number of places.
2020-05-19 11:15:54 +02:00
Nikita Popov
00013401ff Allow using prototypes when optimizing arg passing
Closes GH-5193.
2020-04-16 12:15:19 +02:00
Nikita Popov
dcbdcf87c8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Handle NULL caller_call_opline
2020-03-23 17:12:55 +01:00
Nikita Popov
dd9b5c8680 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Handle NULL caller_call_opline
2020-03-23 17:12:12 +01:00
Nikita Popov
34f1266a9c Handle NULL caller_call_opline
This can happen if there is an EXIT in the call arguments, in which
case the DO_CALL opcode may be eliminated as unreachable.
2020-03-23 17:12:01 +01:00
Nikita Popov
d15012d5e8 Accept const op_array in zend_build_call_map 2020-03-13 16:25:28 +01:00
Dmitry Stogov
2068ce9adf Use RT_CONSTANT() or CT_CONSTANT() macro depending on ZEND_ACC_DONE_PASS_TWO flag 2019-10-11 12:54:07 +03:00
Dmitry Stogov
3ad20f80f5 Revert/redo pass_two only once 2019-10-10 23:20:36 +03:00
Dmitry Stogov
1133ee1167 Check for USER_FUNCTION 2019-02-19 18:39:44 +03:00
Dmitry Stogov
da919a8b65 Remove copyright years. 2019-02-05 10:33:28 +03:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Dmitry Stogov
ba99aa133c Fixed issues related to optimization and persitence of classes linked with interfaces, traits or internal classes. 2018-11-14 16:32:07 +03:00
Zeev Suraski
9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02:00
Zeev Suraski
67e0138c0d Future-proof email addresses... 2018-11-01 18:30:28 +02:00
Peter Kokot
be49d61b19 Remove old SVN keywords substitutions
When the PHP source code was versioned in Subversion, there was
possible to substitute certain keywords such as $Id$ with revision
number, last change time and author name. Such approach is not used
in Git so this patch removes these outdated artifacts from source
code files.
2018-06-16 13:04:30 +02:00
Xinchen Hui
efcaa37190 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed bug #76477 (Opcache causes empty return value)
2018-06-15 16:31:58 +08:00
Xinchen Hui
f31ba7cb53 Fixed bug #76477 (Opcache causes empty return value) 2018-06-15 16:31:31 +08:00
Dmitry Stogov
3a794d39f0 Avoid repeatable ARG_SHOULD_BE_SENT_BY_REF() checks in FETCH_*FUNC_ARG and following SEND_VAR_EX. Perform the check once in a new CHECK_FUNC_ARG opcode and reuse in the following FETCH_*FUNC_ARG and SEND_FUNC_ARG (SEND_VAR_EX replacement). 2018-02-05 19:40:06 +03:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Nikita Popov
9331be7d6a Use call_map to avoid linear call lookup 2017-03-16 12:33:57 +01:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Dmitry Stogov
01bc515b4d Export zend_analyze_calls() to allow building call trees. 2016-10-25 17:20:27 +03:00
Nikita Popov
c3232c5903 Fix call graph construction
Travis build for 7.1+ has been failing for the past week...
2016-10-23 22:12:55 +02:00
Dmitry Stogov
ed3196ea35 Use simple "one-pass" algorithm. 2016-10-18 00:06:20 +03:00
Dmitry Stogov
b111da96d9 Split ZEND_SEND_VAR_NO_REF into ZEND_SEND_VAR_NO_REF and ZEND_SEND_VAR_NO_REF_EX (similar to ZEND_SEND_VAL) and remove ZEND_ARG_* flags. 2016-05-31 04:06:00 +03:00
Dmitry Stogov
8ae695cd75 Fixed possible crash 2016-05-06 12:36:21 +03:00
Nikita Popov
d94b9545d6 Support known static/method calls in call graph
For this purpose extract the function lookup call into a helper
zend_optimizer_get_called_func().
2016-04-27 17:10:45 +02:00
Andrea Faulds
d6fc6d4ae6 Fix memory leak
Leak was introduced in c88ffa9a56.
2016-03-30 14:16:07 +01:00
Xinchen Hui
f2d2e8ceb9 arena_alloc never returns NULL 2016-03-09 18:05:28 +08:00
Nikita Popov
bb357e0617 Fix bitset initialization 2016-01-07 23:49:42 +01:00
Lior Kaplan
71c1980025 Happy new year (Update copyright to 2016) 2016-01-01 20:06:12 +02:00
Dmitry Stogov
9044f491cc Use do_alloca() instead of alloca() 2015-12-16 04:59:05 +03:00
Dmitry Stogov
c88ffa9a56 Added e-SSA based DFA optimisation framework (incomplete) 2015-12-16 00:49:44 +03:00