Commit Graph

1806 Commits

Author SHA1 Message Date
Dmitry Stogov
457392fa64 Cheaper checks for exceptions thrown from __toString() 2019-06-06 01:47:22 +03:00
Dmitry Stogov
3f4dfe1877 Prevent generation of specialized ZEND_ASSIGN_OP_..._STATIC_PROP handlers, that call unspecialized helper, anyway. 2019-06-05 17:38:13 +03:00
Nikita Popov
a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Dmitry Stogov
2915a32f37 Fixed compilation warning 2019-05-31 00:59:52 +03:00
Dmitry Stogov
1814308e49 Don't specialize "cold" handlers 2019-05-31 00:31:57 +03:00
Dmitry Stogov
4e567ed1da Removed useless specialization. Specialized handlers called not specialized helpers. 2019-05-31 00:15:25 +03:00
Dmitry Stogov
cf388033d5 Reduce register pressure by reloading values on CPUs with few general purpose registers 2019-05-31 00:14:10 +03:00
Dmitry Stogov
b2cb6a4a27 Avoid double copying 2019-05-28 13:35:00 +03:00
Nikita Popov
fd23f9104a BIND_STATIC of implicit binding may be undef
Even though we don't need it at runtime, add the BIND_IMPLICIT
flag to BIND_STATIC as well, so we can distinguish this case in
type inference.

This fixes a JIT miscompile in arrow_functions/002.phpt.
2019-05-27 17:12:20 +02:00
CHU Zhaowei
e829d08729 Implement spread operator in arrays
RFC: https://wiki.php.net/rfc/spread_operator_for_array

Closes GH-3640.
2019-05-13 14:42:43 +02:00
Nikita Popov
f3e5bbe6f3 Implement arrow functions
Per RFC: https://wiki.php.net/rfc/arrow_functions_v2

Co-authored-by: Levi Morrison <levim@php.net>
Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
2019-05-02 15:04:03 +02:00
Dmitry Stogov
38f9c8d93d Don't initialize return value before calling user functions 2019-04-18 02:31:12 +03:00
Dmitry Stogov
cb3cfc9ff8 Removed tests that always (or almost always) true 2019-04-15 13:18:16 +03:00
Nikita Popov
7f6c22cb3d Fix last maybe uninit warnings on 7.4
Most of these only occur under GCC 5. Not fond of all the workarounds
(especially the PDO one), but it gets us a clean build...
2019-04-15 11:35:13 +02:00
Dmitry Stogov
55cc280429 Backported call frame initialization improvement 2019-04-12 02:35:42 +03:00
Dmitry Stogov
88a2268d6b Replace "ZEND_CALL_CTOR" hack by additional live-range 2019-04-12 00:49:45 +03:00
Nikita Popov
30df87f77d Generate ZEND_COUNT for sizeof()
sizeof() is an alias of count(), so we should generate the same
code for them.
2019-04-11 10:48:52 +02:00
Nikita Popov
e86820eb56 Fix invalid function by-ref prop assign handling 2019-04-08 10:18:26 +02:00
Dmitry Stogov
d6848625d7 Optimized "smart branch" instructions 2019-04-05 00:25:45 +03:00
Dmitry Stogov
9038d5c6ee Make is_identical() functions return zend_bool (instead of int) 2019-04-04 18:18:12 +03:00
Dmitry Stogov
575c3576a7 unused variable 2019-04-04 17:52:17 +03:00
Dmitry Stogov
9cb926d8d1 Improved comparison opcode handlers 2019-04-02 23:46:21 +03:00
Dmitry Stogov
14359eb7eb Fixed typo 2019-03-20 01:31:35 +03:00
Dmitry Stogov
9357953bab micro-optimization 2019-03-19 02:02:14 +03:00
Dmitry Stogov
d4bef4ce7b Avoid useless code duplication, because of unused specialization 2019-02-15 17:49:39 +03:00
Dmitry Stogov
78a1d76962 Reduce slow code size 2019-02-15 17:03:04 +03:00
Nikita Popov
adf2f39745 Fix build without global regs 2019-02-14 14:01:39 +01:00
Nikita Popov
340c6d3927 Revert "Don't silence fatal errors with @"
This reverts commit abd36289e2.

This wasn't ready for merging yet, there are still some test
failures.
2019-01-31 09:39:10 +01:00
Nikita Popov
abd36289e2
Don't silence fatal errors with @ 2019-01-31 07:11:05 +01:00
Zeev Suraski
a81202ac49 Adios, yearly copyright ranges 2019-01-30 11:48:28 +01:00
Nikita Popov
a50198d0fe Implement ??= operator
RFC: https://wiki.php.net/rfc/null_coalesce_equal_operator

$a ??= $b is $a ?? ($a = $b), with the difference that $a is only
evaluated once, to the degree that this is possible. In particular
in $a[foo()] ?? $b function foo() is only ever called once.
However, the variable access themselves will be reevaluated.
2019-01-22 11:12:04 +01:00
Dmitry Stogov
0941f25811 Removed useless Z_REFCOUNTED_P() checks. 2019-01-17 10:53:58 +03:00
Dmitry Stogov
8661b6dd5d Reduce slow code size 2019-01-16 14:26:32 +03:00
Dmitry Stogov
fd27fd4a15 Fixed and improved incorrect usage of value_type argument. 2019-01-16 11:06:19 +03:00
Dmitry Stogov
6a2d2af06a Merge branch 'master' of git.php.net:php-src
* 'master' of git.php.net:php-src:
  Fix param list for build without global reg
2019-01-16 02:30:15 +03:00
Dmitry Stogov
0b21a4ba45 Separated zend_assign_to_typed_prop() 2019-01-16 02:13:43 +03:00
Anatol Belski
cd43a4629f Fix param list for build without global reg 2019-01-15 22:31:52 +01:00
Dmitry Stogov
938ba93f4a Separated zend_binary_assign_op_typed_ref() and zend_binary_assign_op_typed_prop() helpers 2019-01-15 18:49:05 +03:00
Dmitry Stogov
239305d12e Fixed uninitialized result of PRE_INC/PRE_DEC in case of exception.
Separated increment/decrement of typed reference into helper.
2019-01-15 18:03:46 +03:00
Dmitry Stogov
7f053c2c49 Merge branch 'PHP-7.3'
* PHP-7.3:
  Fixed bug #77263 (Segfault when using 2 RecursiveFilterIterator)
2019-01-14 13:21:03 +03:00
Dmitry Stogov
920450534e Fixed bug #77263 (Segfault when using 2 RecursiveFilterIterator) 2019-01-14 13:18:28 +03:00
Nikita Popov
e219ec144e Implement typed properties
RFC: https://wiki.php.net/rfc/typed_properties_v2

This is a squash of PR #3734, which is a squash of PR #3313.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Joe Watkins <krakjoe@php.net>
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2019-01-11 15:49:06 +01:00
Nikita Popov
fe359cf1ff Fix undefined function error message
This got fixed on 7.3, but the implementation is slightly different
on master and the new test was failing.
2019-01-02 15:41:38 +01:00
Xinchen Hui
1a0c325b89 Merge branch 'PHP-7.3'
* PHP-7.3:
  Fixed bug #77376 ("undefined function" message no longer includes namespace)
2019-01-02 15:32:29 +08:00
Xinchen Hui
e01f08f679 Fixed bug #77376 ("undefined function" message no longer includes namespace) 2019-01-02 15:32:17 +08:00
Dmitry Stogov
b8d6aac5ad Micro optimization 2018-12-28 15:34:33 +03:00
Dmitry Stogov
e8daada82e Tune ARRAY_KEY_EXISTS opcode handler for speed and code size 2018-12-27 02:34:52 +03:00
Dmitry Stogov
70fcbe3524 Fixed ext/spl/tests/bug61347.phpt failure introduced by ZEND_ARRAY_KEY_EXISTS opcode 2018-12-27 00:20:20 +03:00
Michael Moravec
f5044a12dd Implement ZEND_ARRAY_KEY_EXISTS opcode to speed up array_key_exists() 2018-12-26 23:54:11 +03:00
Dmitry Stogov
d90a5d2e1a Micro optimization 2018-12-26 12:30:30 +03:00
Dmitry Stogov
a111dfae0b Removed dead condition 2018-12-25 19:23:40 +03:00
Dmitry Stogov
2954a309de Avoid code duplication 2018-12-25 17:48:29 +03:00
Dmitry Stogov
868c1b7377 Reduce executor size 2018-12-18 17:34:18 +03:00
Dmitry Stogov
1f3a535324 Delay exceptional case check 2018-11-20 13:06:23 +03:00
Dmitry Stogov
a5a3d507d2 Optimization 2018-11-20 11:55:16 +03:00
Levi Morrison
74d15b535a Remove do_bind_inherited_class; use do_bind_class
Pass NULL as the second parameter. I don't know if in the past these
differed more, but there isn't any point to having both of them
anymore.
2018-11-07 18:54:00 +01:00
Zeev Suraski
9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02:00
Zeev Suraski
54dc07f3dc Update email addresses. We're still @Zend, but future proofing it... 2018-11-01 17:20:07 +02:00
Dmitry Stogov
e3688c2180 Refetetch function name on exceptional path to allow better code on fast code path. 2018-10-23 17:12:49 +03:00
Nikita Popov
149e6aaa99 Fix accessibility checks for dynamic properties
A dynamic property may be shadowed by a private/protected property.
Make sure we check property accessibility for non-indirect
properties as well.

Closes #3626.
2018-10-22 16:46:33 +02:00
Dmitry Stogov
d57cd36e47 Immutable clases and op_arrays.
Squashed commit of the following:

commit cd0c36c3f9
Merge: 4740dabb84 ad6738e886
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 14:43:38 2018 +0300

    Merge branch 'master' into immutable

    * master:
      Remove the "auto" encoding
      Fixed bug #77025
      Add vtbls for EUC-TW encoding

commit 4740dabb84
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 14:12:28 2018 +0300

    Reverted back ce->iterator_funcs_ptr. Initialize ce->iterator_funcs_ptr fields in immutable classes.

commit ad7a78b253
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:46:30 2018 +0300

    Added comment

commit 0276ea5187
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:42:43 2018 +0300

    Added type cast

commit c63fc5d5f1
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:36:51 2018 +0300

    Moved static class members initialization into the proper place.

commit b945548e93
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:21:03 2018 +0300

    Removed redundand assertion

commit d5a4108840
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:19:13 2018 +0300

    Removed duplicate code

commit 8dadca8864
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:05:43 2018 +0300

    Hide offset encoding magic in ZEND_MAP_PTR_IS_OFFSET(), ZEND_MAP_PTR_OFFSET2PTR() and ZEND_MAP_PTR_PTR2OFFSET() macros.

commit 9ef07c88bd
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 10:48:29 2018 +0300

    typo

commit a06f0f3d3a
Merge: 94099586ec 3412345ffe
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 10:47:07 2018 +0300

    Merge branch 'master' into immutable

    * master:
      Remove unused variable makefile_am_files
      Classify object handlers are required/optional
      Add support for getting SKIP_TAGSTART and SKIP_WHITE options
      Remove some obsolete config_vars.mk occurrences
      Remove bsd_converted from .gitignore
      Remove configuration parser and scanners ignores
      Remove obsolete buildconf.stamp from .gitignore
      [ci skip] Add magicdata.patch exception to .gitignore
      Remove outdated ext/spl/examples items from .gitignore
      Remove unused test.inc in ext/iconv/tests

commit 94099586ec
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon Oct 15 23:34:01 2018 +0300

    Immutable clases and op_arrays
2018-10-17 15:52:50 +03:00
Nikita Popov
1cfbb21790 Classify object handlers are required/optional 2018-10-16 20:53:59 +02:00
Peter Kokot
902d39a3a7 Trim trailing whitespace in source code files 2018-10-13 14:14:50 +02:00
Nikita Popov
7ec8087f80 Introduce get_properties_for() handler
This handler allows getting the object properties for a particular
purpose, such as array casting, serialization, etc.
2018-10-10 10:39:10 +02:00
Dmitry Stogov
6beaa9fa5b Use zend_hash_find() instead of zend_hash_exists() 2018-09-19 13:55:27 +03:00
Dmitry Stogov
689c6fb188 Replace ZEND_ACC_ANON_BOUND, ZEND_ACC_UNRESOLVED_PARENT and ZEND_ACC_UNRESOLVED_INTERFACES with single ZEND_ACC_LINKED. 2018-09-18 11:41:40 +03:00
Dmitry Stogov
bc288c4723 Simplify __clone() visibility check (magic methods still don't respect ZEND_ACC_CHANGED). 2018-09-13 13:36:09 +03:00
Dmitry Stogov
2fbfdde1b6 Cleanup class linking 2018-08-27 16:40:25 +03:00
Dmitry Stogov
6136a20544 ZEND_DECLARE_CLASS, ZEND_DECLARE_INHERITED_CLASS and ZEND_DECLARE_INHERITED_CLASS_DELAYED don't need return value anymore. 2018-08-24 15:40:53 +03:00
Dmitry Stogov
d140df58e6 Keep information about unresolved interfaces in zend_class_entry->interface_names.
Move interface implementation code into ZEND_DECLARE_*CLASS opcodes.
Remove ZEND_ADD_INTERFACE and ZEND_VERIFY_ABSTRACT_CLASS opcodes.
2018-08-23 17:16:28 +03:00
Dmitry Stogov
67397970b2 Replace zend_class_entry->traits by persistent zend_class_entry->trait_names.
Move trait binding code into ZEND_DECLARE_*CLASS opcodes.
Remove ZEND_ADD_TRIAIT and ZEND_BIND_TRAITS opcodes.
2018-08-23 02:02:26 +03:00
Dmitry Stogov
92fdf9d629 Change zend_lookup_class_ex() and zend_fetch_class_by_name() prototypes to accept optional lower-case class name as zend_string*, instead of zval*. 2018-08-22 17:07:31 +03:00
Dmitry Stogov
1321aa5080 Merge branch 'PHP-7.3'
* PHP-7.3:
  Stop using zend_function->reserved[] space.
2018-08-22 10:44:34 +03:00
Dmitry Stogov
8d95f561e4 Stop using zend_function->reserved[] space. 2018-08-22 10:43:51 +03:00
Dmitry Stogov
6d88e1ccd6 Don't use second operand of BIND_STATIC instruction. 2018-08-21 12:22:04 +03:00
Dmitry Stogov
7a52864ad0 Merge branch 'PHP-7.3'
* PHP-7.3:
  Removed dead code
2018-08-21 09:02:22 +03:00
Dmitry Stogov
5e5311e0ba Removed dead code 2018-08-21 09:01:54 +03:00
Dmitry Stogov
64f8b0185f Merge branch 'PHP-7.3'
* PHP-7.3:
  Avoid hash lookups in BIND_STATIC and BIND_LEXICAL opcode handlers. Encode static variable offset into opline->extended_value.
2018-08-20 16:11:40 +03:00
Dmitry Stogov
b8828926f2 Avoid hash lookups in BIND_STATIC and BIND_LEXICAL opcode handlers.
Encode static variable offset into opline->extended_value.
2018-08-20 16:10:09 +03:00
Xinchen Hui
4ab25235e5 Added a note 2018-08-17 12:22:46 +08:00
Xinchen Hui
fd463a9a60 Fixed bug #76752 (Crash in ZEND_COALESCE_SPEC_TMP_HANDLER - assertion in _get_zval_ptr_tmp failed). 2018-08-17 12:19:31 +08:00
Dmitry Stogov
3ced766da9 Removed duplicate code. zend_fetch_dimension_address_LIST_w() was a copy of zend_fetch_dimension_address_W(), ZEND_FETCH_LIST_W_SPEC_CV_... a copy of ZEND_FETCH_DIM_W_SPEC_CV_... 2018-07-30 10:53:39 +03:00
Dmitry Stogov
a588b825d6 Improved assignment to "next" element of array ($a[] = ...) 2018-07-27 13:15:22 +03:00
Dmitry Stogov
f374e93762 Use better check 2018-07-26 14:13:33 +03:00
Dmitry Stogov
ab8094c666 Pack zend_constant.flags and zend_constant.module_number into reserved space inside zend_constant.value. 2018-07-26 12:58:07 +03:00
Dmitry Stogov
f950128cd6 Encode parent class name as IS_CONST operand in DECLARE_INHERITED_CLASS and DECLARE_ANON_INHERITED_CLASS opcodes (eliminate FETCH_CLAS
S opcode).
2018-07-25 13:40:47 +03:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Dmitry Stogov
afc82e243c Micro-optimization 2018-07-23 10:52:00 +03:00
Dmitry Stogov
df60566671 Inline FETCH_CONST and DEFINED handlers into "hybrid" executor. 2018-07-17 13:30:55 +03:00
Dmitry Stogov
88dd38ee81 Reduce overhead of case-insensitive constants deprecation for "fast path" 2018-07-17 12:58:58 +03:00
Nikita Popov
3588d8af12 Deprecate case-insensitive constants
RFC: https://wiki.php.net/rfc/case_insensitive_constant_deprecation
2018-07-16 19:16:55 +02:00
Dmitry Stogov
40551e0255 Eliminated reference-counting and EG(exception) check 2018-07-09 13:20:46 +03:00
Dmitry Stogov
67b4c3379a Uze ZVAL_COPY_DEREF() instead of ZVAL_DEREF() and ZVAL_COPY() 2018-07-09 12:46:46 +03:00
Xinchen Hui
9d1e9b73c5 rename ref_dtor_func to rc_dtor_func 2018-07-06 19:15:26 +08:00
Xinchen Hui
f9297387f4 Rename zval_dtor_func and ref_dotr_func 2018-07-06 18:47:30 +08:00
Xinchen Hui
e3355ac5ec Revert "Rename _zval_dtor_func to _ref_dtor_func"
This reverts commit a362ae6b12.
2018-07-06 18:37:45 +08:00
Xinchen Hui
a362ae6b12 Rename _zval_dtor_func to _ref_dtor_func 2018-07-06 18:32:27 +08:00
Dmitry Stogov
dcf7592076 Optimize array to object casting 2018-07-06 03:10:05 +03:00
Dmitry Stogov
85b2bc38e1 Optimize object to array casting 2018-07-06 01:25:24 +03:00
Dmitry Stogov
3a8f26060c Argument unpacking with Traversables and non-integer keys.
Changed error message, added UPGRADING note and test.
2018-07-04 22:34:36 +03:00