1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 23:18:13 +02:00
Commit Graph

739 Commits

Author SHA1 Message Date
Dmitry Stogov 828f6806f3 Merge branch 'PHP-8.0'
* PHP-8.0:
  Bug #80447 (Strange out of memory error when running with JIT)
2020-12-01 16:43:41 +03:00
Dmitry Stogov 1674c96c0b Bug #80447 (Strange out of memory error when running with JIT) 2020-12-01 16:43:05 +03:00
Dmitry Stogov c3a6cf01af Merge branch 'PHP-8.0'
* PHP-8.0:
  Skip test if JIT is not available
2020-12-01 09:59:25 +03:00
Dmitry Stogov 31eafedf2e Skip test if JIT is not available 2020-12-01 09:58:33 +03:00
Dmitry Stogov 034270d69a Merge branch 'PHP-8.0'
* PHP-8.0:
  Disable JIT with incompatible third-party extensions
2020-11-30 13:59:33 +03:00
Dmitry Stogov d5a82e2c4e Disable JIT with incompatible third-party extensions 2020-11-30 13:58:34 +03:00
Nikita Popov 89891d75c3 Merge branch 'PHP-8.0'
* PHP-8.0:
  Only replace IN_ARRAY result type for JMPZ/JMPNZ
2020-11-30 11:19:13 +01:00
Nikita Popov fdb05b92bf Only replace IN_ARRAY result type for JMPZ/JMPNZ
Replacing the result type in the general case is dangerous,
because not all opcodes support both VAR and TMP. One common case
is the in_array() result being passed to SEND_VAR, which would
have to be changed to SEND_VAL.

Rather than complicating this logic, reduce the scope to only
doing the type replacement for JMPZ and JMPNZ. The only reason
we're doing this in the first place is to enable the smart branch
optimization, so we can limit it to the relevant opcodes. Replacing
the result type may be marginally useful in other cases as well
(as it may avoid reference checks), but not worth the bother.
2020-11-30 11:18:21 +01:00
Nikita Popov 236eb60e96 Merge branch 'PHP-8.0'
* PHP-8.0:
  Respect strict_types during sccp function call evaluation
2020-11-27 20:24:25 +01:00
Nikita Popov 5b3809e942 Respect strict_types during sccp function call evaluation
Similar to what we do with attributes, add a dummy call frame
on which we can set the strict_types flag.
2020-11-27 20:24:00 +01:00
Tyson Andre 74f4586540 Remove duplicate str_split check, fix test expectation 2020-11-27 12:21:54 -05:00
Nikita Popov 30c89166ec Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix handling of sccp exceptions
2020-11-27 17:44:48 +01:00
Nikita Popov a505fc627e Fix handling of sccp exceptions
We should clear the exception *before* we destroy the execute_data.
Add a variation of the test that indirects through another file,
and would crash otherwise.
2020-11-27 17:44:30 +01:00
Nikita Popov 46428a843c Merge branch 'PHP-8.0'
* PHP-8.0:
  Handle exceptions during SCCP function evaluation
2020-11-27 17:01:48 +01:00
Nikita Popov e5aae35855 Handle exceptions during SCCP function evaluation
Easier to handle them than to ensure they can't happen in the
first place.
2020-11-27 17:00:12 +01:00
Nikita Popov 877fa6b8a6 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #80433
2020-11-27 10:52:21 +01:00
Nikita Popov 48ff654fb9 Fixed bug #80433
Use ZEND_STRTOL to allow leading zeros in opcache.jit option.
2020-11-27 10:51:57 +01:00
Dmitry Stogov fa7af81c22 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed trampoline handling
2020-11-17 23:56:39 +03:00
Dmitry Stogov 9841e8e411 Fixed trampoline handling 2020-11-17 23:56:05 +03:00
Dmitry Stogov 849b9e2bcd Merge branch 'PHP-8.0'
* PHP-8.0:
  Trampoline cleanup
2020-11-16 12:06:09 +03:00
Dmitry Stogov 64dc79f906 Trampoline cleanup 2020-11-16 12:05:45 +03:00
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
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
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
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 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 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