Commit Graph

45 Commits

Author SHA1 Message Date
Nikita Popov
2aba10be4a Reduce ZEND_THROW specialization
Throwing is very expensive due to the need of gathering the backtrace,
so it makes little sense to optimize refcounting to this degree.
2019-10-09 13:17:25 +02:00
Dmitry Stogov
853b426ecf Avoid over-specialization 2019-07-24 19:51:56 +03:00
Nikita Popov
1eb706179f Avoid references in TMP var
Make sure we deref the OBJ_IS result, because we store it in a TMP
var, which is not allowed to contain references and will cause
assertion failures in the unspecialized VM.

This also partially reverts fd463a9a60,
which merged the TMP and VAR specializations of COALESCE to work
around this bug.

An alternative would be to change the result type of OBJ_IS back
to VAR.
2019-07-24 10:07:26 +02:00
Dmitry Stogov
b30e4a5aa6 Avoid extra specialization for cold opcodes 2019-07-17 14:03:48 +03:00
Dmitry Stogov
918f09f72a Added specialization for comparison instructions and QM_ASSIGN 2019-07-17 09:12:01 +03:00
Dmitry Stogov
349a388b90 Slit INC/DEC opcodes into hot/cold parts and remove specialized versioins for LONG_OR_DOUBLE. 2019-07-16 17:39:25 +03:00
Dmitry Stogov
2e26b063b6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed incorrect specialization (missed IS_INDIRECT handling)
2019-07-16 01:54:22 +03:00
Dmitry Stogov
c570980175 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed incorrect specialization (missed IS_INDIRECT handling)
2019-07-16 01:52:11 +03:00
Dmitry Stogov
ef1a1a0698 Separate "cold" parts of comparison instructions 2019-07-11 20:44:39 +03:00
Dmitry Stogov
be94c0c3c6 Separate "cold" parts of binary op instructions 2019-07-11 18:23:08 +03:00
Dmitry Stogov
e1f418dd18 Remove duplicated code for (PRE|POST)_DEC_(OBJ|STATIC_PROP) opcodes 2019-07-09 10:46:04 +03:00
Dmitry Stogov
48ca5a1e17 Replace ZEND_ASSIGN_ADD (and others) by ZEND_ASSIGN_OP, ZEND_ASSIGN_DIM_OP, ZEND_ASSGIN_OBJ_OP and ZEND_ASSIGN_STATIC_PROP_OP 2019-07-05 12:03:25 +03:00
Dmitry Stogov
ef05eab432 Improve zend_binary_assign_op helpers.
Reorder opcode numbers to make ADD-POW and ASSIGN_ADD-ASSIGN_POW opcodes sequencional.
2019-07-04 17:25:43 +03:00
Dmitry Stogov
56b8b165f8 Optimization of INC/DEC helpers 2019-07-03 10:33:03 +03:00
Dmitry Stogov
e8f1f70101 Reduce overhead of delayed early binding 2019-06-25 14:20:41 +03:00
Nikita Popov
89b2d88659 Register class before fetching parent
We want the class declaration to be available while compiling the
parent class.
2019-06-11 13:09:33 +02: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
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
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
Dmitry Stogov
d4bef4ce7b Avoid useless code duplication, because of unused specialization 2019-02-15 17:49:39 +03: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
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
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
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
6d88e1ccd6 Don't use second operand of BIND_STATIC instruction. 2018-08-21 12:22:04 +03: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
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
Dmitry Stogov
004a0568f4 Eliminated REFCOUNTED checks on persistent constant operands in SEND_VAL[_EX] and QM_ASSIGN. 2018-07-03 13:10:22 +03:00
Dmitry Stogov
1597b56619 Inline few small opcode handlers into hybrid executor 2018-06-07 16:30:53 +03:00
Dmitry Stogov
9e0f131d2b Fixed ISSET/ISEMPTY bit meaning to simplify run-time checks 2018-05-31 19:02:51 +03:00
Dmitry Stogov
84aab1d4e1 Marked rarely used opcodes as "cold" (e.g. ADD_CONST_CONST ususaly optimized out). 2018-05-30 01:50:44 +03:00
Dmitry Stogov
4aa9505b6e Merge identical handlers 2018-03-29 11:13:17 +03:00
Dmitry Stogov
e791e93b55 Make ZEND_ISSET_ISEMPTY_CV specialised across ISSET/ISEMPTY and HOT (the handler is really small, so inlining affects executor size insignificantly) 2018-03-22 13:03:45 +03:00
Dmitry Stogov
6fb9e24218 Allow generation of VM map 2018-02-22 15:31:00 +03:00
Andi Gutmans
e86edc5f1b - Nuke another two files 2004-10-22 22:01:34 +00:00
Marcus Boerger
f71644b480 - Revert automatic pass arg_info
# We need to find a better solutions to prevent havy extension writer probs
2004-10-08 22:17:32 +00:00
Marcus Boerger
f916d603ef - Add arginfo ZEND_ARG_SEND_AUTOMATIC which lets the compiler automatically
determine whether pass by ref is possible or pass by value is needed.
# This is usefull when functions take array or string parameters as
# expressions. In such a case force by ref is not applicable and the
# executor would copy the variable unnecessarily as soon as it is at least
# once referenced.
2004-10-05 18:36:46 +00:00
Dmitry Stogov
3d383e45dc Fixed unset() bug that was introduced with CV optimization patch 2004-10-05 09:09:18 +00:00
Dmitry Stogov
3f35c6a6cc Added test cases for CV optimization patch 2004-10-05 06:53:39 +00:00
Andi Gutmans
db507dd153 - Commit the variable fetch optimization.
- Extensions which delete global variables need to use new special function
- delete_global_variable() (I'm about to rename it) to remove them.
- Will post to internals@ or via commit messages if there's anything else.
2004-10-04 19:54:35 +00:00
Dmitry Stogov
480f4e3565 Specializer was updated with executor's fixes. 2004-09-22 08:45:21 +00:00
Andi Gutmans
8eb8850c90 - Some architectural changes:
a) We specialize opcodes according to op_type fields. Each opcode has to
    be marked with which op_type's it uses.
 b) We support different execution methods. Function handlers, switch()
    and goto dispatching. goto seems to be the fastest but it really
    depends on the compiler and how well it optimizes. I suggest playing
    around with optimization flags.

- Warning: Things might break so keep us posted on how things are going.
  (Dmitry, Andi)
2004-09-08 22:14:12 +00:00