1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 09:28:21 +02:00
Commit Graph

1479 Commits

Author SHA1 Message Date
Nikita Popov f38d6cea42 Check func_info consistency
Make sure explicitly specified func_info is a subset of
automatically computed info. This will at least prevent
cases where a type is removed from stubs, but not removed
from func_info.

Closes GH-5471.
2020-04-27 16:25:59 +02:00
Nikita Popov c5f87eee5d Mark passthru() as RC0
This function only returns null/false, RC1 does not make sense.
2020-04-27 15:39:31 +02:00
Nikita Popov 58eafbe734 Make array_rand() type info more accurate 2020-04-27 15:36:32 +02:00
Nikita Popov cc8a8613b6 Remove MAY_BE_FALSE from range() type info 2020-04-27 15:36:32 +02:00
Máté Kocsis a6960cfb05 Fix inaccurate func infos
Closes GH-5472
2020-04-27 15:35:44 +02:00
Nikita Popov 19e886d9d8 Avoid throw expression leaks
Mark "throw" used in expression context with a flag, and don't
treat it as a BB terminator in that case. This prevents us from
optimizing away the following opcodes as unreachable, which may
result in live ranges being dropped incorrectly.

Close GH-5450.
2020-04-27 15:22:05 +02:00
Nikita Popov a447897db0 Use information about classes returned by internal functions 2020-04-27 12:50:24 +02:00
Tyson Andre 4e1219ac88 [skip ci] Fix typos in jit code comments
And in Opcache's zend_cfg.h

Closes GH-5414
2020-04-19 10:03:49 -04:00
Christoph M. Becker a1eaaa692e Fix #79475: [JIT] func_get_args() assertion violation
`func_get_args()` may return `zend_empty_array`, which has refcount 2
to enforce separation.   We have to cater to that during type inference
so that the optimization in the JIT macro `SEPARATE_ARRAY` doesn't
prevent the separation.
2020-04-17 09:53:23 +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 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