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

14328 Commits

Author SHA1 Message Date
Nikita Popov 080e2316cf Mark some operand fetching funs as ATTRIBUTE_UNUSED
Whether these are used depends on VM specialization.
2019-06-12 13:17:25 +02:00
Nikita Popov 93c728b77c Try to control ZEND_MM_ALIGNED_SIZE type 2019-06-12 13:17:25 +02:00
Nikita Popov f601eb15e6 Fix -Wmissing-braces warnings
Unfortunate that = {} is a GNU extension.
2019-06-12 11:54:12 +02:00
Nikita Popov 852ab5d83f Use %define api.pure instead of %pure-parser
%pure-parser is deprecated. In our case there is no difference between
true & full, as we don't use locations.
2019-06-12 09:26:34 +02:00
Nikita Popov 8f8fcbbd39 Support full variance if autoloading is used
Keep track of delayed variance obligations and check them after
linking a class is otherwise finished. Obligations may either be
unresolved method compatibility (because the necessecary classes
aren't available yet) or open parent/interface dependencies. The
latter occur because we allow the use of not fully linked classes
as parents/interfaces now.

An important aspect of the implementation is we do not require
classes involved in variance checks to be fully linked in order for
the class to be fully linked. Because the involved types do have to
exist in the class table (as partially linked classes) and we do
check these for correct variance, we have the guarantee that either
those classes will successfully link lateron or generate an error,
but there is no way to actually use them until that point and as
such no possibility of violating the variance contract. This is
important because it ensures that a class declaration always either
errors or will produce an immediately usable class afterwards --
there are no cases where the finalization of the class declaration
has to be delayed until a later time, as earlier variants of this
patch did.

Because variance checks deal with classes in various stages of
linking, we need to use a special instanceof implementation that
supports this, and also introduce finer-grained flags that tell us
which parts have been linked already and which haven't.

Class autoloading for variance checks is delayed into a separate
stage after the class is otherwise linked and before delayed
variance obligations are processed. This separation is needed to
handle cases like A extends B extends C, where B is the autoload
root, but C is required to check variance. This could end up
loading C while the class structure of B is in an inconsistent
state.
2019-06-11 13:09:33 +02:00
Nikita Popov 89b2d88659 Register class before fetching parent
We want the class declaration to be available while compiling the
parent class.
2019-06-11 13:09:33 +02:00
Nikita Popov 51fb8dc422 Add specialized pair construction API
Closes GH-3990.
2019-06-11 12:29:55 +02:00
Nikita Popov eecd8961d9 Add get_mangled_object_vars() function 2019-06-11 10:28:29 +02:00
Dmitry Stogov 374f769982 micro-optimization 2019-06-10 16:43:20 +03:00
Joe Watkins 42d60addef BIND_LEXICAL has a meaningless line number 2019-06-10 14:19:39 +02:00
Joe Watkins 006b191126 Fix #78132 wrong line number on ZEND_BIND_STATIC for lexical vars 2019-06-08 21:47:07 +02:00
Nikita Popov 7780ba9660 Try to fix Windows build 2019-06-06 14:56:42 +02:00
Dmitry Stogov 741468d145 Use ZEND_ASSUME() to perform the following check only on "slow" path. 2019-06-06 14:22:10 +03:00
Dmitry Stogov be74ca4976 Support for exceptions thrown during "Array to string conversion" error processing 2019-06-06 14:09:42 +03:00
Dmitry Stogov a95014dc10 Reduce over-specialization for quite seldom instructions 2019-06-06 13:13:09 +03:00
Dmitry Stogov 457392fa64 Cheaper checks for exceptions thrown from __toString() 2019-06-06 01:47:22 +03:00
Dmitry Stogov 90a2e4ba66 Fixed reference-counting 2019-06-06 01:40:40 +03:00
Dmitry Stogov 3f4dfe1877 Prevent generation of specialized ZEND_ASSIGN_OP_..._STATIC_PROP handlers, that call unspecialized helper, anyway. 2019-06-05 17:38:13 +03:00
Nikita Popov b964298c19 Deprecate ReflectionType::__toString()
We weren't able to do this in 7.1 because the deprecation notice
may be converted to an exception and __toString() can't throw,
which means that it ultimately become a fatal error. This issue
is resolved now, so we can mark the method as deprecated.
2019-06-05 15:33:52 +02:00
Nikita Popov a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Peter Kokot ac9ce0f895 Fixed bug #78102 2019-06-05 10:04:57 +02:00
Joe Watkins ff96f25b12 Revert "Fix bug #62397 - disable_functions does not work with eval."
This reverts commit 050d299364.
2019-06-03 11:20:12 +02:00
Nikita Popov 67b84e4548 Fixed uninitialized var warning
Causes build failure on release+zts azure build. I'm rewriting this
code to separate the if/else handling, because they don't really
have anything in common anyway...
2019-05-31 12:55:13 +02:00
Dmitry Stogov 1df9f238fe Better hot/cold code splitting 2019-05-31 12:20:21 +03:00
Dmitry Stogov 2915a32f37 Fixed compilation warning 2019-05-31 00:59:52 +03:00
Dmitry Stogov 1814308e49 Don't specialize "cold" handlers 2019-05-31 00:31:57 +03:00
Dmitry Stogov 4e567ed1da Removed useless specialization. Specialized handlers called not specialized helpers. 2019-05-31 00:15:25 +03:00
Dmitry Stogov cf388033d5 Reduce register pressure by reloading values on CPUs with few general purpose registers 2019-05-31 00:14:10 +03:00
Dmitry Stogov ee56552913 Disable "bad" optimisations only for emulation loop 2019-05-30 20:35:30 +03:00
Dmitry Stogov b06f05bf47 zend_assign_to_variable() optimization 2019-05-29 13:58:37 +03:00
Dmitry Stogov e14d77335c Mark "cold" functions 2019-05-29 11:48:41 +03:00
Derick Rethans 8ec0cf8be7 Bump API numbers 2019-05-29 09:34:10 +01:00
Dmitry Stogov 0d102515bf zend_do_fcall_overloaded() doesn't have to be exported 2019-05-29 10:32:30 +03:00
Joe Watkins cc598d1ea9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  disabled functions must not have return type
  Restore the execute bit for run-tests.php
2019-05-29 08:30:55 +02:00
Joe Watkins 6c73b2088a Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  disabled functions must not have return type
2019-05-29 08:30:41 +02:00
Joe Watkins 7821cc3b9f disabled functions must not have return type 2019-05-29 08:30:08 +02:00
Anatol Belski 08a0030b33 Fix conditional compilation
The new symbols are shared and don't need to depend on the availability
of __builtin_constant_p.
2019-05-29 02:40:09 +02:00
Anatol Belski 1a4ace05ae These macros should not expect any argument 2019-05-29 02:29:02 +02:00
Dmitry Stogov 8c0b0c6a1e Avoid cold code duplication 2019-05-29 01:43:27 +03:00
Dmitry Stogov 83804519df Replace ZVAL_COPY() and ZVAL_COPY_VALUE() for IS_OBJECT by cheaper macros 2019-05-28 20:10:02 +03:00
Dmitry Stogov b2cb6a4a27 Avoid double copying 2019-05-28 13:35:00 +03:00
Dmitry Stogov 072f28938f Put phpinfo() related code into cold code segment 2019-05-28 11:04:13 +03:00
Nikita Popov fd23f9104a BIND_STATIC of implicit binding may be undef
Even though we don't need it at runtime, add the BIND_IMPLICIT
flag to BIND_STATIC as well, so we can distinguish this case in
type inference.

This fixes a JIT miscompile in arrow_functions/002.phpt.
2019-05-27 17:12:20 +02:00
Nikita Popov e6fac86dc3 Accept flags argument in zend_lookup_class_ex()
Instead of a single boolean, so we have space for extension here.
2019-05-27 09:36:25 +02:00
Nikita Popov d7f3844c87 Deprecate use of parent where no parent exists
This deprecation is part of the covariance RFC.
2019-05-24 10:58:46 +02:00
Nikita Popov 49a3b03e9f Implement basic variance support
This is a minimal variance implementation: It does not support any
cyclic type dependencies. Additionally the preloading requirements
are much more restrictive than necessary. Hopefully we can relax
these in the future.
2019-05-24 09:30:37 +02:00
Nikita Popov afec3a9208 Avoid early-binding on unresolved types
Fixes bug #76451, and more importantly lays necessary groundwork for
covariant/contravariant types. Bug #76451 is just an edge case, but
once covariance is introduced this will become a common problem instead.
2019-05-24 09:30:13 +02:00
Nikita Popov 71ce7d32ea Merge branch 'PHP-7.3' into PHP-7.4 2019-05-23 13:41:17 +02:00
Nikita Popov 6f9dfd9473 Fix bug #77955
Free metadata before freeing the arena. I don't have a repro script,
but the added assertion fails for many existing tests prior to this
change.
2019-05-23 13:40:52 +02:00
Nikita Popov 64918c7702 Forbid use of not fully linked classes 2019-05-23 10:41:10 +02:00