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
315ea609da
Remove restriction on method call inlining
...
In PHP 8, we are guaranteed that $this exists, so we no longer have
to forbid this case.
2020-06-29 09:54:31 +02:00
Nikita Popov
bc62acf874
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Don't inline static call to instance method
2020-06-29 09:53:09 +02:00
Nikita Popov
fabcd9f14e
Don't inline static call to instance method
...
Fixes the failure in bug79740.phpt with opcache.
2020-06-29 09:52:37 +02:00
Christoph M. Becker
92c4b06513
Use ZEND_UNREACHABLE() instead of ZEND_ASSERT(0)
...
Instead of marking unreachable code with `ZEND_ASSERT(0)`, we introduce
`ZEND_UNREACHABLE()`, so that MSVC which does not consider `assert(0)`
to mark unreachable code does no longer trigger C4715[1] warnings in
debug builds. This may be useful for other compilers as well.
[1] <https://docs.microsoft.com/de-de/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4715?view=vs-2019 >
2020-06-16 18:39:09 +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
ac4e0f0852
Make zend_type a 2-field struct
...
We now store the pointer payload and the type mask separately. This
is in preparation for union types, where we will be using both at
the same time.
To avoid increasing the size of arginfo structures, the
pass_by_reference and is_variadic fields are now stored as part of
the type_mask (8-bit are reserved for custom use).
Different types of pointer payloads are distinguished based on bits
in the type_mask.
2019-11-08 15:15:48 +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
da919a8b65
Remove copyright years.
2019-02-05 10:33:28 +03: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
67e0138c0d
Future-proof email addresses...
2018-11-01 18:30:28 +02:00
Gabriel Caruso
2d48d734a2
Fix some misspellings
2018-02-06 16:59:00 +01:00
Dmitry Stogov
ca035f26aa
Moved "zval.u2.cache_slot" into free room of "zend_op"
2018-02-05 19:41:47 +03: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
Dmitry Stogov
bf7176c70f
Use reference-counting instead of duplication and separation, if really necessary.
2018-01-19 01:03:24 +03:00
Xinchen Hui
a6519d0514
year++
2018-01-02 12:57:58 +08:00
Dmitry Stogov
ef5ea48741
Always use IS_CONSTANT_AST (IS_CONSTANT is removed).
2017-10-10 10:11:05 +03:00
Dmitry Stogov
e70618aff6
Changed the way VM accesses constant operands in 64-bit builds.
2017-10-04 16:53:01 +03:00
Dmitry Stogov
b685991b44
Get rid of old compatibility macros
2017-07-04 09:50:57 +03:00
Sammy Kaye Powers
9e29f841ce
Update copyright headers to 2017
2017-01-02 09:30:12 -06:00
Nikita Popov
5f4f83220a
Don't inline if function has ref arguments
...
Otherwise we end up leaving opcodes like FETCH_DIM_W behind. The
test case demonstrates a leak in particular.
2016-11-12 18:49:41 +01:00
Nikita Popov
3c8beb16c4
Allow early-binding of ZEND_NEW args
2016-11-10 22:52:15 +01:00
Nikita Popov
62af7e0db8
Merge branch 'PHP-7.0' into PHP-7.1
2016-11-10 22:19:48 +01:00
Nikita Popov
bb3d0c0e17
Fcall optimization: Avoid FETCH_DIM_R with UNUSED op2
2016-11-10 21:36:46 +01:00
Dmitry Stogov
acdafc0a27
Prevent inlining through call_user_func() and call_user_func_array()
2016-07-01 00:16:54 +03:00
Dmitry Stogov
1a14533806
Introduce new CHECK_VAR instruction to keep warnings about undefined variables.
2016-06-30 21:40:34 +03:00
Dmitry Stogov
3a45242669
Disable inlining for $this->foo(), because $this may be not in object context
2016-06-30 21:05:48 +03:00
Dmitry Stogov
c3667a5eed
Disable inlining for $this->foo(), because $this may be used not in object context
2016-06-30 21:03:08 +03:00
Nikita Popov
6f8273e3bf
Fix RT_CONSTANT_EX typo
2016-06-30 17:42:57 +02:00
Dmitry Stogov
d898344663
Inline simple constant functions
2016-06-30 17:04:25 +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
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
Nikita Popov
4f54c15cb1
Ct bind private/final $this method call args
...
The test covers two edge-cases wrt opcache support.
2016-04-27 17:10:44 +02:00
Dmitry Stogov
b73517c1a1
Use DO_FCALL_BY_NAME instead of DO_FCALL, if possible
2016-04-14 16:07:28 +03:00
Nikita Popov
3ad0e1d6ca
Fix static method arg binding in traits
2016-04-08 01:48:21 +02:00
Nikita Popov
b867bd1c8d
Fix FETCH_CLASS_SELF comparisons
...
Turns out those don't form a bitfield.
2016-03-26 22:45:23 +01:00
Nikita Popov
64dae1ea76
Statically bind static method call arguments
...
If we know what method will be called, use ct-bound send opcodes.
The intl test is changed because a runtime error changed to a
compile-time error.
2016-03-14 17:50:56 +01:00
Xinchen Hui
63fb2b7118
Improve the names
2016-01-25 16:00:10 +08:00
Lior Kaplan
3d5438bf7b
Merge branch 'PHP-7.0'
...
* PHP-7.0:
Update header to PHP Version 7
Happy new year (Update copyright to 2016)
Happy new year (Update copyright to 2016)
2016-01-01 20:04:31 +02:00
Lior Kaplan
2eb1f38d24
Happy new year (Update copyright to 2016)
2016-01-01 20:03:16 +02:00
Dmitry Stogov
eb7be5379d
Speed up fetching of class entries for self:: parent:: and static::
...
This is generalized solution for Bob's idea of speed up self::method() calls without ZEND_FETCH_CLASS.
At first, it adds few new opcodes to separate class related behaviour:
FETCH_STATIC_PROP_R
FETCH_STATIC_PROP_W
FETCH_STATIC_PROP_RW
FETCH_STATIC_PROP_FUNC_ARG
FETCH_STATIC_PROP_UNSET
FETCH_STATIC_PROP_IS
UNSET_STATIC_PROP
ISSET_ISEMPTY_STATIC_PROP
FETCH_CLASS_CONSTANT
At seconds, it enables IS_UNUSED operand to fetch (self, parent or static without separate FETCH_CLASS) for new opcodes and the following ones:
INIT_STATIC_METHOD_CALL
NEW
END_INSTANCEOF
Finaly, opcache optimizer had to be fixed to support new opcodes.
2015-10-28 21:26:52 +03:00
Xinchen Hui
ec00a4de4e
Merge branch 'PHP-5.6'
2015-03-04 14:49:03 +08:00
Xinchen Hui
a29b64fc10
Fixed bug #69159 (Opcache causes problem when passing a variable variable to a function)
2015-03-04 14:48:41 +08:00
Dmitry Stogov
c2c78dc963
Added specialized versions of DO_FCALL handler:
...
DO_ICALL - for internal functions
DO_UCALL - for user functions
DO_FCALL_BY_NAME - plain, most probably user, funcstions (not methods)
2015-02-25 10:37:21 +03:00
Dmitry Stogov
dcb96c2e03
Split INIT_FCALL_BY_NAME inti INIT_FCALL_BY_NAME(CONST+STRING) and INIT_DYNAMIC_CALL(CONST-STRING|TMPVAR|CV)
2015-02-24 22:29:47 +03:00
Xinchen Hui
fc33f52d8c
bump year
2015-01-15 23:27:30 +08:00
Stanislav Malyshev
b7a7b1a624
trailing whitespace removal
2015-01-10 15:07:38 -08:00
Anatol Belski
bdeb220f48
first shot remove TSRMLS_* things
2014-12-13 23:06:14 +01:00
Dmitry Stogov
9ea35a37b9
Make ZEND_INIT_FCALL keep predcalculted size of necessary stack space in opline->op1.num to avoid its recalculation on each execution.
2014-12-12 09:01:42 +03:00
Dmitry Stogov
e20a727430
SEND_VAR_NO_REF optimization
2014-11-18 14:37:36 +03:00