1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 19:23:22 +02:00
Commit Graph

3669 Commits

Author SHA1 Message Date
Nikita Popov 4945bc2609 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix phi use chain management when renaming variable
2020-11-09 17:08:46 +01: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 13a8f3b30f Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed missaligned access
2020-11-09 11:50:51 +03:00
Dmitry Stogov 4bbe55b250 Fixed missaligned access 2020-11-09 11:50:26 +03:00
Nikita Popov 6033c77653 Merge branch 'PHP-8.0'
* PHP-8.0:
  Skip preload test under asan
2020-11-09 09:47:12 +01: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 668ac03ca4 Merge branch 'PHP-8.0'
* PHP-8.0:
  Move stack overflow checks out of the loops
2020-11-06 12:10:28 +03: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 5cd88ccddb Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed incorrect invariant guard motion
2020-11-05 18:32:46 +03:00
Dmitry Stogov ff91800602 Fixed incorrect invariant guard motion 2020-11-05 18:32:00 +03:00
Nikita Popov 046143859d Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixup trait methods even if no traits are used
2020-11-05 13:16:31 +01: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 1fea175765 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix multiple trait fixup
2020-11-05 12:11:20 +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 313a56add0 Merge branch 'PHP-8.0'
* PHP-8.0:
  End output handlers in preload shutdown
2020-11-04 16:05:48 +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 c380812ed2 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix static variable in methods inheritance during preloading
2020-11-04 15:43:00 +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 80e063c28e Merge branch 'PHP-8.0'
* PHP-8.0:
  Assert that references are not persisted
2020-11-04 14:52:47 +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 6457043a75 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix dynamic function definition in preload script
2020-11-04 10:56:24 +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 b43c455b98 Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't disable early binding during preloading script
2020-11-03 16:47:42 +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 d0a07cd0fa Merge branch 'PHP-8.0'
* PHP-8.0:
  Report parse errors during preloading
2020-11-03 16:25:08 +01:00
Nikita Popov b009573f4e Report parse errors during preloading 2020-11-03 16:24:54 +01:00
Nikita Popov 8d43896013 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix use of type copy ctor when importing trait properties
2020-11-03 15:30:00 +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 fa7272780b Merge branch 'PHP-8.0'
* PHP-8.0:
  Allow unlinked classes when performing in_compilation variance check
2020-11-03 14:50:15 +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 b4b91a8240 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix variance checks on resolved union types
2020-11-03 14:19:53 +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 fa15f03241 Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't ignore internal classes during preloading
2020-11-03 11:51:29 +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 a600443190 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix persisting property info table with internal parent
2020-11-03 11:31:58 +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 ac5486b832 Merge branch 'PHP-8.0'
* PHP-8.0:
  Preserve trait method alias name during preloading
2020-11-03 10:57:01 +01:00
Nikita Popov 6f2431860b Preserve trait method alias name during preloading 2020-11-03 10:55:59 +01:00
Nikita Popov d5dff02e72 Merge branch 'PHP-8.0'
* PHP-8.0:
  Rename opcache.jit_max_loops_unroll to opcache.jit_max_loop_unrolls
2020-11-02 12:25:28 +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 e2dc80b4e4 Merge branch 'PHP-8.0' 2020-10-30 22:07:41 +02: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 1b3b430f47 Add --repeat testing mode
This testing mode executes the test multiple times in the same
process (but in different requests). It is primarily intended to
catch tracing JIT bugs, but also catches state leaks across
requests.

Closes GH-6365.
2020-10-30 17:29:33 +01:00
Nikita Popov 3e2b127e63 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix SSA integrity violation for type inference in dead code
2020-10-30 15:52:59 +01: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
Nikita Popov 83738281eb Fix SSA integrity violation for type inference in dead code
The foreach body can never be executed and thus may contain empty
types. We should still uphold our SSA integrity invariants in that
case.
2020-10-30 15:52:10 +01:00
Dmitry Stogov fab8ef62ff Merge branch 'PHP-8.0'
* PHP-8.0:
  Create TSSA loops for recursive call/return traces and move invariant type guards out of loops.
2020-10-30 13:10:08 +03:00