1
0
mirror of https://github.com/php/php-src.git synced 2026-04-23 16:08:35 +02:00
Commit Graph

3646 Commits

Author SHA1 Message Date
Dmitry Stogov 337d2af6ca zend_jit_trace_stack_frame.stack can't be NULL 2020-11-23 16:19:22 +03:00
Dmitry Stogov 586ccfdfd5 Fixed use-after-free in PHPUnit tests 2020-11-23 14:42:38 +03:00
Dmitry Stogov 4cf3da7383 Keep value of register before possible side exit 2020-11-23 12:07:05 +03:00
Nikita Popov fa67864c13 Use MIN/MAX when dumping RANGE[]
It's very common that one of the bounds is LONG_MIN or LONG_MAX.
Dump them as MIN/MAX instead of the int representation in that
case, as it makes the dump less noisy.
2020-11-20 16:47:46 +01:00
Dmitry Stogov c0d1dbcb43 Fixed incorrect TRACE_FRAME_MASK_NESTED flag setting 2020-11-20 18:22:21 +03:00
Dmitry Stogov c8df28d276 Fixed 32-bit JIT 2020-11-20 15:12:30 +03:00
Dmitry Stogov 069f9cbaa5 Added missing deoptimization code for trampoline handling 2020-11-19 12:32:36 +03:00
Dmitry Stogov feed041fc8 Fixed register clobbering 2020-11-18 10:22:25 +03:00
Dmitry Stogov 9841e8e411 Fixed trampoline handling 2020-11-17 23:56:05 +03:00
Dmitry Stogov e364af91b5 Fixed allocated register clobbering 2020-11-17 18:31:14 +03:00
Dmitry Stogov 1523733bc4 Fixed false pasitive ASAN NULL pointer dereference warning 2020-11-17 16:23:30 +03:00
Nikita Popov 9cfb5261e4 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix incorrectly optimized out live range
2020-11-17 10:20:23 +01:00
Nikita Popov df7417d127 Fix incorrectly optimized out live range
For x ? y : z style structures, the live range starts at z, but
may also hold the value of y. Make sure that the refcounting check
takes this into account, by checking the type of a potential phi
user.
2020-11-17 10:19:57 +01:00
Dmitry Stogov 3fb1b0862c Fixed MAY_BE_INDIRECT inference 2020-11-16 18:17:05 +03:00
Dmitry Stogov e3c63de05b Fixed alias handling 2020-11-16 16:11:25 +03:00
Dmitry Stogov eb6d496a93 Fixed reference-counting 2020-11-16 14:51:55 +03:00
Dmitry Stogov edf5c1901f Fixed incorrect FETCH_THIS optimization 2020-11-16 14:51:39 +03:00
Dmitry Stogov bd321df479 Fixed inconsistent VM stack state 2020-11-16 13:19:44 +03:00
Dmitry Stogov 64dc79f906 Trampoline cleanup 2020-11-16 12:05:45 +03:00
Dmitry Stogov 9acebe14df Fixed incorrectly eliminated type store 2020-11-11 20:13:58 +03:00
Dmitry Stogov 03e7854381 Remove assertion 2020-11-11 18:34:16 +03:00
Dmitry Stogov 2d2d42b268 Fixed incorrect invariant guard motion 2020-11-11 17:34:46 +03:00
Dmitry Stogov de359c00b4 Stop on fake frame 2020-11-11 14:54:54 +03:00
Dmitry Stogov a0de82ad75 Fixed reference-counting propagation 2020-11-11 14:54:00 +03:00
Dmitry Stogov 11c4821ba9 [Observer+JIT] Save opline before calling begin/end handlers 2020-11-11 13:50:53 +03:00
Nikita Popov 523dd9a2d9 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix phi use chain management when renaming variable
2020-11-09 17:08:38 +01:00
Nikita Popov d971b67027 Fix phi use chain management when renaming variable
If there is a previous use of the new variable in the phi, we need
to NULL out the use chain of the new source we're adding.

Test case is reduced from an assertion failure in the Symfony Demo.
2020-11-09 17:08:16 +01:00
Dmitry Stogov 4bbe55b250 Fixed missaligned access 2020-11-09 11:50:26 +03:00
Nikita Popov 5df461bc91 Skip preload test under asan
Just like the other preload tests with startup failures, this may
cause leaks.
2020-11-09 09:46:48 +01:00
Dmitry Stogov 98e4f9466d Move stack overflow checks out of the loops 2020-11-06 12:09:56 +03:00
Nikita Popov 6808968c89 Backport preloading trait fixup fixes
This cherry-picks 33969c2252 and
2effbfd871 from PHP-8.0.

The issues these commits fix could also manifest in PHP 7.4, and
a commenter on bug #80307 reports this this might indeed be
happening.
2020-11-05 16:35:08 +01:00
Dmitry Stogov ff91800602 Fixed incorrect invariant guard motion 2020-11-05 18:32:00 +03:00
Nikita Popov 2effbfd871 Fixup trait methods even if no traits are used
Trait methods might be non-trivially inherited, in which case we
may have to perform fixup in classes that do not directly use any
traits.
2020-11-05 13:15:32 +01:00
Nikita Popov 33969c2252 Fix multiple trait fixup
If a trait method is inherited, preloading trait fixup might be
performed on it multiple times. Usually this is fine, because
the opcodes pointer will have already been updated, and will thus
not be found in the xlat table.

However, it can happen that the new opcodes pointer is the same
as one of the old opcodes pointers, if the pointer has been reused
by the allocator. In this case we will look up the wrong op array
and overwrite the trait method with an unrelated trait method.

We fix this by indexing the xlat table not by the opcodes pointer,
but by the refcount pointer. The refcount pointer is not changed
during optimization, and accurately represents which op arrays
should use the same opcodes.

Fixes bug #80307. The test case does not reproduce the bug, because
this depends on a lot of "luck" with the allocator. The test case
merely illustrates a case where orig_op_array would have been NULL
in the original code.
2020-11-05 12:04:39 +01:00
Nikita Popov 7c7c6b0d73 End output handlers in preload shutdown
Same as in php_request_shutdown(), we need to end any active
output handlers, as these may no longer be safe to execute
lateron.
2020-11-04 16:05:24 +01:00
Nikita Popov 670fe594b9 Fix static variable in methods inheritance during preloading
This is now "bug compatible" with the normal behavior, and more
imporantly, does not crash :)
2020-11-04 15:42:52 +01:00
Nikita Popov 7794925ba4 Assert that references are not persisted
There should not be any need to persist references, and it's unlikely
that persisting a reference will behave correctly at runtime, because
we don't have a concept of an immutable reference.
2020-11-04 14:51:44 +01:00
Nikita Popov c6563dddac Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix dynamic function definition in preload script
2020-11-04 10:55:59 +01:00
Nikita Popov e0d6c3f7ba Fix dynamic function definition in preload script
We should use normal function renaming if the function is declared
during preloading itself, rather than afterwards.

This fixes a regression introduced by
68f80be9d1.
2020-11-04 10:54:08 +01:00
Nikita Popov 54668a449e Don't disable early binding during preloading script
We should only disable early binding during the opcache_compile_file()
calls, not inside the preloading script or anything it includes.
The right condition to check for is whether we compile the file
without execution, as declaring classes is "execution".
2020-11-03 16:45:13 +01:00
Nikita Popov b009573f4e Report parse errors during preloading 2020-11-03 16:24:54 +01:00
Nikita Popov 9fd8e00f1a Fix use of type copy ctor when importing trait properties
We shouldn't call the copy constructor inside the original type,
duh.
2020-11-03 15:29:18 +01:00
Nikita Popov 7e55317558 Allow unlinked classes when performing in_compilation variance check
As preloading runs in in_compilation mode, we also need to allow
use of unlinked classes in lookup_class().
2020-11-03 14:49:10 +01:00
Nikita Popov ee934f8245 Fix variance checks on resolved union types
This is a bit annoying: When preloading is used, types might be
resolved during inheritance checks, so we need to deal with CE
types rather than just NAME types everywhere.
2020-11-03 14:19:15 +01:00
Nikita Popov 51b5f7d67d Don't ignore internal classes during preloading
When preloading, it's fine to make use of internal class information,
as we do not support Windows. It is also necessary to allow proper
variance checks against internal classes.
2020-11-03 11:50:14 +01:00
Nikita Popov 14c42c6961 Fix persisting property info table with internal parent
If the property info comes from an internal parent, we won't have
an xlat entry for it. Leave it alone in that case.
2020-11-03 11:30:44 +01:00
Nikita Popov 6f2431860b Preserve trait method alias name during preloading 2020-11-03 10:55:59 +01:00
Nikita Popov 0571f09424 Rename opcache.jit_max_loops_unroll to opcache.jit_max_loop_unrolls 2020-11-02 12:25:21 +01:00
Alex Dowad d44235acae Convert numeric string array keys to integers correctly in JITted code
While fixing bugs in mbstring, one of my new test cases failed with a strange
error message stating: 'Warning: Undefined array key 1...', when clearly the
array key had been set properly.

GDB'd that sucker and found that JIT'd PHP code was calling directly into
`zend_hash_add_new` (which was not converting the numeric string key to an
integer properly). But where was that code coming from? I examined the disasm,
looked up symbols to figure out where call instructions were going, then grepped
the codebase for those function names. It soon became clear that the disasm I
was looking at was compiled from `zend_jit_fetch_dim_w_helper`.
2020-10-30 22:07:08 +02:00
Nikita Popov 5958137dc5 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix SSA integrity violation for type inference in dead code
2020-10-30 15:52:46 +01:00