Nikita Popov
bac5137e4e
Add zend_create_member_string() API
...
This is a recurring pattern.
2020-04-14 16:52:13 +02:00
Nikita Popov
d030ddb2cd
Export the zend_string_concat3() API
2020-04-09 15:06:53 +02:00
Nikita Popov
1ed132e2e5
Unify checks for binary operator errors for ct eval
...
Move everything into one function and share it with opcache.
This fixes some discrepancies.
2020-04-01 14:42:58 +02:00
Nikita Popov
56b18d478e
Don't convert binop operand types in opcache
...
This may produce different behavior if operator overloading is
involved, and may change the error message.
If there's strong interest, this could be done in the DFA pass
with available type information. It does not look particularly
practically useful to me though.
2020-04-01 14:39:41 +02:00
Nikita Popov
2d8f9f34dd
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fix literal compaction collision between string and double
2020-04-01 14:23:07 +02:00
Nikita Popov
59c8d6a863
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix literal compaction collision between string and double
2020-04-01 14:22:27 +02:00
Nikita Popov
14b770d407
Fix literal compaction collision between string and double
...
For the sake of simplicity I'm using a separate hashtable, rather
than trying to do hash perturabation on the double strings.
2020-04-01 14:20:59 +02:00
Tyson Andre
47ddd95836
Do constant evaluation for str_contains in opcache
...
Both arguments must be strings.
str_contains deliberately does not emit a warning for an empty needle.
Closes GH-5324
2020-03-30 09:54:38 -04:00
Nikita Popov
a34480ec82
SCCP: Optimize strpos with empty needle
...
This is no longer special cases in PHP 8.
2020-03-30 10:37:22 +02:00
Dmitry Stogov
099ffc2169
BIND_GLOBAL and BIND_STATIC don't use value of the first operand
2020-03-27 15:20:21 +03:00
Nikita Popov
97cb81ead5
Remove HAVE_REALPATH checks
...
We do not actually use realpath(), but a custom implementation.
Make sure the realpath() function is always available.
Closes GH-5290.
2020-03-26 11:46:00 +01:00
Dmitry Stogov
5a05fef2af
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fixed bug #79412 (Opcache chokes and uses 100% CPU on specific script).
2020-03-25 17:38:08 +03:00
Dmitry Stogov
91ee85c20c
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fixed bug #79412 (Opcache chokes and uses 100% CPU on specific script).
2020-03-25 17:31:33 +03:00
Dmitry Stogov
65120cfc09
Fixed bug #79412 (Opcache chokes and uses 100% CPU on specific script).
2020-03-25 17:31:06 +03:00
Dmitry Stogov
b7c6244dfc
Add new line before basic-block labels (except for the first BB0)
2020-03-25 14:26:42 +03:00
Dmitry Stogov
0684b9fcdc
Always print numeric opline numbers
2020-03-25 14:26:42 +03:00
Dmitry Stogov
af3142daaf
Make SSA dump format controlled by opcache.jit_debug more readable (always print opcode number).
...
This doesn't affect dumps controlled by opcache.opt_debug_level.
2020-03-24 22:44:11 +03: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
Dmitry Stogov
7283dbba27
ZEND_MAKE_REF can't throw
2020-03-20 01:37:27 +03:00
Dmitry Stogov
8e879b9f44
JIT for ZEND_CHECK_FUNC_ARG
2020-03-18 23:56:03 +03:00
Nikita Popov
1ba6e66c46
Improve type inference
...
After thinking about this a bit more, the code here was too
conservative. We know that everything but an object is going to
throw, so it's sufficient to restrict the type to MAY_BE_OBJECT.
The change in the test is weird but not incorrect, because it
operates on empty inferred types, in which case the code must be
dead (which it is). We should probably add a more explicit removal
of code working on empty types.
2020-03-17 15:41:47 +01:00
Nikita Popov
41a86a72c4
Clean up a few more places
2020-03-17 15:23:52 +01:00
Nikita Popov
023039fbfc
Remove object auto-vivification leftovers in type-inference
...
undef/null/false no longer get promoted to object in PHP 8.
In fact, we may drop the SSA var defs outside RC inference mode now.
2020-03-17 14:54:11 +01:00
Nikita Popov
3723985058
Merge EX variants of INFO macros
2020-03-16 13:02:16 +01:00
Nikita Popov
d35ce5d661
Merge EX variants of RANGE macros
...
Only need to create the ssa_op variable in range inference...
2020-03-16 12:36:03 +01:00
Nikita Popov
44b3971b85
Merge zend_may_throw(_ex)
...
Explicitly pass ssa_op in the places that don't do so yet.
2020-03-16 12:24:40 +01:00
Dmitry Stogov
9a8f735c57
Emit warning about type narrowing for tracing JIT as well
2020-03-14 01:29:46 +03:00
Dmitry Stogov
29bf7902b3
Fixed RC inference for ZEND_ASSIGN_STATIC_PROP and removed useless checks during RC inference
2020-03-14 01:17:45 +03:00
Dmitry Stogov
4bf2d09ede
Tracing JIT (it doesn't support register allocation yet)
...
Use opcache.jit=1255 to swith it on (the third digit 5 really matters)
Use opcache.jit_debug=0xff001 to see how it works and what code it generates
2020-03-13 22:11:07 +03:00
Nikita Popov
d15012d5e8
Accept const op_array in zend_build_call_map
2020-03-13 16:25:28 +01:00
Nikita Popov
9e89f91341
Add assertions for DIM_W/RW uses
...
The result should be used only once and on the directly next opline,
otherwise it may not be safe. Add some assertions to that effect.
2020-03-13 13:11:42 +01:00
Nikita Popov
9ab2cb923e
Also remove dead arguments
2020-03-13 12:45:02 +01:00
Nikita Popov
b979e03159
Remove dead type narrowing code
...
Rename handle_type_narrowing() to clarify what it does, and
remove dead code for resetting dependent vars.
2020-03-13 12:27:49 +01:00
Nikita Popov
d9c45d86f9
Improve type inference for COALESCE
...
Place a pi node on the non-null edge to remove a spurious
undef/null type.
Additionally, adjust the profitability heuristic to be more
accurate if the "other predecessor" writes to the variable.
Ideally this should not just consider the direct predecessors,
but it's sufficient for this case.
This partially addresses bug #79353 by removing the discrepancy
between ?? and ??=.
2020-03-09 16:19:48 +01:00
Máté Kocsis
3ab75ac019
Update MySQLi function info
...
Closes GH-5214
2020-02-28 14:36:54 +01:00
Dmitry Stogov
63761d1133
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fixed incorrect overflow detection
2020-02-27 23:38:19 +03:00
Dmitry Stogov
cb88184420
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fixed incorrect overflow detection
2020-02-27 23:38:09 +03:00
Dmitry Stogov
5b51b633e2
Fixed incorrect overflow detection
2020-02-27 23:37:41 +03:00
Nikita Popov
5a90392c6a
Use EX_NUM_TO_VAR() in more places
...
Not sure why I missed these before.
2020-02-27 13:13:24 +01:00
Nikita Popov
1949a26aac
Remove more null arithmetic UB
...
Introduce an EX_NUM_TO_VAR macro to mirror EX_VAR_TO_NUM and
replace usages of the ZEND_CALL_VAR_NUM(NULL) pattern.
2020-02-27 12:54:48 +01:00
Nikita Popov
43443857b7
Add static return type
...
RFC: https://wiki.php.net/rfc/static_return_type
The "static" type is represented as MAY_BE_STATIC, rather than
a class type like "self" and "parent", as it has special
resolution semantics, and cannot be cached in the runtime cache.
Closes GH-5062.
2020-02-17 11:51:09 +01:00
Nikita Popov
d933591674
Add support for $obj::class
...
This allows $obj::class, which gives the same result as get_class($obj).
Anything other than an object results in TypeError.
RFC: https://wiki.php.net/rfc/class_name_literal_on_object
Closes GH-5065.
2020-02-11 12:16:30 +01:00
Dmitry Stogov
64b40f69dc
Make ASSIGN, ASSIGN_OP, INC and DEC opcodes to return IS_TMP_VAR instead of IS_VAR.
...
This helps to avoid unnecessary IS_REFERENCE checks.
This changes some notices "Only variables should be passed by reference" to exception "Cannot pass parameter %d by reference".
Also, for consistency, compile-time fatal error "Only variables can be passed by reference" was converted to exception "Cannot pass parameter %d by reference"
2020-02-07 13:36:52 +03:00
Nikita Popov
4f5f72c7af
Remove ZEND_ACC_INHERITED flag
...
It is equivalent to checking ce->parent != NULL. Just adds more
state that needs to be kept in sync.
2020-02-06 10:42:25 +01:00
Dmitry Stogov
08d2d9257d
Export zend_dump_op() and add ZEND_DUMP_NUMERIC_OPLINES flag to print oplines as "dddd" instead of "Ld+"
2020-01-31 13:27:35 +03:00
Nikita Popov
b33697d47e
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fixed bug #79193
2020-01-30 14:56:31 +01:00
Nikita Popov
f70b552326
Fixed bug #79193
2020-01-30 14:55:58 +01:00
Tyson Andre
5f92a085cc
Convert ZEND_ECHO operand to string after sccp
...
And filter out echoes of the empty string (e.g. false/null)
Split out of #5097 (on GitHub)
Closes GH-5118
2020-01-27 20:21:24 -05:00