1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 11:13:36 +02:00
Commit Graph

2910 Commits

Author SHA1 Message Date
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
Dmitry Stogov 4b89d96489 Improved JIT for ZEND_ASSIGN 2020-03-17 15:45:54 +03:00
Nikita Popov b1a082da25 Fix typos 2020-03-17 12:59:37 +01:00
Dmitry Stogov 902e19ddf3 Store informaton about class 2020-03-17 00:25:47 +03:00
Dmitry Stogov 7069b55ba4 Fixed recording classes of object references 2020-03-16 23:08:07 +03:00
Nikita Popov 6a0b59d085 Slightly deduplicate code
This code is the same in both branches, extract it.
2020-03-16 17:07:27 +01:00
Nikita Popov eb7e1df228 Remove "safe" argument from ZVAL_PTR_DTOR
This is no longer used
2020-03-16 17:07:27 +01:00
Nikita Popov cfd79841f4 Fix typos 2020-03-16 17:07:27 +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
Nikita Popov 5c65562ce4 Remove unnecessary cast 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
Dmitry Stogov 78b64bd4ed Merge branch 'PHP-7.4'
* PHP-7.4:
  Check asserts early
  identation fix
  Call global code of preloaded script in global context
  Avoid "Anonymous class wasn't preloaded" error by lazely loading of not preloaded part of a preloaded script
2020-03-13 11:42:07 +03:00
Dmitry Stogov b6492b4453 identation fix 2020-03-12 22:26:16 +03:00
Dmitry Stogov 3c6e9bed1a Call global code of preloaded script in global context 2020-03-12 22:19:47 +03:00
Dmitry Stogov 2dddab01ae Avoid "Anonymous class wasn't preloaded" error by lazely loading of not preloaded part of a preloaded script 2020-03-12 16:31:24 +03:00
Christoph M. Becker b31f73b1c8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Enclose INI values containing {TMP} in quotes
2020-03-09 22:53:23 +01:00
Christoph M. Becker fea2994ff8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Enclose INI values containing {TMP} in quotes
2020-03-09 22:51:11 +01:00
Christoph M. Becker d5e206620b Enclose INI values containing {TMP} in quotes
At least on Windows, the temporary directory may contain tilde signs,
which would result in an INI parse error.
2020-03-09 22:49:08 +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
Nikita Popov 191451da90 Fix bug #79358: JIT miscompile in composer 2020-03-09 12:55:14 +01:00
Nikita Popov 941a3b6ccd Remove unnecessary uses of CHECK_SILENT
If no error is passed, it is always silent.
2020-03-06 16:36:45 +01:00
Nikita Popov 33ef3d64da Use separate typedef for bucket comparison function
Avoid performing the same casting dance inside each sort compare
function.
2020-03-04 12:46:06 +01:00
Nikita Popov 53efa1b0c6 Store aliased name of trait method
Currently, trait methods are aliased will continue to use the
original function name. In a few places in the codebase, we will
try to look up the actual method name instead. However, this does
not work if an aliased method is used indirectly
(https://bugs.php.net/bug.php?id=69180).

I think it would be better to instead actually change the method
name to the alias. This is in principle easy: We have to allow
function_name to be changed even if op array is otherwise shared
(similar to static_variables). This means we need to addref/release
the function_name separately, but I don't think there is a
performance concern here (especially as everything is usually
interned).

There is a bit of complication in opcache, where we need to make
sure that the function name is released the correct number of times
(interning may overwrite the name in the original op_array, but we
need to release it as many times as the op_array is shared).

Fixes bug #69180.
Fixes bug #74939.
Closes GH-5226.
2020-03-03 11:55:48 +01:00
Nikita Popov bb85478bcc Merge branch 'PHP-7.4'
* PHP-7.4:
  Try to fix msvc build
2020-02-28 14:49:03 +01:00
Nikita Popov a7de98fb12 Try to fix msvc build 2020-02-28 14:48:02 +01:00
Máté Kocsis 3ab75ac019 Update MySQLi function info
Closes GH-5214
2020-02-28 14:36:54 +01:00
Nikita Popov 519a72e0b4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79252
2020-02-28 12:49:45 +01:00
Nikita Popov 30ee3f48d4 Fixed bug #79252 2020-02-28 12:47:56 +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 819a872cfa Avoid more null arithmetic 2020-02-27 14:48:43 +01: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
Máté Kocsis ac0853eb26 Make type error messages more consistent
Closes GH-5092
2020-02-17 14:22:17 +01:00
Nikita Popov 72bd55902d Improve generated names for anonymous classes
In order of preference, the generated name will be:

    new class extends ParentClass {};
    // -> ParentClass@anonymous
    new class implements FirstInterface, SecondInterface {};
    // -> FirstInterface@anonymous
    new class {};
    // -> class@anonymous

This is intended to display a more useful class name in error messages
and stack traces, and thus make debugging easier.

Closes GH-5153.
2020-02-17 12:21:33 +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
Dmitry Stogov cf8407a238 Fixed bug #79255 (PHP cannot be compiled with enable JIT) 2020-02-17 12:03:49 +03:00
Nikita Popov 7a8f180b19 Revert "Fixed bug #79255 (PHP cannot be compiled with enable JIT)"
This reverts commit de6984edd5.

Reverting to unbreak 32-bit CI.
2020-02-17 09:34:56 +01:00
Xinchen Hui de6984edd5 Fixed bug #79255 (PHP cannot be compiled with enable JIT) 2020-02-17 13:13:49 +08:00
Nikita Popov f3d8ac1d95 Fix JIT trait type errors
We need to load EX->func here rather than use a hardcoded op_array,
as it may be copied with adjusted scope for traits.
2020-02-13 15:16:23 +01:00
Dmitry Stogov b79af3d4df Removed unused macro 2020-02-11 17:30:49 +03:00