Commit Graph

2626 Commits

Author SHA1 Message Date
Tyson Andre
e8d2097bdc Update opcache zend_func_info after wbmp/xml_parser changes
See UPGRADING on the master branch.

```
- GD:
  . The deprecated function image2wbmp() has been removed.
    RFC: https://wiki.php.net/rfc/image2wbmp
  . The deprecated functions png2wbmp() and jpeg2wbmp() have been removed.
    RFC: https://wiki.php.net/rfc/deprecate-png-jpeg-2wbmp
- XML:
  . xml_parser_create(_ns) will now return an XmlParser object rather than a
    resource.
```
2019-09-27 10:06:36 +02:00
Dmitry Stogov
7d7b20ea91 Don't generate useless stubs 2019-09-26 23:21:48 +03:00
Dmitry Stogov
cf33837d75 Cleanup CFG optimization 2019-09-25 17:30:59 +03:00
Nikita Popov
a369430b00 Avoid signed shift 2019-09-24 11:36:05 +02:00
Dmitry Stogov
1030ff5f5f Use cheaper code for scalar type check 2019-09-23 23:04:08 +03:00
Dmitry Stogov
6e226c188c Change ZEND_RECV and ZEND_RECV_VARIADIC to use extended_value for cache slot (instead of op2), to be consistent with ZEND_RECV_INIT. 2019-09-23 22:28:56 +03:00
Nikita Popov
9e8ba7891e Change representation of zend_type from type code to MAY_BE_* mask
This switches zend_type from storing a single IS_* type code to
storing a MAY_BE_* type mask. Right now most code still assumes
that there is only a single type in the mask (or two together
with MAY_BE_NULL). But this will make it a lot simpler to introduce
union types.

An additional advantage (and why I'm doing this separately), is
that a number of special cases no longer need to be handled
separately: We can do a single mask & (1 << type) check to handle
all simple types, booleans (true|false) and null.
2019-09-23 15:31:35 +02:00
Dmitry Stogov
ddfb3d6056 Fixed 32-bit JIT 2019-09-19 21:53:36 +03:00
Nikita Popov
edfcf2d81f Merge branch 'PHP-7.4' 2019-09-19 17:22:34 +02:00
Nikita Popov
5bee9c9062 Merge branch 'PHP-7.3' into PHP-7.4 2019-09-19 17:22:28 +02:00
Nikita Popov
85e7668129 Merge branch 'PHP-7.2' into PHP-7.3 2019-09-19 17:21:45 +02:00
Nikita Popov
003c13d7bc Fix iterable return type optimization 2019-09-19 17:21:00 +02:00
Nikita Popov
cdd4e591a4 Don't make argument nullable based on AST null initializer
Closes GH-4720.
2019-09-19 11:27:00 +02:00
Dmitry Stogov
2aefd11211 Optimize access to thread local cache.
This patch saves one CPU instruction on each "_tsrm_ls_cache" access in ZTS CLI/CGI/FPM builds.
This reduce typical instruction sequence for EG(current_execute_data) access from 4 to 3 CPU instructions.
2019-09-18 14:03:07 +03:00
Nikita Popov
8af9043766 Merge branch 'PHP-7.4' 2019-09-17 12:18:01 +02:00
Nikita Popov
62b440ffbb Merge branch 'PHP-7.3' into PHP-7.4 2019-09-17 12:09:06 +02:00
Nikita Popov
f98684b06c Merge branch 'PHP-7.2' into PHP-7.3 2019-09-17 12:08:57 +02:00
Tyson Andre
29bced9521 Fix opcache return type for get_headers in zend_func_info
https://www.php.net/manual/en/function.get-headers.php#refsect1-function.get-headers-examples
shows that it will return string keys when the second argument is
non-zero. I've verified that this is the case.

This bug was there since the initial commit in c88ffa9a56.

Closes GH-4702.
2019-09-17 12:08:29 +02:00
Christoph M. Becker
9b9fac78b0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78429: opcache_compile_file(__FILE__); segfaults
2019-09-16 16:01:49 +02:00
Christoph M. Becker
20f73d3d8f Fix #78429: opcache_compile_file(__FILE__); segfaults
We have to ensure that OPcache has been properly started up when
`opcache_compile_file()` is called.
2019-09-16 16:01:09 +02:00
Dmitry Stogov
78a890e45f Merge branch 'PHP-7.4'
* PHP-7.4:
  Make constant and copy propagation only for IS_TMP_VAR operands
2019-09-13 12:39:45 +03:00
Dmitry Stogov
af9b127fed Make constant and copy propagation only for IS_TMP_VAR operands 2019-09-13 12:38:57 +03:00
Nikita Popov
f61f122b9a Merge branch 'PHP-7.4' 2019-09-12 16:41:45 +02:00
Nikita Popov
4b9ebd837b Allow throwing exception while loading parent class
This is a fix for symfony/symfony#32995.

The behavior is:

* Throwing exception when loading parent/interface is allowed
  (and we will also throw one if the class is simply not found).
* If this happens, the bucket key for the class is reset, so
  it's possibly to try registering the same class again.
* However, if the class has already been used due to a variance
  obligation, the exception is upgraded to a fatal error, as we
  cannot safely unregister the class stub anymore.
2019-09-12 16:41:18 +02:00
Nikita Popov
c70bab7b24 Merge branch 'PHP-7.4' 2019-09-11 09:53:18 +02:00
Nikita Popov
0a24cd4e7c Preloading: Fix handling of static vars in inherited methods
Part of bug #78512.
2019-09-11 09:53:10 +02:00
Dmitry Stogov
628fd6ec71 clenup 2019-09-09 22:40:28 +03:00
Dmitry Stogov
f43fe067e9 Avoid hash value recalculation on each counter update 2019-09-09 21:25:54 +03:00
Nikita Popov
004f31c434 Merge branch 'PHP-7.4' 2019-09-09 17:19:12 +02:00
Tyson Andre
3e89e9a636 Add opcache return type for random_int()
random_int() will throw for incorrect argument counts, types (e.g. float
that can't cast to int), or having min > max.

See ext/standard/random.c
2019-09-09 17:19:04 +02:00
Tyson Andre
45e529d673 Fix opcache zend_func_info for microtime/gettimeofday
microtime() doesn't return an array,
and gettimeofday() doesn't return a string.
See _php_gettimeofday in microtime.c (mode is non-zero for gettimeofday)
2019-09-09 17:13:19 +02:00
Nikita Popov
f16ad678f7 Merge branch 'PHP-7.4' 2019-09-09 11:37:36 +02:00
Nikita Popov
36a8cf5182 Fixed bug #78514
The property class may have already been translated as part of
some other class. Only translate if xlat returns non-null.
2019-09-09 11:36:50 +02:00
Nikita Popov
ee4b11c668 Detect calls to abstract methods in get_method() already
Instead of checking for this during DO_FCALL, already detect this
case during get_method()/get_static_method(), similar to visibility
checks.

This causes a minor difference in behavior, in that arguments will
no longer be evaluated. I think this is correct though (and consistent
with visibility errors).
2019-09-06 15:05:24 +02:00
Nikita Popov
d9750ac41e Load execute_data without global regs 2019-09-05 10:46:50 +02:00
Nikita Popov
5d490742cb Fix deprecated args freeing with JIT
I'm including the logic for this rare case in the helper function
to avoid complicating the main JIT logic.
2019-09-05 10:05:46 +02:00
Nikita Popov
91b69beec8 Merge branch 'PHP-7.4' 2019-09-04 11:12:56 +02:00
Tyson Andre
94e2f25f07 Add missing opcache return types for functions in spl
(excluding spl_autoload)

spl_object_id() is of the most interest to me,
since I frequently call it in an application.

This includes false/null types caused by wrong argument types and wrong argument
counts.

I can't rule out iterator_to_array returning null in spl_iterator_apply,
so leave MAY_BE_NULL in.

With review comments by nikic:
Co-Authored-By: Nikita Popov <nikita.ppv@googlemail.com>
2019-09-04 11:12:41 +02:00
Dmitry Stogov
3be83233c3 Merge branch 'PHP-7.4'
* PHP-7.4:
  Execute preload script under user defined by opcache.preload_user directive
2019-09-03 14:23:44 +03:00
Dmitry Stogov
5dc37cc306 Execute preload script under user defined by opcache.preload_user directive 2019-09-03 14:23:13 +03:00
Nikita Popov
597a5da027 Support computing func info from ret arg info for internal funcs 2019-09-03 10:32:47 +02:00
Nikita Popov
3cca014ce4 Remove duplicate func info for array_key_first/last
Looks like this was already added in master separately...
2019-09-03 10:31:39 +02:00
Nikita Popov
d4a7d17b9a Merge branch 'PHP-7.4' 2019-09-03 09:58:29 +02:00
Tyson Andre
4de8503c22 Add missing opcache return info for ext/standard.
array_key_first/last returns null for invalid args,
wrong argument counts, and empty arrays.

random_bytes returns a string or throws.
2019-09-03 09:57:51 +02:00
Nikita Popov
d440a3cddb Merge branch 'PHP-7.4' 2019-09-03 09:53:51 +02:00
Tyson Andre
1a905bcb1e Add new missing functions from ext/hash 2019-09-03 09:53:41 +02:00
Tyson Andre
149588280b Fix opcache optimizer info for time_nanosleep (again)
Fixes my earlier PR #4617

If I remember correctly,
The F0 macro is used for return values that are guaranteed to not be
reference counted.
The F1 macro is used for return values that may have up to 1 reference
(i.e. MAY_BE_RC1).

I didn't notice that time_nanosleep needed to be F1 since it could
return an array, and that array is reference counted.
2019-09-03 09:31:01 +02:00
Nikita Popov
7f78f839dc php_stream_from_zval can no longer return false 2019-09-03 09:25:50 +02:00
Nikita Popov
3ac0f42c40 Merge branch 'PHP-7.4' 2019-09-03 09:24:20 +02:00
Nikita Popov
632708ac02 Merge branch 'PHP-7.3' into PHP-7.4 2019-09-03 09:24:05 +02:00